@77sol-lab/form-schemas 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chunk-22ZUS7K3.mjs +47 -0
- package/{src/domains/financing/formalization/schemas/BtgPFSchema.ts → chunk-2TGZGHS3.mjs} +8 -21
- package/chunk-36GQASLI.mjs +47 -0
- package/chunk-6BD6V7EB.mjs +47 -0
- package/{src/domains/financing/formalization/schemas/EosPFSchema.ts → chunk-7LHQ27CS.mjs} +8 -21
- package/chunk-A2TV7TRP.mjs +6 -0
- package/chunk-B7RDVG4R.mjs +57 -0
- package/{src/domains/financing/formalization/schemas/BvPFSchema.ts → chunk-CY2EXD6C.mjs} +8 -22
- package/chunk-EFLW2FHX.mjs +47 -0
- package/chunk-FISPUQLP.mjs +59 -0
- package/chunk-FVIOZ4Q5.mjs +66 -0
- package/chunk-G3T562PC.mjs +47 -0
- package/chunk-GCYI6OFG.mjs +47 -0
- package/chunk-HKY6D6J5.mjs +33 -0
- package/chunk-KXEEZLMR.mjs +33 -0
- package/chunk-MWPQSGDD.mjs +47 -0
- package/chunk-NDJRJOFE.mjs +202 -0
- package/chunk-NL4VK2TF.mjs +33 -0
- package/chunk-ORO6OVTB.mjs +33 -0
- package/chunk-RMWCQ6YU.mjs +33 -0
- package/chunk-SBOQWT53.mjs +33 -0
- package/chunk-TCPW5MUT.mjs +33 -0
- package/chunk-TE64VI3I.mjs +47 -0
- package/chunk-TEL6EWAJ.mjs +47 -0
- package/chunk-TTHE6D3Y.mjs +33 -0
- package/chunk-TUYULPDF.mjs +47 -0
- package/chunk-UHMVAJYK.mjs +33 -0
- package/chunk-W3CNJVMM.mjs +33 -0
- package/chunk-WHVCW22E.mjs +33 -0
- package/chunk-X4DDGGAB.mjs +233 -0
- package/chunk-XUMC3TQU.mjs +52 -0
- package/financing/formalization/index.d.cts +18755 -0
- package/financing/formalization/index.d.ts +18755 -0
- package/financing/formalization/index.js +1444 -0
- package/financing/formalization/index.mjs +31 -0
- package/financing/formalization/schemas/AlfaPFSchema.d.cts +439 -0
- package/financing/formalization/schemas/AlfaPFSchema.d.ts +439 -0
- package/financing/formalization/schemas/AlfaPFSchema.js +236 -0
- package/financing/formalization/schemas/AlfaPFSchema.mjs +3 -0
- package/financing/formalization/schemas/AlfaPJSchema.d.cts +679 -0
- package/financing/formalization/schemas/AlfaPJSchema.d.ts +679 -0
- package/financing/formalization/schemas/AlfaPJSchema.js +210 -0
- package/financing/formalization/schemas/AlfaPJSchema.mjs +2 -0
- package/financing/formalization/schemas/BancoDoBrasilPFSchema.d.cts +439 -0
- package/financing/formalization/schemas/BancoDoBrasilPFSchema.d.ts +439 -0
- package/financing/formalization/schemas/BancoDoBrasilPFSchema.js +236 -0
- package/financing/formalization/schemas/BancoDoBrasilPFSchema.mjs +3 -0
- package/financing/formalization/schemas/BancoDoBrasilPJSchema.d.cts +679 -0
- package/financing/formalization/schemas/BancoDoBrasilPJSchema.d.ts +679 -0
- package/financing/formalization/schemas/BancoDoBrasilPJSchema.js +210 -0
- package/financing/formalization/schemas/BancoDoBrasilPJSchema.mjs +2 -0
- package/financing/formalization/schemas/BtgPFSchema.d.cts +439 -0
- package/financing/formalization/schemas/BtgPFSchema.d.ts +439 -0
- package/financing/formalization/schemas/BtgPFSchema.js +236 -0
- package/financing/formalization/schemas/BtgPFSchema.mjs +3 -0
- package/financing/formalization/schemas/BtgPJSchema.d.cts +811 -0
- package/financing/formalization/schemas/BtgPJSchema.d.ts +811 -0
- package/financing/formalization/schemas/BtgPJSchema.js +222 -0
- package/financing/formalization/schemas/BtgPJSchema.mjs +3 -0
- package/financing/formalization/schemas/BvPFSchema.d.cts +535 -0
- package/financing/formalization/schemas/BvPFSchema.d.ts +535 -0
- package/financing/formalization/schemas/BvPFSchema.js +248 -0
- package/financing/formalization/schemas/BvPFSchema.mjs +3 -0
- package/financing/formalization/schemas/BvPJSchema.d.cts +895 -0
- package/financing/formalization/schemas/BvPJSchema.d.ts +895 -0
- package/financing/formalization/schemas/BvPJSchema.js +229 -0
- package/financing/formalization/schemas/BvPJSchema.mjs +3 -0
- package/financing/formalization/schemas/CaixaEconomicaFederalPFSchema.d.cts +439 -0
- package/financing/formalization/schemas/CaixaEconomicaFederalPFSchema.d.ts +439 -0
- package/financing/formalization/schemas/CaixaEconomicaFederalPFSchema.js +236 -0
- package/financing/formalization/schemas/CaixaEconomicaFederalPFSchema.mjs +3 -0
- package/financing/formalization/schemas/CaixaEconomicaFederalPJSchema.d.cts +679 -0
- package/financing/formalization/schemas/CaixaEconomicaFederalPJSchema.d.ts +679 -0
- package/financing/formalization/schemas/CaixaEconomicaFederalPJSchema.js +210 -0
- package/financing/formalization/schemas/CaixaEconomicaFederalPJSchema.mjs +2 -0
- package/financing/formalization/schemas/CashMePFSchema.d.cts +439 -0
- package/financing/formalization/schemas/CashMePFSchema.d.ts +439 -0
- package/financing/formalization/schemas/CashMePFSchema.js +236 -0
- package/financing/formalization/schemas/CashMePFSchema.mjs +3 -0
- package/financing/formalization/schemas/CashMePJSchema.d.cts +679 -0
- package/financing/formalization/schemas/CashMePJSchema.d.ts +679 -0
- package/financing/formalization/schemas/CashMePJSchema.js +210 -0
- package/financing/formalization/schemas/CashMePJSchema.mjs +2 -0
- package/financing/formalization/schemas/Credito77PFSchema.d.cts +439 -0
- package/financing/formalization/schemas/Credito77PFSchema.d.ts +439 -0
- package/financing/formalization/schemas/Credito77PFSchema.js +236 -0
- package/financing/formalization/schemas/Credito77PFSchema.mjs +3 -0
- package/financing/formalization/schemas/Credito77PJSchema.d.cts +679 -0
- package/financing/formalization/schemas/Credito77PJSchema.d.ts +679 -0
- package/financing/formalization/schemas/Credito77PJSchema.js +210 -0
- package/financing/formalization/schemas/Credito77PJSchema.mjs +2 -0
- package/financing/formalization/schemas/EosPFSchema.d.cts +439 -0
- package/financing/formalization/schemas/EosPFSchema.d.ts +439 -0
- package/financing/formalization/schemas/EosPFSchema.js +236 -0
- package/financing/formalization/schemas/EosPFSchema.mjs +3 -0
- package/financing/formalization/schemas/EosPJSchema.d.cts +679 -0
- package/financing/formalization/schemas/EosPJSchema.d.ts +679 -0
- package/financing/formalization/schemas/EosPJSchema.js +210 -0
- package/financing/formalization/schemas/EosPJSchema.mjs +2 -0
- package/financing/formalization/schemas/HdtEnergyPFSchema.d.cts +439 -0
- package/financing/formalization/schemas/HdtEnergyPFSchema.d.ts +439 -0
- package/financing/formalization/schemas/HdtEnergyPFSchema.js +236 -0
- package/financing/formalization/schemas/HdtEnergyPFSchema.mjs +3 -0
- package/financing/formalization/schemas/HdtEnergyPJSchema.d.cts +679 -0
- package/financing/formalization/schemas/HdtEnergyPJSchema.d.ts +679 -0
- package/financing/formalization/schemas/HdtEnergyPJSchema.js +210 -0
- package/financing/formalization/schemas/HdtEnergyPJSchema.mjs +2 -0
- package/financing/formalization/schemas/LosangoPFSchema.d.cts +439 -0
- package/financing/formalization/schemas/LosangoPFSchema.d.ts +439 -0
- package/financing/formalization/schemas/LosangoPFSchema.js +236 -0
- package/financing/formalization/schemas/LosangoPFSchema.mjs +3 -0
- package/financing/formalization/schemas/LosangoPJSchema.d.cts +679 -0
- package/financing/formalization/schemas/LosangoPJSchema.d.ts +679 -0
- package/financing/formalization/schemas/LosangoPJSchema.js +210 -0
- package/financing/formalization/schemas/LosangoPJSchema.mjs +2 -0
- package/financing/formalization/schemas/SafraPFSchema.d.cts +439 -0
- package/financing/formalization/schemas/SafraPFSchema.d.ts +439 -0
- package/financing/formalization/schemas/SafraPFSchema.js +236 -0
- package/financing/formalization/schemas/SafraPFSchema.mjs +3 -0
- package/financing/formalization/schemas/SafraPJSchema.d.cts +679 -0
- package/financing/formalization/schemas/SafraPJSchema.d.ts +679 -0
- package/financing/formalization/schemas/SafraPJSchema.js +210 -0
- package/financing/formalization/schemas/SafraPJSchema.mjs +2 -0
- package/financing/formalization/schemas/SantanderPFSchema.d.cts +439 -0
- package/financing/formalization/schemas/SantanderPFSchema.d.ts +439 -0
- package/financing/formalization/schemas/SantanderPFSchema.js +236 -0
- package/financing/formalization/schemas/SantanderPFSchema.mjs +3 -0
- package/financing/formalization/schemas/SantanderPJSchema.d.cts +679 -0
- package/financing/formalization/schemas/SantanderPJSchema.d.ts +679 -0
- package/financing/formalization/schemas/SantanderPJSchema.js +210 -0
- package/financing/formalization/schemas/SantanderPJSchema.mjs +2 -0
- package/financing/formalization/schemas/SolAgoraPFSchema.d.cts +439 -0
- package/financing/formalization/schemas/SolAgoraPFSchema.d.ts +439 -0
- package/financing/formalization/schemas/SolAgoraPFSchema.js +236 -0
- package/financing/formalization/schemas/SolAgoraPFSchema.mjs +3 -0
- package/financing/formalization/schemas/SolAgoraPJSchema.d.cts +787 -0
- package/financing/formalization/schemas/SolAgoraPJSchema.d.ts +787 -0
- package/financing/formalization/schemas/SolAgoraPJSchema.js +220 -0
- package/financing/formalization/schemas/SolAgoraPJSchema.mjs +3 -0
- package/financing/formalization/schemas/SolfacilPFSchema.d.cts +439 -0
- package/financing/formalization/schemas/SolfacilPFSchema.d.ts +439 -0
- package/financing/formalization/schemas/SolfacilPFSchema.js +236 -0
- package/financing/formalization/schemas/SolfacilPFSchema.mjs +3 -0
- package/financing/formalization/schemas/SolfacilPJSchema.d.cts +739 -0
- package/financing/formalization/schemas/SolfacilPJSchema.d.ts +739 -0
- package/financing/formalization/schemas/SolfacilPJSchema.js +215 -0
- package/financing/formalization/schemas/SolfacilPJSchema.mjs +2 -0
- package/index.d.cts +2 -0
- package/index.d.ts +2 -0
- package/index.js +1444 -0
- package/index.mjs +31 -0
- package/package.json +21 -43
- package/README.md +0 -182
- package/src/domains/financing/enums/banks.ts +0 -22
- package/src/domains/financing/enums/index.ts +0 -2
- package/src/domains/financing/enums/occupation.ts +0 -2
- package/src/domains/financing/formalization/extras.ts +0 -21
- package/src/domains/financing/formalization/index.ts +0 -18
- package/src/domains/financing/formalization/refinements.ts +0 -70
- package/src/domains/financing/formalization/registry.ts +0 -153
- package/src/domains/financing/formalization/schemas/AlfaPFSchema.ts +0 -46
- package/src/domains/financing/formalization/schemas/AlfaPJSchema.ts +0 -65
- package/src/domains/financing/formalization/schemas/BancoDoBrasilPFSchema.ts +0 -46
- package/src/domains/financing/formalization/schemas/BancoDoBrasilPJSchema.ts +0 -65
- package/src/domains/financing/formalization/schemas/BtgPJSchema.ts +0 -77
- package/src/domains/financing/formalization/schemas/BvPJSchema.ts +0 -84
- package/src/domains/financing/formalization/schemas/CaixaEconomicaFederalPFSchema.ts +0 -48
- package/src/domains/financing/formalization/schemas/CaixaEconomicaFederalPJSchema.ts +0 -67
- package/src/domains/financing/formalization/schemas/CashMePFSchema.ts +0 -46
- package/src/domains/financing/formalization/schemas/CashMePJSchema.ts +0 -65
- package/src/domains/financing/formalization/schemas/Credito77PFSchema.ts +0 -46
- package/src/domains/financing/formalization/schemas/Credito77PJSchema.ts +0 -65
- package/src/domains/financing/formalization/schemas/EosPJSchema.ts +0 -65
- package/src/domains/financing/formalization/schemas/HdtEnergyPFSchema.ts +0 -46
- package/src/domains/financing/formalization/schemas/HdtEnergyPJSchema.ts +0 -65
- package/src/domains/financing/formalization/schemas/LosangoPFSchema.ts +0 -46
- package/src/domains/financing/formalization/schemas/LosangoPJSchema.ts +0 -65
- package/src/domains/financing/formalization/schemas/SafraPFSchema.ts +0 -46
- package/src/domains/financing/formalization/schemas/SafraPJSchema.ts +0 -65
- package/src/domains/financing/formalization/schemas/SantanderPFSchema.ts +0 -46
- package/src/domains/financing/formalization/schemas/SantanderPJSchema.ts +0 -65
- package/src/domains/financing/formalization/schemas/SolAgoraPFSchema.ts +0 -46
- package/src/domains/financing/formalization/schemas/SolAgoraPJSchema.ts +0 -75
- package/src/domains/financing/formalization/schemas/SolfacilPFSchema.ts +0 -46
- package/src/domains/financing/formalization/schemas/SolfacilPJSchema.ts +0 -70
- package/src/domains/financing/formalization/uiMeta.ts +0 -122
- package/src/domains/financing/index.ts +0 -1
- package/src/index.ts +0 -1
- package/src/shared/enums/document-type.ts +0 -4
- package/src/shared/enums/index.ts +0 -3
- package/src/shared/enums/nationality.ts +0 -2
- package/src/shared/enums/sex.ts +0 -4
- package/src/shared/fields/index.ts +0 -1
- package/src/shared/fields/primitives.ts +0 -32
- package/src/shared/regex/index.ts +0 -75
- package/src/shared/regex/patterns.ts +0 -15
- package/src/shared/regex/validators.spec.ts +0 -162
- package/src/shared/regex/validators.ts +0 -96
package/index.js
ADDED
|
@@ -0,0 +1,1444 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var zod = require('zod');
|
|
4
|
+
|
|
5
|
+
// src/shared/enums/document-type.ts
|
|
6
|
+
var DocumentTypeEnum = zod.z.enum(["rg", "cnh", "rne"]);
|
|
7
|
+
|
|
8
|
+
// src/shared/enums/nationality.ts
|
|
9
|
+
var NATIONALITY_BRAZIL = "brasil";
|
|
10
|
+
var SexEnum = zod.z.enum(["masculino", "feminino"]);
|
|
11
|
+
var BANK_SLUGS = [
|
|
12
|
+
"credito77",
|
|
13
|
+
"losango",
|
|
14
|
+
"santander",
|
|
15
|
+
"btg",
|
|
16
|
+
"bv",
|
|
17
|
+
"banco-do-brasil",
|
|
18
|
+
"caixa-economica-federal",
|
|
19
|
+
"alfa",
|
|
20
|
+
"safra",
|
|
21
|
+
"cash_me_",
|
|
22
|
+
"hdt_energy",
|
|
23
|
+
"solfacil",
|
|
24
|
+
"sol_agora",
|
|
25
|
+
"eos"
|
|
26
|
+
];
|
|
27
|
+
var BankEnum = zod.z.enum(BANK_SLUGS);
|
|
28
|
+
|
|
29
|
+
// src/domains/financing/enums/occupation.ts
|
|
30
|
+
var OCCUPATIONS_REQUIRING_CNPJ = ["empresario", "empresario_ou_proprietario"];
|
|
31
|
+
|
|
32
|
+
// src/shared/regex/patterns.ts
|
|
33
|
+
var PATTERNS = {
|
|
34
|
+
cpf: /^\d{11}$/,
|
|
35
|
+
cnpj: /^\d{14}$/,
|
|
36
|
+
cep: /^\d{8}$/,
|
|
37
|
+
phoneBR: /^\d{11}$/,
|
|
38
|
+
email: /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
|
|
39
|
+
dateDMY: /^\d{2}\/\d{2}\/\d{4}$/};
|
|
40
|
+
|
|
41
|
+
// src/shared/regex/validators.ts
|
|
42
|
+
function onlyDigits(value) {
|
|
43
|
+
return value.replace(/\D/g, "");
|
|
44
|
+
}
|
|
45
|
+
function isValidCPF(value) {
|
|
46
|
+
const cpf = onlyDigits(value);
|
|
47
|
+
if (cpf.length !== 11) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
if (/^(\d)\1{10}$/.test(cpf)) {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
const calcCheck = (slice) => {
|
|
54
|
+
let sum = 0;
|
|
55
|
+
for (let i = 0; i < slice; i++) {
|
|
56
|
+
sum += Number(cpf[i]) * (slice + 1 - i);
|
|
57
|
+
}
|
|
58
|
+
const rest = sum * 10 % 11;
|
|
59
|
+
return rest === 10 ? 0 : rest;
|
|
60
|
+
};
|
|
61
|
+
return calcCheck(9) === Number(cpf[9]) && calcCheck(10) === Number(cpf[10]);
|
|
62
|
+
}
|
|
63
|
+
function isValidCNPJ(value) {
|
|
64
|
+
const cnpj = onlyDigits(value);
|
|
65
|
+
if (cnpj.length !== 14) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
if (/^(\d)\1{13}$/.test(cnpj)) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
const calcCheck = (length) => {
|
|
72
|
+
const weights = length === 12 ? [5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2] : [6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2];
|
|
73
|
+
let sum = 0;
|
|
74
|
+
for (const [i, weight] of weights.entries()) {
|
|
75
|
+
sum += Number(cnpj[i]) * weight;
|
|
76
|
+
}
|
|
77
|
+
const rest = sum % 11;
|
|
78
|
+
return rest < 2 ? 0 : 11 - rest;
|
|
79
|
+
};
|
|
80
|
+
return calcCheck(12) === Number(cnpj[12]) && calcCheck(13) === Number(cnpj[13]);
|
|
81
|
+
}
|
|
82
|
+
function parseDMY(value) {
|
|
83
|
+
const match = /^(\d{2})\/(\d{2})\/(\d{4})$/.exec(value);
|
|
84
|
+
if (!match) {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
const [, dd, mm, yyyy] = match;
|
|
88
|
+
const day = Number(dd);
|
|
89
|
+
const month = Number(mm);
|
|
90
|
+
const year = Number(yyyy);
|
|
91
|
+
const date = new Date(year, month - 1, day);
|
|
92
|
+
if (date.getFullYear() !== year || date.getMonth() !== month - 1 || date.getDate() !== day) {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
return date;
|
|
96
|
+
}
|
|
97
|
+
function ageInYears(birth, reference = /* @__PURE__ */ new Date()) {
|
|
98
|
+
let age = reference.getFullYear() - birth.getFullYear();
|
|
99
|
+
const monthDiff = reference.getMonth() - birth.getMonth();
|
|
100
|
+
if (monthDiff < 0 || monthDiff === 0 && reference.getDate() < birth.getDate()) {
|
|
101
|
+
age--;
|
|
102
|
+
}
|
|
103
|
+
return age;
|
|
104
|
+
}
|
|
105
|
+
function isAdultDMY(value, reference) {
|
|
106
|
+
const date = parseDMY(value);
|
|
107
|
+
if (!date) {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
return ageInYears(date, reference) >= 18;
|
|
111
|
+
}
|
|
112
|
+
function isNotFutureDMY(value, reference = /* @__PURE__ */ new Date()) {
|
|
113
|
+
const date = parseDMY(value);
|
|
114
|
+
if (!date) {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
return date.getTime() <= reference.getTime();
|
|
118
|
+
}
|
|
119
|
+
function yearsSinceDMY(value, reference = /* @__PURE__ */ new Date()) {
|
|
120
|
+
const date = parseDMY(value);
|
|
121
|
+
if (!date) {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
return ageInYears(date, reference);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// src/shared/regex/index.ts
|
|
128
|
+
var cpfSchema = zod.z.string().transform(onlyDigits).refine((v) => PATTERNS.cpf.test(v), "CPF deve ter 11 d\xEDgitos").refine(isValidCPF, "CPF inv\xE1lido");
|
|
129
|
+
var cnpjSchema = zod.z.string().transform(onlyDigits).refine((v) => PATTERNS.cnpj.test(v), "CNPJ deve ter 14 d\xEDgitos").refine(isValidCNPJ, "CNPJ inv\xE1lido");
|
|
130
|
+
var cpfCnpjSchema = zod.z.string().transform(onlyDigits).refine(
|
|
131
|
+
(v) => PATTERNS.cpf.test(v) || PATTERNS.cnpj.test(v),
|
|
132
|
+
"Documento deve ter 11 (CPF) ou 14 (CNPJ) d\xEDgitos"
|
|
133
|
+
).refine((v) => v.length === 11 ? isValidCPF(v) : isValidCNPJ(v), "Documento inv\xE1lido");
|
|
134
|
+
var cepSchema = zod.z.string().transform(onlyDigits).refine((v) => PATTERNS.cep.test(v), "CEP deve ter 8 d\xEDgitos");
|
|
135
|
+
var phoneBRSchema = zod.z.string().transform(onlyDigits).refine((v) => PATTERNS.phoneBR.test(v), "Telefone deve ter 11 d\xEDgitos com DDD");
|
|
136
|
+
var emailSchema = zod.z.string().trim().refine((v) => PATTERNS.email.test(v), "E-mail inv\xE1lido");
|
|
137
|
+
var dateDMYSchema = zod.z.string().refine((v) => PATTERNS.dateDMY.test(v), "Data deve estar no formato DD/MM/AAAA").refine((v) => parseDMY(v) !== null, "Data inexistente no calend\xE1rio");
|
|
138
|
+
var birthDateSchema = dateDMYSchema.refine(
|
|
139
|
+
(v) => isAdultDMY(v),
|
|
140
|
+
"\xC9 necess\xE1rio ser maior de idade (18+)"
|
|
141
|
+
);
|
|
142
|
+
var issueDateSchema = dateDMYSchema.refine(
|
|
143
|
+
(v) => isNotFutureDMY(v),
|
|
144
|
+
"Data de emiss\xE3o n\xE3o pode ser futura"
|
|
145
|
+
);
|
|
146
|
+
var currencySchema = zod.z.number({ invalid_type_error: "Valor monet\xE1rio inv\xE1lido" }).positive("Valor deve ser positivo");
|
|
147
|
+
zod.z.number().int("Deve ser um n\xFAmero inteiro").min(1, "M\xEDnimo 1").max(28, "M\xE1ximo 28");
|
|
148
|
+
|
|
149
|
+
// src/domains/financing/formalization/refinements.ts
|
|
150
|
+
var RG_MAX_EMISSION_YEARS = 10;
|
|
151
|
+
function applyCommonRefinements(data, ctx) {
|
|
152
|
+
if ("account_third_party" in data && typeof data.account_third_party === "string" && data.account_third_party !== "nao_se_aplica" && !data.bond_document_upload) {
|
|
153
|
+
ctx.addIssue({
|
|
154
|
+
code: zod.z.ZodIssueCode.custom,
|
|
155
|
+
path: ["bond_document_upload"],
|
|
156
|
+
message: "Documento de v\xEDnculo \xE9 obrigat\xF3rio quando a conta est\xE1 em nome de terceiro"
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
function applyPfRefinements(data, ctx) {
|
|
161
|
+
applyCommonRefinements(data, ctx);
|
|
162
|
+
if ("nature_of_occupation" in data && typeof data.nature_of_occupation === "string" && OCCUPATIONS_REQUIRING_CNPJ.includes(data.nature_of_occupation) && !data.cnpj_proprietary) {
|
|
163
|
+
ctx.addIssue({
|
|
164
|
+
code: zod.z.ZodIssueCode.custom,
|
|
165
|
+
path: ["cnpj_proprietary"],
|
|
166
|
+
message: "CNPJ do propriet\xE1rio \xE9 obrigat\xF3rio para esta ocupa\xE7\xE3o"
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
if (data.type_doc === "rg" && typeof data.doc_issue_date === "string") {
|
|
170
|
+
const years = yearsSinceDMY(data.doc_issue_date);
|
|
171
|
+
if (years !== null && years > RG_MAX_EMISSION_YEARS) {
|
|
172
|
+
ctx.addIssue({
|
|
173
|
+
code: zod.z.ZodIssueCode.custom,
|
|
174
|
+
path: ["doc_issue_date"],
|
|
175
|
+
message: `RG deve ter no m\xE1ximo ${RG_MAX_EMISSION_YEARS} anos de emiss\xE3o`
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
if (typeof data.nationality === "string" && data.nationality.toLowerCase() !== NATIONALITY_BRAZIL && "type_doc" in data && data.type_doc !== "rne") {
|
|
180
|
+
ctx.addIssue({
|
|
181
|
+
code: zod.z.ZodIssueCode.custom,
|
|
182
|
+
path: ["type_doc"],
|
|
183
|
+
message: "Para nacionalidade estrangeira, o documento deve ser Registro de Estrangeiro (RNE)"
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
function applyPjRefinements(data, ctx) {
|
|
188
|
+
applyCommonRefinements(data, ctx);
|
|
189
|
+
}
|
|
190
|
+
function textField(maxLength) {
|
|
191
|
+
const base = zod.z.string().trim().min(1, "Campo obrigat\xF3rio");
|
|
192
|
+
return maxLength === void 0 ? base : base.max(maxLength, `M\xE1ximo ${maxLength} caracteres`);
|
|
193
|
+
}
|
|
194
|
+
var numberField = zod.z.number({ invalid_type_error: "Valor num\xE9rico inv\xE1lido" }).nonnegative("Valor n\xE3o pode ser negativo");
|
|
195
|
+
var integerField = zod.z.number({ invalid_type_error: "Valor num\xE9rico inv\xE1lido" }).int("Deve ser um n\xFAmero inteiro").nonnegative("Valor n\xE3o pode ser negativo");
|
|
196
|
+
function selectField(values) {
|
|
197
|
+
return zod.z.enum(values);
|
|
198
|
+
}
|
|
199
|
+
var MAX_UPLOAD_BYTES = 5 * 1024 * 1024;
|
|
200
|
+
var ACCEPTED_UPLOAD_MIME = ["image/jpeg", "image/png", "application/pdf"];
|
|
201
|
+
var fileUploadField = zod.z.object({
|
|
202
|
+
url: zod.z.string().url().optional(),
|
|
203
|
+
mime: zod.z.enum(ACCEPTED_UPLOAD_MIME, {
|
|
204
|
+
errorMap: () => ({ message: "Formato deve ser JPEG, PNG ou PDF" })
|
|
205
|
+
}),
|
|
206
|
+
sizeBytes: zod.z.number().max(MAX_UPLOAD_BYTES, "Arquivo deve ter no m\xE1ximo 5MB")
|
|
207
|
+
});
|
|
208
|
+
var THIRD_PARTY_OPTIONS = [
|
|
209
|
+
"nao_se_aplica",
|
|
210
|
+
"conjuge",
|
|
211
|
+
"pai_mae",
|
|
212
|
+
"filho_filha",
|
|
213
|
+
"parente",
|
|
214
|
+
"outro"
|
|
215
|
+
];
|
|
216
|
+
var formalizationExtras = {
|
|
217
|
+
energy_bill_upload: fileUploadField,
|
|
218
|
+
account_third_party: selectField(THIRD_PARTY_OPTIONS),
|
|
219
|
+
bond_document_upload: fileUploadField.optional(),
|
|
220
|
+
document_front_upload: fileUploadField,
|
|
221
|
+
document_back_upload: fileUploadField,
|
|
222
|
+
// RN-014: seguro RD/RE começa ON.
|
|
223
|
+
rd_re_insurance_toggle: zod.z.boolean().default(true)
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
// src/domains/financing/formalization/schemas/AlfaPFSchema.ts
|
|
227
|
+
var alfaPfObject = zod.z.object({
|
|
228
|
+
...formalizationExtras,
|
|
229
|
+
name: textField(),
|
|
230
|
+
cep: cepSchema,
|
|
231
|
+
cpf: cpfSchema,
|
|
232
|
+
address: textField(),
|
|
233
|
+
birth_date: birthDateSchema,
|
|
234
|
+
number: textField(),
|
|
235
|
+
sex: SexEnum,
|
|
236
|
+
complement: textField(15).optional(),
|
|
237
|
+
mother_name: textField(),
|
|
238
|
+
district: textField(),
|
|
239
|
+
energy_account_in_requester_name: textField(),
|
|
240
|
+
city: textField(),
|
|
241
|
+
energy_bill_owner_document: cpfCnpjSchema.optional(),
|
|
242
|
+
state: textField(2),
|
|
243
|
+
nationality: textField(),
|
|
244
|
+
cellphone: phoneBRSchema,
|
|
245
|
+
email: emailSchema,
|
|
246
|
+
monthly_income: currencySchema,
|
|
247
|
+
profession: textField(),
|
|
248
|
+
type_doc: DocumentTypeEnum,
|
|
249
|
+
doc: textField(15),
|
|
250
|
+
issuing_body: textField(6),
|
|
251
|
+
doc_issue_date: issueDateSchema
|
|
252
|
+
});
|
|
253
|
+
var alfaPfSchema = alfaPfObject.strict().superRefine(applyPfRefinements);
|
|
254
|
+
var alfaPjObject = zod.z.object({
|
|
255
|
+
...formalizationExtras,
|
|
256
|
+
financing_company: zod.z.object({
|
|
257
|
+
corporate_name: textField(),
|
|
258
|
+
cep: cepSchema,
|
|
259
|
+
address: textField(),
|
|
260
|
+
foundation_date: issueDateSchema,
|
|
261
|
+
number: textField(),
|
|
262
|
+
cnpj: cnpjSchema,
|
|
263
|
+
email: emailSchema,
|
|
264
|
+
complement: textField(15).optional(),
|
|
265
|
+
phone: phoneBRSchema,
|
|
266
|
+
district: textField(),
|
|
267
|
+
legal_nature: textField(),
|
|
268
|
+
city: textField(),
|
|
269
|
+
economic_activity_group: textField(),
|
|
270
|
+
state: textField(2),
|
|
271
|
+
economic_activity: textField(),
|
|
272
|
+
monthly_income: currencySchema
|
|
273
|
+
}).strict(),
|
|
274
|
+
financing_company_guarantor: zod.z.array(
|
|
275
|
+
zod.z.object({
|
|
276
|
+
name: textField(),
|
|
277
|
+
cep: cepSchema,
|
|
278
|
+
cpf: cpfSchema,
|
|
279
|
+
address: textField(),
|
|
280
|
+
birth_date: birthDateSchema,
|
|
281
|
+
number: textField(),
|
|
282
|
+
complement: textField(15).optional(),
|
|
283
|
+
cellphone: phoneBRSchema,
|
|
284
|
+
email: emailSchema,
|
|
285
|
+
district: textField(),
|
|
286
|
+
sex: SexEnum,
|
|
287
|
+
city: textField(),
|
|
288
|
+
state: textField(2),
|
|
289
|
+
office: textField(),
|
|
290
|
+
mother_name: textField(),
|
|
291
|
+
nationality: textField()
|
|
292
|
+
}).strict()
|
|
293
|
+
)
|
|
294
|
+
});
|
|
295
|
+
var alfaPjSchema = alfaPjObject.strict().superRefine(applyPjRefinements);
|
|
296
|
+
var bancoDoBrasilPfObject = zod.z.object({
|
|
297
|
+
...formalizationExtras,
|
|
298
|
+
name: textField(),
|
|
299
|
+
cep: cepSchema,
|
|
300
|
+
cpf: cpfSchema,
|
|
301
|
+
address: textField(),
|
|
302
|
+
birth_date: birthDateSchema,
|
|
303
|
+
number: textField(),
|
|
304
|
+
sex: SexEnum,
|
|
305
|
+
complement: textField(15).optional(),
|
|
306
|
+
mother_name: textField(),
|
|
307
|
+
district: textField(),
|
|
308
|
+
energy_account_in_requester_name: textField(),
|
|
309
|
+
city: textField(),
|
|
310
|
+
energy_bill_owner_document: cpfCnpjSchema.optional(),
|
|
311
|
+
state: textField(2),
|
|
312
|
+
nationality: textField(),
|
|
313
|
+
cellphone: phoneBRSchema,
|
|
314
|
+
email: emailSchema,
|
|
315
|
+
monthly_income: currencySchema,
|
|
316
|
+
profession: textField(),
|
|
317
|
+
type_doc: DocumentTypeEnum,
|
|
318
|
+
doc: textField(15),
|
|
319
|
+
issuing_body: textField(6),
|
|
320
|
+
doc_issue_date: issueDateSchema
|
|
321
|
+
});
|
|
322
|
+
var bancoDoBrasilPfSchema = bancoDoBrasilPfObject.strict().superRefine(applyPfRefinements);
|
|
323
|
+
var bancoDoBrasilPjObject = zod.z.object({
|
|
324
|
+
...formalizationExtras,
|
|
325
|
+
financing_company: zod.z.object({
|
|
326
|
+
corporate_name: textField(),
|
|
327
|
+
cep: cepSchema,
|
|
328
|
+
address: textField(),
|
|
329
|
+
foundation_date: issueDateSchema,
|
|
330
|
+
number: textField(),
|
|
331
|
+
cnpj: cnpjSchema,
|
|
332
|
+
email: emailSchema,
|
|
333
|
+
complement: textField(15).optional(),
|
|
334
|
+
phone: phoneBRSchema,
|
|
335
|
+
district: textField(),
|
|
336
|
+
legal_nature: textField(),
|
|
337
|
+
city: textField(),
|
|
338
|
+
economic_activity_group: textField(),
|
|
339
|
+
state: textField(2),
|
|
340
|
+
economic_activity: textField(),
|
|
341
|
+
monthly_income: currencySchema
|
|
342
|
+
}).strict(),
|
|
343
|
+
financing_company_guarantor: zod.z.array(
|
|
344
|
+
zod.z.object({
|
|
345
|
+
name: textField(),
|
|
346
|
+
cep: cepSchema,
|
|
347
|
+
cpf: cpfSchema,
|
|
348
|
+
address: textField(),
|
|
349
|
+
birth_date: birthDateSchema,
|
|
350
|
+
number: textField(),
|
|
351
|
+
complement: textField(15).optional(),
|
|
352
|
+
cellphone: phoneBRSchema,
|
|
353
|
+
email: emailSchema,
|
|
354
|
+
district: textField(),
|
|
355
|
+
sex: SexEnum,
|
|
356
|
+
city: textField(),
|
|
357
|
+
state: textField(2),
|
|
358
|
+
office: textField(),
|
|
359
|
+
mother_name: textField(),
|
|
360
|
+
nationality: textField()
|
|
361
|
+
}).strict()
|
|
362
|
+
)
|
|
363
|
+
});
|
|
364
|
+
var bancoDoBrasilPjSchema = bancoDoBrasilPjObject.strict().superRefine(applyPjRefinements);
|
|
365
|
+
var btgPfObject = zod.z.object({
|
|
366
|
+
...formalizationExtras,
|
|
367
|
+
name: textField(),
|
|
368
|
+
cep: cepSchema,
|
|
369
|
+
cpf: cpfSchema,
|
|
370
|
+
address: textField(),
|
|
371
|
+
birth_date: birthDateSchema,
|
|
372
|
+
number: textField(),
|
|
373
|
+
sex: SexEnum,
|
|
374
|
+
complement: textField(15).optional(),
|
|
375
|
+
mother_name: textField(),
|
|
376
|
+
district: textField(),
|
|
377
|
+
energy_account_in_requester_name: textField(),
|
|
378
|
+
city: textField(),
|
|
379
|
+
energy_bill_owner_document: cpfCnpjSchema.optional(),
|
|
380
|
+
state: textField(2),
|
|
381
|
+
nationality: textField(),
|
|
382
|
+
cellphone: phoneBRSchema,
|
|
383
|
+
email: emailSchema,
|
|
384
|
+
monthly_income: currencySchema,
|
|
385
|
+
profession: textField(),
|
|
386
|
+
type_doc: DocumentTypeEnum,
|
|
387
|
+
doc: textField(15),
|
|
388
|
+
issuing_body: textField(6),
|
|
389
|
+
doc_issue_date: issueDateSchema
|
|
390
|
+
});
|
|
391
|
+
var btgPfSchema = btgPfObject.strict().superRefine(applyPfRefinements);
|
|
392
|
+
var btgPjObject = zod.z.object({
|
|
393
|
+
...formalizationExtras,
|
|
394
|
+
financing_company: zod.z.object({
|
|
395
|
+
corporate_name: textField(),
|
|
396
|
+
cep: cepSchema,
|
|
397
|
+
address: textField(),
|
|
398
|
+
foundation_date: issueDateSchema,
|
|
399
|
+
number: textField(),
|
|
400
|
+
cnpj: cnpjSchema,
|
|
401
|
+
email: emailSchema,
|
|
402
|
+
complement: textField(15).optional(),
|
|
403
|
+
phone: phoneBRSchema,
|
|
404
|
+
district: textField(),
|
|
405
|
+
legal_nature: textField(),
|
|
406
|
+
city: textField(),
|
|
407
|
+
economic_activity_group: textField(),
|
|
408
|
+
state: textField(2),
|
|
409
|
+
economic_activity: textField(),
|
|
410
|
+
monthly_income: currencySchema
|
|
411
|
+
}).strict(),
|
|
412
|
+
financing_company_guarantor: zod.z.array(
|
|
413
|
+
zod.z.object({
|
|
414
|
+
name: textField(),
|
|
415
|
+
cep: cepSchema,
|
|
416
|
+
cpf: cpfSchema,
|
|
417
|
+
address: textField(),
|
|
418
|
+
birth_date: birthDateSchema,
|
|
419
|
+
number: textField(),
|
|
420
|
+
complement: textField(15).optional(),
|
|
421
|
+
cellphone: phoneBRSchema,
|
|
422
|
+
phone: phoneBRSchema,
|
|
423
|
+
email: emailSchema,
|
|
424
|
+
district: textField(),
|
|
425
|
+
sex: SexEnum,
|
|
426
|
+
city: textField(),
|
|
427
|
+
state: textField(2),
|
|
428
|
+
civil_status: textField(),
|
|
429
|
+
office: textField(),
|
|
430
|
+
type_doc: DocumentTypeEnum,
|
|
431
|
+
doc: textField(),
|
|
432
|
+
issuing_body: textField(),
|
|
433
|
+
uf_issuing_body: textField(2),
|
|
434
|
+
doc_issue_date: issueDateSchema,
|
|
435
|
+
doc_expiration_date: dateDMYSchema,
|
|
436
|
+
mother_name: textField(),
|
|
437
|
+
monthly_income: currencySchema,
|
|
438
|
+
patrimony: currencySchema,
|
|
439
|
+
uf_naturalness: textField(2),
|
|
440
|
+
nationality: textField()
|
|
441
|
+
}).strict()
|
|
442
|
+
)
|
|
443
|
+
});
|
|
444
|
+
var btgPjSchema = btgPjObject.strict().superRefine(applyPjRefinements);
|
|
445
|
+
var bvPfObject = zod.z.object({
|
|
446
|
+
...formalizationExtras,
|
|
447
|
+
name: textField(),
|
|
448
|
+
cep: cepSchema,
|
|
449
|
+
residence_situation: textField(),
|
|
450
|
+
cpf: cpfSchema,
|
|
451
|
+
address: textField(),
|
|
452
|
+
months_in_residence: integerField,
|
|
453
|
+
birth_date: birthDateSchema,
|
|
454
|
+
number: textField(),
|
|
455
|
+
sex: SexEnum,
|
|
456
|
+
complement: textField(15).optional(),
|
|
457
|
+
is_installation_at_requester: textField(),
|
|
458
|
+
mother_name: textField(),
|
|
459
|
+
district: textField(),
|
|
460
|
+
energy_account_in_requester_name: textField(),
|
|
461
|
+
city: textField(),
|
|
462
|
+
energy_bill_owner_document: cpfCnpjSchema.optional(),
|
|
463
|
+
civil_status: textField(),
|
|
464
|
+
state: textField(2),
|
|
465
|
+
nationality: textField(),
|
|
466
|
+
uf_naturalness: textField(2),
|
|
467
|
+
naturalness: textField(),
|
|
468
|
+
cellphone: phoneBRSchema,
|
|
469
|
+
email: emailSchema,
|
|
470
|
+
monthly_income: currencySchema,
|
|
471
|
+
profession: textField(),
|
|
472
|
+
nature_of_occupation: textField(),
|
|
473
|
+
company_time: numberField,
|
|
474
|
+
cnpj_proprietary: cnpjSchema.optional(),
|
|
475
|
+
equity_value: currencySchema,
|
|
476
|
+
type_doc: DocumentTypeEnum,
|
|
477
|
+
doc: textField(15),
|
|
478
|
+
issuing_body: textField(6),
|
|
479
|
+
emitting_state: textField(2),
|
|
480
|
+
doc_issue_date: issueDateSchema,
|
|
481
|
+
pep_relationship: textField().optional()
|
|
482
|
+
});
|
|
483
|
+
var bvPfSchema = bvPfObject.strict().superRefine(applyPfRefinements);
|
|
484
|
+
var bvPjObject = zod.z.object({
|
|
485
|
+
...formalizationExtras,
|
|
486
|
+
financing_company: zod.z.object({
|
|
487
|
+
corporate_name: textField(),
|
|
488
|
+
cep: cepSchema,
|
|
489
|
+
residence_situation: textField(),
|
|
490
|
+
address: textField(),
|
|
491
|
+
foundation_date: issueDateSchema,
|
|
492
|
+
months_in_residence: integerField,
|
|
493
|
+
number: textField(),
|
|
494
|
+
cnpj: cnpjSchema,
|
|
495
|
+
email: emailSchema,
|
|
496
|
+
complement: textField(15).optional(),
|
|
497
|
+
phone: phoneBRSchema,
|
|
498
|
+
district: textField(),
|
|
499
|
+
legal_nature: textField(),
|
|
500
|
+
city: textField(),
|
|
501
|
+
economic_activity_group: textField(),
|
|
502
|
+
state: textField(2),
|
|
503
|
+
economic_activity: textField(),
|
|
504
|
+
monthly_income: currencySchema,
|
|
505
|
+
capital_social: currencySchema
|
|
506
|
+
}).strict(),
|
|
507
|
+
financing_company_guarantor: zod.z.array(
|
|
508
|
+
zod.z.object({
|
|
509
|
+
name: textField(),
|
|
510
|
+
cep: cepSchema,
|
|
511
|
+
cpf: cpfSchema,
|
|
512
|
+
address: textField(),
|
|
513
|
+
birth_date: birthDateSchema,
|
|
514
|
+
number: textField(),
|
|
515
|
+
complement: textField(15).optional(),
|
|
516
|
+
cellphone: phoneBRSchema,
|
|
517
|
+
phone: phoneBRSchema,
|
|
518
|
+
email: emailSchema,
|
|
519
|
+
district: textField(),
|
|
520
|
+
sex: SexEnum,
|
|
521
|
+
city: textField(),
|
|
522
|
+
state: textField(2),
|
|
523
|
+
civil_status: textField(),
|
|
524
|
+
residence_situation: textField(),
|
|
525
|
+
office: textField(),
|
|
526
|
+
months_in_residence: integerField,
|
|
527
|
+
type_doc: DocumentTypeEnum,
|
|
528
|
+
doc: textField(),
|
|
529
|
+
issuing_body: textField(),
|
|
530
|
+
uf_issuing_body: textField(2),
|
|
531
|
+
doc_issue_date: issueDateSchema,
|
|
532
|
+
doc_expiration_date: dateDMYSchema,
|
|
533
|
+
mother_name: textField(),
|
|
534
|
+
monthly_income: currencySchema,
|
|
535
|
+
patrimony: currencySchema,
|
|
536
|
+
naturalness: textField(),
|
|
537
|
+
uf_naturalness: textField(2),
|
|
538
|
+
nationality: textField(),
|
|
539
|
+
pep_relationship: textField()
|
|
540
|
+
}).strict()
|
|
541
|
+
)
|
|
542
|
+
});
|
|
543
|
+
var bvPjSchema = bvPjObject.strict().superRefine(applyPjRefinements);
|
|
544
|
+
var caixaEconomicaFederalPfObject = zod.z.object({
|
|
545
|
+
...formalizationExtras,
|
|
546
|
+
name: textField(),
|
|
547
|
+
cep: cepSchema,
|
|
548
|
+
cpf: cpfSchema,
|
|
549
|
+
address: textField(),
|
|
550
|
+
birth_date: birthDateSchema,
|
|
551
|
+
number: textField(),
|
|
552
|
+
sex: SexEnum,
|
|
553
|
+
complement: textField(15).optional(),
|
|
554
|
+
mother_name: textField(),
|
|
555
|
+
district: textField(),
|
|
556
|
+
energy_account_in_requester_name: textField(),
|
|
557
|
+
city: textField(),
|
|
558
|
+
energy_bill_owner_document: cpfCnpjSchema.optional(),
|
|
559
|
+
state: textField(2),
|
|
560
|
+
nationality: textField(),
|
|
561
|
+
cellphone: phoneBRSchema,
|
|
562
|
+
email: emailSchema,
|
|
563
|
+
monthly_income: currencySchema,
|
|
564
|
+
profession: textField(),
|
|
565
|
+
type_doc: DocumentTypeEnum,
|
|
566
|
+
doc: textField(15),
|
|
567
|
+
issuing_body: textField(6),
|
|
568
|
+
doc_issue_date: issueDateSchema
|
|
569
|
+
});
|
|
570
|
+
var caixaEconomicaFederalPfSchema = caixaEconomicaFederalPfObject.strict().superRefine(applyPfRefinements);
|
|
571
|
+
var caixaEconomicaFederalPjObject = zod.z.object({
|
|
572
|
+
...formalizationExtras,
|
|
573
|
+
financing_company: zod.z.object({
|
|
574
|
+
corporate_name: textField(),
|
|
575
|
+
cep: cepSchema,
|
|
576
|
+
address: textField(),
|
|
577
|
+
foundation_date: issueDateSchema,
|
|
578
|
+
number: textField(),
|
|
579
|
+
cnpj: cnpjSchema,
|
|
580
|
+
email: emailSchema,
|
|
581
|
+
complement: textField(15).optional(),
|
|
582
|
+
phone: phoneBRSchema,
|
|
583
|
+
district: textField(),
|
|
584
|
+
legal_nature: textField(),
|
|
585
|
+
city: textField(),
|
|
586
|
+
economic_activity_group: textField(),
|
|
587
|
+
state: textField(2),
|
|
588
|
+
economic_activity: textField(),
|
|
589
|
+
monthly_income: currencySchema
|
|
590
|
+
}).strict(),
|
|
591
|
+
financing_company_guarantor: zod.z.array(
|
|
592
|
+
zod.z.object({
|
|
593
|
+
name: textField(),
|
|
594
|
+
cep: cepSchema,
|
|
595
|
+
cpf: cpfSchema,
|
|
596
|
+
address: textField(),
|
|
597
|
+
birth_date: birthDateSchema,
|
|
598
|
+
number: textField(),
|
|
599
|
+
complement: textField(15).optional(),
|
|
600
|
+
cellphone: phoneBRSchema,
|
|
601
|
+
email: emailSchema,
|
|
602
|
+
district: textField(),
|
|
603
|
+
sex: SexEnum,
|
|
604
|
+
city: textField(),
|
|
605
|
+
state: textField(2),
|
|
606
|
+
office: textField(),
|
|
607
|
+
mother_name: textField(),
|
|
608
|
+
nationality: textField()
|
|
609
|
+
}).strict()
|
|
610
|
+
)
|
|
611
|
+
});
|
|
612
|
+
var caixaEconomicaFederalPjSchema = caixaEconomicaFederalPjObject.strict().superRefine(applyPjRefinements);
|
|
613
|
+
var cashMePfObject = zod.z.object({
|
|
614
|
+
...formalizationExtras,
|
|
615
|
+
name: textField(),
|
|
616
|
+
cep: cepSchema,
|
|
617
|
+
cpf: cpfSchema,
|
|
618
|
+
address: textField(),
|
|
619
|
+
birth_date: birthDateSchema,
|
|
620
|
+
number: textField(),
|
|
621
|
+
sex: SexEnum,
|
|
622
|
+
complement: textField(15).optional(),
|
|
623
|
+
mother_name: textField(),
|
|
624
|
+
district: textField(),
|
|
625
|
+
energy_account_in_requester_name: textField(),
|
|
626
|
+
city: textField(),
|
|
627
|
+
energy_bill_owner_document: cpfCnpjSchema.optional(),
|
|
628
|
+
state: textField(2),
|
|
629
|
+
nationality: textField(),
|
|
630
|
+
cellphone: phoneBRSchema,
|
|
631
|
+
email: emailSchema,
|
|
632
|
+
monthly_income: currencySchema,
|
|
633
|
+
profession: textField(),
|
|
634
|
+
type_doc: DocumentTypeEnum,
|
|
635
|
+
doc: textField(15),
|
|
636
|
+
issuing_body: textField(6),
|
|
637
|
+
doc_issue_date: issueDateSchema
|
|
638
|
+
});
|
|
639
|
+
var cashMePfSchema = cashMePfObject.strict().superRefine(applyPfRefinements);
|
|
640
|
+
var cashMePjObject = zod.z.object({
|
|
641
|
+
...formalizationExtras,
|
|
642
|
+
financing_company: zod.z.object({
|
|
643
|
+
corporate_name: textField(),
|
|
644
|
+
cep: cepSchema,
|
|
645
|
+
address: textField(),
|
|
646
|
+
foundation_date: issueDateSchema,
|
|
647
|
+
number: textField(),
|
|
648
|
+
cnpj: cnpjSchema,
|
|
649
|
+
email: emailSchema,
|
|
650
|
+
complement: textField(15).optional(),
|
|
651
|
+
phone: phoneBRSchema,
|
|
652
|
+
district: textField(),
|
|
653
|
+
legal_nature: textField(),
|
|
654
|
+
city: textField(),
|
|
655
|
+
economic_activity_group: textField(),
|
|
656
|
+
state: textField(2),
|
|
657
|
+
economic_activity: textField(),
|
|
658
|
+
monthly_income: currencySchema
|
|
659
|
+
}).strict(),
|
|
660
|
+
financing_company_guarantor: zod.z.array(
|
|
661
|
+
zod.z.object({
|
|
662
|
+
name: textField(),
|
|
663
|
+
cep: cepSchema,
|
|
664
|
+
cpf: cpfSchema,
|
|
665
|
+
address: textField(),
|
|
666
|
+
birth_date: birthDateSchema,
|
|
667
|
+
number: textField(),
|
|
668
|
+
complement: textField(15).optional(),
|
|
669
|
+
cellphone: phoneBRSchema,
|
|
670
|
+
email: emailSchema,
|
|
671
|
+
district: textField(),
|
|
672
|
+
sex: SexEnum,
|
|
673
|
+
city: textField(),
|
|
674
|
+
state: textField(2),
|
|
675
|
+
office: textField(),
|
|
676
|
+
mother_name: textField(),
|
|
677
|
+
nationality: textField()
|
|
678
|
+
}).strict()
|
|
679
|
+
)
|
|
680
|
+
});
|
|
681
|
+
var cashMePjSchema = cashMePjObject.strict().superRefine(applyPjRefinements);
|
|
682
|
+
var credito77PfObject = zod.z.object({
|
|
683
|
+
...formalizationExtras,
|
|
684
|
+
name: textField(),
|
|
685
|
+
cep: cepSchema,
|
|
686
|
+
cpf: cpfSchema,
|
|
687
|
+
address: textField(),
|
|
688
|
+
birth_date: birthDateSchema,
|
|
689
|
+
number: textField(),
|
|
690
|
+
sex: SexEnum,
|
|
691
|
+
complement: textField(15).optional(),
|
|
692
|
+
mother_name: textField(),
|
|
693
|
+
district: textField(),
|
|
694
|
+
energy_account_in_requester_name: textField(),
|
|
695
|
+
city: textField(),
|
|
696
|
+
energy_bill_owner_document: cpfCnpjSchema.optional(),
|
|
697
|
+
state: textField(2),
|
|
698
|
+
nationality: textField(),
|
|
699
|
+
cellphone: phoneBRSchema,
|
|
700
|
+
email: emailSchema,
|
|
701
|
+
monthly_income: currencySchema,
|
|
702
|
+
profession: textField(),
|
|
703
|
+
type_doc: DocumentTypeEnum,
|
|
704
|
+
doc: textField(15),
|
|
705
|
+
issuing_body: textField(6),
|
|
706
|
+
doc_issue_date: issueDateSchema
|
|
707
|
+
});
|
|
708
|
+
var credito77PfSchema = credito77PfObject.strict().superRefine(applyPfRefinements);
|
|
709
|
+
var credito77PjObject = zod.z.object({
|
|
710
|
+
...formalizationExtras,
|
|
711
|
+
financing_company: zod.z.object({
|
|
712
|
+
corporate_name: textField(),
|
|
713
|
+
cep: cepSchema,
|
|
714
|
+
address: textField(),
|
|
715
|
+
foundation_date: issueDateSchema,
|
|
716
|
+
number: textField(),
|
|
717
|
+
cnpj: cnpjSchema,
|
|
718
|
+
email: emailSchema,
|
|
719
|
+
complement: textField(15).optional(),
|
|
720
|
+
phone: phoneBRSchema,
|
|
721
|
+
district: textField(),
|
|
722
|
+
legal_nature: textField(),
|
|
723
|
+
city: textField(),
|
|
724
|
+
economic_activity_group: textField(),
|
|
725
|
+
state: textField(2),
|
|
726
|
+
economic_activity: textField(),
|
|
727
|
+
monthly_income: currencySchema
|
|
728
|
+
}).strict(),
|
|
729
|
+
financing_company_guarantor: zod.z.array(
|
|
730
|
+
zod.z.object({
|
|
731
|
+
name: textField(),
|
|
732
|
+
cep: cepSchema,
|
|
733
|
+
cpf: cpfSchema,
|
|
734
|
+
address: textField(),
|
|
735
|
+
birth_date: birthDateSchema,
|
|
736
|
+
number: textField(),
|
|
737
|
+
complement: textField(15).optional(),
|
|
738
|
+
cellphone: phoneBRSchema,
|
|
739
|
+
email: emailSchema,
|
|
740
|
+
district: textField(),
|
|
741
|
+
sex: SexEnum,
|
|
742
|
+
city: textField(),
|
|
743
|
+
state: textField(2),
|
|
744
|
+
office: textField(),
|
|
745
|
+
mother_name: textField(),
|
|
746
|
+
nationality: textField()
|
|
747
|
+
}).strict()
|
|
748
|
+
)
|
|
749
|
+
});
|
|
750
|
+
var credito77PjSchema = credito77PjObject.strict().superRefine(applyPjRefinements);
|
|
751
|
+
var eosPfObject = zod.z.object({
|
|
752
|
+
...formalizationExtras,
|
|
753
|
+
name: textField(),
|
|
754
|
+
cep: cepSchema,
|
|
755
|
+
cpf: cpfSchema,
|
|
756
|
+
address: textField(),
|
|
757
|
+
birth_date: birthDateSchema,
|
|
758
|
+
number: textField(),
|
|
759
|
+
sex: SexEnum,
|
|
760
|
+
complement: textField(15).optional(),
|
|
761
|
+
mother_name: textField(),
|
|
762
|
+
district: textField(),
|
|
763
|
+
energy_account_in_requester_name: textField(),
|
|
764
|
+
city: textField(),
|
|
765
|
+
energy_bill_owner_document: cpfCnpjSchema.optional(),
|
|
766
|
+
state: textField(2),
|
|
767
|
+
nationality: textField(),
|
|
768
|
+
cellphone: phoneBRSchema,
|
|
769
|
+
email: emailSchema,
|
|
770
|
+
monthly_income: currencySchema,
|
|
771
|
+
profession: textField(),
|
|
772
|
+
type_doc: DocumentTypeEnum,
|
|
773
|
+
doc: textField(15),
|
|
774
|
+
issuing_body: textField(6),
|
|
775
|
+
doc_issue_date: issueDateSchema
|
|
776
|
+
});
|
|
777
|
+
var eosPfSchema = eosPfObject.strict().superRefine(applyPfRefinements);
|
|
778
|
+
var eosPjObject = zod.z.object({
|
|
779
|
+
...formalizationExtras,
|
|
780
|
+
financing_company: zod.z.object({
|
|
781
|
+
corporate_name: textField(),
|
|
782
|
+
cep: cepSchema,
|
|
783
|
+
address: textField(),
|
|
784
|
+
foundation_date: issueDateSchema,
|
|
785
|
+
number: textField(),
|
|
786
|
+
cnpj: cnpjSchema,
|
|
787
|
+
email: emailSchema,
|
|
788
|
+
complement: textField(15).optional(),
|
|
789
|
+
phone: phoneBRSchema,
|
|
790
|
+
district: textField(),
|
|
791
|
+
legal_nature: textField(),
|
|
792
|
+
city: textField(),
|
|
793
|
+
economic_activity_group: textField(),
|
|
794
|
+
state: textField(2),
|
|
795
|
+
economic_activity: textField(),
|
|
796
|
+
monthly_income: currencySchema
|
|
797
|
+
}).strict(),
|
|
798
|
+
financing_company_guarantor: zod.z.array(
|
|
799
|
+
zod.z.object({
|
|
800
|
+
name: textField(),
|
|
801
|
+
cep: cepSchema,
|
|
802
|
+
cpf: cpfSchema,
|
|
803
|
+
address: textField(),
|
|
804
|
+
birth_date: birthDateSchema,
|
|
805
|
+
number: textField(),
|
|
806
|
+
complement: textField(15).optional(),
|
|
807
|
+
cellphone: phoneBRSchema,
|
|
808
|
+
email: emailSchema,
|
|
809
|
+
district: textField(),
|
|
810
|
+
sex: SexEnum,
|
|
811
|
+
city: textField(),
|
|
812
|
+
state: textField(2),
|
|
813
|
+
office: textField(),
|
|
814
|
+
mother_name: textField(),
|
|
815
|
+
nationality: textField()
|
|
816
|
+
}).strict()
|
|
817
|
+
)
|
|
818
|
+
});
|
|
819
|
+
var eosPjSchema = eosPjObject.strict().superRefine(applyPjRefinements);
|
|
820
|
+
var hdtEnergyPfObject = zod.z.object({
|
|
821
|
+
...formalizationExtras,
|
|
822
|
+
name: textField(),
|
|
823
|
+
cep: cepSchema,
|
|
824
|
+
cpf: cpfSchema,
|
|
825
|
+
address: textField(),
|
|
826
|
+
birth_date: birthDateSchema,
|
|
827
|
+
number: textField(),
|
|
828
|
+
sex: SexEnum,
|
|
829
|
+
complement: textField(15).optional(),
|
|
830
|
+
mother_name: textField(),
|
|
831
|
+
district: textField(),
|
|
832
|
+
energy_account_in_requester_name: textField(),
|
|
833
|
+
city: textField(),
|
|
834
|
+
energy_bill_owner_document: cpfCnpjSchema.optional(),
|
|
835
|
+
state: textField(2),
|
|
836
|
+
nationality: textField(),
|
|
837
|
+
cellphone: phoneBRSchema,
|
|
838
|
+
email: emailSchema,
|
|
839
|
+
monthly_income: currencySchema,
|
|
840
|
+
profession: textField(),
|
|
841
|
+
type_doc: DocumentTypeEnum,
|
|
842
|
+
doc: textField(15),
|
|
843
|
+
issuing_body: textField(6),
|
|
844
|
+
doc_issue_date: issueDateSchema
|
|
845
|
+
});
|
|
846
|
+
var hdtEnergyPfSchema = hdtEnergyPfObject.strict().superRefine(applyPfRefinements);
|
|
847
|
+
var hdtEnergyPjObject = zod.z.object({
|
|
848
|
+
...formalizationExtras,
|
|
849
|
+
financing_company: zod.z.object({
|
|
850
|
+
corporate_name: textField(),
|
|
851
|
+
cep: cepSchema,
|
|
852
|
+
address: textField(),
|
|
853
|
+
foundation_date: issueDateSchema,
|
|
854
|
+
number: textField(),
|
|
855
|
+
cnpj: cnpjSchema,
|
|
856
|
+
email: emailSchema,
|
|
857
|
+
complement: textField(15).optional(),
|
|
858
|
+
phone: phoneBRSchema,
|
|
859
|
+
district: textField(),
|
|
860
|
+
legal_nature: textField(),
|
|
861
|
+
city: textField(),
|
|
862
|
+
economic_activity_group: textField(),
|
|
863
|
+
state: textField(2),
|
|
864
|
+
economic_activity: textField(),
|
|
865
|
+
monthly_income: currencySchema
|
|
866
|
+
}).strict(),
|
|
867
|
+
financing_company_guarantor: zod.z.array(
|
|
868
|
+
zod.z.object({
|
|
869
|
+
name: textField(),
|
|
870
|
+
cep: cepSchema,
|
|
871
|
+
cpf: cpfSchema,
|
|
872
|
+
address: textField(),
|
|
873
|
+
birth_date: birthDateSchema,
|
|
874
|
+
number: textField(),
|
|
875
|
+
complement: textField(15).optional(),
|
|
876
|
+
cellphone: phoneBRSchema,
|
|
877
|
+
email: emailSchema,
|
|
878
|
+
district: textField(),
|
|
879
|
+
sex: SexEnum,
|
|
880
|
+
city: textField(),
|
|
881
|
+
state: textField(2),
|
|
882
|
+
office: textField(),
|
|
883
|
+
mother_name: textField(),
|
|
884
|
+
nationality: textField()
|
|
885
|
+
}).strict()
|
|
886
|
+
)
|
|
887
|
+
});
|
|
888
|
+
var hdtEnergyPjSchema = hdtEnergyPjObject.strict().superRefine(applyPjRefinements);
|
|
889
|
+
var losangoPfObject = zod.z.object({
|
|
890
|
+
...formalizationExtras,
|
|
891
|
+
name: textField(),
|
|
892
|
+
cep: cepSchema,
|
|
893
|
+
cpf: cpfSchema,
|
|
894
|
+
address: textField(),
|
|
895
|
+
birth_date: birthDateSchema,
|
|
896
|
+
number: textField(),
|
|
897
|
+
sex: SexEnum,
|
|
898
|
+
complement: textField(15).optional(),
|
|
899
|
+
mother_name: textField(),
|
|
900
|
+
district: textField(),
|
|
901
|
+
energy_account_in_requester_name: textField(),
|
|
902
|
+
city: textField(),
|
|
903
|
+
energy_bill_owner_document: cpfCnpjSchema.optional(),
|
|
904
|
+
state: textField(2),
|
|
905
|
+
nationality: textField(),
|
|
906
|
+
cellphone: phoneBRSchema,
|
|
907
|
+
email: emailSchema,
|
|
908
|
+
monthly_income: currencySchema,
|
|
909
|
+
profession: textField(),
|
|
910
|
+
type_doc: DocumentTypeEnum,
|
|
911
|
+
doc: textField(15),
|
|
912
|
+
issuing_body: textField(6),
|
|
913
|
+
doc_issue_date: issueDateSchema
|
|
914
|
+
});
|
|
915
|
+
var losangoPfSchema = losangoPfObject.strict().superRefine(applyPfRefinements);
|
|
916
|
+
var losangoPjObject = zod.z.object({
|
|
917
|
+
...formalizationExtras,
|
|
918
|
+
financing_company: zod.z.object({
|
|
919
|
+
corporate_name: textField(),
|
|
920
|
+
cep: cepSchema,
|
|
921
|
+
address: textField(),
|
|
922
|
+
foundation_date: issueDateSchema,
|
|
923
|
+
number: textField(),
|
|
924
|
+
cnpj: cnpjSchema,
|
|
925
|
+
email: emailSchema,
|
|
926
|
+
complement: textField(15).optional(),
|
|
927
|
+
phone: phoneBRSchema,
|
|
928
|
+
district: textField(),
|
|
929
|
+
legal_nature: textField(),
|
|
930
|
+
city: textField(),
|
|
931
|
+
economic_activity_group: textField(),
|
|
932
|
+
state: textField(2),
|
|
933
|
+
economic_activity: textField(),
|
|
934
|
+
monthly_income: currencySchema
|
|
935
|
+
}).strict(),
|
|
936
|
+
financing_company_guarantor: zod.z.array(
|
|
937
|
+
zod.z.object({
|
|
938
|
+
name: textField(),
|
|
939
|
+
cep: cepSchema,
|
|
940
|
+
cpf: cpfSchema,
|
|
941
|
+
address: textField(),
|
|
942
|
+
birth_date: birthDateSchema,
|
|
943
|
+
number: textField(),
|
|
944
|
+
complement: textField(15).optional(),
|
|
945
|
+
cellphone: phoneBRSchema,
|
|
946
|
+
email: emailSchema,
|
|
947
|
+
district: textField(),
|
|
948
|
+
sex: SexEnum,
|
|
949
|
+
city: textField(),
|
|
950
|
+
state: textField(2),
|
|
951
|
+
office: textField(),
|
|
952
|
+
mother_name: textField(),
|
|
953
|
+
nationality: textField()
|
|
954
|
+
}).strict()
|
|
955
|
+
)
|
|
956
|
+
});
|
|
957
|
+
var losangoPjSchema = losangoPjObject.strict().superRefine(applyPjRefinements);
|
|
958
|
+
var safraPfObject = zod.z.object({
|
|
959
|
+
...formalizationExtras,
|
|
960
|
+
name: textField(),
|
|
961
|
+
cep: cepSchema,
|
|
962
|
+
cpf: cpfSchema,
|
|
963
|
+
address: textField(),
|
|
964
|
+
birth_date: birthDateSchema,
|
|
965
|
+
number: textField(),
|
|
966
|
+
sex: SexEnum,
|
|
967
|
+
complement: textField(15).optional(),
|
|
968
|
+
mother_name: textField(),
|
|
969
|
+
district: textField(),
|
|
970
|
+
energy_account_in_requester_name: textField(),
|
|
971
|
+
city: textField(),
|
|
972
|
+
energy_bill_owner_document: cpfCnpjSchema.optional(),
|
|
973
|
+
state: textField(2),
|
|
974
|
+
nationality: textField(),
|
|
975
|
+
cellphone: phoneBRSchema,
|
|
976
|
+
email: emailSchema,
|
|
977
|
+
monthly_income: currencySchema,
|
|
978
|
+
profession: textField(),
|
|
979
|
+
type_doc: DocumentTypeEnum,
|
|
980
|
+
doc: textField(15),
|
|
981
|
+
issuing_body: textField(6),
|
|
982
|
+
doc_issue_date: issueDateSchema
|
|
983
|
+
});
|
|
984
|
+
var safraPfSchema = safraPfObject.strict().superRefine(applyPfRefinements);
|
|
985
|
+
var safraPjObject = zod.z.object({
|
|
986
|
+
...formalizationExtras,
|
|
987
|
+
financing_company: zod.z.object({
|
|
988
|
+
corporate_name: textField(),
|
|
989
|
+
cep: cepSchema,
|
|
990
|
+
address: textField(),
|
|
991
|
+
foundation_date: issueDateSchema,
|
|
992
|
+
number: textField(),
|
|
993
|
+
cnpj: cnpjSchema,
|
|
994
|
+
email: emailSchema,
|
|
995
|
+
complement: textField(15).optional(),
|
|
996
|
+
phone: phoneBRSchema,
|
|
997
|
+
district: textField(),
|
|
998
|
+
legal_nature: textField(),
|
|
999
|
+
city: textField(),
|
|
1000
|
+
economic_activity_group: textField(),
|
|
1001
|
+
state: textField(2),
|
|
1002
|
+
economic_activity: textField(),
|
|
1003
|
+
monthly_income: currencySchema
|
|
1004
|
+
}).strict(),
|
|
1005
|
+
financing_company_guarantor: zod.z.array(
|
|
1006
|
+
zod.z.object({
|
|
1007
|
+
name: textField(),
|
|
1008
|
+
cep: cepSchema,
|
|
1009
|
+
cpf: cpfSchema,
|
|
1010
|
+
address: textField(),
|
|
1011
|
+
birth_date: birthDateSchema,
|
|
1012
|
+
number: textField(),
|
|
1013
|
+
complement: textField(15).optional(),
|
|
1014
|
+
cellphone: phoneBRSchema,
|
|
1015
|
+
email: emailSchema,
|
|
1016
|
+
district: textField(),
|
|
1017
|
+
sex: SexEnum,
|
|
1018
|
+
city: textField(),
|
|
1019
|
+
state: textField(2),
|
|
1020
|
+
office: textField(),
|
|
1021
|
+
mother_name: textField(),
|
|
1022
|
+
nationality: textField()
|
|
1023
|
+
}).strict()
|
|
1024
|
+
)
|
|
1025
|
+
});
|
|
1026
|
+
var safraPjSchema = safraPjObject.strict().superRefine(applyPjRefinements);
|
|
1027
|
+
var santanderPfObject = zod.z.object({
|
|
1028
|
+
...formalizationExtras,
|
|
1029
|
+
name: textField(),
|
|
1030
|
+
cep: cepSchema,
|
|
1031
|
+
cpf: cpfSchema,
|
|
1032
|
+
address: textField(),
|
|
1033
|
+
birth_date: birthDateSchema,
|
|
1034
|
+
number: textField(),
|
|
1035
|
+
sex: SexEnum,
|
|
1036
|
+
complement: textField(15).optional(),
|
|
1037
|
+
mother_name: textField(),
|
|
1038
|
+
district: textField(),
|
|
1039
|
+
energy_account_in_requester_name: textField(),
|
|
1040
|
+
city: textField(),
|
|
1041
|
+
energy_bill_owner_document: cpfCnpjSchema.optional(),
|
|
1042
|
+
state: textField(2),
|
|
1043
|
+
nationality: textField(),
|
|
1044
|
+
cellphone: phoneBRSchema,
|
|
1045
|
+
email: emailSchema,
|
|
1046
|
+
monthly_income: currencySchema,
|
|
1047
|
+
profession: textField(),
|
|
1048
|
+
type_doc: DocumentTypeEnum,
|
|
1049
|
+
doc: textField(15),
|
|
1050
|
+
issuing_body: textField(6),
|
|
1051
|
+
doc_issue_date: issueDateSchema
|
|
1052
|
+
});
|
|
1053
|
+
var santanderPfSchema = santanderPfObject.strict().superRefine(applyPfRefinements);
|
|
1054
|
+
var santanderPjObject = zod.z.object({
|
|
1055
|
+
...formalizationExtras,
|
|
1056
|
+
financing_company: zod.z.object({
|
|
1057
|
+
corporate_name: textField(),
|
|
1058
|
+
cep: cepSchema,
|
|
1059
|
+
address: textField(),
|
|
1060
|
+
foundation_date: issueDateSchema,
|
|
1061
|
+
number: textField(),
|
|
1062
|
+
cnpj: cnpjSchema,
|
|
1063
|
+
email: emailSchema,
|
|
1064
|
+
complement: textField(15).optional(),
|
|
1065
|
+
phone: phoneBRSchema,
|
|
1066
|
+
district: textField(),
|
|
1067
|
+
legal_nature: textField(),
|
|
1068
|
+
city: textField(),
|
|
1069
|
+
economic_activity_group: textField(),
|
|
1070
|
+
state: textField(2),
|
|
1071
|
+
economic_activity: textField(),
|
|
1072
|
+
monthly_income: currencySchema
|
|
1073
|
+
}).strict(),
|
|
1074
|
+
financing_company_guarantor: zod.z.array(
|
|
1075
|
+
zod.z.object({
|
|
1076
|
+
name: textField(),
|
|
1077
|
+
cep: cepSchema,
|
|
1078
|
+
cpf: cpfSchema,
|
|
1079
|
+
address: textField(),
|
|
1080
|
+
birth_date: birthDateSchema,
|
|
1081
|
+
number: textField(),
|
|
1082
|
+
complement: textField(15).optional(),
|
|
1083
|
+
cellphone: phoneBRSchema,
|
|
1084
|
+
email: emailSchema,
|
|
1085
|
+
district: textField(),
|
|
1086
|
+
sex: SexEnum,
|
|
1087
|
+
city: textField(),
|
|
1088
|
+
state: textField(2),
|
|
1089
|
+
office: textField(),
|
|
1090
|
+
mother_name: textField(),
|
|
1091
|
+
nationality: textField()
|
|
1092
|
+
}).strict()
|
|
1093
|
+
)
|
|
1094
|
+
});
|
|
1095
|
+
var santanderPjSchema = santanderPjObject.strict().superRefine(applyPjRefinements);
|
|
1096
|
+
var solAgoraPfObject = zod.z.object({
|
|
1097
|
+
...formalizationExtras,
|
|
1098
|
+
name: textField(),
|
|
1099
|
+
cep: cepSchema,
|
|
1100
|
+
cpf: cpfSchema,
|
|
1101
|
+
address: textField(),
|
|
1102
|
+
birth_date: birthDateSchema,
|
|
1103
|
+
number: textField(),
|
|
1104
|
+
sex: SexEnum,
|
|
1105
|
+
complement: textField(15).optional(),
|
|
1106
|
+
mother_name: textField(),
|
|
1107
|
+
district: textField(),
|
|
1108
|
+
energy_account_in_requester_name: textField(),
|
|
1109
|
+
city: textField(),
|
|
1110
|
+
energy_bill_owner_document: cpfCnpjSchema.optional(),
|
|
1111
|
+
state: textField(2),
|
|
1112
|
+
nationality: textField(),
|
|
1113
|
+
cellphone: phoneBRSchema,
|
|
1114
|
+
email: emailSchema,
|
|
1115
|
+
monthly_income: currencySchema,
|
|
1116
|
+
profession: textField(),
|
|
1117
|
+
type_doc: DocumentTypeEnum,
|
|
1118
|
+
doc: textField(15),
|
|
1119
|
+
issuing_body: textField(6),
|
|
1120
|
+
doc_issue_date: issueDateSchema
|
|
1121
|
+
});
|
|
1122
|
+
var solAgoraPfSchema = solAgoraPfObject.strict().superRefine(applyPfRefinements);
|
|
1123
|
+
var solAgoraPjObject = zod.z.object({
|
|
1124
|
+
...formalizationExtras,
|
|
1125
|
+
financing_company: zod.z.object({
|
|
1126
|
+
corporate_name: textField(),
|
|
1127
|
+
cep: cepSchema,
|
|
1128
|
+
address: textField(),
|
|
1129
|
+
foundation_date: issueDateSchema,
|
|
1130
|
+
number: textField(),
|
|
1131
|
+
cnpj: cnpjSchema,
|
|
1132
|
+
email: emailSchema,
|
|
1133
|
+
complement: textField(15).optional(),
|
|
1134
|
+
phone: phoneBRSchema,
|
|
1135
|
+
district: textField(),
|
|
1136
|
+
legal_nature: textField(),
|
|
1137
|
+
city: textField(),
|
|
1138
|
+
economic_activity_group: textField(),
|
|
1139
|
+
state: textField(2),
|
|
1140
|
+
economic_activity: textField(),
|
|
1141
|
+
monthly_income: currencySchema
|
|
1142
|
+
}).strict(),
|
|
1143
|
+
financing_company_qsa: zod.z.array(
|
|
1144
|
+
zod.z.object({
|
|
1145
|
+
cep: cepSchema,
|
|
1146
|
+
name: textField(),
|
|
1147
|
+
address: textField(),
|
|
1148
|
+
cpf: cpfSchema,
|
|
1149
|
+
number: textField(),
|
|
1150
|
+
entry_date: issueDateSchema,
|
|
1151
|
+
complement: textField(15).optional(),
|
|
1152
|
+
phone: phoneBRSchema,
|
|
1153
|
+
district: textField(),
|
|
1154
|
+
cellphone: phoneBRSchema,
|
|
1155
|
+
city: textField(),
|
|
1156
|
+
email: emailSchema,
|
|
1157
|
+
state: textField(2),
|
|
1158
|
+
birth_date: birthDateSchema,
|
|
1159
|
+
civil_status: textField(),
|
|
1160
|
+
sex: SexEnum,
|
|
1161
|
+
type_doc: DocumentTypeEnum,
|
|
1162
|
+
doc: textField(),
|
|
1163
|
+
doc_issuance_uf: textField(2),
|
|
1164
|
+
doc_issue_date: issueDateSchema,
|
|
1165
|
+
doc_expiration_date: dateDMYSchema,
|
|
1166
|
+
mother_name: textField(),
|
|
1167
|
+
naturalness: textField(),
|
|
1168
|
+
uf_naturalness: textField(2),
|
|
1169
|
+
nationality: textField()
|
|
1170
|
+
}).strict()
|
|
1171
|
+
)
|
|
1172
|
+
});
|
|
1173
|
+
var solAgoraPjSchema = solAgoraPjObject.strict().superRefine(applyPjRefinements);
|
|
1174
|
+
var solfacilPfObject = zod.z.object({
|
|
1175
|
+
...formalizationExtras,
|
|
1176
|
+
name: textField(),
|
|
1177
|
+
cep: cepSchema,
|
|
1178
|
+
cpf: cpfSchema,
|
|
1179
|
+
address: textField(),
|
|
1180
|
+
birth_date: birthDateSchema,
|
|
1181
|
+
number: textField(),
|
|
1182
|
+
sex: SexEnum,
|
|
1183
|
+
complement: textField(15).optional(),
|
|
1184
|
+
mother_name: textField(),
|
|
1185
|
+
district: textField(),
|
|
1186
|
+
energy_account_in_requester_name: textField(),
|
|
1187
|
+
city: textField(),
|
|
1188
|
+
energy_bill_owner_document: cpfCnpjSchema.optional(),
|
|
1189
|
+
state: textField(2),
|
|
1190
|
+
nationality: textField(),
|
|
1191
|
+
cellphone: phoneBRSchema,
|
|
1192
|
+
email: emailSchema,
|
|
1193
|
+
monthly_income: currencySchema,
|
|
1194
|
+
profession: textField(),
|
|
1195
|
+
type_doc: DocumentTypeEnum,
|
|
1196
|
+
doc: textField(15),
|
|
1197
|
+
issuing_body: textField(6),
|
|
1198
|
+
doc_issue_date: issueDateSchema
|
|
1199
|
+
});
|
|
1200
|
+
var solfacilPfSchema = solfacilPfObject.strict().superRefine(applyPfRefinements);
|
|
1201
|
+
var solfacilPjObject = zod.z.object({
|
|
1202
|
+
...formalizationExtras,
|
|
1203
|
+
financing_company: zod.z.object({
|
|
1204
|
+
corporate_name: textField(),
|
|
1205
|
+
cep: cepSchema,
|
|
1206
|
+
address: textField(),
|
|
1207
|
+
foundation_date: issueDateSchema,
|
|
1208
|
+
number: textField(),
|
|
1209
|
+
cnpj: cnpjSchema,
|
|
1210
|
+
email: emailSchema,
|
|
1211
|
+
complement: textField(15).optional(),
|
|
1212
|
+
phone: phoneBRSchema,
|
|
1213
|
+
district: textField(),
|
|
1214
|
+
legal_nature: textField(),
|
|
1215
|
+
city: textField(),
|
|
1216
|
+
state: textField(2)
|
|
1217
|
+
}).strict(),
|
|
1218
|
+
financing_company_guarantor: zod.z.array(
|
|
1219
|
+
zod.z.object({
|
|
1220
|
+
name: textField(),
|
|
1221
|
+
cep: cepSchema,
|
|
1222
|
+
cpf: cpfSchema,
|
|
1223
|
+
address: textField(),
|
|
1224
|
+
birth_date: birthDateSchema,
|
|
1225
|
+
number: textField(),
|
|
1226
|
+
complement: textField(15).optional(),
|
|
1227
|
+
cellphone: phoneBRSchema,
|
|
1228
|
+
phone: phoneBRSchema,
|
|
1229
|
+
email: emailSchema,
|
|
1230
|
+
district: textField(),
|
|
1231
|
+
sex: SexEnum,
|
|
1232
|
+
city: textField(),
|
|
1233
|
+
state: textField(2),
|
|
1234
|
+
civil_status: textField(),
|
|
1235
|
+
office: textField(),
|
|
1236
|
+
doc: textField(),
|
|
1237
|
+
issuing_body: textField(),
|
|
1238
|
+
uf_issuing_body: textField(2),
|
|
1239
|
+
doc_issue_date: issueDateSchema,
|
|
1240
|
+
mother_name: textField(),
|
|
1241
|
+
monthly_income: currencySchema,
|
|
1242
|
+
patrimony: currencySchema,
|
|
1243
|
+
nationality: textField()
|
|
1244
|
+
}).strict()
|
|
1245
|
+
)
|
|
1246
|
+
});
|
|
1247
|
+
var solfacilPjSchema = solfacilPjObject.strict().superRefine(applyPjRefinements);
|
|
1248
|
+
|
|
1249
|
+
// src/domains/financing/formalization/registry.ts
|
|
1250
|
+
var pfSchemaRegistry = {
|
|
1251
|
+
credito77: credito77PfSchema,
|
|
1252
|
+
losango: losangoPfSchema,
|
|
1253
|
+
santander: santanderPfSchema,
|
|
1254
|
+
btg: btgPfSchema,
|
|
1255
|
+
bv: bvPfSchema,
|
|
1256
|
+
"banco-do-brasil": bancoDoBrasilPfSchema,
|
|
1257
|
+
"caixa-economica-federal": caixaEconomicaFederalPfSchema,
|
|
1258
|
+
alfa: alfaPfSchema,
|
|
1259
|
+
safra: safraPfSchema,
|
|
1260
|
+
cash_me_: cashMePfSchema,
|
|
1261
|
+
hdt_energy: hdtEnergyPfSchema,
|
|
1262
|
+
solfacil: solfacilPfSchema,
|
|
1263
|
+
sol_agora: solAgoraPfSchema,
|
|
1264
|
+
eos: eosPfSchema
|
|
1265
|
+
};
|
|
1266
|
+
var pjSchemaRegistry = {
|
|
1267
|
+
credito77: credito77PjSchema,
|
|
1268
|
+
losango: losangoPjSchema,
|
|
1269
|
+
santander: santanderPjSchema,
|
|
1270
|
+
btg: btgPjSchema,
|
|
1271
|
+
bv: bvPjSchema,
|
|
1272
|
+
"banco-do-brasil": bancoDoBrasilPjSchema,
|
|
1273
|
+
"caixa-economica-federal": caixaEconomicaFederalPjSchema,
|
|
1274
|
+
alfa: alfaPjSchema,
|
|
1275
|
+
safra: safraPjSchema,
|
|
1276
|
+
cash_me_: cashMePjSchema,
|
|
1277
|
+
hdt_energy: hdtEnergyPjSchema,
|
|
1278
|
+
solfacil: solfacilPjSchema,
|
|
1279
|
+
sol_agora: solAgoraPjSchema,
|
|
1280
|
+
eos: eosPjSchema
|
|
1281
|
+
};
|
|
1282
|
+
var pfBaseSchemaRegistry = {
|
|
1283
|
+
credito77: credito77PfObject,
|
|
1284
|
+
losango: losangoPfObject,
|
|
1285
|
+
santander: santanderPfObject,
|
|
1286
|
+
btg: btgPfObject,
|
|
1287
|
+
bv: bvPfObject,
|
|
1288
|
+
"banco-do-brasil": bancoDoBrasilPfObject,
|
|
1289
|
+
"caixa-economica-federal": caixaEconomicaFederalPfObject,
|
|
1290
|
+
alfa: alfaPfObject,
|
|
1291
|
+
safra: safraPfObject,
|
|
1292
|
+
cash_me_: cashMePfObject,
|
|
1293
|
+
hdt_energy: hdtEnergyPfObject,
|
|
1294
|
+
solfacil: solfacilPfObject,
|
|
1295
|
+
sol_agora: solAgoraPfObject,
|
|
1296
|
+
eos: eosPfObject
|
|
1297
|
+
};
|
|
1298
|
+
var pjBaseSchemaRegistry = {
|
|
1299
|
+
credito77: credito77PjObject,
|
|
1300
|
+
losango: losangoPjObject,
|
|
1301
|
+
santander: santanderPjObject,
|
|
1302
|
+
btg: btgPjObject,
|
|
1303
|
+
bv: bvPjObject,
|
|
1304
|
+
"banco-do-brasil": bancoDoBrasilPjObject,
|
|
1305
|
+
"caixa-economica-federal": caixaEconomicaFederalPjObject,
|
|
1306
|
+
alfa: alfaPjObject,
|
|
1307
|
+
safra: safraPjObject,
|
|
1308
|
+
cash_me_: cashMePjObject,
|
|
1309
|
+
hdt_energy: hdtEnergyPjObject,
|
|
1310
|
+
solfacil: solfacilPjObject,
|
|
1311
|
+
sol_agora: solAgoraPjObject,
|
|
1312
|
+
eos: eosPjObject
|
|
1313
|
+
};
|
|
1314
|
+
var CREDITO77_PRESTAMISTA_FIELDS = {
|
|
1315
|
+
doc: true,
|
|
1316
|
+
issuing_body: true,
|
|
1317
|
+
doc_issue_date: true,
|
|
1318
|
+
sex: true
|
|
1319
|
+
};
|
|
1320
|
+
function isCredito77WithoutPrestamista(bank, person, options) {
|
|
1321
|
+
return bank === "credito77" && person === "pf" && !options.prestamistaIncluso;
|
|
1322
|
+
}
|
|
1323
|
+
function getFormalizationSchema(bank, person, options = {}) {
|
|
1324
|
+
if (isCredito77WithoutPrestamista(bank, person, options)) {
|
|
1325
|
+
return credito77PfObject.omit(CREDITO77_PRESTAMISTA_FIELDS).strict().superRefine(applyPfRefinements);
|
|
1326
|
+
}
|
|
1327
|
+
return person === "pf" ? pfSchemaRegistry[bank] : pjSchemaRegistry[bank];
|
|
1328
|
+
}
|
|
1329
|
+
function getFormalizationBaseSchema(bank, person, options = {}) {
|
|
1330
|
+
if (isCredito77WithoutPrestamista(bank, person, options)) {
|
|
1331
|
+
return credito77PfObject.omit(CREDITO77_PRESTAMISTA_FIELDS);
|
|
1332
|
+
}
|
|
1333
|
+
return person === "pf" ? pfBaseSchemaRegistry[bank] : pjBaseSchemaRegistry[bank];
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
// src/domains/financing/formalization/uiMeta.ts
|
|
1337
|
+
var FORMALIZATION_FIELD_META = {
|
|
1338
|
+
energy_bill_upload: { kind: "file", label: "Conta de energia", step: 1 },
|
|
1339
|
+
account_third_party: {
|
|
1340
|
+
kind: "select",
|
|
1341
|
+
label: "Conta em nome de terceiro?",
|
|
1342
|
+
step: 1
|
|
1343
|
+
},
|
|
1344
|
+
bond_document_upload: {
|
|
1345
|
+
kind: "file",
|
|
1346
|
+
label: "Documento de v\xEDnculo com o titular",
|
|
1347
|
+
step: 1
|
|
1348
|
+
},
|
|
1349
|
+
document_front_upload: {
|
|
1350
|
+
kind: "file",
|
|
1351
|
+
label: "Documento de identidade (frente)",
|
|
1352
|
+
step: 2
|
|
1353
|
+
},
|
|
1354
|
+
document_back_upload: {
|
|
1355
|
+
kind: "file",
|
|
1356
|
+
label: "Documento de identidade (verso)",
|
|
1357
|
+
step: 2
|
|
1358
|
+
},
|
|
1359
|
+
name: { kind: "text", label: "Nome", step: 3 },
|
|
1360
|
+
cpf: { kind: "cpf", label: "CPF", step: 3 },
|
|
1361
|
+
birth_date: { kind: "date", label: "Data de nascimento", step: 3 },
|
|
1362
|
+
nationality: { kind: "text", label: "Nacionalidade", step: 3 },
|
|
1363
|
+
type_doc: { kind: "select", label: "Tipo de documento", step: 3 },
|
|
1364
|
+
doc: { kind: "text", label: "N\xFAmero do documento", step: 3 },
|
|
1365
|
+
issuing_body: { kind: "text", label: "\xD3rg\xE3o emissor", step: 3 },
|
|
1366
|
+
emitting_state: { kind: "text", label: "UF emissor", step: 3 },
|
|
1367
|
+
doc_issue_date: { kind: "date", label: "Data de expedi\xE7\xE3o", step: 3 },
|
|
1368
|
+
email: { kind: "email", label: "E-mail", step: 3 },
|
|
1369
|
+
cellphone: { kind: "phone", label: "Celular", step: 3 },
|
|
1370
|
+
monthly_income: { kind: "currency", label: "Renda mensal", step: 3 },
|
|
1371
|
+
mother_name: { kind: "text", label: "Nome da m\xE3e", step: 3 },
|
|
1372
|
+
is_installation_at_requester: {
|
|
1373
|
+
kind: "text",
|
|
1374
|
+
label: "Instala\xE7\xE3o no endere\xE7o do solicitante",
|
|
1375
|
+
step: 3
|
|
1376
|
+
},
|
|
1377
|
+
energy_account_in_requester_name: {
|
|
1378
|
+
kind: "text",
|
|
1379
|
+
label: "Conta de energia no nome do solicitante",
|
|
1380
|
+
step: 3
|
|
1381
|
+
},
|
|
1382
|
+
energy_bill_owner_document: {
|
|
1383
|
+
kind: "cpfCnpj",
|
|
1384
|
+
label: "Documento do titular da conta de energia",
|
|
1385
|
+
step: 3
|
|
1386
|
+
},
|
|
1387
|
+
cep: { kind: "cep", label: "CEP", step: 3 },
|
|
1388
|
+
address: { kind: "text", label: "Endere\xE7o", step: 3 },
|
|
1389
|
+
number: { kind: "text", label: "N\xFAmero", step: 3 },
|
|
1390
|
+
complement: { kind: "text", label: "Complemento", step: 3 },
|
|
1391
|
+
district: { kind: "text", label: "Bairro", step: 3 },
|
|
1392
|
+
state: { kind: "text", label: "Estado (UF)", step: 3 },
|
|
1393
|
+
city: { kind: "text", label: "Cidade", step: 3 },
|
|
1394
|
+
sex: { kind: "select", label: "Sexo", step: 4 },
|
|
1395
|
+
profession: { kind: "text", label: "Profiss\xE3o", step: 4 },
|
|
1396
|
+
rd_re_insurance_toggle: {
|
|
1397
|
+
kind: "toggle",
|
|
1398
|
+
label: "Seguro prestamista (RD/RE)",
|
|
1399
|
+
step: 4
|
|
1400
|
+
},
|
|
1401
|
+
nature_of_occupation: {
|
|
1402
|
+
kind: "text",
|
|
1403
|
+
label: "Natureza da ocupa\xE7\xE3o",
|
|
1404
|
+
step: 4
|
|
1405
|
+
},
|
|
1406
|
+
cnpj_proprietary: { kind: "cnpj", label: "CNPJ do propriet\xE1rio", step: 4 },
|
|
1407
|
+
equity_value: { kind: "currency", label: "Patrim\xF4nio", step: 4 },
|
|
1408
|
+
civil_status: { kind: "text", label: "Estado civil", step: 4 },
|
|
1409
|
+
naturalness: { kind: "text", label: "Naturalidade", step: 4 },
|
|
1410
|
+
uf_naturalness: { kind: "text", label: "UF de naturalidade", step: 4 },
|
|
1411
|
+
company_time: { kind: "number", label: "Tempo de empresa (meses)", step: 4 },
|
|
1412
|
+
pep_relationship: { kind: "text", label: "Rela\xE7\xE3o com PEP", step: 4 },
|
|
1413
|
+
residence_situation: {
|
|
1414
|
+
kind: "text",
|
|
1415
|
+
label: "Situa\xE7\xE3o da resid\xEAncia",
|
|
1416
|
+
step: 4
|
|
1417
|
+
},
|
|
1418
|
+
months_in_residence: {
|
|
1419
|
+
kind: "integer",
|
|
1420
|
+
label: "Tempo de resid\xEAncia (meses)",
|
|
1421
|
+
step: 4
|
|
1422
|
+
},
|
|
1423
|
+
financing_company: { kind: "group", label: "Dados da empresa", step: 3 },
|
|
1424
|
+
financing_company_guarantor: { kind: "array", label: "Avalistas", step: 3 },
|
|
1425
|
+
financing_company_qsa: {
|
|
1426
|
+
kind: "array",
|
|
1427
|
+
label: "Quadro societ\xE1rio (QSA)",
|
|
1428
|
+
step: 3
|
|
1429
|
+
}
|
|
1430
|
+
};
|
|
1431
|
+
|
|
1432
|
+
exports.BANK_SLUGS = BANK_SLUGS;
|
|
1433
|
+
exports.BankEnum = BankEnum;
|
|
1434
|
+
exports.FORMALIZATION_FIELD_META = FORMALIZATION_FIELD_META;
|
|
1435
|
+
exports.NATIONALITY_BRAZIL = NATIONALITY_BRAZIL;
|
|
1436
|
+
exports.OCCUPATIONS_REQUIRING_CNPJ = OCCUPATIONS_REQUIRING_CNPJ;
|
|
1437
|
+
exports.applyPfRefinements = applyPfRefinements;
|
|
1438
|
+
exports.applyPjRefinements = applyPjRefinements;
|
|
1439
|
+
exports.getFormalizationBaseSchema = getFormalizationBaseSchema;
|
|
1440
|
+
exports.getFormalizationSchema = getFormalizationSchema;
|
|
1441
|
+
exports.pfBaseSchemaRegistry = pfBaseSchemaRegistry;
|
|
1442
|
+
exports.pfSchemaRegistry = pfSchemaRegistry;
|
|
1443
|
+
exports.pjBaseSchemaRegistry = pjBaseSchemaRegistry;
|
|
1444
|
+
exports.pjSchemaRegistry = pjSchemaRegistry;
|