FactuGES_ERP/modules/customer-invoices/src/api/domain/value-objects/item-discount.ts

20 lines
489 B
TypeScript
Raw Normal View History

import { Percentage, type PercentageProps } from "@repo/rdx-ddd";
import type { Result } from "@repo/rdx-utils";
2025-09-05 11:23:45 +00:00
type ItemDiscountProps = Pick<PercentageProps, "value">;
export class ItemDiscount extends Percentage {
static DEFAULT_SCALE = 2;
static create({ value }: ItemDiscountProps): Result<Percentage> {
return Percentage.create({
value,
scale: ItemDiscount.DEFAULT_SCALE,
});
}
static zero() {
2025-09-10 11:57:15 +00:00
return ItemDiscount.create({ value: 0 }).data;
2025-09-05 11:23:45 +00:00
}
}