remove package functionality
This commit is contained in:
parent
40a61e888e
commit
80c03bdcd9
@ -180,7 +180,7 @@ export namespace Cart {
|
||||
}
|
||||
|
||||
export interface CartItem {
|
||||
item: Tariffs.Tariff | Tariffs.Package;
|
||||
item: Tariffs.Tariff;
|
||||
/**
|
||||
* Посчитанная цена пункта корзины
|
||||
*/
|
||||
@ -196,12 +196,12 @@ export namespace Cart {
|
||||
*/
|
||||
envolvedDiscounts: string[];
|
||||
totalPrice: number;
|
||||
item: Tariffs.Tariff | Tariffs.Package;
|
||||
item: Tariffs.Tariff;
|
||||
}
|
||||
|
||||
export interface CartTotal {
|
||||
items: CartItemTotal[];
|
||||
totalPrice: number;
|
||||
priceByService: { [Key in Tariffs.ServiceType]: number;}
|
||||
priceByService: { [Key in Tariffs.ServiceType]: number; };
|
||||
}
|
||||
}
|
@ -77,11 +77,4 @@ export namespace Tariffs {
|
||||
*/
|
||||
customPrice?: number;
|
||||
}
|
||||
|
||||
export interface Package {
|
||||
id: string;
|
||||
name: string;
|
||||
services: ServiceType[];
|
||||
tariffs: Tariff[];
|
||||
}
|
||||
}
|
@ -61,12 +61,6 @@ export function calcCartData(
|
||||
totalPrice: cartItem.price,
|
||||
};
|
||||
|
||||
if (isPackage(cartItem.item)) {
|
||||
// TODO implement for package
|
||||
|
||||
throw new Error("unimplemented");
|
||||
}
|
||||
|
||||
const tariff = cartItem.item;
|
||||
|
||||
const maxPrivilegeDiscount = findMaxApplicablePrivilegeDiscount(discounts, tariff);
|
||||
@ -177,12 +171,6 @@ function calcCartItemWithPromocode(
|
||||
totalPrice: 0,
|
||||
};
|
||||
|
||||
if (isPackage(cartItem.item)) {
|
||||
// TODO implement for package
|
||||
|
||||
throw new Error("unimplemented");
|
||||
}
|
||||
|
||||
const tariff = cartItem.item;
|
||||
|
||||
discount.target.products.forEach(product => {
|
||||
@ -196,21 +184,3 @@ function calcCartItemWithPromocode(
|
||||
|
||||
return cartItemTotal;
|
||||
}
|
||||
|
||||
export function packTariffs(tariffs: Tariffs.Tariff[], id: string, name: string): Tariffs.Package {
|
||||
const services: Tariffs.ServiceType[] = [];
|
||||
tariffs.forEach(tariff => {
|
||||
if (!services.includes(tariff.privilege.serviceKey)) services.push(tariff.privilege.serviceKey);
|
||||
});
|
||||
|
||||
return {
|
||||
id,
|
||||
name,
|
||||
services,
|
||||
tariffs,
|
||||
};
|
||||
}
|
||||
|
||||
export function isPackage(item: Tariffs.Tariff | Tariffs.Package): item is Tariffs.Package {
|
||||
return "tariffs" in item;
|
||||
}
|
Loading…
Reference in New Issue
Block a user