braintree / braintree-web

A suite of tools for integrating Braintree in the browser
https://developer.paypal.com/braintree/docs/start/hello-client/javascript/v3
MIT License
444 stars 134 forks source link

PaymentDataRequest allowedCountryCodes not taking effect #719

Open danshirley1 opened 4 months ago

danshirley1 commented 4 months ago

General information

Issue description

For Google Pay, If I set a country code of UK for shippingAddressParameters.allowedCountryCodes in my call to createPaymentDataRequest() should I be able to select a delivery address from another country? It seems that when I try an address in France I can select that address and submit the payment successfully with no messaging or issue.

Actual Result

I can select a shipping address in France.

Expected Result

I'm assuming I shouldn't be able to select a shipping address in a country other than UK.

Code Example

        const paymentDataRequest = googlePaymentInstance.createPaymentDataRequest({
          transactionInfo: {
            countryCode: 'GB',
            currencyCode: 'GBP,
            totalPriceStatus: 'ESTIMATED',
            totalPrice: '123.45',
          },
          shippingAddressRequired: true,
          shippingOptionRequired: true,
          emailRequired: true,
          callbackIntents: ['PAYMENT_AUTHORIZATION', 'SHIPPING_ADDRESS', 'SHIPPING_OPTION'],
          shippingAddressParameters: {
            allowedCountryCodes: ['UK'],
          },
        });

        const paymentData = await paymentsClient.loadPaymentData(paymentDataRequest);
        ...