evo360-types 1.3.662 → 1.3.667

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.
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.zServiceTaxInfoSchema = exports.zServiceLineItemSchema = exports.zServiceInvoiceStateSchema = exports.zProviderServiceInvoiceStatusSchema = exports.zExternalLinkSchema = exports.zExternalObjectTypeSchema = exports.zInvoiceSourceRefSchema = exports.zInvoiceSourceTypeSchema = exports.zInvoiceTakerRefSchema = exports.zInvoiceTakerSnapshotSchema = exports.zInvoiceTakerSnapshotAddressSchema = exports.zTakerDocumentSchema = exports.zTakerTaxProfileSchema = exports.zTakerProviderRefsSchema = exports.zTakerAddressSchema = exports.zInvoiceTakerTypeSchema = exports.zServiceSchema = exports.zCustomerServiceTaxInfoSchema = exports.zIssuerTaxProfileSchema = exports.zIssuerNfseConfigSchema = exports.zIssuerMunicipalCredentialsRefSchema = exports.zIssuerTaxRegimeSchema = exports.zIssuerCompanyIdentitySchema = exports.zIssuerCompanyAddressSchema = exports.zTaxProfileSyncStateSchema = exports.zAsaasProviderSchema = exports.zAsaasProviderAsaasBlockSchema = exports.zAsaasProviderCapabilitiesSchema = exports.zAsaasPaymentsCapabilitiesSchema = exports.zAsaasEnvFlagSchema = exports.zAsaasNfseCapabilitiesSchema = exports.zAsaasEnvAuthConfigSchema = exports.zAsaasSubaccountInputSchema = exports.zAsaasAccountScopeSchema = exports.zAsaasWebhookConfigSchema = exports.zRetryPolicySchema = exports.zAsaasWebhookEventSchema = exports.zAsaasAccountScopeModeSchema = exports.zProviderRemoteRefsSchema = exports.zProviderFiscalInfoPayloadSchema = exports.zProviderCredentialsInputSchema = exports.zProviderCredentialsSecretRefsSchema = exports.zProviderMunicipalOptionsSnapshotSchema = exports.zProviderOptionItemSchema = exports.zProviderMunicipalAuthTypeSchema = exports.zFinopsProviderBaseSchema = exports.zProviderStatusSchema = exports.zFinopsActionSchema = exports.zFinopsProviderTypeSchema = exports.zProviderEnvSchema = void 0;
4
- exports.zNexFinopsPaymentMethodsDiscoverSchema = exports.zEvoBillingPortalCardCaptureSchema = exports.zNexFinopsBillingCardChargeSchema = exports.zNexFinopsContractPaymentMethodsWriteSchema = exports.zNexFinopsPaymentMethodPatchSchema = exports.zNexFinopsPaymentMethodStatusSchema = exports.zNexFinopsPaymentMethodKindSchema = exports.zNexFinopsContractAllowancesWriteSchema = exports.zNexFinopsUsageAlertDefaultsSchema = exports.zNexFinopsAlertThresholdSchema = exports.zNexFinopsContractAllowancesSchema = exports.zNexFinopsContractAllowanceSchema = exports.zNexVendasJourneyPaymentSchema = exports.zNexVendasJourneyPaymentSupersededSchema = exports.zNexVendasJourneyPaymentWebhookEventSchema = exports.zNexVendasJourneyBoletoSchema = exports.zNexVendasJourneyPaymentChooseSchema = exports.zNexVendasJourneyPaymentStateSchema = exports.zNexVendasJourneyPaymentKindSchema = exports.zNexVendasJourneyPaymentMethodSchema = exports.zNexFinopsContractAsaasInfoSchema = exports.zNexFinopsAsaasSubscriptionStatusSchema = exports.zNexFinopsPaymentMethodSchema = exports.zNexFinopsProposalSchema = exports.zNexFinopsProposalWriteSchema = exports.zNexFinopsProposalPrefillSchema = exports.zNexFinopsProposalLoyaltyPeriodSchema = exports.zNexFinopsProposalPaymentMethodSchema = exports.zNexFinopsProposalStatusSchema = exports.zServiceInvoiceSchema = exports.zPaymentLinkSchema = exports.zPaymentLinkDocumentStateSchema = exports.zAsaasPaymentLinkSubscriptionCycleSchema = exports.zAsaasPaymentLinkChargeTypeSchema = exports.zAsaasPaymentLinkBillingTypeSchema = exports.zProviderPayloadSnapshotSchema = exports.zProviderTraceSchema = exports.zProviderInvoiceErrorSchema = exports.zProviderInvoiceIdentifiersSchema = exports.zProviderInvoiceLinksSchema = void 0;
4
+ exports.zNfseFeeReimbursementExecuteSchema = exports.zNfseFeeReimbursementCompetenciaSchema = exports.zNexFinopsPaymentMethodsDiscoverSchema = exports.zEvoBillingPortalCardCaptureSchema = exports.zNexFinopsBillingCardChargeSchema = exports.zNexFinopsContractPaymentMethodsWriteSchema = exports.zNexFinopsPaymentMethodPatchSchema = exports.zNexFinopsPaymentMethodStatusSchema = exports.zNexFinopsPaymentMethodKindSchema = exports.zNexFinopsContractAllowancesWriteSchema = exports.zNexFinopsUsageAlertDefaultsSchema = exports.zNexFinopsAlertThresholdSchema = exports.zNexFinopsContractAllowancesSchema = exports.zNexFinopsContractAllowanceSchema = exports.zNexVendasJourneyPaymentSchema = exports.zNexVendasJourneyPaymentSupersededSchema = exports.zNexVendasJourneyPaymentWebhookEventSchema = exports.zNexVendasJourneyBoletoSchema = exports.zNexVendasJourneyPaymentChooseSchema = exports.zNexVendasJourneyPaymentStateSchema = exports.zNexVendasJourneyPaymentKindSchema = exports.zNexVendasJourneyPaymentMethodSchema = exports.zNexFinopsContractAsaasInfoSchema = exports.zNexFinopsAsaasSubscriptionStatusSchema = exports.zNexFinopsPaymentMethodSchema = exports.zNexFinopsProposalSchema = exports.zNexFinopsProposalWriteSchema = exports.zNexFinopsProposalPrefillSchema = exports.zNexFinopsProposalLoyaltyPeriodSchema = exports.zNexFinopsProposalPaymentMethodSchema = exports.zNexFinopsProposalStatusSchema = exports.zServiceInvoiceSchema = exports.zPaymentLinkSchema = exports.zPaymentLinkDocumentStateSchema = exports.zAsaasPaymentLinkSubscriptionCycleSchema = exports.zAsaasPaymentLinkChargeTypeSchema = exports.zAsaasPaymentLinkBillingTypeSchema = exports.zProviderPayloadSnapshotSchema = exports.zProviderTraceSchema = exports.zProviderInvoiceErrorSchema = exports.zProviderInvoiceIdentifiersSchema = exports.zProviderInvoiceLinksSchema = void 0;
5
5
  const zod_1 = require("zod");
