From d2a314edc05c326bbe0680754bee52d6ddf34330 Mon Sep 17 00:00:00 2001 From: david Date: Fri, 22 May 2026 10:06:24 +0200 Subject: [PATCH] =?UTF-8?q?M=C3=A9todos=20de=20pago?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../models/payment-method-detail.model.ts | 13 ++++++++----- .../full/payment-method-full-snapshot-builder.ts | 12 ++++++++---- .../payment-method-summary-snapshot-builder.ts | 2 ++ 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/modules/catalogs/src/api/application/payment-methods/models/payment-method-detail.model.ts b/modules/catalogs/src/api/application/payment-methods/models/payment-method-detail.model.ts index ef161ad0..58df3fb5 100644 --- a/modules/catalogs/src/api/application/payment-methods/models/payment-method-detail.model.ts +++ b/modules/catalogs/src/api/application/payment-methods/models/payment-method-detail.model.ts @@ -1,8 +1,11 @@ +import type { Name, TextValue, UniqueID } from "@repo/rdx-ddd"; +import type { Maybe } from "@repo/rdx-utils"; + export type PaymentMethodDetail = { - id: string; - name: string; - type: string; + id: UniqueID; + companyId: UniqueID; + name: Name; + description: Maybe; is_active: boolean; - created_at: string; - updated_at: string; + is_system: boolean; }; diff --git a/modules/catalogs/src/api/application/payment-methods/snapshot-builders/full/payment-method-full-snapshot-builder.ts b/modules/catalogs/src/api/application/payment-methods/snapshot-builders/full/payment-method-full-snapshot-builder.ts index 95e4bbf5..3933e3dc 100644 --- a/modules/catalogs/src/api/application/payment-methods/snapshot-builders/full/payment-method-full-snapshot-builder.ts +++ b/modules/catalogs/src/api/application/payment-methods/snapshot-builders/full/payment-method-full-snapshot-builder.ts @@ -1,19 +1,23 @@ import type { GetPaymentMethodByIdResponseDTO } from "@erp/catalogs/common"; import type { ISnapshotBuilder } from "@erp/core/api"; -import { toNullable } from "@repo/rdx-ddd"; +import { maybeToNullable } from "@repo/rdx-ddd"; import type { PaymentMethod } from "../../../../domain"; +export type PaymentMethodFullSnapshot = GetPaymentMethodByIdResponseDTO; + export interface IPaymentMethodFullSnapshotBuilder - extends ISnapshotBuilder {} + extends ISnapshotBuilder {} export class PaymentMethodFullSnapshotBuilder implements IPaymentMethodFullSnapshotBuilder { - public toOutput(paymentMethod: PaymentMethod): GetPaymentMethodByIdResponseDTO { + public toOutput(paymentMethod: PaymentMethod): PaymentMethodFullSnapshot { return { id: paymentMethod.id.toPrimitive(), company_id: paymentMethod.companyId.toPrimitive(), + name: paymentMethod.name.toPrimitive(), - description: toNullable(paymentMethod.description, (value) => value.toPrimitive()), + description: maybeToNullable(paymentMethod.description, (value) => value.toPrimitive()), + is_active: paymentMethod.isActive, is_system: paymentMethod.isSystem, }; diff --git a/modules/catalogs/src/api/application/payment-methods/snapshot-builders/summary/payment-method-summary-snapshot-builder.ts b/modules/catalogs/src/api/application/payment-methods/snapshot-builders/summary/payment-method-summary-snapshot-builder.ts index 33514949..ffd2b517 100644 --- a/modules/catalogs/src/api/application/payment-methods/snapshot-builders/summary/payment-method-summary-snapshot-builder.ts +++ b/modules/catalogs/src/api/application/payment-methods/snapshot-builders/summary/payment-method-summary-snapshot-builder.ts @@ -11,7 +11,9 @@ export class PaymentMethodSummarySnapshotBuilder implements IPaymentMethodSummar return { id: paymentMethod.id.toString(), company_id: paymentMethod.companyId.toString(), + name: paymentMethod.name.toString(), + is_system: paymentMethod.isSystem, is_active: paymentMethod.isActive, };