blob: c9c4b0e66e4dde974a178fb2413b66f47bd38a5e [file] [log] [blame]
Test basic creation of a PaymentRequest object with an Apple Pay payment method.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Testing PaymentRequest
PASS new PaymentRequest(null, null) threw exception TypeError: Value is not a sequence.
PASS new PaymentRequest([validPaymentMethod()], validPaymentDetails()) did not throw exception.
Testing ApplePayRequest.version
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.version = 0;
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with InvalidAccessError: "0" is not a supported version..
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.version = 1000;
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with InvalidAccessError: "1000" is not a supported version..
Testing ApplePayRequest.countryCode
SETUP: paymentMethod = validPaymentMethod(); delete paymentMethod.data.countryCode;
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: Member ApplePayRequest.countryCode is required and must be an instance of DOMString.
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.countryCode = 'invalid';
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: "invalid" is not a valid country code..
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.countryCode = '';
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: "" is not a valid country code..
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.countryCode = null;
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: "null" is not a valid country code..
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.countryCode = undefined;
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: Member ApplePayRequest.countryCode is required and must be an instance of DOMString.
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.countryCode = 7;
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: "7" is not a valid country code..
Testing ApplePayRequest.supportedNetworks
SETUP: paymentMethod = validPaymentMethod(); delete paymentMethod.data.supportedNetworks;
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: Member ApplePayRequest.supportedNetworks is required and must be an instance of sequence.
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.supportedNetworks = '';
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: Value is not a sequence.
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.supportedNetworks = null;
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: Value is not a sequence.
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.supportedNetworks = undefined;
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: Member ApplePayRequest.supportedNetworks is required and must be an instance of sequence.
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.supportedNetworks = 7;
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: Value is not a sequence.
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.supportedNetworks = [];
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: At least one supported network must be provided..
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.supportedNetworks = ['invalidNetwork'];
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: "invalidNetwork" is not a valid payment network..
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.supportedNetworks = ['invalidNetwork', 'visa'];
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: "invalidNetwork" is not a valid payment network..
Testing ApplePayRequest.merchantCapabilities
SETUP: paymentMethod = validPaymentMethod(); delete paymentMethod.data.merchantCapabilities;
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: Member ApplePayRequest.merchantCapabilities is required and must be an instance of sequence.
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.merchantCapabilities = '';
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: Value is not a sequence.
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.merchantCapabilities = null;
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: Value is not a sequence.
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.merchantCapabilities = undefined;
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: Member ApplePayRequest.merchantCapabilities is required and must be an instance of sequence.
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.merchantCapabilities = 7;
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: Value is not a sequence.
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.merchantCapabilities = [];
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: At least one merchant capability must be provided..
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.merchantCapabilities = ['invalidCapability'];
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: Type error.
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.merchantCapabilities = ['invalidCapability', 'supports3DS'];
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: Type error.
Testing ApplePayRequest.requiredBillingContactFields
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.requiredBillingContactFields = '';
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: Value is not a sequence.
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.requiredBillingContactFields = null;
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: Value is not a sequence.
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.requiredBillingContactFields = 7;
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: Value is not a sequence.
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.requiredBillingContactFields = { };
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: Type error.
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.requiredBillingContactFields = [''];
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: Type error.
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.requiredBillingContactFields = [null];
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: Type error.
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.requiredBillingContactFields = [undefined];
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: Type error.
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.requiredBillingContactFields = [{}];
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: Type error.
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.requiredBillingContactFields = ['invalid'];
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: Type error.
Testing ApplePayRequest.billingContact
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.billingContact = '';
PASS new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with InvalidStateError: The object is in an invalid state..
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.billingContact = 7;
PASS new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with InvalidStateError: The object is in an invalid state..
Testing ApplePayRequest.requiredShippingContactFields
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = '';
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: Value is not a sequence.
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = null;
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: Value is not a sequence.
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = 7;
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: Value is not a sequence.
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = { };
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: Type error.
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = [''];
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: Type error.
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = [null];
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: Type error.
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = [undefined];
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: Type error.
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = [{}];
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: Type error.
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = ['invalid'];
PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with TypeError: Type error.
Testing ApplePayRequest.shippingContact
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.shippingContact = '';
PASS new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with InvalidStateError: The object is in an invalid state..
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.shippingContact = 7;
PASS new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with InvalidStateError: The object is in an invalid state..
Testing ApplePayRequest.applicationData
SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.applicationData = { toString: function() { throw '"Error in toString"'; } };
PASS new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise with InvalidStateError: The object is in an invalid state..
Testing PaymentDetails.total
SETUP: paymentDetails = validPaymentDetails(); delete paymentDetails.total;
PASS request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show() threw exception TypeError: Member PaymentDetailsInit.total is required and must be an instance of PaymentItem.
SETUP: paymentDetails = validPaymentDetails(); paymentDetails.total = '';
PASS request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show() threw exception TypeError: Type error.
SETUP: paymentDetails = validPaymentDetails(); paymentDetails.total = null;
PASS request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show() threw exception TypeError: Member PaymentItem.amount is required and must be an instance of PaymentCurrencyAmount.
SETUP: paymentDetails = validPaymentDetails(); paymentDetails.total = undefined;
PASS request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show() threw exception TypeError: Member PaymentDetailsInit.total is required and must be an instance of PaymentItem.
SETUP: paymentDetails = validPaymentDetails(); paymentDetails.total = 7;
PASS request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show() threw exception TypeError: Type error.
SETUP: paymentDetails = validPaymentDetails(); paymentDetails.total = [];
PASS request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show() threw exception TypeError: Member PaymentItem.amount is required and must be an instance of PaymentCurrencyAmount.
SETUP: paymentDetails = validPaymentDetails(); paymentDetails.total = { };
PASS request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show() threw exception TypeError: Member PaymentItem.amount is required and must be an instance of PaymentCurrencyAmount.
SETUP: paymentDetails = validPaymentDetails(); paymentDetails.total = { label: 'label' };
PASS request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show() threw exception TypeError: Member PaymentItem.amount is required and must be an instance of PaymentCurrencyAmount.
SETUP: paymentDetails = validPaymentDetails(); paymentDetails.total = { label: 'label', amount: 'amount' };
PASS request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show() threw exception TypeError: Type error.
SETUP: paymentDetails = validPaymentDetails(); paymentDetails.total = { label: 'label', amount: { currency: '', value: '0' } };
PASS request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show() threw exception RangeError: "" is not a valid currency code..
SETUP: paymentDetails = validPaymentDetails(); paymentDetails.total = { label: 'label', amount: { currency: 'USD', value:'-10.00'} };
PASS request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show() threw exception TypeError: Total currency values cannot be negative..
SETUP: paymentDetails = validPaymentDetails(); paymentDetails.total = { label: 'label', amount: { currency: 'USD', value: '10000000000.00' } };
PASS request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show() rejected promise with TypeError: Total amount is too big..
Testing PaymentDetails.displayItems
SETUP: paymentDetails = validPaymentDetails(); paymentDetails.displayItems = '';
PASS request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show() threw exception TypeError: Value is not a sequence.
SETUP: paymentDetails = validPaymentDetails(); paymentDetails.displayItems = null;
PASS request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show() threw exception TypeError: Value is not a sequence.
SETUP: paymentDetails = validPaymentDetails(); paymentDetails.displayItems = 7;
PASS request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show() threw exception TypeError: Value is not a sequence.
SETUP: paymentDetails = validPaymentDetails(); paymentDetails.displayItems = { };
PASS request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show() threw exception TypeError: Type error.
SETUP: paymentDetails = validPaymentDetails(); paymentDetails.displayItems = [''];
PASS request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show() threw exception TypeError: Type error.
SETUP: paymentDetails = validPaymentDetails(); paymentDetails.displayItems = [null];
PASS request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show() threw exception TypeError: Member PaymentItem.amount is required and must be an instance of PaymentCurrencyAmount.
SETUP: paymentDetails = validPaymentDetails(); paymentDetails.displayItems = [undefined];
PASS request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show() threw exception TypeError: Member PaymentItem.amount is required and must be an instance of PaymentCurrencyAmount.
SETUP: paymentDetails = validPaymentDetails(); paymentDetails.displayItems = [{}];
PASS request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show() threw exception TypeError: Member PaymentItem.amount is required and must be an instance of PaymentCurrencyAmount.
SETUP: paymentDetails = validPaymentDetails(); paymentDetails.displayItems = [{ label: 'label' }];
PASS request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show() threw exception TypeError: Member PaymentItem.amount is required and must be an instance of PaymentCurrencyAmount.
SETUP: paymentDetails = validPaymentDetails(); paymentDetails.displayItems = [{ label: 'label', amount: '' }];
PASS request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show() threw exception TypeError: Type error.
SETUP: paymentDetails = validPaymentDetails(); paymentDetails.displayItems = [{ label: 'label', amount: '10.00', type: 'invalid' }];
PASS request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show() threw exception TypeError: Type error.
SETUP: paymentDetails = validPaymentDetails(); paymentDetails.displayItems = [{ label: 'label', amount: { currency: 'EUR', value: '10.00' } }];
PASS request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show() rejected promise with TypeError: "EUR" does not match the expected currency of "USD". Apple Pay requires all PaymentCurrencyAmounts to use the same currency code..
Testing PaymentDetails.shippingOptions
SETUP: paymentDetails = validPaymentDetails(); paymentDetails.shippingOptions = '';
PASS request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show() threw exception TypeError: Value is not a sequence.
SETUP: paymentDetails = validPaymentDetails(); paymentDetails.shippingOptions = 'invalid';
PASS request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show() threw exception TypeError: Value is not a sequence.
SETUP: paymentDetails = validPaymentDetails(); paymentDetails.shippingOptions = null;
PASS request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show() threw exception TypeError: Value is not a sequence.
SETUP: paymentDetails = validPaymentDetails(); paymentDetails.shippingOptions = 7;
PASS request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show() threw exception TypeError: Value is not a sequence.
SETUP: paymentDetails = validPaymentDetails(); paymentDetails.shippingOptions = { };
PASS request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show() threw exception TypeError: Type error.
SETUP: paymentDetails = validPaymentDetails(); paymentDetails.shippingOptions = [{ }];
PASS request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show() threw exception TypeError: Member PaymentShippingOption.amount is required and must be an instance of PaymentCurrencyAmount.
SETUP: paymentDetails = validPaymentDetails(); paymentDetails.shippingOptions = [{ amount: '', }];
PASS request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show() threw exception TypeError: Type error.
SETUP: paymentDetails = validPaymentDetails(); paymentDetails.shippingOptions = [{ amount: '', detail: '' }];
PASS request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show() threw exception TypeError: Type error.
SETUP: paymentDetails = validPaymentDetails(); paymentDetails.shippingOptions = [{ amount: '', detail: '', identifier: '' }];
PASS request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show() threw exception TypeError: Type error.
SETUP: paymentDetails = validPaymentDetails(); paymentDetails.shippingOptions = [{ amount: '', detail: '', identifier: '', label: '' }];
PASS request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show() threw exception TypeError: Type error.
SETUP: paymentDetails = validPaymentDetails(); paymentDetails.shippingOptions = [{ amount: '-1', detail: '', identifier: '', label: '' }];
PASS request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show() threw exception TypeError: Type error.
SETUP: paymentDetails = validPaymentDetails(); paymentDetails.shippingOptions = [{ amount: { currency: 'EUR', value: '10.00' }, id: '', label: '' }];
PASS request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show() rejected promise with TypeError: "EUR" does not match the expected currency of "USD". Apple Pay requires all PaymentCurrencyAmounts to use the same currency code..
Testing PaymentOptions
SETUP: paymentOptions = {}; paymentOptions.shippingType = '';
PASS new PaymentRequest([validPaymentMethod()], validPaymentDetails(), paymentOptions); request.show() threw exception TypeError: Type error.
SETUP: paymentOptions = {}; paymentOptions.shippingType = 'invalid';
PASS new PaymentRequest([validPaymentMethod()], validPaymentDetails(), paymentOptions); request.show() threw exception TypeError: Type error.
SETUP: paymentOptions = {}; paymentOptions.shippingType = null;
PASS new PaymentRequest([validPaymentMethod()], validPaymentDetails(), paymentOptions); request.show() threw exception TypeError: Type error.
SETUP: paymentOptions = {}; paymentOptions.shippingType = 7;
PASS new PaymentRequest([validPaymentMethod()], validPaymentDetails(), paymentOptions); request.show() threw exception TypeError: Type error.
SETUP: paymentOptions = {}; paymentOptions.shippingType = { };
PASS new PaymentRequest([validPaymentMethod()], validPaymentDetails(), paymentOptions); request.show() threw exception TypeError: Type error.
PASS successfullyParsed is true
TEST COMPLETE