@fiado/api-invoker 1.2.42 → 1.2.43
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/bin/centralPayments/CentralPaymentsConnectorApi.d.ts +32 -29
- package/bin/centralPayments/CentralPaymentsConnectorApi.js +17 -9
- package/bin/centralPayments/interfaces/ICentralPaymentsConnectorApi.d.ts +29 -28
- package/bin/container.config.js +4 -0
- package/bin/utils/InvokerUtils.d.ts +4 -0
- package/bin/utils/InvokerUtils.js +34 -0
- package/package.json +2 -2
- package/src/centralPayments/CentralPaymentsConnectorApi.ts +68 -37
- package/src/centralPayments/interfaces/ICentralPaymentsConnectorApi.ts +55 -28
- package/src/container.config.ts +20 -10
- package/src/utils/InvokerUtils.ts +19 -0
|
@@ -1,36 +1,39 @@
|
|
|
1
1
|
import { ICentralPaymentsConnectorApi } from "./interfaces/ICentralPaymentsConnectorApi";
|
|
2
2
|
import { IHttpRequest } from "@fiado/http-client";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { UploadDocumentRequest } from "@fiado/type-kit/bin/identity";
|
|
7
|
-
import { ActivateBankAccountCardRequest, UpdateBankAccountCardRequest } from "@fiado/type-kit/bin/card";
|
|
3
|
+
import { CreateBankAccountUserRequest, CreateBankAccountUserResponse, GetBankAccountUserResponse, UpdateBankAccountUserRequest } from "@fiado/type-kit/bin/account";
|
|
4
|
+
import { CentralPaymentsDocumentUploadRequest, HealthcheckResponse, OOWQuestionsResponse, SubmitOOWQuestionAnswersRequest } from "@fiado/type-kit/bin/centralPayments";
|
|
5
|
+
import { ActivateBankAccountCardRequest, ActivateBankAccountCardResponse, CardBatchRequest, CardBatchResponse, CardStatementListResponse, GetBankAccountCardBalanceResponse, GetBankAccountCardResponse, StatementDocumentResponse, UpdateBankAccountCardRequest, UpdateBankAccountCardResponse } from "@fiado/type-kit/bin/card";
|
|
8
6
|
import { Status } from "@fiado/type-kit/bin/directory/enums/Status";
|
|
7
|
+
import FiadoApiResponse from "@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse";
|
|
8
|
+
import { CentralPaymentsQueryParams, CentralPaymentsTransactionItem, TransactionListResponse } from "@fiado/type-kit/bin/transaction";
|
|
9
|
+
import { InvokerUtils } from "../utils/InvokerUtils";
|
|
9
10
|
export declare class CentralPaymentsConnectorApi implements ICentralPaymentsConnectorApi {
|
|
10
11
|
private readonly httpRequest;
|
|
12
|
+
private readonly _invokerUtils;
|
|
11
13
|
private readonly baseUrl;
|
|
12
|
-
constructor(httpRequest: IHttpRequest);
|
|
13
|
-
healthcheck(): Promise<
|
|
14
|
-
createCardholder(request: CreateBankAccountUserRequest): Promise<
|
|
15
|
-
getCardholder(externalUserId: string): Promise<
|
|
16
|
-
updateCardholder(externalUserId: string, request: UpdateBankAccountUserRequest): Promise<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
14
|
+
constructor(httpRequest: IHttpRequest, _invokerUtils: InvokerUtils);
|
|
15
|
+
healthcheck(): Promise<FiadoApiResponse<HealthcheckResponse>>;
|
|
16
|
+
createCardholder(request: CreateBankAccountUserRequest): Promise<FiadoApiResponse<CreateBankAccountUserResponse>>;
|
|
17
|
+
getCardholder(externalUserId: string): Promise<FiadoApiResponse<GetBankAccountUserResponse>>;
|
|
18
|
+
updateCardholder(externalUserId: string, request: UpdateBankAccountUserRequest): Promise<FiadoApiResponse<GetBankAccountUserResponse>>;
|
|
19
|
+
deleteCardholder(externalUserId: string): Promise<FiadoApiResponse<null>>;
|
|
20
|
+
getOOWQuestions(externalUserId: string): Promise<FiadoApiResponse<OOWQuestionsResponse[]>>;
|
|
21
|
+
submitOOWQuestionAnswers(externalUserId: string, request: SubmitOOWQuestionAnswersRequest[]): Promise<FiadoApiResponse<GetBankAccountUserResponse>>;
|
|
22
|
+
uploadDocuments(externalUserId: string, request: CentralPaymentsDocumentUploadRequest): Promise<FiadoApiResponse<null>>;
|
|
23
|
+
setCardPin(request: UpdateBankAccountCardRequest): Promise<FiadoApiResponse<UpdateBankAccountCardResponse>>;
|
|
24
|
+
getCardInformation(externalCardId: string): Promise<FiadoApiResponse<GetBankAccountCardResponse>>;
|
|
25
|
+
getCardSensitiveInformation(externalCardId: string): Promise<FiadoApiResponse<GetBankAccountCardResponse>>;
|
|
26
|
+
activateCard(externalCardId: string, request: ActivateBankAccountCardRequest): Promise<FiadoApiResponse<ActivateBankAccountCardResponse>>;
|
|
27
|
+
getCardBalance(externalCardId: string): Promise<FiadoApiResponse<GetBankAccountCardBalanceResponse>>;
|
|
28
|
+
updateCardStatus(externalCardId: string, status: Status): Promise<FiadoApiResponse<GetBankAccountCardResponse>>;
|
|
29
|
+
updateCardProgram(externalCardId: string, programId: string): Promise<FiadoApiResponse<GetBankAccountCardResponse>>;
|
|
30
|
+
orderPhysicalCard(externalUserId: string): Promise<FiadoApiResponse<GetBankAccountCardResponse>>;
|
|
31
|
+
getCardsByExternalUserId(externalUserId: string): Promise<FiadoApiResponse<GetBankAccountCardResponse>>;
|
|
32
|
+
generateCardsInBatch(request: CardBatchRequest): Promise<FiadoApiResponse<CardBatchResponse>>;
|
|
33
|
+
getCardBatch(batchId: string): Promise<FiadoApiResponse<CardBatchResponse>>;
|
|
34
|
+
deleteCardBatch(batchId: string): Promise<FiadoApiResponse<CardBatchResponse>>;
|
|
35
|
+
getStatementsList(externalCardId: string): Promise<FiadoApiResponse<CardStatementListResponse[]>>;
|
|
36
|
+
getStatementDocument(statementId: string): Promise<FiadoApiResponse<StatementDocumentResponse>>;
|
|
37
|
+
getTransactionHistory(externalCardId: string, params: CentralPaymentsQueryParams): Promise<FiadoApiResponse<TransactionListResponse<CentralPaymentsTransactionItem>>>;
|
|
38
|
+
getTransactionDetails(externalTransactionId: string): Promise<FiadoApiResponse<CentralPaymentsTransactionItem>>;
|
|
36
39
|
}
|
|
@@ -14,9 +14,11 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.CentralPaymentsConnectorApi = void 0;
|
|
16
16
|
const inversify_1 = require("inversify");
|
|
17
|
+
const InvokerUtils_1 = require("../utils/InvokerUtils");
|
|
17
18
|
let CentralPaymentsConnectorApi = class CentralPaymentsConnectorApi {
|
|
18
|
-
constructor(httpRequest) {
|
|
19
|
+
constructor(httpRequest, _invokerUtils) {
|
|
19
20
|
this.httpRequest = httpRequest;
|
|
21
|
+
this._invokerUtils = _invokerUtils;
|
|
20
22
|
this.baseUrl = process.env.CENTRAL_PAYMENTS_LAMBDA_URL || "";
|
|
21
23
|
}
|
|
22
24
|
/* HEALTHCHECK */
|
|
@@ -37,6 +39,10 @@ let CentralPaymentsConnectorApi = class CentralPaymentsConnectorApi {
|
|
|
37
39
|
const url = `${this.baseUrl}/cardholders/${externalUserId}`;
|
|
38
40
|
return await this.httpRequest.put(url, request);
|
|
39
41
|
}
|
|
42
|
+
async deleteCardholder(externalUserId) {
|
|
43
|
+
const url = `${this.baseUrl}/cardholders/${externalUserId}`;
|
|
44
|
+
return await this.httpRequest.delete(url);
|
|
45
|
+
}
|
|
40
46
|
/* KYC DOCUMENTS */
|
|
41
47
|
async getOOWQuestions(externalUserId) {
|
|
42
48
|
const url = `${this.baseUrl}/kyc/${externalUserId}/oow/questions`;
|
|
@@ -48,12 +54,12 @@ let CentralPaymentsConnectorApi = class CentralPaymentsConnectorApi {
|
|
|
48
54
|
}
|
|
49
55
|
async uploadDocuments(externalUserId, request) {
|
|
50
56
|
const url = `${this.baseUrl}/kyc/${externalUserId}/documents/upload`;
|
|
51
|
-
return await this.httpRequest.post(url);
|
|
57
|
+
return await this.httpRequest.post(url, request);
|
|
52
58
|
}
|
|
53
59
|
/* CARDS */
|
|
54
60
|
async setCardPin(request) {
|
|
55
61
|
const url = `${this.baseUrl}/cards/pin/change`;
|
|
56
|
-
return await this.httpRequest.
|
|
62
|
+
return await this.httpRequest.post(url, request);
|
|
57
63
|
}
|
|
58
64
|
async getCardInformation(externalCardId) {
|
|
59
65
|
const url = `${this.baseUrl}/cards/${externalCardId}`;
|
|
@@ -76,11 +82,11 @@ let CentralPaymentsConnectorApi = class CentralPaymentsConnectorApi {
|
|
|
76
82
|
return await this.httpRequest.put(url);
|
|
77
83
|
}
|
|
78
84
|
async updateCardProgram(externalCardId, programId) {
|
|
79
|
-
const url = `${this.baseUrl}/cards/${externalCardId}/
|
|
85
|
+
const url = `${this.baseUrl}/cards/${externalCardId}/programs/${programId}`;
|
|
80
86
|
return await this.httpRequest.put(url);
|
|
81
87
|
}
|
|
82
|
-
async orderPhysicalCard(
|
|
83
|
-
const url = `${this.baseUrl}/cards/${
|
|
88
|
+
async orderPhysicalCard(externalUserId) {
|
|
89
|
+
const url = `${this.baseUrl}/cards/physical/order/${externalUserId}`;
|
|
84
90
|
return await this.httpRequest.put(url);
|
|
85
91
|
}
|
|
86
92
|
async getCardsByExternalUserId(externalUserId) {
|
|
@@ -101,7 +107,7 @@ let CentralPaymentsConnectorApi = class CentralPaymentsConnectorApi {
|
|
|
101
107
|
}
|
|
102
108
|
/* STATEMENTS */
|
|
103
109
|
async getStatementsList(externalCardId) {
|
|
104
|
-
const url = `${this.baseUrl}/statements/${externalCardId}`;
|
|
110
|
+
const url = `${this.baseUrl}/statements/cards/${externalCardId}`;
|
|
105
111
|
return await this.httpRequest.get(url);
|
|
106
112
|
}
|
|
107
113
|
async getStatementDocument(statementId) {
|
|
@@ -110,7 +116,8 @@ let CentralPaymentsConnectorApi = class CentralPaymentsConnectorApi {
|
|
|
110
116
|
}
|
|
111
117
|
/* TRANSACTIONS */
|
|
112
118
|
async getTransactionHistory(externalCardId, params) {
|
|
113
|
-
const
|
|
119
|
+
const queryParams = this._invokerUtils.toQueryStringParameters(params);
|
|
120
|
+
const url = `${this.baseUrl}/transactions/history/${externalCardId}?${queryParams}`;
|
|
114
121
|
return await this.httpRequest.get(url);
|
|
115
122
|
}
|
|
116
123
|
async getTransactionDetails(externalTransactionId) {
|
|
@@ -122,5 +129,6 @@ exports.CentralPaymentsConnectorApi = CentralPaymentsConnectorApi;
|
|
|
122
129
|
exports.CentralPaymentsConnectorApi = CentralPaymentsConnectorApi = __decorate([
|
|
123
130
|
(0, inversify_1.injectable)(),
|
|
124
131
|
__param(0, (0, inversify_1.inject)("IHttpRequest")),
|
|
125
|
-
|
|
132
|
+
__param(1, (0, inversify_1.inject)("InvokerUtils")),
|
|
133
|
+
__metadata("design:paramtypes", [Object, InvokerUtils_1.InvokerUtils])
|
|
126
134
|
], CentralPaymentsConnectorApi);
|
|
@@ -1,31 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { UploadDocumentRequest } from "@fiado/type-kit/bin/identity";
|
|
5
|
-
import { ActivateBankAccountCardRequest, UpdateBankAccountCardRequest } from "@fiado/type-kit/bin/card";
|
|
1
|
+
import { CreateBankAccountUserRequest, CreateBankAccountUserResponse, GetBankAccountUserResponse, UpdateBankAccountUserRequest } from "@fiado/type-kit/bin/account";
|
|
2
|
+
import { CentralPaymentsDocumentUploadRequest, HealthcheckResponse, OOWQuestionsResponse, SubmitOOWQuestionAnswersRequest } from "@fiado/type-kit/bin/centralPayments";
|
|
3
|
+
import { ActivateBankAccountCardRequest, ActivateBankAccountCardResponse, CardBatchRequest, CardBatchResponse, CardStatementListResponse, GetBankAccountCardBalanceResponse, GetBankAccountCardResponse, StatementDocumentResponse, UpdateBankAccountCardRequest, UpdateBankAccountCardResponse } from "@fiado/type-kit/bin/card";
|
|
6
4
|
import { Status } from "@fiado/type-kit/bin/directory/enums/Status";
|
|
5
|
+
import FiadoApiResponse from "@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse";
|
|
6
|
+
import { CentralPaymentsQueryParams, CentralPaymentsTransactionItem, TransactionListResponse } from "@fiado/type-kit/bin/transaction";
|
|
7
7
|
export interface ICentralPaymentsConnectorApi {
|
|
8
|
-
healthcheck(): Promise<
|
|
9
|
-
createCardholder(request: CreateBankAccountUserRequest): Promise<
|
|
10
|
-
getCardholder(externalUserId: string): Promise<
|
|
11
|
-
updateCardholder(externalUserId: string, request: UpdateBankAccountUserRequest): Promise<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
8
|
+
healthcheck(): Promise<FiadoApiResponse<HealthcheckResponse>>;
|
|
9
|
+
createCardholder(request: CreateBankAccountUserRequest): Promise<FiadoApiResponse<CreateBankAccountUserResponse>>;
|
|
10
|
+
getCardholder(externalUserId: string): Promise<FiadoApiResponse<GetBankAccountUserResponse>>;
|
|
11
|
+
updateCardholder(externalUserId: string, request: UpdateBankAccountUserRequest): Promise<FiadoApiResponse<GetBankAccountUserResponse>>;
|
|
12
|
+
deleteCardholder(externalUserId: string): Promise<FiadoApiResponse<null>>;
|
|
13
|
+
getOOWQuestions(externalUserId: string): Promise<FiadoApiResponse<OOWQuestionsResponse[]>>;
|
|
14
|
+
submitOOWQuestionAnswers(externalUserId: string, request: SubmitOOWQuestionAnswersRequest[]): Promise<FiadoApiResponse<GetBankAccountUserResponse>>;
|
|
15
|
+
uploadDocuments(externalUserId: string, request: CentralPaymentsDocumentUploadRequest): Promise<FiadoApiResponse<null>>;
|
|
16
|
+
setCardPin(request: UpdateBankAccountCardRequest): Promise<FiadoApiResponse<UpdateBankAccountCardResponse>>;
|
|
17
|
+
getCardInformation(externalCardId: string): Promise<FiadoApiResponse<GetBankAccountCardResponse>>;
|
|
18
|
+
getCardSensitiveInformation(externalCardId: string): Promise<FiadoApiResponse<GetBankAccountCardResponse>>;
|
|
19
|
+
activateCard(externalCardId: string, request: ActivateBankAccountCardRequest): Promise<FiadoApiResponse<ActivateBankAccountCardResponse>>;
|
|
20
|
+
getCardBalance(externalCardId: string): Promise<FiadoApiResponse<GetBankAccountCardBalanceResponse>>;
|
|
21
|
+
updateCardStatus(externalCardId: string, status: Status): Promise<FiadoApiResponse<GetBankAccountCardResponse>>;
|
|
22
|
+
updateCardProgram(externalCardId: string, programId: string): Promise<FiadoApiResponse<GetBankAccountCardResponse>>;
|
|
23
|
+
orderPhysicalCard(externalUserId: string): Promise<FiadoApiResponse<GetBankAccountCardResponse>>;
|
|
24
|
+
getCardsByExternalUserId(externalUserId: string): Promise<FiadoApiResponse<GetBankAccountCardResponse>>;
|
|
25
|
+
generateCardsInBatch(request: CardBatchRequest): Promise<FiadoApiResponse<CardBatchResponse>>;
|
|
26
|
+
getCardBatch(batchId: string): Promise<FiadoApiResponse<CardBatchResponse>>;
|
|
27
|
+
deleteCardBatch(batchId: string): Promise<FiadoApiResponse<CardBatchResponse>>;
|
|
28
|
+
getStatementsList(externalCardId: string): Promise<FiadoApiResponse<CardStatementListResponse[]>>;
|
|
29
|
+
getStatementDocument(statementId: string): Promise<FiadoApiResponse<StatementDocumentResponse>>;
|
|
30
|
+
getTransactionHistory(externalCardId: string, params: CentralPaymentsQueryParams): Promise<FiadoApiResponse<TransactionListResponse<CentralPaymentsTransactionItem>>>;
|
|
31
|
+
getTransactionDetails(externalTransactionId: string): Promise<FiadoApiResponse<CentralPaymentsTransactionItem>>;
|
|
31
32
|
}
|
package/bin/container.config.js
CHANGED
|
@@ -51,7 +51,11 @@ const device_1 = require("./device");
|
|
|
51
51
|
const observations_1 = require("./observations");
|
|
52
52
|
const CognitoConnectorV2_1 = __importDefault(require("./cognitoConnector/CognitoConnectorV2"));
|
|
53
53
|
const centralPayments_1 = require("./centralPayments");
|
|
54
|
+
const InvokerUtils_1 = require("./utils/InvokerUtils");
|
|
54
55
|
exports.apiInvokerBindings = new inversify_1.ContainerModule((bind) => {
|
|
56
|
+
// UTILS bindings
|
|
57
|
+
bind("InvokerUtils").to(InvokerUtils_1.InvokerUtils);
|
|
58
|
+
// API invoker bindings
|
|
55
59
|
bind("IDirectoryApi").to(directory_1.DirectoryApi);
|
|
56
60
|
bind("IIdentityApi").to(identity_1.IdentityApi);
|
|
57
61
|
bind("IAddressApi").to(address_1.AddressApi);
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.InvokerUtils = void 0;
|
|
13
|
+
const inversify_1 = require("inversify");
|
|
14
|
+
let InvokerUtils = class InvokerUtils {
|
|
15
|
+
constructor() {
|
|
16
|
+
}
|
|
17
|
+
toQueryStringParameters(object) {
|
|
18
|
+
const records = Object.entries(object).reduce((acc, [key, value]) => {
|
|
19
|
+
if (Array.isArray(value)) {
|
|
20
|
+
acc[key] = value.join(','); // Convierte arrays a una cadena separada por comas
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
acc[key] = String(value); // Convierte todos los demás valores a string
|
|
24
|
+
}
|
|
25
|
+
return acc;
|
|
26
|
+
}, {});
|
|
27
|
+
return new URLSearchParams(records).toString();
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
exports.InvokerUtils = InvokerUtils;
|
|
31
|
+
exports.InvokerUtils = InvokerUtils = __decorate([
|
|
32
|
+
(0, inversify_1.injectable)(),
|
|
33
|
+
__metadata("design:paramtypes", [])
|
|
34
|
+
], InvokerUtils);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.43",
|
|
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",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"@fiado/gateway-adapter": "^1.1.40",
|
|
17
17
|
"@fiado/http-client": "^1.0.2",
|
|
18
18
|
"@fiado/logger": "^1.0.3",
|
|
19
|
-
"@fiado/type-kit": "^1.
|
|
19
|
+
"@fiado/type-kit": "^1.8.6",
|
|
20
20
|
"dotenv": "^16.4.5",
|
|
21
21
|
"inversify": "^6.0.2",
|
|
22
22
|
"reflect-metadata": "^0.2.1",
|
|
@@ -1,141 +1,172 @@
|
|
|
1
1
|
import {ICentralPaymentsConnectorApi} from "./interfaces/ICentralPaymentsConnectorApi";
|
|
2
2
|
import {inject, injectable} from "inversify";
|
|
3
3
|
import {IHttpRequest} from "@fiado/http-client";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
import {
|
|
5
|
+
CreateBankAccountUserRequest,
|
|
6
|
+
CreateBankAccountUserResponse,
|
|
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";
|
|
9
28
|
import {Status} from "@fiado/type-kit/bin/directory/enums/Status";
|
|
29
|
+
import FiadoApiResponse from "@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse";
|
|
30
|
+
import {
|
|
31
|
+
CentralPaymentsQueryParams,
|
|
32
|
+
CentralPaymentsTransactionItem,
|
|
33
|
+
TransactionListResponse
|
|
34
|
+
} from "@fiado/type-kit/bin/transaction";
|
|
35
|
+
import {InvokerUtils} from "../utils/InvokerUtils";
|
|
10
36
|
|
|
11
37
|
@injectable()
|
|
12
38
|
export class CentralPaymentsConnectorApi implements ICentralPaymentsConnectorApi {
|
|
13
39
|
private readonly baseUrl = process.env.CENTRAL_PAYMENTS_LAMBDA_URL || "";
|
|
14
40
|
|
|
15
41
|
constructor(
|
|
16
|
-
@inject("IHttpRequest") private readonly httpRequest: IHttpRequest
|
|
42
|
+
@inject("IHttpRequest") private readonly httpRequest: IHttpRequest,
|
|
43
|
+
@inject("InvokerUtils") private readonly _invokerUtils: InvokerUtils,
|
|
17
44
|
) {
|
|
18
45
|
}
|
|
19
46
|
|
|
20
47
|
/* HEALTHCHECK */
|
|
21
|
-
async healthcheck(): Promise<
|
|
48
|
+
async healthcheck(): Promise<FiadoApiResponse<HealthcheckResponse>> {
|
|
22
49
|
const url = `${this.baseUrl}/healthcheck`;
|
|
23
50
|
return await this.httpRequest.get(url);
|
|
24
51
|
}
|
|
25
52
|
|
|
26
53
|
/* CARDHOLDERS */
|
|
27
|
-
async createCardholder(request: CreateBankAccountUserRequest): Promise<
|
|
54
|
+
async createCardholder(request: CreateBankAccountUserRequest): Promise<FiadoApiResponse<CreateBankAccountUserResponse>> {
|
|
28
55
|
const url = `${this.baseUrl}/cardholders`;
|
|
29
56
|
return await this.httpRequest.post(url, request);
|
|
30
57
|
}
|
|
31
58
|
|
|
32
|
-
async getCardholder(externalUserId: string): Promise<
|
|
59
|
+
async getCardholder(externalUserId: string): Promise<FiadoApiResponse<GetBankAccountUserResponse>> {
|
|
33
60
|
const url = `${this.baseUrl}/cardholders/${externalUserId}`;
|
|
34
61
|
return await this.httpRequest.get(url);
|
|
35
62
|
}
|
|
36
63
|
|
|
37
|
-
async updateCardholder(externalUserId: string, request: UpdateBankAccountUserRequest): Promise<
|
|
64
|
+
async updateCardholder(externalUserId: string, request: UpdateBankAccountUserRequest): Promise<FiadoApiResponse<GetBankAccountUserResponse>> {
|
|
38
65
|
const url = `${this.baseUrl}/cardholders/${externalUserId}`;
|
|
39
66
|
return await this.httpRequest.put(url, request);
|
|
40
67
|
}
|
|
41
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
|
+
|
|
42
74
|
/* KYC DOCUMENTS */
|
|
43
|
-
async getOOWQuestions(externalUserId: string): Promise<
|
|
75
|
+
async getOOWQuestions(externalUserId: string): Promise<FiadoApiResponse<OOWQuestionsResponse[]>> {
|
|
44
76
|
const url = `${this.baseUrl}/kyc/${externalUserId}/oow/questions`;
|
|
45
77
|
return await this.httpRequest.get(url);
|
|
46
78
|
}
|
|
47
79
|
|
|
48
|
-
async submitOOWQuestionAnswers(externalUserId: string, request: SubmitOOWQuestionAnswersRequest[]): Promise<
|
|
80
|
+
async submitOOWQuestionAnswers(externalUserId: string, request: SubmitOOWQuestionAnswersRequest[]): Promise<FiadoApiResponse<GetBankAccountUserResponse>> {
|
|
49
81
|
const url = `${this.baseUrl}/kyc/${externalUserId}/oow/questions`;
|
|
50
82
|
return await this.httpRequest.post(url, request);
|
|
51
83
|
}
|
|
52
84
|
|
|
53
|
-
async uploadDocuments(externalUserId: string, request:
|
|
85
|
+
async uploadDocuments(externalUserId: string, request: CentralPaymentsDocumentUploadRequest): Promise<FiadoApiResponse<null>> {
|
|
54
86
|
const url = `${this.baseUrl}/kyc/${externalUserId}/documents/upload`;
|
|
55
|
-
return await this.httpRequest.post(url);
|
|
87
|
+
return await this.httpRequest.post(url, request);
|
|
56
88
|
}
|
|
57
89
|
|
|
58
90
|
/* CARDS */
|
|
59
|
-
async setCardPin(request: UpdateBankAccountCardRequest): Promise<
|
|
91
|
+
async setCardPin(request: UpdateBankAccountCardRequest): Promise<FiadoApiResponse<UpdateBankAccountCardResponse>> {
|
|
60
92
|
const url = `${this.baseUrl}/cards/pin/change`;
|
|
61
|
-
return await this.httpRequest.
|
|
93
|
+
return await this.httpRequest.post(url, request);
|
|
62
94
|
}
|
|
63
95
|
|
|
64
|
-
async getCardInformation(externalCardId: string): Promise<
|
|
96
|
+
async getCardInformation(externalCardId: string): Promise<FiadoApiResponse<GetBankAccountCardResponse>> {
|
|
65
97
|
const url = `${this.baseUrl}/cards/${externalCardId}`;
|
|
66
98
|
return await this.httpRequest.get(url);
|
|
67
99
|
}
|
|
68
100
|
|
|
69
|
-
async getCardSensitiveInformation(externalCardId: string): Promise<
|
|
101
|
+
async getCardSensitiveInformation(externalCardId: string): Promise<FiadoApiResponse<GetBankAccountCardResponse>> {
|
|
70
102
|
const url = `${this.baseUrl}/cards/${externalCardId}/sensitive`;
|
|
71
103
|
return await this.httpRequest.get(url);
|
|
72
104
|
}
|
|
73
105
|
|
|
74
|
-
async activateCard(externalCardId: string, request: ActivateBankAccountCardRequest): Promise<
|
|
106
|
+
async activateCard(externalCardId: string, request: ActivateBankAccountCardRequest): Promise<FiadoApiResponse<ActivateBankAccountCardResponse>> {
|
|
75
107
|
const url = `${this.baseUrl}/cards/${externalCardId}/activate`;
|
|
76
108
|
return await this.httpRequest.post(url, request);
|
|
77
109
|
}
|
|
78
110
|
|
|
79
|
-
async getCardBalance(externalCardId: string): Promise<
|
|
111
|
+
async getCardBalance(externalCardId: string): Promise<FiadoApiResponse<GetBankAccountCardBalanceResponse>> {
|
|
80
112
|
const url = `${this.baseUrl}/cards/${externalCardId}/balance`;
|
|
81
113
|
return await this.httpRequest.get(url);
|
|
82
114
|
}
|
|
83
115
|
|
|
84
|
-
async updateCardStatus(externalCardId: string, status: Status): Promise<
|
|
116
|
+
async updateCardStatus(externalCardId: string, status: Status): Promise<FiadoApiResponse<GetBankAccountCardResponse>> {
|
|
85
117
|
const url = `${this.baseUrl}/cards/${externalCardId}/status/${status}`;
|
|
86
118
|
return await this.httpRequest.put(url);
|
|
87
119
|
}
|
|
88
120
|
|
|
89
|
-
async updateCardProgram(externalCardId: string, programId: string): Promise<
|
|
90
|
-
const url = `${this.baseUrl}/cards/${externalCardId}/
|
|
121
|
+
async updateCardProgram(externalCardId: string, programId: string): Promise<FiadoApiResponse<GetBankAccountCardResponse>> {
|
|
122
|
+
const url = `${this.baseUrl}/cards/${externalCardId}/programs/${programId}`;
|
|
91
123
|
return await this.httpRequest.put(url);
|
|
92
124
|
}
|
|
93
125
|
|
|
94
|
-
async orderPhysicalCard(
|
|
95
|
-
const url = `${this.baseUrl}/cards/${
|
|
126
|
+
async orderPhysicalCard(externalUserId: string): Promise<FiadoApiResponse<GetBankAccountCardResponse>> {
|
|
127
|
+
const url = `${this.baseUrl}/cards/physical/order/${externalUserId}`;
|
|
96
128
|
return await this.httpRequest.put(url);
|
|
97
129
|
}
|
|
98
130
|
|
|
99
|
-
async getCardsByExternalUserId(externalUserId: string): Promise<
|
|
131
|
+
async getCardsByExternalUserId(externalUserId: string): Promise<FiadoApiResponse<GetBankAccountCardResponse>> {
|
|
100
132
|
const url = `${this.baseUrl}/cards/cardholders/${externalUserId}`;
|
|
101
133
|
return await this.httpRequest.get(url);
|
|
102
134
|
}
|
|
103
135
|
|
|
104
|
-
async generateCardsInBatch(request:
|
|
136
|
+
async generateCardsInBatch(request: CardBatchRequest): Promise<FiadoApiResponse<CardBatchResponse>> {
|
|
105
137
|
const url = `${this.baseUrl}/cards/batch`;
|
|
106
138
|
return await this.httpRequest.post(url, request);
|
|
107
139
|
}
|
|
108
140
|
|
|
109
|
-
async getCardBatch(batchId: string): Promise<
|
|
141
|
+
async getCardBatch(batchId: string): Promise<FiadoApiResponse<CardBatchResponse>> {
|
|
110
142
|
const url = `${this.baseUrl}/cards/batch/${batchId}`;
|
|
111
143
|
return await this.httpRequest.get(url);
|
|
112
144
|
}
|
|
113
145
|
|
|
114
|
-
async deleteCardBatch(batchId: string): Promise<
|
|
146
|
+
async deleteCardBatch(batchId: string): Promise<FiadoApiResponse<CardBatchResponse>> {
|
|
115
147
|
const url = `${this.baseUrl}/cards/batch/${batchId}`;
|
|
116
148
|
return await this.httpRequest.delete(url);
|
|
117
149
|
}
|
|
118
150
|
|
|
119
151
|
/* STATEMENTS */
|
|
120
|
-
async getStatementsList(externalCardId: string): Promise<
|
|
121
|
-
const url = `${this.baseUrl}/statements/${externalCardId}`;
|
|
152
|
+
async getStatementsList(externalCardId: string): Promise<FiadoApiResponse<CardStatementListResponse[]>> {
|
|
153
|
+
const url = `${this.baseUrl}/statements/cards/${externalCardId}`;
|
|
122
154
|
return await this.httpRequest.get(url);
|
|
123
155
|
}
|
|
124
156
|
|
|
125
|
-
async getStatementDocument(statementId: string): Promise<
|
|
157
|
+
async getStatementDocument(statementId: string): Promise<FiadoApiResponse<StatementDocumentResponse>> {
|
|
126
158
|
const url = `${this.baseUrl}/statements/document-url/${statementId}`;
|
|
127
159
|
return await this.httpRequest.get(url);
|
|
128
160
|
}
|
|
129
161
|
|
|
130
162
|
/* TRANSACTIONS */
|
|
131
|
-
async getTransactionHistory(externalCardId: string,
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
const url = `${this.baseUrl}/transactions/${externalCardId}?${new URLSearchParams(params)}`;
|
|
163
|
+
async getTransactionHistory(externalCardId: string, params: CentralPaymentsQueryParams): Promise<FiadoApiResponse<TransactionListResponse<CentralPaymentsTransactionItem>>> {
|
|
164
|
+
const queryParams: string = this._invokerUtils.toQueryStringParameters(params);
|
|
165
|
+
const url = `${this.baseUrl}/transactions/history/${externalCardId}?${queryParams}`;
|
|
135
166
|
return await this.httpRequest.get(url);
|
|
136
167
|
}
|
|
137
168
|
|
|
138
|
-
async getTransactionDetails(externalTransactionId: string): Promise<
|
|
169
|
+
async getTransactionDetails(externalTransactionId: string): Promise<FiadoApiResponse<CentralPaymentsTransactionItem>> {
|
|
139
170
|
const url = `${this.baseUrl}/transactions/${externalTransactionId}`;
|
|
140
171
|
return await this.httpRequest.get(url);
|
|
141
172
|
}
|
|
@@ -1,54 +1,81 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import {
|
|
2
|
+
CreateBankAccountUserRequest,
|
|
3
|
+
CreateBankAccountUserResponse,
|
|
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";
|
|
6
25
|
import {Status} from "@fiado/type-kit/bin/directory/enums/Status";
|
|
26
|
+
import FiadoApiResponse from "@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse";
|
|
27
|
+
import {
|
|
28
|
+
CentralPaymentsQueryParams,
|
|
29
|
+
CentralPaymentsTransactionItem,
|
|
30
|
+
TransactionListResponse
|
|
31
|
+
} from "@fiado/type-kit/bin/transaction";
|
|
7
32
|
|
|
8
33
|
export interface ICentralPaymentsConnectorApi {
|
|
9
|
-
healthcheck(): Promise<
|
|
34
|
+
healthcheck(): Promise<FiadoApiResponse<HealthcheckResponse>>;
|
|
10
35
|
|
|
11
|
-
createCardholder(request: CreateBankAccountUserRequest): Promise<
|
|
36
|
+
createCardholder(request: CreateBankAccountUserRequest): Promise<FiadoApiResponse<CreateBankAccountUserResponse>>;
|
|
12
37
|
|
|
13
|
-
getCardholder(externalUserId: string): Promise<
|
|
38
|
+
getCardholder(externalUserId: string): Promise<FiadoApiResponse<GetBankAccountUserResponse>>;
|
|
14
39
|
|
|
15
|
-
updateCardholder(externalUserId: string, request: UpdateBankAccountUserRequest): Promise<
|
|
40
|
+
updateCardholder(externalUserId: string, request: UpdateBankAccountUserRequest): Promise<FiadoApiResponse<GetBankAccountUserResponse>>;
|
|
16
41
|
|
|
17
|
-
|
|
42
|
+
deleteCardholder(externalUserId: string): Promise<FiadoApiResponse<null>>;
|
|
18
43
|
|
|
19
|
-
|
|
44
|
+
getOOWQuestions(externalUserId: string): Promise<FiadoApiResponse<OOWQuestionsResponse[]>>;
|
|
20
45
|
|
|
21
|
-
|
|
46
|
+
submitOOWQuestionAnswers(externalUserId: string, request: SubmitOOWQuestionAnswersRequest[]): Promise<FiadoApiResponse<GetBankAccountUserResponse>>;
|
|
22
47
|
|
|
23
|
-
|
|
48
|
+
uploadDocuments(externalUserId: string, request: CentralPaymentsDocumentUploadRequest): Promise<FiadoApiResponse<null>>;
|
|
24
49
|
|
|
25
|
-
|
|
50
|
+
setCardPin(request: UpdateBankAccountCardRequest): Promise<FiadoApiResponse<UpdateBankAccountCardResponse>>;
|
|
26
51
|
|
|
27
|
-
|
|
52
|
+
getCardInformation(externalCardId: string): Promise<FiadoApiResponse<GetBankAccountCardResponse>>;
|
|
28
53
|
|
|
29
|
-
|
|
54
|
+
getCardSensitiveInformation(externalCardId: string): Promise<FiadoApiResponse<GetBankAccountCardResponse>>;
|
|
30
55
|
|
|
31
|
-
|
|
56
|
+
activateCard(externalCardId: string, request: ActivateBankAccountCardRequest): Promise<FiadoApiResponse<ActivateBankAccountCardResponse>>;
|
|
32
57
|
|
|
33
|
-
|
|
58
|
+
getCardBalance(externalCardId: string): Promise<FiadoApiResponse<GetBankAccountCardBalanceResponse>>;
|
|
34
59
|
|
|
35
|
-
|
|
60
|
+
updateCardStatus(externalCardId: string, status: Status): Promise<FiadoApiResponse<GetBankAccountCardResponse>>;
|
|
36
61
|
|
|
37
|
-
|
|
62
|
+
updateCardProgram(externalCardId: string, programId: string): Promise<FiadoApiResponse<GetBankAccountCardResponse>>;
|
|
38
63
|
|
|
39
|
-
|
|
64
|
+
orderPhysicalCard(externalUserId: string): Promise<FiadoApiResponse<GetBankAccountCardResponse>>;
|
|
40
65
|
|
|
41
|
-
|
|
66
|
+
getCardsByExternalUserId(externalUserId: string): Promise<FiadoApiResponse<GetBankAccountCardResponse>>;
|
|
42
67
|
|
|
43
|
-
|
|
68
|
+
generateCardsInBatch(request: CardBatchRequest): Promise<FiadoApiResponse<CardBatchResponse>>;
|
|
44
69
|
|
|
45
|
-
|
|
70
|
+
getCardBatch(batchId: string): Promise<FiadoApiResponse<CardBatchResponse>>;
|
|
46
71
|
|
|
47
|
-
|
|
72
|
+
deleteCardBatch(batchId: string): Promise<FiadoApiResponse<CardBatchResponse>>;
|
|
48
73
|
|
|
49
|
-
|
|
74
|
+
getStatementsList(externalCardId: string): Promise<FiadoApiResponse<CardStatementListResponse[]>>;
|
|
50
75
|
|
|
51
|
-
|
|
76
|
+
getStatementDocument(statementId: string): Promise<FiadoApiResponse<StatementDocumentResponse>>;
|
|
52
77
|
|
|
53
|
-
|
|
78
|
+
getTransactionHistory(externalCardId: string, params: CentralPaymentsQueryParams): Promise<FiadoApiResponse<TransactionListResponse<CentralPaymentsTransactionItem>>>;
|
|
79
|
+
|
|
80
|
+
getTransactionDetails(externalTransactionId: string): Promise<FiadoApiResponse<CentralPaymentsTransactionItem>>;
|
|
54
81
|
}
|
package/src/container.config.ts
CHANGED
|
@@ -44,26 +44,36 @@ import TransactionProcessorApi from "./transactionProcessor/api/TransactionProce
|
|
|
44
44
|
import {ITransactionProcessorApi} from "./transactionProcessor";
|
|
45
45
|
import ActivityPublisher from "./activity-business/queue/ActivityPublisher";
|
|
46
46
|
import RiskProfileApi from "./riskProfile/api/RiskProfileApi";
|
|
47
|
-
import {
|
|
47
|
+
import {
|
|
48
|
+
IRiskProfileApi,
|
|
49
|
+
ITransactionAlarmPublisher,
|
|
50
|
+
ITransactionAlertApi,
|
|
51
|
+
TransactionAlarmPublisher
|
|
52
|
+
} from "./riskProfile";
|
|
48
53
|
import {ContactInformationApi, IContactInformationApi} from "./contactInformation";
|
|
49
54
|
import {FiadoMessagesApi, IFiadoMessagesApi} from "./fiadoMessages";
|
|
50
55
|
import CnbvApi from "./cnbv-business/CnbvApi";
|
|
51
|
-
import {
|
|
56
|
+
import {ICnbvApi} from "./cnbv-business";
|
|
52
57
|
import TransactionApi from "./transaction/api/TransactionApi";
|
|
53
|
-
import {
|
|
54
|
-
import {
|
|
58
|
+
import {IPomeloProcessorApi, PomeloProcessorApi} from "./pomeloProcessor";
|
|
59
|
+
import {DisputesApi, IDisputesApi} from "./disputes";
|
|
55
60
|
import TransactionAlertApi from "./riskProfile/api/TransactionAlertApi";
|
|
56
|
-
import {
|
|
57
|
-
import {
|
|
61
|
+
import {DirectoriesApi, IDirectoriesApi} from "./directories";
|
|
62
|
+
import {ICognitoConnectorApi, ICognitoV2Api} from "./cognitoConnector";
|
|
58
63
|
import CognitoConnectorApi from "./cognitoConnector/CognitoConnectorApi";
|
|
59
|
-
import {
|
|
60
|
-
import {
|
|
61
|
-
import {
|
|
62
|
-
import {
|
|
64
|
+
import {IZendeskApi, ZendeskApi} from "./zendesk";
|
|
65
|
+
import {BlackListApi, IBlackListApi} from "./blacklist";
|
|
66
|
+
import {DeviceApi, IDeviceApi} from "./device";
|
|
67
|
+
import {IObservationsApi, ObservationsApi} from "./observations";
|
|
63
68
|
import CognitoApi from "./cognitoConnector/CognitoConnectorV2";
|
|
64
69
|
import {CentralPaymentsConnectorApi, ICentralPaymentsConnectorApi} from "./centralPayments";
|
|
70
|
+
import {InvokerUtils} from "./utils/InvokerUtils";
|
|
65
71
|
|
|
66
72
|
export const apiInvokerBindings = new ContainerModule((bind: interfaces.Bind) => {
|
|
73
|
+
// UTILS bindings
|
|
74
|
+
bind<InvokerUtils>("InvokerUtils").to(InvokerUtils);
|
|
75
|
+
|
|
76
|
+
// API invoker bindings
|
|
67
77
|
bind<IDirectoryApi>("IDirectoryApi").to(DirectoryApi);
|
|
68
78
|
bind<IIdentityApi>("IIdentityApi").to(IdentityApi);
|
|
69
79
|
bind<IAddressApi>("IAddressApi").to(AddressApi);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {injectable} from "inversify";
|
|
2
|
+
|
|
3
|
+
@injectable()
|
|
4
|
+
export class InvokerUtils {
|
|
5
|
+
constructor() {
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
toQueryStringParameters(object: any): string {
|
|
9
|
+
const records: Record<string, string> = Object.entries(object).reduce((acc, [key, value]) => {
|
|
10
|
+
if (Array.isArray(value)) {
|
|
11
|
+
acc[key] = value.join(','); // Convierte arrays a una cadena separada por comas
|
|
12
|
+
} else {
|
|
13
|
+
acc[key] = String(value); // Convierte todos los demás valores a string
|
|
14
|
+
}
|
|
15
|
+
return acc;
|
|
16
|
+
}, {} as Record<string, string>);
|
|
17
|
+
return new URLSearchParams(records).toString();
|
|
18
|
+
}
|
|
19
|
+
}
|