add find discount factor function
This commit is contained in:
parent
c15d17e77d
commit
211acfbd98
10
src/utils/cart/findDiscountFactor.ts
Normal file
10
src/utils/cart/findDiscountFactor.ts
Normal file
@ -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";
|
||||
|
Loading…
Reference in New Issue
Block a user