diff --git a/lib/recurly/apple-pay.js b/lib/recurly/apple-pay.js index 08752cdc2..b4c4b3234 100644 --- a/lib/recurly/apple-pay.js +++ b/lib/recurly/apple-pay.js @@ -91,6 +91,7 @@ class ApplePay extends Emitter { supportedNetworks: this.config.supportedNetworks, merchantCapabilities: this.config.merchantCapabilities, requiredBillingContactFields: ['postalAddress'], + requiredShippingContactFields: this.config.requiredShippingContactFields, total: this.totalLineItem }); @@ -199,6 +200,7 @@ class ApplePay extends Emitter { this.config.merchantCapabilities = info.merchantCapabilities || []; this.config.supportedNetworks = info.supportedNetworks || []; + this.config.requiredShippingContactFields = options.requiredShippingContactFields || []; this.emit('ready'); } @@ -301,6 +303,9 @@ class ApplePay extends Emitter { onShippingContactSelected (event) { const status = this.session.STATUS_SUCCESS; const newShippingMethods = []; + + this.emit('shippingContactSelected', event); + this.session.completeShippingContactSelection(status, newShippingMethods, this.finalTotalLineItem, this.lineItems); } @@ -345,6 +350,7 @@ class ApplePay extends Emitter { debug('Token received', token); this.session.completePayment(this.session.STATUS_SUCCESS); + this.emit('authorized', event); this.emit('token', token); } });