Compare commits
No commits in common. "595e08459d93c326cc4c918b3e1778cfbf6e3db7" and "538c081d58ec010b677fdd9799174764609d82d8" have entirely different histories.
595e08459d
...
538c081d58
@ -4,13 +4,6 @@ import tailwindcss from "@tailwindcss/vite";
|
|||||||
import react from "@vitejs/plugin-react";
|
import react from "@vitejs/plugin-react";
|
||||||
import { defineConfig } from "vite";
|
import { defineConfig } from "vite";
|
||||||
|
|
||||||
const appNodeModulesPath = path.resolve(__dirname, "./node_modules");
|
|
||||||
const hmrHost = process.env.VITE_HMR_HOST;
|
|
||||||
const hmrClientPort = process.env.VITE_HMR_CLIENT_PORT
|
|
||||||
? Number(process.env.VITE_HMR_CLIENT_PORT)
|
|
||||||
: undefined;
|
|
||||||
const hmrProtocol = process.env.VITE_HMR_PROTOCOL;
|
|
||||||
|
|
||||||
// https://vite.dev/config/
|
// https://vite.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
build: {
|
build: {
|
||||||
@ -20,26 +13,10 @@ export default defineConfig({
|
|||||||
"process.env": {},
|
"process.env": {},
|
||||||
},
|
},
|
||||||
plugins: [react(), tailwindcss()],
|
plugins: [react(), tailwindcss()],
|
||||||
server: {
|
|
||||||
host: true,
|
|
||||||
hmr:
|
|
||||||
hmrHost || hmrClientPort || hmrProtocol
|
|
||||||
? {
|
|
||||||
host: hmrHost,
|
|
||||||
clientPort: hmrClientPort,
|
|
||||||
protocol: hmrProtocol,
|
|
||||||
}
|
|
||||||
: undefined,
|
|
||||||
},
|
|
||||||
resolve: {
|
resolve: {
|
||||||
dedupe: ["react", "react-dom", "react/jsx-runtime", "react/jsx-dev-runtime"],
|
dedupe: ["react", "react-dom"],
|
||||||
alias: {
|
alias: {
|
||||||
"@": path.resolve(__dirname, "./src"),
|
"@": path.resolve(__dirname, "./src"),
|
||||||
react: path.resolve(appNodeModulesPath, "react"),
|
|
||||||
"react-dom": path.resolve(appNodeModulesPath, "react-dom"),
|
|
||||||
"react-dom/client": path.resolve(appNodeModulesPath, "react-dom/client.js"),
|
|
||||||
"react/jsx-runtime": path.resolve(appNodeModulesPath, "react/jsx-runtime.js"),
|
|
||||||
"react/jsx-dev-runtime": path.resolve(appNodeModulesPath, "react/jsx-dev-runtime.js"),
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import assert from "node:assert/strict";
|
|||||||
import test from "node:test";
|
import test from "node:test";
|
||||||
|
|
||||||
import { DiscountPercentage } from "@erp/core/api";
|
import { DiscountPercentage } from "@erp/core/api";
|
||||||
import { CurrencyCode, LanguageCode, UniqueID, UtcDate } from "@repo/rdx-ddd";
|
import { UniqueID } from "@repo/rdx-ddd";
|
||||||
import { Maybe, Result } from "@repo/rdx-utils";
|
import { Maybe, Result } from "@repo/rdx-utils";
|
||||||
|
|
||||||
import { ProformaToIssuedInvoiceConverter } from "./proforma-to-issued-invoice-props-converter";
|
import { ProformaToIssuedInvoiceConverter } from "./proforma-to-issued-invoice-props-converter";
|
||||||
@ -68,89 +68,3 @@ test("toCreateProps no materializa VerifactuRecord ni policy en el converter", (
|
|||||||
assert.equal(result.isSuccess, true);
|
assert.equal(result.isSuccess, true);
|
||||||
assert.equal(result.data.verifactu.isNone(), true);
|
assert.equal(result.data.verifactu.isNone(), true);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("resolvePaymentTerm normaliza percentage.value cuando llega numérico del catálogo", () => {
|
|
||||||
const converter = new ProformaToIssuedInvoiceConverter();
|
|
||||||
const companyId = UniqueID.generateNewID();
|
|
||||||
const paymentTermId = UniqueID.generateNewID();
|
|
||||||
const invoiceDateResult = UtcDate.createFromISO("2026-08-20");
|
|
||||||
const languageCodeResult = LanguageCode.create("es");
|
|
||||||
const currencyCodeResult = CurrencyCode.create("EUR");
|
|
||||||
const discountResult = DiscountPercentage.create({ value: 0 });
|
|
||||||
|
|
||||||
assert.equal(invoiceDateResult.isSuccess, true);
|
|
||||||
assert.equal(languageCodeResult.isSuccess, true);
|
|
||||||
assert.equal(currencyCodeResult.isSuccess, true);
|
|
||||||
assert.equal(discountResult.isSuccess, true);
|
|
||||||
|
|
||||||
const result = converter["resolvePaymentTerm"]({
|
|
||||||
proforma: {
|
|
||||||
companyId,
|
|
||||||
id: UniqueID.generateNewID(),
|
|
||||||
targetInvoiceSeriesCode: Maybe.none(),
|
|
||||||
operationDate: Maybe.some(invoiceDateResult.data),
|
|
||||||
description: {
|
|
||||||
unwrap: () => "Servicio mensual",
|
|
||||||
},
|
|
||||||
languageCode: languageCodeResult.data,
|
|
||||||
currencyCode: currencyCodeResult.data,
|
|
||||||
notes: Maybe.none(),
|
|
||||||
reference: Maybe.none(),
|
|
||||||
customerId: UniqueID.generateNewID(),
|
|
||||||
totals: () => ({
|
|
||||||
subtotalAmount: {} as never,
|
|
||||||
itemsDiscountAmount: {} as never,
|
|
||||||
globalDiscountAmount: {} as never,
|
|
||||||
totalDiscountAmount: {} as never,
|
|
||||||
taxableAmount: {} as never,
|
|
||||||
ivaAmount: {} as never,
|
|
||||||
recAmount: {} as never,
|
|
||||||
retentionAmount: {} as never,
|
|
||||||
taxesAmount: {} as never,
|
|
||||||
totalAmount: {} as never,
|
|
||||||
}),
|
|
||||||
globalDiscountPercentage: discountResult.data,
|
|
||||||
} as never,
|
|
||||||
paymentMethod: {
|
|
||||||
id: UniqueID.generateNewID(),
|
|
||||||
name: "Transferencia",
|
|
||||||
description: Maybe.none(),
|
|
||||||
},
|
|
||||||
paymentTerm: Maybe.some({
|
|
||||||
id: paymentTermId.toPrimitive(),
|
|
||||||
name: "30 días",
|
|
||||||
description: "Pago estándar",
|
|
||||||
isActive: true,
|
|
||||||
dueRules: [
|
|
||||||
{
|
|
||||||
dueDays: "30",
|
|
||||||
percentage: {
|
|
||||||
value: 10000,
|
|
||||||
scale: 2,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
} as never),
|
|
||||||
taxRegime: {
|
|
||||||
code: "01",
|
|
||||||
description: "Régimen general",
|
|
||||||
},
|
|
||||||
fiscalClassification: {
|
|
||||||
operationQualificationCode: null,
|
|
||||||
exemptionReasonCode: null,
|
|
||||||
},
|
|
||||||
usesVerifactu: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
assert.equal(result.isSuccess, true);
|
|
||||||
assert.equal(result.data.isSome(), true);
|
|
||||||
assert.deepEqual(result.data.unwrap().dueRules, [
|
|
||||||
{
|
|
||||||
dueDays: "30",
|
|
||||||
percentage: {
|
|
||||||
value: "10000",
|
|
||||||
scale: 2,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
|
|||||||
@ -306,7 +306,7 @@ export class ProformaToIssuedInvoiceConverter implements IProformaToIssuedInvoic
|
|||||||
dueRules: paymentTerm.dueRules.map((rule) => ({
|
dueRules: paymentTerm.dueRules.map((rule) => ({
|
||||||
dueDays: rule.dueDays,
|
dueDays: rule.dueDays,
|
||||||
percentage: {
|
percentage: {
|
||||||
value: String(rule.percentage.value),
|
value: rule.percentage.value,
|
||||||
scale: rule.percentage.scale,
|
scale: rule.percentage.scale,
|
||||||
},
|
},
|
||||||
})),
|
})),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user