fix: correctly handle discounts applied by dpn api
This commit is contained in:
@@ -111,8 +111,12 @@ class BookingResponse
|
||||
* - ERM/GRU: Gruppenrabatt (group discount for large bookings)
|
||||
* - Other ERM subtypes: Various automatic discounts
|
||||
*
|
||||
* These discounts appear as negative price items and must be accounted for when
|
||||
* comparing the API total price against the locally calculated price.
|
||||
* These discounts appear as negative price items with type "ERM" and must be
|
||||
* accounted for when comparing the API total price against the locally calculated price.
|
||||
*
|
||||
* Important: Only ERM type discounts are considered API-applied. Other negative price
|
||||
* items (like BEF transportation discounts) are already handled by the local price
|
||||
* calculator and should not be subtracted again.
|
||||
*
|
||||
* Note: Voucher discounts (AKTION, KULANZGUTSCHEIN) are handled separately via
|
||||
* getVoucherDiscountFromPrices() as they are user-initiated, not automatic.
|
||||
@@ -123,8 +127,7 @@ class BookingResponse
|
||||
{
|
||||
return array_filter(
|
||||
$this->priceItems,
|
||||
fn (PriceItem $item) => $item->totalPrice < 0
|
||||
&& false === \in_array($item->type, ['AKTION', 'KULANZGUTSCHEIN'], true)
|
||||
fn (PriceItem $item) => $item->totalPrice < 0 && 'ERM' === $item->type
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user