@fiado/type-kit 3.120.0 → 3.122.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/remittance/dtos/internal/RemittanceCreditBackRequest.d.ts +28 -0
- package/bin/remittance/dtos/internal/RemittanceCreditBackRequest.js +80 -0
- package/bin/remittance/dtos/internal/RemittanceCreditBackResponse.d.ts +12 -0
- package/bin/remittance/dtos/internal/RemittanceCreditBackResponse.js +7 -0
- package/bin/remittance/enums/FeeAbsorbedByEnum.d.ts +4 -0
- package/bin/remittance/enums/FeeAbsorbedByEnum.js +8 -0
- package/bin/remittance/enums/RemittanceCancelOutcomeEnum.d.ts +4 -0
- package/bin/remittance/enums/RemittanceCancelOutcomeEnum.js +8 -0
- package/bin/remittance/enums/RemittanceCancelledByEnum.d.ts +4 -0
- package/bin/remittance/enums/RemittanceCancelledByEnum.js +9 -0
- package/bin/remittance/enums/RemittanceTxStatus.d.ts +1 -0
- package/bin/remittance/enums/RemittanceTxStatus.js +1 -0
- package/bin/remittance/enums/index.d.ts +3 -0
- package/bin/remittance/enums/index.js +3 -0
- package/bin/remittance/index.d.ts +2 -0
- package/bin/remittance/index.js +2 -0
- package/bin/walletFunding/dtos/CancelFundingReferenceRequest.d.ts +6 -0
- package/bin/walletFunding/dtos/CancelFundingReferenceRequest.js +31 -0
- package/bin/walletFunding/dtos/CancelFundingReferenceResponse.d.ts +7 -0
- package/bin/walletFunding/dtos/CancelFundingReferenceResponse.js +6 -0
- package/bin/walletFunding/dtos/CancelFundingRequest.d.ts +11 -0
- package/bin/walletFunding/dtos/CancelFundingRequest.js +33 -0
- package/bin/walletFunding/dtos/CancelFundingResponse.d.ts +14 -0
- package/bin/walletFunding/dtos/CancelFundingResponse.js +12 -0
- package/bin/walletFunding/dtos/CancelWalletFundingRequest.d.ts +3 -0
- package/bin/walletFunding/dtos/CancelWalletFundingRequest.js +21 -0
- package/bin/walletFunding/dtos/CancelWalletFundingResponse.d.ts +7 -0
- package/bin/walletFunding/dtos/CancelWalletFundingResponse.js +6 -0
- package/bin/walletFunding/dtos/SettleWalletFundingRequest.d.ts +43 -0
- package/bin/walletFunding/dtos/SettleWalletFundingRequest.js +76 -0
- package/bin/walletFunding/dtos/SettleWalletFundingResponse.d.ts +36 -0
- package/bin/walletFunding/dtos/SettleWalletFundingResponse.js +2 -0
- package/bin/walletFunding/dtos/index.d.ts +2 -0
- package/bin/walletFunding/dtos/index.js +2 -0
- package/bin/walletFunding/enums/SettlementErrorCodeEnum.d.ts +25 -0
- package/bin/walletFunding/enums/SettlementErrorCodeEnum.js +29 -0
- package/bin/walletFunding/enums/index.d.ts +1 -0
- package/bin/walletFunding/enums/index.js +1 -0
- package/bin/walletFunding/index.d.ts +1 -0
- package/bin/walletFunding/index.js +1 -0
- package/bin/walletFunding/schemas/AccountPagoConfiadoSchema.d.ts +37 -0
- package/bin/walletFunding/schemas/AccountPagoConfiadoSchema.js +41 -0
- package/bin/walletFunding/schemas/EqualityFundingPaymentSchema.d.ts +42 -0
- package/bin/walletFunding/schemas/EqualityFundingPaymentSchema.js +44 -0
- package/bin/walletFunding/schemas/index.d.ts +2 -0
- package/bin/walletFunding/schemas/index.js +18 -0
- package/package.json +1 -1
- package/src/remittance/dtos/internal/RemittanceCreditBackRequest.ts +61 -0
- package/src/remittance/dtos/internal/RemittanceCreditBackResponse.ts +13 -0
- package/src/remittance/enums/FeeAbsorbedByEnum.ts +4 -0
- package/src/remittance/enums/RemittanceCancelOutcomeEnum.ts +4 -0
- package/src/remittance/enums/RemittanceCancelledByEnum.ts +5 -0
- package/src/remittance/enums/RemittanceTxStatus.ts +1 -0
- package/src/remittance/enums/index.ts +3 -0
- package/src/remittance/index.ts +2 -0
- package/src/walletFunding/dtos/SettleWalletFundingRequest.ts +53 -0
- package/src/walletFunding/dtos/SettleWalletFundingResponse.ts +37 -0
- package/src/walletFunding/dtos/index.ts +2 -0
- package/src/walletFunding/enums/SettlementErrorCodeEnum.ts +25 -0
- package/src/walletFunding/enums/index.ts +1 -0
- package/src/walletFunding/index.ts +1 -0
- package/src/walletFunding/schemas/AccountPagoConfiadoSchema.ts +41 -0
- package/src/walletFunding/schemas/EqualityFundingPaymentSchema.ts +44 -0
- package/src/walletFunding/schemas/index.ts +2 -0
|
@@ -22,3 +22,4 @@ __exportStar(require("./WalletFundingErrorCodeEnum"), exports);
|
|
|
22
22
|
__exportStar(require("./WalletFundingRefundReasonEnum"), exports);
|
|
23
23
|
__exportStar(require("./PaymentCodeTypeEnum"), exports);
|
|
24
24
|
__exportStar(require("./FundingWebhookTypeEnum"), exports);
|
|
25
|
+
__exportStar(require("./SettlementErrorCodeEnum"), exports);
|
|
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./enums"), exports);
|
|
18
18
|
__exportStar(require("./dtos"), exports);
|
|
19
|
+
__exportStar(require("./schemas"), exports);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema literal de la tabla DDB `AccountPagoConfiado_GT`.
|
|
3
|
+
*
|
|
4
|
+
* Owner declarado: `account-pago-confiado`. Write-shared con
|
|
5
|
+
* `wallet-funding-settlement` SOLO en el path money (campos de balance) bajo
|
|
6
|
+
* excepción documentada (spec 15 §3 + spec 10 §7 pendiente).
|
|
7
|
+
*
|
|
8
|
+
* El settlement escribe ÚNICAMENTE estos campos vía TransactWriteItems:
|
|
9
|
+
* - `availableBalance` (ADD :amt)
|
|
10
|
+
* - `currentBalance` (ADD :amt)
|
|
11
|
+
* - `updatedAt` (SET :now)
|
|
12
|
+
*
|
|
13
|
+
* El resto del shape (status, level, KYC, settings) sigue siendo write-exclusivo
|
|
14
|
+
* del owner. Cualquier campo nuevo de balance que el settlement deba escribir
|
|
15
|
+
* requiere actualizar este schema + el TransactWriteBuilder del settlement.
|
|
16
|
+
*/
|
|
17
|
+
export declare const AccountPagoConfiadoTable: {
|
|
18
|
+
readonly name: "AccountPagoConfiado_GT";
|
|
19
|
+
readonly pk: "id";
|
|
20
|
+
readonly attributes: {
|
|
21
|
+
readonly id: "id";
|
|
22
|
+
readonly directoryId: "directoryId";
|
|
23
|
+
readonly availableBalance: "availableBalance";
|
|
24
|
+
readonly currentBalance: "currentBalance";
|
|
25
|
+
readonly lockedBalance: "lockedBalance";
|
|
26
|
+
readonly unsettledBalance: "unsettledBalance";
|
|
27
|
+
readonly unpaidBalance: "unpaidBalance";
|
|
28
|
+
readonly unallowedBalance: "unallowedBalance";
|
|
29
|
+
readonly updatedAt: "updatedAt";
|
|
30
|
+
readonly status: "status";
|
|
31
|
+
readonly accountLevel: "accountLevel";
|
|
32
|
+
readonly currency: "currency";
|
|
33
|
+
readonly countryId: "countryId";
|
|
34
|
+
readonly createdAt: "createdAt";
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export type AccountPagoConfiadoAttribute = typeof AccountPagoConfiadoTable.attributes[keyof typeof AccountPagoConfiadoTable.attributes];
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AccountPagoConfiadoTable = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Schema literal de la tabla DDB `AccountPagoConfiado_GT`.
|
|
6
|
+
*
|
|
7
|
+
* Owner declarado: `account-pago-confiado`. Write-shared con
|
|
8
|
+
* `wallet-funding-settlement` SOLO en el path money (campos de balance) bajo
|
|
9
|
+
* excepción documentada (spec 15 §3 + spec 10 §7 pendiente).
|
|
10
|
+
*
|
|
11
|
+
* El settlement escribe ÚNICAMENTE estos campos vía TransactWriteItems:
|
|
12
|
+
* - `availableBalance` (ADD :amt)
|
|
13
|
+
* - `currentBalance` (ADD :amt)
|
|
14
|
+
* - `updatedAt` (SET :now)
|
|
15
|
+
*
|
|
16
|
+
* El resto del shape (status, level, KYC, settings) sigue siendo write-exclusivo
|
|
17
|
+
* del owner. Cualquier campo nuevo de balance que el settlement deba escribir
|
|
18
|
+
* requiere actualizar este schema + el TransactWriteBuilder del settlement.
|
|
19
|
+
*/
|
|
20
|
+
exports.AccountPagoConfiadoTable = {
|
|
21
|
+
name: "AccountPagoConfiado_GT",
|
|
22
|
+
pk: "id",
|
|
23
|
+
attributes: {
|
|
24
|
+
id: "id",
|
|
25
|
+
directoryId: "directoryId",
|
|
26
|
+
// Campos write-shared con wallet-funding-settlement (money path):
|
|
27
|
+
availableBalance: "availableBalance",
|
|
28
|
+
currentBalance: "currentBalance",
|
|
29
|
+
lockedBalance: "lockedBalance",
|
|
30
|
+
unsettledBalance: "unsettledBalance",
|
|
31
|
+
unpaidBalance: "unpaidBalance",
|
|
32
|
+
unallowedBalance: "unallowedBalance",
|
|
33
|
+
updatedAt: "updatedAt",
|
|
34
|
+
// Campos write-exclusive del owner (account-pago-confiado):
|
|
35
|
+
status: "status",
|
|
36
|
+
accountLevel: "accountLevel",
|
|
37
|
+
currency: "currency",
|
|
38
|
+
countryId: "countryId",
|
|
39
|
+
createdAt: "createdAt",
|
|
40
|
+
},
|
|
41
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema literal de la tabla DDB `EqualityFundingPayment_GT`.
|
|
3
|
+
*
|
|
4
|
+
* Define los nombres exactos de tabla, atributos e índices que el
|
|
5
|
+
* `equality-connector` (owner declarado) y el `wallet-funding-settlement`
|
|
6
|
+
* (write-shared bajo excepción money path, spec 15 §3) consumen.
|
|
7
|
+
*
|
|
8
|
+
* NO es un model de Dynamoose — son solo constantes type-safe. El
|
|
9
|
+
* settlement usa DDB SDK v3 raw para `TransactWriteItems`; el connector
|
|
10
|
+
* sigue usando Dynamoose en su repositorio (su propio model interno).
|
|
11
|
+
*
|
|
12
|
+
* Cuando el schema cambia (nuevo campo, índice nuevo), bump del type-kit
|
|
13
|
+
* fuerza recompile de TODOS los consumers → drift imposible en silence.
|
|
14
|
+
*/
|
|
15
|
+
export declare const EqualityFundingPaymentTable: {
|
|
16
|
+
readonly name: "EqualityFundingPayment_GT";
|
|
17
|
+
readonly pk: "equalityTransactionNumber";
|
|
18
|
+
readonly attributes: {
|
|
19
|
+
readonly equalityTransactionNumber: "equalityTransactionNumber";
|
|
20
|
+
readonly directoryId: "directoryId";
|
|
21
|
+
readonly reference: "reference";
|
|
22
|
+
readonly paymentAmount: "paymentAmount";
|
|
23
|
+
readonly paymentDate: "paymentDate";
|
|
24
|
+
readonly center: "center";
|
|
25
|
+
readonly centerId: "centerId";
|
|
26
|
+
readonly status: "status";
|
|
27
|
+
readonly webhookType: "webhookType";
|
|
28
|
+
readonly webhookRequestRaw: "webhookRequestRaw";
|
|
29
|
+
readonly webhookResponseRaw: "webhookResponseRaw";
|
|
30
|
+
readonly processorTransactionNumber: "processorTransactionNumber";
|
|
31
|
+
readonly rejectionCode: "rejectionCode";
|
|
32
|
+
readonly rejectionReason: "rejectionReason";
|
|
33
|
+
readonly refundReason: "refundReason";
|
|
34
|
+
readonly createdAt: "createdAt";
|
|
35
|
+
readonly updatedAt: "updatedAt";
|
|
36
|
+
};
|
|
37
|
+
readonly indexes: {
|
|
38
|
+
/** GSI por status + createdAt — usado por crons de reconciliation/refund. */
|
|
39
|
+
readonly statusCreatedAt: "status-createdAt-index";
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
export type EqualityFundingPaymentAttribute = typeof EqualityFundingPaymentTable.attributes[keyof typeof EqualityFundingPaymentTable.attributes];
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EqualityFundingPaymentTable = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Schema literal de la tabla DDB `EqualityFundingPayment_GT`.
|
|
6
|
+
*
|
|
7
|
+
* Define los nombres exactos de tabla, atributos e índices que el
|
|
8
|
+
* `equality-connector` (owner declarado) y el `wallet-funding-settlement`
|
|
9
|
+
* (write-shared bajo excepción money path, spec 15 §3) consumen.
|
|
10
|
+
*
|
|
11
|
+
* NO es un model de Dynamoose — son solo constantes type-safe. El
|
|
12
|
+
* settlement usa DDB SDK v3 raw para `TransactWriteItems`; el connector
|
|
13
|
+
* sigue usando Dynamoose en su repositorio (su propio model interno).
|
|
14
|
+
*
|
|
15
|
+
* Cuando el schema cambia (nuevo campo, índice nuevo), bump del type-kit
|
|
16
|
+
* fuerza recompile de TODOS los consumers → drift imposible en silence.
|
|
17
|
+
*/
|
|
18
|
+
exports.EqualityFundingPaymentTable = {
|
|
19
|
+
name: "EqualityFundingPayment_GT",
|
|
20
|
+
pk: "equalityTransactionNumber",
|
|
21
|
+
attributes: {
|
|
22
|
+
equalityTransactionNumber: "equalityTransactionNumber",
|
|
23
|
+
directoryId: "directoryId",
|
|
24
|
+
reference: "reference",
|
|
25
|
+
paymentAmount: "paymentAmount",
|
|
26
|
+
paymentDate: "paymentDate",
|
|
27
|
+
center: "center",
|
|
28
|
+
centerId: "centerId",
|
|
29
|
+
status: "status",
|
|
30
|
+
webhookType: "webhookType",
|
|
31
|
+
webhookRequestRaw: "webhookRequestRaw",
|
|
32
|
+
webhookResponseRaw: "webhookResponseRaw",
|
|
33
|
+
processorTransactionNumber: "processorTransactionNumber",
|
|
34
|
+
rejectionCode: "rejectionCode",
|
|
35
|
+
rejectionReason: "rejectionReason",
|
|
36
|
+
refundReason: "refundReason",
|
|
37
|
+
createdAt: "createdAt",
|
|
38
|
+
updatedAt: "updatedAt",
|
|
39
|
+
},
|
|
40
|
+
indexes: {
|
|
41
|
+
/** GSI por status + createdAt — usado por crons de reconciliation/refund. */
|
|
42
|
+
statusCreatedAt: "status-createdAt-index",
|
|
43
|
+
},
|
|
44
|
+
};
|
|
@@ -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("./EqualityFundingPaymentSchema"), exports);
|
|
18
|
+
__exportStar(require("./AccountPagoConfiadoSchema"), exports);
|
package/package.json
CHANGED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { IsString, IsNotEmpty, IsNumber, IsEnum, IsOptional, IsPositive } from "class-validator";
|
|
2
|
+
import { RemittanceCancelledByEnum } from "../../enums/RemittanceCancelledByEnum";
|
|
3
|
+
import { RemittanceCancelOutcomeEnum } from "../../enums/RemittanceCancelOutcomeEnum";
|
|
4
|
+
import { FeeAbsorbedByEnum } from "../../enums/FeeAbsorbedByEnum";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Request del credit-back de cancelacion. Lo emite uniteller-connector (cron F8)
|
|
8
|
+
* hacia el endpoint privado del processor POST remittance/credit-back, SOLO cuando
|
|
9
|
+
* UNIR confirma el outcome terminal (fondos de vuelta en el Wlp Wallet).
|
|
10
|
+
*/
|
|
11
|
+
export class RemittanceCreditBackRequest {
|
|
12
|
+
/** Llave de idempotencia del credit-back (= marketplaceTransactionNumber). */
|
|
13
|
+
@IsString()
|
|
14
|
+
@IsNotEmpty()
|
|
15
|
+
idempotencyKey: string;
|
|
16
|
+
|
|
17
|
+
/** Transaction number de UNIR (trazabilidad). */
|
|
18
|
+
@IsString()
|
|
19
|
+
@IsNotEmpty()
|
|
20
|
+
transactionNumber: string;
|
|
21
|
+
|
|
22
|
+
/** Tx del processor; sirve de relatedTransactionId del chargeback + correlacion /trx. */
|
|
23
|
+
@IsString()
|
|
24
|
+
@IsNotEmpty()
|
|
25
|
+
marketplaceTransactionNumber: string;
|
|
26
|
+
|
|
27
|
+
/** Para resolver la cuenta CP del usuario (externalAccountId del chargeback). */
|
|
28
|
+
@IsString()
|
|
29
|
+
@IsNotEmpty()
|
|
30
|
+
directoryId: string;
|
|
31
|
+
|
|
32
|
+
/** Monto principal (siempre se acredita). */
|
|
33
|
+
@IsNumber()
|
|
34
|
+
@IsPositive()
|
|
35
|
+
principalAmount: number;
|
|
36
|
+
|
|
37
|
+
/** Service fee de la remesa (se acredita solo si feeAbsorbedBy = FIADO). */
|
|
38
|
+
@IsNumber()
|
|
39
|
+
serviceFeeAmount: number;
|
|
40
|
+
|
|
41
|
+
@IsString()
|
|
42
|
+
@IsNotEmpty()
|
|
43
|
+
currencyId: string;
|
|
44
|
+
|
|
45
|
+
@IsEnum(RemittanceCancelledByEnum)
|
|
46
|
+
cancelledBy: RemittanceCancelledByEnum;
|
|
47
|
+
|
|
48
|
+
@IsEnum(RemittanceCancelOutcomeEnum)
|
|
49
|
+
cancelOutcome: RemittanceCancelOutcomeEnum;
|
|
50
|
+
|
|
51
|
+
@IsEnum(FeeAbsorbedByEnum)
|
|
52
|
+
feeAbsorbedBy: FeeAbsorbedByEnum;
|
|
53
|
+
|
|
54
|
+
@IsString()
|
|
55
|
+
@IsOptional()
|
|
56
|
+
cancelRequestedAt?: string;
|
|
57
|
+
|
|
58
|
+
@IsString()
|
|
59
|
+
@IsOptional()
|
|
60
|
+
cancelConfirmedAt?: string;
|
|
61
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { RemittanceTxStatus } from "../../enums/RemittanceTxStatus";
|
|
2
|
+
|
|
3
|
+
/** Respuesta del credit-back: confirma el credito ejecutado en CP + estado final. */
|
|
4
|
+
export class RemittanceCreditBackResponse {
|
|
5
|
+
/** Estado final de la remesa tras el credit-back (CANCELLED si VOID, REFUND si REFUND). */
|
|
6
|
+
status: RemittanceTxStatus;
|
|
7
|
+
/** Monto efectivamente acreditado al cliente. */
|
|
8
|
+
creditedAmount: number;
|
|
9
|
+
/** Id del credito generado en CP (chargeback) — para auditoria/conciliacion. */
|
|
10
|
+
cpCreditTransactionId?: string;
|
|
11
|
+
/** True si el credit-back ya existia (idempotencia) y no se re-ejecuto. */
|
|
12
|
+
alreadyProcessed: boolean;
|
|
13
|
+
}
|
|
@@ -2,3 +2,6 @@ export * from "./ReceptionMethod";
|
|
|
2
2
|
export * from "./RemittanceTxStatus";
|
|
3
3
|
export * from "./RemittanceCountryISO";
|
|
4
4
|
export * from "./RemittanceUserState";
|
|
5
|
+
export * from "./RemittanceCancelledByEnum";
|
|
6
|
+
export * from "./RemittanceCancelOutcomeEnum";
|
|
7
|
+
export * from "./FeeAbsorbedByEnum";
|
package/src/remittance/index.ts
CHANGED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { IsNumber, IsObject, IsOptional, IsPositive, IsString, Length, MaxLength } from "class-validator";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Request del endpoint `POST /settlements` del lambda `wallet-funding-settlement`.
|
|
5
|
+
*
|
|
6
|
+
* Ejecuta el WRITE atómico (TransactWriteItems 2 items) que acredita el
|
|
7
|
+
* balance del wallet Y marca el payment del provider como APPLIED, todo
|
|
8
|
+
* en una única transacción ACID DDB single-region.
|
|
9
|
+
*
|
|
10
|
+
* Idempotente por `ConditionExpression: status = CONSULTED` sobre el
|
|
11
|
+
* payment row del provider. Si el reintento llega y el row ya está en
|
|
12
|
+
* APPLIED, el settlement devuelve `alreadySettled=true` con el folio
|
|
13
|
+
* cacheado sin re-creditar.
|
|
14
|
+
*
|
|
15
|
+
* Caller canónico: `equality-connector.WebhookPaymentManager` post
|
|
16
|
+
* `processor.walletFundingValidate()`. Ver spec 15.
|
|
17
|
+
*/
|
|
18
|
+
export class SettleWalletFundingRequest {
|
|
19
|
+
/** Nombre canónico del provider cash-in. V1: "equality". Futuros: "openpay", etc. */
|
|
20
|
+
@IsString() @MaxLength(32) providerName!: string;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Identificador de la transacción en el provider. Para Equality es
|
|
24
|
+
* `equalityTransactionNumber` (PK de `EqualityFundingPayment_GT`).
|
|
25
|
+
*/
|
|
26
|
+
@IsString() @MaxLength(64) providerTxId!: string;
|
|
27
|
+
|
|
28
|
+
/** Referencia del payment row (ej. la `reference` de Equality). */
|
|
29
|
+
@IsString() @MaxLength(128) providerReference!: string;
|
|
30
|
+
|
|
31
|
+
@IsString() @MaxLength(64) directoryId!: string;
|
|
32
|
+
|
|
33
|
+
/** PK de la cuenta PCF (AccountPagoConfiado_GT.id) destino del crédito. */
|
|
34
|
+
@IsString() @MaxLength(64) accountId!: string;
|
|
35
|
+
|
|
36
|
+
@IsNumber() @IsPositive() amount!: number;
|
|
37
|
+
|
|
38
|
+
@IsString() @Length(3, 3) currencyCode!: string;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Folio del processor (campo Alfanumérico según doc Passport). Pre-generado
|
|
42
|
+
* por `processor.walletFundingValidate()` y reenviado al settlement para
|
|
43
|
+
* persistirlo en el payment row como `processorTransactionNumber`.
|
|
44
|
+
*/
|
|
45
|
+
@IsString() @MaxLength(64) processorTransactionNumber!: string;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Snapshot del webhook recibido del provider. Opcional — se persiste en
|
|
49
|
+
* `webhookResponseRaw` del payment row para auditoría. NO load-bearing
|
|
50
|
+
* para la idempotencia ni el flow.
|
|
51
|
+
*/
|
|
52
|
+
@IsOptional() @IsObject() webhookEcho?: Record<string, unknown>;
|
|
53
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { BenefitPaymentStatusEnum } from "../../benefitCenter/enums/BenefitPaymentStatusEnum";
|
|
2
|
+
import { SettlementErrorCodeEnum } from "../enums/SettlementErrorCodeEnum";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Response del endpoint `POST /settlements`. Indica si el settlement se
|
|
6
|
+
* ejecutó exitosamente (APPROVED) o fue rechazado (REJECTED) con un
|
|
7
|
+
* `errorCode` específico.
|
|
8
|
+
*
|
|
9
|
+
* Estado APPROVED:
|
|
10
|
+
* - El TransactWriteItems se commiteó atómicamente.
|
|
11
|
+
* - Balance acreditado + status del payment en APPLIED.
|
|
12
|
+
* - `alreadySettled=false` (primera ejecución) o `alreadySettled=true`
|
|
13
|
+
* (reintento idempotent — el row ya estaba en APPLIED).
|
|
14
|
+
*
|
|
15
|
+
* Estado REJECTED:
|
|
16
|
+
* - El TransactWriteItems NO se ejecutó (pre-check falló) o falló
|
|
17
|
+
* irrecuperablemente. Caller debe responder REJECTED al provider y
|
|
18
|
+
* marcar el payment en `QUEUED_FOR_REFUND` para gestión manual.
|
|
19
|
+
*
|
|
20
|
+
* Ver spec 15.
|
|
21
|
+
*/
|
|
22
|
+
export interface SettleWalletFundingResponse {
|
|
23
|
+
status: BenefitPaymentStatusEnum;
|
|
24
|
+
/**
|
|
25
|
+
* `true` si el TransactWriteItems no se ejecutó porque el row ya estaba
|
|
26
|
+
* en APPLIED (idempotent fast path). `false` si fue la primera ejecución
|
|
27
|
+
* que efectivamente movió saldo.
|
|
28
|
+
*/
|
|
29
|
+
alreadySettled: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Folio del processor devuelto al caller. En idempotent hit es el folio
|
|
32
|
+
* cacheado del row APPLIED previo (NO el del request actual).
|
|
33
|
+
*/
|
|
34
|
+
processorTransactionNumber: string;
|
|
35
|
+
errorCode?: SettlementErrorCodeEnum;
|
|
36
|
+
message?: string;
|
|
37
|
+
}
|
|
@@ -19,3 +19,5 @@ export * from "./ReverseWalletFundingRequest";
|
|
|
19
19
|
export * from "./ReverseWalletFundingResponse";
|
|
20
20
|
export * from "./AuthorizeFundingRequest";
|
|
21
21
|
export * from "./AuthorizeFundingResponse";
|
|
22
|
+
export * from "./SettleWalletFundingRequest";
|
|
23
|
+
export * from "./SettleWalletFundingResponse";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Códigos de error del lambda `wallet-funding-settlement`.
|
|
3
|
+
*
|
|
4
|
+
* Distintos a `WalletFundingErrorCodeEnum` — esos son del flow del processor
|
|
5
|
+
* (validaciones PCF, AML, caps). Estos son específicos del settlement:
|
|
6
|
+
* estado del payment row + integridad del TransactWriteItems.
|
|
7
|
+
*
|
|
8
|
+
* Ver spec 15 §4.5 (flujo interno) + §8 (edge cases).
|
|
9
|
+
*/
|
|
10
|
+
export enum SettlementErrorCodeEnum {
|
|
11
|
+
/** El payment row no existe en la tabla del provider. Bug del caller (debió crear CONSULTED antes). */
|
|
12
|
+
PAYMENT_NOT_FOUND = "PAYMENT_NOT_FOUND",
|
|
13
|
+
/** El payment row está en estado terminal (FAILED, QUEUED_FOR_REFUND, REJECTED). No procede acreditar. */
|
|
14
|
+
PAYMENT_IN_TERMINAL_STATE = "PAYMENT_IN_TERMINAL_STATE",
|
|
15
|
+
/** La cuenta PCF no existe o no está accesible. */
|
|
16
|
+
ACCOUNT_NOT_FOUND = "ACCOUNT_NOT_FOUND",
|
|
17
|
+
/** El TransactWriteItems falló por razón no recuperable (no ConditionalCheckFailed esperado). */
|
|
18
|
+
TRANSACT_WRITE_FAILED = "TRANSACT_WRITE_FAILED",
|
|
19
|
+
/** El providerName del request no está registrado en el ProviderRegistry del settlement. */
|
|
20
|
+
PROVIDER_NOT_SUPPORTED = "PROVIDER_NOT_SUPPORTED",
|
|
21
|
+
/** El amount del request difiere del paymentAmount persistido en el row CONSULTED. Posible tampering. */
|
|
22
|
+
AMOUNT_MISMATCH = "AMOUNT_MISMATCH",
|
|
23
|
+
/** Error interno no clasificado. Caller debe loggear + alarmar. */
|
|
24
|
+
INTERNAL_ERROR = "INTERNAL_ERROR",
|
|
25
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema literal de la tabla DDB `AccountPagoConfiado_GT`.
|
|
3
|
+
*
|
|
4
|
+
* Owner declarado: `account-pago-confiado`. Write-shared con
|
|
5
|
+
* `wallet-funding-settlement` SOLO en el path money (campos de balance) bajo
|
|
6
|
+
* excepción documentada (spec 15 §3 + spec 10 §7 pendiente).
|
|
7
|
+
*
|
|
8
|
+
* El settlement escribe ÚNICAMENTE estos campos vía TransactWriteItems:
|
|
9
|
+
* - `availableBalance` (ADD :amt)
|
|
10
|
+
* - `currentBalance` (ADD :amt)
|
|
11
|
+
* - `updatedAt` (SET :now)
|
|
12
|
+
*
|
|
13
|
+
* El resto del shape (status, level, KYC, settings) sigue siendo write-exclusivo
|
|
14
|
+
* del owner. Cualquier campo nuevo de balance que el settlement deba escribir
|
|
15
|
+
* requiere actualizar este schema + el TransactWriteBuilder del settlement.
|
|
16
|
+
*/
|
|
17
|
+
export const AccountPagoConfiadoTable = {
|
|
18
|
+
name: "AccountPagoConfiado_GT",
|
|
19
|
+
pk: "id",
|
|
20
|
+
attributes: {
|
|
21
|
+
id: "id",
|
|
22
|
+
directoryId: "directoryId",
|
|
23
|
+
// Campos write-shared con wallet-funding-settlement (money path):
|
|
24
|
+
availableBalance: "availableBalance",
|
|
25
|
+
currentBalance: "currentBalance",
|
|
26
|
+
lockedBalance: "lockedBalance",
|
|
27
|
+
unsettledBalance: "unsettledBalance",
|
|
28
|
+
unpaidBalance: "unpaidBalance",
|
|
29
|
+
unallowedBalance: "unallowedBalance",
|
|
30
|
+
updatedAt: "updatedAt",
|
|
31
|
+
// Campos write-exclusive del owner (account-pago-confiado):
|
|
32
|
+
status: "status",
|
|
33
|
+
accountLevel: "accountLevel",
|
|
34
|
+
currency: "currency",
|
|
35
|
+
countryId: "countryId",
|
|
36
|
+
createdAt: "createdAt",
|
|
37
|
+
},
|
|
38
|
+
} as const;
|
|
39
|
+
|
|
40
|
+
export type AccountPagoConfiadoAttribute =
|
|
41
|
+
typeof AccountPagoConfiadoTable.attributes[keyof typeof AccountPagoConfiadoTable.attributes];
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema literal de la tabla DDB `EqualityFundingPayment_GT`.
|
|
3
|
+
*
|
|
4
|
+
* Define los nombres exactos de tabla, atributos e índices que el
|
|
5
|
+
* `equality-connector` (owner declarado) y el `wallet-funding-settlement`
|
|
6
|
+
* (write-shared bajo excepción money path, spec 15 §3) consumen.
|
|
7
|
+
*
|
|
8
|
+
* NO es un model de Dynamoose — son solo constantes type-safe. El
|
|
9
|
+
* settlement usa DDB SDK v3 raw para `TransactWriteItems`; el connector
|
|
10
|
+
* sigue usando Dynamoose en su repositorio (su propio model interno).
|
|
11
|
+
*
|
|
12
|
+
* Cuando el schema cambia (nuevo campo, índice nuevo), bump del type-kit
|
|
13
|
+
* fuerza recompile de TODOS los consumers → drift imposible en silence.
|
|
14
|
+
*/
|
|
15
|
+
export const EqualityFundingPaymentTable = {
|
|
16
|
+
name: "EqualityFundingPayment_GT",
|
|
17
|
+
pk: "equalityTransactionNumber",
|
|
18
|
+
attributes: {
|
|
19
|
+
equalityTransactionNumber: "equalityTransactionNumber",
|
|
20
|
+
directoryId: "directoryId",
|
|
21
|
+
reference: "reference",
|
|
22
|
+
paymentAmount: "paymentAmount",
|
|
23
|
+
paymentDate: "paymentDate",
|
|
24
|
+
center: "center",
|
|
25
|
+
centerId: "centerId",
|
|
26
|
+
status: "status",
|
|
27
|
+
webhookType: "webhookType",
|
|
28
|
+
webhookRequestRaw: "webhookRequestRaw",
|
|
29
|
+
webhookResponseRaw: "webhookResponseRaw",
|
|
30
|
+
processorTransactionNumber: "processorTransactionNumber",
|
|
31
|
+
rejectionCode: "rejectionCode",
|
|
32
|
+
rejectionReason: "rejectionReason",
|
|
33
|
+
refundReason: "refundReason",
|
|
34
|
+
createdAt: "createdAt",
|
|
35
|
+
updatedAt: "updatedAt",
|
|
36
|
+
},
|
|
37
|
+
indexes: {
|
|
38
|
+
/** GSI por status + createdAt — usado por crons de reconciliation/refund. */
|
|
39
|
+
statusCreatedAt: "status-createdAt-index",
|
|
40
|
+
},
|
|
41
|
+
} as const;
|
|
42
|
+
|
|
43
|
+
export type EqualityFundingPaymentAttribute =
|
|
44
|
+
typeof EqualityFundingPaymentTable.attributes[keyof typeof EqualityFundingPaymentTable.attributes];
|