6
6
  const zod_schemas_1 = require("../shared/zod-schemas");
7
7
  // ---- Provider enums and base ----
@@ -932,6 +932,8 @@ exports.zNexFinopsContractAllowancesWriteSchema = zod_1.z
932
932
  allowances: exports.zNexFinopsContractAllowancesSchema.optional().nullable(),
933
933
  alerts_enabled: zod_1.z.boolean().optional().nullable(),
934
934
  alert_thresholds: zod_1.z.array(exports.zNexFinopsAlertThresholdSchema).optional().nullable(),
935
+ /** feat-264 D4 — ausente/null = TRUE (reembolsa). */
936
+ nfse_fee_reimbursement: zod_1.z.boolean().optional().nullable(),
935
937
  })
936
938
  .strip();
937
939
  // ---- Nexus FinOps — métodos de pagamento do cliente (feat-253) ----
@@ -1007,3 +1009,25 @@ exports.zNexFinopsPaymentMethodsDiscoverSchema = zod_1.z
1007
1009
  .optional(),
1008
1010
  })
1009
1011
  .strip();
1012
+ // ---- Nexus FinOps — reembolso da taxa de NFS-e (feat-264) ----
1013
+ /** Competência `"YYYY-MM"`. */
1014
+ exports.zNfseFeeReimbursementCompetenciaSchema = zod_1.z
1015
+ .string()
1016
+ .regex(/^\d{4}-(0[1-9]|1[0-2])$/);
1017
+ /**
1018
+ * `POST /nfse-fee-reimbursements/execute`. `expected` é o que o operador viu
1019
+ * na prévia; o backend recalcula e recusa se divergir.
1020
+ */
1021
+ exports.zNfseFeeReimbursementExecuteSchema = zod_1.z
1022
+ .object({
1023
+ tenant: zod_1.z.string().min(1),
1024
+ competencia: exports.zNfseFeeReimbursementCompetenciaSchema,
1025
+ expected: zod_1.z.object({
1026
+ invoice_count: zod_1.z.number().int().positive(),
1027
+ fee_value: zod_1.z.number().positive(),
1028
+ amount: zod_1.z.number().positive(),
1029
+ /** Adendo D1: `wallet_id` da linha da prévia; divergiu no execute => `preview_drift`. */
1030
+ wallet_id: zod_1.z.string().min(1),
1031
+ }),
1032
+ })
1033
+ .strict();
@@ -1021,6 +1021,8 @@ export const zNexFinopsContractAllowancesWriteSchema = z
1021
1021
  allowances: zNexFinopsContractAllowancesSchema.optional().nullable(),
1022
1022
  alerts_enabled: z.boolean().optional().nullable(),
1023
1023
  alert_thresholds: z.array(zNexFinopsAlertThresholdSchema).optional().nullable(),
1024
+ /** feat-264 D4 — ausente/null = TRUE (reembolsa). */
1025
+ nfse_fee_reimbursement: z.boolean().optional().nullable(),
1024
1026
  })
1025
1027
  .strip();
1026
1028
 
@@ -1104,3 +1106,28 @@ export const zNexFinopsPaymentMethodsDiscoverSchema = z
1104
1106
  .optional(),
