diff --git a/demo/js/appr.js b/demo/js/appr.js index dafed40..c540033 100644 --- a/demo/js/appr.js +++ b/demo/js/appr.js @@ -1 +1 @@ -!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var i in n)("object"==typeof exports?exports:e)[i]=n[i]}}(this,function(){return function(e){function t(i){if(n[i])return n[i].exports;var s=n[i]={i:i,l:!1,exports:{}};return e[i].call(s.exports,s,s.exports,t),s.l=!0,s.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,i){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){"use strict";if(Object.defineProperty(t,"__esModule",{value:!0}),window.ApplePaySession&&!ApplePaySession.supportsVersion(3)){var i="https://apple.com/apple-pay";t.PaymentRequest=function(){function e(e,t,n){this.paymentRequestID="",this.shippingAddress=null,this.shippingOption="",this.shippingType="shipping",this.paymentResolver=null,this.paymentRejector=null,this.onshippingaddresschange=null,this.onshippingoptionchange=null,this.onpaymentmethodselected=null,this.merchantIdentifier="";var s=!1;this.paymentRequest={countryCode:"",currencyCode:"",lineItems:[],merchantCapabilities:null,supportedNetworks:[],total:null,billingContact:null,requiredBillingContactFields:[],requiredShippingContactFields:[],shippingContact:null,shippingMethods:[],shippingType:"shipping"};for(var a=0,o=e;a-1||p.supportedMethods===i){if(this.paymentRequest.supportedNetworks=p.data.supportedNetworks,this.paymentRequest.countryCode=p.data.countryCode,3!==p.data.version)throw"Apple Pay needs to be version 3.";p.data.billingContact?this.paymentRequest.billingContact=p.data.billingContact:delete this.paymentRequest.billingContact,p.data.shippingContact?this.paymentRequest.shippingContact=p.data.shippingContact:delete this.paymentRequest.shippingContact,p.data.merchantCapabilities&&(this.paymentRequest.merchantCapabilities=p.data.merchantCapabilities),this.merchantIdentifier=p.data.merchantIdentifier,s=!0;break}}if(!s)throw"Payment method not specified for Apple Pay.";t&&this.updatePaymentDetails(t),n&&(n.requestShipping&&(this.paymentRequest.requiredBillingContactFields.push("postalAddress"),this.paymentRequest.requiredShippingContactFields.push("postalAddress")),n.requestPayerName&&this.paymentRequest.requiredShippingContactFields.push("name"),n.requestPayerEmail&&this.paymentRequest.requiredShippingContactFields.push("email"),n.requestPayerPhone&&this.paymentRequest.requiredShippingContactFields.push("phone"),"pickup"===n.shippingType?this.paymentRequest.shippingType="servicePickup":this.paymentRequest.shippingType=n.shippingType||"shipping"),this.session=new ApplePaySession(1,this.paymentRequest),this.session.addEventListener("validatemerchant",this.onMerchantValidation.bind(this)),this.session.addEventListener("paymentauthorized",this.onPaymentAuthorized.bind(this)),this.session.addEventListener("paymentmethodselected",this.onPaymentMethodSelected.bind(this)),this.session.addEventListener("shippingcontactselected",this.onShippingAddressChange.bind(this)),this.session.addEventListener("shippingmethodselected",this.onShippingOptionChange.bind(this)),this.session.addEventListener("cancel",this.onPaymentCanceled.bind(this))}return e.prototype.updatePaymentDetails=function(e,t,n){if(t){for(var i=[],s=0,a=e.displayItems;s-1||p.supportedMethods===i){if(this.paymentRequest.supportedNetworks=p.data.supportedNetworks,this.paymentRequest.countryCode=p.data.countryCode,3!==p.data.version)throw"Apple Pay needs to be version 3.";p.data.billingContact?this.paymentRequest.billingContact=p.data.billingContact:delete this.paymentRequest.billingContact,p.data.shippingContact?this.paymentRequest.shippingContact=p.data.shippingContact:delete this.paymentRequest.shippingContact,p.data.merchantCapabilities&&(this.paymentRequest.merchantCapabilities=p.data.merchantCapabilities),this.merchantIdentifier=p.data.merchantIdentifier,s=!0;break}}if(!s)throw"Payment method not specified for Apple Pay.";t&&this.updatePaymentDetails(t),n&&(n.requestShipping&&(this.paymentRequest.requiredBillingContactFields.push("postalAddress"),this.paymentRequest.requiredShippingContactFields.push("postalAddress")),n.requestPayerName&&this.paymentRequest.requiredShippingContactFields.push("name"),n.requestPayerEmail&&this.paymentRequest.requiredShippingContactFields.push("email"),n.requestPayerPhone&&this.paymentRequest.requiredShippingContactFields.push("phone"),"pickup"===n.shippingType?this.paymentRequest.shippingType="servicePickup":this.paymentRequest.shippingType=n.shippingType||"shipping"),this.session=new ApplePaySession(1,this.paymentRequest),this.session.addEventListener("validatemerchant",this.onMerchantValidation.bind(this)),this.session.addEventListener("paymentauthorized",this.onPaymentAuthorized.bind(this)),this.session.addEventListener("paymentmethodselected",this.onPaymentMethodSelected.bind(this)),this.session.addEventListener("shippingcontactselected",this.onShippingAddressChange.bind(this)),this.session.addEventListener("shippingmethodselected",this.onShippingOptionChange.bind(this)),this.session.addEventListener("cancel",this.onPaymentCanceled.bind(this))}return e.prototype.updatePaymentDetails=function(e,t,n){if(t){for(var i=[],s=0,a=e.displayItems;swindow).ApplePaySession && !ApplePaySession.supportsVersion(3)) { private updatePaymentDetails( details: PaymentDetailsUpdate, selectedMethod?: string, - selectedType?: string ): void { if (selectedMethod) { // Get rid of existing preserved display items @@ -167,18 +166,6 @@ if ((window).ApplePaySession && !ApplePaySession.supportsVersion(3)) { if (modifier.supportedMethods !== selectedMethod) continue; - // if supported method is 'basic-card' and - // supported type is specified, check if it matches - // Otherwise ignore. - // (This is technically useless on Safari) - if (selectedMethod == 'basic-card' && - modifier.data && - modifier.data.supportedTypes) { - if (!selectedType || - modifier.data.supportedTypes.indexOf(selectedType) === -1) - continue; - } - if (modifier.additionalDisplayItems) { // Concatenate existing display items and additional ones details.displayItems =