Skip to content

Fix seat markup pricing - prioritize seat maps over offer services for total calculation#432

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/fix-416
Draft

Fix seat markup pricing - prioritize seat maps over offer services for total calculation#432
Copilot wants to merge 4 commits intomainfrom
copilot/fix-416

Conversation

Copy link

Copilot AI commented Aug 1, 2025

When seat markup was applied using the markup prop, the component would display the correct marked-up price in the seat selection interface but would still calculate totals using the original (non-marked-up) prices from the offer's available_services.

The Problem

Consider this scenario:

  • Original seat price: 23.39 EUR
  • 10% markup applied: markup: { seats: { rate: 0.1, amount: 0 } }
  • Expected total: 25.73 EUR (23.39 × 1.1)
  • Actual total displayed: 23.39 EUR

The issue was in the getTotalAmountForServices function which had this logic:

  1. First check if service ID exists in offer's available_services (original prices)
  2. If found, use that price and stop
  3. Only if not found, check seat maps (marked-up prices)

Since seat services exist in both the offer AND seat maps, it would always use the original price from step 1.

The Solution

Modified getTotalAmountForServices to prioritize seat maps over offer services:

  1. First check if service ID exists in seat maps (marked-up prices)
  2. If found, use that price
  3. Otherwise, fall back to offer's available_services (for non-seat services)

This ensures:

  • ✅ Seat services use marked-up prices from seat maps
  • ✅ Other services (baggage, etc.) continue working as before
  • ✅ Backward compatibility maintained for cases without seat maps

Testing

Added comprehensive tests covering:

  • Seat services with markup applied correctly
  • Mixed services (seats + baggage) handled properly
  • Fallback to offer services when not found in seat maps
  • Backward compatibility when no seat maps provided

Fixes #416.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • downloads.sentry-cdn.com
  • googlechromelabs.github.io
    • Triggering command: /usr/local/bin/node install.mjs (dns block)
  • https://storage.googleapis.com/chrome-for-testing-public/127.0.6533.88/linux64/chrome-headless-shell-linux64.zip
    • Triggering command: /usr/local/bin/node install.mjs (http block)

If you need me to access, download, or install something from one of these locations, you can either:


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 2 commits August 1, 2025 16:23
Co-authored-by: igorp1 <2934495+igorp1@users.noreply.github.com>
Co-authored-by: igorp1 <2934495+igorp1@users.noreply.github.com>
Copilot AI changed the title [WIP] Wrong return price value (Seats) Fix seat markup pricing - prioritize seat maps over offer services for total calculation Aug 1, 2025
Copilot AI requested a review from igorp1 August 1, 2025 16:33
@igorp1
Copy link
Contributor

igorp1 commented Aug 7, 2025

@copilot fix linter errors

Co-authored-by: igorp1 <2934495+igorp1@users.noreply.github.com>
Copy link
Author

Copilot AI commented Aug 7, 2025

@copilot fix linter errors

Fixed the linter errors. The issues were prettier formatting problems in both modified files. Applied automatic formatting fixes and all lint checks now pass. (f98da31)

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • downloads.sentry-cdn.com
    • Triggering command: /usr/local/bin/node ./scripts/install.js (dns block)
  • googlechromelabs.github.io
    • Triggering command: /usr/local/bin/node install.mjs (dns block)
  • https://storage.googleapis.com/chrome-for-testing-public/127.0.6533.88/linux64/chrome-headless-shell-linux64.zip
    • Triggering command: /usr/local/bin/node install.mjs (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrong return price value (Seats)

2 participants