-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #106 from bold-commerce/CHK-4371
ApplePay for PPCP
- Loading branch information
Showing
11 changed files
with
101 additions
and
28 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,12 +2,14 @@ define( | |
[ | ||
'Magento_Checkout/js/model/quote', | ||
'Magento_Checkout/js/model/shipping-service', | ||
'Bold_CheckoutPaymentBooster/js/action/express-pay/save-shipping-information-action' | ||
'Bold_CheckoutPaymentBooster/js/action/express-pay/save-shipping-information-action', | ||
'Magento_Checkout/js/action/select-shipping-method' | ||
], | ||
function ( | ||
quote, | ||
shippingService, | ||
saveShippingInformation | ||
saveShippingInformation, | ||
selectShippingMethodAction | ||
) { | ||
'use strict'; | ||
|
||
|
@@ -17,13 +19,13 @@ define( | |
* @param {Object} shippingMethod | ||
* @return void | ||
*/ | ||
return function (shippingMethod = null) { | ||
return async function (shippingMethod = null) { | ||
let newMethod = null; | ||
if (shippingMethod !== null) { | ||
let availableMethods = shippingService.getShippingRates().filter((method) => { | ||
let methodId = `${method.carrier_code}_${method.method_code}`; | ||
methodId = methodId.replace(/\s/g, ''); | ||
return methodId === shippingMethod['id']; | ||
return methodId === shippingMethod['id'] || methodId === shippingMethod['identifier']; | ||
}); | ||
if (availableMethods.length > 0) { | ||
newMethod = availableMethods[0]; | ||
|
@@ -32,12 +34,13 @@ define( | |
newMethod = shippingService.getShippingRates().first(); | ||
} | ||
if (newMethod !== null) { | ||
quote.shippingMethod(newMethod); | ||
selectShippingMethodAction(newMethod); | ||
} | ||
if (quote.guestEmail === null) { | ||
quote.guestEmail = '[email protected]'; | ||
} | ||
saveShippingInformation(); | ||
|
||
await saveShippingInformation(); | ||
} | ||
} | ||
); |
This file contains 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
This file contains 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
This file contains 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