@fiado/api-invoker 1.2.40 → 1.2.42

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.
@@ -0,0 +1,36 @@
1
+ import { ICentralPaymentsConnectorApi } from "./interfaces/ICentralPaymentsConnectorApi";
2
+ import { IHttpRequest } from "@fiado/http-client";
3
+ import { ApiResponse } from "@fiado/gateway-adapter";
4
+ import { CreateBankAccountUserRequest, UpdateBankAccountUserRequest } from "@fiado/type-kit/bin/account";
5
+ import { SubmitOOWQuestionAnswersRequest } from "@fiado/type-kit/bin/centralPayments";
6
+ import { UploadDocumentRequest } from "@fiado/type-kit/bin/identity";
7
+ import { ActivateBankAccountCardRequest, UpdateBankAccountCardRequest } from "@fiado/type-kit/bin/card";
8
+ import { Status } from "@fiado/type-kit/bin/directory/enums/Status";
9
+ export declare class CentralPaymentsConnectorApi implements ICentralPaymentsConnectorApi {
10
+ private readonly httpRequest;
11
+ private readonly baseUrl;
12
+ constructor(httpRequest: IHttpRequest);
13
+ healthcheck(): Promise<ApiResponse>;
14
+ createCardholder(request: CreateBankAccountUserRequest): Promise<ApiResponse>;
15
+ getCardholder(externalUserId: string): Promise<ApiResponse>;
16
+ updateCardholder(externalUserId: string, request: UpdateBankAccountUserRequest): Promise<ApiResponse>;
17
+ getOOWQuestions(externalUserId: string): Promise<ApiResponse>;
18
+ submitOOWQuestionAnswers(externalUserId: string, request: SubmitOOWQuestionAnswersRequest[]): Promise<ApiResponse>;
19
+ uploadDocuments(externalUserId: string, request: UploadDocumentRequest): Promise<ApiResponse>;
20
+ setCardPin(request: UpdateBankAccountCardRequest): Promise<ApiResponse>;
21
+ getCardInformation(externalCardId: string): Promise<ApiResponse>;
22
+ getCardSensitiveInformation(externalCardId: string): Promise<ApiResponse>;
23
+ activateCard(externalCardId: string, request: ActivateBankAccountCardRequest): Promise<ApiResponse>;
24
+ getCardBalance(externalCardId: string): Promise<ApiResponse>;
25
+ updateCardStatus(externalCardId: string, status: Status): Promise<ApiResponse>;
26
+ updateCardProgram(externalCardId: string, programId: string): Promise<ApiResponse>;
27
+ orderPhysicalCard(externalCardId: string): Promise<ApiResponse>;
28
+ getCardsByExternalUserId(externalUserId: string): Promise<ApiResponse>;
29
+ generateCardsInBatch(request: any): Promise<ApiResponse>;
30
+ getCardBatch(batchId: string): Promise<ApiResponse>;
31
+ deleteCardBatch(batchId: string): Promise<ApiResponse>;
32
+ getStatementsList(externalCardId: string): Promise<ApiResponse>;
33
+ getStatementDocument(statementId: string): Promise<ApiResponse>;
34
+ getTransactionHistory(externalCardId: string, params: Record<string, string>): Promise<ApiResponse>;
35
+ getTransactionDetails(externalTransactionId: string): Promise<ApiResponse>;
36
+ }
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.CentralPaymentsConnectorApi = void 0;
16
+ const inversify_1 = require("inversify");
17
+ let CentralPaymentsConnectorApi = class CentralPaymentsConnectorApi {
18
+ constructor(httpRequest) {
19
+ this.httpRequest = httpRequest;
20
+ this.baseUrl = process.env.CENTRAL_PAYMENTS_LAMBDA_URL || "";
21
+ }
22
+ /* HEALTHCHECK */
23
+ async healthcheck() {
24
+ const url = `${this.baseUrl}/healthcheck`;
25
+ return await this.httpRequest.get(url);
26
+ }
27
+ /* CARDHOLDERS */
28
+ async createCardholder(request) {
29
+ const url = `${this.baseUrl}/cardholders`;
30
+ return await this.httpRequest.post(url, request);
31
+ }
32
+ async getCardholder(externalUserId) {
33
+ const url = `${this.baseUrl}/cardholders/${externalUserId}`;
34
+ return await this.httpRequest.get(url);
35
+ }
36
+ async updateCardholder(externalUserId, request) {
37
+ const url = `${this.baseUrl}/cardholders/${externalUserId}`;
38
+ return await this.httpRequest.put(url, request);
39
+ }
40
+ /* KYC DOCUMENTS */
41
+ async getOOWQuestions(externalUserId) {
42
+ const url = `${this.baseUrl}/kyc/${externalUserId}/oow/questions`;
43
+ return await this.httpRequest.get(url);
44
+ }
45
+ async submitOOWQuestionAnswers(externalUserId, request) {
46
+ const url = `${this.baseUrl}/kyc/${externalUserId}/oow/questions`;
47
+ return await this.httpRequest.post(url, request);
48
+ }
49
+ async uploadDocuments(externalUserId, request) {
50
+ const url = `${this.baseUrl}/kyc/${externalUserId}/documents/upload`;
51
+ return await this.httpRequest.post(url);
52
+ }
53
+ /* CARDS */
54
+ async setCardPin(request) {
55
+ const url = `${this.baseUrl}/cards/pin/change`;
56
+ return await this.httpRequest.put(url, request);
57
+ }
58
+ async getCardInformation(externalCardId) {
59
+ const url = `${this.baseUrl}/cards/${externalCardId}`;
60
+ return await this.httpRequest.get(url);
61
+ }
62
+ async getCardSensitiveInformation(externalCardId) {
63
+ const url = `${this.baseUrl}/cards/${externalCardId}/sensitive`;
64
+ return await this.httpRequest.get(url);
65
+ }
66
+ async activateCard(externalCardId, request) {
67
+ const url = `${this.baseUrl}/cards/${externalCardId}/activate`;
68
+ return await this.httpRequest.post(url, request);
69
+ }
70
+ async getCardBalance(externalCardId) {
71
+ const url = `${this.baseUrl}/cards/${externalCardId}/balance`;
72
+ return await this.httpRequest.get(url);
73
+ }
74
+ async updateCardStatus(externalCardId, status) {
75
+ const url = `${this.baseUrl}/cards/${externalCardId}/status/${status}`;
76
+ return await this.httpRequest.put(url);
77
+ }
78
+ async updateCardProgram(externalCardId, programId) {
79
+ const url = `${this.baseUrl}/cards/${externalCardId}/program/${programId}`;
80
+ return await this.httpRequest.put(url);
81
+ }
82
+ async orderPhysicalCard(externalCardId) {
83
+ const url = `${this.baseUrl}/cards/${externalCardId}/physical`;
84
+ return await this.httpRequest.put(url);
85
+ }
86
+ async getCardsByExternalUserId(externalUserId) {
87
+ const url = `${this.baseUrl}/cards/cardholders/${externalUserId}`;
88
+ return await this.httpRequest.get(url);
89
+ }
90
+ async generateCardsInBatch(request) {
91
+ const url = `${this.baseUrl}/cards/batch`;
92
+ return await this.httpRequest.post(url, request);
93
+ }
94
+ async getCardBatch(batchId) {
95
+ const url = `${this.baseUrl}/cards/batch/${batchId}`;
96
+ return await this.httpRequest.get(url);
97
+ }
98
+ async deleteCardBatch(batchId) {
99
+ const url = `${this.baseUrl}/cards/batch/${batchId}`;
100
+ return await this.httpRequest.delete(url);
101
+ }
102
+ /* STATEMENTS */
103
+ async getStatementsList(externalCardId) {
104
+ const url = `${this.baseUrl}/statements/${externalCardId}`;
105
+ return await this.httpRequest.get(url);
106
+ }
107
+ async getStatementDocument(statementId) {
108
+ const url = `${this.baseUrl}/statements/document-url/${statementId}`;
109
+ return await this.httpRequest.get(url);
110
+ }
111
+ /* TRANSACTIONS */
112
+ async getTransactionHistory(externalCardId, params) {
113
+ const url = `${this.baseUrl}/transactions/${externalCardId}?${new URLSearchParams(params)}`;
114
+ return await this.httpRequest.get(url);
115
+ }
116
+ async getTransactionDetails(externalTransactionId) {
117
+ const url = `${this.baseUrl}/transactions/${externalTransactionId}`;
118
+ return await this.httpRequest.get(url);
119
+ }
120
+ };
121
+ exports.CentralPaymentsConnectorApi = CentralPaymentsConnectorApi;
122
+ exports.CentralPaymentsConnectorApi = CentralPaymentsConnectorApi = __decorate([
123
+ (0, inversify_1.injectable)(),
124
+ __param(0, (0, inversify_1.inject)("IHttpRequest")),
125
+ __metadata("design:paramtypes", [Object])
126
+ ], CentralPaymentsConnectorApi);
@@ -0,0 +1,2 @@
1
+ export * from './interfaces/ICentralPaymentsConnectorApi';
2
+ export * from './CentralPaymentsConnectorApi';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./interfaces/ICentralPaymentsConnectorApi"), exports);
18
+ __exportStar(require("./CentralPaymentsConnectorApi"), exports);
@@ -0,0 +1,31 @@
1
+ import { ApiResponse } from "@fiado/gateway-adapter";
2
+ import { CreateBankAccountUserRequest, UpdateBankAccountUserRequest } from "@fiado/type-kit/bin/account";
3
+ import { SubmitOOWQuestionAnswersRequest } from "@fiado/type-kit/bin/centralPayments";
4
+ import { UploadDocumentRequest } from "@fiado/type-kit/bin/identity";
5
+ import { ActivateBankAccountCardRequest, UpdateBankAccountCardRequest } from "@fiado/type-kit/bin/card";
6
+ import { Status } from "@fiado/type-kit/bin/directory/enums/Status";
7
+ export interface ICentralPaymentsConnectorApi {
8
+ healthcheck(): Promise<ApiResponse>;
9
+ createCardholder(request: CreateBankAccountUserRequest): Promise<ApiResponse>;
10
+ getCardholder(externalUserId: string): Promise<ApiResponse>;
11
+ updateCardholder(externalUserId: string, request: UpdateBankAccountUserRequest): Promise<ApiResponse>;
12
+ getOOWQuestions(externalUserId: string): Promise<ApiResponse>;
13
+ submitOOWQuestionAnswers(externalUserId: string, request: SubmitOOWQuestionAnswersRequest[]): Promise<ApiResponse>;
14
+ uploadDocuments(externalUserId: string, request: UploadDocumentRequest): Promise<ApiResponse>;
15
+ setCardPin(request: UpdateBankAccountCardRequest): Promise<ApiResponse>;
16
+ getCardInformation(externalCardId: string): Promise<ApiResponse>;
17
+ getCardSensitiveInformation(externalCardId: string): Promise<ApiResponse>;
18
+ activateCard(externalCardId: string, request: ActivateBankAccountCardRequest): Promise<ApiResponse>;
19
+ getCardBalance(externalCardId: string): Promise<ApiResponse>;
20
+ updateCardStatus(externalCardId: string, status: Status): Promise<ApiResponse>;
21
+ updateCardProgram(externalCardId: string, programId: string): Promise<ApiResponse>;
22
+ orderPhysicalCard(externalCardId: string): Promise<ApiResponse>;
23
+ getCardsByExternalUserId(externalUserId: string): Promise<ApiResponse>;
24
+ generateCardsInBatch(request: any): Promise<ApiResponse>;
25
+ getCardBatch(batchId: string): Promise<ApiResponse>;
26
+ deleteCardBatch(batchId: string): Promise<ApiResponse>;
27
+ getStatementsList(externalCardId: string): Promise<ApiResponse>;
28
+ getStatementDocument(statementId: string): Promise<ApiResponse>;
29
+ getTransactionHistory(externalCardId: string, params: Record<string, string>): Promise<ApiResponse>;
30
+ getTransactionDetails(externalTransactionId: string): Promise<ApiResponse>;
31
+ }
@@ -20,16 +20,18 @@ let CognitoApi = class CognitoApi {
20
20
  }
