@fiado/api-invoker 1.2.61 → 1.2.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +64 -64
- package/bin/cognitoConnector/interfaces/ICognitoConnectorApiV2.d.ts +46 -0
- package/bin/cognitoConnector/interfaces/ICognitoConnectorApiV2.js +2 -0
- package/bin/service-business/ServiceApi.d.ts +7 -5
- package/bin/service-business/ServiceApi.js +4 -0
- package/bin/service-business/interfaces/IServiceApi.d.ts +7 -5
- package/package.json +27 -27
- package/src/account-beneficiary/AccountBeneficiaryApi.ts +18 -18
- package/src/account-beneficiary/index.ts +2 -2
- package/src/account-beneficiary/interfaces/IAccountBeneficiaryApi.ts +7 -7
- package/src/account-fiadoinc/AccountFiadoIncApi.ts +73 -73
- package/src/account-fiadoinc/index.ts +1 -1
- package/src/account-fiadoinc/interfaces/IAccountFiadoIncApi.ts +36 -36
- package/src/account-fiadosa/AccountFiadoSAApi.ts +37 -37
- package/src/account-fiadosa/index.ts +1 -1
- package/src/account-fiadosa/interfaces/IAccountFiadoSAApi.ts +15 -15
- package/src/account-pagoconfiado/AccountPagoConfiadoApi.ts +46 -46
- package/src/account-pagoconfiado/index.ts +2 -2
- package/src/account-pagoconfiado/interfaces/IAccountPagoConfiadoApi.ts +24 -24
- package/src/activity-business/ActivityApi.ts +36 -36
- package/src/activity-business/index.ts +5 -5
- package/src/activity-business/interfaces/IActivityApi.ts +13 -13
- package/src/activity-business/queue/ActivityPublisher.ts +28 -28
- package/src/activity-business/queue/IActivityPublisher.ts +4 -4
- package/src/address/AddressApi.ts +46 -46
- package/src/address/index.ts +3 -3
- package/src/address/interfaces/IAddressApi.ts +30 -30
- package/src/authentication/AuthenticationApi.ts +16 -16
- package/src/authentication/index.ts +4 -4
- package/src/authentication/interfaces/IAuthenticationApi.ts +5 -5
- package/src/bankAccount/BankAccountApi.ts +48 -48
- package/src/bankAccount/index.ts +1 -1
- package/src/bankAccount/interfaces/IBankAccountApi.ts +6 -6
- package/src/bbvaRst/api/BBVARstApi.ts +16 -16
- package/src/bbvaRst/api/interfaces/IBBVARstApi.ts +4 -4
- package/src/bbvaRst/index.ts +1 -1
- package/src/blacklist/BlackListApi.ts +19 -19
- package/src/blacklist/index.ts +2 -2
- package/src/blacklist/interfaces/IBlackListApi.ts +20 -20
- package/src/card/CardApi.ts +53 -53
- package/src/card/index.ts +3 -3
- package/src/card/interfaces/ICardApi.ts +16 -16
- package/src/centralPayments/CentralPaymentsConnectorApi.ts +183 -183
- package/src/centralPayments/index.ts +1 -1
- package/src/centralPayments/interfaces/ICentralPaymentsConnectorApi.ts +85 -85
- package/src/cnbv-business/CnbvApi.ts +22 -22
- package/src/cnbv-business/index.ts +4 -4
- package/src/cnbv-business/interfaces/ICnbvApi.ts +6 -6
- package/src/cognitoConnector/CognitoConnectorApi.ts +106 -106
- package/src/cognitoConnector/CognitoConnectorV2.ts +81 -81
- package/src/cognitoConnector/index.ts +11 -11
- package/src/cognitoConnector/interfaces/ICognitoConnectorApi.ts +15 -15
- package/src/cognitoConnector/interfaces/ICognitoV2Api.ts +58 -58
- package/src/collector/CollectorApi.ts +25 -25
- package/src/collector/index.ts +2 -2
- package/src/collector/interfaces/ICollectorApi.ts +21 -21
- package/src/contactInformation/ContactInformationApi.ts +20 -20
- package/src/contactInformation/index.ts +2 -2
- package/src/contactInformation/interface/IContactInformationApi.ts +8 -8
- package/src/container.config.ts +126 -126
- package/src/contract-generator/ContractGeneratorApi.ts +18 -18
- package/src/contract-generator/index.ts +2 -2
- package/src/contract-generator/interfaces/IContractGeneratorApi.ts +16 -16
- package/src/device/DeviceApi.ts +23 -23
- package/src/device/index.ts +2 -2
- package/src/device/interfaces/IDeviceApi.ts +24 -24
- package/src/directories/DirectoriesApi.ts +53 -53
- package/src/directories/index.ts +3 -3
- package/src/directories/interfaces/IDirectoriesApi.ts +16 -16
- package/src/directory/DirectoryApi.ts +150 -150
- package/src/directory/index.ts +3 -3
- package/src/directory/interfaces/IDirectoryApi.ts +69 -69
- package/src/disputes/DisputesApi.ts +50 -50
- package/src/disputes/index.ts +2 -2
- package/src/disputes/interfaces/IDisputesApi.ts +54 -54
- package/src/exchangeRates/ExchangeRatesApi.ts +27 -27
- package/src/exchangeRates/index.ts +1 -1
- package/src/exchangeRates/interfaces/IExchangeRatesApi.ts +8 -8
- package/src/fiadoMessages/api/FiadoMessagesApi.ts +20 -20
- package/src/fiadoMessages/api/interfaces/IFiadoMessagesApi.ts +2 -2
- package/src/fiadoMessages/index.ts +1 -1
- package/src/fraudPreventionEngine/api/FraudPreventionEngineApi.ts +22 -22
- package/src/fraudPreventionEngine/api/interfaces/IFraudPreventionEngineApi.ts +7 -7
- package/src/fraudPreventionEngine/index.ts +1 -1
- package/src/group/GroupApi.ts +24 -24
- package/src/group/index.ts +1 -1
- package/src/group/interfaces/IGroupApi.ts +23 -23
- package/src/identity/IdentityApi.ts +78 -78
- package/src/identity/index.ts +3 -3
- package/src/identity/interfaces/IIdentityApi.ts +38 -38
- package/src/index.ts +41 -41
- package/src/legalDocument/api/LegalDocumentApi.ts +26 -26
- package/src/legalDocument/api/interfaces/ILegalDocumentApi.ts +6 -6
- package/src/legalDocument/index.ts +3 -3
- package/src/notificationMessages/index.ts +1 -1
- package/src/notificationMessages/queue/NotificationMessagePublisher.ts +22 -22
- package/src/notificationMessages/queue/interfaces/INotificationMessagesPublisher.ts +4 -4
- package/src/observations/ObservationsApi.ts +23 -23
- package/src/observations/index.ts +3 -3
- package/src/observations/interfaces/IObservationsApi.ts +9 -9
- package/src/p2pContact/api/P2pContactApi.ts +19 -19
- package/src/p2pContact/api/interfaces/IP2pContactApi.ts +4 -4
- package/src/p2pContact/index.ts +1 -1
- package/src/pomelo/api/PomeloApi.ts +99 -99
- package/src/pomelo/api/interfaces/IPomeloApi.ts +27 -27
- package/src/pomelo/index.ts +1 -1
- package/src/pomeloProcessor/api/PomeloProcessorApi.ts +17 -17
- package/src/pomeloProcessor/api/interfaces/IPomeloProcessorApi.ts +2 -2
- package/src/pomeloProcessor/index.ts +2 -2
- package/src/product-catalog/ProductCatalogApi.ts +17 -17
- package/src/product-catalog/index.ts +1 -1
- package/src/product-catalog/interfaces/IProductCatalogApi.ts +6 -6
- package/src/riskProfile/api/RiskProfileApi.ts +39 -39
- package/src/riskProfile/api/TransactionAlertApi.ts +22 -22
- package/src/riskProfile/api/interfaces/IRiskProfileApi.ts +14 -14
- package/src/riskProfile/api/interfaces/ITransactionAlertApi.ts +7 -7
- package/src/riskProfile/index.ts +7 -7
- package/src/riskProfile/queue/TransactionAlarmPublisher.ts +24 -24
- package/src/riskProfile/queue/interfaces/ITransactionAlarmPublisher.ts +4 -4
- package/src/service-business/ServiceApi.ts +66 -60
- package/src/service-business/index.ts +2 -2
- package/src/service-business/interfaces/IServiceApi.ts +48 -44
- package/src/sessionActivity/index.ts +2 -2
- package/src/sessionActivity/queue/SessionActivityPublisher.ts +22 -22
- package/src/sessionActivity/queue/interfaces/ISessionActivityPublisher.ts +4 -4
- package/src/stpAccount/api/STPAccountApi.ts +111 -111
- package/src/stpAccount/api/interfaces/ISTPAccountApi.ts +7 -7
- package/src/stpAccount/index.ts +1 -1
- package/src/stpServicePayment/api/StpServicePaymentApi.ts +40 -40
- package/src/stpServicePayment/api/interfaces/IStpServicePaymentApi.ts +13 -13
- package/src/stpServicePayment/index.ts +1 -1
- package/src/stpSpei/api/StpSpeiApi.ts +32 -32
- package/src/stpSpei/api/interfaces/IStpSpeiApi.ts +6 -6
- package/src/stpSpei/index.ts +1 -1
- package/src/tern/api/TernApi.ts +147 -147
- package/src/tern/api/interfaces/ITernApi.ts +47 -47
- package/src/tern/index.ts +1 -1
- package/src/transaction/api/TransactionApi.ts +92 -92
- package/src/transaction/api/interfaces/ITransactionApi.ts +35 -35
- package/src/transaction/index.ts +5 -5
- package/src/transaction/queue/TransactionPublisher.ts +24 -24
- package/src/transaction/queue/interfaces/ITransactionPublisher.ts +4 -4
- package/src/transactionProcessor/api/TransactionProcessorApi.ts +42 -42
- package/src/transactionProcessor/api/interfaces/ITransactionProcessorApi.ts +18 -18
- package/src/transactionProcessor/index.ts +1 -1
- package/src/utils/InvokerUtils.ts +18 -18
- package/src/zendesk/ZendeskApi.ts +24 -24
- package/src/zendesk/index.ts +3 -3
- package/src/zendesk/interfaces/IZendeskApi.ts +10 -10
- package/tsconfig.json +21 -21
|
@@ -1,184 +1,184 @@
|
|
|
1
|
-
import { ICentralPaymentsConnectorApi } from "./interfaces/ICentralPaymentsConnectorApi";
|
|
2
|
-
import { inject, injectable } from "inversify";
|
|
3
|
-
import { IHttpRequest } from "@fiado/http-client";
|
|
4
|
-
import {
|
|
5
|
-
CreateBankAccountUserRequest,
|
|
6
|
-
CreateBankAccountUserResponse, GetBankAccountResponse,
|
|
7
|
-
GetBankAccountUserResponse,
|
|
8
|
-
UpdateBankAccountUserRequest
|
|
9
|
-
} from "@fiado/type-kit/bin/account";
|
|
10
|
-
import {
|
|
11
|
-
CentralPaymentsDocumentUploadRequest,
|
|
12
|
-
HealthcheckResponse,
|
|
13
|
-
OOWQuestionsResponse,
|
|
14
|
-
SubmitOOWQuestionAnswersRequest
|
|
15
|
-
} from "@fiado/type-kit/bin/centralPayments";
|
|
16
|
-
import {
|
|
17
|
-
ActivateBankAccountCardRequest,
|
|
18
|
-
ActivateBankAccountCardResponse,
|
|
19
|
-
CardBatchRequest,
|
|
20
|
-
CardBatchResponse,
|
|
21
|
-
CardStatementListResponse,
|
|
22
|
-
GetBankAccountCardBalanceResponse,
|
|
23
|
-
GetBankAccountCardResponse,
|
|
24
|
-
StatementDocumentResponse,
|
|
25
|
-
UpdateBankAccountCardRequest,
|
|
26
|
-
UpdateBankAccountCardResponse
|
|
27
|
-
} from "@fiado/type-kit/bin/card";
|
|
28
|
-
import FiadoApiResponse from "@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse";
|
|
29
|
-
import {
|
|
30
|
-
CentralPaymentsQueryParams,
|
|
31
|
-
CentralPaymentsTransactionItem,
|
|
32
|
-
TransactionListResponse
|
|
33
|
-
} from "@fiado/type-kit/bin/transaction";
|
|
34
|
-
import { InvokerUtils } from "../utils/InvokerUtils";
|
|
35
|
-
|
|
36
|
-
@injectable()
|
|
37
|
-
export class CentralPaymentsConnectorApi implements ICentralPaymentsConnectorApi {
|
|
38
|
-
private readonly baseUrl = process.env.CENTRAL_PAYMENTS_LAMBDA_URL || "";
|
|
39
|
-
|
|
40
|
-
constructor(
|
|
41
|
-
@inject("IHttpRequest") private readonly httpRequest: IHttpRequest,
|
|
42
|
-
@inject("InvokerUtils") private readonly _invokerUtils: InvokerUtils,
|
|
43
|
-
) {
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/* HEALTHCHECK */
|
|
47
|
-
async healthcheck(): Promise<FiadoApiResponse<HealthcheckResponse>> {
|
|
48
|
-
const url = `${this.baseUrl}/healthcheck`;
|
|
49
|
-
return await this.httpRequest.get(url);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/* CARDHOLDERS */
|
|
53
|
-
|
|
54
|
-
async createCardholder(request: CreateBankAccountUserRequest): Promise<FiadoApiResponse<CreateBankAccountUserResponse>> {
|
|
55
|
-
const url = `${this.baseUrl}/cardholders`;
|
|
56
|
-
return await this.httpRequest.post(url, request);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
async getCardholder(externalUserId: string): Promise<FiadoApiResponse<GetBankAccountUserResponse>> {
|
|
60
|
-
const url = `${this.baseUrl}/cardholders/${externalUserId}`;
|
|
61
|
-
return await this.httpRequest.get(url);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
async updateCardholder(externalUserId: string, request: UpdateBankAccountUserRequest): Promise<FiadoApiResponse<GetBankAccountUserResponse>> {
|
|
65
|
-
const url = `${this.baseUrl}/cardholders/${externalUserId}`;
|
|
66
|
-
return await this.httpRequest.put(url, request);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
async deleteCardholder(externalUserId: string): Promise<FiadoApiResponse<null>> {
|
|
70
|
-
const url = `${this.baseUrl}/cardholders/${externalUserId}`;
|
|
71
|
-
return await this.httpRequest.delete(url);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/* KYC DOCUMENTS */
|
|
75
|
-
async getOOWQuestions(externalUserId: string): Promise<FiadoApiResponse<OOWQuestionsResponse[]>> {
|
|
76
|
-
const url = `${this.baseUrl}/kyc/${externalUserId}/oow/questions`;
|
|
77
|
-
return await this.httpRequest.get(url);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
async submitOOWQuestionAnswers(externalUserId: string, request: SubmitOOWQuestionAnswersRequest[]): Promise<FiadoApiResponse<GetBankAccountUserResponse>> {
|
|
81
|
-
const url = `${this.baseUrl}/kyc/${externalUserId}/oow/questions`;
|
|
82
|
-
return await this.httpRequest.post(url, request);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
async uploadDocuments(externalUserId: string, request: CentralPaymentsDocumentUploadRequest): Promise<FiadoApiResponse<null>> {
|
|
86
|
-
const url = `${this.baseUrl}/kyc/${externalUserId}/documents/upload`;
|
|
87
|
-
return await this.httpRequest.post(url, request);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/* CARDS */
|
|
91
|
-
async changePin(request: UpdateBankAccountCardRequest): Promise<FiadoApiResponse<UpdateBankAccountCardResponse>> {
|
|
92
|
-
const url = `${this.baseUrl}/cards/pin/change`;
|
|
93
|
-
return await this.httpRequest.post(url, request);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
async getCardsById(externalCardId: string): Promise<FiadoApiResponse<GetBankAccountCardResponse>> {
|
|
97
|
-
const url = `${this.baseUrl}/cards/${externalCardId}`;
|
|
98
|
-
return await this.httpRequest.get(url);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
async getCardSensitiveInformation(externalCardId: string): Promise<FiadoApiResponse<GetBankAccountCardResponse>> {
|
|
102
|
-
const url = `${this.baseUrl}/cards/${externalCardId}/sensitive`;
|
|
103
|
-
return await this.httpRequest.get(url);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
async activateCard(request: ActivateBankAccountCardRequest): Promise<FiadoApiResponse<ActivateBankAccountCardResponse>> {
|
|
107
|
-
const url = `${this.baseUrl}/cards/${request.externalCardId}/activate`;
|
|
108
|
-
return await this.httpRequest.post(url, request);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
async getCardBalance(externalCardId: string): Promise<FiadoApiResponse<GetBankAccountCardBalanceResponse>> {
|
|
112
|
-
const url = `${this.baseUrl}/cards/${externalCardId}/balance`;
|
|
113
|
-
return await this.httpRequest.get(url);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
async updateCard(request: UpdateBankAccountCardRequest): Promise<FiadoApiResponse<GetBankAccountCardResponse>> {
|
|
117
|
-
const url = `${this.baseUrl}/cards/${request.cardId}/status/${request.status}`;
|
|
118
|
-
return await this.httpRequest.put(url);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
async updateCardProgram(externalCardId: string, programId: string): Promise<FiadoApiResponse<GetBankAccountCardResponse>> {
|
|
122
|
-
const url = `${this.baseUrl}/cards/${externalCardId}/programs/${programId}`;
|
|
123
|
-
return await this.httpRequest.put(url);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
async orderPhysicalCard(externalUserId: string): Promise<FiadoApiResponse<GetBankAccountCardResponse>> {
|
|
127
|
-
const url = `${this.baseUrl}/cards/physical/order/${externalUserId}`;
|
|
128
|
-
return await this.httpRequest.put(url);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
async createSecondaryCard(externalUserId: string): Promise<FiadoApiResponse<GetBankAccountCardResponse>> {
|
|
132
|
-
const url = `${this.baseUrl}/cards/cardholders/${externalUserId}/secondary`;
|
|
133
|
-
return await this.httpRequest.put(url);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
async getCardsByUserId(externalUserId: string, includeSecondary?: boolean): Promise<FiadoApiResponse<GetBankAccountCardResponse[]>> {
|
|
137
|
-
const url = `${this.baseUrl}/cards/cardholders/${externalUserId}`;
|
|
138
|
-
const param = includeSecondary ? `?includeSecondary=${includeSecondary}` : null;
|
|
139
|
-
return await this.httpRequest.get(`${url}${param ?? ""}`);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
async getAccountsByUserId(externalUserId: string): Promise<FiadoApiResponse<GetBankAccountResponse[]>> {
|
|
143
|
-
const url = `${this.baseUrl}/cardholders/${externalUserId}/accounts`;
|
|
144
|
-
return await this.httpRequest.get(url);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
async generateCardsInBatch(request: CardBatchRequest): Promise<FiadoApiResponse<CardBatchResponse>> {
|
|
148
|
-
const url = `${this.baseUrl}/cards/batch`;
|
|
149
|
-
return await this.httpRequest.post(url, request);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
async getCardBatch(batchId: string): Promise<FiadoApiResponse<CardBatchResponse>> {
|
|
153
|
-
const url = `${this.baseUrl}/cards/batch/${batchId}`;
|
|
154
|
-
return await this.httpRequest.get(url);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
async deleteCardBatch(batchId: string): Promise<FiadoApiResponse<CardBatchResponse>> {
|
|
158
|
-
const url = `${this.baseUrl}/cards/batch/${batchId}`;
|
|
159
|
-
return await this.httpRequest.delete(url);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
/* STATEMENTS */
|
|
163
|
-
async getStatementsList(externalCardId: string): Promise<FiadoApiResponse<CardStatementListResponse[]>> {
|
|
164
|
-
const url = `${this.baseUrl}/statements/cards/${externalCardId}`;
|
|
165
|
-
return await this.httpRequest.get(url);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
async getStatementDocument(statementId: string): Promise<FiadoApiResponse<StatementDocumentResponse>> {
|
|
169
|
-
const url = `${this.baseUrl}/statements/document-url/${statementId}`;
|
|
170
|
-
return await this.httpRequest.get(url);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/* TRANSACTIONS */
|
|
174
|
-
async getTransactionHistory(externalCardId: string, params: CentralPaymentsQueryParams): Promise<FiadoApiResponse<TransactionListResponse<CentralPaymentsTransactionItem>>> {
|
|
175
|
-
const queryParams: string = this._invokerUtils.toQueryStringParameters(params);
|
|
176
|
-
const url = `${this.baseUrl}/transactions/history/${externalCardId}?${queryParams}`;
|
|
177
|
-
return await this.httpRequest.get(url);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
async getTransactionDetails(externalTransactionId: string): Promise<FiadoApiResponse<CentralPaymentsTransactionItem>> {
|
|
181
|
-
const url = `${this.baseUrl}/transactions/${externalTransactionId}`;
|
|
182
|
-
return await this.httpRequest.get(url);
|
|
183
|
-
}
|
|
1
|
+
import { ICentralPaymentsConnectorApi } from "./interfaces/ICentralPaymentsConnectorApi";
|
|
2
|
+
import { inject, injectable } from "inversify";
|
|
3
|
+
import { IHttpRequest } from "@fiado/http-client";
|
|
4
|
+
import {
|
|
5
|
+
CreateBankAccountUserRequest,
|
|
6
|
+
CreateBankAccountUserResponse, GetBankAccountResponse,
|
|
7
|
+
GetBankAccountUserResponse,
|
|
8
|
+
UpdateBankAccountUserRequest
|
|
9
|
+
} from "@fiado/type-kit/bin/account";
|
|
10
|
+
import {
|
|
11
|
+
CentralPaymentsDocumentUploadRequest,
|
|
12
|
+
HealthcheckResponse,
|
|
13
|
+
OOWQuestionsResponse,
|
|
14
|
+
SubmitOOWQuestionAnswersRequest
|
|
15
|
+
} from "@fiado/type-kit/bin/centralPayments";
|
|
16
|
+
import {
|
|
17
|
+
ActivateBankAccountCardRequest,
|
|
18
|
+
ActivateBankAccountCardResponse,
|
|
19
|
+
CardBatchRequest,
|
|
20
|
+
CardBatchResponse,
|
|
21
|
+
CardStatementListResponse,
|
|
22
|
+
GetBankAccountCardBalanceResponse,
|
|
23
|
+
GetBankAccountCardResponse,
|
|
24
|
+
StatementDocumentResponse,
|
|
25
|
+
UpdateBankAccountCardRequest,
|
|
26
|
+
UpdateBankAccountCardResponse
|
|
27
|
+
} from "@fiado/type-kit/bin/card";
|
|
28
|
+
import FiadoApiResponse from "@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse";
|
|
29
|
+
import {
|
|
30
|
+
CentralPaymentsQueryParams,
|
|
31
|
+
CentralPaymentsTransactionItem,
|
|
32
|
+
TransactionListResponse
|
|
33
|
+
} from "@fiado/type-kit/bin/transaction";
|
|
34
|
+
import { InvokerUtils } from "../utils/InvokerUtils";
|
|
35
|
+
|
|
36
|
+
@injectable()
|
|
37
|
+
export class CentralPaymentsConnectorApi implements ICentralPaymentsConnectorApi {
|
|
38
|
+
private readonly baseUrl = process.env.CENTRAL_PAYMENTS_LAMBDA_URL || "";
|
|
39
|
+
|
|
40
|
+
constructor(
|
|
41
|
+
@inject("IHttpRequest") private readonly httpRequest: IHttpRequest,
|
|
42
|
+
@inject("InvokerUtils") private readonly _invokerUtils: InvokerUtils,
|
|
43
|
+
) {
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* HEALTHCHECK */
|
|
47
|
+
async healthcheck(): Promise<FiadoApiResponse<HealthcheckResponse>> {
|
|
48
|
+
const url = `${this.baseUrl}/healthcheck`;
|
|
49
|
+
return await this.httpRequest.get(url);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/* CARDHOLDERS */
|
|
53
|
+
|
|
54
|
+
async createCardholder(request: CreateBankAccountUserRequest): Promise<FiadoApiResponse<CreateBankAccountUserResponse>> {
|
|
55
|
+
const url = `${this.baseUrl}/cardholders`;
|
|
56
|
+
return await this.httpRequest.post(url, request);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async getCardholder(externalUserId: string): Promise<FiadoApiResponse<GetBankAccountUserResponse>> {
|
|
60
|
+
const url = `${this.baseUrl}/cardholders/${externalUserId}`;
|
|
61
|
+
return await this.httpRequest.get(url);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
async updateCardholder(externalUserId: string, request: UpdateBankAccountUserRequest): Promise<FiadoApiResponse<GetBankAccountUserResponse>> {
|
|
65
|
+
const url = `${this.baseUrl}/cardholders/${externalUserId}`;
|
|
66
|
+
return await this.httpRequest.put(url, request);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
async deleteCardholder(externalUserId: string): Promise<FiadoApiResponse<null>> {
|
|
70
|
+
const url = `${this.baseUrl}/cardholders/${externalUserId}`;
|
|
71
|
+
return await this.httpRequest.delete(url);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* KYC DOCUMENTS */
|
|
75
|
+
async getOOWQuestions(externalUserId: string): Promise<FiadoApiResponse<OOWQuestionsResponse[]>> {
|
|
76
|
+
const url = `${this.baseUrl}/kyc/${externalUserId}/oow/questions`;
|
|
77
|
+
return await this.httpRequest.get(url);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
async submitOOWQuestionAnswers(externalUserId: string, request: SubmitOOWQuestionAnswersRequest[]): Promise<FiadoApiResponse<GetBankAccountUserResponse>> {
|
|
81
|
+
const url = `${this.baseUrl}/kyc/${externalUserId}/oow/questions`;
|
|
82
|
+
return await this.httpRequest.post(url, request);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
async uploadDocuments(externalUserId: string, request: CentralPaymentsDocumentUploadRequest): Promise<FiadoApiResponse<null>> {
|
|
86
|
+
const url = `${this.baseUrl}/kyc/${externalUserId}/documents/upload`;
|
|
87
|
+
return await this.httpRequest.post(url, request);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* CARDS */
|
|
91
|
+
async changePin(request: UpdateBankAccountCardRequest): Promise<FiadoApiResponse<UpdateBankAccountCardResponse>> {
|
|
92
|
+
const url = `${this.baseUrl}/cards/pin/change`;
|
|
93
|
+
return await this.httpRequest.post(url, request);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
async getCardsById(externalCardId: string): Promise<FiadoApiResponse<GetBankAccountCardResponse>> {
|
|
97
|
+
const url = `${this.baseUrl}/cards/${externalCardId}`;
|
|
98
|
+
return await this.httpRequest.get(url);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
async getCardSensitiveInformation(externalCardId: string): Promise<FiadoApiResponse<GetBankAccountCardResponse>> {
|
|
102
|
+
const url = `${this.baseUrl}/cards/${externalCardId}/sensitive`;
|
|
103
|
+
return await this.httpRequest.get(url);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
async activateCard(request: ActivateBankAccountCardRequest): Promise<FiadoApiResponse<ActivateBankAccountCardResponse>> {
|
|
107
|
+
const url = `${this.baseUrl}/cards/${request.externalCardId}/activate`;
|
|
108
|
+
return await this.httpRequest.post(url, request);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
async getCardBalance(externalCardId: string): Promise<FiadoApiResponse<GetBankAccountCardBalanceResponse>> {
|
|
112
|
+
const url = `${this.baseUrl}/cards/${externalCardId}/balance`;
|
|
113
|
+
return await this.httpRequest.get(url);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
async updateCard(request: UpdateBankAccountCardRequest): Promise<FiadoApiResponse<GetBankAccountCardResponse>> {
|
|
117
|
+
const url = `${this.baseUrl}/cards/${request.cardId}/status/${request.status}`;
|
|
118
|
+
return await this.httpRequest.put(url);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
async updateCardProgram(externalCardId: string, programId: string): Promise<FiadoApiResponse<GetBankAccountCardResponse>> {
|
|
122
|
+
const url = `${this.baseUrl}/cards/${externalCardId}/programs/${programId}`;
|
|
123
|
+
return await this.httpRequest.put(url);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
async orderPhysicalCard(externalUserId: string): Promise<FiadoApiResponse<GetBankAccountCardResponse>> {
|
|
127
|
+
const url = `${this.baseUrl}/cards/physical/order/${externalUserId}`;
|
|
128
|
+
return await this.httpRequest.put(url);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
async createSecondaryCard(externalUserId: string): Promise<FiadoApiResponse<GetBankAccountCardResponse>> {
|
|
132
|
+
const url = `${this.baseUrl}/cards/cardholders/${externalUserId}/secondary`;
|
|
133
|
+
return await this.httpRequest.put(url);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
async getCardsByUserId(externalUserId: string, includeSecondary?: boolean): Promise<FiadoApiResponse<GetBankAccountCardResponse[]>> {
|
|
137
|
+
const url = `${this.baseUrl}/cards/cardholders/${externalUserId}`;
|
|
138
|
+
const param = includeSecondary ? `?includeSecondary=${includeSecondary}` : null;
|
|
139
|
+
return await this.httpRequest.get(`${url}${param ?? ""}`);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
async getAccountsByUserId(externalUserId: string): Promise<FiadoApiResponse<GetBankAccountResponse[]>> {
|
|
143
|
+
const url = `${this.baseUrl}/cardholders/${externalUserId}/accounts`;
|
|
144
|
+
return await this.httpRequest.get(url);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
async generateCardsInBatch(request: CardBatchRequest): Promise<FiadoApiResponse<CardBatchResponse>> {
|
|
148
|
+
const url = `${this.baseUrl}/cards/batch`;
|
|
149
|
+
return await this.httpRequest.post(url, request);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
async getCardBatch(batchId: string): Promise<FiadoApiResponse<CardBatchResponse>> {
|
|
153
|
+
const url = `${this.baseUrl}/cards/batch/${batchId}`;
|
|
154
|
+
return await this.httpRequest.get(url);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
async deleteCardBatch(batchId: string): Promise<FiadoApiResponse<CardBatchResponse>> {
|
|
158
|
+
const url = `${this.baseUrl}/cards/batch/${batchId}`;
|
|
159
|
+
return await this.httpRequest.delete(url);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/* STATEMENTS */
|
|
163
|
+
async getStatementsList(externalCardId: string): Promise<FiadoApiResponse<CardStatementListResponse[]>> {
|
|
164
|
+
const url = `${this.baseUrl}/statements/cards/${externalCardId}`;
|
|
165
|
+
return await this.httpRequest.get(url);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
async getStatementDocument(statementId: string): Promise<FiadoApiResponse<StatementDocumentResponse>> {
|
|
169
|
+
const url = `${this.baseUrl}/statements/document-url/${statementId}`;
|
|
170
|
+
return await this.httpRequest.get(url);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/* TRANSACTIONS */
|
|
174
|
+
async getTransactionHistory(externalCardId: string, params: CentralPaymentsQueryParams): Promise<FiadoApiResponse<TransactionListResponse<CentralPaymentsTransactionItem>>> {
|
|
175
|
+
const queryParams: string = this._invokerUtils.toQueryStringParameters(params);
|
|
176
|
+
const url = `${this.baseUrl}/transactions/history/${externalCardId}?${queryParams}`;
|
|
177
|
+
return await this.httpRequest.get(url);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
async getTransactionDetails(externalTransactionId: string): Promise<FiadoApiResponse<CentralPaymentsTransactionItem>> {
|
|
181
|
+
const url = `${this.baseUrl}/transactions/${externalTransactionId}`;
|
|
182
|
+
return await this.httpRequest.get(url);
|
|
183
|
+
}
|
|
184
184
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './interfaces/ICentralPaymentsConnectorApi';
|
|
1
|
+
export * from './interfaces/ICentralPaymentsConnectorApi';
|
|
2
2
|
export * from './CentralPaymentsConnectorApi';
|
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CreateBankAccountUserRequest,
|
|
3
|
-
CreateBankAccountUserResponse, GetBankAccountResponse,
|
|
4
|
-
GetBankAccountUserResponse,
|
|
5
|
-
UpdateBankAccountUserRequest
|
|
6
|
-
} from "@fiado/type-kit/bin/account";
|
|
7
|
-
import {
|
|
8
|
-
CentralPaymentsDocumentUploadRequest,
|
|
9
|
-
HealthcheckResponse,
|
|
10
|
-
OOWQuestionsResponse,
|
|
11
|
-
SubmitOOWQuestionAnswersRequest
|
|
12
|
-
} from "@fiado/type-kit/bin/centralPayments";
|
|
13
|
-
import {
|
|
14
|
-
ActivateBankAccountCardRequest,
|
|
15
|
-
ActivateBankAccountCardResponse,
|
|
16
|
-
CardBatchRequest,
|
|
17
|
-
CardBatchResponse,
|
|
18
|
-
CardStatementListResponse,
|
|
19
|
-
GetBankAccountCardBalanceResponse,
|
|
20
|
-
GetBankAccountCardResponse,
|
|
21
|
-
StatementDocumentResponse,
|
|
22
|
-
UpdateBankAccountCardRequest,
|
|
23
|
-
UpdateBankAccountCardResponse
|
|
24
|
-
} from "@fiado/type-kit/bin/card";
|
|
25
|
-
import FiadoApiResponse from "@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse";
|
|
26
|
-
import {
|
|
27
|
-
CentralPaymentsQueryParams,
|
|
28
|
-
CentralPaymentsTransactionItem,
|
|
29
|
-
TransactionListResponse
|
|
30
|
-
} from "@fiado/type-kit/bin/transaction";
|
|
31
|
-
|
|
32
|
-
export interface ICentralPaymentsConnectorApi {
|
|
33
|
-
healthcheck(): Promise<FiadoApiResponse<HealthcheckResponse>>;
|
|
34
|
-
|
|
35
|
-
createCardholder(request: CreateBankAccountUserRequest): Promise<FiadoApiResponse<CreateBankAccountUserResponse>>;
|
|
36
|
-
|
|
37
|
-
getCardholder(externalUserId: string): Promise<FiadoApiResponse<GetBankAccountUserResponse>>;
|
|
38
|
-
|
|
39
|
-
updateCardholder(externalUserId: string, request: UpdateBankAccountUserRequest): Promise<FiadoApiResponse<GetBankAccountUserResponse>>;
|
|
40
|
-
|
|
41
|
-
deleteCardholder(externalUserId: string): Promise<FiadoApiResponse<null>>;
|
|
42
|
-
|
|
43
|
-
getOOWQuestions(externalUserId: string): Promise<FiadoApiResponse<OOWQuestionsResponse[]>>;
|
|
44
|
-
|
|
45
|
-
submitOOWQuestionAnswers(externalUserId: string, request: SubmitOOWQuestionAnswersRequest[]): Promise<FiadoApiResponse<GetBankAccountUserResponse>>;
|
|
46
|
-
|
|
47
|
-
uploadDocuments(externalUserId: string, request: CentralPaymentsDocumentUploadRequest): Promise<FiadoApiResponse<null>>;
|
|
48
|
-
|
|
49
|
-
changePin(request: UpdateBankAccountCardRequest): Promise<FiadoApiResponse<UpdateBankAccountCardResponse>>;
|
|
50
|
-
|
|
51
|
-
getCardsById(externalCardId: string): Promise<FiadoApiResponse<GetBankAccountCardResponse>>;
|
|
52
|
-
|
|
53
|
-
getCardSensitiveInformation(externalCardId: string): Promise<FiadoApiResponse<GetBankAccountCardResponse>>;
|
|
54
|
-
|
|
55
|
-
activateCard(request: ActivateBankAccountCardRequest): Promise<FiadoApiResponse<ActivateBankAccountCardResponse>>;
|
|
56
|
-
|
|
57
|
-
getCardBalance(externalCardId: string): Promise<FiadoApiResponse<GetBankAccountCardBalanceResponse>>;
|
|
58
|
-
|
|
59
|
-
updateCard(request: UpdateBankAccountCardRequest): Promise<FiadoApiResponse<GetBankAccountCardResponse>>;
|
|
60
|
-
|
|
61
|
-
updateCardProgram(externalCardId: string, programId: string): Promise<FiadoApiResponse<GetBankAccountCardResponse>>;
|
|
62
|
-
|
|
63
|
-
orderPhysicalCard(externalUserId: string): Promise<FiadoApiResponse<GetBankAccountCardResponse>>;
|
|
64
|
-
|
|
65
|
-
createSecondaryCard(externalUserId: string): Promise<FiadoApiResponse<GetBankAccountCardResponse>>;
|
|
66
|
-
|
|
67
|
-
getCardsByUserId(externalUserId: string, includeSecondary?: boolean): Promise<FiadoApiResponse<GetBankAccountCardResponse[]>>;
|
|
68
|
-
|
|
69
|
-
getAccountsByUserId(externalUserId: string): Promise<FiadoApiResponse<GetBankAccountResponse[]>>;
|
|
70
|
-
|
|
71
|
-
generateCardsInBatch(request: CardBatchRequest): Promise<FiadoApiResponse<CardBatchResponse>>;
|
|
72
|
-
|
|
73
|
-
getCardBatch(batchId: string): Promise<FiadoApiResponse<CardBatchResponse>>;
|
|
74
|
-
|
|
75
|
-
deleteCardBatch(batchId: string): Promise<FiadoApiResponse<CardBatchResponse>>;
|
|
76
|
-
|
|
77
|
-
getStatementsList(externalCardId: string): Promise<FiadoApiResponse<CardStatementListResponse[]>>;
|
|
78
|
-
|
|
79
|
-
getStatementDocument(statementId: string): Promise<FiadoApiResponse<StatementDocumentResponse>>;
|
|
80
|
-
|
|
81
|
-
getTransactionHistory(externalCardId: string, params: CentralPaymentsQueryParams): Promise<FiadoApiResponse<TransactionListResponse<CentralPaymentsTransactionItem>>>;
|
|
82
|
-
|
|
83
|
-
getTransactionDetails(externalTransactionId: string): Promise<FiadoApiResponse<CentralPaymentsTransactionItem>>;
|
|
84
|
-
|
|
85
|
-
// TODO CREATE VIRTUAL CARD
|
|
1
|
+
import {
|
|
2
|
+
CreateBankAccountUserRequest,
|
|
3
|
+
CreateBankAccountUserResponse, GetBankAccountResponse,
|
|
4
|
+
GetBankAccountUserResponse,
|
|
5
|
+
UpdateBankAccountUserRequest
|
|
6
|
+
} from "@fiado/type-kit/bin/account";
|
|
7
|
+
import {
|
|
8
|
+
CentralPaymentsDocumentUploadRequest,
|
|
9
|
+
HealthcheckResponse,
|
|
10
|
+
OOWQuestionsResponse,
|
|
11
|
+
SubmitOOWQuestionAnswersRequest
|
|
12
|
+
} from "@fiado/type-kit/bin/centralPayments";
|
|
13
|
+
import {
|
|
14
|
+
ActivateBankAccountCardRequest,
|
|
15
|
+
ActivateBankAccountCardResponse,
|
|
16
|
+
CardBatchRequest,
|
|
17
|
+
CardBatchResponse,
|
|
18
|
+
CardStatementListResponse,
|
|
19
|
+
GetBankAccountCardBalanceResponse,
|
|
20
|
+
GetBankAccountCardResponse,
|
|
21
|
+
StatementDocumentResponse,
|
|
22
|
+
UpdateBankAccountCardRequest,
|
|
23
|
+
UpdateBankAccountCardResponse
|
|
24
|
+
} from "@fiado/type-kit/bin/card";
|
|
25
|
+
import FiadoApiResponse from "@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse";
|
|
26
|
+
import {
|
|
27
|
+
CentralPaymentsQueryParams,
|
|
28
|
+
CentralPaymentsTransactionItem,
|
|
29
|
+
TransactionListResponse
|
|
30
|
+
} from "@fiado/type-kit/bin/transaction";
|
|
31
|
+
|
|
32
|
+
export interface ICentralPaymentsConnectorApi {
|
|
33
|
+
healthcheck(): Promise<FiadoApiResponse<HealthcheckResponse>>;
|
|
34
|
+
|
|
35
|
+
createCardholder(request: CreateBankAccountUserRequest): Promise<FiadoApiResponse<CreateBankAccountUserResponse>>;
|
|
36
|
+
|
|
37
|
+
getCardholder(externalUserId: string): Promise<FiadoApiResponse<GetBankAccountUserResponse>>;
|
|
38
|
+
|
|
39
|
+
updateCardholder(externalUserId: string, request: UpdateBankAccountUserRequest): Promise<FiadoApiResponse<GetBankAccountUserResponse>>;
|
|
40
|
+
|
|
41
|
+
deleteCardholder(externalUserId: string): Promise<FiadoApiResponse<null>>;
|
|
42
|
+
|
|
43
|
+
getOOWQuestions(externalUserId: string): Promise<FiadoApiResponse<OOWQuestionsResponse[]>>;
|
|
44
|
+
|
|
45
|
+
submitOOWQuestionAnswers(externalUserId: string, request: SubmitOOWQuestionAnswersRequest[]): Promise<FiadoApiResponse<GetBankAccountUserResponse>>;
|
|
46
|
+
|
|
47
|
+
uploadDocuments(externalUserId: string, request: CentralPaymentsDocumentUploadRequest): Promise<FiadoApiResponse<null>>;
|
|
48
|
+
|
|
49
|
+
changePin(request: UpdateBankAccountCardRequest): Promise<FiadoApiResponse<UpdateBankAccountCardResponse>>;
|
|
50
|
+
|
|
51
|
+
getCardsById(externalCardId: string): Promise<FiadoApiResponse<GetBankAccountCardResponse>>;
|
|
52
|
+
|
|
53
|
+
getCardSensitiveInformation(externalCardId: string): Promise<FiadoApiResponse<GetBankAccountCardResponse>>;
|
|
54
|
+
|
|
55
|
+
activateCard(request: ActivateBankAccountCardRequest): Promise<FiadoApiResponse<ActivateBankAccountCardResponse>>;
|
|
56
|
+
|
|
57
|
+
getCardBalance(externalCardId: string): Promise<FiadoApiResponse<GetBankAccountCardBalanceResponse>>;
|
|
58
|
+
|
|
59
|
+
updateCard(request: UpdateBankAccountCardRequest): Promise<FiadoApiResponse<GetBankAccountCardResponse>>;
|
|
60
|
+
|
|
61
|
+
updateCardProgram(externalCardId: string, programId: string): Promise<FiadoApiResponse<GetBankAccountCardResponse>>;
|
|
62
|
+
|
|
63
|
+
orderPhysicalCard(externalUserId: string): Promise<FiadoApiResponse<GetBankAccountCardResponse>>;
|
|
64
|
+
|
|
65
|
+
createSecondaryCard(externalUserId: string): Promise<FiadoApiResponse<GetBankAccountCardResponse>>;
|
|
66
|
+
|
|
67
|
+
getCardsByUserId(externalUserId: string, includeSecondary?: boolean): Promise<FiadoApiResponse<GetBankAccountCardResponse[]>>;
|
|
68
|
+
|
|
69
|
+
getAccountsByUserId(externalUserId: string): Promise<FiadoApiResponse<GetBankAccountResponse[]>>;
|
|
70
|
+
|
|
71
|
+
generateCardsInBatch(request: CardBatchRequest): Promise<FiadoApiResponse<CardBatchResponse>>;
|
|
72
|
+
|
|
73
|
+
getCardBatch(batchId: string): Promise<FiadoApiResponse<CardBatchResponse>>;
|
|
74
|
+
|
|
75
|
+
deleteCardBatch(batchId: string): Promise<FiadoApiResponse<CardBatchResponse>>;
|
|
76
|
+
|
|
77
|
+
getStatementsList(externalCardId: string): Promise<FiadoApiResponse<CardStatementListResponse[]>>;
|
|
78
|
+
|
|
79
|
+
getStatementDocument(statementId: string): Promise<FiadoApiResponse<StatementDocumentResponse>>;
|
|
80
|
+
|
|
81
|
+
getTransactionHistory(externalCardId: string, params: CentralPaymentsQueryParams): Promise<FiadoApiResponse<TransactionListResponse<CentralPaymentsTransactionItem>>>;
|
|
82
|
+
|
|
83
|
+
getTransactionDetails(externalTransactionId: string): Promise<FiadoApiResponse<CentralPaymentsTransactionItem>>;
|
|
84
|
+
|
|
85
|
+
// TODO CREATE VIRTUAL CARD
|
|
86
86
|
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { IHttpRequest } from "@fiado/http-client";
|
|
2
|
-
import { inject, injectable } from "inversify";
|
|
3
|
-
import { ICnbvApi } from "./interfaces/ICnbvApi";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
@injectable()
|
|
8
|
-
export default class CnbvApi implements ICnbvApi {
|
|
9
|
-
|
|
10
|
-
private readonly baseUrl = process.env.CNBV_LAMBDA_URL || "";
|
|
11
|
-
|
|
12
|
-
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) { }
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
async validateConcidence(fullName: string, yearOfBirth: string): Promise<any> {
|
|
16
|
-
|
|
17
|
-
const url = `${this.baseUrl}?value=${yearOfBirth}¶m=YEAR_OF_BIRTH&fullName=${fullName}`;
|
|
18
|
-
|
|
19
|
-
return await this.httpRequest.get(url);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
1
|
+
import { IHttpRequest } from "@fiado/http-client";
|
|
2
|
+
import { inject, injectable } from "inversify";
|
|
3
|
+
import { ICnbvApi } from "./interfaces/ICnbvApi";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@injectable()
|
|
8
|
+
export default class CnbvApi implements ICnbvApi {
|
|
9
|
+
|
|
10
|
+
private readonly baseUrl = process.env.CNBV_LAMBDA_URL || "";
|
|
11
|
+
|
|
12
|
+
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) { }
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
async validateConcidence(fullName: string, yearOfBirth: string): Promise<any> {
|
|
16
|
+
|
|
17
|
+
const url = `${this.baseUrl}?value=${yearOfBirth}¶m=YEAR_OF_BIRTH&fullName=${fullName}`;
|
|
18
|
+
|
|
19
|
+
return await this.httpRequest.get(url);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export * from './interfaces/ICnbvApi';
|
|
4
|
-
export * from './CnbvApi';
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
export * from './interfaces/ICnbvApi';
|
|
4
|
+
export * from './CnbvApi';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export interface ICnbvApi {
|
|
4
|
-
|
|
5
|
-
validateConcidence(fullName:string, yearOfBirth: string): Promise<any>
|
|
6
|
-
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
export interface ICnbvApi {
|
|
4
|
+
|
|
5
|
+
validateConcidence(fullName:string, yearOfBirth: string): Promise<any>
|
|
6
|
+
|
|
7
7
|
}
|