add find discount factor function

This commit is contained in:
nflnkr 2023-08-11 12:32:54 +03:00
parent c15d17e77d
commit 211acfbd98
2 changed files with 11 additions and 0 deletions

@ -0,0 +1,10 @@
import { Discount } from "../../model";
export function findDiscountFactor(discount: Discount | null | undefined): number {
if (!discount) return 1;
if (discount.Layer === 1) return discount.Target.Products[0].Factor;
else return discount.Target.Factor;
}

@ -1,4 +1,5 @@
export * from "./cartDiscount";
export * from "./findDiscountFactor";
export * from "./loyaltyDiscount";
export * from "./privilegeDiscount";
export * from "./serviceDiscount";