mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
#4611 Deadcode entfernt
This commit is contained in:
@@ -314,59 +314,6 @@ export function getAvailabilityPriceForPurchaseOption(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wenn Abholung oder Versand, dann den günstigeren Preis nehmen wenn priceMaintained false ist
|
||||
* Genauere Infos https://dev.azure.com/hugendubel/ISA/_wiki/wikis/ISA.wiki/186/Anzeige-Preise
|
||||
* 18.01.24 #4611 Preis // Preisunterschiede im Warenkorb
|
||||
*/
|
||||
if (purchaseOption === 'delivery' || purchaseOption === 'pickup') {
|
||||
const catalogAvailability = availabilities.find((availability) => availability.purchaseOption === 'catalog');
|
||||
let deliveryAvailability = availabilities.find((availability) => availability.purchaseOption === 'delivery');
|
||||
const digAvailability = availabilities.find((availability) => availability.purchaseOption === 'dig-delivery');
|
||||
const b2bAvailability = availabilities.find((availability) => availability.purchaseOption === 'b2b-delivery');
|
||||
|
||||
if (purchaseOption === 'delivery') {
|
||||
if (isDigCustomer(state)) {
|
||||
deliveryAvailability = digAvailability;
|
||||
} else if (isB2bCustomer(state)) {
|
||||
deliveryAvailability = b2bAvailability;
|
||||
}
|
||||
}
|
||||
|
||||
deliveryAvailability = deliveryAvailability || digAvailability || b2bAvailability;
|
||||
|
||||
if (purchaseOption === 'delivery') {
|
||||
availability = deliveryAvailability;
|
||||
}
|
||||
|
||||
if (!deliveryAvailability?.data?.priceMaintained) {
|
||||
// if price is not maintained, use the cheaper price
|
||||
let cheapestPrice: PriceDTO =
|
||||
availability?.data?.price?.value?.value > 0
|
||||
? availability?.data?.price
|
||||
: catalogAvailability?.data?.price?.value?.value > 0
|
||||
? catalogAvailability?.data?.price
|
||||
: DEFAULT_PRICE_DTO;
|
||||
|
||||
if (
|
||||
deliveryAvailability?.data?.price?.value?.value > 0 &&
|
||||
cheapestPrice?.value?.value > deliveryAvailability?.data?.price?.value?.value
|
||||
) {
|
||||
cheapestPrice = deliveryAvailability?.data?.price;
|
||||
}
|
||||
|
||||
return cheapestPrice;
|
||||
} else {
|
||||
// #4611 #4003 Bei preisgebundenen Artikel muß der Preis von der OLA verwendet werden (store-Ava).
|
||||
// Nicht den instock-Preis verwenden.
|
||||
// Beispiel 9783150079553. Im Beispiel soll auch der Versand Preis 3,60 Euro sein.
|
||||
const pickupAvailability = availabilities.find((availability) => availability.purchaseOption === 'pickup');
|
||||
if (pickupAvailability?.data?.price?.value?.value > 0) {
|
||||
availability = pickupAvailability;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (availability && availability.data.price?.value?.value && availability.data.price) {
|
||||
return availability.data.price;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user