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 = {
|
export type PaymentMethodDetail = {
|
||||||
id: string;
|
id: UniqueID;
|
||||||
name: string;
|
companyId: UniqueID;
|
||||||
type: string;
|
name: Name;
|
||||||
|
description: Maybe<TextValue>;
|
||||||
is_active: boolean;
|
is_active: boolean;
|
||||||
created_at: string;
|
is_system: boolean;
|
||||||
updated_at: string;
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,19 +1,23 @@
|
|||||||
import type { GetPaymentMethodByIdResponseDTO } from "@erp/catalogs/common";
|
import type { GetPaymentMethodByIdResponseDTO } from "@erp/catalogs/common";
|
||||||
import type { ISnapshotBuilder } from "@erp/core/api";
|
import type { ISnapshotBuilder } from "@erp/core/api";
|
||||||
import { toNullable } from "@repo/rdx-ddd";
|
import { maybeToNullable } from "@repo/rdx-ddd";
|
||||||
|
|
||||||
import type { PaymentMethod } from "../../../../domain";
|
import type { PaymentMethod } from "../../../../domain";
|
||||||
|
|
||||||
|
export type PaymentMethodFullSnapshot = GetPaymentMethodByIdResponseDTO;
|
||||||
|
|
||||||
export interface IPaymentMethodFullSnapshotBuilder
|
export interface IPaymentMethodFullSnapshotBuilder
|
||||||
extends ISnapshotBuilder<PaymentMethod, GetPaymentMethodByIdResponseDTO> {}
|
extends ISnapshotBuilder<PaymentMethod, PaymentMethodFullSnapshot> {}
|
||||||
|
|
||||||
export class PaymentMethodFullSnapshotBuilder implements IPaymentMethodFullSnapshotBuilder {
|
export class PaymentMethodFullSnapshotBuilder implements IPaymentMethodFullSnapshotBuilder {
|
||||||
public toOutput(paymentMethod: PaymentMethod): GetPaymentMethodByIdResponseDTO {
|
public toOutput(paymentMethod: PaymentMethod): PaymentMethodFullSnapshot {
|
||||||
return {
|
return {
|
||||||
id: paymentMethod.id.toPrimitive(),
|
id: paymentMethod.id.toPrimitive(),
|
||||||
company_id: paymentMethod.companyId.toPrimitive(),
|
company_id: paymentMethod.companyId.toPrimitive(),
|
||||||
|
|
||||||
name: paymentMethod.name.toPrimitive(),
|
name: paymentMethod.name.toPrimitive(),
|
||||||
description: toNullable(paymentMethod.description, (value) => value.toPrimitive()),
|
description: maybeToNullable(paymentMethod.description, (value) => value.toPrimitive()),
|
||||||
|
|
||||||
is_active: paymentMethod.isActive,
|
is_active: paymentMethod.isActive,
|
||||||
is_system: paymentMethod.isSystem,
|
is_system: paymentMethod.isSystem,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -11,7 +11,9 @@ export class PaymentMethodSummarySnapshotBuilder implements IPaymentMethodSummar
|
|||||||
return {
|
return {
|
||||||
id: paymentMethod.id.toString(),
|
id: paymentMethod.id.toString(),
|
||||||
company_id: paymentMethod.companyId.toString(),
|
company_id: paymentMethod.companyId.toString(),
|
||||||
|
|
||||||
name: paymentMethod.name.toString(),
|
name: paymentMethod.name.toString(),
|
||||||
|
|
||||||
is_system: paymentMethod.isSystem,
|
is_system: paymentMethod.isSystem,
|
||||||
is_active: paymentMethod.isActive,
|
is_active: paymentMethod.isActive,
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user