21
21
  async healthcheck() {
22
22
  const url = `${this.baseUrl}healthcheck`;
23
- return this.httpRequest.get(url);
23
+ const response = await this.httpRequest.get(url);
24
+ return response.data;
24
25
  }
25
26
  async signUp(request) {
26
27
  const url = `${this.baseUrl}cognito/signUp`;
27
- return this.httpRequest.post(url, request);
28
+ const response = await this.httpRequest.post(url, request);
29
+ return response.data;
28
30
  }
29
31
  async signUpConfirm(request) {
30
32
  const url = `${this.baseUrl}cognito/signUp/confirm`;
31
- // Como el endpoint retorna un 200 vacío, devuelves void
32
- await this.httpRequest.post(url, request);
33
+ const response = this.httpRequest.post(url, request);
34
+ return response.data;
33
35
  }
34
36
  async signIn(request) {
35
37
  const url = `${this.baseUrl}cognito/signIn`;
@@ -45,19 +47,23 @@ let CognitoApi = class CognitoApi {
45
47
  }
46
48
  async getUser(request) {
47
49
  const url = `${this.baseUrl}cognito/user`;
48
- return this.httpRequest.post(url, request);
50
+ const response = await this.httpRequest.post(url, request);
51
+ return response.data;
49
52
  }
50
53
  async refreshToken(request) {
51
54
  const url = `${this.baseUrl}cognito/refreshToken`;
52
- return this.httpRequest.post(url, request);
55
+ const response = await this.httpRequest.post(url, request);
56
+ return response.data;
53
57
  }
54
58
  async respondToAuthChallenge(request) {
55
59
  const url = `${this.baseUrl}cognito/respondToAuthChallenge`;
56
- return this.httpRequest.post(url, request);
60
+ const response = await this.httpRequest.post(url, request);
61
+ return response.data;
57
62
  }
58
63
  async resetPassword(request) {
59
64
  const url = `${this.baseUrl}cognito/resetPassword`;
60
- await this.httpRequest.post(url, request);
65
+ const response = await this.httpRequest.post(url, request);
66
+ return response.data;
61
67
  }
62
68
  };
