Files
goodgo-platform/apps/api/src/modules/payments/domain/value-objects/money.vo.ts
Ho Ngoc Hai f15e98a33b feat(payments): improve VNPay, MoMo, ZaloPay services with ConfigService
Migrate payment gateway services from hardcoded config to NestJS
ConfigService injection. Improve payment handler error handling and
update gateway factory specs.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-04-09 09:43:19 +07:00

22 lines
547 B
TypeScript

import { Result, ValueObject } from '@modules/shared';
interface MoneyProps {
amountVND: bigint;
}
export class Money extends ValueObject<MoneyProps> {
get value(): bigint {
return this.props.amountVND;
}
static create(amountVND: bigint): Result<Money, string> {
if (amountVND <= 0n) {
return Result.err('Số tiền phải lớn hơn 0');
}
if (amountVND > 999_999_999_999n) {
return Result.err('Số tiền vượt quá giới hạn cho phép');
}
return Result.ok(new Money({ amountVND }));
}
}