From 700ace3b7603bce910f391563343f677def180e2 Mon Sep 17 00:00:00 2001 From: david Date: Sat, 11 Oct 2025 19:39:02 +0200 Subject: [PATCH] =?UTF-8?q?Error=20en=20presentaci=C3=B3n=20de=20impuestos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../helpers/format-payment_method-dto.ts | 14 ++++++-------- .../domain/customer-invoice.full.presenter.ts | 6 ++++-- .../domain/entities/invoice-taxes/invoice-tax.ts | 3 +-- .../get-customer-invoice-by-id.response.dto.ts | 1 + 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/modules/customer-invoices/src/api/application/helpers/format-payment_method-dto.ts b/modules/customer-invoices/src/api/application/helpers/format-payment_method-dto.ts index ab626de0..38e48e52 100644 --- a/modules/customer-invoices/src/api/application/helpers/format-payment_method-dto.ts +++ b/modules/customer-invoices/src/api/application/helpers/format-payment_method-dto.ts @@ -1,13 +1,11 @@ -export function formatPaymentMethodDTO(paymentMethod: object) { +import { GetCustomerInvoiceByIdResponseDTO } from "@erp/customer-invoices/common"; + +export function formatPaymentMethodDTO( + paymentMethod?: GetCustomerInvoiceByIdResponseDTO["payment_method"] +) { if (!paymentMethod) { return null; } - //Construir objeto paymentMethod para comprobar que existe - //const value = PaymentMethod.create( - // id: paymentMethod.payment_id), - //).data; - //return value.format(locale); - - return paymentMethod.payment_description; + return paymentMethod.payment_description ?? ""; } diff --git a/modules/customer-invoices/src/api/application/presenters/domain/customer-invoice.full.presenter.ts b/modules/customer-invoices/src/api/application/presenters/domain/customer-invoice.full.presenter.ts index 00f3645d..f5c520cd 100644 --- a/modules/customer-invoices/src/api/application/presenters/domain/customer-invoice.full.presenter.ts +++ b/modules/customer-invoices/src/api/application/presenters/domain/customer-invoice.full.presenter.ts @@ -46,6 +46,8 @@ export class CustomerInvoiceFullPresenter extends Presenter< invoice_date: invoice.invoiceDate.toDateString(), operation_date: toEmptyString(invoice.operationDate, (value) => value.toDateString()), + reference: toEmptyString(invoice.reference, (value) => value.toString()), + description: toEmptyString(invoice.description, (value) => value.toString()), notes: toEmptyString(invoice.notes, (value) => value.toString()), language_code: invoice.languageCode.toString(), @@ -57,8 +59,8 @@ export class CustomerInvoiceFullPresenter extends Presenter< taxes: invoice.taxes.map((taxItem) => { return { tax_code: taxItem.tax.code, - taxable_amount: taxItem.taxableAmount.toObjectString(), - taxes_amount: taxItem.taxesAmount.toObjectString(), + taxable_amount: taxItem.taxableAmount.convertScale(2).toObjectString(), + taxes_amount: taxItem.taxesAmount.convertScale(2).toObjectString(), }; }), diff --git a/modules/customer-invoices/src/api/domain/entities/invoice-taxes/invoice-tax.ts b/modules/customer-invoices/src/api/domain/entities/invoice-taxes/invoice-tax.ts index 70bbb2f2..058ada84 100644 --- a/modules/customer-invoices/src/api/domain/entities/invoice-taxes/invoice-tax.ts +++ b/modules/customer-invoices/src/api/domain/entities/invoice-taxes/invoice-tax.ts @@ -1,12 +1,11 @@ import { Tax } from "@erp/core/api"; import { DomainEntity, UniqueID } from "@repo/rdx-ddd"; import { Result } from "@repo/rdx-utils"; -import { ItemAmount } from "../../value-objects"; import { InvoiceAmount } from "../../value-objects/invoice-amount"; export interface InvoiceTaxProps { tax: Tax; - taxesAmount: ItemAmount; + taxesAmount: InvoiceAmount; } export class InvoiceTax extends DomainEntity { diff --git a/modules/customer-invoices/src/common/dto/response/get-customer-invoice-by-id.response.dto.ts b/modules/customer-invoices/src/common/dto/response/get-customer-invoice-by-id.response.dto.ts index d247321c..c4d25f1f 100644 --- a/modules/customer-invoices/src/common/dto/response/get-customer-invoice-by-id.response.dto.ts +++ b/modules/customer-invoices/src/common/dto/response/get-customer-invoice-by-id.response.dto.ts @@ -12,6 +12,7 @@ export const GetCustomerInvoiceByIdResponseSchema = z.object({ invoice_date: z.string(), operation_date: z.string(), + reference: z.string(), description: z.string(), notes: z.string(),