Repository navigation
fix(frontend,mobile): always charge in the base currency - #69
Merged
Merged
Conversation
aelassas
added a commit
that referenced
this pull request
Nov 4, 2026
- stripe/paypal: reject payments whose currency is not the base currency and always create Stripe sessions/intents and PayPal orders in BASE_CURRENCY - booking: use half-open [from, to) overlap in checkout, consistent with search, so a booking ending on a day no longer blocks one starting that day - booking: treat properties without blockOnPay as non-blocking by setting blockOnPay=false at startup, fixing 409 on checkout for legacy properties - frontend: always re-run the search on submit, keep the search when the user changes, load the full location and ignore stale property list responses - tests: cover base currency checks, back-to-back bookings and blockOnPay init
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The backend accepts a payment only in
MI_BASE_CURRENCY, but the checkout pages charge in the currency picked in the currency menu, so a non-base payment goes through and the booking is then rejected.Example (
MI_BASE_CURRENCY=USD, header set to EUR, 1,000 USD stay): the Checkout Session is created for the converted EUR amount in EUR, the card is charged, andcheckCheckoutSessionreturns 400 "Payment currency mismatch". With this change the session is created for 1,000.00 USD; the page still shows the EUR figure as an estimate.As agreed in #68 (option 1), the payment processor now always gets
env.BASE_CURRENCY:calculateTotalPricewith the selected cancellation option, the same amount the server checks;env.BASE_CURRENCY(the server already takes the amount frombooking.price);env.BASE_CURRENCY; app users get this with the next app update;booking.pricesent to/api/checkoutis that base price instead of converting the displayed price back (the server recomputes it anyway).Displayed prices are unchanged. Backend checks are untouched. The Monthly/Yearly month-boundary case mentioned in #68 is not addressed here.
Question: Stripe and PayPal will show the USD amount while the page shows EUR. Would you like a short note such as "charged in USD" next to the total? I left it out to keep this PR to the fix.
Tests: frontend and mobile have no test setup, so no new tests; frontend and mobile lint and
tscpass. Inbackend, lint passes andnpm run testpasses except the threebooking.test.tscases that need a real Stripe key; they fail the same way without this change.Closes #68