tychat-contracts 1.6.21 → 1.6.23

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.
Files changed (118) hide show
  1. package/README.md +33 -33
  2. package/dist/storage/delete-object-rpc.dto.d.ts +9 -0
  3. package/dist/storage/delete-object-rpc.dto.d.ts.map +1 -0
  4. package/dist/storage/delete-object-rpc.dto.js +48 -0
  5. package/dist/storage/index.d.ts +1 -0
  6. package/dist/storage/index.d.ts.map +1 -1
  7. package/dist/storage/index.js +1 -0
  8. package/dist/storage/storage-rmq-patterns.d.ts +2 -0
  9. package/dist/storage/storage-rmq-patterns.d.ts.map +1 -1
  10. package/dist/storage/storage-rmq-patterns.js +3 -1
  11. package/jest.config.ts +5 -5
  12. package/package.json +2 -1
  13. package/src/ai/ai-usage-response.dto.ts +47 -47
  14. package/src/ai/create-ai-usage.dto.ts +43 -43
  15. package/src/analytics/analytics-emitter.helper.ts +54 -54
  16. package/src/analytics/analytics-query.dto.ts +222 -222
  17. package/src/analytics/create-analytic-event.dto.ts +85 -85
  18. package/src/analytics/event-analytic.enum.ts +119 -119
  19. package/src/appointments/appointment-procedure.dto.ts +76 -76
  20. package/src/appointments/create-appointment.dto.ts +153 -153
  21. package/src/appointments/index.ts +10 -10
  22. package/src/appointments/list-appointments-query.dto.ts +157 -157
  23. package/src/appointments/update-appointment-procedure.dto.ts +10 -10
  24. package/src/appointments/update-appointment.dto.ts +4 -4
  25. package/src/auth/refresh-token.dto.ts +10 -10
  26. package/src/billing/billing-response.dto.ts +68 -68
  27. package/src/billing/create-billing.dto.ts +70 -70
  28. package/src/billing/index.ts +6 -6
  29. package/src/billing/list-billings-query.dto.ts +61 -61
  30. package/src/billing/update-billing.dto.ts +4 -4
  31. package/src/cashback/cashback-balance-response.dto.ts +33 -33
  32. package/src/cashback/cashback-config-response.dto.ts +43 -43
  33. package/src/cashback/cashback-enums.ts +33 -33
  34. package/src/cashback/cashback-kafka-payloads.ts +102 -102
  35. package/src/cashback/cashback-kafka-topics.ts +23 -23
  36. package/src/cashback/index.ts +7 -7
  37. package/src/cashback/referral-code-response.dto.ts +49 -49
  38. package/src/cashback/use-referral-code-response.dto.ts +15 -15
  39. package/src/configurations/clinic-configuration.dto.ts +39 -39
  40. package/src/configurations/opening-hours-slot.dto.ts +41 -41
  41. package/src/configurations/update-clinic-configuration.dto.ts +39 -39
  42. package/src/connections/whatsapp-official.dto.ts +113 -113
  43. package/src/conversations/conversation-contact-filters-query.validator.spec.ts +221 -221
  44. package/src/conversations/conversation-contact-filters-query.validator.ts +10 -10
  45. package/src/conversations/conversation-intention.dto.ts +24 -24
  46. package/src/conversations/conversation-response.dto.ts +69 -69
  47. package/src/conversations/conversation-session-response.dto.ts +65 -65
  48. package/src/conversations/conversation-type.dto.ts +15 -15
  49. package/src/conversations/create-conversation-session.dto.ts +28 -28
  50. package/src/conversations/create-conversation.dto.ts +69 -69
  51. package/src/conversations/followup-config-response.dto.ts +290 -290
  52. package/src/conversations/followup-log-response.dto.ts +58 -58
  53. package/src/conversations/followup-type.dto.ts +22 -22
  54. package/src/conversations/index.ts +17 -17
  55. package/src/conversations/list-conversation-contacts-filters.dto.ts +15 -15
  56. package/src/conversations/list-conversation-contacts-query.dto.ts +81 -81
  57. package/src/conversations/satisfaction-response.dto.ts +116 -116
  58. package/src/filters/index.ts +1 -1
  59. package/src/filters/parsed-filter.dto.ts +41 -41
  60. package/src/index.ts +23 -23
  61. package/src/patients/create-patient.dto.ts +122 -122
  62. package/src/patients/index.ts +10 -10
  63. package/src/patients/list-patients-filters.dto.ts +15 -15
  64. package/src/patients/list-patients-query.dto.ts +61 -61
  65. package/src/patients/patient-document-response.dto.ts +33 -33
  66. package/src/patients/patient-history-entry.dto.ts +22 -22
  67. package/src/patients/patient-status.dto.ts +9 -9
  68. package/src/patients/update-patient-document.dto.ts +10 -10
  69. package/src/patients/update-patient.dto.ts +15 -15
  70. package/src/payment-gateway/create-gateway-payment.dto.ts +123 -123
  71. package/src/payment-gateway/gateway-payment-response.dto.ts +65 -65
  72. package/src/payment-gateway/index.ts +12 -12
  73. package/src/payment-gateway/list-gateway-payments-query.dto.ts +63 -63
  74. package/src/payment-gateway/payment-gateway-kafka-topics.ts +25 -25
  75. package/src/payment-gateway/payment-gateway.enums.ts +34 -34
  76. package/src/payment-gateway/update-gateway-payment.dto.ts +7 -7
  77. package/src/payment-gateway/webhook-payload.dto.ts +32 -32
  78. package/src/payments/create-payment.dto.ts +73 -73
  79. package/src/payments/index.ts +6 -6
  80. package/src/payments/list-payments-query.dto.ts +44 -44
  81. package/src/payments/payment-response.dto.ts +67 -67
  82. package/src/payments/update-payment.dto.ts +4 -4
  83. package/src/procedures/create-procedure.dto.ts +104 -104
  84. package/src/procedures/index.ts +6 -6
  85. package/src/procedures/list-procedures-query.dto.ts +59 -59
  86. package/src/procedures/update-procedure.dto.ts +4 -4
  87. package/src/storage/delete-object-rpc.dto.ts +28 -0
  88. package/src/storage/index.ts +1 -0
  89. package/src/storage/storage-rmq-patterns.ts +3 -0
  90. package/src/tenants/index.ts +10 -10
  91. package/src/tenants/whatsapp-provider-kind.dto.ts +12 -12
  92. package/dist/analytics/should-skip-analytics-tenant-lookup.d.ts +0 -7
  93. package/dist/analytics/should-skip-analytics-tenant-lookup.d.ts.map +0 -1
  94. package/dist/analytics/should-skip-analytics-tenant-lookup.js +0 -13
  95. package/dist/appointments/opening-hours-slot.dto.d.ts +0 -6
  96. package/dist/appointments/opening-hours-slot.dto.d.ts.map +0 -1
  97. package/dist/appointments/opening-hours-slot.dto.js +0 -2
  98. package/dist/patients/patient-procedure.dto.d.ts +0 -9
  99. package/dist/patients/patient-procedure.dto.d.ts.map +0 -1
  100. package/dist/patients/patient-procedure.dto.js +0 -79
  101. package/dist/patients/update-patient-procedure.dto.d.ts +0 -6
  102. package/dist/patients/update-patient-procedure.dto.d.ts.map +0 -1
  103. package/dist/patients/update-patient-procedure.dto.js +0 -8
  104. package/dist/payments/payment.dto.d.ts +0 -15
  105. package/dist/payments/payment.dto.d.ts.map +0 -1
  106. package/dist/payments/payment.dto.js +0 -2
  107. package/dist/tenants/create-tenant.dto.d.ts +0 -10
  108. package/dist/tenants/create-tenant.dto.d.ts.map +0 -1
  109. package/dist/tenants/create-tenant.dto.js +0 -73
  110. package/dist/tenants/tenant-slug.util.spec.d.ts +0 -2
  111. package/dist/tenants/tenant-slug.util.spec.d.ts.map +0 -1
  112. package/dist/tenants/tenant-slug.util.spec.js +0 -102
  113. package/dist/tenants/update-tenant-payload.dto.d.ts +0 -6
  114. package/dist/tenants/update-tenant-payload.dto.d.ts.map +0 -1
  115. package/dist/tenants/update-tenant-payload.dto.js +0 -25
  116. package/dist/tenants/update-tenant.dto.d.ts +0 -10
  117. package/dist/tenants/update-tenant.dto.d.ts.map +0 -1
  118. package/dist/tenants/update-tenant.dto.js +0 -78
