Métodos de pago
This commit is contained in:
parent
77fec8fc77
commit
d2a314edc0
@ -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<TextValue>;
|
||||
is_active: boolean;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
is_system: boolean;
|
||||
};
|
||||
|
||||
@ -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<PaymentMethod, GetPaymentMethodByIdResponseDTO> {}
|
||||
extends ISnapshotBuilder<PaymentMethod, PaymentMethodFullSnapshot> {}
|
||||
|
||||
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,
|
||||
};
|
||||
|
||||
@ -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,
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user