@fiado/api-invoker 4.8.0 → 4.8.1
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/.claude/settings.json +33 -33
- package/README.md +600 -600
- package/bin/cognitoConnector/CognitoConnectorApi.d.ts +2 -1
- package/bin/cognitoConnector/CognitoConnectorApi.js +3 -2
- package/bin/cognitoConnector/interfaces/ICognitoConnectorApi.d.ts +1 -1
- package/bin/directories/DirectoriesApi.d.ts +1 -0
- package/bin/directories/DirectoriesApi.js +4 -0
- package/bin/directories/interfaces/IDirectoriesApi.d.ts +4 -0
- package/bin/referral-business/ReferralBusinessApi.d.ts +1 -0
- package/bin/referral-business/ReferralBusinessApi.js +4 -0
- package/bin/referral-business/interfaces/IReferralBusinessApi.d.ts +6 -0
- package/package.json +37 -37
- 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 +126 -126
- package/src/account-fiadoinc/index.ts +4 -4
- package/src/account-fiadoinc/interfaces/IAccountFiadoIncApi.ts +50 -50
- package/src/account-fiadoinc/queue/Publisher.ts +23 -23
- package/src/account-fiadoinc/queue/interfaces/IPublisher.ts +4 -4
- package/src/account-fiadosa/AccountFiadoSAApi.ts +38 -38
- package/src/account-fiadosa/index.ts +1 -1
- package/src/account-fiadosa/interfaces/IAccountFiadoSAApi.ts +16 -16
- package/src/account-pagoconfiado/AccountPagoConfiadoApi.ts +78 -78
- package/src/account-pagoconfiado/index.ts +2 -2
- package/src/account-pagoconfiado/interfaces/IAccountPagoConfiadoApi.ts +37 -37
- 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 +30 -30
- 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/ai-engine-connector/AiEngineApi.ts +28 -28
- package/src/ai-engine-connector/index.ts +2 -2
- package/src/ai-engine-connector/interfaces/IAiEngineApi.ts +6 -6
- package/src/appselectondata/AppSelectionDataApi.ts +32 -32
- package/src/appselectondata/index.ts +2 -2
- package/src/appselectondata/interfaces/IAppSelectionDataApi.ts +17 -17
- package/src/authentication/AuthenticationApi.ts +29 -29
- package/src/authentication/index.ts +4 -4
- package/src/authentication/interfaces/IAuthenticationApi.ts +8 -8
- package/src/bankAccount/BankAccountApi.ts +34 -34
- 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/benefits-marketplace/api/BenefitsMarketplaceApi.ts +35 -35
- package/src/benefits-marketplace/api/dtos/BenefitLeafDisplayResponse.ts +21 -21
- package/src/benefits-marketplace/api/interfaces/IBenefitsMarketplaceApi.ts +62 -62
- package/src/benefits-marketplace/index.ts +3 -3
- 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 +103 -103
- package/src/card/index.ts +3 -3
- package/src/card/interfaces/ICardApi.ts +32 -32
- package/src/card-business/index.ts +2 -2
- package/src/card-business/queue/CardBusinessPublisher.ts +23 -23
- package/src/card-business/queue/ICardBusinessPublisher.ts +10 -10
- package/src/centralPayments/CentralPaymentsConnectorApi.ts +317 -317
- package/src/centralPayments/index.ts +1 -1
- package/src/centralPayments/interfaces/ICentralPaymentsConnectorApi.ts +153 -153
- package/src/circuloCredito/api/CirculoCreditoApi.ts +21 -21
- package/src/circuloCredito/api/interfaces/ICirculoCreditoApi.ts +7 -7
- package/src/circuloCredito/index.ts +2 -2
- package/src/cnbv-business/CnbvApi.ts +31 -31
- package/src/cnbv-business/index.ts +4 -4
- package/src/cnbv-business/interfaces/ICnbvApi.ts +19 -19
- package/src/cnbv-connector/CnbvConnectorApi.ts +18 -18
- package/src/cnbv-connector/index.ts +1 -1
- package/src/cnbv-connector/interfaces/ICnbvConnectorApi.ts +6 -6
- package/src/cognitoBackofficeConnector/api/CognitoBackofficeConnectorApi.ts +263 -263
- package/src/cognitoBackofficeConnector/api/interfaces/ICognitoBackofficeConnectorApi.ts +192 -192
- package/src/cognitoBackofficeConnector/index.ts +2 -2
- package/src/cognitoConnector/CognitoConnectorApi.ts +112 -110
- package/src/cognitoConnector/CognitoConnectorV2.ts +87 -87
- package/src/cognitoConnector/index.ts +11 -11
- package/src/cognitoConnector/interfaces/ICognitoConnectorApi.ts +16 -16
- package/src/cognitoConnector/interfaces/ICognitoV2Api.ts +63 -63
- package/src/collector/CollectorApi.ts +97 -97
- package/src/collector/index.ts +2 -2
- package/src/collector/interfaces/ICollectorApi.ts +47 -47
- package/src/commission-business/CommissionBusinessApi.ts +19 -19
- package/src/commission-business/index.ts +3 -3
- package/src/commission-business/interfaces/ICommissionBusinessApi.ts +15 -15
- 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 +289 -289
- package/src/contract-business/api/ContractBusinessApi.ts +37 -37
- package/src/contract-business/api/interfaces/IContractBusinessApi.ts +32 -32
- package/src/contract-business/index.ts +2 -2
- 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/countries-business/CountriesBusinessApi.ts +26 -26
- package/src/countries-business/index.ts +2 -2
- package/src/countries-business/interfaces/ICountriesBusinessApi.ts +22 -22
- package/src/credit-engine/CreditEngineApi.ts +54 -54
- package/src/credit-engine/index.ts +17 -17
- package/src/credit-engine/interfaces/ICreditEngineApi.ts +46 -46
- package/src/credit-engine/queue/CreditCollectionPublisher.ts +24 -24
- package/src/credit-engine/queue/CreditDelinquencyPublisher.ts +24 -24
- package/src/credit-engine/queue/CreditIncomeDetectionPublisher.ts +24 -24
- package/src/credit-engine/queue/CreditLienCollectionPublisher.ts +24 -24
- package/src/credit-engine/queue/CreditNotificationPublisher.ts +24 -24
- package/src/credit-engine/queue/CreditOfferGenerationPublisher.ts +24 -24
- package/src/credit-engine/queue/CreditReconciliationPublisher.ts +24 -24
- package/src/credit-engine/queue/CreditScoringPublisher.ts +24 -24
- package/src/credit-engine/queue/CreditStatementPublisher.ts +24 -24
- package/src/credit-engine/queue/CreditTransferPublisher.ts +24 -24
- package/src/credit-engine/queue/interfaces/ICreditCollectionPublisher.ts +5 -5
- package/src/credit-engine/queue/interfaces/ICreditDelinquencyPublisher.ts +5 -5
- package/src/credit-engine/queue/interfaces/ICreditIncomeDetectionPublisher.ts +5 -5
- package/src/credit-engine/queue/interfaces/ICreditLienCollectionPublisher.ts +5 -5
- package/src/credit-engine/queue/interfaces/ICreditNotificationPublisher.ts +5 -5
- package/src/credit-engine/queue/interfaces/ICreditOfferGenerationPublisher.ts +5 -5
- package/src/credit-engine/queue/interfaces/ICreditReconciliationPublisher.ts +5 -5
- package/src/credit-engine/queue/interfaces/ICreditScoringPublisher.ts +5 -5
- package/src/credit-engine/queue/interfaces/ICreditStatementPublisher.ts +5 -5
- package/src/credit-engine/queue/interfaces/ICreditTransferPublisher.ts +5 -5
- package/src/credit-payment/CreditPaymentApi.ts +73 -73
- package/src/credit-payment/index.ts +2 -2
- package/src/credit-payment/interfaces/ICreditPaymentApi.ts +52 -52
- package/src/credit-statements/api/CreditStatementsApi.ts +25 -25
- package/src/credit-statements/api/interfaces/ICreditStatementsApi.ts +30 -30
- package/src/credit-statements/index.ts +2 -2
- package/src/device/DeviceApi.ts +32 -32
- package/src/device/index.ts +2 -2
- package/src/device/interfaces/IDeviceApi.ts +41 -41
- package/src/directories/DirectoriesApi.ts +68 -63
- package/src/directories/index.ts +3 -3
- package/src/directories/interfaces/IDirectoriesApi.ts +21 -17
- package/src/directory/DirectoryApi.ts +196 -196
- package/src/directory/index.ts +3 -3
- package/src/directory/interfaces/IDirectoryApi.ts +73 -73
- package/src/directorySetting/DirectorySettingApi.ts +42 -42
- package/src/directorySetting/index.ts +3 -3
- package/src/directorySetting/interfaces/IDirectorySettingApi.ts +56 -56
- package/src/disputes/DisputesApi.ts +50 -50
- package/src/disputes/index.ts +2 -2
- package/src/disputes/interfaces/IDisputesApi.ts +54 -54
- package/src/document-generator/DocumentGeneratorApi.ts +51 -51
- package/src/document-generator/index.ts +2 -2
- package/src/document-generator/interfaces/IDocumentGeneratorApi.ts +34 -34
- package/src/document-image-processor/DocumentImageProcessorApi.ts +22 -22
- package/src/document-image-processor/index.ts +1 -1
- package/src/document-image-processor/interfaces/IDocumentImageProcessorApi.ts +7 -7
- package/src/estafeta/api/EstafetaApi.ts +67 -67
- package/src/estafeta/api/interfaces/IEstafetaApi.ts +28 -28
- package/src/estafeta/index.ts +1 -1
- package/src/event-history-business/EventHistoryApi.ts +108 -108
- package/src/event-history-business/index.ts +3 -3
- package/src/event-history-business/interfaces/IEventHistoryApi.ts +47 -47
- 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/firebase-connector/FirebaseConnectorApi.ts +53 -53
- package/src/firebase-connector/index.ts +3 -3
- package/src/firebase-connector/interfaces/IFirebaseConnectorApi.ts +6 -6
- 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 +69 -69
- package/src/group/index.ts +1 -1
- package/src/group/interfaces/IGroupApi.ts +40 -40
- package/src/identity/IdentityApi.ts +95 -95
- package/src/identity/index.ts +3 -3
- package/src/identity/interfaces/IIdentityApi.ts +46 -46
- package/src/index.ts +78 -78
- package/src/legalDocument/api/LegalDocumentApi.ts +38 -38
- package/src/legalDocument/api/interfaces/ILegalDocumentApi.ts +7 -7
- package/src/legalDocument/index.ts +3 -3
- package/src/milestone-business/api/MilestoneBusinessApi.ts +26 -26
- package/src/milestone-business/api/interfaces/IMilestoneBusinessApi.ts +9 -9
- package/src/milestone-business/index.ts +2 -2
- package/src/multicommServicePayment/api/MulticommServicePaymentApi.ts +94 -94
- package/src/multicommServicePayment/api/interfaces/IMulticommServicePaymentApi.ts +44 -44
- package/src/multicommServicePayment/index.ts +1 -1
- package/src/notificationMessages/index.ts +1 -1
- package/src/notificationMessages/queue/NotificationMessagePublisher.ts +42 -42
- package/src/notificationMessages/queue/interfaces/INotificationMessagesPublisher.ts +7 -7
- package/src/notificationWebsockets/index.ts +1 -1
- package/src/notificationWebsockets/queue/NotificationWSMessagePublisher.ts +29 -29
- package/src/notificationWebsockets/queue/interfaces/INotificationWSMessagesPublisher.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/onboarding/api/OnboardingApi.ts +23 -23
- package/src/onboarding/api/interfaces/IOnboardingApi.ts +3 -3
- package/src/onboarding/index.ts +1 -1
- package/src/onboarding-business/api/OnboardingBusinessApi.ts +210 -210
- package/src/onboarding-business/api/interfaces/IOnboardingBusinessApi.ts +9 -9
- package/src/onboarding-business/index.ts +1 -1
- package/src/order-collector-business/OrderCollectorApi.ts +20 -20
- package/src/order-collector-business/index.ts +3 -3
- package/src/order-collector-business/interfaces/IOrderCollectorApi.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/payroll-business/PayrollApi.ts +19 -19
- package/src/payroll-business/index.ts +1 -1
- package/src/payroll-business/interfaces/IPayrollApi.ts +18 -18
- package/src/people-business/api/PeopleBusinessApi.ts +32 -32
- package/src/people-business/api/interfaces/IPeopleBusinessApi.ts +7 -7
- package/src/people-business/index.ts +1 -1
- package/src/platform-error-events/index.ts +2 -2
- package/src/platform-error-events/queue/PlatformErrorEventsPublisher.ts +24 -24
- package/src/platform-error-events/queue/interfaces/IPlatformErrorEventsPublisher.ts +5 -5
- package/src/pomelo/api/PomeloApi.ts +109 -109
- package/src/pomelo/api/interfaces/IPomeloApi.ts +29 -29
- 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/pricelist-business/PriceListApi.ts +45 -45
- package/src/pricelist-business/index.ts +1 -1
- package/src/pricelist-business/interfaces/IPriceListApi.ts +16 -16
- 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/product-payment/api/ProductPaymentApi.ts +25 -25
- package/src/product-payment/api/interfaces/IProductPaymentApi.ts +8 -8
- package/src/product-payment/index.ts +1 -1
- package/src/referral-business/ReferralBusinessApi.ts +42 -37
- package/src/referral-business/index.ts +1 -1
- package/src/referral-business/interfaces/IReferralBusinessApi.ts +45 -38
- package/src/report-processor-business/api/IReportProcessorBusinessApi.ts +4 -4
- package/src/report-processor-business/api/ReportProcessorBusinessApi.ts +17 -17
- package/src/report-processor-business/index.ts +5 -5
- package/src/riskProfile/api/RiskProfileApi.ts +63 -63
- package/src/riskProfile/api/TransactionAlertApi.ts +49 -49
- package/src/riskProfile/api/interfaces/IRiskProfileApi.ts +51 -51
- package/src/riskProfile/api/interfaces/ITransactionAlertApi.ts +70 -70
- package/src/riskProfile/index.ts +7 -7
- package/src/riskProfile/queue/TransactionAlarmPublisher.ts +25 -25
- package/src/riskProfile/queue/interfaces/ITransactionAlarmPublisher.ts +4 -4
- package/src/service-business/ServiceApi.ts +78 -78
- package/src/service-business/index.ts +2 -2
- package/src/service-business/interfaces/IServiceApi.ts +73 -73
- package/src/sessionActivity/index.ts +2 -2
- package/src/sessionActivity/queue/SessionActivityPublisher.ts +23 -23
- package/src/sessionActivity/queue/interfaces/ISessionActivityPublisher.ts +4 -4
- package/src/stp-business/api/STPBusinessApi.ts +32 -32
- package/src/stp-business/api/interfaces/ISTPBusinessApi.ts +15 -15
- package/src/stp-business/index.ts +1 -1
- 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 +94 -94
- package/src/stpServicePayment/api/interfaces/IStpServicePaymentApi.ts +44 -44
- 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/teams-connector/index.ts +2 -2
- package/src/teams-connector/queue/TeamsNotificationPublisher.ts +24 -24
- package/src/teams-connector/queue/interfaces/ITeamsNotificationPublisher.ts +5 -5
- package/src/tern/api/TernApi.ts +147 -147
- package/src/tern/api/interfaces/ITernApi.ts +54 -54
- package/src/tern/index.ts +1 -1
- package/src/transaction/api/TransactionApi.ts +157 -157
- package/src/transaction/api/interfaces/ITransactionApi.ts +82 -82
- package/src/transaction/index.ts +5 -5
- package/src/transaction/queue/TransactionPublisher.ts +25 -25
- package/src/transaction/queue/interfaces/ITransactionPublisher.ts +4 -4
- package/src/transactionProcessor/api/TransactionProcessorApi.ts +57 -57
- package/src/transactionProcessor/api/interfaces/ITransactionProcessorApi.ts +28 -28
- package/src/transactionProcessor/index.ts +1 -1
- package/src/uniteller-connector/api/UnitellerConnectorApi.ts +113 -113
- package/src/uniteller-connector/api/interfaces/IUnitellerConnectorApi.ts +85 -85
- package/src/uniteller-connector/index.ts +2 -2
- 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
|
@@ -1,87 +1,87 @@
|
|
|
1
|
-
import { injectable, inject } from "inversify";
|
|
2
|
-
import { IHttpRequest } from "@fiado/http-client";
|
|
3
|
-
import {
|
|
4
|
-
SignUpRequest,
|
|
5
|
-
SignUpResponse,
|
|
6
|
-
SignUpConfirmRequest,
|
|
7
|
-
SignInRequest,
|
|
8
|
-
SignInResponse,
|
|
9
|
-
ChangePasswordRequest,
|
|
10
|
-
GetUserRequest,
|
|
11
|
-
GetUserResponse,
|
|
12
|
-
RefreshTokenRequest,
|
|
13
|
-
RefreshTokenResponse,
|
|
14
|
-
RespondToAuthChallengeRequest,
|
|
15
|
-
SetPasswordRequest
|
|
16
|
-
} from "@fiado/type-kit/bin/cognitoConnector";
|
|
17
|
-
import { HealthcheckResponse, ICognitoV2Api } from "./interfaces/ICognitoV2Api";
|
|
18
|
-
|
|
19
|
-
@injectable()
|
|
20
|
-
export default class CognitoApi implements ICognitoV2Api {
|
|
21
|
-
|
|
22
|
-
private readonly baseUrl = process.env.COGNITO_CONNECTOR_LAMBDA_URL || "";
|
|
23
|
-
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) { }
|
|
24
|
-
|
|
25
|
-
async healthcheck(): Promise<HealthcheckResponse> {
|
|
26
|
-
const url = `${this.baseUrl}healthcheck`;
|
|
27
|
-
const response:any = await this.httpRequest.get(url);
|
|
28
|
-
return response.data;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
async signUp(request: SignUpRequest): Promise<SignUpResponse> {
|
|
32
|
-
const url = `${this.baseUrl}cognito/signUp`;
|
|
33
|
-
const response: any = await this.httpRequest.post(url, request);
|
|
34
|
-
return response.data;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
async signUpConfirm(request: SignUpConfirmRequest): Promise<void> {
|
|
38
|
-
const url = `${this.baseUrl}cognito/signUp/confirm`;
|
|
39
|
-
const response: any = this.httpRequest.post(url, request);
|
|
40
|
-
return response.data;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
async signIn(request: SignInRequest): Promise<SignInResponse> {
|
|
44
|
-
const url = `${this.baseUrl}cognito/signIn`;
|
|
45
|
-
return this.httpRequest.post(url, request);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
async signOut(): Promise<void> {
|
|
49
|
-
const url = `${this.baseUrl}cognito/signOut`;
|
|
50
|
-
await this.httpRequest.post(url, {});
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
async changePassword(request: ChangePasswordRequest): Promise<void> {
|
|
54
|
-
const url = `${this.baseUrl}cognito/user/changePassword`;
|
|
55
|
-
await this.httpRequest.post(url, request);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
async getUser(request: GetUserRequest): Promise<GetUserResponse> {
|
|
59
|
-
const url = `${this.baseUrl}cognito/user`;
|
|
60
|
-
const response: any = await this.httpRequest.post(url, request);
|
|
61
|
-
return response.data;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
async refreshToken(request: RefreshTokenRequest): Promise<RefreshTokenResponse> {
|
|
65
|
-
const url = `${this.baseUrl}cognito/refreshToken`;
|
|
66
|
-
const response: any = await this.httpRequest.post(url, request);
|
|
67
|
-
return response.data;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
async respondToAuthChallenge(request: RespondToAuthChallengeRequest): Promise<any> {
|
|
71
|
-
const url = `${this.baseUrl}cognito/respondToAuthChallenge`;
|
|
72
|
-
const response: any = await this.httpRequest.post(url, request);
|
|
73
|
-
return response.data;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
async resetPassword(request: SetPasswordRequest): Promise<void> {
|
|
77
|
-
const url = `${this.baseUrl}cognito/resetPassword`;
|
|
78
|
-
const response: any = await this.httpRequest.post(url, request);
|
|
79
|
-
return response.data;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
async updateUser(request: { identityId: string; typeOfDirectoryId: string; email?: string; emailVerified?: string; phoneNumber?: string; phoneNumberVerified?: string; secretNumberStatus?: string; username?: string }): Promise<void> {
|
|
83
|
-
const url = `${this.baseUrl}cognito/user`;
|
|
84
|
-
const response: any = await this.httpRequest.put(url, request);
|
|
85
|
-
return response.data;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
1
|
+
import { injectable, inject } from "inversify";
|
|
2
|
+
import { IHttpRequest } from "@fiado/http-client";
|
|
3
|
+
import {
|
|
4
|
+
SignUpRequest,
|
|
5
|
+
SignUpResponse,
|
|
6
|
+
SignUpConfirmRequest,
|
|
7
|
+
SignInRequest,
|
|
8
|
+
SignInResponse,
|
|
9
|
+
ChangePasswordRequest,
|
|
10
|
+
GetUserRequest,
|
|
11
|
+
GetUserResponse,
|
|
12
|
+
RefreshTokenRequest,
|
|
13
|
+
RefreshTokenResponse,
|
|
14
|
+
RespondToAuthChallengeRequest,
|
|
15
|
+
SetPasswordRequest
|
|
16
|
+
} from "@fiado/type-kit/bin/cognitoConnector";
|
|
17
|
+
import { HealthcheckResponse, ICognitoV2Api } from "./interfaces/ICognitoV2Api";
|
|
18
|
+
|
|
19
|
+
@injectable()
|
|
20
|
+
export default class CognitoApi implements ICognitoV2Api {
|
|
21
|
+
|
|
22
|
+
private readonly baseUrl = process.env.COGNITO_CONNECTOR_LAMBDA_URL || "";
|
|
23
|
+
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) { }
|
|
24
|
+
|
|
25
|
+
async healthcheck(): Promise<HealthcheckResponse> {
|
|
26
|
+
const url = `${this.baseUrl}healthcheck`;
|
|
27
|
+
const response:any = await this.httpRequest.get(url);
|
|
28
|
+
return response.data;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async signUp(request: SignUpRequest): Promise<SignUpResponse> {
|
|
32
|
+
const url = `${this.baseUrl}cognito/signUp`;
|
|
33
|
+
const response: any = await this.httpRequest.post(url, request);
|
|
34
|
+
return response.data;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async signUpConfirm(request: SignUpConfirmRequest): Promise<void> {
|
|
38
|
+
const url = `${this.baseUrl}cognito/signUp/confirm`;
|
|
39
|
+
const response: any = this.httpRequest.post(url, request);
|
|
40
|
+
return response.data;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async signIn(request: SignInRequest): Promise<SignInResponse> {
|
|
44
|
+
const url = `${this.baseUrl}cognito/signIn`;
|
|
45
|
+
return this.httpRequest.post(url, request);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async signOut(): Promise<void> {
|
|
49
|
+
const url = `${this.baseUrl}cognito/signOut`;
|
|
50
|
+
await this.httpRequest.post(url, {});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async changePassword(request: ChangePasswordRequest): Promise<void> {
|
|
54
|
+
const url = `${this.baseUrl}cognito/user/changePassword`;
|
|
55
|
+
await this.httpRequest.post(url, request);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async getUser(request: GetUserRequest): Promise<GetUserResponse> {
|
|
59
|
+
const url = `${this.baseUrl}cognito/user`;
|
|
60
|
+
const response: any = await this.httpRequest.post(url, request);
|
|
61
|
+
return response.data;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
async refreshToken(request: RefreshTokenRequest): Promise<RefreshTokenResponse> {
|
|
65
|
+
const url = `${this.baseUrl}cognito/refreshToken`;
|
|
66
|
+
const response: any = await this.httpRequest.post(url, request);
|
|
67
|
+
return response.data;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
async respondToAuthChallenge(request: RespondToAuthChallengeRequest): Promise<any> {
|
|
71
|
+
const url = `${this.baseUrl}cognito/respondToAuthChallenge`;
|
|
72
|
+
const response: any = await this.httpRequest.post(url, request);
|
|
73
|
+
return response.data;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async resetPassword(request: SetPasswordRequest): Promise<void> {
|
|
77
|
+
const url = `${this.baseUrl}cognito/resetPassword`;
|
|
78
|
+
const response: any = await this.httpRequest.post(url, request);
|
|
79
|
+
return response.data;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
async updateUser(request: { identityId: string; typeOfDirectoryId: string; email?: string; emailVerified?: string; phoneNumber?: string; phoneNumberVerified?: string; secretNumberStatus?: string; username?: string }): Promise<void> {
|
|
83
|
+
const url = `${this.baseUrl}cognito/user`;
|
|
84
|
+
const response: any = await this.httpRequest.put(url, request);
|
|
85
|
+
return response.data;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export * from './interfaces/ICognitoConnectorApi';
|
|
5
|
-
export * from './CognitoConnectorApi';
|
|
6
|
-
|
|
7
|
-
export * from './interfaces/ICognitoV2Api';
|
|
8
|
-
export * from './CognitoConnectorV2';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export * from './interfaces/ICognitoConnectorApi';
|
|
5
|
+
export * from './CognitoConnectorApi';
|
|
6
|
+
|
|
7
|
+
export * from './interfaces/ICognitoV2Api';
|
|
8
|
+
export * from './CognitoConnectorV2';
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { GetUserRequest, GetUserResponse, RefreshTokenRequest, RefreshTokenResponse, RespondToAuthChallengeRequest, SetPasswordRequest, SignInRequest, SignInResponse, SignUpConfirmRequest, SignUpRequest, SignUpResponse } from "@fiado/type-kit/bin/cognitoConnector";
|
|
2
|
-
import { TypeOfDirectoryId } from "@fiado/type-kit/bin/directory";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export interface ICognitoConnectorApi {
|
|
7
|
-
|
|
8
|
-
signUp(input: SignUpRequest): Promise<SignUpResponse>;
|
|
9
|
-
signIn(input: SignInRequest): Promise<SignInResponse>;
|
|
10
|
-
getUser(input: GetUserRequest): Promise<GetUserResponse>;
|
|
11
|
-
signUpConfirm(input: SignUpConfirmRequest): Promise<void>;
|
|
12
|
-
refreshToken(input: RefreshTokenRequest): Promise<RefreshTokenResponse>;
|
|
13
|
-
changePassword(input: SetPasswordRequest): Promise<void>;
|
|
14
|
-
respondToNewPasswordChallenge(input: RespondToAuthChallengeRequest): Promise<SignInResponse>;
|
|
15
|
-
resetPassword(username: string, typeOfDirectoryId: TypeOfDirectoryId): Promise<void>;
|
|
16
|
-
deleteCognitoUser(identityId: string): Promise<void>;
|
|
1
|
+
import { GetUserRequest, GetUserResponse, RefreshTokenRequest, RefreshTokenResponse, RespondToAuthChallengeRequest, SetPasswordRequest, SignInRequest, SignInResponse, SignUpConfirmRequest, SignUpRequest, SignUpResponse } from "@fiado/type-kit/bin/cognitoConnector";
|
|
2
|
+
import { TypeOfDirectoryId } from "@fiado/type-kit/bin/directory";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export interface ICognitoConnectorApi {
|
|
7
|
+
|
|
8
|
+
signUp(input: SignUpRequest): Promise<SignUpResponse>;
|
|
9
|
+
signIn(input: SignInRequest): Promise<SignInResponse>;
|
|
10
|
+
getUser(input: GetUserRequest): Promise<GetUserResponse>;
|
|
11
|
+
signUpConfirm(input: SignUpConfirmRequest): Promise<void>;
|
|
12
|
+
refreshToken(input: RefreshTokenRequest): Promise<RefreshTokenResponse>;
|
|
13
|
+
changePassword(input: SetPasswordRequest): Promise<void>;
|
|
14
|
+
respondToNewPasswordChallenge(input: RespondToAuthChallengeRequest): Promise<SignInResponse>;
|
|
15
|
+
resetPassword(username: string, typeOfDirectoryId: TypeOfDirectoryId): Promise<void>;
|
|
16
|
+
deleteCognitoUser(identityId: string, typeOfDirectoryId?: TypeOfDirectoryId): Promise<void>;
|
|
17
17
|
}
|
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
import { ChangePasswordRequest, GetUserRequest, GetUserResponse, RefreshTokenRequest, RefreshTokenResponse, RespondToAuthChallengeRequest, SetPasswordRequest, SignInRequest, SignInResponse, SignUpConfirmRequest, SignUpRequest, SignUpResponse } from "@fiado/type-kit/bin/cognitoConnector";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export interface ICognitoV2Api {
|
|
5
|
-
/**
|
|
6
|
-
* Healthcheck for the cognito-connector
|
|
7
|
-
*/
|
|
8
|
-
healthcheck(): Promise<HealthcheckResponse>;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Create a new user in Cognito
|
|
12
|
-
*/
|
|
13
|
-
signUp(request: SignUpRequest): Promise<SignUpResponse>;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Confirm sign-up for a user in Cognito
|
|
17
|
-
*/
|
|
18
|
-
signUpConfirm(request: SignUpConfirmRequest): Promise<void>;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Sign in a user
|
|
22
|
-
*/
|
|
23
|
-
signIn(request: SignInRequest): Promise<SignInResponse>;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Sign out a user
|
|
27
|
-
*/
|
|
28
|
-
signOut(): Promise<void>;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Change a user's password
|
|
32
|
-
*/
|
|
33
|
-
changePassword(request: ChangePasswordRequest): Promise<void>;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Retrieve user details
|
|
37
|
-
*/
|
|
38
|
-
getUser(request: GetUserRequest): Promise<GetUserResponse>;
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Refresh a user's tokens
|
|
42
|
-
*/
|
|
43
|
-
refreshToken(request: RefreshTokenRequest): Promise<RefreshTokenResponse>;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Respond to an auth challenge
|
|
47
|
-
*/
|
|
48
|
-
respondToAuthChallenge(request: RespondToAuthChallengeRequest): Promise<any>;
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Reset a user's password
|
|
52
|
-
*/
|
|
53
|
-
resetPassword(request: SetPasswordRequest): Promise<void>;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Update a user's attributes in Cognito
|
|
57
|
-
*/
|
|
58
|
-
updateUser(request: { identityId: string; typeOfDirectoryId: string; email?: string; emailVerified?: string; phoneNumber?: string; phoneNumberVerified?: string; secretNumberStatus?: string; username?: string }): Promise<void>;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export interface HealthcheckResponse {
|
|
62
|
-
status: string;
|
|
63
|
-
}
|
|
1
|
+
import { ChangePasswordRequest, GetUserRequest, GetUserResponse, RefreshTokenRequest, RefreshTokenResponse, RespondToAuthChallengeRequest, SetPasswordRequest, SignInRequest, SignInResponse, SignUpConfirmRequest, SignUpRequest, SignUpResponse } from "@fiado/type-kit/bin/cognitoConnector";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export interface ICognitoV2Api {
|
|
5
|
+
/**
|
|
6
|
+
* Healthcheck for the cognito-connector
|
|
7
|
+
*/
|
|
8
|
+
healthcheck(): Promise<HealthcheckResponse>;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Create a new user in Cognito
|
|
12
|
+
*/
|
|
13
|
+
signUp(request: SignUpRequest): Promise<SignUpResponse>;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Confirm sign-up for a user in Cognito
|
|
17
|
+
*/
|
|
18
|
+
signUpConfirm(request: SignUpConfirmRequest): Promise<void>;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Sign in a user
|
|
22
|
+
*/
|
|
23
|
+
signIn(request: SignInRequest): Promise<SignInResponse>;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Sign out a user
|
|
27
|
+
*/
|
|
28
|
+
signOut(): Promise<void>;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Change a user's password
|
|
32
|
+
*/
|
|
33
|
+
changePassword(request: ChangePasswordRequest): Promise<void>;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Retrieve user details
|
|
37
|
+
*/
|
|
38
|
+
getUser(request: GetUserRequest): Promise<GetUserResponse>;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Refresh a user's tokens
|
|
42
|
+
*/
|
|
43
|
+
refreshToken(request: RefreshTokenRequest): Promise<RefreshTokenResponse>;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Respond to an auth challenge
|
|
47
|
+
*/
|
|
48
|
+
respondToAuthChallenge(request: RespondToAuthChallengeRequest): Promise<any>;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Reset a user's password
|
|
52
|
+
*/
|
|
53
|
+
resetPassword(request: SetPasswordRequest): Promise<void>;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Update a user's attributes in Cognito
|
|
57
|
+
*/
|
|
58
|
+
updateUser(request: { identityId: string; typeOfDirectoryId: string; email?: string; emailVerified?: string; phoneNumber?: string; phoneNumberVerified?: string; secretNumberStatus?: string; username?: string }): Promise<void>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface HealthcheckResponse {
|
|
62
|
+
status: string;
|
|
63
|
+
}
|
|
@@ -1,97 +1,97 @@
|
|
|
1
|
-
import dotenv from 'dotenv';
|
|
2
|
-
import { inject, injectable } from "inversify";
|
|
3
|
-
import { IHttpRequest } from "@fiado/http-client";
|
|
4
|
-
import { ICollectorApi } from './interfaces/ICollectorApi';
|
|
5
|
-
import CreditContractCreateRequest from '@fiado/type-kit/bin/creditContract/dtos/CreditContractCreateRequest';
|
|
6
|
-
import { CollectorTransactionResponse, CollectorTransactionUpdateRequest, GetLastExchangeRateOutput } from '@fiado/type-kit/bin/collector';
|
|
7
|
-
import { ApiResponse, APIGatewayProxyResultBody } from '@fiado/gateway-adapter';
|
|
8
|
-
import FiadoApiResponse from "@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse";
|
|
9
|
-
import { CreditContractUpdateRequest } from '@fiado/type-kit/bin/collector/dtos/CreditContractUpdateRequest';
|
|
10
|
-
|
|
11
|
-
dotenv.config();
|
|
12
|
-
|
|
13
|
-
@injectable()
|
|
14
|
-
export class CollectorApi implements ICollectorApi {
|
|
15
|
-
|
|
16
|
-
private readonly baseUrl = process.env.COLLECTOR_LAMBDA_URL || "";
|
|
17
|
-
|
|
18
|
-
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) { }
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Crea un nuevo contrato de crédito.
|
|
22
|
-
* @param CreditContractCreateRequest Objeto con la información necesaria para crear el contrato.
|
|
23
|
-
* @returns Una promesa que resuelve a un arreglo de objetos de people.
|
|
24
|
-
* Puede devolver un arreglo vacío si no se encuentran coincidencias.
|
|
25
|
-
* @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
|
|
26
|
-
*/
|
|
27
|
-
async createCreditContract(object: CreditContractCreateRequest): Promise<any> {
|
|
28
|
-
const url = `${this.baseUrl}collector/creditcontracts/create`;
|
|
29
|
-
return await this.httpRequest.post(url, object);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
async getCreditContract(relatedId: string): Promise<any> {
|
|
33
|
-
const url = `${this.baseUrl}collector/creditcontracts/collectordata?externalRelatedId=${relatedId}`;
|
|
34
|
-
return await this.httpRequest.get(url);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
async getCreditContractByRelatedPreAuthId(relatedPreAuthId: string): Promise<any> {
|
|
38
|
-
const url = `${this.baseUrl}collector/creditcontracts/query?relatedPreAuthId=${relatedPreAuthId}`;
|
|
39
|
-
return await this.httpRequest.get(url);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
async getCollectorTransactionByIds(ids: string[]): Promise<APIGatewayProxyResultBody<CollectorTransactionResponse[]>> {
|
|
43
|
-
|
|
44
|
-
if (ids.length === 0) {
|
|
45
|
-
const data: CollectorTransactionResponse[] = [];
|
|
46
|
-
return ApiResponse.success({ data });
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const searchParams = new URLSearchParams();
|
|
50
|
-
ids.forEach(id => searchParams.append('ids', id));
|
|
51
|
-
|
|
52
|
-
const url = `${this.baseUrl}collector/get/ids?${searchParams.toString()}`;
|
|
53
|
-
|
|
54
|
-
return await this.httpRequest.get(url);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
async putCollectorTransactionBulk(object: CollectorTransactionUpdateRequest[]): Promise<void> {
|
|
58
|
-
const url = `${this.baseUrl}/collector/transactions/bulk`;
|
|
59
|
-
return await this.httpRequest.put(url, object);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
async getLastExchangeRate(currencyId: string): Promise<FiadoApiResponse<GetLastExchangeRateOutput>> {
|
|
63
|
-
const url = `${this.baseUrl}collector/exchage/${currencyId}/current`;
|
|
64
|
-
return await this.httpRequest.get(url);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Actualiza un contrato de crédito con el nuevo identificador de la transacción de pre autorización generada en el
|
|
69
|
-
* proceso de renovación de transacciones de pre autorización próximas a vencer.
|
|
70
|
-
* Update credit contract with the new pre authorization transaction identifier generated in the
|
|
71
|
-
* renewal process of pre authorization transactions that are about to expire.
|
|
72
|
-
* @param CreditContractUpdateRequest Objeto con la información necesaria para actualizar el contrato.
|
|
73
|
-
* @returns Una promesa que resuelve a un arreglo de objetos de people.
|
|
74
|
-
* Puede devolver un arreglo vacío si no se encuentran coincidencias.
|
|
75
|
-
* @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
|
|
76
|
-
*/
|
|
77
|
-
async updateCreditContractByRenewalPreAuth(req: CreditContractUpdateRequest): Promise<FiadoApiResponse<any>> {
|
|
78
|
-
const url = `${this.baseUrl}collector/creditcontracts/renewal/preauth`;
|
|
79
|
-
return await this.httpRequest.put(url, req);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// Reconciliation — query by tenant + date range
|
|
83
|
-
async getCreditContractsByTenant(tenantId: string, startDate: string, endDate: string): Promise<any> {
|
|
84
|
-
const url = `${this.baseUrl}collector/creditcontracts/by-tenant?tenantId=${tenantId}&startDate=${startDate}&endDate=${endDate}`;
|
|
85
|
-
return await this.httpRequest.get(url, { 'operationName': 'getCreditContractsByTenant' });
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
async getCVContractsByTenant(tenantId: string, startDate: string, endDate: string): Promise<any> {
|
|
89
|
-
const url = `${this.baseUrl}collector/cvcontracts/by-tenant?tenantId=${tenantId}&startDate=${startDate}&endDate=${endDate}`;
|
|
90
|
-
return await this.httpRequest.get(url, { 'operationName': 'getCVContractsByTenant' });
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
async getCollectorTransactionsByTenant(tenantId: string, startDate: string, endDate: string): Promise<any> {
|
|
94
|
-
const url = `${this.baseUrl}collector/collectortransactions/by-tenant?tenantId=${tenantId}&startDate=${startDate}&endDate=${endDate}`;
|
|
95
|
-
return await this.httpRequest.get(url, { 'operationName': 'getCollectorTransactionsByTenant' });
|
|
96
|
-
}
|
|
97
|
-
}
|
|
1
|
+
import dotenv from 'dotenv';
|
|
2
|
+
import { inject, injectable } from "inversify";
|
|
3
|
+
import { IHttpRequest } from "@fiado/http-client";
|
|
4
|
+
import { ICollectorApi } from './interfaces/ICollectorApi';
|
|
5
|
+
import CreditContractCreateRequest from '@fiado/type-kit/bin/creditContract/dtos/CreditContractCreateRequest';
|
|
6
|
+
import { CollectorTransactionResponse, CollectorTransactionUpdateRequest, GetLastExchangeRateOutput } from '@fiado/type-kit/bin/collector';
|
|
7
|
+
import { ApiResponse, APIGatewayProxyResultBody } from '@fiado/gateway-adapter';
|
|
8
|
+
import FiadoApiResponse from "@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse";
|
|
9
|
+
import { CreditContractUpdateRequest } from '@fiado/type-kit/bin/collector/dtos/CreditContractUpdateRequest';
|
|
10
|
+
|
|
11
|
+
dotenv.config();
|
|
12
|
+
|
|
13
|
+
@injectable()
|
|
14
|
+
export class CollectorApi implements ICollectorApi {
|
|
15
|
+
|
|
16
|
+
private readonly baseUrl = process.env.COLLECTOR_LAMBDA_URL || "";
|
|
17
|
+
|
|
18
|
+
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) { }
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Crea un nuevo contrato de crédito.
|
|
22
|
+
* @param CreditContractCreateRequest Objeto con la información necesaria para crear el contrato.
|
|
23
|
+
* @returns Una promesa que resuelve a un arreglo de objetos de people.
|
|
24
|
+
* Puede devolver un arreglo vacío si no se encuentran coincidencias.
|
|
25
|
+
* @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
|
|
26
|
+
*/
|
|
27
|
+
async createCreditContract(object: CreditContractCreateRequest): Promise<any> {
|
|
28
|
+
const url = `${this.baseUrl}collector/creditcontracts/create`;
|
|
29
|
+
return await this.httpRequest.post(url, object);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async getCreditContract(relatedId: string): Promise<any> {
|
|
33
|
+
const url = `${this.baseUrl}collector/creditcontracts/collectordata?externalRelatedId=${relatedId}`;
|
|
34
|
+
return await this.httpRequest.get(url);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async getCreditContractByRelatedPreAuthId(relatedPreAuthId: string): Promise<any> {
|
|
38
|
+
const url = `${this.baseUrl}collector/creditcontracts/query?relatedPreAuthId=${relatedPreAuthId}`;
|
|
39
|
+
return await this.httpRequest.get(url);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async getCollectorTransactionByIds(ids: string[]): Promise<APIGatewayProxyResultBody<CollectorTransactionResponse[]>> {
|
|
43
|
+
|
|
44
|
+
if (ids.length === 0) {
|
|
45
|
+
const data: CollectorTransactionResponse[] = [];
|
|
46
|
+
return ApiResponse.success({ data });
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const searchParams = new URLSearchParams();
|
|
50
|
+
ids.forEach(id => searchParams.append('ids', id));
|
|
51
|
+
|
|
52
|
+
const url = `${this.baseUrl}collector/get/ids?${searchParams.toString()}`;
|
|
53
|
+
|
|
54
|
+
return await this.httpRequest.get(url);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async putCollectorTransactionBulk(object: CollectorTransactionUpdateRequest[]): Promise<void> {
|
|
58
|
+
const url = `${this.baseUrl}/collector/transactions/bulk`;
|
|
59
|
+
return await this.httpRequest.put(url, object);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async getLastExchangeRate(currencyId: string): Promise<FiadoApiResponse<GetLastExchangeRateOutput>> {
|
|
63
|
+
const url = `${this.baseUrl}collector/exchage/${currencyId}/current`;
|
|
64
|
+
return await this.httpRequest.get(url);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Actualiza un contrato de crédito con el nuevo identificador de la transacción de pre autorización generada en el
|
|
69
|
+
* proceso de renovación de transacciones de pre autorización próximas a vencer.
|
|
70
|
+
* Update credit contract with the new pre authorization transaction identifier generated in the
|
|
71
|
+
* renewal process of pre authorization transactions that are about to expire.
|
|
72
|
+
* @param CreditContractUpdateRequest Objeto con la información necesaria para actualizar el contrato.
|
|
73
|
+
* @returns Una promesa que resuelve a un arreglo de objetos de people.
|
|
74
|
+
* Puede devolver un arreglo vacío si no se encuentran coincidencias.
|
|
75
|
+
* @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
|
|
76
|
+
*/
|
|
77
|
+
async updateCreditContractByRenewalPreAuth(req: CreditContractUpdateRequest): Promise<FiadoApiResponse<any>> {
|
|
78
|
+
const url = `${this.baseUrl}collector/creditcontracts/renewal/preauth`;
|
|
79
|
+
return await this.httpRequest.put(url, req);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Reconciliation — query by tenant + date range
|
|
83
|
+
async getCreditContractsByTenant(tenantId: string, startDate: string, endDate: string): Promise<any> {
|
|
84
|
+
const url = `${this.baseUrl}collector/creditcontracts/by-tenant?tenantId=${tenantId}&startDate=${startDate}&endDate=${endDate}`;
|
|
85
|
+
return await this.httpRequest.get(url, { 'operationName': 'getCreditContractsByTenant' });
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
async getCVContractsByTenant(tenantId: string, startDate: string, endDate: string): Promise<any> {
|
|
89
|
+
const url = `${this.baseUrl}collector/cvcontracts/by-tenant?tenantId=${tenantId}&startDate=${startDate}&endDate=${endDate}`;
|
|
90
|
+
return await this.httpRequest.get(url, { 'operationName': 'getCVContractsByTenant' });
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
async getCollectorTransactionsByTenant(tenantId: string, startDate: string, endDate: string): Promise<any> {
|
|
94
|
+
const url = `${this.baseUrl}collector/collectortransactions/by-tenant?tenantId=${tenantId}&startDate=${startDate}&endDate=${endDate}`;
|
|
95
|
+
return await this.httpRequest.get(url, { 'operationName': 'getCollectorTransactionsByTenant' });
|
|
96
|
+
}
|
|
97
|
+
}
|
package/src/collector/index.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export * from './interfaces/ICollectorApi';
|
|
1
|
+
|
|
2
|
+
export * from './interfaces/ICollectorApi';
|
|
3
3
|
export * from './CollectorApi';
|