@@ -1,9 +1,9 @@
1
- /**
2
- * Allowed patient engagement statuses.
3
- * - "active" → patient is actively engaged in conversations.
4
- * - "inactive" → patient stopped responding after all follow-up attempts.
5
- * Reactivated automatically when the patient sends a new message.
6
- */
7
- export const PATIENT_STATUSES = ['active', 'inactive'] as const;
8
-
9
- export type PatientStatusDto = (typeof PATIENT_STATUSES)[number];
1
+ /**
2
+ * Allowed patient engagement statuses.
3
+ * - "active" → patient is actively engaged in conversations.
4
+ * - "inactive" → patient stopped responding after all follow-up attempts.
5
+ * Reactivated automatically when the patient sends a new message.
6
+ */
7
+ export const PATIENT_STATUSES = ['active', 'inactive'] as const;
8
+
9
+ export type PatientStatusDto = (typeof PATIENT_STATUSES)[number];
@@ -1,10 +1,10 @@
1
- import { ApiProperty } from '@nestjs/swagger';
2
- import { IsNotEmpty, IsString, MaxLength } from 'class-validator';
3
-
4
- export class UpdatePatientDocumentDto {
5
- @ApiProperty({ description: 'Nome exibido do documento', maxLength: 512 })
6
- @IsString()
7
- @IsNotEmpty()
8
- @MaxLength(512)
9
- displayName: string;
10
- }
1
+ import { ApiProperty } from '@nestjs/swagger';
2
+ import { IsNotEmpty, IsString, MaxLength } from 'class-validator';
3
+
4
+ export class UpdatePatientDocumentDto {
5
+ @ApiProperty({ description: 'Nome exibido do documento', maxLength: 512 })
6
+ @IsString()
7
+ @IsNotEmpty()
8
+ @MaxLength(512)
9
+ displayName: string;
10
+ }
@@ -1,15 +1,15 @@
1
- import { ApiPropertyOptional, PartialType } from '@nestjs/swagger';
2
- import { IsIn, IsOptional } from 'class-validator';
3
- import { CreatePatientDto } from './create-patient.dto';
4
- import { PATIENT_STATUSES, type PatientStatusDto } from './patient-status.dto';
5
-
6
- export class UpdatePatientDto extends PartialType(CreatePatientDto) {
7
- @ApiPropertyOptional({
8
- description: 'Status de engajamento do paciente (active | inactive)',
9
- enum: PATIENT_STATUSES,
10
- })
11
- @IsOptional()
12
- @IsIn([...PATIENT_STATUSES])
13
- status?: PatientStatusDto;
14
- }
15
-
1
+ import { ApiPropertyOptional, PartialType } from '@nestjs/swagger';
2
+ import { IsIn, IsOptional } from 'class-validator';
3
+ import { CreatePatientDto } from './create-patient.dto';
4
+ import { PATIENT_STATUSES, type PatientStatusDto } from './patient-status.dto';
5
+
6
+ export class UpdatePatientDto extends PartialType(CreatePatientDto) {
7
+ @ApiPropertyOptional({
8
+ description: 'Status de engajamento do paciente (active | inactive)',
9
+ enum: PATIENT_STATUSES,
10
+ })
11
+ @IsOptional()
12
+ @IsIn([...PATIENT_STATUSES])
13
+ status?: PatientStatusDto;
14
+ }
15
+
@@ -1,123 +1,123 @@
1
- import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
2
- import {
3
- IsDateString,
4
- IsEnum,
5
- IsNotEmpty,
6
- IsNumber,
7
- IsOptional,
8
- IsString,
9
- IsUUID,
10
- Min,
11
- ValidateNested,
12
- } from 'class-validator';
13
- import { Type } from 'class-transformer';
14
- import {
15
- PAYMENT_GATEWAYS,
16
- PaymentGatewayDto,
17
- GATEWAY_PAYMENT_METHODS,
18
- GatewayPaymentMethodDto,
19
- } from './payment-gateway.enums';
20
-
21
- /**
22
- * Optional customer data for gateway registration.
23
- */
24
- export class GatewayCustomerDto {
25
- @ApiProperty({ description: 'Customer name', example: 'John Doe' })
26
- @IsString()
27
- @IsNotEmpty()
28
- name: string;
29
-
30
- @ApiProperty({ description: 'Customer email', example: 'john@example.com' })
31
- @IsString()
32
- @IsNotEmpty()
33
- email: string;
34
-
35
- @ApiPropertyOptional({ description: 'Customer CPF/CNPJ', example: '12345678900' })
36
- @IsOptional()
37
- @IsString()
38
- cpfCnpj?: string;
39
-
40
- @ApiPropertyOptional({ description: 'Customer phone', example: '+5511999999999' })
41
- @IsOptional()
42
- @IsString()
43
- phone?: string;
44
- }
45
-
46
- /**
47
- * DTO for creating a payment through the payment gateway service.
48
- */
49
- export class CreateGatewayPaymentDto {
50
- @ApiProperty({
51
- description: 'Tenant ID (UUID)',
52
- example: '550e8400-e29b-41d4-a716-446655440000',
53
- })
54
- @IsUUID('4')
55
- @IsNotEmpty()
56
- tenantId: string;
57
-
58
- @ApiProperty({
59
- description: 'Billing ID from billing service (UUID)',
60
- example: '550e8400-e29b-41d4-a716-446655440001',
61
- })
62
- @IsUUID('4')
63
- @IsNotEmpty()
64
- billingId: string;
65
-
66
- @ApiProperty({
67
- description: 'Payment amount',
68
- example: 99.90,
69
- minimum: 0.01,
70
- })
71
- @IsNumber()
72
- @Min(0.01)
73
- amount: number;
74
-
75
- @ApiPropertyOptional({
76
- description:
77
- 'Gateway explícito. Se omitido, o payment-gateway-service resolve pela rota global (prioridade + métodos).',
78
- enum: PAYMENT_GATEWAYS,
79
- example: 'ASAAS',
80
- })
81
- @IsOptional()
82
- @IsEnum(PAYMENT_GATEWAYS)
83
- gateway?: PaymentGatewayDto;
84
-
85
- @ApiProperty({
86
- description: 'Payment method',
87
- enum: GATEWAY_PAYMENT_METHODS,
88
- example: 'PIX',
89
- })
90
- @IsEnum(GATEWAY_PAYMENT_METHODS)
91
- @IsNotEmpty()
92
- method: GatewayPaymentMethodDto;
93
-
94
- @ApiProperty({
95
- description: 'Due date (ISO 8601)',
96
- example: '2026-04-15T00:00:00.000Z',
97
- })
98
- @IsDateString()
99
- dueDate: string;
100
-
101
- @ApiPropertyOptional({
102
- description: 'Description of the payment',
103
- example: 'Monthly subscription - April 2026',
104
- })
105
- @IsOptional()
106
- @IsString()
107
- description?: string;
108
-
109
- @ApiPropertyOptional({
110
- description: 'Customer data for gateway registration',
111
- })
112
- @IsOptional()
113
- @ValidateNested()
114
- @Type(() => GatewayCustomerDto)
115
- customer?: GatewayCustomerDto;
116
-
117
- @ApiPropertyOptional({
118
- description: 'Additional metadata as JSON',
119
- example: { invoiceNumber: 'INV-001' },
120
- })
121
- @IsOptional()
122
- metadata?: Record<string, unknown>;
123
- }
1
+ import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
2
+ import {
3
+ IsDateString,
4
+ IsEnum,
5
+ IsNotEmpty,
6
+ IsNumber,
7
+ IsOptional,
8
+ IsString,
9
+ IsUUID,
10
+ Min,
11
+ ValidateNested,
12
+ } from 'class-validator';
13
+ import { Type } from 'class-transformer';
14
+ import {
15
+ PAYMENT_GATEWAYS,
16
+ PaymentGatewayDto,
17
+ GATEWAY_PAYMENT_METHODS,
18
+ GatewayPaymentMethodDto,
19
+ } from './payment-gateway.enums';
20
+
21
+ /**
22
+ * Optional customer data for gateway registration.
23
+ */
24
+ export class GatewayCustomerDto {
25
+ @ApiProperty({ description: 'Customer name', example: 'John Doe' })
26
+ @IsString()
27
+ @IsNotEmpty()
28
+ name: string;
29
+
30
+ @ApiProperty({ description: 'Customer email', example: 'john@example.com' })
31
+ @IsString()
32
+ @IsNotEmpty()
33
+ email: string;
34
+
35
+ @ApiPropertyOptional({ description: 'Customer CPF/CNPJ', example: '12345678900' })
36
+ @IsOptional()
37
+ @IsString()
38
+ cpfCnpj?: string;
39
+
40
+ @ApiPropertyOptional({ description: 'Customer phone', example: '+5511999999999' })
41
+ @IsOptional()
42
+ @IsString()
43
+ phone?: string;
44
+ }
45
+
46
+ /**
47
+ * DTO for creating a payment through the payment gateway service.
48
+ */
49
+ export class CreateGatewayPaymentDto {
50
+ @ApiProperty({
51
+ description: 'Tenant ID (UUID)',
52
+ example: '550e8400-e29b-41d4-a716-446655440000',
53
+ })
54
+ @IsUUID('4')
55
+ @IsNotEmpty()
56
+ tenantId: string;
57
+
58
+ @ApiProperty({
59
+ description: 'Billing ID from billing service (UUID)',
60
+ example: '550e8400-e29b-41d4-a716-446655440001',
61
+ })
62
+ @IsUUID('4')
63
+ @IsNotEmpty()
64
+ billingId: string;
65
+
66
+ @ApiProperty({
67
+ description: 'Payment amount',
68
+ example: 99.90,
69
+ minimum: 0.01,
70
+ })
71
+ @IsNumber()
72
+ @Min(0.01)
73
+ amount: number;
74
+
75
+ @ApiPropertyOptional({
76
+ description:
77
+ 'Gateway explícito. Se omitido, o payment-gateway-service resolve pela rota global (prioridade + métodos).',
78
+ enum: PAYMENT_GATEWAYS,
79
+ example: 'ASAAS',
80
+ })
81
+ @IsOptional()
82
+ @IsEnum(PAYMENT_GATEWAYS)
83
+ gateway?: PaymentGatewayDto;
84
+
85
+ @ApiProperty({
86
+ description: 'Payment method',
87
+ enum: GATEWAY_PAYMENT_METHODS,
88
+ example: 'PIX',
89
+ })
90
+ @IsEnum(GATEWAY_PAYMENT_METHODS)
91
+ @IsNotEmpty()
92
+ method: GatewayPaymentMethodDto;
93
+
94
+ @ApiProperty({
95
+ description: 'Due date (ISO 8601)',
96
+ example: '2026-04-15T00:00:00.000Z',
97
+ })
98
+ @IsDateString()
99
+ dueDate: string;
100
+
101
+ @ApiPropertyOptional({
102
+ description: 'Description of the payment',
103
+ example: 'Monthly subscription - April 2026',
104
+ })
105
+ @IsOptional()
106
+ @IsString()
107
+ description?: string;
108
+
109
+ @ApiPropertyOptional({
110
+ description: 'Customer data for gateway registration',
111
+ })
112
+ @IsOptional()
113
+ @ValidateNested()
114
+ @Type(() => GatewayCustomerDto)
115
+ customer?: GatewayCustomerDto;
116
+
117
+ @ApiPropertyOptional({
118
+ description: 'Additional metadata as JSON',
119
+ example: { invoiceNumber: 'INV-001' },
120
+ })
121
+ @IsOptional()
122
+ metadata?: Record<string, unknown>;
123
+ }
@@ -1,65 +1,65 @@
1
- import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
2
- import {
3
- PAYMENT_GATEWAYS,
4
- PaymentGatewayDto,
5
- GATEWAY_PAYMENT_METHODS,
6
- GatewayPaymentMethodDto,
7
- GATEWAY_PAYMENT_STATUSES,
8
- GatewayPaymentStatusDto,
9
- } from './payment-gateway.enums';
10
-
11
- /**
12
- * Response DTO for a gateway payment record.
13
- */
14
- export class GatewayPaymentResponseDto {
15
- @ApiProperty({ description: 'Payment ID (UUID)', example: '550e8400-e29b-41d4-a716-446655440111' })
16
- id: string;
17
-
18
- @ApiProperty({ description: 'Tenant ID (UUID)', example: '550e8400-e29b-41d4-a716-446655440000' })
19
- tenantId: string;
20
-
21
- @ApiProperty({ description: 'Billing ID (UUID)', example: '550e8400-e29b-41d4-a716-446655440001' })
22
- billingId: string;
23
-
24
- @ApiProperty({ description: 'Payment amount', example: 99.90 })
25
- amount: number;
26
-
27
- @ApiProperty({ description: 'Payment gateway', enum: PAYMENT_GATEWAYS, example: 'ASAAS' })
28
- gateway: PaymentGatewayDto;
29
-
30
- @ApiProperty({ description: 'Payment method', enum: GATEWAY_PAYMENT_METHODS, example: 'PIX' })
31
- method: GatewayPaymentMethodDto;
32
-
33
- @ApiProperty({ description: 'Payment status', enum: GATEWAY_PAYMENT_STATUSES, example: 'PENDING' })
34
- status: GatewayPaymentStatusDto;
35
-
36
- @ApiPropertyOptional({ description: 'External ID from the gateway', example: 'pay_abc123' })
37
- externalId?: string | null;
38
-
39
- @ApiPropertyOptional({ description: 'Error message if payment failed', example: null })
40
- errorMessage?: string | null;
41
-
42
- @ApiPropertyOptional({ description: 'Additional metadata', example: {} })
43
- metadata?: Record<string, unknown> | null;
44
-
45
- @ApiProperty({ description: 'Due date (ISO 8601)', example: '2026-04-15T00:00:00.000Z' })
46
- dueDate: string;
47
-
48
- @ApiPropertyOptional({ description: 'Date when payment was confirmed (ISO 8601)', example: null })
49
- paidAt?: string | null;
50
-
51
- @ApiPropertyOptional({ description: 'Payment expiration date (ISO 8601)', example: null })
52
- expiresAt?: string | null;
53
-
54
- @ApiPropertyOptional({ description: 'Refund amount if partially/fully refunded', example: null })
55
- refundAmount?: number | null;
56
-
57
- @ApiProperty({ description: 'Creation timestamp (ISO 8601)', example: '2026-03-14T12:00:00.000Z' })
58
- createdAt: string;
59
-
60
- @ApiProperty({ description: 'Last update timestamp (ISO 8601)', example: '2026-03-14T12:00:00.000Z' })
61
- updatedAt: string;
62
-
63
- @ApiPropertyOptional({ description: 'Soft deletion timestamp (ISO 8601)', example: null })
64
- deletedAt?: string | null;
65
- }
1
+ import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
2
+ import {
3
+ PAYMENT_GATEWAYS,
4
+ PaymentGatewayDto,
5
+ GATEWAY_PAYMENT_METHODS,
6
+ GatewayPaymentMethodDto,
7
+ GATEWAY_PAYMENT_STATUSES,
8
+ GatewayPaymentStatusDto,
9
+ } from './payment-gateway.enums';
10
+
11
+ /**
12
+ * Response DTO for a gateway payment record.
13
+ */
14
+ export class GatewayPaymentResponseDto {
15
+ @ApiProperty({ description: 'Payment ID (UUID)', example: '550e8400-e29b-41d4-a716-446655440111' })
16
+ id: string;
17
+
18
+ @ApiProperty({ description: 'Tenant ID (UUID)', example: '550e8400-e29b-41d4-a716-446655440000' })
19
+ tenantId: string;
20
+
21
+ @ApiProperty({ description: 'Billing ID (UUID)', example: '550e8400-e29b-41d4-a716-446655440001' })
22
+ billingId: string;
23
+
24
+ @ApiProperty({ description: 'Payment amount', example: 99.90 })
25
+ amount: number;
26
+
27
+ @ApiProperty({ description: 'Payment gateway', enum: PAYMENT_GATEWAYS, example: 'ASAAS' })
28
+ gateway: PaymentGatewayDto;
29
+
30
+ @ApiProperty({ description: 'Payment method', enum: GATEWAY_PAYMENT_METHODS, example: 'PIX' })
31
+ method: GatewayPaymentMethodDto;
32
+
33
+ @ApiProperty({ description: 'Payment status', enum: GATEWAY_PAYMENT_STATUSES, example: 'PENDING' })
34
+ status: GatewayPaymentStatusDto;
35
+
36
+ @ApiPropertyOptional({ description: 'External ID from the gateway', example: 'pay_abc123' })
37
+ externalId?: string | null;
38
+
39
+ @ApiPropertyOptional({ description: 'Error message if payment failed', example: null })
40
+ errorMessage?: string | null;
41
+
42
+ @ApiPropertyOptional({ description: 'Additional metadata', example: {} })
43
+ metadata?: Record<string, unknown> | null;
44
+
45
+ @ApiProperty({ description: 'Due date (ISO 8601)', example: '2026-04-15T00:00:00.000Z' })
46
+ dueDate: string;
47
+
48
+ @ApiPropertyOptional({ description: 'Date when payment was confirmed (ISO 8601)', example: null })
49
+ paidAt?: string | null;
50
+
51
+ @ApiPropertyOptional({ description: 'Payment expiration date (ISO 8601)', example: null })
52
+ expiresAt?: string | null;
53
+
54
+ @ApiPropertyOptional({ description: 'Refund amount if partially/fully refunded', example: null })
55
+ refundAmount?: number | null;
56
+
57
+ @ApiProperty({ description: 'Creation timestamp (ISO 8601)', example: '2026-03-14T12:00:00.000Z' })
58
+ createdAt: string;
59
+
60
+ @ApiProperty({ description: 'Last update timestamp (ISO 8601)', example: '2026-03-14T12:00:00.000Z' })
61
+ updatedAt: string;
62
+
63
+ @ApiPropertyOptional({ description: 'Soft deletion timestamp (ISO 8601)', example: null })
64
+ deletedAt?: string | null;
65
+ }
@@ -1,12 +1,12 @@
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';
7
- export * from './create-gateway-payment.dto';
8
- export * from './update-gateway-payment.dto';
9
- export * from './gateway-payment-response.dto';
10
- export * from './list-gateway-payments-query.dto';
11
- export * from './payment-gateway-kafka-topics';
12
- export * from './webhook-payload.dto';
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';
7
+ export * from './create-gateway-payment.dto';
8
+ export * from './update-gateway-payment.dto';
9
+ export * from './gateway-payment-response.dto';
10
+ export * from './list-gateway-payments-query.dto';
11
+ export * from './payment-gateway-kafka-topics';
12
+ export * from './webhook-payload.dto';
@@ -1,63 +1,63 @@
1
- import { ApiPropertyOptional } from '@nestjs/swagger';
2
- import { ArrayMaxSize, IsArray, IsEnum, IsInt, IsOptional, IsUUID, Max, Min } from 'class-validator';
3
- import {
4
- PAYMENT_GATEWAYS,
5
- PaymentGatewayDto,
6
- GATEWAY_PAYMENT_METHODS,
7
- GatewayPaymentMethodDto,
8
- GATEWAY_PAYMENT_STATUSES,
9
- GatewayPaymentStatusDto,
10
- } from './payment-gateway.enums';
11
-
12
- /**
13
- * Query DTO for listing gateway payments with optional filters and pagination.
14
- */
15
- export class ListGatewayPaymentsQueryDto {
16
- @ApiPropertyOptional({ description: 'Tenant ID filter (UUID)', example: '550e8400-e29b-41d4-a716-446655440000' })
17
- @IsOptional()
18
- @IsUUID('4')
19
- tenantId?: string;
20
-
21
- @ApiPropertyOptional({ description: 'Billing ID filter (UUID)' })
22
- @IsOptional()
23
- @IsUUID('4')
24
- billingId?: string;
25
-
26
- @ApiPropertyOptional({
27
- description: 'Filtra por várias faturas (UUID). Ignorado se `billingId` estiver definido.',
28
- type: [String],
29
- })
30
- @IsOptional()
31
- @IsArray()
32
- @ArrayMaxSize(200)
33
- @IsUUID('4', { each: true })
34
- billingIds?: string[];
35
-
36
- @ApiPropertyOptional({ description: 'Gateway filter', enum: PAYMENT_GATEWAYS })
37
- @IsOptional()
38
- @IsEnum(PAYMENT_GATEWAYS)
39
- gateway?: PaymentGatewayDto;
40
-
41
- @ApiPropertyOptional({ description: 'Method filter', enum: GATEWAY_PAYMENT_METHODS })
42
- @IsOptional()
43
- @IsEnum(GATEWAY_PAYMENT_METHODS)
44
- method?: GatewayPaymentMethodDto;
45
-
46
- @ApiPropertyOptional({ description: 'Status filter', enum: GATEWAY_PAYMENT_STATUSES })
47
- @IsOptional()
48
- @IsEnum(GATEWAY_PAYMENT_STATUSES)
49
- status?: GatewayPaymentStatusDto;
50
-
51
- @ApiPropertyOptional({ description: 'Page number (starting at 1)', example: 1, minimum: 1, default: 1 })
52
- @IsOptional()
53
- @IsInt()
54
- @Min(1)
55
- page?: number;
56
-
57
- @ApiPropertyOptional({ description: 'Records per page', example: 20, minimum: 1, maximum: 500, default: 20 })
58
- @IsOptional()
59
- @IsInt()
60
- @Min(1)
61
- @Max(500)
62
- limit?: number;
63
- }
1
+ import { ApiPropertyOptional } from '@nestjs/swagger';
2
+ import { ArrayMaxSize, IsArray, IsEnum, IsInt, IsOptional, IsUUID, Max, Min } from 'class-validator';
3
+ import {
4
+ PAYMENT_GATEWAYS,
5
+ PaymentGatewayDto,
6
+ GATEWAY_PAYMENT_METHODS,
7
+ GatewayPaymentMethodDto,
8
+ GATEWAY_PAYMENT_STATUSES,
9
+ GatewayPaymentStatusDto,
10
+ } from './payment-gateway.enums';
11
+
12
+ /**
13
+ * Query DTO for listing gateway payments with optional filters and pagination.
14
+ */
15
+ export class ListGatewayPaymentsQueryDto {
16
+ @ApiPropertyOptional({ description: 'Tenant ID filter (UUID)', example: '550e8400-e29b-41d4-a716-446655440000' })
17
+ @IsOptional()
18
+ @IsUUID('4')
19
+ tenantId?: string;
20
+
21
+ @ApiPropertyOptional({ description: 'Billing ID filter (UUID)' })
22
+ @IsOptional()
23
+ @IsUUID('4')
24
+ billingId?: string;
25
+
26
+ @ApiPropertyOptional({
27
+ description: 'Filtra por várias faturas (UUID). Ignorado se `billingId` estiver definido.',
28
+ type: [String],
29
+ })
30
+ @IsOptional()
31
+ @IsArray()
32
+ @ArrayMaxSize(200)
33
+ @IsUUID('4', { each: true })
34
+ billingIds?: string[];
35
+
36
+ @ApiPropertyOptional({ description: 'Gateway filter', enum: PAYMENT_GATEWAYS })
37
+ @IsOptional()
38
+ @IsEnum(PAYMENT_GATEWAYS)
39
+ gateway?: PaymentGatewayDto;
40
+
41
+ @ApiPropertyOptional({ description: 'Method filter', enum: GATEWAY_PAYMENT_METHODS })
42
+ @IsOptional()
43
+ @IsEnum(GATEWAY_PAYMENT_METHODS)
44
+ method?: GatewayPaymentMethodDto;
45
+
46
+ @ApiPropertyOptional({ description: 'Status filter', enum: GATEWAY_PAYMENT_STATUSES })
47
+ @IsOptional()
48
+ @IsEnum(GATEWAY_PAYMENT_STATUSES)
49
+ status?: GatewayPaymentStatusDto;
50
+
51
+ @ApiPropertyOptional({ description: 'Page number (starting at 1)', example: 1, minimum: 1, default: 1 })
52
+ @IsOptional()
53
+ @IsInt()
54
+ @Min(1)
55
+ page?: number;
56
+
57
+ @ApiPropertyOptional({ description: 'Records per page', example: 20, minimum: 1, maximum: 500, default: 20 })
58
+ @IsOptional()
59
+ @IsInt()
60
+ @Min(1)
61
+ @Max(500)
62
+ limit?: number;
63
+ }
@@ -1,25 +1,25 @@
1
- /**
2
- * Kafka topic names used by the payment-gateway service.
3
- * Topics follow the pattern: payment.{action}
4
- */
5
-
6
- /** Topic for creating a new payment through a gateway. */
7
- export const TOPIC_PAYMENT_CREATE = 'payment.create';
8
-
9
- /** Topic for canceling an existing payment. */
10
- export const TOPIC_PAYMENT_CANCEL = 'payment.cancel';
11
-
12
- /** Topic for requesting a refund. */
13
- export const TOPIC_PAYMENT_REFUND = 'payment.refund';
14
-
15
- /** Topic for querying payment status. */
16
- export const TOPIC_PAYMENT_STATUS = 'payment.status';
17
-
18
- /** Topic for listing payments (RPC). */
19
- export const TOPIC_PAYMENT_FIND_ALL = 'payment.findAll';
20
-
21
- /** Topic for finding a single payment (RPC). */
22
- export const TOPIC_PAYMENT_FIND_ONE = 'payment.findOne';
23
-
24
- /** Topic for payment webhook events (internal broadcast). */
25
- export const TOPIC_PAYMENT_WEBHOOK = 'payment.webhook';
1
+ /**
2
+ * Kafka topic names used by the payment-gateway service.
3
+ * Topics follow the pattern: payment.{action}
4
+ */
5
+
6
+ /** Topic for creating a new payment through a gateway. */
7
+ export const TOPIC_PAYMENT_CREATE = 'payment.create';
8
+
9
+ /** Topic for canceling an existing payment. */
10
+ export const TOPIC_PAYMENT_CANCEL = 'payment.cancel';
11
+
12
+ /** Topic for requesting a refund. */
13
+ export const TOPIC_PAYMENT_REFUND = 'payment.refund';
14
+
15
+ /** Topic for querying payment status. */
16
+ export const TOPIC_PAYMENT_STATUS = 'payment.status';
17
+
18
+ /** Topic for listing payments (RPC). */
19
+ export const TOPIC_PAYMENT_FIND_ALL = 'payment.findAll';
20
+
21
+ /** Topic for finding a single payment (RPC). */
22
+ export const TOPIC_PAYMENT_FIND_ONE = 'payment.findOne';
23
+
24
+ /** Topic for payment webhook events (internal broadcast). */
25
+ export const TOPIC_PAYMENT_WEBHOOK = 'payment.webhook';