Skip to content

Commit

Permalink
Merge pull request #480 from Adyen/feature/AD-332a
Browse files Browse the repository at this point in the history
AD-332 Add Apple Pay Express Button with Frontend Logic and API Calls…
  • Loading branch information
pjaneta authored Nov 20, 2024
2 parents 6503906 + c3b0d00 commit a7c9f04
Showing 1 changed file with 7 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,11 @@ var AdyenExpressCheckoutHybris = (function () {
// resolve(shippingMethodUpdate);
// },
//onValidateMerchant is required if you're using your own Apple Pay certificate
onValidateMerchant: (resolve, reject, validationURL) => {
resolve();
},
onClick: function (resolve, reject) {
resolve();
},
onSubmit: function (state, component) {
// empty to block session flow, submit logic done in onAuthorized
},
onAuthorized: (resolve, reject, event) => {
var data = this.prepareDataApple(event);
this.makePayment(data, this.getAppleUrl(), resolve, reject);
onAuthorized: (paymentData, actions) => {
this.makePayment(this.prepareDataApple(paymentData), this.getAppleUrl(), actions.resolve, actions.reject);
}
});
applePayComponent.isAvailable()
Expand Down Expand Up @@ -195,8 +188,8 @@ var AdyenExpressCheckoutHybris = (function () {

// Step 7: Configure the callback to get the shopper's information.

onAuthorized: (paymentData) => {
this.makePayment(this.prepareDataGoogle(paymentData), this.getGoogleUrl())
onAuthorized: (paymentData, actions) => {
this.makePayment(this.prepareDataGoogle(paymentData), this.getGoogleUrl(), actions.resolve, actions.reject)
},
onError: function (error) {
console.log(error)
Expand Down Expand Up @@ -260,7 +253,9 @@ var AdyenExpressCheckoutHybris = (function () {
}
document.querySelector("#handleComponentResultForm").submit();
},
prepareDataApple: function (event) {
prepareDataApple: function (paymentData) {
const event = paymentData.authorizedEvent;

const baseData = {
applePayDetails: {
applePayToken: btoa(JSON.stringify(event.payment.token.paymentData))
Expand Down

0 comments on commit a7c9f04

Please sign in to comment.