Skip to content

Add 'get_supported_currencies' function for klarna #3378

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Sep 4, 2024

Conversation

Mayisha
Copy link
Contributor

@Mayisha Mayisha commented Aug 23, 2024

Fixes #3351

Changes proposed in this Pull Request:

Added get_supported_currencies for Klarna which returns the list of supported currencies based on the Stripe account currency.

Testing instructions

  • Connect your store to an account from the US.
  • Change your store currency to EUR.
  • Enable Klarna under the Payment Methods tab in the plugin settings.
  • As a shopper, add a product to your cart and go to the checkout page.
  • Ensure your billing country is the United States.
  • In develop branch notice that Klarna is displayed. When you select it, the Payment Element isn't displayed. The following error shows up in the browser console.
356851433-28331e36-25a2-4943-b089-6ee7e3928d48

@Mayisha Mayisha marked this pull request as draft August 23, 2024 16:05
@Mayisha Mayisha marked this pull request as ready for review September 3, 2024 06:54
@Mayisha Mayisha requested a review from james-allan September 3, 2024 06:54
@Mayisha
Copy link
Contributor Author

Mayisha commented Sep 3, 2024

@james-allan I have requested your review here as you have the most knowledge in Klarna. As you had fixed the previous issue #3108, you are the best person to save me from creating any regression. 🥺

Copy link
Contributor

@james-allan james-allan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work on this @Mayisha. The super detailed function comment is really nice at explaining the various scenarios. It should help us understand how it currently works and where problems might be if our understanding is incorrect.

Based on scenarios outlined in the comment and my understanding of Klarna requirements I tested the following matrix of set ups and customer situations:

Acc Store Currency Customer location Klarna offered (👍)
🇺🇸 US US Yes (👍)
🇺🇸 US AU No (👍)
🇺🇸 AU AU No (👍)
🇺🇸 AU US No (👍)
🇦🇺🐨🦘 AU AU Yes (👍)
🇦🇺🐨🦘 AU US No (👍)
🇦🇺🐨🦘 EUR FR No (👍)
🇦🇺🐨🦘 EUR AU No (👍)
🇫🇷 EUR FR Yes (👍)
🇫🇷 EUR Germany Yes (👍)
🇫🇷 EUR Greece Yes (👍)
🇫🇷 EUR UK No (👍)
🇫🇷 EUR Switzerland No (👍)
🇫🇷 EUR US No (👍)
🇫🇷 NOK Norway Yes (👍)
🇫🇷 NOK FR No (👍)
🇫🇷 AU AU No (👍)
🇫🇷 AU FR No (👍)
🇬🇧 GBP GB Yes (👍)
🇬🇧 GBP FR No (👍)
🇬🇧 GBP US No (👍)
🇬🇧 AU AU No (👍)
🇬🇧 AU GB No (👍)
🇬🇧 NOK NO Yes (⚠️)
  • ⚠️ This case I wasn't 100% sure but they work and appear correct based on the final case listed in the advanced rules of EEA countries.
  • 👍 Indicates that the expected outcome occurred.
  • Bolded rows are the outcomes where Klarna was shown to customers on the checkout - every other case was hidden.

@Mayisha
Copy link
Contributor Author

Mayisha commented Sep 4, 2024

Thank you @james-allan for testing so many scenarios and documenting them 💯

@Mayisha Mayisha merged commit 849b8b5 into develop Sep 4, 2024
34 of 35 checks passed
@Mayisha Mayisha deleted the fix/3351-klarna-on-checkout branch September 4, 2024 07:00
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.

Klarna is displayed when it shouldn't thus its Payment Element fails to load
2 participants