@fiado/api-invoker 3.4.5 → 3.6.0
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/benefits-marketplace/api/BenefitsMarketplaceApi.d.ts +11 -0
- package/bin/benefits-marketplace/api/BenefitsMarketplaceApi.js +35 -0
- package/bin/benefits-marketplace/api/interfaces/IBenefitsMarketplaceApi.d.ts +40 -0
- package/bin/benefits-marketplace/api/interfaces/IBenefitsMarketplaceApi.js +2 -0
- package/bin/benefits-marketplace/index.d.ts +2 -0
- package/bin/benefits-marketplace/index.js +18 -0
- package/bin/cognitoConnector/interfaces/ICognitoConnectorApiV2.d.ts +46 -0
- package/bin/cognitoConnector/interfaces/ICognitoConnectorApiV2.js +2 -0
- package/bin/container.config.js +3 -0
- package/bin/estafeta/EstafetaApi.d.ts +0 -0
- package/bin/estafeta/EstafetaApi.js +0 -0
- package/bin/index.d.ts +1 -0
- package/bin/index.js +1 -0
- package/bin/multicommServicePayment/api/MulticommServicePaymentApi.d.ts +3 -1
- package/bin/multicommServicePayment/api/MulticommServicePaymentApi.js +8 -0
- package/bin/multicommServicePayment/api/interfaces/IMulticommServicePaymentApi.d.ts +3 -1
- package/bin/report-processor-business/api/IReportProcessorBusiness.d.ts +3 -0
- package/bin/report-processor-business/api/IReportProcessorBusiness.js +2 -0
- package/bin/stpServicePayment/api/StpServicePaymentApi.d.ts +3 -1
- package/bin/stpServicePayment/api/StpServicePaymentApi.js +8 -0
- package/bin/stpServicePayment/api/interfaces/IStpServicePaymentApi.d.ts +3 -1
- package/package.json +2 -2
- package/src/benefits-marketplace/api/BenefitsMarketplaceApi.ts +26 -0
- package/src/benefits-marketplace/api/interfaces/IBenefitsMarketplaceApi.ts +42 -0
- package/src/benefits-marketplace/index.ts +2 -0
- package/src/container.config.ts +6 -0
- package/src/index.ts +1 -0
- package/src/multicommServicePayment/api/MulticommServicePaymentApi.ts +11 -1
- package/src/multicommServicePayment/api/interfaces/IMulticommServicePaymentApi.ts +11 -1
- package/src/stpServicePayment/api/StpServicePaymentApi.ts +11 -1
- package/src/stpServicePayment/api/interfaces/IStpServicePaymentApi.ts +11 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IBenefitsMarketplaceApi } from "./interfaces/IBenefitsMarketplaceApi";
|
|
2
|
+
import { IHttpRequest } from "@fiado/http-client";
|
|
3
|
+
import { BenefitPaymentRequest, BenefitPaymentResponse } from "@fiado/type-kit/bin/benefitCenter";
|
|
4
|
+
import { ApiGatewayResponse } from "@fiado/gateway-adapter";
|
|
5
|
+
export default class BenefitsMarketplaceApi implements IBenefitsMarketplaceApi {
|
|
6
|
+
private httpRequest;
|
|
7
|
+
private readonly baseUrl;
|
|
8
|
+
constructor(httpRequest: IHttpRequest);
|
|
9
|
+
pay(moduleName: string, request: BenefitPaymentRequest): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
|
|
10
|
+
consultPayment(moduleName: string, transactionNumber: string): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
const inversify_1 = require("inversify");
|
|
16
|
+
let BenefitsMarketplaceApi = class BenefitsMarketplaceApi {
|
|
17
|
+
constructor(httpRequest) {
|
|
18
|
+
this.httpRequest = httpRequest;
|
|
19
|
+
this.baseUrl = process.env.BENEFITS_MARKETPLACE_LAMBDA_URL || "";
|
|
20
|
+
}
|
|
21
|
+
async pay(moduleName, request) {
|
|
22
|
+
const url = `${this.baseUrl}/pay/${encodeURIComponent(moduleName)}`;
|
|
23
|
+
return await this.httpRequest.post(url, request);
|
|
24
|
+
}
|
|
25
|
+
async consultPayment(moduleName, transactionNumber) {
|
|
26
|
+
const url = `${this.baseUrl}/pay/${encodeURIComponent(moduleName)}/transactions/${encodeURIComponent(transactionNumber)}`;
|
|
27
|
+
return await this.httpRequest.get(url);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
BenefitsMarketplaceApi = __decorate([
|
|
31
|
+
(0, inversify_1.injectable)(),
|
|
32
|
+
__param(0, (0, inversify_1.inject)("IHttpRequest")),
|
|
33
|
+
__metadata("design:paramtypes", [Object])
|
|
34
|
+
], BenefitsMarketplaceApi);
|
|
35
|
+
exports.default = BenefitsMarketplaceApi;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { BenefitPaymentRequest, BenefitPaymentResponse } from "@fiado/type-kit/bin/benefitCenter";
|
|
2
|
+
import { ApiGatewayResponse } from "@fiado/gateway-adapter";
|
|
3
|
+
/**
|
|
4
|
+
* Cliente único del procesador hacia benefits-marketplace-business (Fase 2).
|
|
5
|
+
*
|
|
6
|
+
* Lo consume exclusivamente BenefitsMarketplaceTransactionService dentro de
|
|
7
|
+
* transaction-processor-business. Ningún otro service del procesador conoce
|
|
8
|
+
* este cliente.
|
|
9
|
+
*
|
|
10
|
+
* Endpoint backend: POST /pay/{moduleName} (privado, dentro de la VPC).
|
|
11
|
+
* El marketplace resuelve `moduleName` a un publisher y reenvía la request
|
|
12
|
+
* tal cual al conector correspondiente con `BenefitPaymentRequest`.
|
|
13
|
+
*/
|
|
14
|
+
export interface IBenefitsMarketplaceApi {
|
|
15
|
+
/**
|
|
16
|
+
* Invoca el pago contra el marketplace. Backend: POST /pay/{moduleName}.
|
|
17
|
+
*
|
|
18
|
+
* @param moduleName Nombre del conector destino (ej. "stp-service-pay-connector",
|
|
19
|
+
* "multicomm-service-pay-connector", "donations-pay-connector").
|
|
20
|
+
* Se transmite como path-param y NO debe llevar slashes ni codificación
|
|
21
|
+
* extra: el cliente lo aplica directamente en la URL.
|
|
22
|
+
* @param request Cuerpo estandarizado de la transacción.
|
|
23
|
+
*/
|
|
24
|
+
pay(moduleName: string, request: BenefitPaymentRequest): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
|
|
25
|
+
/**
|
|
26
|
+
* Consulta el estado actual de un pago previamente enviado al marketplace.
|
|
27
|
+
* Backend: GET /pay/{moduleName}/transactions/{transactionNumber}.
|
|
28
|
+
*
|
|
29
|
+
* Lo consume el cron de timeout reconciliation del procesador
|
|
30
|
+
* (BenefitsMarketplaceTimeOutService) para decidir si publicar la
|
|
31
|
+
* transacción a la cola (cuando el marketplace confirma APPROVED) o
|
|
32
|
+
* reversar el débito ya hecho (cuando confirma REJECTED).
|
|
33
|
+
*
|
|
34
|
+
* @param moduleName Mismo identificador del conector usado en pay().
|
|
35
|
+
* @param transactionNumber Identificador único de la transacción del lado
|
|
36
|
+
* del procesador. Es el mismo `transactionNumber`
|
|
37
|
+
* que viajó en el `BenefitPaymentRequest` original.
|
|
38
|
+
*/
|
|
39
|
+
consultPayment(moduleName: string, transactionNumber: string): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
|
|
40
|
+
}
|
|
@@ -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("./api/interfaces/IBenefitsMarketplaceApi"), exports);
|
|
18
|
+
__exportStar(require("./api/BenefitsMarketplaceApi"), exports);
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
}
|
package/bin/container.config.js
CHANGED
|
@@ -98,6 +98,7 @@ const legalDocument_1 = require("./legalDocument");
|
|
|
98
98
|
const CountriesBusinessApi_1 = __importDefault(require("./countries-business/CountriesBusinessApi"));
|
|
99
99
|
// AI Engine connector
|
|
100
100
|
const ai_engine_connector_1 = require("./ai-engine-connector");
|
|
101
|
+
const BenefitsMarketplaceApi_1 = __importDefault(require("./benefits-marketplace/api/BenefitsMarketplaceApi"));
|
|
101
102
|
exports.apiInvokerBindings = new inversify_1.ContainerModule((bind) => {
|
|
102
103
|
// UTILS bindings
|
|
103
104
|
bind("InvokerUtils").to(InvokerUtils_1.InvokerUtils);
|
|
@@ -198,4 +199,6 @@ exports.apiInvokerBindings = new inversify_1.ContainerModule((bind) => {
|
|
|
198
199
|
bind("ICountriesBusinessApi").to(CountriesBusinessApi_1.default);
|
|
199
200
|
// AI Engine connector
|
|
200
201
|
bind("IAiEngineApi").to(ai_engine_connector_1.AiEngineApi);
|
|
202
|
+
// Benefits marketplace (Fase 2) - cliente único del procesador → marketplace
|
|
203
|
+
bind("IBenefitsMarketplaceApi").to(BenefitsMarketplaceApi_1.default);
|
|
201
204
|
});
|
|
File without changes
|
|
File without changes
|
package/bin/index.d.ts
CHANGED
package/bin/index.js
CHANGED
|
@@ -87,3 +87,4 @@ __exportStar(require("./platform-error-events"), exports);
|
|
|
87
87
|
__exportStar(require("./teams-connector"), exports);
|
|
88
88
|
__exportStar(require("./countries-business"), exports);
|
|
89
89
|
__exportStar(require("./ai-engine-connector"), exports);
|
|
90
|
+
__exportStar(require("./benefits-marketplace"), exports);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IMulticommServicePaymentApi } from "./interfaces/IMulticommServicePaymentApi";
|
|
2
2
|
import { IHttpRequest } from "@fiado/http-client";
|
|
3
3
|
import { GetCatalogParams, GetFavoritesParams, GetFavoritesResponse, ServicePaymentRequest } from "@fiado/type-kit/bin/servicePayment";
|
|
4
|
-
import { ConnectorCatalogResponse } from "@fiado/type-kit/bin/benefitCenter";
|
|
4
|
+
import { BenefitPaymentRequest, BenefitPaymentResponse, ConnectorCatalogResponse } from "@fiado/type-kit/bin/benefitCenter";
|
|
5
5
|
import { ApiGatewayResponse } from "@fiado/gateway-adapter";
|
|
6
6
|
import FiadoApiResponse from "@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse";
|
|
7
7
|
export default class MulticommServicePaymentApi implements IMulticommServicePaymentApi {
|
|
@@ -29,4 +29,6 @@ export default class MulticommServicePaymentApi implements IMulticommServicePaym
|
|
|
29
29
|
benefitId?: string;
|
|
30
30
|
includeDisabled?: boolean;
|
|
31
31
|
}): Promise<ApiGatewayResponse<ConnectorCatalogResponse>>;
|
|
32
|
+
payStandard(request: BenefitPaymentRequest): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
|
|
33
|
+
consultStandard(transactionNumber: string): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
|
|
32
34
|
}
|
|
@@ -72,6 +72,14 @@ let MulticommServicePaymentApi = class MulticommServicePaymentApi {
|
|
|
72
72
|
}
|
|
73
73
|
return await this.httpRequest.get(url);
|
|
74
74
|
}
|
|
75
|
+
async payStandard(request) {
|
|
76
|
+
const url = `${this.baseUrl}/pay/standard`;
|
|
77
|
+
return await this.httpRequest.post(url, request);
|
|
78
|
+
}
|
|
79
|
+
async consultStandard(transactionNumber) {
|
|
80
|
+
const url = `${this.baseUrl}/pay/standard/transactions/${encodeURIComponent(transactionNumber)}`;
|
|
81
|
+
return await this.httpRequest.get(url);
|
|
82
|
+
}
|
|
75
83
|
};
|
|
76
84
|
MulticommServicePaymentApi = __decorate([
|
|
77
85
|
(0, inversify_1.injectable)(),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GetCatalogParams, GetFavoritesParams, GetFavoritesResponse, ServicePaymentRequest } from "@fiado/type-kit/bin/servicePayment";
|
|
2
|
-
import { ConnectorCatalogResponse } from "@fiado/type-kit/bin/benefitCenter";
|
|
2
|
+
import { BenefitPaymentRequest, BenefitPaymentResponse, ConnectorCatalogResponse } from "@fiado/type-kit/bin/benefitCenter";
|
|
3
3
|
import { ApiGatewayResponse } from "@fiado/gateway-adapter";
|
|
4
4
|
import FiadoApiResponse from "@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse";
|
|
5
5
|
export interface IMulticommServicePaymentApi {
|
|
@@ -24,4 +24,6 @@ export interface IMulticommServicePaymentApi {
|
|
|
24
24
|
benefitId?: string;
|
|
25
25
|
includeDisabled?: boolean;
|
|
26
26
|
}): Promise<ApiGatewayResponse<ConnectorCatalogResponse>>;
|
|
27
|
+
payStandard(request: BenefitPaymentRequest): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
|
|
28
|
+
consultStandard(transactionNumber: string): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
|
|
27
29
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IStpServicePaymentApi } from "./interfaces/IStpServicePaymentApi";
|
|
2
2
|
import { IHttpRequest } from "@fiado/http-client";
|
|
3
3
|
import { GetCatalogParams, ServicePaymentRequest, ReferenceVerificationRequest, ReferenceVerificationResponse, GetFavoritesParams, GetFavoritesResponse } from "@fiado/type-kit/bin/servicePayment";
|
|
4
|
-
import { ConnectorCatalogResponse } from "@fiado/type-kit/bin/benefitCenter";
|
|
4
|
+
import { BenefitPaymentRequest, BenefitPaymentResponse, ConnectorCatalogResponse } from "@fiado/type-kit/bin/benefitCenter";
|
|
5
5
|
import { ApiGatewayResponse } from "@fiado/gateway-adapter";
|
|
6
6
|
import FiadoApiResponse from "@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse";
|
|
7
7
|
export default class StpServicePaymentApi implements IStpServicePaymentApi {
|
|
@@ -25,4 +25,6 @@ export default class StpServicePaymentApi implements IStpServicePaymentApi {
|
|
|
25
25
|
benefitId?: string;
|
|
26
26
|
includeDisabled?: boolean;
|
|
27
27
|
}): Promise<ApiGatewayResponse<ConnectorCatalogResponse>>;
|
|
28
|
+
payStandard(request: BenefitPaymentRequest): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
|
|
29
|
+
consultStandard(transactionNumber: string): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
|
|
28
30
|
}
|
|
@@ -72,6 +72,14 @@ let StpServicePaymentApi = class StpServicePaymentApi {
|
|
|
72
72
|
}
|
|
73
73
|
return await this.httpRequest.get(url);
|
|
74
74
|
}
|
|
75
|
+
async payStandard(request) {
|
|
76
|
+
const url = `${this.baseUrl}/pay/standard`;
|
|
77
|
+
return await this.httpRequest.post(url, request);
|
|
78
|
+
}
|
|
79
|
+
async consultStandard(transactionNumber) {
|
|
80
|
+
const url = `${this.baseUrl}/pay/standard/transactions/${encodeURIComponent(transactionNumber)}`;
|
|
81
|
+
return await this.httpRequest.get(url);
|
|
82
|
+
}
|
|
75
83
|
};
|
|
76
84
|
StpServicePaymentApi = __decorate([
|
|
77
85
|
(0, inversify_1.injectable)(),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GetCatalogParams, ServicePaymentRequest, ReferenceVerificationRequest, ReferenceVerificationResponse, GetFavoritesParams, GetFavoritesResponse } from "@fiado/type-kit/bin/servicePayment";
|
|
2
|
-
import { ConnectorCatalogResponse } from "@fiado/type-kit/bin/benefitCenter";
|
|
2
|
+
import { BenefitPaymentRequest, BenefitPaymentResponse, ConnectorCatalogResponse } from "@fiado/type-kit/bin/benefitCenter";
|
|
3
3
|
import { ApiGatewayResponse } from "@fiado/gateway-adapter";
|
|
4
4
|
import FiadoApiResponse from "@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse";
|
|
5
5
|
export interface IStpServicePaymentApi {
|
|
@@ -20,4 +20,6 @@ export interface IStpServicePaymentApi {
|
|
|
20
20
|
benefitId?: string;
|
|
21
21
|
includeDisabled?: boolean;
|
|
22
22
|
}): Promise<ApiGatewayResponse<ConnectorCatalogResponse>>;
|
|
23
|
+
payStandard(request: BenefitPaymentRequest): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
|
|
24
|
+
consultStandard(transactionNumber: string): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
|
|
23
25
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0",
|
|
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.50",
|
|
17
17
|
"@fiado/http-client": "^1.0.7",
|
|
18
18
|
"@fiado/logger": "^1.0.3",
|
|
19
|
-
"@fiado/type-kit": "^3.
|
|
19
|
+
"@fiado/type-kit": "^3.9.0",
|
|
20
20
|
"dotenv": "^16.4.7",
|
|
21
21
|
"i": "^0.3.7",
|
|
22
22
|
"inversify": "^6.2.2",
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {IBenefitsMarketplaceApi} from "./interfaces/IBenefitsMarketplaceApi";
|
|
2
|
+
import {inject, injectable} from "inversify";
|
|
3
|
+
import {IHttpRequest} from "@fiado/http-client";
|
|
4
|
+
import {BenefitPaymentRequest, BenefitPaymentResponse} from "@fiado/type-kit/bin/benefitCenter";
|
|
5
|
+
import {ApiGatewayResponse} from "@fiado/gateway-adapter";
|
|
6
|
+
|
|
7
|
+
@injectable()
|
|
8
|
+
export default class BenefitsMarketplaceApi implements IBenefitsMarketplaceApi {
|
|
9
|
+
private readonly baseUrl = process.env.BENEFITS_MARKETPLACE_LAMBDA_URL || "";
|
|
10
|
+
|
|
11
|
+
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
async pay(moduleName: string, request: BenefitPaymentRequest): Promise<ApiGatewayResponse<BenefitPaymentResponse>> {
|
|
15
|
+
const url = `${this.baseUrl}/pay/${encodeURIComponent(moduleName)}`;
|
|
16
|
+
return await this.httpRequest.post(url, request);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async consultPayment(
|
|
20
|
+
moduleName: string,
|
|
21
|
+
transactionNumber: string,
|
|
22
|
+
): Promise<ApiGatewayResponse<BenefitPaymentResponse>> {
|
|
23
|
+
const url = `${this.baseUrl}/pay/${encodeURIComponent(moduleName)}/transactions/${encodeURIComponent(transactionNumber)}`;
|
|
24
|
+
return await this.httpRequest.get(url);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import {BenefitPaymentRequest, BenefitPaymentResponse} from "@fiado/type-kit/bin/benefitCenter";
|
|
2
|
+
import {ApiGatewayResponse} from "@fiado/gateway-adapter";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Cliente único del procesador hacia benefits-marketplace-business (Fase 2).
|
|
6
|
+
*
|
|
7
|
+
* Lo consume exclusivamente BenefitsMarketplaceTransactionService dentro de
|
|
8
|
+
* transaction-processor-business. Ningún otro service del procesador conoce
|
|
9
|
+
* este cliente.
|
|
10
|
+
*
|
|
11
|
+
* Endpoint backend: POST /pay/{moduleName} (privado, dentro de la VPC).
|
|
12
|
+
* El marketplace resuelve `moduleName` a un publisher y reenvía la request
|
|
13
|
+
* tal cual al conector correspondiente con `BenefitPaymentRequest`.
|
|
14
|
+
*/
|
|
15
|
+
export interface IBenefitsMarketplaceApi {
|
|
16
|
+
/**
|
|
17
|
+
* Invoca el pago contra el marketplace. Backend: POST /pay/{moduleName}.
|
|
18
|
+
*
|
|
19
|
+
* @param moduleName Nombre del conector destino (ej. "stp-service-pay-connector",
|
|
20
|
+
* "multicomm-service-pay-connector", "donations-pay-connector").
|
|
21
|
+
* Se transmite como path-param y NO debe llevar slashes ni codificación
|
|
22
|
+
* extra: el cliente lo aplica directamente en la URL.
|
|
23
|
+
* @param request Cuerpo estandarizado de la transacción.
|
|
24
|
+
*/
|
|
25
|
+
pay(moduleName: string, request: BenefitPaymentRequest): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Consulta el estado actual de un pago previamente enviado al marketplace.
|
|
29
|
+
* Backend: GET /pay/{moduleName}/transactions/{transactionNumber}.
|
|
30
|
+
*
|
|
31
|
+
* Lo consume el cron de timeout reconciliation del procesador
|
|
32
|
+
* (BenefitsMarketplaceTimeOutService) para decidir si publicar la
|
|
33
|
+
* transacción a la cola (cuando el marketplace confirma APPROVED) o
|
|
34
|
+
* reversar el débito ya hecho (cuando confirma REJECTED).
|
|
35
|
+
*
|
|
36
|
+
* @param moduleName Mismo identificador del conector usado en pay().
|
|
37
|
+
* @param transactionNumber Identificador único de la transacción del lado
|
|
38
|
+
* del procesador. Es el mismo `transactionNumber`
|
|
39
|
+
* que viajó en el `BenefitPaymentRequest` original.
|
|
40
|
+
*/
|
|
41
|
+
consultPayment(moduleName: string, transactionNumber: string): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
|
|
42
|
+
}
|
package/src/container.config.ts
CHANGED
|
@@ -144,6 +144,9 @@ import { ICountriesBusinessApi } from "./countries-business";
|
|
|
144
144
|
import CountriesBusinessApi from "./countries-business/CountriesBusinessApi";
|
|
145
145
|
// AI Engine connector
|
|
146
146
|
import { IAiEngineApi, AiEngineApi } from "./ai-engine-connector";
|
|
147
|
+
// Benefits marketplace (Fase 2)
|
|
148
|
+
import { IBenefitsMarketplaceApi } from "./benefits-marketplace";
|
|
149
|
+
import BenefitsMarketplaceApi from "./benefits-marketplace/api/BenefitsMarketplaceApi";
|
|
147
150
|
|
|
148
151
|
export const apiInvokerBindings = new ContainerModule((bind: interfaces.Bind) => {
|
|
149
152
|
// UTILS bindings
|
|
@@ -253,4 +256,7 @@ export const apiInvokerBindings = new ContainerModule((bind: interfaces.Bind) =>
|
|
|
253
256
|
|
|
254
257
|
// AI Engine connector
|
|
255
258
|
bind<IAiEngineApi>("IAiEngineApi").to(AiEngineApi);
|
|
259
|
+
|
|
260
|
+
// Benefits marketplace (Fase 2) - cliente único del procesador → marketplace
|
|
261
|
+
bind<IBenefitsMarketplaceApi>("IBenefitsMarketplaceApi").to(BenefitsMarketplaceApi);
|
|
256
262
|
});
|
package/src/index.ts
CHANGED
|
@@ -2,7 +2,7 @@ import {IMulticommServicePaymentApi} from "./interfaces/IMulticommServicePayment
|
|
|
2
2
|
import {inject, injectable} from "inversify";
|
|
3
3
|
import {IHttpRequest} from "@fiado/http-client";
|
|
4
4
|
import {GetCatalogParams, GetFavoritesParams, GetFavoritesResponse, ServicePaymentRequest} from "@fiado/type-kit/bin/servicePayment";
|
|
5
|
-
import {ConnectorCatalogResponse} from "@fiado/type-kit/bin/benefitCenter";
|
|
5
|
+
import {BenefitPaymentRequest, BenefitPaymentResponse, ConnectorCatalogResponse} from "@fiado/type-kit/bin/benefitCenter";
|
|
6
6
|
import {ApiGatewayResponse} from "@fiado/gateway-adapter";
|
|
7
7
|
import FiadoApiResponse from "@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse";
|
|
8
8
|
|
|
@@ -72,4 +72,14 @@ export default class MulticommServicePaymentApi implements IMulticommServicePaym
|
|
|
72
72
|
}
|
|
73
73
|
return await this.httpRequest.get(url);
|
|
74
74
|
}
|
|
75
|
+
|
|
76
|
+
async payStandard(request: BenefitPaymentRequest): Promise<ApiGatewayResponse<BenefitPaymentResponse>> {
|
|
77
|
+
const url = `${this.baseUrl}/pay/standard`;
|
|
78
|
+
return await this.httpRequest.post(url, request);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
async consultStandard(transactionNumber: string): Promise<ApiGatewayResponse<BenefitPaymentResponse>> {
|
|
82
|
+
const url = `${this.baseUrl}/pay/standard/transactions/${encodeURIComponent(transactionNumber)}`;
|
|
83
|
+
return await this.httpRequest.get(url);
|
|
84
|
+
}
|
|
75
85
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {GetCatalogParams, GetFavoritesParams, GetFavoritesResponse, ServicePaymentRequest} from "@fiado/type-kit/bin/servicePayment";
|
|
2
|
-
import {ConnectorCatalogResponse} from "@fiado/type-kit/bin/benefitCenter";
|
|
2
|
+
import {BenefitPaymentRequest, BenefitPaymentResponse, ConnectorCatalogResponse} from "@fiado/type-kit/bin/benefitCenter";
|
|
3
3
|
import {ApiGatewayResponse} from "@fiado/gateway-adapter";
|
|
4
4
|
import FiadoApiResponse from "@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse";
|
|
5
5
|
|
|
@@ -23,4 +23,14 @@ export interface IMulticommServicePaymentApi {
|
|
|
23
23
|
// Agregado en v3.1.0 — consume GET /catalog/standard del conector.
|
|
24
24
|
// Consumido por CatalogTreeBuilder en benefits-marketplace-business.
|
|
25
25
|
getStandardCatalog(params?: { benefitId?: string; includeDisabled?: boolean }): Promise<ApiGatewayResponse<ConnectorCatalogResponse>>;
|
|
26
|
+
|
|
27
|
+
// Agregado en v3.5.0 (Fase 2) — consume POST /pay/standard del conector con DTO estandarizado.
|
|
28
|
+
// Lo invoca el PaymentRouter de benefits-marketplace-business.
|
|
29
|
+
payStandard(request: BenefitPaymentRequest): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
|
|
30
|
+
|
|
31
|
+
// Agregado en v3.6.0 (Fase 2.5) — consume GET /pay/standard/transactions/{transactionNumber}
|
|
32
|
+
// del conector. Devuelve el estado actual mapeado a BenefitPaymentResponse (el conector
|
|
33
|
+
// hace el mapping legacy → estándar internamente). Usado por el cron de timeout
|
|
34
|
+
// reconciliation del marketplace para consultar transacciones async sin ver shapes legacy.
|
|
35
|
+
consultStandard(transactionNumber: string): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
|
|
26
36
|
}
|
|
@@ -2,7 +2,7 @@ import {IStpServicePaymentApi} from "./interfaces/IStpServicePaymentApi";
|
|
|
2
2
|
import {inject, injectable} from "inversify";
|
|
3
3
|
import {IHttpRequest} from "@fiado/http-client";
|
|
4
4
|
import {GetCatalogParams, ServicePaymentRequest, ReferenceVerificationRequest, ReferenceVerificationResponse, GetFavoritesParams, GetFavoritesResponse} from "@fiado/type-kit/bin/servicePayment";
|
|
5
|
-
import {ConnectorCatalogResponse} from "@fiado/type-kit/bin/benefitCenter";
|
|
5
|
+
import {BenefitPaymentRequest, BenefitPaymentResponse, ConnectorCatalogResponse} from "@fiado/type-kit/bin/benefitCenter";
|
|
6
6
|
import {ApiGatewayResponse} from "@fiado/gateway-adapter";
|
|
7
7
|
import FiadoApiResponse from "@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse";
|
|
8
8
|
|
|
@@ -72,4 +72,14 @@ export default class StpServicePaymentApi implements IStpServicePaymentApi {
|
|
|
72
72
|
}
|
|
73
73
|
return await this.httpRequest.get(url);
|
|
74
74
|
}
|
|
75
|
+
|
|
76
|
+
async payStandard(request: BenefitPaymentRequest): Promise<ApiGatewayResponse<BenefitPaymentResponse>> {
|
|
77
|
+
const url = `${this.baseUrl}/pay/standard`;
|
|
78
|
+
return await this.httpRequest.post(url, request);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
async consultStandard(transactionNumber: string): Promise<ApiGatewayResponse<BenefitPaymentResponse>> {
|
|
82
|
+
const url = `${this.baseUrl}/pay/standard/transactions/${encodeURIComponent(transactionNumber)}`;
|
|
83
|
+
return await this.httpRequest.get(url);
|
|
84
|
+
}
|
|
75
85
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {GetCatalogParams, ServicePaymentRequest, ReferenceVerificationRequest, ReferenceVerificationResponse, GetFavoritesParams, GetFavoritesResponse} from "@fiado/type-kit/bin/servicePayment";
|
|
2
|
-
import {ConnectorCatalogResponse} from "@fiado/type-kit/bin/benefitCenter";
|
|
2
|
+
import {BenefitPaymentRequest, BenefitPaymentResponse, ConnectorCatalogResponse} from "@fiado/type-kit/bin/benefitCenter";
|
|
3
3
|
import {ApiGatewayResponse} from "@fiado/gateway-adapter";
|
|
4
4
|
import FiadoApiResponse from "@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse";
|
|
5
5
|
|
|
@@ -23,4 +23,14 @@ export interface IStpServicePaymentApi {
|
|
|
23
23
|
// Agregado en v3.1.0 — consume GET /catalog/standard del conector.
|
|
24
24
|
// Consumido por CatalogTreeBuilder en benefits-marketplace-business.
|
|
25
25
|
getStandardCatalog(params?: { benefitId?: string; includeDisabled?: boolean }): Promise<ApiGatewayResponse<ConnectorCatalogResponse>>;
|
|
26
|
+
|
|
27
|
+
// Agregado en v3.5.0 (Fase 2) — consume POST /pay/standard del conector con DTO estandarizado.
|
|
28
|
+
// Lo invoca el PaymentRouter de benefits-marketplace-business.
|
|
29
|
+
payStandard(request: BenefitPaymentRequest): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
|
|
30
|
+
|
|
31
|
+
// Agregado en v3.6.0 (Fase 2.5) — consume GET /pay/standard/transactions/{transactionNumber}
|
|
32
|
+
// del conector. Devuelve el estado actual mapeado a BenefitPaymentResponse (el conector
|
|
33
|
+
// hace el mapping legacy → estándar internamente). Usado por el cron de timeout
|
|
34
|
+
// reconciliation del marketplace para consultar transacciones async sin ver shapes legacy.
|
|
35
|
+
consultStandard(transactionNumber: string): Promise<ApiGatewayResponse<BenefitPaymentResponse>>;
|
|
26
36
|
}
|