Skip to content

Commit

Permalink
fix(countryCode): fix CountryCode case (#19)
Browse files Browse the repository at this point in the history
* fix(countryCode): fix CountryCode case

* upgrade version 1.4
  • Loading branch information
rsimhadri authored and GitHub Enterprise committed Nov 9, 2022
1 parent 4a3c26f commit ccbd4f1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@paypal/applepay-components",
"version": "1.3.0",
"version": "1.4.0",
"description": "A PayPal Apple Pay Library to provide Apple Pay Integration",
"main": "index.js",
"scripts": {
Expand Down
14 changes: 12 additions & 2 deletions src/applepay.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ function validateMerchant({ validationUrl, displayName } : ValidateMerchantParam
}`,
variables: {
url: validationUrl,
displayName: displayName,
displayName,
clientID: getClientID(),
merchantID: getMerchantID(),
merchantDomain: getMerchantDomain()
Expand Down Expand Up @@ -215,6 +215,16 @@ function validateMerchant({ validationUrl, displayName } : ValidateMerchantParam
function confirmOrder({ orderId, token, billingContact, shippingContact } : ConfirmOrderParams) : Promise<void | PayPalApplePayErrorType> {
logApplePayEvent('paymentauthorized');

// Fix Lowercase CountryCode from Apple
if (shippingContact?.countryCode) {
shippingContact.countryCode = shippingContact.countryCode.toUpperCase();
}

if (billingContact?.countryCode) {
billingContact.countryCode = billingContact.countryCode.toUpperCase();
}


return fetch(
`${ getPayPalDomain() }/graphql?ApproveApplePayPayment`,
{
Expand Down Expand Up @@ -244,7 +254,7 @@ function confirmOrder({ orderId, token, billingContact, shippingContact } : Conf
billingContact,
shippingContact,
clientID: getClientID(),
orderID: orderId
orderID: orderId
}
})
}
Expand Down

0 comments on commit ccbd4f1

Please sign in to comment.