63
69
  CognitoApi = __decorate([
@@ -50,6 +50,7 @@ const blacklist_1 = require("./blacklist");
50
50
  const device_1 = require("./device");
51
51
  const observations_1 = require("./observations");
52
52
  const CognitoConnectorV2_1 = __importDefault(require("./cognitoConnector/CognitoConnectorV2"));
53
+ const centralPayments_1 = require("./centralPayments");
53
54
  exports.apiInvokerBindings = new inversify_1.ContainerModule((bind) => {
54
55
  bind("IDirectoryApi").to(directory_1.DirectoryApi);
55
56
  bind("IIdentityApi").to(identity_1.IdentityApi);
@@ -96,4 +97,5 @@ exports.apiInvokerBindings = new inversify_1.ContainerModule((bind) => {
96
97
  bind("IBlackListApi").to(blacklist_1.BlackListApi);
97
98
  bind("IDeviceApi").to(device_1.DeviceApi);
98
99
  bind("IObservationsApi").to(observations_1.ObservationsApi);
100
+ bind("ICentralPaymentsConnectorApi").to(centralPayments_1.CentralPaymentsConnectorApi);
99
101
  });
package/bin/index.d.ts CHANGED
@@ -33,6 +33,7 @@ export * from "./pomeloProcessor";
33
33
  export * from "./disputes";
34
34
  export * from "./directories";
35
35
  export * from "./cognitoConnector";
36
+ export * from "./centralPayments";
36
37
  export * from "./zendesk";
37
38
  export * from "./blacklist";
38
39
  export * from "./legalDocument";
package/bin/index.js CHANGED
@@ -49,6 +49,7 @@ __exportStar(require("./pomeloProcessor"), exports);
49
49
  __exportStar(require("./disputes"), exports);
50
50
  __exportStar(require("./directories"), exports);
51
51
  __exportStar(require("./cognitoConnector"), exports);
52
+ __exportStar(require("./centralPayments"), exports);
52
53
  __exportStar(require("./zendesk"), exports);
53
54
  __exportStar(require("./blacklist"), exports);
54
55
  __exportStar(require("./legalDocument"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/api-invoker",
3
- "version": "1.2.40",
3
+ "version": "1.2.42",
4
4
  "description": "Sirve como un puente entre diferentes funciones lambda, facilitando la comunicación entre ellas a través de invocaciones http",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",
@@ -12,15 +12,15 @@
12
12
  "author": "Fiado Inc",
13
13
  "license": "ISC",
14
14
  "dependencies": {
15
- "@aws-sdk/client-sqs": "^3.750.0",
15
+ "@aws-sdk/client-sqs": "^3.572.0",
16
16
  "@fiado/gateway-adapter": "^1.1.40",
17
- "@fiado/http-client": "^1.0.4",
17
+ "@fiado/http-client": "^1.0.2",
18
18
  "@fiado/logger": "^1.0.3",
19
- "@fiado/type-kit": "^1.6.84",
20
- "dotenv": "^16.4.7",
21
- "inversify": "^6.2.2",
22
- "reflect-metadata": "^0.2.2",
23
- "typescript": "^5.7.3"
19
+ "@fiado/type-kit": "^1.7.5",
20
+ "dotenv": "^16.4.5",
21
+ "inversify": "^6.0.2",
22
+ "reflect-metadata": "^0.2.1",
23
+ "typescript": "^5.4.3"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/node": "^20.12.7"
@@ -0,0 +1,142 @@
1
+ import {ICentralPaymentsConnectorApi} from "./interfaces/ICentralPaymentsConnectorApi";
2
+ import {inject, injectable} from "inversify";
3
+ import {IHttpRequest} from "@fiado/http-client";
4
+ import {ApiResponse} from "@fiado/gateway-adapter";
5
+ import {CreateBankAccountUserRequest, UpdateBankAccountUserRequest} from "@fiado/type-kit/bin/account";
6
+ import {SubmitOOWQuestionAnswersRequest} from "@fiado/type-kit/bin/centralPayments";
7
+ import {UploadDocumentRequest} from "@fiado/type-kit/bin/identity";
8
+ import {ActivateBankAccountCardRequest, UpdateBankAccountCardRequest} from "@fiado/type-kit/bin/card";
9
+ import {Status} from "@fiado/type-kit/bin/directory/enums/Status";
10
+
11
+ @injectable()
12
+ export class CentralPaymentsConnectorApi implements ICentralPaymentsConnectorApi {
13
+ private readonly baseUrl = process.env.CENTRAL_PAYMENTS_LAMBDA_URL || "";
14
+
15
+ constructor(
16
+ @inject("IHttpRequest") private readonly httpRequest: IHttpRequest
17
+ ) {
18
+ }
19
+
20
+ /* HEALTHCHECK */
21
+ async healthcheck(): Promise<ApiResponse> {
22
+ const url = `${this.baseUrl}/healthcheck`;
23
+ return await this.httpRequest.get(url);
24
+ }
25
+
26
+ /* CARDHOLDERS */
27
+ async createCardholder(request: CreateBankAccountUserRequest): Promise<ApiResponse> {
28
+ const url = `${this.baseUrl}/cardholders`;
29
+ return await this.httpRequest.post(url, request);
30
+ }
31
+
32
+ async getCardholder(externalUserId: string): Promise<ApiResponse> {
33
+ const url = `${this.baseUrl}/cardholders/${externalUserId}`;
34
+ return await this.httpRequest.get(url);
35
+ }
36
+
37
+ async updateCardholder(externalUserId: string, request: UpdateBankAccountUserRequest): Promise<ApiResponse> {
38
+ const url = `${this.baseUrl}/cardholders/${externalUserId}`;
39
+ return await this.httpRequest.put(url, request);
40
+ }
41
+
42
+ /* KYC DOCUMENTS */
43
+ async getOOWQuestions(externalUserId: string): Promise<ApiResponse> {
44
+ const url = `${this.baseUrl}/kyc/${externalUserId}/oow/questions`;
45
+ return await this.httpRequest.get(url);
46
+ }
47
+
48
+ async submitOOWQuestionAnswers(externalUserId: string, request: SubmitOOWQuestionAnswersRequest[]): Promise<ApiResponse> {
49
+ const url = `${this.baseUrl}/kyc/${externalUserId}/oow/questions`;
50
+ return await this.httpRequest.post(url, request);
51
+ }
52
+
53
+ async uploadDocuments(externalUserId: string, request: UploadDocumentRequest): Promise<ApiResponse> {
54
+ const url = `${this.baseUrl}/kyc/${externalUserId}/documents/upload`;
55
+ return await this.httpRequest.post(url);
56
+ }
57
+
58
+ /* CARDS */
59
+ async setCardPin(request: UpdateBankAccountCardRequest): Promise<ApiResponse> {
60
+ const url = `${this.baseUrl}/cards/pin/change`;
61
+ return await this.httpRequest.put(url, request);
62
+ }
63
+
64
+ async getCardInformation(externalCardId: string): Promise<ApiResponse> {
65
+ const url = `${this.baseUrl}/cards/${externalCardId}`;
66
+ return await this.httpRequest.get(url);
67
+ }
68
+
69
+ async getCardSensitiveInformation(externalCardId: string): Promise<ApiResponse> {
70
+ const url = `${this.baseUrl}/cards/${externalCardId}/sensitive`;
71
+ return await this.httpRequest.get(url);
72
+ }
73
+
74
+ async activateCard(externalCardId: string, request: ActivateBankAccountCardRequest): Promise<ApiResponse> {
75
+ const url = `${this.baseUrl}/cards/${externalCardId}/activate`;
76
+ return await this.httpRequest.post(url, request);
77
+ }
78
+
79
+ async getCardBalance(externalCardId: string): Promise<ApiResponse> {
80
+ const url = `${this.baseUrl}/cards/${externalCardId}/balance`;
81
+ return await this.httpRequest.get(url);
82
+ }
83
+
84
+ async updateCardStatus(externalCardId: string, status: Status): Promise<ApiResponse> {
85
+ const url = `${this.baseUrl}/cards/${externalCardId}/status/${status}`;
86
+ return await this.httpRequest.put(url);
87
+ }
88
+
89
+ async updateCardProgram(externalCardId: string, programId: string): Promise<ApiResponse> {
90
+ const url = `${this.baseUrl}/cards/${externalCardId}/program/${programId}`;
91
+ return await this.httpRequest.put(url);
92
+ }
93
+
94
+ async orderPhysicalCard(externalCardId: string): Promise<ApiResponse> {
95
+ const url = `${this.baseUrl}/cards/${externalCardId}/physical`;
96
+ return await this.httpRequest.put(url);
97
+ }
98
+
99
+ async getCardsByExternalUserId(externalUserId: string): Promise<ApiResponse> {
100
+ const url = `${this.baseUrl}/cards/cardholders/${externalUserId}`;
101
+ return await this.httpRequest.get(url);
102
+ }
103
+
104
+ async generateCardsInBatch(request: any): Promise<ApiResponse> {
105
+ const url = `${this.baseUrl}/cards/batch`;
106
+ return await this.httpRequest.post(url, request);
107
+ }
108
+
109
+ async getCardBatch(batchId: string): Promise<ApiResponse> {
110
+ const url = `${this.baseUrl}/cards/batch/${batchId}`;
111
+ return await this.httpRequest.get(url);
112
+ }
113
+
114
+ async deleteCardBatch(batchId: string): Promise<ApiResponse> {
115
+ const url = `${this.baseUrl}/cards/batch/${batchId}`;
116
+ return await this.httpRequest.delete(url);
117
+ }
118
+
119
+ /* STATEMENTS */
120
+ async getStatementsList(externalCardId: string): Promise<ApiResponse> {
121
+ const url = `${this.baseUrl}/statements/${externalCardId}`;
122
+ return await this.httpRequest.get(url);
123
+ }
124
+
125
+ async getStatementDocument(statementId: string): Promise<ApiResponse> {
126
+ const url = `${this.baseUrl}/statements/document-url/${statementId}`;
127
+ return await this.httpRequest.get(url);
128
+ }
129
+
130
+ /* TRANSACTIONS */
131
+ async getTransactionHistory(externalCardId: string,
132
+ params: Record<string, string>
133
+ ): Promise<ApiResponse> {
134
+ const url = `${this.baseUrl}/transactions/${externalCardId}?${new URLSearchParams(params)}`;
135
+ return await this.httpRequest.get(url);
136
+ }
137
+
138
+ async getTransactionDetails(externalTransactionId: string): Promise<ApiResponse> {
139
+ const url = `${this.baseUrl}/transactions/${externalTransactionId}`;
140
+ return await this.httpRequest.get(url);
141
+ }
142
+ }
@@ -0,0 +1,2 @@
1
+ export * from './interfaces/ICentralPaymentsConnectorApi';
2
+ export * from './CentralPaymentsConnectorApi';
@@ -0,0 +1,54 @@
1
+ import {ApiResponse} from "@fiado/gateway-adapter";
2
+ import {CreateBankAccountUserRequest, UpdateBankAccountUserRequest} from "@fiado/type-kit/bin/account";
3
+ import {SubmitOOWQuestionAnswersRequest} from "@fiado/type-kit/bin/centralPayments";
4
+ import {UploadDocumentRequest} from "@fiado/type-kit/bin/identity";
5
+ import {ActivateBankAccountCardRequest, UpdateBankAccountCardRequest} from "@fiado/type-kit/bin/card";
6
+ import {Status} from "@fiado/type-kit/bin/directory/enums/Status";
7
+
8
+ export interface ICentralPaymentsConnectorApi {
9
+ healthcheck(): Promise<ApiResponse>;
10
+
11
+ createCardholder(request: CreateBankAccountUserRequest): Promise<ApiResponse>;
12
+
13
+ getCardholder(externalUserId: string): Promise<ApiResponse>;
14
+
15
+ updateCardholder(externalUserId: string, request: UpdateBankAccountUserRequest): Promise<ApiResponse>;
16
+
17
+ getOOWQuestions(externalUserId: string): Promise<ApiResponse>;
18
+
19
+ submitOOWQuestionAnswers(externalUserId: string, request: SubmitOOWQuestionAnswersRequest[]): Promise<ApiResponse>;
20
+
21
+ uploadDocuments(externalUserId: string, request: UploadDocumentRequest): Promise<ApiResponse>;
22
+
23
+ setCardPin(request: UpdateBankAccountCardRequest): Promise<ApiResponse>;
24
+
25
+ getCardInformation(externalCardId: string): Promise<ApiResponse>;
26
+
27
+ getCardSensitiveInformation(externalCardId: string): Promise<ApiResponse>;
28
+
29
+ activateCard(externalCardId: string, request: ActivateBankAccountCardRequest): Promise<ApiResponse>;
30
+
31
+ getCardBalance(externalCardId: string): Promise<ApiResponse>;
32
+
33
+ updateCardStatus(externalCardId: string, status: Status): Promise<ApiResponse>;
34
+
35
+ updateCardProgram(externalCardId: string, programId: string): Promise<ApiResponse>
36
+
37
+ orderPhysicalCard(externalCardId: string): Promise<ApiResponse>;
38
+
39
+ getCardsByExternalUserId(externalUserId: string): Promise<ApiResponse>;
40
+
41
+ generateCardsInBatch(request: any): Promise<ApiResponse>;
42
+
43
+ getCardBatch(batchId: string): Promise<ApiResponse>;
44
+
45
+ deleteCardBatch(batchId: string): Promise<ApiResponse>;
46
+
47
+ getStatementsList(externalCardId: string): Promise<ApiResponse>;
48
+
49
+ getStatementDocument(statementId: string): Promise<ApiResponse>;
50
+
51
+ getTransactionHistory(externalCardId: string, params: Record<string, string>): Promise<ApiResponse>;
52
+
53
+ getTransactionDetails(externalTransactionId: string): Promise<ApiResponse>;
54
+ }
@@ -24,18 +24,20 @@ export default class CognitoApi implements ICognitoV2Api {
24
24
 
25
25
  async healthcheck(): Promise<HealthcheckResponse> {
26
26
  const url = `${this.baseUrl}healthcheck`;
27
- return this.httpRequest.get(url);
27
+ const response:any = await this.httpRequest.get(url);
28
+ return response.data;
28
29
  }
29
30
 
30
31
  async signUp(request: SignUpRequest): Promise<SignUpResponse> {
31
32
  const url = `${this.baseUrl}cognito/signUp`;
32
- return this.httpRequest.post(url, request);
33
+ const response: any = await this.httpRequest.post(url, request);
34
+ return response.data;
33
35
  }
34
36
 
35
37
  async signUpConfirm(request: SignUpConfirmRequest): Promise<void> {
36
38
  const url = `${this.baseUrl}cognito/signUp/confirm`;
37
- // Como el endpoint retorna un 200 vacío, devuelves void
38
- await this.httpRequest.post(url, request);
39
+ const response: any = this.httpRequest.post(url, request);
40
+ return response.data;
39
41
  }
40
42
 
41
43
  async signIn(request: SignInRequest): Promise<SignInResponse> {
@@ -55,21 +57,25 @@ export default class CognitoApi implements ICognitoV2Api {
55
57
 
56
58
  async getUser(request: GetUserRequest): Promise<GetUserResponse> {
57
59
  const url = `${this.baseUrl}cognito/user`;
58
- return this.httpRequest.post(url, request);
60
+ const response: any = await this.httpRequest.post(url, request);
61
+ return response.data;
59
62
  }
60
63
 
61
64
  async refreshToken(request: RefreshTokenRequest): Promise<RefreshTokenResponse> {
62
65
  const url = `${this.baseUrl}cognito/refreshToken`;
63
- return this.httpRequest.post(url, request);
66
+ const response: any = await this.httpRequest.post(url, request);
67
+ return response.data;
64
68
  }
65
69
 
66
70
  async respondToAuthChallenge(request: RespondToAuthChallengeRequest): Promise<any> {
67
71
  const url = `${this.baseUrl}cognito/respondToAuthChallenge`;
68
- return this.httpRequest.post(url, request);
72
+ const response: any = await this.httpRequest.post(url, request);
73
+ return response.data;
69
74
  }
70
75
 
71
76
  async resetPassword(request: SetPasswordRequest): Promise<void> {
72
77
  const url = `${this.baseUrl}cognito/resetPassword`;
73
- await this.httpRequest.post(url, request);
78
+ const response: any = await this.httpRequest.post(url, request);
79
+ return response.data;
74
80
  }
75
81
  }
@@ -61,6 +61,7 @@ import { BlackListApi, IBlackListApi } from "./blacklist";
61
61
  import { DeviceApi, IDeviceApi } from "./device";
62
62
  import { IObservationsApi, ObservationsApi } from "./observations";
63
63
  import CognitoApi from "./cognitoConnector/CognitoConnectorV2";
64
+ import {CentralPaymentsConnectorApi, ICentralPaymentsConnectorApi} from "./centralPayments";
64
65
 
65
66
  export const apiInvokerBindings = new ContainerModule((bind: interfaces.Bind) => {
66
67
  bind<IDirectoryApi>("IDirectoryApi").to(DirectoryApi);
@@ -108,6 +109,5 @@ export const apiInvokerBindings = new ContainerModule((bind: interfaces.Bind) =>
108
109
  bind<IBlackListApi>("IBlackListApi").to(BlackListApi);
109
110
  bind<IDeviceApi>("IDeviceApi").to(DeviceApi);
110
111
  bind<IObservationsApi>("IObservationsApi").to(ObservationsApi);
111
-
112
-
112
+ bind<ICentralPaymentsConnectorApi>("ICentralPaymentsConnectorApi").to(CentralPaymentsConnectorApi);
113
113
  });
package/src/index.ts CHANGED
@@ -33,6 +33,7 @@ export * from "./pomeloProcessor";
33
33
  export * from "./disputes";
34
34
  export * from "./directories";
35
35
  export * from "./cognitoConnector";
36
+ export * from "./centralPayments";
36
37
  export * from "./zendesk";
37
38
  export * from "./blacklist";
38
39
  export * from "./legalDocument";
@@ -1,46 +0,0 @@
1
- import { ChangePasswordRequest, GetUserRequest, GetUserResponse, RefreshTokenRequest, RefreshTokenResponse, RespondToAuthChallengeRequest, SetPasswordRequest, SignInRequest, SignInResponse, SignUpConfirmRequest, SignUpRequest, SignUpResponse } from "@fiado/type-kit/bin/cognitoConnector";
2
- export interface ICognitoApi {
3
- /**
4
- * Healthcheck for the cognito-connector
5
- */
6
- healthcheck(): Promise<HealthcheckResponse>;
7
- /**
8
- * Create a new user in Cognito
9
- */
10
- signUp(request: SignUpRequest): Promise<SignUpResponse>;
11
- /**
12
- * Confirm sign-up for a user in Cognito
13
- */
14
- signUpConfirm(request: SignUpConfirmRequest): Promise<void>;
15
- /**
16
- * Sign in a user
17
- */
18
- signIn(request: SignInRequest): Promise<SignInResponse>;
19
- /**
20
- * Sign out a user
21
- */
22
- signOut(): Promise<void>;
23
- /**
24
- * Change a user's password
25
- */
26
- changePassword(request: ChangePasswordRequest): Promise<void>;
27
- /**
28
- * Retrieve user details
29
- */
30
- getUser(request: GetUserRequest): Promise<GetUserResponse>;
31
- /**
32
- * Refresh a user's tokens
33
- */
34
- refreshToken(request: RefreshTokenRequest): Promise<RefreshTokenResponse>;
35
- /**
36
- * Respond to an auth challenge
37
- */
38
- respondToAuthChallenge(request: RespondToAuthChallengeRequest): Promise<any>;
39
- /**
40
- * Reset a user's password
41
- */
42
- resetPassword(request: SetPasswordRequest): Promise<void>;
43
- }
44
- export interface HealthcheckResponse {
45
- status: string;
46
- }