arcli 0.1.2 → 1.1.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/LICENSE +21 -0
- package/README.md +164 -4
- package/dist/cli/commands/billing-family.command.d.ts +2 -0
- package/dist/cli/commands/billing-family.command.js +30 -0
- package/dist/cli/commands/billing-family.command.js.map +1 -0
- package/dist/cli/commands/billing-shortcuts.command.d.ts +2 -0
- package/dist/cli/commands/billing-shortcuts.command.js +18 -0
- package/dist/cli/commands/billing-shortcuts.command.js.map +1 -0
- package/dist/cli/commands/billing.command.interactive-preview.d.ts +17 -0
- package/dist/cli/commands/billing.command.interactive-preview.js +65 -0
- package/dist/cli/commands/billing.command.interactive-preview.js.map +1 -0
- package/dist/cli/commands/billing.command.options.d.ts +2 -0
- package/dist/cli/commands/billing.command.options.js +49 -0
- package/dist/cli/commands/billing.command.options.js.map +1 -0
- package/dist/cli/commands/billing.command.output.d.ts +12 -0
- package/dist/cli/commands/billing.command.output.js +33 -0
- package/dist/cli/commands/billing.command.output.js.map +1 -0
- package/dist/cli/commands/billing.command.parser.d.ts +18 -0
- package/dist/cli/commands/billing.command.parser.js +136 -0
- package/dist/cli/commands/billing.command.parser.js.map +1 -0
- package/dist/cli/commands/billing.command.shared.d.ts +7 -0
- package/dist/cli/commands/billing.command.shared.js +78 -0
- package/dist/cli/commands/billing.command.shared.js.map +1 -0
- package/dist/cli/commands/billing.command.shortcuts.d.ts +7 -0
- package/dist/cli/commands/billing.command.shortcuts.js +52 -0
- package/dist/cli/commands/billing.command.shortcuts.js.map +1 -0
- package/dist/cli/commands/config.command.d.ts +2 -0
- package/dist/cli/commands/config.command.js +125 -0
- package/dist/cli/commands/config.command.js.map +1 -0
- package/dist/cli/commands/examples.command.d.ts +2 -0
- package/dist/cli/commands/examples.command.js +14 -0
- package/dist/cli/commands/examples.command.js.map +1 -0
- package/dist/cli/commands/storybook.command.d.ts +2 -0
- package/dist/cli/commands/storybook.command.js +26 -0
- package/dist/cli/commands/storybook.command.js.map +1 -0
- package/dist/cli/help.d.ts +10 -0
- package/dist/cli/help.js +473 -0
- package/dist/cli/help.js.map +1 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +41 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/program.d.ts +2 -0
- package/dist/cli/program.js +28 -0
- package/dist/cli/program.js.map +1 -0
- package/dist/cli/types.d.ts +6 -0
- package/dist/cli/types.js +2 -0
- package/dist/cli/types.js.map +1 -0
- package/dist/cli/version.d.ts +1 -0
- package/dist/cli/version.js +2 -0
- package/dist/cli/version.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/dates/arca-date.d.ts +2 -0
- package/dist/lib/dates/arca-date.js +28 -0
- package/dist/lib/dates/arca-date.js.map +1 -0
- package/dist/lib/errors/app-error.d.ts +14 -0
- package/dist/lib/errors/app-error.js +29 -0
- package/dist/lib/errors/app-error.js.map +1 -0
- package/dist/lib/files/read-json-file.d.ts +1 -0
- package/dist/lib/files/read-json-file.js +21 -0
- package/dist/lib/files/read-json-file.js.map +1 -0
- package/dist/lib/paths/mask-path.d.ts +1 -0
- package/dist/lib/paths/mask-path.js +17 -0
- package/dist/lib/paths/mask-path.js.map +1 -0
- package/dist/lib/security/certificate.d.ts +7 -0
- package/dist/lib/security/certificate.js +16 -0
- package/dist/lib/security/certificate.js.map +1 -0
- package/dist/lib/security/pem.d.ts +5 -0
- package/dist/lib/security/pem.js +36 -0
- package/dist/lib/security/pem.js.map +1 -0
- package/dist/modules/billing/billing-response.d.ts +4 -0
- package/dist/modules/billing/billing-response.js +74 -0
- package/dist/modules/billing/billing-response.js.map +1 -0
- package/dist/modules/billing/billing.amounts.d.ts +9 -0
- package/dist/modules/billing/billing.amounts.js +30 -0
- package/dist/modules/billing/billing.amounts.js.map +1 -0
- package/dist/modules/billing/billing.associated-vouchers.d.ts +10 -0
- package/dist/modules/billing/billing.associated-vouchers.js +51 -0
- package/dist/modules/billing/billing.associated-vouchers.js.map +1 -0
- package/dist/modules/billing/billing.constants.d.ts +2 -0
- package/dist/modules/billing/billing.constants.js +3 -0
- package/dist/modules/billing/billing.constants.js.map +1 -0
- package/dist/modules/billing/billing.date-range.d.ts +8 -0
- package/dist/modules/billing/billing.date-range.js +45 -0
- package/dist/modules/billing/billing.date-range.js.map +1 -0
- package/dist/modules/billing/billing.display.d.ts +13 -0
- package/dist/modules/billing/billing.display.js +111 -0
- package/dist/modules/billing/billing.display.js.map +1 -0
- package/dist/modules/billing/billing.json-format.d.ts +6 -0
- package/dist/modules/billing/billing.json-format.js +5 -0
- package/dist/modules/billing/billing.json-format.js.map +1 -0
- package/dist/modules/billing/billing.labels.d.ts +9 -0
- package/dist/modules/billing/billing.labels.js +108 -0
- package/dist/modules/billing/billing.labels.js.map +1 -0
- package/dist/modules/billing/billing.mappers.d.ts +8 -0
- package/dist/modules/billing/billing.mappers.js +59 -0
- package/dist/modules/billing/billing.mappers.js.map +1 -0
- package/dist/modules/billing/billing.presenter.d.ts +7 -0
- package/dist/modules/billing/billing.presenter.js +3 -0
- package/dist/modules/billing/billing.presenter.js.map +1 -0
- package/dist/modules/billing/billing.schemas.d.ts +74 -0
- package/dist/modules/billing/billing.schemas.js +69 -0
- package/dist/modules/billing/billing.schemas.js.map +1 -0
- package/dist/modules/billing/billing.serialize.d.ts +8 -0
- package/dist/modules/billing/billing.serialize.js +51 -0
- package/dist/modules/billing/billing.serialize.js.map +1 -0
- package/dist/modules/billing/billing.service.d.ts +15 -0
- package/dist/modules/billing/billing.service.js +88 -0
- package/dist/modules/billing/billing.service.js.map +1 -0
- package/dist/modules/billing/billing.text.d.ts +8 -0
- package/dist/modules/billing/billing.text.js +44 -0
- package/dist/modules/billing/billing.text.js.map +1 -0
- package/dist/modules/billing/billing.types.d.ts +13 -0
- package/dist/modules/billing/billing.types.internal.d.ts +25 -0
- package/dist/modules/billing/billing.types.internal.js +2 -0
- package/dist/modules/billing/billing.types.internal.js.map +1 -0
- package/dist/modules/billing/billing.types.js +2 -0
- package/dist/modules/billing/billing.types.js.map +1 -0
- package/dist/modules/billing/billing.validation.d.ts +5 -0
- package/dist/modules/billing/billing.validation.js +45 -0
- package/dist/modules/billing/billing.validation.js.map +1 -0
- package/dist/modules/billing/voucher-kind-map.d.ts +9 -0
- package/dist/modules/billing/voucher-kind-map.js +180 -0
- package/dist/modules/billing/voucher-kind-map.js.map +1 -0
- package/dist/modules/config/config-doctor.d.ts +15 -0
- package/dist/modules/config/config-doctor.js +125 -0
- package/dist/modules/config/config-doctor.js.map +1 -0
- package/dist/modules/config/config-value-parser.d.ts +2 -0
- package/dist/modules/config/config-value-parser.js +71 -0
- package/dist/modules/config/config-value-parser.js.map +1 -0
- package/dist/modules/config/config.presenter.d.ts +7 -0
- package/dist/modules/config/config.presenter.js +80 -0
- package/dist/modules/config/config.presenter.js.map +1 -0
- package/dist/modules/config/config.schemas.d.ts +87 -0
- package/dist/modules/config/config.schemas.js +84 -0
- package/dist/modules/config/config.schemas.js.map +1 -0
- package/dist/modules/config/config.service.d.ts +20 -0
- package/dist/modules/config/config.service.js +78 -0
- package/dist/modules/config/config.service.js.map +1 -0
- package/dist/modules/examples/examples.d.ts +1 -0
- package/dist/modules/examples/examples.js +156 -0
- package/dist/modules/examples/examples.js.map +1 -0
- package/dist/modules/storybook/showcase-theme.d.ts +7 -0
- package/dist/modules/storybook/showcase-theme.js +6 -0
- package/dist/modules/storybook/showcase-theme.js.map +1 -0
- package/dist/modules/storybook/showcase.d.ts +2 -0
- package/dist/modules/storybook/showcase.js +310 -0
- package/dist/modules/storybook/showcase.js.map +1 -0
- package/dist/modules/update-check/update-check.presenter.d.ts +2 -0
- package/dist/modules/update-check/update-check.presenter.js +6 -0
- package/dist/modules/update-check/update-check.presenter.js.map +1 -0
- package/dist/modules/update-check/update-check.service.d.ts +8 -0
- package/dist/modules/update-check/update-check.service.js +72 -0
- package/dist/modules/update-check/update-check.service.js.map +1 -0
- package/dist/services/arca/arca-billing.gateway.d.ts +9 -0
- package/dist/services/arca/arca-billing.gateway.js +10 -0
- package/dist/services/arca/arca-billing.gateway.js.map +1 -0
- package/dist/services/arca/arca-client.factory.d.ts +5 -0
- package/dist/services/arca/arca-client.factory.js +7 -0
- package/dist/services/arca/arca-client.factory.js.map +1 -0
- package/dist/services/arca/arca-context.resolver.d.ts +44 -0
- package/dist/services/arca/arca-context.resolver.js +120 -0
- package/dist/services/arca/arca-context.resolver.js.map +1 -0
- package/dist/ui/components/contentPanel.d.ts +5 -0
- package/dist/ui/components/contentPanel.js +11 -0
- package/dist/ui/components/contentPanel.js.map +1 -0
- package/dist/ui/components/errorPanel.d.ts +1 -0
- package/dist/ui/components/errorPanel.js +13 -0
- package/dist/ui/components/errorPanel.js.map +1 -0
- package/dist/ui/components/index.d.ts +6 -0
- package/dist/ui/components/index.js +7 -0
- package/dist/ui/components/index.js.map +1 -0
- package/dist/ui/components/keyValuePanel.d.ts +3 -0
- package/dist/ui/components/keyValuePanel.js +14 -0
- package/dist/ui/components/keyValuePanel.js.map +1 -0
- package/dist/ui/components/noticePanel.d.ts +3 -0
- package/dist/ui/components/noticePanel.js +11 -0
- package/dist/ui/components/noticePanel.js.map +1 -0
- package/dist/ui/components/rawPanel.d.ts +1 -0
- package/dist/ui/components/rawPanel.js +5 -0
- package/dist/ui/components/rawPanel.js.map +1 -0
- package/dist/ui/components/statusPanel.d.ts +3 -0
- package/dist/ui/components/statusPanel.js +20 -0
- package/dist/ui/components/statusPanel.js.map +1 -0
- package/dist/ui/index.d.ts +5 -0
- package/dist/ui/index.js +6 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/presenters/billing.presenter.d.ts +2 -0
- package/dist/ui/presenters/billing.presenter.js +2 -0
- package/dist/ui/presenters/billing.presenter.js.map +1 -0
- package/dist/ui/presenters/config.presenter.d.ts +1 -0
- package/dist/ui/presenters/config.presenter.js +2 -0
- package/dist/ui/presenters/config.presenter.js.map +1 -0
- package/dist/ui/presenters/errors.presenter.d.ts +1 -0
- package/dist/ui/presenters/errors.presenter.js +89 -0
- package/dist/ui/presenters/errors.presenter.js.map +1 -0
- package/dist/ui/presenters/errors.zod-presenter.d.ts +2 -0
- package/dist/ui/presenters/errors.zod-presenter.js +82 -0
- package/dist/ui/presenters/errors.zod-presenter.js.map +1 -0
- package/dist/ui/presenters/index.d.ts +4 -0
- package/dist/ui/presenters/index.js +5 -0
- package/dist/ui/presenters/index.js.map +1 -0
- package/dist/ui/presenters/showcase.presenter.d.ts +1 -0
- package/dist/ui/presenters/showcase.presenter.js +2 -0
- package/dist/ui/presenters/showcase.presenter.js.map +1 -0
- package/dist/ui/primitives/index.d.ts +10 -0
- package/dist/ui/primitives/index.js +11 -0
- package/dist/ui/primitives/index.js.map +1 -0
- package/dist/ui/primitives/renderDivider.d.ts +5 -0
- package/dist/ui/primitives/renderDivider.js +5 -0
- package/dist/ui/primitives/renderDivider.js.map +1 -0
- package/dist/ui/primitives/renderFooter.d.ts +7 -0
- package/dist/ui/primitives/renderFooter.js +6 -0
- package/dist/ui/primitives/renderFooter.js.map +1 -0
- package/dist/ui/primitives/renderJson.d.ts +3 -0
- package/dist/ui/primitives/renderJson.js +19 -0
- package/dist/ui/primitives/renderJson.js.map +1 -0
- package/dist/ui/primitives/renderKeyValue.d.ts +14 -0
- package/dist/ui/primitives/renderKeyValue.js +34 -0
- package/dist/ui/primitives/renderKeyValue.js.map +1 -0
- package/dist/ui/primitives/renderLogo.d.ts +2 -0
- package/dist/ui/primitives/renderLogo.js +28 -0
- package/dist/ui/primitives/renderLogo.js.map +1 -0
- package/dist/ui/primitives/renderObject.d.ts +1 -0
- package/dist/ui/primitives/renderObject.js +19 -0
- package/dist/ui/primitives/renderObject.js.map +1 -0
- package/dist/ui/primitives/renderPanel.d.ts +23 -0
- package/dist/ui/primitives/renderPanel.js +114 -0
- package/dist/ui/primitives/renderPanel.js.map +1 -0
- package/dist/ui/primitives/renderSubtitle.d.ts +7 -0
- package/dist/ui/primitives/renderSubtitle.js +6 -0
- package/dist/ui/primitives/renderSubtitle.js.map +1 -0
- package/dist/ui/primitives/renderTable.d.ts +6 -0
- package/dist/ui/primitives/renderTable.js +14 -0
- package/dist/ui/primitives/renderTable.js.map +1 -0
- package/dist/ui/primitives/text.d.ts +18 -0
- package/dist/ui/primitives/text.js +154 -0
- package/dist/ui/primitives/text.js.map +1 -0
- package/dist/ui/stream/index.d.ts +1 -0
- package/dist/ui/stream/index.js +2 -0
- package/dist/ui/stream/index.js.map +1 -0
- package/dist/ui/stream/terminal-stream.d.ts +10 -0
- package/dist/ui/stream/terminal-stream.js +20 -0
- package/dist/ui/stream/terminal-stream.js.map +1 -0
- package/dist/ui/theme/index.d.ts +1 -0
- package/dist/ui/theme/index.js +2 -0
- package/dist/ui/theme/index.js.map +1 -0
- package/dist/ui/theme/theme.d.ts +27 -0
- package/dist/ui/theme/theme.js +41 -0
- package/dist/ui/theme/theme.js.map +1 -0
- package/llms.txt +157 -0
- package/package.json +98 -35
- package/.babelrc +0 -4
- package/.eslintignore +0 -1
- package/.eslintrc.js +0 -17
- package/.npmignore +0 -1
- package/lib/arcli.js +0 -275
- package/lib/arcli.min.js +0 -1
- package/src/config.js +0 -22
- package/src/consoler.js +0 -10
- package/src/index.js +0 -21
- package/src/init.js +0 -13
- package/src/run.js +0 -4
- package/src/spinner.js +0 -39
- package/tst/index.js +0 -26
- package/webpack.config.js +0 -47
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function formatDateLabel(value: string | undefined): string;
|
|
2
|
+
export declare function formatMoneyLabel(value: number | undefined): string;
|
|
3
|
+
export declare function formatConceptLabel(value: number | undefined): string;
|
|
4
|
+
export declare function formatDocumentTypeLabel(value: number | undefined): string;
|
|
5
|
+
export declare function formatIvaConditionLabel(value: number | undefined): string;
|
|
6
|
+
export declare function formatCurrencyLabel(value: string | undefined): string;
|
|
7
|
+
export declare function formatNumericLabel(value: number | undefined): string;
|
|
8
|
+
export declare function formatTaxIdLabel(value: string | number | undefined): string;
|
|
9
|
+
export declare function formatDecimalLabel(value: number | undefined): string;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
export function formatDateLabel(value) {
|
|
2
|
+
if (!value) {
|
|
3
|
+
return 'N/D';
|
|
4
|
+
}
|
|
5
|
+
if (/^\d{8}$/.test(value)) {
|
|
6
|
+
return `${value.slice(6, 8)}/${value.slice(4, 6)}/${value.slice(0, 4)}`;
|
|
7
|
+
}
|
|
8
|
+
return value.replaceAll('-', '/');
|
|
9
|
+
}
|
|
10
|
+
export function formatMoneyLabel(value) {
|
|
11
|
+
if (typeof value !== 'number') {
|
|
12
|
+
return 'N/D';
|
|
13
|
+
}
|
|
14
|
+
const hasDecimals = !Number.isInteger(value);
|
|
15
|
+
return `${new Intl.NumberFormat('es-AR', {
|
|
16
|
+
maximumFractionDigits: 2,
|
|
17
|
+
minimumFractionDigits: hasDecimals ? 2 : 0,
|
|
18
|
+
}).format(value)}$`;
|
|
19
|
+
}
|
|
20
|
+
export function formatConceptLabel(value) {
|
|
21
|
+
switch (value) {
|
|
22
|
+
case 1:
|
|
23
|
+
return 'Productos';
|
|
24
|
+
case 2:
|
|
25
|
+
return 'Servicios';
|
|
26
|
+
case 3:
|
|
27
|
+
return 'Productos y servicios';
|
|
28
|
+
default:
|
|
29
|
+
return value ? String(value) : 'N/D';
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export function formatDocumentTypeLabel(value) {
|
|
33
|
+
switch (value) {
|
|
34
|
+
case 80:
|
|
35
|
+
return 'CUIT';
|
|
36
|
+
case 86:
|
|
37
|
+
return 'CUIL';
|
|
38
|
+
case 96:
|
|
39
|
+
return 'DNI';
|
|
40
|
+
case 99:
|
|
41
|
+
return 'Consumidor final';
|
|
42
|
+
default:
|
|
43
|
+
return value ? String(value) : 'N/D';
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export function formatIvaConditionLabel(value) {
|
|
47
|
+
switch (value) {
|
|
48
|
+
case 1:
|
|
49
|
+
return 'Responsable inscripto';
|
|
50
|
+
case 4:
|
|
51
|
+
return 'Sujeto exento';
|
|
52
|
+
case 5:
|
|
53
|
+
return 'Consumidor final';
|
|
54
|
+
case 6:
|
|
55
|
+
return 'Responsable monotributo';
|
|
56
|
+
case 7:
|
|
57
|
+
return 'Sujeto no categorizado';
|
|
58
|
+
case 8:
|
|
59
|
+
return 'Proveedor del exterior';
|
|
60
|
+
case 9:
|
|
61
|
+
return 'Cliente del exterior';
|
|
62
|
+
case 10:
|
|
63
|
+
return 'IVA liberado';
|
|
64
|
+
case 13:
|
|
65
|
+
return 'Monotributista social';
|
|
66
|
+
case 15:
|
|
67
|
+
return 'IVA no alcanzado';
|
|
68
|
+
case 16:
|
|
69
|
+
return 'Monotributo trabajador independiente promovido';
|
|
70
|
+
default:
|
|
71
|
+
return value ? String(value) : 'N/D';
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
export function formatCurrencyLabel(value) {
|
|
75
|
+
switch (value) {
|
|
76
|
+
case 'PES':
|
|
77
|
+
return 'Pesos argentinos (ARS)';
|
|
78
|
+
case 'USD':
|
|
79
|
+
return 'Dolares estadounidenses (USD)';
|
|
80
|
+
default:
|
|
81
|
+
return value ?? 'N/D';
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
export function formatNumericLabel(value) {
|
|
85
|
+
if (typeof value !== 'number') {
|
|
86
|
+
return 'N/D';
|
|
87
|
+
}
|
|
88
|
+
return new Intl.NumberFormat('es-AR').format(value);
|
|
89
|
+
}
|
|
90
|
+
export function formatTaxIdLabel(value) {
|
|
91
|
+
if (value === undefined || value === null || value === '') {
|
|
92
|
+
return 'No informado';
|
|
93
|
+
}
|
|
94
|
+
const normalizedValue = String(value).replace(/\D/g, '');
|
|
95
|
+
if (!/^\d{11}$/.test(normalizedValue)) {
|
|
96
|
+
return String(value);
|
|
97
|
+
}
|
|
98
|
+
return `${normalizedValue.slice(0, 2)}-${normalizedValue.slice(2, 10)}-${normalizedValue.slice(10)}`;
|
|
99
|
+
}
|
|
100
|
+
export function formatDecimalLabel(value) {
|
|
101
|
+
if (typeof value !== 'number') {
|
|
102
|
+
return 'N/D';
|
|
103
|
+
}
|
|
104
|
+
return new Intl.NumberFormat('es-AR', {
|
|
105
|
+
maximumFractionDigits: 6,
|
|
106
|
+
}).format(value);
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=billing.labels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.labels.js","sourceRoot":"","sources":["../../../src/modules/billing/billing.labels.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,eAAe,CAAC,KAAyB;IACvD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;IAC1E,CAAC;IAED,OAAO,KAAK,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,KAAyB;IACxD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,WAAW,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAE7C,OAAO,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE;QACvC,qBAAqB,EAAE,CAAC;QACxB,qBAAqB,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KAC3C,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,G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AAC;QAC9B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE;QACpC,qBAAqB,EAAE,CAAC;KACzB,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BillingConcept, BillingDocumentType, BillingIvaCondition } from './billing.schemas';
|
|
2
|
+
import type { VoucherKindDefinition } from './billing.types';
|
|
3
|
+
export declare function resolveBillingConceptCode(concept: BillingConcept): number;
|
|
4
|
+
export declare function resolveBillingDocumentTypeCode(documentType: BillingDocumentType): number;
|
|
5
|
+
export declare function resolveBillingIvaConditionCode(ivaCondition: BillingIvaCondition): number;
|
|
6
|
+
export declare function resolveBillingCurrencyCode(currencyCode?: string): string;
|
|
7
|
+
export declare function formatVoucherLabel(voucherKind: VoucherKindDefinition): string;
|
|
8
|
+
export declare function formatDocumentFlag(documentType: BillingDocumentType): string;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { DEFAULT_CURRENCY_CODE } from './billing.constants.js';
|
|
2
|
+
const BILLING_CONCEPT_MAP = {
|
|
3
|
+
productos: 1,
|
|
4
|
+
servicios: 2,
|
|
5
|
+
'productos-servicios': 3,
|
|
6
|
+
};
|
|
7
|
+
const BILLING_DOCUMENT_TYPE_MAP = {
|
|
8
|
+
'consumidor-final': 99,
|
|
9
|
+
cuil: 86,
|
|
10
|
+
cuit: 80,
|
|
11
|
+
dni: 96,
|
|
12
|
+
};
|
|
13
|
+
const BILLING_IVA_CONDITION_MAP = {
|
|
14
|
+
'cliente-del-exterior': 9,
|
|
15
|
+
'consumidor-final': 5,
|
|
16
|
+
'iva-liberado': 10,
|
|
17
|
+
'iva-no-alcanzado': 15,
|
|
18
|
+
'monotributista-social': 13,
|
|
19
|
+
'monotributo-trabajador-independiente-promovido': 16,
|
|
20
|
+
'proveedor-del-exterior': 8,
|
|
21
|
+
'responsable-inscripto': 1,
|
|
22
|
+
'responsable-monotributo': 6,
|
|
23
|
+
'sujeto-exento': 4,
|
|
24
|
+
'sujeto-no-categorizado': 7,
|
|
25
|
+
};
|
|
26
|
+
const BILLING_CURRENCY_CODE_MAP = {
|
|
27
|
+
ARS: 'PES',
|
|
28
|
+
PES: 'PES',
|
|
29
|
+
USD: 'USD',
|
|
30
|
+
};
|
|
31
|
+
export function resolveBillingConceptCode(concept) {
|
|
32
|
+
return BILLING_CONCEPT_MAP[concept];
|
|
33
|
+
}
|
|
34
|
+
export function resolveBillingDocumentTypeCode(documentType) {
|
|
35
|
+
return BILLING_DOCUMENT_TYPE_MAP[documentType];
|
|
36
|
+
}
|
|
37
|
+
export function resolveBillingIvaConditionCode(ivaCondition) {
|
|
38
|
+
return BILLING_IVA_CONDITION_MAP[ivaCondition];
|
|
39
|
+
}
|
|
40
|
+
export function resolveBillingCurrencyCode(currencyCode = DEFAULT_CURRENCY_CODE) {
|
|
41
|
+
const normalizedCode = currencyCode.trim().toUpperCase();
|
|
42
|
+
return BILLING_CURRENCY_CODE_MAP[normalizedCode] ?? normalizedCode;
|
|
43
|
+
}
|
|
44
|
+
export function formatVoucherLabel(voucherKind) {
|
|
45
|
+
return voucherKind.displayName.toLowerCase();
|
|
46
|
+
}
|
|
47
|
+
export function formatDocumentFlag(documentType) {
|
|
48
|
+
switch (documentType) {
|
|
49
|
+
case 'cuit':
|
|
50
|
+
return '--cuit';
|
|
51
|
+
case 'cuil':
|
|
52
|
+
return '--cuil';
|
|
53
|
+
case 'dni':
|
|
54
|
+
return '--dni';
|
|
55
|
+
default:
|
|
56
|
+
return '--consumidor-final';
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=billing.mappers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.mappers.js","sourceRoot":"","sources":["../../../src/modules/billing/billing.mappers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,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nE,OAAO,WAAW,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,YAAiC;IAClE,QAAQ,YAAY,EAAE,CAAC;QACrB,KAAK,MAAM;YACT,OAAO,QAAQ,CAAC;QAClB,KAAK,MAAM;YACT,OAAO,QAAQ,CAAC;QAClB,KAAK,KAAK;YACR,OAAO,OAAO,CAAC;QACjB;YACE,OAAO,oBAAoB,CAAC;IAChC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { formatBillingResultAsJson } from './billing.json-format';
|
|
2
|
+
export { formatBillingResultAsText } from './billing.text';
|
|
3
|
+
export interface BillingPresenterOptions {
|
|
4
|
+
readonly environment?: 'produccion' | 'testing';
|
|
5
|
+
readonly previewShown?: boolean;
|
|
6
|
+
readonly raw?: boolean;
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.presenter.js","sourceRoot":"","sources":["../../../src/modules/billing/billing.presenter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const billingConceptSchema: z.ZodPreprocess<z.ZodEnum<{
|
|
3
|
+
productos: "productos";
|
|
4
|
+
"productos-servicios": "productos-servicios";
|
|
5
|
+
servicios: "servicios";
|
|
6
|
+
}>>;
|
|
7
|
+
export declare const billingDocumentTypeSchema: z.ZodEnum<{
|
|
8
|
+
"consumidor-final": "consumidor-final";
|
|
9
|
+
cuit: "cuit";
|
|
10
|
+
cuil: "cuil";
|
|
11
|
+
dni: "dni";
|
|
12
|
+
}>;
|
|
13
|
+
export declare const billingIvaConditionSchema: z.ZodEnum<{
|
|
14
|
+
"cliente-del-exterior": "cliente-del-exterior";
|
|
15
|
+
"consumidor-final": "consumidor-final";
|
|
16
|
+
"iva-liberado": "iva-liberado";
|
|
17
|
+
"iva-no-alcanzado": "iva-no-alcanzado";
|
|
18
|
+
"monotributista-social": "monotributista-social";
|
|
19
|
+
"monotributo-trabajador-independiente-promovido": "monotributo-trabajador-independiente-promovido";
|
|
20
|
+
"proveedor-del-exterior": "proveedor-del-exterior";
|
|
21
|
+
"responsable-inscripto": "responsable-inscripto";
|
|
22
|
+
"responsable-monotributo": "responsable-monotributo";
|
|
23
|
+
"sujeto-exento": "sujeto-exento";
|
|
24
|
+
"sujeto-no-categorizado": "sujeto-no-categorizado";
|
|
25
|
+
}>;
|
|
26
|
+
export declare const billingCommandSchema: z.ZodObject<{
|
|
27
|
+
associatedVoucher: z.ZodOptional<z.ZodObject<{
|
|
28
|
+
cuit: z.ZodOptional<z.ZodString>;
|
|
29
|
+
numero: z.ZodOptional<z.ZodNumber>;
|
|
30
|
+
puntoVenta: z.ZodOptional<z.ZodNumber>;
|
|
31
|
+
shortcut: z.ZodOptional<z.ZodString>;
|
|
32
|
+
tipo: z.ZodOptional<z.ZodNumber>;
|
|
33
|
+
}, z.core.$strip>>;
|
|
34
|
+
billingDate: z.ZodOptional<z.ZodString>;
|
|
35
|
+
concept: z.ZodPreprocess<z.ZodEnum<{
|
|
36
|
+
productos: "productos";
|
|
37
|
+
"productos-servicios": "productos-servicios";
|
|
38
|
+
servicios: "servicios";
|
|
39
|
+
}>>;
|
|
40
|
+
currencyCode: z.ZodDefault<z.ZodString>;
|
|
41
|
+
documentNumber: z.ZodOptional<z.ZodNumber>;
|
|
42
|
+
documentType: z.ZodDefault<z.ZodEnum<{
|
|
43
|
+
"consumidor-final": "consumidor-final";
|
|
44
|
+
cuit: "cuit";
|
|
45
|
+
cuil: "cuil";
|
|
46
|
+
dni: "dni";
|
|
47
|
+
}>>;
|
|
48
|
+
dryRun: z.ZodDefault<z.ZodBoolean>;
|
|
49
|
+
emit: z.ZodDefault<z.ZodBoolean>;
|
|
50
|
+
exchangeRate: z.ZodDefault<z.ZodNumber>;
|
|
51
|
+
dueDay: z.ZodOptional<z.ZodNumber>;
|
|
52
|
+
ivaCondition: z.ZodEnum<{
|
|
53
|
+
"cliente-del-exterior": "cliente-del-exterior";
|
|
54
|
+
"consumidor-final": "consumidor-final";
|
|
55
|
+
"iva-liberado": "iva-liberado";
|
|
56
|
+
"iva-no-alcanzado": "iva-no-alcanzado";
|
|
57
|
+
"monotributista-social": "monotributista-social";
|
|
58
|
+
"monotributo-trabajador-independiente-promovido": "monotributo-trabajador-independiente-promovido";
|
|
59
|
+
"proveedor-del-exterior": "proveedor-del-exterior";
|
|
60
|
+
"responsable-inscripto": "responsable-inscripto";
|
|
61
|
+
"responsable-monotributo": "responsable-monotributo";
|
|
62
|
+
"sujeto-exento": "sujeto-exento";
|
|
63
|
+
"sujeto-no-categorizado": "sujeto-no-categorizado";
|
|
64
|
+
}>;
|
|
65
|
+
pointOfSale: z.ZodOptional<z.ZodNumber>;
|
|
66
|
+
serviceEndDate: z.ZodOptional<z.ZodString>;
|
|
67
|
+
serviceStartDate: z.ZodOptional<z.ZodString>;
|
|
68
|
+
shortcut: z.ZodPipe<z.ZodString, z.ZodTransform<"fa" | "fb" | "fc" | "nca" | "ncb" | "ncc" | "nda" | "ndb" | "ndc" | "fcea" | "fceb" | "fcec" | "ncea" | "nceb" | "ncec" | "ndea" | "ndeb" | "ndec", string>>;
|
|
69
|
+
totalAmount: z.ZodNumber;
|
|
70
|
+
}, z.core.$strip>;
|
|
71
|
+
export type BillingConcept = z.infer<typeof billingConceptSchema>;
|
|
72
|
+
export type BillingDocumentType = z.infer<typeof billingDocumentTypeSchema>;
|
|
73
|
+
export type BillingIvaCondition = z.infer<typeof billingIvaConditionSchema>;
|
|
74
|
+
export type BillingCommandInput = z.infer<typeof billingCommandSchema>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
const BILLING_CONCEPT_ALIASES = {
|
|
3
|
+
p: 'productos',
|
|
4
|
+
producto: 'productos',
|
|
5
|
+
productos: 'productos',
|
|
6
|
+
ps: 'productos-servicios',
|
|
7
|
+
'productos-y-servicios': 'productos-servicios',
|
|
8
|
+
'productos-servicios': 'productos-servicios',
|
|
9
|
+
s: 'servicios',
|
|
10
|
+
servicio: 'servicios',
|
|
11
|
+
servicios: 'servicios',
|
|
12
|
+
};
|
|
13
|
+
export const billingConceptSchema = z.preprocess((value) => {
|
|
14
|
+
if (typeof value !== 'string') {
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
const normalizedValue = value.trim().toLowerCase();
|
|
18
|
+
return BILLING_CONCEPT_ALIASES[normalizedValue] ?? value;
|
|
19
|
+
}, z.enum(['productos', 'productos-servicios', 'servicios']));
|
|
20
|
+
export const billingDocumentTypeSchema = z.enum(['consumidor-final', 'cuil', 'cuit', 'dni']);
|
|
21
|
+
export const billingIvaConditionSchema = z.enum([
|
|
22
|
+
'cliente-del-exterior',
|
|
23
|
+
'consumidor-final',
|
|
24
|
+
'iva-liberado',
|
|
25
|
+
'iva-no-alcanzado',
|
|
26
|
+
'monotributista-social',
|
|
27
|
+
'monotributo-trabajador-independiente-promovido',
|
|
28
|
+
'proveedor-del-exterior',
|
|
29
|
+
'responsable-inscripto',
|
|
30
|
+
'responsable-monotributo',
|
|
31
|
+
'sujeto-exento',
|
|
32
|
+
'sujeto-no-categorizado',
|
|
33
|
+
]);
|
|
34
|
+
const billingAssociatedVoucherSchema = z
|
|
35
|
+
.object({
|
|
36
|
+
cuit: z
|
|
37
|
+
.string()
|
|
38
|
+
.trim()
|
|
39
|
+
.regex(/^\d{11}$/)
|
|
40
|
+
.optional(),
|
|
41
|
+
numero: z.number().int().positive().optional(),
|
|
42
|
+
puntoVenta: z.number().int().positive().optional(),
|
|
43
|
+
shortcut: z.string().trim().min(1).optional(),
|
|
44
|
+
tipo: z.number().int().positive().optional(),
|
|
45
|
+
})
|
|
46
|
+
.optional();
|
|
47
|
+
export const billingCommandSchema = z.object({
|
|
48
|
+
associatedVoucher: billingAssociatedVoucherSchema,
|
|
49
|
+
billingDate: z.string().trim().optional(),
|
|
50
|
+
concept: billingConceptSchema,
|
|
51
|
+
currencyCode: z.string().trim().length(3).default('ARS'),
|
|
52
|
+
documentNumber: z.number().int().nonnegative().optional(),
|
|
53
|
+
documentType: billingDocumentTypeSchema.default('consumidor-final'),
|
|
54
|
+
dryRun: z.boolean().default(false),
|
|
55
|
+
emit: z.boolean().default(false),
|
|
56
|
+
exchangeRate: z.number().positive().default(1),
|
|
57
|
+
dueDay: z.number().int().min(1).max(31).optional(),
|
|
58
|
+
ivaCondition: billingIvaConditionSchema,
|
|
59
|
+
pointOfSale: z.number().int().positive().optional(),
|
|
60
|
+
serviceEndDate: z.string().trim().optional(),
|
|
61
|
+
serviceStartDate: z.string().trim().optional(),
|
|
62
|
+
shortcut: z
|
|
63
|
+
.string()
|
|
64
|
+
.trim()
|
|
65
|
+
.min(1)
|
|
66
|
+
.transform((value) => value),
|
|
67
|
+
totalAmount: z.number().positive(),
|
|
68
|
+
});
|
|
69
|
+
//# sourceMappingURL=billing.schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.schemas.js","sourceRoot":"","sources":["../../../src/modules/billing/billing.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,uBAAuB,GAAG;IAC9B,CAAC,EAAE,WAAW;IACd,QAAQ,EAAE,WAAW;IACrB,SAAS,EAAE,WAAW;IACtB,EAAE,EAAE,qBAAqB;IACzB,uBAAuB,EAAE,qBAAqB;IAC9C,qBAAqB,EAAE,qBAAqB;IAC5C,CAAC,EAAE,WAAW;IACd,QAAQ,EAAE,WAAW;IACrB,SAAS,EAAE,WAAW;CACd,CAAC;AAEX,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,UAAU,CAC9C,CAAC,KAAK,EAAE,EAAE;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AAE;SACR,IAAI,EAAE;SACN,GAAG,CAAC,CAAC,CAAC;SACN,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAwB,CAAC;IACjD,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACnC,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BillingExecutionResult } from './billing.types.internal';
|
|
2
|
+
interface BillingSerializeOptions {
|
|
3
|
+
readonly raw?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function serializeBillingResult(result: BillingExecutionResult, options?: BillingSerializeOptions): Record<string, unknown>;
|
|
6
|
+
export declare function serializeBillingBatch(results: BillingExecutionResult[], options?: BillingSerializeOptions): Array<Record<string, unknown>>;
|
|
7
|
+
export declare function formatRawBillingResponse(result: BillingExecutionResult): Record<string, string> | NonNullable<BillingExecutionResult['response']['raw']>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
function formatRawResponse(result) {
|
|
2
|
+
if (result.response.raw) {
|
|
3
|
+
return result.response.raw;
|
|
4
|
+
}
|
|
5
|
+
return {
|
|
6
|
+
mensaje: 'Sin emision real. Use --emitir para obtener una respuesta de ARCA.',
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
function formatVoucherSummary(result) {
|
|
10
|
+
return {
|
|
11
|
+
atajo: result.voucherKind.shortcut,
|
|
12
|
+
cae: result.response.cae,
|
|
13
|
+
caeVencimiento: result.response.caeVencimiento,
|
|
14
|
+
comprobante: result.voucherKind.displayName,
|
|
15
|
+
errores: result.response.errors,
|
|
16
|
+
estado: result.response.status,
|
|
17
|
+
eventos: result.response.events,
|
|
18
|
+
observaciones: result.response.observaciones,
|
|
19
|
+
observacion: result.response.observacion,
|
|
20
|
+
solicitud: result.payload,
|
|
21
|
+
previsualizacion: result.dryRun,
|
|
22
|
+
resultado: result.response.resultado,
|
|
23
|
+
sugerencias: result.response.suggestions,
|
|
24
|
+
tipoArca: result.voucherKind.arcaType,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export function serializeBillingResult(result, options = {}) {
|
|
28
|
+
if (options.raw) {
|
|
29
|
+
return {
|
|
30
|
+
atajo: result.voucherKind.shortcut,
|
|
31
|
+
comprobante: result.voucherKind.displayName,
|
|
32
|
+
solicitud: result.payload,
|
|
33
|
+
previsualizacion: result.dryRun,
|
|
34
|
+
respuesta: formatRawResponse(result),
|
|
35
|
+
sugerencias: result.response.suggestions,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
return formatVoucherSummary(result);
|
|
39
|
+
}
|
|
40
|
+
export function serializeBillingBatch(results, options = {}) {
|
|
41
|
+
return results.map((result, index) => ({
|
|
42
|
+
atajo: result.voucherKind.shortcut,
|
|
43
|
+
indice: index + 1,
|
|
44
|
+
comprobante: result.voucherKind.displayName,
|
|
45
|
+
...serializeBillingResult(result, options),
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
export function formatRawBillingResponse(result) {
|
|
49
|
+
return formatRawResponse(result);
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=billing.serialize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.serialize.js","sourceRoot":"","sources":["../../../src/modules/billing/billing.serialize.ts"],"names":[],"mappings":"AAMA,SAAS,iBAAiB,CACxB,MAA8B;IAE9B,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC;QACxB,OAAO,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC;IAC7B,CAAC;IAED,OAAO;QACL,OAAO,EAAE,oEAAoE;KAC9E,CAAC;AACJ,CAAC;AAED,SAAS,oBAAoB,CAAC,MAA8B;IAC1D,OAAO;QACL,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,QAAQ;QAClC,GAAG,EAAE,MAAM,CAAC,QAAQ,CAAC,GAAG;QACxB,cAAc,EAAE,MAAM,CAAC,QAAQ,CAAC,cA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AG,CAAC;QACjB,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,WAAW;QAC3C,GAAG,sBAAsB,CAAC,MAAM,EAAE,OAAO,CAAC;KAC3C,CAAC,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,MAA8B;IAE9B,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { INextVoucher } from '@arcasdk/core/lib/domain/types/voucher.types';
|
|
2
|
+
import type { ResolvedArcaRuntime } from '../../services/arca/arca-context.resolver';
|
|
3
|
+
import type { BillingCommandInput } from './billing.schemas';
|
|
4
|
+
import type { VoucherKindDefinition } from './billing.types';
|
|
5
|
+
import type { BillingExecutionResult, BillingGateway } from './billing.types.internal';
|
|
6
|
+
export interface BillingExecutionOptions {
|
|
7
|
+
readonly gateway: BillingGateway;
|
|
8
|
+
readonly input: BillingCommandInput;
|
|
9
|
+
readonly runtime: ResolvedArcaRuntime;
|
|
10
|
+
}
|
|
11
|
+
export declare class BillingService {
|
|
12
|
+
execute(options: BillingExecutionOptions): Promise<BillingExecutionResult>;
|
|
13
|
+
buildVoucherPayload(input: BillingCommandInput, runtime: ResolvedArcaRuntime, voucherKind?: VoucherKindDefinition): INextVoucher;
|
|
14
|
+
private requireVoucherKind;
|
|
15
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { InputValidationError } from '../../lib/errors/app-error.js';
|
|
2
|
+
import { resolveTaxAmounts } from './billing.amounts.js';
|
|
3
|
+
import { resolveAssociatedVouchers } from './billing.associated-vouchers.js';
|
|
4
|
+
import { DEFAULT_EXCHANGE_RATE } from './billing.constants.js';
|
|
5
|
+
import { resolveBillingDateRange } from './billing.date-range.js';
|
|
6
|
+
import { resolveBillingConceptCode, resolveBillingCurrencyCode, resolveBillingDocumentTypeCode, resolveBillingIvaConditionCode, } from './billing.mappers.js';
|
|
7
|
+
import { validateDocumentIdentity } from './billing.validation.js';
|
|
8
|
+
import { createDryRunResponse, mapBillingResponse } from './billing-response.js';
|
|
9
|
+
import { getVoucherKindByShortcut } from './voucher-kind-map.js';
|
|
10
|
+
export class BillingService {
|
|
11
|
+
async execute(options) {
|
|
12
|
+
const voucherKind = this.requireVoucherKind(options.input.shortcut);
|
|
13
|
+
const payload = this.buildVoucherPayload(options.input, options.runtime, voucherKind);
|
|
14
|
+
if (options.input.dryRun || !options.input.emit) {
|
|
15
|
+
return {
|
|
16
|
+
dryRun: true,
|
|
17
|
+
environment: options.runtime.environment,
|
|
18
|
+
payload,
|
|
19
|
+
response: createDryRunResponse(),
|
|
20
|
+
voucherKind,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
const response = await options.gateway.createNextVoucher(payload);
|
|
24
|
+
return {
|
|
25
|
+
dryRun: false,
|
|
26
|
+
environment: options.runtime.environment,
|
|
27
|
+
payload,
|
|
28
|
+
response: mapBillingResponse(response),
|
|
29
|
+
voucherKind,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
buildVoucherPayload(input, runtime, voucherKind = this.requireVoucherKind(input.shortcut)) {
|
|
33
|
+
const pointOfSale = input.pointOfSale ?? runtime.pointOfSale;
|
|
34
|
+
if (!pointOfSale) {
|
|
35
|
+
throw new InputValidationError('Falta el punto de venta. Use --punto-venta o --pv, o configurelo con "arcli config establecer puntoVenta <valor>".');
|
|
36
|
+
}
|
|
37
|
+
const dateRange = resolveBillingDateRange(input);
|
|
38
|
+
const concept = resolveBillingConceptCode(input.concept);
|
|
39
|
+
const documentType = resolveBillingDocumentTypeCode(input.documentType);
|
|
40
|
+
const ivaCondition = resolveBillingIvaConditionCode(input.ivaCondition);
|
|
41
|
+
const associatedVouchers = resolveAssociatedVouchers({
|
|
42
|
+
input,
|
|
43
|
+
requireVoucherKind: (shortcut) => this.requireVoucherKind(shortcut),
|
|
44
|
+
voucherKind,
|
|
45
|
+
});
|
|
46
|
+
const taxAmounts = resolveTaxAmounts(input.totalAmount, input.ivaCondition, voucherKind);
|
|
47
|
+
validateDocumentIdentity(input, voucherKind);
|
|
48
|
+
const payload = {
|
|
49
|
+
CantReg: 1,
|
|
50
|
+
CbteFch: dateRange.billingDate,
|
|
51
|
+
CbteTipo: voucherKind.arcaType,
|
|
52
|
+
Concepto: concept,
|
|
53
|
+
CondicionIVAReceptorId: ivaCondition,
|
|
54
|
+
DocTipo: documentType,
|
|
55
|
+
FchServDesde: concept === 1 ? undefined : dateRange.serviceStartDate,
|
|
56
|
+
FchServHasta: concept === 1 ? undefined : dateRange.serviceEndDate,
|
|
57
|
+
FchVtoPago: concept === 1 ? undefined : dateRange.paymentDueDate,
|
|
58
|
+
ImpIVA: taxAmounts.ivaAmount,
|
|
59
|
+
ImpNeto: taxAmounts.netAmount,
|
|
60
|
+
ImpOpEx: 0,
|
|
61
|
+
ImpTotConc: 0,
|
|
62
|
+
ImpTotal: input.totalAmount,
|
|
63
|
+
ImpTrib: 0,
|
|
64
|
+
MonCotiz: input.exchangeRate ?? DEFAULT_EXCHANGE_RATE,
|
|
65
|
+
MonId: resolveBillingCurrencyCode(input.currencyCode),
|
|
66
|
+
PtoVta: pointOfSale,
|
|
67
|
+
};
|
|
68
|
+
if (taxAmounts.iva) {
|
|
69
|
+
payload.Iva = taxAmounts.iva;
|
|
70
|
+
}
|
|
71
|
+
if (typeof input.documentNumber === 'number') {
|
|
72
|
+
payload.DocNro = input.documentNumber;
|
|
73
|
+
}
|
|
74
|
+
if (associatedVouchers) {
|
|
75
|
+
payload.CbtesAsoc = associatedVouchers;
|
|
76
|
+
}
|
|
77
|
+
// El SDK tipa DocNro como obligatorio, pero el CLI permite omitirlo cuando el usuario no lo informa.
|
|
78
|
+
return payload;
|
|
79
|
+
}
|
|
80
|
+
requireVoucherKind(shortcut) {
|
|
81
|
+
const definition = getVoucherKindByShortcut(shortcut);
|
|
82
|
+
if (!definition) {
|
|
83
|
+
throw new InputValidationError(`El atajo "${shortcut}" no corresponde a un comprobante soportado.`);
|
|
84
|
+
}
|
|
85
|
+
return definition;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=billing.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.service.js","sourceRoot":"","sources":["../../../src/modules/billing/billing.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAGlE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EACL,yBAAyB,EACzB,0BAA0B,EAC1B,8BAA8B,EAC9B,8BAA8B,GAC/B,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAc9D,MAAM,OAAO,cAAc;IAClB,KAAK,CAAC,OAAO,CAAC,OAAgC;QACnD,MAAM,WAAW,GAAG,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QACpE,MAAM,OAAO,GAAG,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QAEtF,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;YAChD,OAAO;gBACL,MAAM,EAAE,IAAI;gBACZ,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,WAAW;gBACxC,OAAO;gBACP,QA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QAAQ,CAAC,CAAC;QAEtD,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,oBAAoB,CAAC,aAAa,QAAQ,8CAA8C,CAAC,CAAC;QACtG,CAAC;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;CACF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BillingExecutionResult } from './billing.types.internal';
|
|
2
|
+
interface BillingTextOptions {
|
|
3
|
+
readonly environment?: 'produccion' | 'testing';
|
|
4
|
+
readonly previewShown?: boolean;
|
|
5
|
+
readonly raw?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function formatBillingResultAsText(result: BillingExecutionResult, options?: BillingTextOptions): string;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { contentPanel, renderObject } from '../../ui/index.js';
|
|
2
|
+
import { formatEnvironmentBanner, formatPayloadPreview, formatResultPanel, formatStatusBadge } from './billing.display.js';
|
|
3
|
+
import { formatRawBillingResponse } from './billing.serialize.js';
|
|
4
|
+
function formatObservationList(observaciones) {
|
|
5
|
+
return observaciones.map((item, index) => `${index + 1}. ${item}`).join('\n');
|
|
6
|
+
}
|
|
7
|
+
export function formatBillingResultAsText(result, options = {}) {
|
|
8
|
+
const environmentLines = options.previewShown
|
|
9
|
+
? []
|
|
10
|
+
: formatEnvironmentBanner(options.environment ?? result.environment);
|
|
11
|
+
if (options.raw) {
|
|
12
|
+
if (result.dryRun) {
|
|
13
|
+
return [...environmentLines, formatPayloadPreview(result)].join('\n\n');
|
|
14
|
+
}
|
|
15
|
+
const lines = [contentPanel('Respuesta bruta', renderObject(formatRawBillingResponse(result)), 'wide', 'info')];
|
|
16
|
+
if (!options.previewShown) {
|
|
17
|
+
lines.unshift(formatPayloadPreview(result));
|
|
18
|
+
}
|
|
19
|
+
return [...environmentLines, ...lines].join('\n\n');
|
|
20
|
+
}
|
|
21
|
+
if (result.dryRun) {
|
|
22
|
+
return [...environmentLines, formatPayloadPreview(result)].join('\n\n');
|
|
23
|
+
}
|
|
24
|
+
const lines = [...environmentLines];
|
|
25
|
+
if (!options.previewShown) {
|
|
26
|
+
lines.push(formatPayloadPreview(result));
|
|
27
|
+
}
|
|
28
|
+
lines.push(formatResultPanel(result, formatStatusBadge(result)));
|
|
29
|
+
if (result.response.observaciones.length > 0) {
|
|
30
|
+
lines.push(contentPanel('Observaciones', formatObservationList(result.response.observaciones), 'wide', 'warning'));
|
|
31
|
+
}
|
|
32
|
+
if (result.response.events.length > 0) {
|
|
33
|
+
lines.push(contentPanel('Eventos', renderObject(result.response.events), 'wide', 'info'));
|
|
34
|
+
}
|
|
35
|
+
if (result.response.errors.length > 0) {
|
|
36
|
+
lines.push(contentPanel('Errores', renderObject(result.response.errors), 'wide', 'danger'));
|
|
37
|
+
}
|
|
38
|
+
const suggestions = result.response.suggestions ?? [];
|
|
39
|
+
if (suggestions.length > 0) {
|
|
40
|
+
lines.push(contentPanel('Sugerencias', suggestions.map((item) => `• ${item}`).join('\n'), 'wide', 'info'));
|
|
41
|
+
}
|
|
42
|
+
return lines.join('\n\n');
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=billing.text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.text.js","sourceRoot":"","sources":["../../../src/modules/billing/billing.text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAEtD,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACxH,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAS/D,SAAS,qBAAqB,CAAC,aAAgC;IAC7D,OAAO,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC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' | 'b' | 'c';
|
|
2
|
+
export type VoucherFamily = 'factura' | 'nota-credito' | 'nota-debito' | 'factura-credito-electronica' | 'nota-credito-electronica' | 'nota-debito-electronica';
|
|
3
|
+
export type VoucherShortcut = 'fa' | 'fb' | 'fc' | 'nca' | 'ncb' | 'ncc' | 'nda' | 'ndb' | 'ndc' | 'fcea' | 'fceb' | 'fcec' | 'ncea' | 'nceb' | 'ncec' | 'ndea' | 'ndeb' | 'ndec';
|
|
4
|
+
export type VoucherDisplayName = 'Factura A' | 'Factura B' | 'Factura C' | 'Nota de credito A' | 'Nota de credito B' | 'Nota de credito C' | 'Nota de debito A' | 'Nota de debito B' | 'Nota de debito C' | 'Factura de credito electronica A' | 'Factura de credito electronica B' | 'Factura de credito electronica C' | 'Nota de credito electronica A' | 'Nota de credito electronica B' | 'Nota de credito electronica C' | 'Nota de debito electronica A' | 'Nota de debito electronica B' | 'Nota de debito electronica C';
|
|
5
|
+
export interface VoucherKindDefinition {
|
|
6
|
+
readonly arcaType: number;
|
|
7
|
+
readonly displayName: VoucherDisplayName;
|
|
8
|
+
readonly family: VoucherFamily;
|
|
9
|
+
readonly isElectronicCredit: boolean;
|
|
10
|
+
readonly letter: VoucherLetter;
|
|
11
|
+
readonly requiresAssociatedVoucher: boolean;
|
|
12
|
+
readonly shortcut: VoucherShortcut;
|
|
13
|
+
}
|