fix: privilege discount on amount
This commit is contained in:
parent
3aff04bf4a
commit
5327da77ea
@ -6,6 +6,7 @@ export type PrivilegeCartData = {
|
||||
privilegeId: string;
|
||||
description: string;
|
||||
price: number;
|
||||
amount: number;
|
||||
appliedPrivilegeDiscount: Discount | null;
|
||||
};
|
||||
|
||||
|
@ -9,7 +9,7 @@ export function applyPrivilegeDiscounts(
|
||||
cartData.services.forEach(service => {
|
||||
service.tariffs.forEach(tariff => {
|
||||
tariff.privileges.forEach(privilege => {
|
||||
const privilegeDiscount = findPrivilegeDiscount(privilege.privilegeId, privilege.price, discounts);
|
||||
const privilegeDiscount = findPrivilegeDiscount(privilege.privilegeId, privilege.amount, discounts);
|
||||
if (!privilegeDiscount) return;
|
||||
|
||||
const discountAmount = privilege.price * (1 - findDiscountFactor(privilegeDiscount));
|
||||
|
Loading…
Reference in New Issue
Block a user