Skip to content
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

Shipping addresses with lettered currencies are not mapped to enum #294

Open
MiltosKaripidisPoq opened this issue Jan 26, 2024 · 3 comments
Labels

Comments

@MiltosKaripidisPoq
Copy link

Describe the bug
The PayPal SDK fails to map the currency from the shipping method when the country's currency contains letters rather than symbols. For example, Norway's kr compared to German's .

The failure is happening on the Repository class (1079 line) and specifically in this function:

fun getShippingAndPickUpOptions(selectedShippingMethod: ShippingMethodType): List<Options> {
        val currencyCode: CurrencyCode = when {
            debugConfigManager.currencyCode != null -> debugConfigManager.currencyCode!!
            shippingMethodsList.isNotEmpty() -> CurrencyCode.valueOf(shippingMethodsList.first().amount?.currencyFormatSymbolISOCurrency?.filter { it.isLetter() }.orEmpty())
            pickUpMethodsList.isNotEmpty() -> CurrencyCode.valueOf(pickUpMethodsList.first().amount?.currencyFormatSymbolISOCurrency?.filter { it.isLetter() }.orEmpty())
            else -> CurrencyCode.USD
        }
        ...

In our example, the following line gets the value of currencyFormatSymbolISOCurrency which is zł290PLN. The following line filters it and gets the result złPLN, which of course cannot be mapped to the CurrencyCode enum that expects just PLN.

CurrencyCode.valueOf(shippingMethodsList.first().amount?.currencyFormatSymbolISOCurrency?.filter { it.isLetter() }.orEmpty())

To Reproduce
Steps to reproduce the behavior:

  1. Have a shipping method of a country with lettered currency like Poland, Norway, etc.
  2. Click PayPal button to initialise it.

Expected behavior
Currency to be mapped correctly so the flow can proceed.

Additional context
I am using 1.1.0 version.

The API that is made by PayPal is /graphql and field path from the response is data.checkoutSession.cart.shippingMethods[0].amount.currencyFormatSymbolISOCurrency.

Copy link

Thank you for reaching out to the Native Checkout SDK team. This integration path is now inactive for new merchants.
If you are an existing merchant, please contact us here for further assistance.

New merchants can integrate the Native Checkout experience via the Braintree Android SDK or PayPal Android SDK.
For more information please see their respective developer documentation linked below.

@MiltosKaripidisPoq
Copy link
Author

@chpypl Could you please review it and point me to the right direction? Is it a misconfiguration from my side or an SDK issue? Thanks in advance.

@balapoq
Copy link

balapoq commented Feb 22, 2024

@MaxHastingsPP / @chpypl can we get some help with this issue please? We have an existing Paypal integration based on this SDK. We are planning to move to the new Braintree/Paypal SDK in the coming months but are currently in the process of launching apps with the existing integration in countries where the currency codes are alphanumeric. This issue is blocking the release of the apps. Any help will be much appreciated 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants