Paso de factuges a proforma

This commit is contained in:
David Arranz 2026-03-25 10:49:28 +01:00
parent 41f30cde9d
commit a4615e8bc4

View File

@ -10,7 +10,7 @@ import type { CustomerPublicServices } from "@erp/customers/api";
import { import {
type Customer, type Customer,
CustomerStatus, CustomerStatus,
type CustomerTaxesProps, CustomerTaxes,
type ICustomerCreateProps, type ICustomerCreateProps,
} from "@erp/customers/api/domain"; } from "@erp/customers/api/domain";
import { type Name, type PhoneNumber, type TextValue, UniqueID } from "@repo/rdx-ddd"; import { type Name, type PhoneNumber, type TextValue, UniqueID } from "@repo/rdx-ddd";
@ -269,11 +269,14 @@ export class CreateProformaFromFactugesUseCase {
return Result.fail(ivaResult.error); return Result.fail(ivaResult.error);
} }
const defaultTaxes: CustomerTaxesProps = { const defaultTaxes = CustomerTaxes.create({
iva: Maybe.some(ivaResult.data), iva: Maybe.some(ivaResult.data),
rec: Maybe.none(), rec: Maybe.none(),
retention: Maybe.none(), retention: Maybe.none(),
}; });
if (defaultTaxes.isFailure) {
return Result.fail(defaultTaxes.error);
}
const tin = Maybe.some(customerDraft.tin); const tin = Maybe.some(customerDraft.tin);
const tradeName = Maybe.none<Name>(); const tradeName = Maybe.none<Name>();
@ -290,7 +293,7 @@ export class CreateProformaFromFactugesUseCase {
reference, reference,
fax, fax,
legalRecord, legalRecord,
defaultTaxes, defaultTaxes: defaultTaxes.data,
}); });
} }
} }