mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-28 20:40:55 +00:00
feat: integrate eTradeInfo component for auto-filling company information and enhance TIN input handling
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { Injectable, BadRequestException } from "@nestjs/common";
|
||||
import { HttpService } from "@nestjs/axios";
|
||||
import { Agent } from "https";
|
||||
import { firstValueFrom } from "rxjs";
|
||||
import {
|
||||
ETradeCompanyInfo,
|
||||
@@ -12,6 +13,14 @@ export class ETradeService {
|
||||
private readonly baseUrl = "https://etrade.gov.et/api";
|
||||
private readonly referer = "https://etrade.gov.et/business-license-checker";
|
||||
|
||||
/**
|
||||
* The eTrade server serves an incomplete TLS chain (it omits the intermediate
|
||||
* CA cert), so Node rejects the handshake with UNABLE_TO_GET_ISSUER_CERT.
|
||||
* Scope a relaxed agent to these outbound calls only — the rest of the app
|
||||
* keeps full certificate verification.
|
||||
*/
|
||||
private readonly httpsAgent = new Agent({ rejectUnauthorized: false });
|
||||
|
||||
constructor(private readonly httpService: HttpService) {}
|
||||
|
||||
async getCompanyInfoByTin(tin: string): Promise<ETradeCompanyInfo> {
|
||||
@@ -20,6 +29,7 @@ export class ETradeService {
|
||||
const response = await firstValueFrom(
|
||||
this.httpService.get<ETradeCompanyInfo>(url, {
|
||||
headers: { Referer: this.referer },
|
||||
httpsAgent: this.httpsAgent,
|
||||
}),
|
||||
);
|
||||
return response.data;
|
||||
@@ -44,6 +54,7 @@ export class ETradeService {
|
||||
Lang: "en",
|
||||
},
|
||||
headers: { Referer: this.referer },
|
||||
httpsAgent: this.httpsAgent,
|
||||
}),
|
||||
);
|
||||
return response.data;
|
||||
|
||||
Reference in New Issue
Block a user