1105
1107
  })
1106
1108
  .strip();
1109
+
1110
+ // ---- Nexus FinOps — reembolso da taxa de NFS-e (feat-264) ----
1111
+
1112
+ /** Competência `"YYYY-MM"`. */
1113
+ export const zNfseFeeReimbursementCompetenciaSchema = z
1114
+ .string()
1115
+ .regex(/^\d{4}-(0[1-9]|1[0-2])$/);
1116
+
1117
+ /**
1118
+ * `POST /nfse-fee-reimbursements/execute`. `expected` é o que o operador viu
1119
+ * na prévia; o backend recalcula e recusa se divergir.
1120
+ */
1121
+ export const zNfseFeeReimbursementExecuteSchema = z
1122
+ .object({
1123
+ tenant: z.string().min(1),
1124
+ competencia: zNfseFeeReimbursementCompetenciaSchema,
1125
+ expected: z.object({
1126
+ invoice_count: z.number().int().positive(),
1127
+ fee_value: z.number().positive(),
1128
+ amount: z.number().positive(),
1129
+ /** Adendo D1: `wallet_id` da linha da prévia; divergiu no execute => `preview_drift`. */
1130
+ wallet_id: z.string().min(1),
1131
+ }),
1132
+ })
1133
+ .strict();
@@ -129,6 +129,7 @@ export declare const zInsuranceCompanySchema: z.ZodObject<{
129
129
  name: z.ZodDefault<z.ZodOptional<z.ZodString>>;
130
130
  kind: z.ZodDefault<z.ZodOptional<z.ZodString>>;
131
131
  line1: z.ZodDefault<z.ZodOptional<z.ZodString>>;
132
+ number: z.ZodDefault<z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>>;
132
133
  line2: z.ZodDefault<z.ZodOptional<z.ZodString>>;
133
134
  neighborhood: z.ZodDefault<z.ZodOptional<z.ZodString>>;
134
135
  city: z.ZodDefault<z.ZodOptional<z.ZodString>>;
@@ -137,22 +138,24 @@ export declare const zInsuranceCompanySchema: z.ZodObject<{
137
138
  country: z.ZodDefault<z.ZodOptional<z.ZodString>>;
138
139
  geo: z.ZodOptional<z.ZodAny>;
139
140
  }, "strip", z.ZodTypeAny, {
141
+ number: string;
140
142
  name: string;
141
143
  kind: string;
142
144
  country: string;
143
- city: string;
144
145
  state: string;
146
+ city: string;
145
147
  line1: string;
146
148
  line2: string;
147
149
  neighborhood: string;
148
150
  zip: string;
149
151
  geo?: any;
150
152
  }, {
153
+ number?: unknown;
151
154
  name?: string | undefined;
152
155
  kind?: string | undefined;
153
156
  country?: string | undefined;
154
- city?: string | undefined;
155
157
  state?: string | undefined;
158
+ city?: string | undefined;
156
159
  line1?: string | undefined;
157
160
  line2?: string | undefined;
158
161
  neighborhood?: string | undefined;
@@ -268,6 +271,7 @@ export declare const zInsuranceCompanySchema: z.ZodObject<{
268
271
  name: z.ZodDefault<z.ZodOptional<z.ZodString>>;
269
272
  kind: z.ZodDefault<z.ZodOptional<z.ZodString>>;
270
273
  line1: z.ZodDefault<z.ZodOptional<z.ZodString>>;
274
+ number: z.ZodDefault<z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>>;
271
275
  line2: z.ZodDefault<z.ZodOptional<z.ZodString>>;
272
276
  neighborhood: z.ZodDefault<z.ZodOptional<z.ZodString>>;
273
277
  city: z.ZodDefault<z.ZodOptional<z.ZodString>>;
@@ -276,22 +280,24 @@ export declare const zInsuranceCompanySchema: z.ZodObject<{
276
280
  country: z.ZodDefault<z.ZodOptional<z.ZodString>>;
277
281
  geo: z.ZodOptional<z.ZodAny>;
278
282
  }, "strip", z.ZodTypeAny, {
283
+ number: string;
279
284
  name: string;
280
285
  kind: string;
281
286
  country: string;
282
- city: string;
283
287
  state: string;
288
+ city: string;
284
289
  line1: string;
285
290
  line2: string;
286
291
  neighborhood: string;
287
292
  zip: string;
288
293
  geo?: any;
289
294
  }, {
295
+ number?: unknown;
290
296
  name?: string | undefined;
291
297
  kind?: string | undefined;
292
298
  country?: string | undefined;
293
- city?: string | undefined;
294
299
  state?: string | undefined;
300
+ city?: string | undefined;
295
301
  line1?: string | undefined;
296
302
  line2?: string | undefined;
297
303
  neighborhood?: string | undefined;
@@ -407,6 +413,7 @@ export declare const zInsuranceCompanySchema: z.ZodObject<{
407
413
  name: z.ZodDefault<z.ZodOptional<z.ZodString>>;
408
414
  kind: z.ZodDefault<z.ZodOptional<z.ZodString>>;
409
415
  line1: z.ZodDefault<z.ZodOptional<z.ZodString>>;
416
+ number: z.ZodDefault<z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>>;
410
417
  line2: z.ZodDefault<z.ZodOptional<z.ZodString>>;
411
418
  neighborhood: z.ZodDefault<z.ZodOptional<z.ZodString>>;
412
419
  city: z.ZodDefault<z.ZodOptional<z.ZodString>>;
@@ -415,22 +422,24 @@ export declare const zInsuranceCompanySchema: z.ZodObject<{
415
422
  country: z.ZodDefault<z.ZodOptional<z.ZodString>>;
416
423
  geo: z.ZodOptional<z.ZodAny>;
417
424
  }, "strip", z.ZodTypeAny, {
425
+ number: string;
418
426
  name: string;
419
427
  kind: string;
420
428
  country: string;
421
- city: string;
422
429
  state: string;
430
+ city: string;
423
431
  line1: string;
424
432
  line2: string;
425
433
  neighborhood: string;
426
434
  zip: string;
427
435
  geo?: any;
428
436
  }, {
437
+ number?: unknown;
429
438
  name?: string | undefined;
430
439
  kind?: string | undefined;
431
440
  country?: string | undefined;
432
- city?: string | undefined;
433
441
  state?: string | undefined;
442
+ city?: string | undefined;
434
443
  line1?: string | undefined;
435
444
  line2?: string | undefined;
436
445
  neighborhood?: string | undefined;
@@ -124,6 +124,7 @@ export declare const zProfessionalSchema: z.ZodObject<{
124
124
  name: z.ZodDefault<z.ZodOptional<z.ZodString>>;
125
125
  kind: z.ZodDefault<z.ZodOptional<z.ZodString>>;
126
126
  line1: z.ZodDefault<z.ZodOptional<z.ZodString>>;
127
+ number: z.ZodDefault<z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>>;
127
128
  line2: z.ZodDefault<z.ZodOptional<z.ZodString>>;
128
129
  neighborhood: z.ZodDefault<z.ZodOptional<z.ZodString>>;
129
130
  city: z.ZodDefault<z.ZodOptional<z.ZodString>>;
@@ -132,22 +133,24 @@ export declare const zProfessionalSchema: z.ZodObject<{
132
133
  country: z.ZodDefault<z.ZodOptional<z.ZodString>>;
133
134
  geo: z.ZodOptional<z.ZodAny>;
134
135
  }, "strip", z.ZodTypeAny, {
136
+ number: string;
135
137
  name: string;
136
138
  kind: string;
137
139
  country: string;
138
- city: string;
139
140
  state: string;
141
+ city: string;
140
142
  line1: string;
141
143
  line2: string;
142
144
  neighborhood: string;
143
145
  zip: string;
144
146
  geo?: any;
145
147
  }, {
148
+ number?: unknown;
146
149
  name?: string | undefined;
147
150
  kind?: string | undefined;
148
151
  country?: string | undefined;
149
- city?: string | undefined;
150
152
  state?: string | undefined;
153
+ city?: string | undefined;
151
154
  line1?: string | undefined;
152
155
  line2?: string | undefined;
153
156
  neighborhood?: string | undefined;
@@ -278,6 +281,7 @@ export declare const zProfessionalSchema: z.ZodObject<{
278
281
  name: z.ZodDefault<z.ZodOptional<z.ZodString>>;
279
282
  kind: z.ZodDefault<z.ZodOptional<z.ZodString>>;
280
283
  line1: z.ZodDefault<z.ZodOptional<z.ZodString>>;
284
+ number: z.ZodDefault<z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>>;
281
285
  line2: z.ZodDefault<z.ZodOptional<z.ZodString>>;
282
286
  neighborhood: z.ZodDefault<z.ZodOptional<z.ZodString>>;
283
287
  city: z.ZodDefault<z.ZodOptional<z.ZodString>>;
@@ -286,22 +290,24 @@ export declare const zProfessionalSchema: z.ZodObject<{
286
290
  country: z.ZodDefault<z.ZodOptional<z.ZodString>>;
287
291
  geo: z.ZodOptional<z.ZodAny>;
288
292
  }, "strip", z.ZodTypeAny, {
293
+ number: string;
289
294
  name: string;
290
295
  kind: string;
291
296
  country: string;
292
- city: string;
293
297
  state: string;
298
+ city: string;
294
299
  line1: string;
295
300
  line2: string;
296
301
  neighborhood: string;
297
302
  zip: string;
298
303
  geo?: any;
299
304
  }, {
305
+ number?: unknown;
300
306
  name?: string | undefined;
301
307
  kind?: string | undefined;
302
308
  country?: string | undefined;
303
- city?: string | undefined;
304
309
  state?: string | undefined;
310
+ city?: string | undefined;
305
311
  line1?: string | undefined;
306
312
  line2?: string | undefined;
307
313
  neighborhood?: string | undefined;
@@ -432,6 +438,7 @@ export declare const zProfessionalSchema: z.ZodObject<{
432
438
  name: z.ZodDefault<z.ZodOptional<z.ZodString>>;
433
439
  kind: z.ZodDefault<z.ZodOptional<z.ZodString>>;
434
440
  line1: z.ZodDefault<z.ZodOptional<z.ZodString>>;
441
+ number: z.ZodDefault<z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>>;
435
442
  line2: z.ZodDefault<z.ZodOptional<z.ZodString>>;
436
443
  neighborhood: z.ZodDefault<z.ZodOptional<z.ZodString>>;
437
444
  city: z.ZodDefault<z.ZodOptional<z.ZodString>>;
@@ -440,22 +447,24 @@ export declare const zProfessionalSchema: z.ZodObject<{
440
447
  country: z.ZodDefault<z.ZodOptional<z.ZodString>>;
441
448
  geo: z.ZodOptional<z.ZodAny>;
442
449
  }, "strip", z.ZodTypeAny, {
450
+ number: string;
443
451
  name: string;
444
452
  kind: string;
445
453
  country: string;
446
- city: string;
447
454
  state: string;
455
+ city: string;
448
456
  line1: string;
449
457
  line2: string;
450
458
  neighborhood: string;
451
459
  zip: string;
452
460
  geo?: any;
453
461
  }, {
462
+ number?: unknown;
454
463
  name?: string | undefined;
455
464
  kind?: string | undefined;
456
465
  country?: string | undefined;
457
- city?: string | undefined;
458
466
  state?: string | undefined;
467
+ city?: string | undefined;
459
468
  line1?: string | undefined;
460
469
  line2?: string | undefined;
461
470
  neighborhood?: string | undefined;
@@ -973,6 +982,7 @@ export declare const zPatientSchema: z.ZodObject<{
973
982
  name: z.ZodDefault<z.ZodOptional<z.ZodString>>;
974
983
  kind: z.ZodDefault<z.ZodOptional<z.ZodString>>;
975
984
  line1: z.ZodDefault<z.ZodOptional<z.ZodString>>;
985
+ number: z.ZodDefault<z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>>;
976
986
  line2: z.ZodDefault<z.ZodOptional<z.ZodString>>;
977
987
  neighborhood: z.ZodDefault<z.ZodOptional<z.ZodString>>;
978
988
  city: z.ZodDefault<z.ZodOptional<z.ZodString>>;
@@ -981,22 +991,24 @@ export declare const zPatientSchema: z.ZodObject<{
981
991
  country: z.ZodDefault<z.ZodOptional<z.ZodString>>;
982
992
  geo: z.ZodOptional<z.ZodAny>;
983
993
  }, "strip", z.ZodTypeAny, {
994
+ number: string;
984
995
  name: string;
985
996
  kind: string;
986
997
  country: string;
987
- city: string;
988
998
  state: string;
999
+ city: string;
989
1000
  line1: string;
990
1001
  line2: string;
991
1002
  neighborhood: string;
992
1003
  zip: string;
993
1004
  geo?: any;
994
1005
  }, {
1006
+ number?: unknown;
995
1007
  name?: string | undefined;
996
1008
  kind?: string | undefined;
997
1009
  country?: string | undefined;
998
- city?: string | undefined;
999
1010
  state?: string | undefined;
1011
+ city?: string | undefined;
1000
1012
  line1?: string | undefined;
1001
1013
  line2?: string | undefined;
1002
1014
  neighborhood?: string | undefined;
@@ -1621,6 +1633,7 @@ export declare const zPatientSchema: z.ZodObject<{
1621
1633
  name: z.ZodDefault<z.ZodOptional<z.ZodString>>;
1622
1634
  kind: z.ZodDefault<z.ZodOptional<z.ZodString>>;
1623
1635
  line1: z.ZodDefault<z.ZodOptional<z.ZodString>>;
1636
+ number: z.ZodDefault<z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>>;
1624
1637
  line2: z.ZodDefault<z.ZodOptional<z.ZodString>>;
1625
1638
  neighborhood: z.ZodDefault<z.ZodOptional<z.ZodString>>;
1626
1639
  city: z.ZodDefault<z.ZodOptional<z.ZodString>>;
@@ -1629,22 +1642,24 @@ export declare const zPatientSchema: z.ZodObject<{
1629
1642
  country: z.ZodDefault<z.ZodOptional<z.ZodString>>;
1630
1643
  geo: z.ZodOptional<z.ZodAny>;
1631
1644
  }, "strip", z.ZodTypeAny, {
1645
+ number: string;
1632
1646
  name: string;
1633
1647
  kind: string;
1634
1648
  country: string;
1635
- city: string;
1636
1649
  state: string;
1650
+ city: string;
1637
1651
  line1: string;
1638
1652
  line2: string;
1639
1653
  neighborhood: string;
1640
1654
  zip: string;
1641
1655
  geo?: any;
1642
1656
  }, {
1657
+ number?: unknown;
1643
1658
  name?: string | undefined;
1644
1659
  kind?: string | undefined;
1645
1660
  country?: string | undefined;
1646
- city?: string | undefined;
1647
1661
  state?: string | undefined;
1662
+ city?: string | undefined;
1648
1663
  line1?: string | undefined;
1649
1664
  line2?: string | undefined;
1650
1665
  neighborhood?: string | undefined;
@@ -2269,6 +2284,7 @@ export declare const zPatientSchema: z.ZodObject<{
2269
2284
  name: z.ZodDefault<z.ZodOptional<z.ZodString>>;
2270
2285
  kind: z.ZodDefault<z.ZodOptional<z.ZodString>>;
2271
2286
  line1: z.ZodDefault<z.ZodOptional<z.ZodString>>;
2287
+ number: z.ZodDefault<z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>>;
2272
2288
  line2: z.ZodDefault<z.ZodOptional<z.ZodString>>;
2273
2289
  neighborhood: z.ZodDefault<z.ZodOptional<z.ZodString>>;
2274
2290
  city: z.ZodDefault<z.ZodOptional<z.ZodString>>;
@@ -2277,22 +2293,24 @@ export declare const zPatientSchema: z.ZodObject<{
2277
2293
  country: z.ZodDefault<z.ZodOptional<z.ZodString>>;
2278
2294
  geo: z.ZodOptional<z.ZodAny>;
2279
2295
  }, "strip", z.ZodTypeAny, {
2296
+ number: string;
2280
2297
  name: string;
2281
2298
  kind: string;
2282
2299
  country: string;
2283
- city: string;
2284
2300
  state: string;
2301
+ city: string;
2285
2302
  line1: string;
2286
2303
  line2: string;
2287
2304
  neighborhood: string;
2288
2305
  zip: string;
2289
2306
  geo?: any;
2290
2307
  }, {
2308
+ number?: unknown;
2291
2309
  name?: string | undefined;
2292
2310
  kind?: string | undefined;
2293
2311
  country?: string | undefined;
2294
- city?: string | undefined;
2295
2312
  state?: string | undefined;
2313
+ city?: string | undefined;
2296
2314
  line1?: string | undefined;
2297
2315
  line2?: string | undefined;
2298
2316
  neighborhood?: string | undefined;
@@ -53,6 +53,7 @@ export declare const zAddressSchema: z.ZodObject<{
53
53
  name: z.ZodDefault<z.ZodOptional<z.ZodString>>;
54
54
  kind: z.ZodDefault<z.ZodOptional<z.ZodString>>;
55
55
  line1: z.ZodDefault<z.ZodOptional<z.ZodString>>;
56
+ number: z.ZodDefault<z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>>;
56
57
  line2: z.ZodDefault<z.ZodOptional<z.ZodString>>;
57
58
  neighborhood: z.ZodDefault<z.ZodOptional<z.ZodString>>;
58
59
  city: z.ZodDefault<z.ZodOptional<z.ZodString>>;
@@ -61,22 +62,24 @@ export declare const zAddressSchema: z.ZodObject<{
61
62
  country: z.ZodDefault<z.ZodOptional<z.ZodString>>;
62
63
  geo: z.ZodOptional<z.ZodAny>;
63
64
  }, "strip", z.ZodTypeAny, {
65
+ number: string;
64
66
  name: string;
65
67
  kind: string;
66
68
  country: string;
67
- city: string;
68
69
  state: string;
70
+ city: string;
69
71
  line1: string;
70
72
  line2: string;
71
73
  neighborhood: string;
72
74
  zip: string;
73
75
  geo?: any;
74
76
  }, {
77
+ number?: unknown;
75
78
  name?: string | undefined;
76
79
  kind?: string | undefined;
77
80
  country?: string | undefined;
78
- city?: string | undefined;
79
81
  state?: string | undefined;
82
+ city?: string | undefined;
80
83
  line1?: string | undefined;
81
84
  line2?: string | undefined;
82
85
  neighborhood?: string | undefined;
@@ -73,6 +73,10 @@ exports.zAddressSchema = zod_1.z.object({
73
73
  name: zod_1.z.string().max(255).optional().default(""),
74
74
  kind: zod_1.z.string().max(255).optional().default(""),
75
75
  line1: zod_1.z.string().max(255).optional().default(""),
76
+ number: zod_1.z
77
+ .preprocess((v) => (v === null || v === undefined ? "" : String(v)), zod_1.z.string().max(255))
78
+ .optional()
79
+ .default(""),
76
80
  line2: zod_1.z.string().max(255).optional().default(""),
77
81
  neighborhood: zod_1.z.string().max(255).optional().default(""),
78
82
  city: zod_1.z.string().max(255).optional().default(""),
@@ -87,6 +87,10 @@ export const zAddressSchema = z.object({
87
87
  name: z.string().max(255).optional().default(""),
88
88
  kind: z.string().max(255).optional().default(""),
89
89
  line1: z.string().max(255).optional().default(""),
90
+ number: z
91
+ .preprocess((v) => (v === null || v === undefined ? "" : String(v)), z.string().max(255))
92
+ .optional()
93
+ .default(""),
90
94
  line2: z.string().max(255).optional().default(""),
91
95
  neighborhood: z.string().max(255).optional().default(""),
92
96
  city: z.string().max(255).optional().default(""),
@@ -54,14 +54,26 @@ export interface INexusModuleChatPermissions {
54
54
  }
55
55
  export interface INexusReports {
56
56
  }
57
+ /**
58
+ * Sub-claims do módulo financeiro do Nexus. `finance === true` é o formato
59
+ * legado; não herda `reimbursements` (feat-264: movimenta dinheiro, exige TOTP).
60
+ */
61
+ export interface INexusModuleFinancePermissions {
62
+ customers?: boolean;
63
+ contracts?: boolean;
64
+ billing?: boolean;
65
+ reports?: boolean;
66
+ /** feat-264 — reembolso da taxa de NFS-e. Sem bypass de admin. */
67
+ reimbursements?: boolean;
68
+ }
57
69
  export interface INexusModules {
58
70
  chat?: INexusModuleChatPermissions | boolean;
59
71
  tenants?: boolean;
60
- finance?: boolean;
72
+ finance?: INexusModuleFinancePermissions | boolean;
61
73
  notifications?: boolean;
62
74
  waba?: boolean;
63
75
  reports?: INexusReports | boolean;
64
- [key: string]: INexusModuleChatPermissions | INexusReports | boolean | undefined;
76
+ [key: string]: INexusModuleChatPermissions | INexusModuleFinancePermissions | INexusReports | boolean | undefined;
65
77
  }
66
78
  export interface INexusClaims {
67
79
  nexus_access: boolean;
@@ -66,14 +66,32 @@ export interface INexusModuleChatPermissions {
66
66
 
67
67
  export interface INexusReports {}
68
68
 
69
+ /**
70
+ * Sub-claims do módulo financeiro do Nexus. `finance === true` é o formato
71
+ * legado; não herda `reimbursements` (feat-264: movimenta dinheiro, exige TOTP).
72
+ */
73
+ export interface INexusModuleFinancePermissions {
74
+ customers?: boolean;
75
+ contracts?: boolean;
76
+ billing?: boolean;
77
+ reports?: boolean;
78
+ /** feat-264 — reembolso da taxa de NFS-e. Sem bypass de admin. */
79
+ reimbursements?: boolean;
80
+ }
81
+
69
82
  export interface INexusModules {
70
83
  chat?: INexusModuleChatPermissions | boolean;
71
84
  tenants?: boolean;
72
- finance?: boolean;
85
+ finance?: INexusModuleFinancePermissions | boolean;
73
86
  notifications?: boolean;
74
87
  waba?: boolean;
75
88
  reports?: INexusReports | boolean;
76
- [key: string]: INexusModuleChatPermissions | INexusReports | boolean | undefined;
89
+ [key: string]:
90
+ | INexusModuleChatPermissions
91
+ | INexusModuleFinancePermissions
92
+ | INexusReports
93
+ | boolean
94
+ | undefined;
77
95
  }
78
96
 
79
97
  export interface INexusClaims {
@@ -179,6 +179,8 @@ export interface INexFinopsContract extends IFireGlobalDoc {
179
179
  * `INexFinopsUsageAlertDefaults.thresholds`.
180
180
  */
181
181
  alert_thresholds?: number[] | null;
182
+ /** feat-264 D4 — reembolsar a taxa de NFS-e ao cliente. ⚠️ Ausente/null = TRUE (reembolsa). */
183
+ nfse_fee_reimbursement?: boolean | null;
182
184
  }
183
185
  export declare const NEX_FINOPS_CONTRACT_STATUS_TRANSITIONS: Record<NexFinopsContractStatus, NexFinopsContractStatus[]>;
184
186
  /**
@@ -219,6 +219,9 @@ export interface INexFinopsContract extends IFireGlobalDoc {
219
219
  * `INexFinopsUsageAlertDefaults.thresholds`.
220
220
  */
221
221
  alert_thresholds?: number[] | null;
222
+
223
+ /** feat-264 D4 — reembolsar a taxa de NFS-e ao cliente. ⚠️ Ausente/null = TRUE (reembolsa). */
224
+ nfse_fee_reimbursement?: boolean | null;
222
225
  }
223
226
 
224
227
  // ── Status transitions ──
@@ -0,0 +1,112 @@
1
+ /** Coleção dos registros de reembolso. */
2
+ export declare const NEX_FINOPS_NFSE_FEE_REIMBURSEMENTS_COLLECTION = "nfse_fee_reimbursements";
3
+ /** `externalReference` da transferência Asaas = `"nexnfr:{id}"`. */
4
+ export declare const NFSE_FEE_REIMBURSEMENT_EXTERNAL_REF_PREFIX = "nexnfr:";
5
+ export type NfseFeeReimbursementState = 'awaiting_authorization' | 'pending' | 'done' | 'failed' | 'canceled' | 'refused';
6
+ /**
7
+ * `failed`/`canceled`/`refused` -> `done` existe só para a REALIDADE do Asaas: um
8
+ * `TRANSFER_DONE` do `transfer_id` vinculado significa que o dinheiro saiu; o
9
+ * registro vira `done` (as notas passam a ser consumidas e nunca são pagas duas
10
+ * vezes) e gera alerta CRITICAL. Nenhum fluxo nosso faz essa transição.
11
+ */
12
+ export declare const NFSE_FEE_REIMBURSEMENT_TRANSITIONS: Record<NfseFeeReimbursementState, NfseFeeReimbursementState[]>;
13
+ /** Estados que consomem as notas do snapshot (não podem ser reembolsadas de novo). */
14
+ export declare const NFSE_FEE_REIMBURSEMENT_CONSUMING_STATES: readonly string[];
15
+ /** Estados em voo: bloqueiam nova execução para o mesmo tenant/competência. */
16
+ export declare const NFSE_FEE_REIMBURSEMENT_IN_FLIGHT_STATES: readonly string[];
17
+ /** De onde veio o `wallet_id` do destino (Adendo D1). */
18
+ export type NfseFeeReimbursementWalletSource = 'account_scope' | 'asaas_wallets_api';
19
+ /** D1: plugável. Só `asaas_internal_transfer` é implementado; `pix` fica para depois. */
20
+ export type NfseFeeReimbursementPayoutMethod = 'asaas_internal_transfer';
21
+ export interface INfseFeeReimbursement {
22
+ /** `{tenant}_{YYYY-MM}[_{seq}]` */
23
+ id: string;
24
+ tenant: string;
25
+ /** `"YYYY-MM"` (mês de `authorized_at` em America/Sao_Paulo). */
26
+ competencia: string;
27
+ /** 1, 2, … */
28
+ seq: number;
29
+ state: NfseFeeReimbursementState;
30
+ state_reason?: string | null;
31
+ provider: {
32
+ id: string;
33
+ /** Adendo D1: `asaas` = conta própria do tenant; `asaas_subaccount` = subconta da master. */
34
+ type: 'asaas' | 'asaas_subaccount';
35
+ env: 'production';
36
+ /** Só a subconta tem; conta própria => `null`. */
37
+ asaas_account_id?: string | null;
38
+ wallet_id: string;
39
+ /** `account_scope` (subconta, persistido) | `asaas_wallets_api` (conta própria, `GET /v3/wallets/` com a chave do tenant; só snapshot). */
40
+ wallet_source: NfseFeeReimbursementWalletSource;
41
+ };
42
+ /** Snapshot do que foi reembolsado. */
43
+ invoices: {
44
+ count: number;
45
+ ids: string[];
46
+ };
47
+ fee: {
48
+ value: number;
49
+ source: 'asaas_myaccount_fees';
50
+ fetched_at: string;
51
+ };
52
+ /** `round2(count * fee.value)` */
53
+ amount: number;
54
+ currency: 'BRL';
55
+ contract: {
56
+ customer_id: string | null;
57
+ contract_ids: string[];
58
+ };
59
+ payout: {
60
+ method: NfseFeeReimbursementPayoutMethod;
61
+ /** `"nexnfr:{id}"` */
62
+ external_reference: string;
63
+ /** Ex.: `"Reembolso taxa NFS-e 09/2026 - 10 notas"` */
64
+ description: string;
65
+ /** Id Asaas — vinculado SÓ pela resposta do nosso POST /v3/transfers/ (validação e eventos nunca vinculam). */
66
+ transfer_id?: string | null;
67
+ /** PENDING | BANK_PROCESSING | DONE | CANCELLED | FAILED | BLOCKED */
68
+ asaas_status?: string | null;
69
+ transfer_fee?: number | null;
70
+ effective_date?: string | null;
71
+ fail_reason?: string | null;
72
+ };
73
+ validation: {
74
+ decision: 'APPROVED' | 'REFUSED' | null;
75
+ decided_at?: string | null;
76
+ attempts: number;
77
+ last_reason?: string | null;
78
+ };
79
+ last_event?: string | null;
80
+ last_event_at?: string | null;
81
+ requested_by: {
82
+ login_id: string;
83
+ email?: string | null;
84
+ second_factor: 'totp';
85
+ auth_time: string;
86
+ };
87
+ created_at: string;
88
+ updated_at: string;
89
+ done_at?: string | null;
90
+ }
91
+ export type NfseFeeReimbursementEligibility = 'eligible' | 'nothing_to_reimburse' | 'in_flight' | 'open_competencia' | 'not_eligible_contract_flag' | 'no_contract' | 'subaccount_not_ready' | 'wallet_unavailable' | 'ambiguous_provider' | 'fee_unavailable';
92
+ export interface INfseFeeReimbursementPreviewRow {
93
+ tenant: string;
94
+ tenant_name?: string | null;
95
+ competencia: string;
96
+ eligibility: NfseFeeReimbursementEligibility;
97
+ reason?: string | null;
98
+ provider_id?: string | null;
99
+ provider_type?: string | null;
100
+ wallet_id?: string | null;
101
+ wallet_source?: NfseFeeReimbursementWalletSource | null;
102
+ /** Autorizadas na competência, do provider. */
103
+ invoice_count_total: number;
104
+ invoice_count_already_reimbursed: number;
105
+ invoice_count_to_reimburse: number;
106
+ fee_value: number | null;
107
+ amount: number | null;
108
+ next_record_id?: string | null;
109
+ records: Array<Pick<INfseFeeReimbursement, 'id' | 'state' | 'amount' | 'seq'> & {
110
+ invoice_count: number;
111
+ }>;
112
+ }