tychat-contracts 1.0.86 → 1.0.88
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/dist/billing/list-billings-query.dto.d.ts +3 -0
- package/dist/billing/list-billings-query.dto.d.ts.map +1 -1
- package/dist/billing/list-billings-query.dto.js +21 -0
- package/dist/cashback/cashback-kafka-payloads.d.ts +6 -0
- package/dist/cashback/cashback-kafka-payloads.d.ts.map +1 -1
- package/dist/payment-gateway/create-gateway-payment.dto.d.ts +1 -1
- package/dist/payment-gateway/create-gateway-payment.dto.d.ts.map +1 -1
- package/dist/payment-gateway/create-gateway-payment.dto.js +3 -3
- package/dist/payment-gateway/index.d.ts +5 -0
- package/dist/payment-gateway/index.d.ts.map +1 -1
- package/dist/payment-gateway/index.js +5 -0
- package/dist/payment-gateway/initiate-billing-payment-response.dto.d.ts +13 -0
- package/dist/payment-gateway/initiate-billing-payment-response.dto.d.ts.map +1 -0
- package/dist/payment-gateway/initiate-billing-payment-response.dto.js +48 -0
- package/dist/payment-gateway/initiate-billing-payment.mapper.d.ts +7 -0
- package/dist/payment-gateway/initiate-billing-payment.mapper.d.ts.map +1 -0
- package/dist/payment-gateway/initiate-billing-payment.mapper.js +17 -0
- package/dist/payment-gateway/payment-gateway-routing-matrix.d.ts +3 -0
- package/dist/payment-gateway/payment-gateway-routing-matrix.d.ts.map +1 -0
- package/dist/payment-gateway/payment-gateway-routing-matrix.js +15 -0
- package/dist/payment-gateway/payment-gateway-routing.dto.d.ts +14 -0
- package/dist/payment-gateway/payment-gateway-routing.dto.d.ts.map +1 -0
- package/dist/payment-gateway/payment-gateway-routing.dto.js +89 -0
- package/dist/payment-gateway/platform-configuration.topics.d.ts +3 -0
- package/dist/payment-gateway/platform-configuration.topics.d.ts.map +1 -0
- package/dist/payment-gateway/platform-configuration.topics.js +5 -0
- package/package.json +1 -1
- package/src/billing/list-billings-query.dto.ts +22 -0
- package/src/cashback/cashback-kafka-payloads.ts +7 -0
- package/src/payment-gateway/create-gateway-payment.dto.ts +5 -4
- package/src/payment-gateway/index.ts +5 -0
- package/src/payment-gateway/initiate-billing-payment-response.dto.ts +25 -0
- package/src/payment-gateway/initiate-billing-payment.mapper.ts +19 -0
- package/src/payment-gateway/payment-gateway-routing-matrix.ts +18 -0
- package/src/payment-gateway/payment-gateway-routing.dto.ts +84 -0
- package/src/payment-gateway/platform-configuration.topics.ts +2 -0
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { BillingStatusDto } from './create-billing.dto';
|
|
2
|
+
import { type GatewayPaymentMethodDto, type PaymentGatewayDto } from '../payment-gateway/payment-gateway.enums';
|
|
2
3
|
export declare class ListBillingsQueryDto {
|
|
3
4
|
tenantId?: string;
|
|
4
5
|
status?: BillingStatusDto;
|
|
5
6
|
paymentId?: string;
|
|
7
|
+
method?: GatewayPaymentMethodDto;
|
|
8
|
+
gateway?: PaymentGatewayDto;
|
|
6
9
|
page?: number;
|
|
7
10
|
limit?: number;
|
|
8
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-billings-query.dto.d.ts","sourceRoot":"","sources":["../../src/billing/list-billings-query.dto.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,gBAAgB,EACjB,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"list-billings-query.dto.d.ts","sourceRoot":"","sources":["../../src/billing/list-billings-query.dto.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,gBAAgB,EACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAEL,KAAK,uBAAuB,EAE5B,KAAK,iBAAiB,EACvB,MAAM,0CAA0C,CAAC;AAElD,qBAAa,oBAAoB;IAO/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IASlB,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAQ1B,SAAS,CAAC,EAAE,MAAM,CAAC;IAQnB,MAAM,CAAC,EAAE,uBAAuB,CAAC;IAQjC,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAW5B,IAAI,CAAC,EAAE,MAAM,CAAC;IAad,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -13,10 +13,13 @@ exports.ListBillingsQueryDto = void 0;
|
|
|
13
13
|
const swagger_1 = require("@nestjs/swagger");
|
|
14
14
|
const class_validator_1 = require("class-validator");
|
|
15
15
|
const create_billing_dto_1 = require("./create-billing.dto");
|
|
16
|
+
const payment_gateway_enums_1 = require("../payment-gateway/payment-gateway.enums");
|
|
16
17
|
class ListBillingsQueryDto {
|
|
17
18
|
tenantId;
|
|
18
19
|
status;
|
|
19
20
|
paymentId;
|
|
21
|
+
method;
|
|
22
|
+
gateway;
|
|
20
23
|
page;
|
|
21
24
|
limit;
|
|
22
25
|
}
|
|
@@ -49,6 +52,24 @@ __decorate([
|
|
|
49
52
|
(0, class_validator_1.IsUUID)('4'),
|
|
50
53
|
__metadata("design:type", String)
|
|
51
54
|
], ListBillingsQueryDto.prototype, "paymentId", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
57
|
+
description: 'Filtro por método de pagamento associado à cobrança',
|
|
58
|
+
enum: payment_gateway_enums_1.GATEWAY_PAYMENT_METHODS,
|
|
59
|
+
}),
|
|
60
|
+
(0, class_validator_1.IsOptional)(),
|
|
61
|
+
(0, class_validator_1.IsEnum)(payment_gateway_enums_1.GATEWAY_PAYMENT_METHODS),
|
|
62
|
+
__metadata("design:type", String)
|
|
63
|
+
], ListBillingsQueryDto.prototype, "method", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
66
|
+
description: 'Filtro por gateway de pagamento',
|
|
67
|
+
enum: payment_gateway_enums_1.PAYMENT_GATEWAYS,
|
|
68
|
+
}),
|
|
69
|
+
(0, class_validator_1.IsOptional)(),
|
|
70
|
+
(0, class_validator_1.IsEnum)(payment_gateway_enums_1.PAYMENT_GATEWAYS),
|
|
71
|
+
__metadata("design:type", String)
|
|
72
|
+
], ListBillingsQueryDto.prototype, "gateway", void 0);
|
|
52
73
|
__decorate([
|
|
53
74
|
(0, swagger_1.ApiPropertyOptional)({
|
|
54
75
|
description: 'Page number (starting at 1)',
|
|
@@ -32,6 +32,12 @@ export interface UseReferralCodePayload {
|
|
|
32
32
|
checkoutId: string;
|
|
33
33
|
checkoutAmount: number;
|
|
34
34
|
}
|
|
35
|
+
/** Vínculo de código no cadastro do paciente (sem checkout). */
|
|
36
|
+
export interface LinkReferralAtRegistrationPayload {
|
|
37
|
+
tenant: string;
|
|
38
|
+
code: string;
|
|
39
|
+
referredPatientId: string;
|
|
40
|
+
}
|
|
35
41
|
export interface GetReferralByPatientPayload {
|
|
36
42
|
tenant: string;
|
|
37
43
|
patientId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cashback-kafka-payloads.d.ts","sourceRoot":"","sources":["../../src/cashback/cashback-kafka-payloads.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAItF,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,2BAA2B;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,uBAAuB,CAAC;IACvC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,yBAAyB,CAAC;IAC3C,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC;AAID,MAAM,WAAW,2BAA2B;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,yFAAyF;IACzF,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,2BAA2B;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,2BAA2B;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;CACxB;AAID,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,4BAA4B;IAC3C,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
|
1
|
+
{"version":3,"file":"cashback-kafka-payloads.d.ts","sourceRoot":"","sources":["../../src/cashback/cashback-kafka-payloads.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAItF,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,2BAA2B;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,uBAAuB,CAAC;IACvC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,yBAAyB,CAAC;IAC3C,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC;AAID,MAAM,WAAW,2BAA2B;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,yFAAyF;IACzF,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,2BAA2B;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,gEAAgE;AAChE,MAAM,WAAW,iCAAiC;IAChD,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,2BAA2B;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;CACxB;AAID,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,4BAA4B;IAC3C,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-gateway-payment.dto.d.ts","sourceRoot":"","sources":["../../src/payment-gateway/create-gateway-payment.dto.ts"],"names":[],"mappings":"AAaA,OAAO,EAEL,iBAAiB,EAEjB,uBAAuB,EACxB,MAAM,yBAAyB,CAAC;AAEjC;;GAEG;AACH,qBAAa,kBAAkB;IAI7B,IAAI,EAAE,MAAM,CAAC;IAKb,KAAK,EAAE,MAAM,CAAC;IAKd,OAAO,CAAC,EAAE,MAAM,CAAC;IAKjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,qBAAa,uBAAuB;IAOlC,QAAQ,EAAE,MAAM,CAAC;IAQjB,SAAS,EAAE,MAAM,CAAC;IASlB,MAAM,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"create-gateway-payment.dto.d.ts","sourceRoot":"","sources":["../../src/payment-gateway/create-gateway-payment.dto.ts"],"names":[],"mappings":"AAaA,OAAO,EAEL,iBAAiB,EAEjB,uBAAuB,EACxB,MAAM,yBAAyB,CAAC;AAEjC;;GAEG;AACH,qBAAa,kBAAkB;IAI7B,IAAI,EAAE,MAAM,CAAC;IAKb,KAAK,EAAE,MAAM,CAAC;IAKd,OAAO,CAAC,EAAE,MAAM,CAAC;IAKjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,qBAAa,uBAAuB;IAOlC,QAAQ,EAAE,MAAM,CAAC;IAQjB,SAAS,EAAE,MAAM,CAAC;IASlB,MAAM,EAAE,MAAM,CAAC;IAUf,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAS5B,MAAM,EAAE,uBAAuB,CAAC;IAOhC,OAAO,EAAE,MAAM,CAAC;IAQhB,WAAW,CAAC,EAAE,MAAM,CAAC;IAQrB,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAO9B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC"}
|
|
@@ -92,13 +92,13 @@ __decorate([
|
|
|
92
92
|
__metadata("design:type", Number)
|
|
93
93
|
], CreateGatewayPaymentDto.prototype, "amount", void 0);
|
|
94
94
|
__decorate([
|
|
95
|
-
(0, swagger_1.
|
|
96
|
-
description: '
|
|
95
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
96
|
+
description: 'Gateway explícito. Se omitido, o payment-gateway-service resolve pela rota global (prioridade + métodos).',
|
|
97
97
|
enum: payment_gateway_enums_1.PAYMENT_GATEWAYS,
|
|
98
98
|
example: 'ASAAS',
|
|
99
99
|
}),
|
|
100
|
+
(0, class_validator_1.IsOptional)(),
|
|
100
101
|
(0, class_validator_1.IsEnum)(payment_gateway_enums_1.PAYMENT_GATEWAYS),
|
|
101
|
-
(0, class_validator_1.IsNotEmpty)(),
|
|
102
102
|
__metadata("design:type", String)
|
|
103
103
|
], CreateGatewayPaymentDto.prototype, "gateway", void 0);
|
|
104
104
|
__decorate([
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
export * from './payment-gateway.enums';
|
|
2
|
+
export * from './payment-gateway-routing-matrix';
|
|
3
|
+
export * from './payment-gateway-routing.dto';
|
|
4
|
+
export * from './initiate-billing-payment-response.dto';
|
|
5
|
+
export * from './initiate-billing-payment.mapper';
|
|
6
|
+
export * from './platform-configuration.topics';
|
|
2
7
|
export * from './create-gateway-payment.dto';
|
|
3
8
|
export * from './update-gateway-payment.dto';
|
|
4
9
|
export * from './gateway-payment-response.dto';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/payment-gateway/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mCAAmC,CAAC;AAClD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/payment-gateway/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,kCAAkC,CAAC;AACjD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yCAAyC,CAAC;AACxD,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mCAAmC,CAAC;AAClD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC"}
|
|
@@ -15,6 +15,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./payment-gateway.enums"), exports);
|
|
18
|
+
__exportStar(require("./payment-gateway-routing-matrix"), exports);
|
|
19
|
+
__exportStar(require("./payment-gateway-routing.dto"), exports);
|
|
20
|
+
__exportStar(require("./initiate-billing-payment-response.dto"), exports);
|
|
21
|
+
__exportStar(require("./initiate-billing-payment.mapper"), exports);
|
|
22
|
+
__exportStar(require("./platform-configuration.topics"), exports);
|
|
18
23
|
__exportStar(require("./create-gateway-payment.dto"), exports);
|
|
19
24
|
__exportStar(require("./update-gateway-payment.dto"), exports);
|
|
20
25
|
__exportStar(require("./gateway-payment-response.dto"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GatewayPaymentResponseDto } from './gateway-payment-response.dto';
|
|
2
|
+
/**
|
|
3
|
+
* Resposta de iniciar pagamento de cobrança: inclui o registro do pagamento e
|
|
4
|
+
* campos explícitos copiados de metadata quando presentes (PIX, checkout, boleto).
|
|
5
|
+
*/
|
|
6
|
+
export declare class InitiateBillingPaymentResponseDto extends GatewayPaymentResponseDto {
|
|
7
|
+
checkoutUrl?: string | null;
|
|
8
|
+
pixQrCode?: string | null;
|
|
9
|
+
pixCopyPaste?: string | null;
|
|
10
|
+
boletoUrl?: string | null;
|
|
11
|
+
boletoBarcode?: string | null;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=initiate-billing-payment-response.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initiate-billing-payment-response.dto.d.ts","sourceRoot":"","sources":["../../src/payment-gateway/initiate-billing-payment-response.dto.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAE3E;;;GAGG;AACH,qBAAa,iCAAkC,SAAQ,yBAAyB;IAI9E,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG5B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG1B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG7B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG1B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B"}
|
|
@@ -0,0 +1,48 @@
|
|
|
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.InitiateBillingPaymentResponseDto = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const gateway_payment_response_dto_1 = require("./gateway-payment-response.dto");
|
|
15
|
+
/**
|
|
16
|
+
* Resposta de iniciar pagamento de cobrança: inclui o registro do pagamento e
|
|
17
|
+
* campos explícitos copiados de metadata quando presentes (PIX, checkout, boleto).
|
|
18
|
+
*/
|
|
19
|
+
class InitiateBillingPaymentResponseDto extends gateway_payment_response_dto_1.GatewayPaymentResponseDto {
|
|
20
|
+
checkoutUrl;
|
|
21
|
+
pixQrCode;
|
|
22
|
+
pixCopyPaste;
|
|
23
|
+
boletoUrl;
|
|
24
|
+
boletoBarcode;
|
|
25
|
+
}
|
|
26
|
+
exports.InitiateBillingPaymentResponseDto = InitiateBillingPaymentResponseDto;
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
29
|
+
description: 'URL para fluxo de pagamento (cartão, checkout hospedado, etc.)',
|
|
30
|
+
}),
|
|
31
|
+
__metadata("design:type", Object)
|
|
32
|
+
], InitiateBillingPaymentResponseDto.prototype, "checkoutUrl", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, swagger_1.ApiPropertyOptional)({ description: 'QR Code PIX em base64 quando aplicável' }),
|
|
35
|
+
__metadata("design:type", Object)
|
|
36
|
+
], InitiateBillingPaymentResponseDto.prototype, "pixQrCode", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, swagger_1.ApiPropertyOptional)({ description: 'PIX copia e cola quando aplicável' }),
|
|
39
|
+
__metadata("design:type", Object)
|
|
40
|
+
], InitiateBillingPaymentResponseDto.prototype, "pixCopyPaste", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, swagger_1.ApiPropertyOptional)({ description: 'URL do boleto quando aplicável' }),
|
|
43
|
+
__metadata("design:type", Object)
|
|
44
|
+
], InitiateBillingPaymentResponseDto.prototype, "boletoUrl", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, swagger_1.ApiPropertyOptional)({ description: 'Código de barras do boleto quando aplicável' }),
|
|
47
|
+
__metadata("design:type", Object)
|
|
48
|
+
], InitiateBillingPaymentResponseDto.prototype, "boletoBarcode", void 0);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { GatewayPaymentResponseDto } from './gateway-payment-response.dto';
|
|
2
|
+
import { InitiateBillingPaymentResponseDto } from './initiate-billing-payment-response.dto';
|
|
3
|
+
/**
|
|
4
|
+
* Copia campos conhecidos de `metadata` para a resposta explícita de checkout/PIX/boleto.
|
|
5
|
+
*/
|
|
6
|
+
export declare function toInitiateBillingPaymentResponseDto(payment: GatewayPaymentResponseDto): InitiateBillingPaymentResponseDto;
|
|
7
|
+
//# sourceMappingURL=initiate-billing-payment.mapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initiate-billing-payment.mapper.d.ts","sourceRoot":"","sources":["../../src/payment-gateway/initiate-billing-payment.mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAChF,OAAO,EAAE,iCAAiC,EAAE,MAAM,yCAAyC,CAAC;AAE5F;;GAEG;AACH,wBAAgB,mCAAmC,CACjD,OAAO,EAAE,yBAAyB,GACjC,iCAAiC,CAUnC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toInitiateBillingPaymentResponseDto = toInitiateBillingPaymentResponseDto;
|
|
4
|
+
/**
|
|
5
|
+
* Copia campos conhecidos de `metadata` para a resposta explícita de checkout/PIX/boleto.
|
|
6
|
+
*/
|
|
7
|
+
function toInitiateBillingPaymentResponseDto(payment) {
|
|
8
|
+
const meta = (payment.metadata ?? {});
|
|
9
|
+
return {
|
|
10
|
+
...payment,
|
|
11
|
+
checkoutUrl: meta.paymentUrl ?? undefined,
|
|
12
|
+
pixQrCode: meta.pixQrCode ?? undefined,
|
|
13
|
+
pixCopyPaste: meta.pixCopyPaste ?? undefined,
|
|
14
|
+
boletoUrl: meta.boletoUrl ?? undefined,
|
|
15
|
+
boletoBarcode: meta.boletoBarcode ?? undefined,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { GatewayPaymentMethodDto, PaymentGatewayDto } from './payment-gateway.enums';
|
|
2
|
+
export declare function isMethodSupportedByGateway(gateway: PaymentGatewayDto, method: GatewayPaymentMethodDto): boolean;
|
|
3
|
+
//# sourceMappingURL=payment-gateway-routing-matrix.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-gateway-routing-matrix.d.ts","sourceRoot":"","sources":["../../src/payment-gateway/payment-gateway-routing-matrix.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAY1F,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,iBAAiB,EAC1B,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAET"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isMethodSupportedByGateway = isMethodSupportedByGateway;
|
|
4
|
+
/**
|
|
5
|
+
* Matriz fixa gateway × meio (alinhada ao README do payment-gateway-service).
|
|
6
|
+
* Usada para validar configuração persistida e para checagens determinísticas.
|
|
7
|
+
*/
|
|
8
|
+
const SUPPORTED = {
|
|
9
|
+
ASAAS: new Set(['PIX', 'CREDIT_CARD', 'DEBIT_CARD', 'BOLETO']),
|
|
10
|
+
MERCADO_PAGO: new Set(['PIX', 'CREDIT_CARD', 'DEBIT_CARD']),
|
|
11
|
+
STRIPE: new Set(['CREDIT_CARD', 'DEBIT_CARD']),
|
|
12
|
+
};
|
|
13
|
+
function isMethodSupportedByGateway(gateway, method) {
|
|
14
|
+
return SUPPORTED[gateway]?.has(method) ?? false;
|
|
15
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ValidationArguments, ValidatorConstraintInterface } from 'class-validator';
|
|
2
|
+
import { type GatewayPaymentMethodDto, type PaymentGatewayDto } from './payment-gateway.enums';
|
|
3
|
+
export declare class PaymentGatewayRoutingEntriesConstraint implements ValidatorConstraintInterface {
|
|
4
|
+
validate(entries: unknown, _args: ValidationArguments): boolean;
|
|
5
|
+
defaultMessage(): string;
|
|
6
|
+
}
|
|
7
|
+
export declare class PaymentGatewayRoutingEntryDto {
|
|
8
|
+
gateway: PaymentGatewayDto;
|
|
9
|
+
methods: GatewayPaymentMethodDto[];
|
|
10
|
+
}
|
|
11
|
+
export declare class PaymentGatewayRoutingDto {
|
|
12
|
+
entries: PaymentGatewayRoutingEntryDto[];
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=payment-gateway-routing.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-gateway-routing.dto.d.ts","sourceRoot":"","sources":["../../src/payment-gateway/payment-gateway-routing.dto.ts"],"names":[],"mappings":"AAEA,OAAO,EAML,mBAAmB,EAEnB,4BAA4B,EAC7B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAEL,KAAK,uBAAuB,EAE5B,KAAK,iBAAiB,EACvB,MAAM,yBAAyB,CAAC;AAGjC,qBACa,sCAAuC,YAAW,4BAA4B;IACzF,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,mBAAmB,GAAG,OAAO;IAiC/D,cAAc,IAAI,MAAM;CAMzB;AAED,qBAAa,6BAA6B;IAGxC,OAAO,EAAE,iBAAiB,CAAC;IAM3B,OAAO,EAAE,uBAAuB,EAAE,CAAC;CACpC;AAED,qBAAa,wBAAwB;IAOnC,OAAO,EAAE,6BAA6B,EAAE,CAAC;CAC1C"}
|
|
@@ -0,0 +1,89 @@
|
|
|
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.PaymentGatewayRoutingDto = exports.PaymentGatewayRoutingEntryDto = exports.PaymentGatewayRoutingEntriesConstraint = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const class_transformer_1 = require("class-transformer");
|
|
15
|
+
const class_validator_1 = require("class-validator");
|
|
16
|
+
const payment_gateway_enums_1 = require("./payment-gateway.enums");
|
|
17
|
+
const payment_gateway_routing_matrix_1 = require("./payment-gateway-routing-matrix");
|
|
18
|
+
let PaymentGatewayRoutingEntriesConstraint = class PaymentGatewayRoutingEntriesConstraint {
|
|
19
|
+
validate(entries, _args) {
|
|
20
|
+
if (!Array.isArray(entries) || entries.length < 1) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
const seenGateways = new Set();
|
|
24
|
+
for (const raw of entries) {
|
|
25
|
+
if (!raw || typeof raw !== 'object') {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
const e = raw;
|
|
29
|
+
if (typeof e.gateway !== 'string' || !payment_gateway_enums_1.PAYMENT_GATEWAYS.includes(e.gateway)) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
const gateway = e.gateway;
|
|
33
|
+
if (seenGateways.has(gateway)) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
seenGateways.add(gateway);
|
|
37
|
+
if (!Array.isArray(e.methods) || e.methods.length < 1) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
for (const m of e.methods) {
|
|
41
|
+
if (typeof m !== 'string' || !payment_gateway_enums_1.GATEWAY_PAYMENT_METHODS.includes(m)) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
if (!(0, payment_gateway_routing_matrix_1.isMethodSupportedByGateway)(gateway, m)) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
defaultMessage() {
|
|
52
|
+
return ('paymentGatewayRouting.entries inválido: ordem vazia, gateway duplicado, methods vazio ' +
|
|
53
|
+
'ou combinação gateway/método não suportada pela plataforma');
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
exports.PaymentGatewayRoutingEntriesConstraint = PaymentGatewayRoutingEntriesConstraint;
|
|
57
|
+
exports.PaymentGatewayRoutingEntriesConstraint = PaymentGatewayRoutingEntriesConstraint = __decorate([
|
|
58
|
+
(0, class_validator_1.ValidatorConstraint)({ name: 'paymentGatewayRoutingEntriesValid', async: false })
|
|
59
|
+
], PaymentGatewayRoutingEntriesConstraint);
|
|
60
|
+
class PaymentGatewayRoutingEntryDto {
|
|
61
|
+
gateway;
|
|
62
|
+
methods;
|
|
63
|
+
}
|
|
64
|
+
exports.PaymentGatewayRoutingEntryDto = PaymentGatewayRoutingEntryDto;
|
|
65
|
+
__decorate([
|
|
66
|
+
(0, swagger_1.ApiProperty)({ enum: payment_gateway_enums_1.PAYMENT_GATEWAYS }),
|
|
67
|
+
(0, class_validator_1.IsEnum)(payment_gateway_enums_1.PAYMENT_GATEWAYS),
|
|
68
|
+
__metadata("design:type", String)
|
|
69
|
+
], PaymentGatewayRoutingEntryDto.prototype, "gateway", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
(0, swagger_1.ApiProperty)({ enum: payment_gateway_enums_1.GATEWAY_PAYMENT_METHODS, isArray: true }),
|
|
72
|
+
(0, class_validator_1.IsArray)(),
|
|
73
|
+
(0, class_validator_1.ArrayMinSize)(1),
|
|
74
|
+
(0, class_validator_1.IsEnum)(payment_gateway_enums_1.GATEWAY_PAYMENT_METHODS, { each: true }),
|
|
75
|
+
__metadata("design:type", Array)
|
|
76
|
+
], PaymentGatewayRoutingEntryDto.prototype, "methods", void 0);
|
|
77
|
+
class PaymentGatewayRoutingDto {
|
|
78
|
+
entries;
|
|
79
|
+
}
|
|
80
|
+
exports.PaymentGatewayRoutingDto = PaymentGatewayRoutingDto;
|
|
81
|
+
__decorate([
|
|
82
|
+
(0, swagger_1.ApiProperty)({ type: [PaymentGatewayRoutingEntryDto] }),
|
|
83
|
+
(0, class_validator_1.IsArray)(),
|
|
84
|
+
(0, class_validator_1.ArrayMinSize)(1),
|
|
85
|
+
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
86
|
+
(0, class_transformer_1.Type)(() => PaymentGatewayRoutingEntryDto),
|
|
87
|
+
(0, class_validator_1.Validate)(PaymentGatewayRoutingEntriesConstraint),
|
|
88
|
+
__metadata("design:type", Array)
|
|
89
|
+
], PaymentGatewayRoutingDto.prototype, "entries", void 0);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-configuration.topics.d.ts","sourceRoot":"","sources":["../../src/payment-gateway/platform-configuration.topics.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,eAAO,MAAM,gCAAgC,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TOPIC_PLATFORM_CONFIGURATION_GET = void 0;
|
|
4
|
+
/** RPC: retorno da configuração global da plataforma (tenant-service → consumidores). */
|
|
5
|
+
exports.TOPIC_PLATFORM_CONFIGURATION_GET = 'platform.configuration.get';
|
package/package.json
CHANGED
|
@@ -4,6 +4,12 @@ import {
|
|
|
4
4
|
BILLING_STATUSES,
|
|
5
5
|
BillingStatusDto,
|
|
6
6
|
} from './create-billing.dto';
|
|
7
|
+
import {
|
|
8
|
+
GATEWAY_PAYMENT_METHODS,
|
|
9
|
+
type GatewayPaymentMethodDto,
|
|
10
|
+
PAYMENT_GATEWAYS,
|
|
11
|
+
type PaymentGatewayDto,
|
|
12
|
+
} from '../payment-gateway/payment-gateway.enums';
|
|
7
13
|
|
|
8
14
|
export class ListBillingsQueryDto {
|
|
9
15
|
@ApiPropertyOptional({
|
|
@@ -31,6 +37,22 @@ export class ListBillingsQueryDto {
|
|
|
31
37
|
@IsUUID('4')
|
|
32
38
|
paymentId?: string;
|
|
33
39
|
|
|
40
|
+
@ApiPropertyOptional({
|
|
41
|
+
description: 'Filtro por método de pagamento associado à cobrança',
|
|
42
|
+
enum: GATEWAY_PAYMENT_METHODS,
|
|
43
|
+
})
|
|
44
|
+
@IsOptional()
|
|
45
|
+
@IsEnum(GATEWAY_PAYMENT_METHODS)
|
|
46
|
+
method?: GatewayPaymentMethodDto;
|
|
47
|
+
|
|
48
|
+
@ApiPropertyOptional({
|
|
49
|
+
description: 'Filtro por gateway de pagamento',
|
|
50
|
+
enum: PAYMENT_GATEWAYS,
|
|
51
|
+
})
|
|
52
|
+
@IsOptional()
|
|
53
|
+
@IsEnum(PAYMENT_GATEWAYS)
|
|
54
|
+
gateway?: PaymentGatewayDto;
|
|
55
|
+
|
|
34
56
|
@ApiPropertyOptional({
|
|
35
57
|
description: 'Page number (starting at 1)',
|
|
36
58
|
example: 1,
|
|
@@ -42,6 +42,13 @@ export interface UseReferralCodePayload {
|
|
|
42
42
|
checkoutAmount: number;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
/** Vínculo de código no cadastro do paciente (sem checkout). */
|
|
46
|
+
export interface LinkReferralAtRegistrationPayload {
|
|
47
|
+
tenant: string;
|
|
48
|
+
code: string;
|
|
49
|
+
referredPatientId: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
45
52
|
export interface GetReferralByPatientPayload {
|
|
46
53
|
tenant: string;
|
|
47
54
|
patientId: string;
|
|
@@ -72,14 +72,15 @@ export class CreateGatewayPaymentDto {
|
|
|
72
72
|
@Min(0.01)
|
|
73
73
|
amount: number;
|
|
74
74
|
|
|
75
|
-
@
|
|
76
|
-
description:
|
|
75
|
+
@ApiPropertyOptional({
|
|
76
|
+
description:
|
|
77
|
+
'Gateway explícito. Se omitido, o payment-gateway-service resolve pela rota global (prioridade + métodos).',
|
|
77
78
|
enum: PAYMENT_GATEWAYS,
|
|
78
79
|
example: 'ASAAS',
|
|
79
80
|
})
|
|
81
|
+
@IsOptional()
|
|
80
82
|
@IsEnum(PAYMENT_GATEWAYS)
|
|
81
|
-
|
|
82
|
-
gateway: PaymentGatewayDto;
|
|
83
|
+
gateway?: PaymentGatewayDto;
|
|
83
84
|
|
|
84
85
|
@ApiProperty({
|
|
85
86
|
description: 'Payment method',
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
export * from './payment-gateway.enums';
|
|
2
|
+
export * from './payment-gateway-routing-matrix';
|
|
3
|
+
export * from './payment-gateway-routing.dto';
|
|
4
|
+
export * from './initiate-billing-payment-response.dto';
|
|
5
|
+
export * from './initiate-billing-payment.mapper';
|
|
6
|
+
export * from './platform-configuration.topics';
|
|
2
7
|
export * from './create-gateway-payment.dto';
|
|
3
8
|
export * from './update-gateway-payment.dto';
|
|
4
9
|
export * from './gateway-payment-response.dto';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
+
import { GatewayPaymentResponseDto } from './gateway-payment-response.dto';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Resposta de iniciar pagamento de cobrança: inclui o registro do pagamento e
|
|
6
|
+
* campos explícitos copiados de metadata quando presentes (PIX, checkout, boleto).
|
|
7
|
+
*/
|
|
8
|
+
export class InitiateBillingPaymentResponseDto extends GatewayPaymentResponseDto {
|
|
9
|
+
@ApiPropertyOptional({
|
|
10
|
+
description: 'URL para fluxo de pagamento (cartão, checkout hospedado, etc.)',
|
|
11
|
+
})
|
|
12
|
+
checkoutUrl?: string | null;
|
|
13
|
+
|
|
14
|
+
@ApiPropertyOptional({ description: 'QR Code PIX em base64 quando aplicável' })
|
|
15
|
+
pixQrCode?: string | null;
|
|
16
|
+
|
|
17
|
+
@ApiPropertyOptional({ description: 'PIX copia e cola quando aplicável' })
|
|
18
|
+
pixCopyPaste?: string | null;
|
|
19
|
+
|
|
20
|
+
@ApiPropertyOptional({ description: 'URL do boleto quando aplicável' })
|
|
21
|
+
boletoUrl?: string | null;
|
|
22
|
+
|
|
23
|
+
@ApiPropertyOptional({ description: 'Código de barras do boleto quando aplicável' })
|
|
24
|
+
boletoBarcode?: string | null;
|
|
25
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { GatewayPaymentResponseDto } from './gateway-payment-response.dto';
|
|
2
|
+
import { InitiateBillingPaymentResponseDto } from './initiate-billing-payment-response.dto';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Copia campos conhecidos de `metadata` para a resposta explícita de checkout/PIX/boleto.
|
|
6
|
+
*/
|
|
7
|
+
export function toInitiateBillingPaymentResponseDto(
|
|
8
|
+
payment: GatewayPaymentResponseDto,
|
|
9
|
+
): InitiateBillingPaymentResponseDto {
|
|
10
|
+
const meta = (payment.metadata ?? {}) as Record<string, unknown>;
|
|
11
|
+
return {
|
|
12
|
+
...payment,
|
|
13
|
+
checkoutUrl: (meta.paymentUrl as string | undefined) ?? undefined,
|
|
14
|
+
pixQrCode: (meta.pixQrCode as string | undefined) ?? undefined,
|
|
15
|
+
pixCopyPaste: (meta.pixCopyPaste as string | undefined) ?? undefined,
|
|
16
|
+
boletoUrl: (meta.boletoUrl as string | undefined) ?? undefined,
|
|
17
|
+
boletoBarcode: (meta.boletoBarcode as string | undefined) ?? undefined,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { GatewayPaymentMethodDto, PaymentGatewayDto } from './payment-gateway.enums';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Matriz fixa gateway × meio (alinhada ao README do payment-gateway-service).
|
|
5
|
+
* Usada para validar configuração persistida e para checagens determinísticas.
|
|
6
|
+
*/
|
|
7
|
+
const SUPPORTED: Record<PaymentGatewayDto, ReadonlySet<GatewayPaymentMethodDto>> = {
|
|
8
|
+
ASAAS: new Set(['PIX', 'CREDIT_CARD', 'DEBIT_CARD', 'BOLETO']),
|
|
9
|
+
MERCADO_PAGO: new Set(['PIX', 'CREDIT_CARD', 'DEBIT_CARD']),
|
|
10
|
+
STRIPE: new Set(['CREDIT_CARD', 'DEBIT_CARD']),
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export function isMethodSupportedByGateway(
|
|
14
|
+
gateway: PaymentGatewayDto,
|
|
15
|
+
method: GatewayPaymentMethodDto,
|
|
16
|
+
): boolean {
|
|
17
|
+
return SUPPORTED[gateway]?.has(method) ?? false;
|
|
18
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { ApiProperty } from '@nestjs/swagger';
|
|
2
|
+
import { Type } from 'class-transformer';
|
|
3
|
+
import {
|
|
4
|
+
ArrayMinSize,
|
|
5
|
+
IsArray,
|
|
6
|
+
IsEnum,
|
|
7
|
+
Validate,
|
|
8
|
+
ValidateNested,
|
|
9
|
+
ValidationArguments,
|
|
10
|
+
ValidatorConstraint,
|
|
11
|
+
ValidatorConstraintInterface,
|
|
12
|
+
} from 'class-validator';
|
|
13
|
+
import {
|
|
14
|
+
GATEWAY_PAYMENT_METHODS,
|
|
15
|
+
type GatewayPaymentMethodDto,
|
|
16
|
+
PAYMENT_GATEWAYS,
|
|
17
|
+
type PaymentGatewayDto,
|
|
18
|
+
} from './payment-gateway.enums';
|
|
19
|
+
import { isMethodSupportedByGateway } from './payment-gateway-routing-matrix';
|
|
20
|
+
|
|
21
|
+
@ValidatorConstraint({ name: 'paymentGatewayRoutingEntriesValid', async: false })
|
|
22
|
+
export class PaymentGatewayRoutingEntriesConstraint implements ValidatorConstraintInterface {
|
|
23
|
+
validate(entries: unknown, _args: ValidationArguments): boolean {
|
|
24
|
+
if (!Array.isArray(entries) || entries.length < 1) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
const seenGateways = new Set<string>();
|
|
28
|
+
for (const raw of entries) {
|
|
29
|
+
if (!raw || typeof raw !== 'object') {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
const e = raw as { gateway?: unknown; methods?: unknown };
|
|
33
|
+
if (typeof e.gateway !== 'string' || !PAYMENT_GATEWAYS.includes(e.gateway as PaymentGatewayDto)) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
const gateway = e.gateway as PaymentGatewayDto;
|
|
37
|
+
if (seenGateways.has(gateway)) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
seenGateways.add(gateway);
|
|
41
|
+
if (!Array.isArray(e.methods) || e.methods.length < 1) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
for (const m of e.methods) {
|
|
45
|
+
if (typeof m !== 'string' || !GATEWAY_PAYMENT_METHODS.includes(m as GatewayPaymentMethodDto)) {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
if (!isMethodSupportedByGateway(gateway, m as GatewayPaymentMethodDto)) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
defaultMessage(): string {
|
|
57
|
+
return (
|
|
58
|
+
'paymentGatewayRouting.entries inválido: ordem vazia, gateway duplicado, methods vazio ' +
|
|
59
|
+
'ou combinação gateway/método não suportada pela plataforma'
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export class PaymentGatewayRoutingEntryDto {
|
|
65
|
+
@ApiProperty({ enum: PAYMENT_GATEWAYS })
|
|
66
|
+
@IsEnum(PAYMENT_GATEWAYS as unknown as object)
|
|
67
|
+
gateway: PaymentGatewayDto;
|
|
68
|
+
|
|
69
|
+
@ApiProperty({ enum: GATEWAY_PAYMENT_METHODS, isArray: true })
|
|
70
|
+
@IsArray()
|
|
71
|
+
@ArrayMinSize(1)
|
|
72
|
+
@IsEnum(GATEWAY_PAYMENT_METHODS as unknown as object, { each: true })
|
|
73
|
+
methods: GatewayPaymentMethodDto[];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export class PaymentGatewayRoutingDto {
|
|
77
|
+
@ApiProperty({ type: [PaymentGatewayRoutingEntryDto] })
|
|
78
|
+
@IsArray()
|
|
79
|
+
@ArrayMinSize(1)
|
|
80
|
+
@ValidateNested({ each: true })
|
|
81
|
+
@Type(() => PaymentGatewayRoutingEntryDto)
|
|
82
|
+
@Validate(PaymentGatewayRoutingEntriesConstraint)
|
|
83
|
+
entries: PaymentGatewayRoutingEntryDto[];
|
|
84
|
+
}
|