(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}(g.braintree || (g.braintree = {})).dropin = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;iYou cannot use this constructor directly. Use {@link module:braintree-web/apple-pay.create|braintree.applePay.create} instead. * @classdesc This class represents an Apple Pay component. Instances of this class have methods for validating the merchant server and tokenizing payments. */ function ApplePay(options) { this._client = options.client; /** * @name ApplePay#merchantIdentifier * @description A special merchant ID which represents the merchant association with Braintree. Required when using `ApplePaySession.canMakePaymentsWithActiveCard`. * @example * var promise = ApplePaySession.canMakePaymentsWithActiveCard(applePayInstance.merchantIdentifier); * promise.then(function (canMakePaymentsWithActiveCard) { * if (canMakePaymentsWithActiveCard) { * // Set up Apple Pay buttons * } * }); */ Object.defineProperty(this, 'merchantIdentifier', { value: this._client.getConfiguration().gatewayConfiguration.applePayWeb.merchantIdentifier, configurable: false, writable: false }); } /** * Merges a payment request with Braintree defaults to return an {external:ApplePayPaymentRequest}. * * The following properties are assigned to `paymentRequest` if not already defined. Their default values come from the Braintree gateway. * - `countryCode` * - `currencyCode` * - `merchantCapabilities` * - `supportedNetworks` * @public * @param {external:ApplePayPaymentRequest} paymentRequest The payment request details to apply on top of those from Braintree. * @returns {external:ApplePayPaymentRequest} The decorated `paymentRequest` object. * @example * var applePay = require('braintree-web/apple-pay'); * * applePay.create({client: clientInstance}, function (applePayErr, applePayInstance) { * if (applePayErr) { * // Handle error here * return; * } * * var paymentRequest = applePayInstance.createPaymentRequest({ * total: { * label: 'My Company', * amount: '19.99' * } * }); * * var session = new ApplePaySession(2, paymentRequest); * * // ... */ ApplePay.prototype.createPaymentRequest = function (paymentRequest) { var applePay = this._client.getConfiguration().gatewayConfiguration.applePayWeb; var defaults = { countryCode: applePay.countryCode, currencyCode: applePay.currencyCode, merchantCapabilities: applePay.merchantCapabilities || ['supports3DS'], supportedNetworks: applePay.supportedNetworks.map(function (network) { return network === 'mastercard' ? 'masterCard' : network; }) }; return Object.assign({}, defaults, paymentRequest); }; /** * Validates your merchant website, as required by `ApplePaySession` before payment can be authorized. * @public * @param {object} options Options * @param {string} options.validationURL The validationURL fram an `ApplePayValidateMerchantEvent`. * @param {string} options.displayName The canonical name for your store. Use a non-localized name. This parameter should be a UTF-8 string that is a maximum of 128 characters. The system may display this name to the user. * @param {callback} [callback] The second argument, data, is the Apple Pay merchant session object. If no callback is provided, `performValidation` returns a promise. * Pass the merchant session to your Apple Pay session's `completeMerchantValidation` method. * @returns {Promise|void} Returns a promise if no callback is provided. * @example * var applePay = require('braintree-web/apple-pay'); * * applePay.create({client: clientInstance}, function (applePayErr, applePayInstance) { * if (applePayErr) { * // Handle error here * return; * } * * var paymentRequest = applePayInstance.createPaymentRequest({ * total: { * label: 'My Company', * amount: '19.99' * } * }); * var session = new ApplePaySession(2, paymentRequest); * * session.onvalidatemerchant = function (event) { * applePayInstance.performValidation({ * validationURL: event.validationURL, * displayName: 'My Great Store' * }, function (validationErr, validationData) { * if (validationErr) { * console.error(validationErr); * session.abort(); * return; * } * * session.completeMerchantValidation(validationData); * }); * }; * }); */ ApplePay.prototype.performValidation = function (options) { var applePayWebSession; var self = this; if (!options || !options.validationURL) { return Promise.reject(new BraintreeError(errors.APPLE_PAY_VALIDATION_URL_REQUIRED)); } applePayWebSession = { validationUrl: options.validationURL, domainName: options.domainName || global.location.hostname, merchantIdentifier: options.merchantIdentifier || this.merchantIdentifier }; if (options.displayName != null) { applePayWebSession.displayName = options.displayName; } return this._client.request({ method: 'post', endpoint: 'apple_pay_web/sessions', data: { _meta: {source: 'apple-pay'}, applePayWebSession: applePayWebSession } }).then(function (response) { analytics.sendEvent(self._client, 'applepay.performValidation.succeeded'); return Promise.resolve(response); }).catch(function (err) { analytics.sendEvent(self._client, 'applepay.performValidation.failed'); if (err.code === 'CLIENT_REQUEST_ERROR') { return Promise.reject(new BraintreeError({ type: errors.APPLE_PAY_MERCHANT_VALIDATION_FAILED.type, code: errors.APPLE_PAY_MERCHANT_VALIDATION_FAILED.code, message: errors.APPLE_PAY_MERCHANT_VALIDATION_FAILED.message, details: { originalError: err.details.originalError } })); } return Promise.reject(new BraintreeError({ type: errors.APPLE_PAY_MERCHANT_VALIDATION_NETWORK.type, code: errors.APPLE_PAY_MERCHANT_VALIDATION_NETWORK.code, message: errors.APPLE_PAY_MERCHANT_VALIDATION_NETWORK.message, details: { originalError: err } })); }); }; /** * Tokenizes an Apple Pay payment. This will likely be called in your `ApplePaySession`'s `onpaymentauthorized` callback. * @public * @param {object} options Options * @param {object} options.token The `payment.token` property of an {@link external:ApplePayPaymentAuthorizedEvent}. * @param {callback} [callback] The second argument, data, is a {@link ApplePay~tokenizePayload|tokenizePayload}. If no callback is provided, `tokenize` returns a promise that resolves with a {@link ApplePay~tokenizePayload|tokenizePayload}. * @returns {Promise|void} Returns a promise if no callback is provided. * @example * var applePay = require('braintree-web/apple-pay'); * * applePay.create({client: clientInstance}, function (applePayErr, applePayInstance) { * if (applePayErr) { * // Handle error here * return; * } * * var paymentRequest = applePayInstance.createPaymentRequest({ * total: { * label: 'My Company', * amount: '19.99' * } * }); * var session = new ApplePaySession(2, paymentRequest); * * session.onpaymentauthorized = function (event) { * applePayInstance.tokenize({ * token: event.payment.token * }, function (tokenizeErr, tokenizedPayload) { * if (tokenizeErr) { * session.completePayment(ApplePaySession.STATUS_FAILURE); * return; * } * session.completePayment(ApplePaySession.STATUS_SUCCESS); * * // Send the tokenizedPayload to your server here! * }); * }; * * // ... * }); */ ApplePay.prototype.tokenize = function (options) { var self = this; if (!options.token) { return Promise.reject(new BraintreeError(errors.APPLE_PAY_PAYMENT_TOKEN_REQUIRED)); } return this._client.request({ method: 'post', endpoint: 'payment_methods/apple_payment_tokens', data: { _meta: { source: 'apple-pay' }, applePaymentToken: Object.assign({}, options.token, { // The gateway requires this key to be base64-encoded. paymentData: btoa(JSON.stringify(options.token.paymentData)) }) } }).then(function (response) { analytics.sendEvent(self._client, 'applepay.tokenize.succeeded'); return Promise.resolve(response.applePayCards[0]); }).catch(function (err) { analytics.sendEvent(self._client, 'applepay.tokenize.failed'); return Promise.reject(new BraintreeError({ type: errors.APPLE_PAY_TOKENIZATION.type, code: errors.APPLE_PAY_TOKENIZATION.code, message: errors.APPLE_PAY_TOKENIZATION.message, details: { originalError: err } })); }); }; /** * Cleanly tear down anything set up by {@link module:braintree-web/apple-pay.create|create}. * @public * @param {callback} [callback] Called once teardown is complete. No data is returned if teardown completes successfully. * @example * applePayInstance.teardown(); * @example With callback * applePayInstance.teardown(function () { * // teardown is complete * }); * @returns {Promise|void} Returns a promise if no callback is provided. */ ApplePay.prototype.teardown = function () { convertMethodsToError(this, methods(ApplePay.prototype)); return Promise.resolve(); }; module.exports = wrapPromise.wrapPrototype(ApplePay); }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"../lib/analytics":62,"../lib/braintree-error":66,"../lib/convert-methods-to-error":72,"../lib/methods":85,"../lib/promise":87,"./errors":23,"@braintree/wrap-promise":21}],23:[function(require,module,exports){ 'use strict'; /** * @name BraintreeError.Apple Pay - Creation Error Codes * @description Errors that occur when [creating the Apple Pay component](/current/module-braintree-web_apple-pay.html#.create). * @property {MERCHANT} APPLE_PAY_NOT_ENABLED Occurs when the authorization used is not authorized to process Apple Pay. */ /** * @name BraintreeError.Apple Pay - performValidation Error Codes * @description Errors that occur when [validating](/current/ApplePay.html#performValidation). * @property {MERCHANT} APPLE_PAY_VALIDATION_URL_REQUIRED Occurs when the `validationURL` option is not passed in. * @property {MERCHANT} APPLE_PAY_MERCHANT_VALIDATION_FAILED Occurs when the website domain has not been registered in the Braintree control panel. * @property {NETWORK} APPLE_PAY_MERCHANT_VALIDATION_NETWORK Occurs when an unknown network error occurs. */ /** * @name BraintreeError.Apple Pay - tokenize Error Codes * @description Errors that occur when [tokenizing](/current/ApplePay.html#tokenize). * @property {MERCHANT} APPLE_PAY_PAYMENT_TOKEN_REQUIRED Occurs when the `token` option is not passed in. * @property {NETWORK} APPLE_PAY_TOKENIZATION Occurs when an unknown network error occurs. */ var BraintreeError = require('../lib/braintree-error'); module.exports = { APPLE_PAY_NOT_ENABLED: { type: BraintreeError.types.MERCHANT, code: 'APPLE_PAY_NOT_ENABLED', message: 'Apple Pay is not enabled for this merchant.' }, APPLE_PAY_VALIDATION_URL_REQUIRED: { type: BraintreeError.types.MERCHANT, code: 'APPLE_PAY_VALIDATION_URL_REQUIRED', message: 'performValidation must be called with a validationURL.' }, APPLE_PAY_MERCHANT_VALIDATION_NETWORK: { type: BraintreeError.types.NETWORK, code: 'APPLE_PAY_MERCHANT_VALIDATION_NETWORK', message: 'A network error occurred when validating the Apple Pay merchant.' }, APPLE_PAY_MERCHANT_VALIDATION_FAILED: { type: BraintreeError.types.MERCHANT, code: 'APPLE_PAY_MERCHANT_VALIDATION_FAILED', message: 'Make sure you have registered your domain name in the Braintree Control Panel.' }, APPLE_PAY_PAYMENT_TOKEN_REQUIRED: { type: BraintreeError.types.MERCHANT, code: 'APPLE_PAY_PAYMENT_TOKEN_REQUIRED', message: 'tokenize must be called with a payment token.' }, APPLE_PAY_TOKENIZATION: { type: BraintreeError.types.NETWORK, code: 'APPLE_PAY_TOKENIZATION', message: 'A network error occurred when processing the Apple Pay payment.' } }; },{"../lib/braintree-error":66}],24:[function(require,module,exports){ 'use strict'; /** * @module braintree-web/apple-pay * @description Accept Apple Pay on the Web. *This component is currently in beta and is subject to change.* */ var BraintreeError = require('../lib/braintree-error'); var ApplePay = require('./apple-pay'); var analytics = require('../lib/analytics'); var basicComponentVerification = require('../lib/basic-component-verification'); var errors = require('./errors'); var VERSION = "3.37.0"; var Promise = require('../lib/promise'); var wrapPromise = require('@braintree/wrap-promise'); /** * @static * @function create * @param {object} options Creation options: * @param {Client} options.client A {@link Client} instance. * @param {callback} [callback] The second argument, `data`, is the {@link ApplePay} instance. If no callback is provided, `create` returns a promise that resolves with the {@link ApplePay} instance. * @returns {Promise|void} Returns a promise if no callback is provided. */ function create(options) { return basicComponentVerification.verify({ name: 'Apple Pay', client: options.client }).then(function () { if (!options.client.getConfiguration().gatewayConfiguration.applePayWeb) { return Promise.reject(new BraintreeError(errors.APPLE_PAY_NOT_ENABLED)); } analytics.sendEvent(options.client, 'applepay.initialized'); return new ApplePay(options); }); } module.exports = { create: wrapPromise(create), /** * @description The current version of the SDK, i.e. `{@pkg version}`. * @type {string} */ VERSION: VERSION }; },{"../lib/analytics":62,"../lib/basic-component-verification":64,"../lib/braintree-error":66,"../lib/promise":87,"./apple-pay":22,"./errors":23,"@braintree/wrap-promise":21}],25:[function(require,module,exports){ 'use strict'; var isIe = require('@braintree/browser-detection/is-ie'); var isIe9 = require('@braintree/browser-detection/is-ie9'); module.exports = { isIe: isIe, isIe9: isIe9 }; },{"@braintree/browser-detection/is-ie":4,"@braintree/browser-detection/is-ie9":7}],26:[function(require,module,exports){ 'use strict'; var BRAINTREE_VERSION = require('./constants').BRAINTREE_VERSION; var GraphQL = require('./request/graphql'); var request = require('./request'); var isVerifiedDomain = require('../lib/is-verified-domain'); var BraintreeError = require('../lib/braintree-error'); var convertToBraintreeError = require('../lib/convert-to-braintree-error'); var createAuthorizationData = require('../lib/create-authorization-data'); var addMetadata = require('../lib/add-metadata'); var Promise = require('../lib/promise'); var wrapPromise = require('@braintree/wrap-promise'); var once = require('../lib/once'); var deferred = require('../lib/deferred'); var assign = require('../lib/assign').assign; var analytics = require('../lib/analytics'); var constants = require('./constants'); var errors = require('./errors'); var sharedErrors = require('../lib/errors'); var VERSION = require('../lib/constants').VERSION; var GRAPHQL_URLS = require('../lib/constants').GRAPHQL_URLS; var methods = require('../lib/methods'); var convertMethodsToError = require('../lib/convert-methods-to-error'); /** * This object is returned by {@link Client#getConfiguration|getConfiguration}. This information is used extensively by other Braintree modules to properly configure themselves. * @typedef {object} Client~configuration * @property {object} client The braintree-web/client parameters. * @property {string} client.authorization A tokenizationKey or clientToken. * @property {object} gatewayConfiguration Gateway-supplied configuration. * @property {object} analyticsMetadata Analytics-specific data. * @property {string} analyticsMetadata.sessionId Uniquely identifies a browsing session. * @property {string} analyticsMetadata.sdkVersion The braintree.js version. * @property {string} analyticsMetadata.merchantAppId Identifies the merchant's web app. */ /** * @class * @param {Client~configuration} configuration Options * @description Do not use this constructor directly. Use {@link module:braintree-web/client.create|braintree.client.create} instead. * @classdesc This class is required by many other Braintree components. It serves as the base API layer that communicates with our servers. It is also capable of being used to formulate direct calls to our servers, such as direct credit card tokenization. See {@link Client#request}. */ function Client(configuration) { var configurationJSON, gatewayConfiguration, braintreeApiConfiguration; configuration = configuration || {}; configurationJSON = JSON.stringify(configuration); gatewayConfiguration = configuration.gatewayConfiguration; if (!gatewayConfiguration) { throw new BraintreeError(errors.CLIENT_MISSING_GATEWAY_CONFIGURATION); } [ 'assetsUrl', 'clientApiUrl', 'configUrl' ].forEach(function (property) { if (property in gatewayConfiguration && !isVerifiedDomain(gatewayConfiguration[property])) { throw new BraintreeError({ type: errors.CLIENT_GATEWAY_CONFIGURATION_INVALID_DOMAIN.type, code: errors.CLIENT_GATEWAY_CONFIGURATION_INVALID_DOMAIN.code, message: property + ' property is on an invalid domain.' }); } }); /** * Returns a copy of the configuration values. * @public * @returns {Client~configuration} configuration */ this.getConfiguration = function () { return JSON.parse(configurationJSON); }; this._activeCache = true; this._request = request; this._configuration = this.getConfiguration(); this._clientApiBaseUrl = gatewayConfiguration.clientApiUrl + '/v1/'; braintreeApiConfiguration = gatewayConfiguration.braintreeApi; if (braintreeApiConfiguration) { this._braintreeApi = { baseUrl: braintreeApiConfiguration.url + '/', accessToken: braintreeApiConfiguration.accessToken }; if (!isVerifiedDomain(this._braintreeApi.baseUrl)) { throw new BraintreeError({ type: errors.CLIENT_GATEWAY_CONFIGURATION_INVALID_DOMAIN.type, code: errors.CLIENT_GATEWAY_CONFIGURATION_INVALID_DOMAIN.code, message: 'braintreeApi URL is on an invalid domain.' }); } } if (gatewayConfiguration.graphQL) { this._graphQL = new GraphQL({ graphQL: gatewayConfiguration.graphQL }); } } /** * Used by other modules to formulate all network requests to the Braintree gateway. It is also capable of being used directly from your own form to tokenize credit card information. However, be sure to satisfy PCI compliance if you use direct card tokenization. * @public * @param {object} options Request options: * @param {string} options.method HTTP method, e.g. "get" or "post". * @param {string} options.endpoint Endpoint path, e.g. "payment_methods". * @param {object} options.data Data to send with the request. * @param {number} [options.timeout=60000] Set a timeout (in milliseconds) for the request. * @param {callback} [callback] The second argument, data, is the returned server data. * @example * Direct Credit Card Tokenization * var createClient = require('braintree-web/client').create; * * createClient({ * authorization: CLIENT_AUTHORIZATION * }, function (createErr, clientInstance) { * var form = document.getElementById('my-form-id'); * var data = { * creditCard: { * number: form['cc-number'].value, * cvv: form['cc-cvv'].value, * expirationDate: form['cc-expiration-date'].value, * billingAddress: { * postalCode: form['cc-postal-code'].value * }, * options: { * validate: false * } * } * }; * * // Warning: For a merchant to be eligible for the easiest level of PCI compliance (SAQ A), * // payment fields cannot be hosted on your checkout page. * // For an alternative to the following, use Hosted Fields. * clientInstance.request({ * endpoint: 'payment_methods/credit_cards', * method: 'post', * data: data * }, function (requestErr, response) { * // More detailed example of handling API errors: https://codepen.io/braintree/pen/MbwjdM * if (requestErr) { throw new Error(requestErr); } * * console.log('Got nonce:', response.creditCards[0].nonce); * }); * }); * @example * Tokenizing Fields for AVS Checks * var createClient = require('braintree-web/client').create; * * createClient({ * authorization: CLIENT_AUTHORIZATION * }, function (createErr, clientInstance) { * var form = document.getElementById('my-form-id'); * var data = { * creditCard: { * number: form['cc-number'].value, * cvv: form['cc-cvv'].value, * expirationDate: form['cc-date'].value, * // The billing address can be checked with AVS rules. * // See: https://articles.braintreepayments.com/support/guides/fraud-tools/basic/avs-cvv-rules * billingAddress: { * postalCode: form['cc-postal-code'].value, * streetAddress: form['cc-street-address'].value, * countryName: form['cc-country-name'].value, * countryCodeAlpha2: form['cc-country-alpha2'].value, * countryCodeAlpha3: form['cc-country-alpha3'].value, * countryCodeNumeric: form['cc-country-numeric'].value * }, * options: { * validate: false * } * } * }; * * // Warning: For a merchant to be eligible for the easiest level of PCI compliance (SAQ A), * // payment fields cannot be hosted on your checkout page. * // For an alternative to the following, use Hosted Fields. * clientInstance.request({ * endpoint: 'payment_methods/credit_cards', * method: 'post', * data: data * }, function (requestErr, response) { * // More detailed example of handling API errors: https://codepen.io/braintree/pen/MbwjdM * if (requestErr) { throw new Error(requestErr); } * * console.log('Got nonce:', response.creditCards[0].nonce); * }); * }); * @returns {Promise|void} Returns a promise if no callback is provided. */ Client.prototype.request = function (options, callback) { var self = this; // eslint-disable-line no-invalid-this var requestPromise = new Promise(function (resolve, reject) { var optionName, api, baseUrl, requestOptions; if (options.api !== 'graphQLApi') { if (!options.method) { optionName = 'options.method'; } else if (!options.endpoint) { optionName = 'options.endpoint'; } } if (optionName) { throw new BraintreeError({ type: errors.CLIENT_OPTION_REQUIRED.type, code: errors.CLIENT_OPTION_REQUIRED.code, message: optionName + ' is required when making a request.' }); } if ('api' in options) { api = options.api; } else { api = 'clientApi'; } requestOptions = { method: options.method, graphQL: self._graphQL, timeout: options.timeout, metadata: self._configuration.analyticsMetadata }; if (api === 'clientApi') { baseUrl = self._clientApiBaseUrl; requestOptions.data = addMetadata(self._configuration, options.data); } else if (api === 'braintreeApi') { if (!self._braintreeApi) { throw new BraintreeError(sharedErrors.BRAINTREE_API_ACCESS_RESTRICTED); } baseUrl = self._braintreeApi.baseUrl; requestOptions.data = options.data; requestOptions.headers = { 'Braintree-Version': constants.BRAINTREE_API_VERSION_HEADER, Authorization: 'Bearer ' + self._braintreeApi.accessToken }; } else if (api === 'graphQLApi') { baseUrl = GRAPHQL_URLS[self._configuration.gatewayConfiguration.environment]; options.endpoint = ''; requestOptions.method = 'post'; requestOptions.data = assign({ clientSdkMetadata: { source: self._configuration.analyticsMetadata.source, integration: self._configuration.analyticsMetadata.integration, sessionId: self._configuration.analyticsMetadata.sessionId } }, options.data); requestOptions.headers = getAuthorizationHeadersForGraphQL(self._configuration.authorization); } else { throw new BraintreeError({ type: errors.CLIENT_OPTION_INVALID.type, code: errors.CLIENT_OPTION_INVALID.code, message: 'options.api is invalid.' }); } requestOptions.url = baseUrl + options.endpoint; requestOptions.sendAnalyticsEvent = function (kind) { analytics.sendEvent(self, kind); }; self._request(requestOptions, function (err, data, status) { var resolvedData, requestError; requestError = formatRequestError(status, err); if (requestError) { reject(requestError); return; } if (api === 'graphQLApi' && data.errors) { reject(convertToBraintreeError(data.errors, { type: errors.CLIENT_GRAPHQL_REQUEST_ERROR.type, code: errors.CLIENT_GRAPHQL_REQUEST_ERROR.code, message: errors.CLIENT_GRAPHQL_REQUEST_ERROR.message })); return; } resolvedData = assign({_httpStatus: status}, data); resolve(resolvedData); }); }); if (typeof callback === 'function') { callback = once(deferred(callback)); requestPromise.then(function (response) { callback(null, response, response._httpStatus); }).catch(function (err) { var status = err && err.details && err.details.httpStatus; callback(err, null, status); }); return; } return requestPromise; // eslint-disable-line consistent-return }; function formatRequestError(status, err) { // eslint-disable-line consistent-return var requestError; if (status === -1) { requestError = new BraintreeError(errors.CLIENT_REQUEST_TIMEOUT); } else if (status === 403) { requestError = new BraintreeError(errors.CLIENT_AUTHORIZATION_INSUFFICIENT); } else if (status === 429) { requestError = new BraintreeError(errors.CLIENT_RATE_LIMITED); } else if (status >= 500) { requestError = new BraintreeError(errors.CLIENT_GATEWAY_NETWORK); } else if (status < 200 || status >= 400) { requestError = convertToBraintreeError(err, { type: errors.CLIENT_REQUEST_ERROR.type, code: errors.CLIENT_REQUEST_ERROR.code, message: errors.CLIENT_REQUEST_ERROR.message }); } if (requestError) { requestError.details = requestError.details || {}; requestError.details.httpStatus = status; return requestError; } } Client.prototype.toJSON = function () { return this.getConfiguration(); }; /** * Returns the Client version. * @public * @returns {String} The created client's version. * @example * var createClient = require('braintree-web/client').create; * * createClient({ * authorization: CLIENT_AUTHORIZATION * }, function (createErr, clientInstance) { * console.log(clientInstance.getVersion()); // Ex: 1.0.0 * }); * @returns {void} */ Client.prototype.getVersion = function () { return VERSION; }; /** * Cleanly tear down anything set up by {@link module:braintree-web/client.create|create}. * @public * @param {callback} [callback] Called once teardown is complete. No data is returned if teardown completes successfully. * @example * clientInstance.teardown(); * @example With callback * clientInstance.teardown(function () { * // teardown is complete * }); * @returns {Promise|void} Returns a promise if no callback is provided. */ Client.prototype.teardown = wrapPromise(function () { var self = this; // eslint-disable-line no-invalid-this self._activeCache = false; convertMethodsToError(self, methods(Client.prototype)); return Promise.resolve(); }); function getAuthorizationHeadersForGraphQL(authorization) { var authAttrs = createAuthorizationData(authorization).attrs; var token = authAttrs.authorizationFingerprint || authAttrs.tokenizationKey; return { Authorization: 'Bearer ' + token, 'Braintree-Version': BRAINTREE_VERSION }; } module.exports = Client; },{"../lib/add-metadata":61,"../lib/analytics":62,"../lib/assign":63,"../lib/braintree-error":66,"../lib/constants":71,"../lib/convert-methods-to-error":72,"../lib/convert-to-braintree-error":73,"../lib/create-authorization-data":74,"../lib/deferred":75,"../lib/errors":78,"../lib/is-verified-domain":83,"../lib/methods":85,"../lib/once":86,"../lib/promise":87,"./constants":27,"./errors":28,"./request":41,"./request/graphql":39,"@braintree/wrap-promise":21}],27:[function(require,module,exports){ 'use strict'; module.exports = { BRAINTREE_API_VERSION_HEADER: '2017-04-03', BRAINTREE_VERSION: '2018-05-10' }; },{}],28:[function(require,module,exports){ 'use strict'; /** * @name BraintreeError.Client - Interal Error Codes * @ignore * @description These codes should never be experienced by the mechant directly. * @property {MERCHANT} CLIENT_GATEWAY_CONFIGURATION_INVALID_DOMAIN An error to prevent client creation for domains that are not allowed in the JS. * @property {INTERNAL} CLIENT_MISSING_GATEWAY_CONFIGURATION Occurs when the client is created without a gateway configuration. Should never happen. */ /** * @name BraintreeError.Client - Create Error Codes * @description Errors that may occur when [creating the client](/current/module-braintree-web_client.html#.create) * @property {MERCHANT} CLIENT_INVALID_AUTHORIZATION Occurs when client token cannot be parsed. */ /** * @name BraintreeError.Client - Request Error Codes * @description Errors that may occur when [using the request method](/current/Client.html#request) * @property {MERCHANT} CLIENT_OPTION_REQUIRED An option required in the request method was not provided. Usually `options.method` or `options.endpoint` * @property {MERCHANT} CLIENT_OPTION_INVALID The request option provided is invalid. * @property {MERCHANT} CLIENT_GATEWAY_NETWORK The Braintree gateway could not be contacted. * @property {NETWORK} CLIENT_REQUEST_TIMEOUT The request took too long to complete and timed out. * @property {NETWORK} CLIENT_REQUEST_ERROR The response from a request had status 400 or greater. * @property {NETWORK} CLIENT_GRAPHQL_REQUEST_ERROR The response from a request to GraphQL contained an error. * @property {MERCHANT} CLIENT_RATE_LIMITED The response from a request had a status of 429, indicating rate limiting. * @property {MERCHANT} CLIENT_AUTHORIZATION_INSUFFICIENT The user assocaited with the client token or tokenization key does not have permissions to make the request. */ var BraintreeError = require('../lib/braintree-error'); module.exports = { CLIENT_GATEWAY_CONFIGURATION_INVALID_DOMAIN: { type: BraintreeError.types.MERCHANT, code: 'CLIENT_GATEWAY_CONFIGURATION_INVALID_DOMAIN' }, CLIENT_OPTION_REQUIRED: { type: BraintreeError.types.MERCHANT, code: 'CLIENT_OPTION_REQUIRED' }, CLIENT_OPTION_INVALID: { type: BraintreeError.types.MERCHANT, code: 'CLIENT_OPTION_INVALID' }, CLIENT_MISSING_GATEWAY_CONFIGURATION: { type: BraintreeError.types.INTERNAL, code: 'CLIENT_MISSING_GATEWAY_CONFIGURATION', message: 'Missing gatewayConfiguration.' }, CLIENT_INVALID_AUTHORIZATION: { type: BraintreeError.types.MERCHANT, code: 'CLIENT_INVALID_AUTHORIZATION', message: 'Authorization is invalid. Make sure your client token or tokenization key is valid.' }, CLIENT_GATEWAY_NETWORK: { type: BraintreeError.types.NETWORK, code: 'CLIENT_GATEWAY_NETWORK', message: 'Cannot contact the gateway at this time.' }, CLIENT_REQUEST_TIMEOUT: { type: BraintreeError.types.NETWORK, code: 'CLIENT_REQUEST_TIMEOUT', message: 'Request timed out waiting for a reply.' }, CLIENT_REQUEST_ERROR: { type: BraintreeError.types.NETWORK, code: 'CLIENT_REQUEST_ERROR', message: 'There was a problem with your request.' }, CLIENT_GRAPHQL_REQUEST_ERROR: { type: BraintreeError.types.NETWORK, code: 'CLIENT_GRAPHQL_REQUEST_ERROR', message: 'There was a problem with your request.' }, CLIENT_RATE_LIMITED: { type: BraintreeError.types.MERCHANT, code: 'CLIENT_RATE_LIMITED', message: 'You are being rate-limited; please try again in a few minutes.' }, CLIENT_AUTHORIZATION_INSUFFICIENT: { type: BraintreeError.types.MERCHANT, code: 'CLIENT_AUTHORIZATION_INSUFFICIENT', message: 'The authorization used has insufficient privileges.' } }; },{"../lib/braintree-error":66}],29:[function(require,module,exports){ (function (global){ 'use strict'; var BraintreeError = require('../lib/braintree-error'); var Promise = require('../lib/promise'); var wrapPromise = require('@braintree/wrap-promise'); var request = require('./request'); var uuid = require('../lib/vendor/uuid'); var constants = require('../lib/constants'); var createAuthorizationData = require('../lib/create-authorization-data'); var errors = require('./errors'); var GraphQL = require('./request/graphql'); var isDateStringBeforeOrOn = require('../lib/is-date-string-before-or-on'); var BRAINTREE_VERSION = require('./constants').BRAINTREE_VERSION; function getConfiguration(options) { return new Promise(function (resolve, reject) { var configuration, authData, attrs, configUrl, reqOptions; var sessionId = uuid(); var analyticsMetadata = { merchantAppId: global.location.host, platform: constants.PLATFORM, sdkVersion: constants.VERSION, source: constants.SOURCE, integration: constants.INTEGRATION, integrationType: constants.INTEGRATION, sessionId: sessionId }; try { authData = createAuthorizationData(options.authorization); } catch (err) { reject(new BraintreeError(errors.CLIENT_INVALID_AUTHORIZATION)); return; } attrs = authData.attrs; configUrl = authData.configUrl; attrs._meta = analyticsMetadata; attrs.braintreeLibraryVersion = constants.BRAINTREE_LIBRARY_VERSION; attrs.configVersion = '3'; reqOptions = { url: configUrl, method: 'GET', data: attrs }; if (attrs.authorizationFingerprint && authData.graphQL) { if (isDateStringBeforeOrOn(authData.graphQL.date, BRAINTREE_VERSION)) { reqOptions.graphQL = new GraphQL({ graphQL: { url: authData.graphQL.url, features: ['configuration'] } }); } reqOptions.metadata = analyticsMetadata; } request(reqOptions, function (err, response, status) { var errorTemplate; if (err) { if (status === 403) { errorTemplate = errors.CLIENT_AUTHORIZATION_INSUFFICIENT; } else { errorTemplate = errors.CLIENT_GATEWAY_NETWORK; } reject(new BraintreeError({ type: errorTemplate.type, code: errorTemplate.code, message: errorTemplate.message, details: { originalError: err } })); return; } configuration = { authorization: options.authorization, authorizationType: attrs.tokenizationKey ? 'TOKENIZATION_KEY' : 'CLIENT_TOKEN', analyticsMetadata: analyticsMetadata, gatewayConfiguration: response }; resolve(configuration); }); }); } module.exports = { getConfiguration: wrapPromise(getConfiguration) }; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"../lib/braintree-error":66,"../lib/constants":71,"../lib/create-authorization-data":74,"../lib/is-date-string-before-or-on":81,"../lib/promise":87,"../lib/vendor/uuid":91,"./constants":27,"./errors":28,"./request":41,"./request/graphql":39,"@braintree/wrap-promise":21}],30:[function(require,module,exports){ 'use strict'; var BraintreeError = require('../lib/braintree-error'); var Client = require('./client'); var getConfiguration = require('./get-configuration').getConfiguration; var VERSION = "3.37.0"; var Promise = require('../lib/promise'); var wrapPromise = require('@braintree/wrap-promise'); var sharedErrors = require('../lib/errors'); var cachedClients = {}; /** @module braintree-web/client */ /** * @function create * @description This function is the entry point for the braintree.client module. It is used for creating {@link Client} instances that service communication to Braintree servers. * @param {object} options Object containing all {@link Client} options: * @param {string} options.authorization A tokenizationKey or clientToken. * @param {callback} [callback] The second argument, data, is the {@link Client} instance. * @returns {Promise|void} Returns a promise if no callback is provided. * @example * var createClient = require('braintree-web/client').create; * * createClient({ * authorization: CLIENT_AUTHORIZATION * }, function (createErr, clientInstance) { * // ... * }); * @static */ function create(options) { if (!options.authorization) { return Promise.reject(new BraintreeError({ type: sharedErrors.INSTANTIATION_OPTION_REQUIRED.type, code: sharedErrors.INSTANTIATION_OPTION_REQUIRED.code, message: 'options.authorization is required when instantiating a client.' })); } if (cachedClients[options.authorization] && cachedClients[options.authorization]._activeCache) { return Promise.resolve(cachedClients[options.authorization]); } return getConfiguration(options).then(function (configuration) { var client; if (options.debug) { configuration.isDebug = true; } client = new Client(configuration); cachedClients[options.authorization] = client; return client; }); } // Primarily used for testing the client create call function clearCache() { cachedClients = {}; } module.exports = { create: wrapPromise(create), /** * @description The current version of the SDK, i.e. `{@pkg version}`. * @type {string} */ VERSION: VERSION, _clearCache: clearCache }; },{"../lib/braintree-error":66,"../lib/errors":78,"../lib/promise":87,"./client":26,"./get-configuration":29,"@braintree/wrap-promise":21}],31:[function(require,module,exports){ 'use strict'; var querystring = require('../../lib/querystring'); var browserDetection = require('../browser-detection'); var assign = require('../../lib/assign').assign; var prepBody = require('./prep-body'); var parseBody = require('./parse-body'); var xhr = require('./xhr'); var isXHRAvailable = xhr.isAvailable; var GraphQLRequest = require('./graphql/request'); var DefaultRequest = require('./default-request'); var MAX_TCP_RETRYCOUNT = 1; var TCP_PRECONNECT_BUG_STATUS_CODE = 408; function requestShouldRetry(status) { return (!status || status === TCP_PRECONNECT_BUG_STATUS_CODE) && browserDetection.isIe(); } function graphQLRequestShouldRetryWithClientApi(body) { var errorClass = !body.data && body.errors && body.errors[0] && body.errors[0].extensions && body.errors[0].extensions.errorClass; return errorClass === 'UNKNOWN' || errorClass === 'INTERNAL'; } function _requestWithRetry(options, tcpRetryCount, cb) { var status, resBody, ajaxRequest, body, method, headers, parsedBody; var url = options.url; var graphQL = options.graphQL; var timeout = options.timeout; var req = xhr.getRequestObject(); var callback = cb; var isGraphQLRequest = Boolean(graphQL && graphQL.isGraphQLRequest(url, options.data)); options.headers = assign({'Content-Type': 'application/json'}, options.headers); if (isGraphQLRequest) { ajaxRequest = new GraphQLRequest(options); } else { ajaxRequest = new DefaultRequest(options); } url = ajaxRequest.getUrl(); body = ajaxRequest.getBody(); method = ajaxRequest.getMethod(); headers = ajaxRequest.getHeaders(); if (method === 'GET') { url = querystring.queryify(url, body); body = null; } if (isXHRAvailable) { req.onreadystatechange = function () { if (req.readyState !== 4) { return; } if (req.status === 0 && isGraphQLRequest) { // If a merchant experiences a connection // issue to the GraphQL endpoint (possibly // due to a Content Security Policy), retry // the request against the old client API. delete options.graphQL; _requestWithRetry(options, tcpRetryCount, cb); return; } parsedBody = parseBody(req.responseText); resBody = ajaxRequest.adaptResponseBody(parsedBody); status = ajaxRequest.determineStatus(req.status, parsedBody); if (status >= 400 || status < 200) { if (isGraphQLRequest && graphQLRequestShouldRetryWithClientApi(parsedBody)) { delete options.graphQL; _requestWithRetry(options, tcpRetryCount, cb); return; } if (tcpRetryCount < MAX_TCP_RETRYCOUNT && requestShouldRetry(status)) { tcpRetryCount++; _requestWithRetry(options, tcpRetryCount, cb); return; } callback(resBody || 'error', null, status || 500); } else { callback(null, resBody, status); } }; } else { if (options.headers) { url = querystring.queryify(url, headers); } req.onload = function () { callback(null, parseBody(req.responseText), req.status); }; req.onerror = function () { // XDomainRequest does not report a body or status for errors, so // hardcode to 'error' and 500, respectively callback('error', null, 500); }; // This must remain for IE9 to work req.onprogress = function () {}; req.ontimeout = function () { callback('timeout', null, -1); }; } try { req.open(method, url, true); } catch (requestOpenError) { // If a merchant has a Content Security Policy and they have // not allowed our endpoints, some browsers may // synchronously throw an error. If it is not a GraphQL // request, we throw the error. If it is a GraphQL request // we remove the GraphQL option and try the request against // the old client API. if (!isGraphQLRequest) { throw requestOpenError; } delete options.graphQL; _requestWithRetry(options, tcpRetryCount, cb); return; } req.timeout = timeout; if (isXHRAvailable) { Object.keys(headers).forEach(function (headerKey) { req.setRequestHeader(headerKey, headers[headerKey]); }); } try { req.send(prepBody(method, body)); } catch (e) { /* ignored */ } } function request(options, cb) { _requestWithRetry(options, 0, cb); } module.exports = { request: request }; },{"../../lib/assign":63,"../../lib/querystring":88,"../browser-detection":25,"./default-request":32,"./graphql/request":40,"./parse-body":44,"./prep-body":45,"./xhr":46}],32:[function(require,module,exports){ 'use strict'; function DefaultRequest(options) { this._url = options.url; this._data = options.data; this._method = options.method; this._headers = options.headers; } DefaultRequest.prototype.getUrl = function () { return this._url; }; DefaultRequest.prototype.getBody = function () { return this._data; }; DefaultRequest.prototype.getMethod = function () { return this._method; }; DefaultRequest.prototype.getHeaders = function () { return this._headers; }; DefaultRequest.prototype.adaptResponseBody = function (parsedBody) { return parsedBody; }; DefaultRequest.prototype.determineStatus = function (status) { return status; }; module.exports = DefaultRequest; },{}],33:[function(require,module,exports){ (function (global){ 'use strict'; module.exports = function getUserAgent() { return global.navigator.userAgent; }; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}],34:[function(require,module,exports){ 'use strict'; var errorResponseAdapter = require('./error'); var assign = require('../../../../lib/assign').assign; /* eslint-disable camelcase */ var cardTypeTransforms = { creditCard: { AMERICAN_EXPRESS: 'American Express', DISCOVER: 'Discover', INTERNATIONAL_MAESTRO: 'Maestro', JCB: 'JCB', MASTERCARD: 'MasterCard', SOLO: 'Solo', UK_MAESTRO: 'UK Maestro', UNION_PAY: 'UnionPay', VISA: 'Visa' }, applePayWeb: { VISA: 'visa', MASTERCARD: 'mastercard', DISCOVER: 'discover', AMERICAN_EXPRESS: 'amex' }, visaCheckout: { VISA: 'Visa', MASTERCARD: 'MasterCard', DISCOVER: 'Discover', AMERICAN_EXPRESS: 'American Express' }, googlePay: { VISA: 'visa', MASTERCARD: 'mastercard', DISCOVER: 'discover', AMERICAN_EXPRESS: 'amex' }, masterpass: { VISA: 'visa', MASTERCARD: 'master', DISCOVER: 'discover', AMERICAN_EXPRESS: 'amex', DINERS: 'diners', INTERNATIONAL_MAESTRO: 'maestro', JCB: 'jcb' } }; /* eslint-enable camelcase */ function configurationResponseAdapter(responseBody, ctx) { var adaptedResponse; if (responseBody.data && !responseBody.errors) { adaptedResponse = adaptConfigurationResponseBody(responseBody, ctx); } else { adaptedResponse = errorResponseAdapter(responseBody); } return adaptedResponse; } function adaptConfigurationResponseBody(body, ctx) { var configuration = body.data.clientConfiguration; var response; response = { environment: configuration.environment.toLowerCase(), clientApiUrl: configuration.clientApiUrl, assetsUrl: configuration.assetsUrl, analytics: { url: configuration.analyticsUrl }, merchantId: configuration.merchantId, venmo: 'off' }; if (configuration.supportedFeatures) { response.graphQL = { url: ctx._graphQL._config.url, features: configuration.supportedFeatures.map(function (feature) { return feature.toLowerCase(); }) }; } if (configuration.braintreeApi) { response.braintreeApi = configuration.braintreeApi; } if (configuration.applePayWeb) { response.applePayWeb = configuration.applePayWeb; response.applePayWeb.supportedNetworks = mapCardTypes(configuration.applePayWeb.supportedCardBrands, cardTypeTransforms.applePayWeb); delete response.applePayWeb.supportedCardBrands; } if (configuration.ideal) { response.ideal = configuration.ideal; } if (configuration.kount) { response.kount = { kountMerchantId: configuration.kount.merchantId }; } if (configuration.creditCard) { response.challenges = configuration.creditCard.challenges.map(function (challenge) { return challenge.toLowerCase(); }); response.creditCards = { supportedCardTypes: mapCardTypes(configuration.creditCard.supportedCardBrands, cardTypeTransforms.creditCard) }; response.threeDSecureEnabled = configuration.creditCard.threeDSecureEnabled; } else { response.challenges = []; response.creditCards = { supportedCardTypes: [] }; response.threeDSecureEnabled = false; } if (configuration.googlePay) { response.androidPay = { displayName: configuration.googlePay.displayName, enabled: true, environment: configuration.googlePay.environment.toLowerCase(), googleAuthorizationFingerprint: configuration.googlePay.googleAuthorization, supportedNetworks: mapCardTypes(configuration.googlePay.supportedCardBrands, cardTypeTransforms.googlePay) }; } if (configuration.venmo) { response.payWithVenmo = { merchantId: configuration.venmo.merchantId, accessToken: configuration.venmo.accessToken, environment: configuration.venmo.environment.toLowerCase() }; } if (configuration.paypal) { response.paypalEnabled = true; response.paypal = assign({}, configuration.paypal); response.paypal.currencyIsoCode = response.paypal.currencyCode; response.paypal.environment = response.paypal.environment.toLowerCase(); delete response.paypal.currencyCode; } else { response.paypalEnabled = false; } if (configuration.unionPay) { response.unionPay = { enabled: true, merchantAccountId: configuration.unionPay.merchantAccountId }; } if (configuration.visaCheckout) { response.visaCheckout = { apikey: configuration.visaCheckout.apiKey, externalClientId: configuration.visaCheckout.externalClientId, supportedCardTypes: mapCardTypes(configuration.visaCheckout.supportedCardBrands, cardTypeTransforms.visaCheckout) }; } if (configuration.masterpass) { response.masterpass = { merchantCheckoutId: configuration.masterpass.merchantCheckoutId, supportedNetworks: mapCardTypes(configuration.masterpass.supportedCardBrands, cardTypeTransforms.masterpass) }; } if (configuration.usBankAccount) { response.usBankAccount = { routeId: configuration.usBankAccount.routeId, plaid: { publicKey: configuration.usBankAccount.plaidPublicKey } }; } return response; } function mapCardTypes(cardTypes, cardTypeTransformMap) { return cardTypes.reduce(function (acc, type) { if (cardTypeTransformMap.hasOwnProperty(type)) { return acc.concat(cardTypeTransformMap[type]); } return acc; }, []); } module.exports = configurationResponseAdapter; },{"../../../../lib/assign":63,"./error":36}],35:[function(require,module,exports){ 'use strict'; var errorResponseAdapter = require('./error'); var CARD_BRAND_MAP = { /* eslint-disable camelcase */ AMERICAN_EXPRESS: 'American Express', DINERS: 'Discover', DISCOVER: 'Discover', INTERNATIONAL_MAESTRO: 'Maestro', JCB: 'JCB', MASTERCARD: 'MasterCard', UK_MAESTRO: 'Maestro', UNION_PAY: 'Union Pay', VISA: 'Visa' /* eslint-enable camelcase */ }; var BIN_DATA_MAP = { YES: 'Yes', NO: 'No', UNKNOWN: 'Unknown' }; function creditCardTokenizationResponseAdapter(responseBody) { var adaptedResponse; if (responseBody.data && !responseBody.errors) { adaptedResponse = adaptTokenizeCreditCardResponseBody(responseBody); } else { adaptedResponse = errorResponseAdapter(responseBody); } return adaptedResponse; } function adaptTokenizeCreditCardResponseBody(body) { var data = body.data.tokenizeCreditCard; var creditCard = data.creditCard; var lastTwo = creditCard.last4 ? creditCard.last4.substr(2, 4) : ''; var binData = creditCard.binData; var response; if (binData) { ['commercial', 'debit', 'durbinRegulated', 'healthcare', 'payroll', 'prepaid'].forEach(function (key) { if (binData[key]) { binData[key] = BIN_DATA_MAP[binData[key]]; } else { binData[key] = 'Unknown'; } }); ['issuingBank', 'countryOfIssuance', 'productId'].forEach(function (key) { if (!binData[key]) { binData[key] = 'Unknown'; } }); } response = { creditCards: [ { binData: binData, consumed: false, description: lastTwo ? 'ending in ' + lastTwo : '', nonce: data.token, details: { cardType: CARD_BRAND_MAP[creditCard.brandCode] || 'Unknown', lastFour: creditCard.last4 || '', lastTwo: lastTwo }, type: 'CreditCard', threeDSecureInfo: null } ] }; return response; } module.exports = creditCardTokenizationResponseAdapter; },{"./error":36}],36:[function(require,module,exports){ 'use strict'; function errorResponseAdapter(responseBody) { var response; var errorClass = responseBody.errors && responseBody.errors[0] && responseBody.errors[0].extensions && responseBody.errors[0].extensions.errorClass; if (errorClass === 'VALIDATION') { response = userErrorResponseAdapter(responseBody); } else if (errorClass) { response = errorWithClassResponseAdapter(responseBody); } else { response = {error: {message: 'There was a problem serving your request'}, fieldErrors: []}; } return response; } function errorWithClassResponseAdapter(responseBody) { return {error: {message: responseBody.errors[0].message}, fieldErrors: []}; } function userErrorResponseAdapter(responseBody) { var fieldErrors = buildFieldErrors(responseBody.errors); return {error: {message: getLegacyMessage(fieldErrors)}, fieldErrors: fieldErrors}; } function buildFieldErrors(errors) { var fieldErrors = []; errors.forEach(function (error) { addFieldError(error.extensions.inputPath.slice(1), error, fieldErrors); }); return fieldErrors; } function addFieldError(inputPath, errorDetail, fieldErrors) { var fieldError; var legacyCode = errorDetail.extensions.legacyCode; var inputField = inputPath[0]; if (inputPath.length === 1) { fieldErrors.push({ code: legacyCode, field: inputField, message: errorDetail.message }); return; } fieldErrors.forEach(function (candidate) { if (candidate.field === inputField) { fieldError = candidate; } }); if (!fieldError) { fieldError = {field: inputField, fieldErrors: []}; fieldErrors.push(fieldError); } addFieldError(inputPath.slice(1), errorDetail, fieldError.fieldErrors); } function getLegacyMessage(errors) { var legacyMessages = { creditCard: 'Credit card is invalid' }; var field = errors[0].field; return legacyMessages[field]; } module.exports = errorResponseAdapter; },{}],37:[function(require,module,exports){ 'use strict'; var CONFIGURATION_QUERY = 'query ClientConfiguration { ' + ' clientConfiguration { ' + ' analyticsUrl ' + ' environment ' + ' merchantId ' + ' assetsUrl ' + ' clientApiUrl ' + ' creditCard { ' + ' supportedCardBrands ' + ' challenges ' + ' threeDSecureEnabled ' + ' } ' + ' applePayWeb { ' + ' countryCode ' + ' currencyCode ' + ' merchantIdentifier ' + ' supportedCardBrands ' + ' } ' + ' googlePay { ' + ' displayName ' + ' supportedCardBrands ' + ' environment ' + ' googleAuthorization ' + ' } ' + ' ideal { ' + ' routeId ' + ' assetsUrl ' + ' } ' + ' kount { ' + ' merchantId ' + ' } ' + ' masterpass { ' + ' merchantCheckoutId ' + ' supportedCardBrands ' + ' } ' + ' paypal { ' + ' displayName ' + ' clientId ' + ' privacyUrl ' + ' userAgreementUrl ' + ' assetsUrl ' + ' environment ' + ' environmentNoNetwork ' + ' unvettedMerchant ' + ' braintreeClientId ' + ' billingAgreementsEnabled ' + ' merchantAccountId ' + ' currencyCode ' + ' payeeEmail ' + ' } ' + ' unionPay { ' + ' merchantAccountId ' + ' } ' + ' usBankAccount { ' + ' routeId ' + ' plaidPublicKey ' + ' } ' + ' venmo { ' + ' merchantId ' + ' accessToken ' + ' environment ' + ' } ' + ' visaCheckout { ' + ' apiKey ' + ' externalClientId ' + ' supportedCardBrands ' + ' } ' + ' braintreeApi { ' + ' accessToken ' + ' url ' + ' } ' + ' supportedFeatures ' + ' } ' + '}'; function configuration() { return { query: CONFIGURATION_QUERY, operationName: 'ClientConfiguration' }; } module.exports = configuration; },{}],38:[function(require,module,exports){ 'use strict'; var assign = require('../../../../lib/assign').assign; var CREDIT_CARD_TOKENIZATION_MUTATION = 'mutation TokenizeCreditCard($input: TokenizeCreditCardInput!) { ' + ' tokenizeCreditCard(input: $input) { ' + ' token ' + ' creditCard { ' + ' brandCode ' + ' last4 ' + ' binData { ' + ' prepaid ' + ' healthcare ' + ' debit ' + ' durbinRegulated ' + ' commercial ' + ' payroll ' + ' issuingBank ' + ' countryOfIssuance ' + ' productId ' + ' } ' + ' } ' + ' } ' + '}'; function createCreditCardTokenizationBody(body) { var cc = body.creditCard; var billingAddress = cc && cc.billingAddress; var expDate = cc && cc.expirationDate; var expirationMonth = cc && (cc.expirationMonth || (expDate && expDate.split('/')[0].trim())); var expirationYear = cc && (cc.expirationYear || (expDate && expDate.split('/')[1].trim())); var variables = { input: { creditCard: { number: cc && cc.number, expirationMonth: expirationMonth, expirationYear: expirationYear, cvv: cc && cc.cvv, cardholderName: cc && cc.cardholderName }, options: {} } }; if (billingAddress) { variables.input.creditCard.billingAddress = billingAddress; } variables.input = addValidationRule(body, variables.input); return variables; } function addValidationRule(body, input) { var validate; if (body.creditCard && body.creditCard.options && typeof body.creditCard.options.validate === 'boolean') { validate = body.creditCard.options.validate; } else if ((body.authorizationFingerprint && body.tokenizationKey) || body.authorizationFingerprint) { validate = true; } else if (body.tokenizationKey) { validate = false; } if (typeof validate === 'boolean') { input.options = assign({ validate: validate }, input.options); } return input; } function creditCardTokenization(body) { return { query: CREDIT_CARD_TOKENIZATION_MUTATION, variables: createCreditCardTokenizationBody(body), operationName: 'TokenizeCreditCard' }; } module.exports = creditCardTokenization; },{"../../../../lib/assign":63}],39:[function(require,module,exports){ 'use strict'; var browserDetection = require('../../browser-detection'); var features = { tokenize_credit_cards: 'payment_methods/credit_cards', // eslint-disable-line camelcase configuration: 'configuration' }; var disallowedInputPaths = [ 'creditCard.options.unionPayEnrollment' ]; function GraphQL(config) { this._config = config.graphQL; } GraphQL.prototype.getGraphQLEndpoint = function () { return this._config.url; }; GraphQL.prototype.isGraphQLRequest = function (url, body) { var featureEnabled; var path = this.getClientApiPath(url); if (!this._isGraphQLEnabled() || !path || browserDetection.isIe9()) { return false; } featureEnabled = this._config.features.some(function (feature) { return features[feature] === path; }); if (containsDisallowedlistedKeys(body)) { return false; } return featureEnabled; }; GraphQL.prototype.getClientApiPath = function (url) { var path; var clientApiPrefix = '/client_api/v1/'; var pathParts = url.split(clientApiPrefix); if (pathParts.length > 1) { path = pathParts[1].split('?')[0]; } return path; }; GraphQL.prototype._isGraphQLEnabled = function () { return Boolean(this._config); }; function containsDisallowedlistedKeys(body) { return disallowedInputPaths.some(function (keys) { var value = keys.split('.').reduce(function (accumulator, key) { return accumulator && accumulator[key]; }, body); return value !== undefined; // eslint-disable-line no-undefined }); } module.exports = GraphQL; },{"../../browser-detection":25}],40:[function(require,module,exports){ 'use strict'; var BRAINTREE_VERSION = require('../../constants').BRAINTREE_VERSION; var assign = require('../../../lib/assign').assign; var creditCardTokenizationBodyGenerator = require('./generators/credit-card-tokenization'); var creditCardTokenizationResponseAdapter = require('./adapters/credit-card-tokenization'); var configurationBodyGenerator = require('./generators/configuration'); var configurationResponseAdapter = require('./adapters/configuration'); var generators = { 'payment_methods/credit_cards': creditCardTokenizationBodyGenerator, configuration: configurationBodyGenerator }; var adapters = { 'payment_methods/credit_cards': creditCardTokenizationResponseAdapter, configuration: configurationResponseAdapter }; function GraphQLRequest(options) { var clientApiPath = options.graphQL.getClientApiPath(options.url); this._graphQL = options.graphQL; this._data = options.data; this._method = options.method; this._headers = options.headers; this._clientSdkMetadata = { source: options.metadata.source, integration: options.metadata.integration, sessionId: options.metadata.sessionId }; this._sendAnalyticsEvent = options.sendAnalyticsEvent || Function.prototype; this._generator = generators[clientApiPath]; this._adapter = adapters[clientApiPath]; this._sendAnalyticsEvent('graphql.init'); } GraphQLRequest.prototype.getUrl = function () { return this._graphQL.getGraphQLEndpoint(); }; GraphQLRequest.prototype.getBody = function () { var formattedBody = formatBodyKeys(this._data); var generatedBody = this._generator(formattedBody); var body = assign({clientSdkMetadata: this._clientSdkMetadata}, generatedBody); return JSON.stringify(body); }; GraphQLRequest.prototype.getMethod = function () { return 'POST'; }; GraphQLRequest.prototype.getHeaders = function () { var authorization, headers; if (this._data.authorizationFingerprint) { this._sendAnalyticsEvent('graphql.authorization-fingerprint'); authorization = this._data.authorizationFingerprint; } else { this._sendAnalyticsEvent('graphql.tokenization-key'); authorization = this._data.tokenizationKey; } headers = { Authorization: 'Bearer ' + authorization, 'Braintree-Version': BRAINTREE_VERSION }; return assign({}, this._headers, headers); }; GraphQLRequest.prototype.adaptResponseBody = function (parsedBody) { return this._adapter(parsedBody, this); }; GraphQLRequest.prototype.determineStatus = function (httpStatus, parsedResponse) { var status, errorClass; if (httpStatus === 200) { errorClass = parsedResponse.errors && parsedResponse.errors[0] && parsedResponse.errors[0].extensions && parsedResponse.errors[0].extensions.errorClass; if (parsedResponse.data && !parsedResponse.errors) { status = 200; } else if (errorClass === 'VALIDATION') { status = 422; } else if (errorClass === 'AUTHORIZATION') { status = 403; } else if (errorClass === 'AUTHENTICATION') { status = 401; } else if (isGraphQLError(errorClass, parsedResponse)) { status = 403; } else { status = 500; } } else if (!httpStatus) { status = 500; } else { status = httpStatus; } this._sendAnalyticsEvent('graphql.status.' + httpStatus); this._sendAnalyticsEvent('graphql.determinedStatus.' + status); return status; }; function isGraphQLError(errorClass, parsedResponse) { return !errorClass && parsedResponse.errors[0].message; } function snakeCaseToCamelCase(snakeString) { if (snakeString.indexOf('_') === -1) { return snakeString; } return snakeString.toLowerCase().replace(/(\_\w)/g, function (match) { return match[1].toUpperCase(); }); } function formatBodyKeys(originalBody) { var body = {}; Object.keys(originalBody).forEach(function (key) { var camelCaseKey = snakeCaseToCamelCase(key); if (typeof originalBody[key] === 'object') { body[camelCaseKey] = formatBodyKeys(originalBody[key]); } else if (typeof originalBody[key] === 'number') { body[camelCaseKey] = String(originalBody[key]); } else { body[camelCaseKey] = originalBody[key]; } }); return body; } module.exports = GraphQLRequest; },{"../../../lib/assign":63,"../../constants":27,"./adapters/configuration":34,"./adapters/credit-card-tokenization":35,"./generators/configuration":37,"./generators/credit-card-tokenization":38}],41:[function(require,module,exports){ 'use strict'; var ajaxIsAvaliable; var once = require('../../lib/once'); var JSONPDriver = require('./jsonp-driver'); var AJAXDriver = require('./ajax-driver'); var getUserAgent = require('./get-user-agent'); var isHTTP = require('./is-http'); function isAjaxAvailable() { if (ajaxIsAvaliable == null) { ajaxIsAvaliable = !(isHTTP() && /MSIE\s(8|9)/.test(getUserAgent())); } return ajaxIsAvaliable; } module.exports = function (options, cb) { cb = once(cb || Function.prototype); options.method = (options.method || 'GET').toUpperCase(); options.timeout = options.timeout == null ? 60000 : options.timeout; options.data = options.data || {}; if (isAjaxAvailable()) { AJAXDriver.request(options, cb); } else { JSONPDriver.request(options, cb); } }; },{"../../lib/once":86,"./ajax-driver":31,"./get-user-agent":33,"./is-http":42,"./jsonp-driver":43}],42:[function(require,module,exports){ (function (global){ 'use strict'; module.exports = function () { return global.location.protocol === 'http:'; }; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}],43:[function(require,module,exports){ (function (global){ 'use strict'; var head; var uuid = require('../../lib/vendor/uuid'); var querystring = require('../../lib/querystring'); var timeouts = {}; function _removeScript(script) { if (script && script.parentNode) { script.parentNode.removeChild(script); } } function _createScriptTag(url, callbackName) { var script = document.createElement('script'); var done = false; script.src = url; script.async = true; script.onerror = function () { global[callbackName]({message: 'error', status: 500}); }; script.onload = script.onreadystatechange = function () { if (done) { return; } if (!this.readyState || this.readyState === 'loaded' || this.readyState === 'complete') { done = true; script.onload = script.onreadystatechange = null; } }; return script; } function _cleanupGlobal(callbackName) { try { delete global[callbackName]; } catch (_) { global[callbackName] = null; } } function _setupTimeout(timeout, callbackName) { timeouts[callbackName] = setTimeout(function () { timeouts[callbackName] = null; global[callbackName]({ error: 'timeout', status: -1 }); global[callbackName] = function () { _cleanupGlobal(callbackName); }; }, timeout); } function _setupGlobalCallback(script, callback, callbackName) { global[callbackName] = function (response) { var status = response.status || 500; var err = null; var data = null; delete response.status; if (status >= 400 || status < 200) { err = response; } else { data = response; } _cleanupGlobal(callbackName); _removeScript(script); clearTimeout(timeouts[callbackName]); callback(err, data, status); }; } function request(options, callback) { var script; var callbackName = 'callback_json_' + uuid().replace(/-/g, ''); var url = options.url; var attrs = options.data; var method = options.method; var timeout = options.timeout; url = querystring.queryify(url, attrs); url = querystring.queryify(url, { _method: method, callback: callbackName }); script = _createScriptTag(url, callbackName); _setupGlobalCallback(script, callback, callbackName); _setupTimeout(timeout, callbackName); if (!head) { head = document.getElementsByTagName('head')[0]; } head.appendChild(script); } module.exports = { request: request }; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"../../lib/querystring":88,"../../lib/vendor/uuid":91}],44:[function(require,module,exports){ 'use strict'; module.exports = function (body) { try { body = JSON.parse(body); } catch (e) { /* ignored */ } return body; }; },{}],45:[function(require,module,exports){ 'use strict'; module.exports = function (method, body) { if (typeof method !== 'string') { throw new Error('Method must be a string'); } if (method.toLowerCase() !== 'get' && body != null) { body = typeof body === 'string' ? body : JSON.stringify(body); } return body; }; },{}],46:[function(require,module,exports){ (function (global){ 'use strict'; var isXHRAvailable = global.XMLHttpRequest && 'withCredentials' in new global.XMLHttpRequest(); function getRequestObject() { return isXHRAvailable ? new XMLHttpRequest() : new XDomainRequest(); } module.exports = { isAvailable: isXHRAvailable, getRequestObject: getRequestObject }; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}],47:[function(require,module,exports){ 'use strict'; /** * @name BraintreeError.Google Payment - Creation Error Codes * @description Errors that occur when [creating the Google Payment component](/current/module-braintree-web_google-payment.html#.create). * @property {MERCHANT} GOOGLE_PAYMENT_NOT_ENABLED Occurs when Google Pay is not enabled on the Braintree control panel. */ /** * @name BraintreeError.Google Payment - parseResponse Error Codes * @description Errors that occur when [parsing the response from Google](/current/GooglePayment.html#parseResponse). * @property {UNKNOWN} GOOGLE_PAYMENT_GATEWAY_ERROR Occurs when Google Pay could not be tokenized. */ var BraintreeError = require('../lib/braintree-error'); module.exports = { GOOGLE_PAYMENT_NOT_ENABLED: { type: BraintreeError.types.MERCHANT, code: 'GOOGLE_PAYMENT_NOT_ENABLED', message: 'Google Pay is not enabled for this merchant.' }, GOOGLE_PAYMENT_GATEWAY_ERROR: { code: 'GOOGLE_PAYMENT_GATEWAY_ERROR', message: 'There was an error when tokenizing the Google Pay payment method.', type: BraintreeError.types.UNKNOWN } }; },{"../lib/braintree-error":66}],48:[function(require,module,exports){ 'use strict'; var analytics = require('../lib/analytics'); var assign = require('../lib/assign').assign; var convertMethodsToError = require('../lib/convert-methods-to-error'); var generateGooglePayConfiguration = require('../lib/generate-google-pay-configuration'); var BraintreeError = require('../lib/braintree-error'); var errors = require('./errors'); var methods = require('../lib/methods'); var Promise = require('../lib/promise'); var wrapPromise = require('@braintree/wrap-promise'); /** * @typedef {object} GooglePayment~tokenizePayload * @property {string} nonce The payment method nonce. * @property {object} details Additional account details. * @property {string} details.cardType Type of card, ex: Visa, MasterCard. * @property {string} details.lastFour Last four digits of card number. * @property {string} details.lastTwo Last two digits of card number. * @property {string} description A human-readable description. * @property {string} type The payment method type, `CreditCard` or `AndroidPayCard`. * @property {object} binData Information about the card based on the bin. * @property {string} binData.commercial Possible values: 'Yes', 'No', 'Unknown'. * @property {string} binData.countryOfIssuance The country of issuance. * @property {string} binData.debit Possible values: 'Yes', 'No', 'Unknown'. * @property {string} binData.durbinRegulated Possible values: 'Yes', 'No', 'Unknown'. * @property {string} binData.healthcare Possible values: 'Yes', 'No', 'Unknown'. * @property {string} binData.issuingBank The issuing bank. * @property {string} binData.payroll Possible values: 'Yes', 'No', 'Unknown'. * @property {string} binData.prepaid Possible values: 'Yes', 'No', 'Unknown'. * @property {string} binData.productId The product id. */ /** * @class GooglePayment * @param {object} options Google Payment {@link module:braintree-web/google-payment.create create} options. * @description Do not use this constructor directly. Use {@link module:braintree-web/google-payment.create|braintree-web.google-payment.create} instead. * @classdesc This class represents a Google Payment component produced by {@link module:braintree-web/google-payment.create|braintree-web/google-payment.create}. Instances of this class have methods for initializing the Google Pay flow. */ function GooglePayment(options) { this._client = options.client; this._braintreeGeneratedPaymentRequestConfiguration = generateGooglePayConfiguration(this._client.getConfiguration()); } /** * Create a configuration object for use in the `loadPaymentData` method. * @public * @param {object} overrides The supplied parameters for creating the PaymentDataRequest object. Only required parameters are the `merchantId` provided by Google and a `transactionInfo` object, but any of the parameters in the PaymentDataRequest can be overwritten. See https://developers.google.com/pay/api/web/reference/object#PaymentDataRequest * @param {string} merchantId The merchant id provided by registering with Google. * @param {object} transactionInfo See https://developers.google.com/pay/api/web/reference/object#TransactionInfo for more information. * @example * var configuration = googlePaymentInstance.createPaymentDataRequest({ * merchantId: 'my-merchant-id-from-google', * transactionInfo: { * currencyCode: 'USD', * totalPriceStatus: 'FINAL', * totalPrice: '100.00' * } * }); * var paymentsClient = new google.payments.api.PaymentsClient({ * environment: 'TEST' // or 'PRODUCTION' * }) * * paymentsClient.loadPaymentData(paymentDataRequest).then(function (response) { * // handle response with googlePaymentInstance.parseResponse * // (see below) * }); * @returns {object} Returns a configuration object for Google PaymentDataRequest. */ GooglePayment.prototype.createPaymentDataRequest = function (overrides) { var overrideCardNetworks = overrides && overrides.cardRequirements && overrides.cardRequirements.allowedCardNetworks; var defaultCardNetworks = this._braintreeGeneratedPaymentRequestConfiguration.cardRequirements.allowedCardNetworks; var allowedCardNetworks = overrideCardNetworks || defaultCardNetworks; var paymentDataRequest = assign({}, this._braintreeGeneratedPaymentRequestConfiguration, overrides); // this way we can preserve allowedCardNetworks from default integration // if merchant did not pass any in `cardRequirements` paymentDataRequest.cardRequirements.allowedCardNetworks = allowedCardNetworks; analytics.sendEvent(this._client, 'google-payment.createPaymentDataRequest'); return paymentDataRequest; }; /** * Parse the response from the tokenization. * @public * @param {object} response The response back from the Google Pay tokenization. * @param {callback} [callback] The second argument, data, is a {@link GooglePay~tokenizePayload|tokenizePayload}. If no callback is provided, `parseResponse` returns a promise that resolves with a {@link GooglePayment~tokenizePayload|tokenizePayload}. * @example with callback * var paymentsClient = new google.payments.api.PaymentsClient({ * environment: 'TEST' // or 'PRODUCTION' * }) * * paymentsClient.loadPaymentData(paymentDataRequestFromCreatePaymentDataRequest).then(function (response) { * googlePaymentInstance.parseResponse(response, function (err, data) { * if (err) { * // handle errors * } * // send parsedResponse.nonce to your server * }); * }); * @example with promise * var paymentsClient = new google.payments.api.PaymentsClient({ * environment: 'TEST' // or 'PRODUCTION' * }) * * paymentsClient.loadPaymentData(paymentDataRequestFromCreatePaymentDataRequest).then(function (response) { * return googlePaymentInstance.parseResponse(response); * }).then(function (parsedResponse) { * // send parsedResponse.nonce to your server * }).catch(function (err) { * // handle errors * }); * @returns {Promise|void} Returns a promise that resolves the parsed response if no callback is provided. */ GooglePayment.prototype.parseResponse = function (response) { var client = this._client; return Promise.resolve().then(function () { var payload; var parsedResponse = JSON.parse(response.paymentMethodToken.token); var error = parsedResponse.error; if (error) { return Promise.reject(error); } payload = parsedResponse.androidPayCards[0]; analytics.sendEvent(client, 'google-payment.parseResponse.succeeded'); return Promise.resolve({ nonce: payload.nonce, type: payload.type, description: payload.description, details: { cardType: payload.details.cardType, lastFour: payload.details.lastFour, lastTwo: payload.details.lastTwo }, binData: payload.binData }); }).catch(function (error) { analytics.sendEvent(client, 'google-payment.parseResponse.failed'); return Promise.reject(new BraintreeError({ code: errors.GOOGLE_PAYMENT_GATEWAY_ERROR.code, message: errors.GOOGLE_PAYMENT_GATEWAY_ERROR.message, type: errors.GOOGLE_PAYMENT_GATEWAY_ERROR.type, details: { originalError: error } })); }); }; /** * Cleanly tear down anything set up by {@link module:braintree-web/google-payment.create|create}. * @public * @param {callback} [callback] Called once teardown is complete. No data is returned if teardown completes successfully. * @example * googlePaymentInstance.teardown(); * @example With callback * googlePaymentInstance.teardown(function () { * // teardown is complete * }); * @returns {Promise|void} Returns a promise if no callback is provided. */ GooglePayment.prototype.teardown = function () { convertMethodsToError(this, methods(GooglePayment.prototype)); return Promise.resolve(); }; module.exports = wrapPromise.wrapPrototype(GooglePayment); },{"../lib/analytics":62,"../lib/assign":63,"../lib/braintree-error":66,"../lib/convert-methods-to-error":72,"../lib/generate-google-pay-configuration":80,"../lib/methods":85,"../lib/promise":87,"./errors":47,"@braintree/wrap-promise":21}],49:[function(require,module,exports){ 'use strict'; /** * @module braintree-web/google-payment * @description A component to integrate with Google Pay. The majority of the integration uses [Google's pay.js JavaScript file](https://pay.google.com/gp/p/js/pay.js). The Braintree component generates the configuration object necessary for Google Pay to initiate the Payment Request and parse the returned data to retrieve the payment method nonce which is used to process the transaction on the server. */ var basicComponentVerification = require('../lib/basic-component-verification'); var BraintreeError = require('../lib/braintree-error'); var errors = require('./errors'); var GooglePayment = require('./google-payment'); var Promise = require('../lib/promise'); var wrapPromise = require('@braintree/wrap-promise'); var VERSION = "3.37.0"; /** * @static * @function create * @param {object} options Creation options: * @param {Client} options.client A {@link Client} instance. * @param {callback} [callback] The second argument, `data`, is the {@link GooglePayment} instance. If no callback is provided, `create` returns a promise that resolves with the {@link GooglePayment} instance. * @example Simple Example * // include https://pay.google.com/gp/p/js/pay.js in a script tag * // on your page to load the `google.payments.api.PaymentsClient` global object. * * var paymentButton = document.querySelector('#google-pay-button'); * var paymentsClient = new google.payments.api.PaymentsClient({ * environment: 'TEST' // or 'PRODUCTION' * }); * * braintree.client.create({ * authorization: 'tokenization-key-or-client-token' * }).then(function (clientInstance) { * return braintree.googlePayment.create({ * client: clientInstance * }); * }).then(function (googlePaymentInstance) { * paymentButton.addEventListener('click', function (event) { * var paymentDataRequest; * * event.preventDefault(); * * paymentDataRequest = googlePaymentInstance.createPaymentDataRequest({ * merchantId: 'your-merchant-id-from-google', * transactionInfo: { * currencyCode: 'USD', * totalPriceStatus: 'FINAL', * totalPrice: '100.00' * } * }); * * paymentsClient.loadPaymentData(paymentDataRequest).then(function (paymentData) { * return googlePaymentInstance.parseResponse(paymentData); * }).then(function (result) { * // send result.nonce to your server * }).catch(function (err) { * // handle err * }); * }); * }); * @example Check Browser and Customer Compatibility * var paymentsClient = new google.payments.api.PaymentsClient({ * environment: 'TEST' // or 'PRODUCTION' * }); * * function setupGooglePayButton(googlePaymentInstance) { * var button = document.createElement('button'); * * button.id = 'google-pay'; * button.appendChild(document.createTextNode('Google Pay')); * button.addEventListener('click', function (event) { * var paymentRequestData; * * event.preventDefault(); * * paymentDataRequest = googlePaymentInstance.createPaymentDataRequest({ * merchantId: 'your-merchant-id-from-google', * transactionInfo: { * currencyCode: 'USD', * totalPriceStatus: 'FINAL', * totalPrice: '100.00' // your amount * } * }); * * paymentsClient.loadPaymentData(paymentDataRequest).then(function (paymentData) { * return googlePaymentInstance.parseResponse(paymentData); * }).then(function (result) { * // send result.nonce to your server * }).catch(function (err) { * // handle errors * }); * }); * * document.getElementById('container').appendChild(button); * } * * braintree.client.create({ * authorization: 'tokenization-key-or-client-token' * }).then(function (clientInstance) { * return braintree.googlePayment.create({ * client: clientInstance * }); * }).then(function (googlePaymentInstance) { * return paymentsClient.isReadyToPay({ * allowedPaymentMethods: googlePaymentInstance.createPaymentDataRequest().allowedPaymentMethods * }); * }).then(function (response) { * if (response.result) { * setupGooglePayButton(googlePaymentInstance); * } * }).catch(function (err) { * // handle setup errors * }); * * @returns {Promise|void} Returns a promise if no callback is provided. */ function create(options) { return basicComponentVerification.verify({ name: 'Google Pay', client: options.client }).then(function () { if (!options.client.getConfiguration().gatewayConfiguration.androidPay) { return Promise.reject(new BraintreeError(errors.GOOGLE_PAYMENT_NOT_ENABLED)); } return new GooglePayment(options); }); } module.exports = { create: wrapPromise(create), /** * @description The current version of the SDK, i.e. `{@pkg version}`. * @type {string} */ VERSION: VERSION }; },{"../lib/basic-component-verification":64,"../lib/braintree-error":66,"../lib/promise":87,"./errors":47,"./google-payment":48,"@braintree/wrap-promise":21}],50:[function(require,module,exports){ 'use strict'; var BraintreeError = require('../../lib/braintree-error'); var errors = require('../shared/errors'); var allowedAttributes = require('../shared/constants').allowedAttributes; function attributeValidationError(attribute, value) { var err; if (!allowedAttributes.hasOwnProperty(attribute)) { err = new BraintreeError({ type: errors.HOSTED_FIELDS_ATTRIBUTE_NOT_SUPPORTED.type, code: errors.HOSTED_FIELDS_ATTRIBUTE_NOT_SUPPORTED.code, message: 'The "' + attribute + '" attribute is not supported in Hosted Fields.' }); } else if (value != null && !_isValid(attribute, value)) { err = new BraintreeError({ type: errors.HOSTED_FIELDS_ATTRIBUTE_VALUE_NOT_ALLOWED.type, code: errors.HOSTED_FIELDS_ATTRIBUTE_VALUE_NOT_ALLOWED.code, message: 'Value "' + value + '" is not allowed for "' + attribute + '" attribute.' }); } return err; } function _isValid(attribute, value) { if (allowedAttributes[attribute] === 'string') { return typeof value === 'string' || typeof value === 'number'; } else if (allowedAttributes[attribute] === 'boolean') { return String(value) === 'true' || String(value) === 'false'; } return false; } module.exports = attributeValidationError; },{"../../lib/braintree-error":66,"../shared/constants":57,"../shared/errors":58}],51:[function(require,module,exports){ 'use strict'; var constants = require('../shared/constants'); var useMin = require('../../lib/use-min'); module.exports = function composeUrl(assetsUrl, componentId, isDebug) { return assetsUrl + '/web/' + constants.VERSION + '/html/hosted-fields-frame' + useMin(isDebug) + '.html#' + componentId; }; },{"../../lib/use-min":89,"../shared/constants":57}],52:[function(require,module,exports){ (function (global){ 'use strict'; var allowedStyles = require('../shared/constants').allowedStyles; module.exports = function getStylesFromClass(cssClass) { var element = document.createElement('input'); var styles = {}; var computedStyles; if (cssClass[0] === '.') { cssClass = cssClass.substring(1); } element.className = cssClass; element.style.display = 'none !important'; element.style.position = 'fixed !important'; element.style.left = '-99999px !important'; element.style.top = '-99999px !important'; global.document.body.appendChild(element); computedStyles = global.getComputedStyle(element); allowedStyles.forEach(function (style) { var value = computedStyles[style]; if (value) { styles[style] = value; } }); global.document.body.removeChild(element); return styles; }; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"../shared/constants":57}],53:[function(require,module,exports){ 'use strict'; var assign = require('../../lib/assign').assign; var Destructor = require('../../lib/destructor'); var classlist = require('../../lib/classlist'); var iFramer = require('@braintree/iframer'); var Bus = require('../../lib/bus'); var BraintreeError = require('../../lib/braintree-error'); var composeUrl = require('./compose-url'); var getStylesFromClass = require('./get-styles-from-class'); var constants = require('../shared/constants'); var errors = require('../shared/errors'); var INTEGRATION_TIMEOUT_MS = require('../../lib/constants').INTEGRATION_TIMEOUT_MS; var uuid = require('../../lib/vendor/uuid'); var findParentTags = require('../shared/find-parent-tags'); var browserDetection = require('../shared/browser-detection'); var events = constants.events; var EventEmitter = require('../../lib/event-emitter'); var injectFrame = require('./inject-frame'); var analytics = require('../../lib/analytics'); var allowedFields = constants.allowedFields; var methods = require('../../lib/methods'); var convertMethodsToError = require('../../lib/convert-methods-to-error'); var sharedErrors = require('../../lib/errors'); var getCardTypes = require('../shared/get-card-types'); var attributeValidationError = require('./attribute-validation-error'); var Promise = require('../../lib/promise'); var wrapPromise = require('@braintree/wrap-promise'); /** * @typedef {object} HostedFields~tokenizePayload * @property {string} nonce The payment method nonce. * @property {object} details Additional account details. * @property {string} details.cardType Type of card, ex: Visa, MasterCard. * @property {string} details.lastFour Last four digits of card number. * @property {string} details.lastTwo Last two digits of card number. * @property {string} description A human-readable description. * @property {string} type The payment method type, always `CreditCard`. * @property {object} binData Information about the card based on the bin. * @property {string} binData.commercial Possible values: 'Yes', 'No', 'Unknown'. * @property {string} binData.countryOfIssuance The country of issuance. * @property {string} binData.debit Possible values: 'Yes', 'No', 'Unknown'. * @property {string} binData.durbinRegulated Possible values: 'Yes', 'No', 'Unknown'. * @property {string} binData.healthcare Possible values: 'Yes', 'No', 'Unknown'. * @property {string} binData.issuingBank The issuing bank. * @property {string} binData.payroll Possible values: 'Yes', 'No', 'Unknown'. * @property {string} binData.prepaid Possible values: 'Yes', 'No', 'Unknown'. * @property {string} binData.productId The product id. */ /** * @typedef {object} HostedFields~stateObject * @description The event payload sent from {@link HostedFields#on|on} or {@link HostedFields#getState|getState}. * @property {HostedFields~hostedFieldsCard[]} cards * This will return an array of potential {@link HostedFields~hostedFieldsCard|cards}. If the card type has been determined, the array will contain only one card. * Internally, Hosted Fields uses credit-card-type, * an open-source card detection library. * @property {string} emittedBy * The name of the field associated with an event. This will not be included if returned by {@link HostedFields#getState|getState}. It will be one of the following strings:
* - `"number"` * - `"cvv"` * - `"expirationDate"` * - `"expirationMonth"` * - `"expirationYear"` * - `"postalCode"` * @property {object} fields * @property {?HostedFields~hostedFieldsFieldData} fields.number {@link HostedFields~hostedFieldsFieldData|hostedFieldsFieldData} for the number field, if it is present. * @property {?HostedFields~hostedFieldsFieldData} fields.cvv {@link HostedFields~hostedFieldsFieldData|hostedFieldsFieldData} for the CVV field, if it is present. * @property {?HostedFields~hostedFieldsFieldData} fields.expirationDate {@link HostedFields~hostedFieldsFieldData|hostedFieldsFieldData} for the expiration date field, if it is present. * @property {?HostedFields~hostedFieldsFieldData} fields.expirationMonth {@link HostedFields~hostedFieldsFieldData|hostedFieldsFieldData} for the expiration month field, if it is present. * @property {?HostedFields~hostedFieldsFieldData} fields.expirationYear {@link HostedFields~hostedFieldsFieldData|hostedFieldsFieldData} for the expiration year field, if it is present. * @property {?HostedFields~hostedFieldsFieldData} fields.postalCode {@link HostedFields~hostedFieldsFieldData|hostedFieldsFieldData} for the postal code field, if it is present. */ /** * @typedef {object} HostedFields~hostedFieldsFieldData * @description Data about Hosted Fields fields, sent in {@link HostedFields~stateObject|stateObjects}. * @property {HTMLElement} container Reference to the container DOM element on your page associated with the current event. * @property {boolean} isFocused Whether or not the input is currently focused. * @property {boolean} isEmpty Whether or not the user has entered a value in the input. * @property {boolean} isPotentiallyValid * A determination based on the future validity of the input value. * This is helpful when a user is entering a card number and types "41". * While that value is not valid for submission, it is still possible for * it to become a fully qualified entry. However, if the user enters "4x" * it is clear that the card number can never become valid and isPotentiallyValid will * return false. * @property {boolean} isValid Whether or not the value of the associated input is fully qualified for submission. */ /** * @typedef {object} HostedFields~hostedFieldsCard * @description Information about the card type, sent in {@link HostedFields~stateObject|stateObjects}. * @property {string} type The code-friendly representation of the card type. It will be one of the following strings: * - `american-express` * - `diners-club` * - `discover` * - `jcb` * - `maestro` * - `master-card` * - `unionpay` * - `visa` * @property {string} niceType The pretty-printed card type. It will be one of the following strings: * - `American Express` * - `Diners Club` * - `Discover` * - `JCB` * - `Maestro` * - `MasterCard` * - `UnionPay` * - `Visa` * @property {object} code * This object contains data relevant to the security code requirements of the card brand. * For example, on a Visa card there will be a CVV of 3 digits, whereas an * American Express card requires a 4-digit CID. * @property {string} code.name "CVV" "CID" "CVC" * @property {number} code.size The expected length of the security code. Typically, this is 3 or 4. */ /** * @name HostedFields#on * @function * @param {string} event The name of the event to which you are subscribing. * @param {function} handler A callback to handle the event. * @description Subscribes a handler function to a named event. `event` should be {@link HostedFields#event:blur|blur}, {@link HostedFields#event:focus|focus}, {@link HostedFields#event:empty|empty}, {@link HostedFields#event:notEmpty|notEmpty}, {@link HostedFields#event:cardTypeChange|cardTypeChange}, or {@link HostedFields#event:validityChange|validityChange}. Events will emit a {@link HostedFields~stateObject|stateObject}. * @example * Listening to a Hosted Field event, in this case 'focus' * hostedFields.create({ ... }, function (createErr, hostedFieldsInstance) { * hostedFieldsInstance.on('focus', function (event) { * console.log(event.emittedBy, 'has been focused'); * }); * }); * @returns {void} */ /** * This event is emitted when the user requests submission of an input field, such as by pressing the Enter or Return key on their keyboard, or mobile equivalent. * @event HostedFields#inputSubmitRequest * @type {HostedFields~stateObject} * @example * Clicking a submit button upon hitting Enter (or equivalent) within a Hosted Field * var hostedFields = require('braintree-web/hosted-fields'); * var submitButton = document.querySelector('input[type="submit"]'); * * hostedFields.create({ ... }, function (createErr, hostedFieldsInstance) { * hostedFieldsInstance.on('inputSubmitRequest', function () { * // User requested submission, e.g. by pressing Enter or equivalent * submitButton.click(); * }); * }); */ /** * This event is emitted when a field transitions from having data to being empty. * @event HostedFields#empty * @type {HostedFields~stateObject} * @example * Listening to an empty event * hostedFields.create({ ... }, function (createErr, hostedFieldsInstance) { * hostedFieldsInstance.on('empty', function (event) { * console.log(event.emittedBy, 'is now empty'); * }); * }); */ /** * This event is emitted when a field transitions from being empty to having data. * @event HostedFields#notEmpty * @type {HostedFields~stateObject} * @example * Listening to an notEmpty event * hostedFields.create({ ... }, function (createErr, hostedFieldsInstance) { * hostedFieldsInstance.on('notEmpty', function (event) { * console.log(event.emittedBy, 'is now not empty'); * }); * }); */ /** * This event is emitted when a field loses focus. * @event HostedFields#blur * @type {HostedFields~stateObject} * @example * Listening to a blur event * hostedFields.create({ ... }, function (createErr, hostedFieldsInstance) { * hostedFieldsInstance.on('blur', function (event) { * console.log(event.emittedBy, 'lost focus'); * }); * }); */ /** * This event is emitted when a field gains focus. * @event HostedFields#focus * @type {HostedFields~stateObject} * @example * Listening to a focus event * hostedFields.create({ ... }, function (createErr, hostedFieldsInstance) { * hostedFieldsInstance.on('focus', function (event) { * console.log(event.emittedBy, 'gained focus'); * }); * }); */ /** * This event is emitted when activity within the number field has changed such that the possible card type has changed. * @event HostedFields#cardTypeChange * @type {HostedFields~stateObject} * @example * Listening to a cardTypeChange event * hostedFields.create({ ... }, function (createErr, hostedFieldsInstance) { * hostedFieldsInstance.on('cardTypeChange', function (event) { * if (event.cards.length === 1) { * console.log(event.cards[0].type); * } else { * console.log('Type of card not yet known'); * } * }); * }); */ /** * This event is emitted when the validity of a field has changed. Validity is represented in the {@link HostedFields~stateObject|stateObject} as two booleans: `isValid` and `isPotentiallyValid`. * @event HostedFields#validityChange * @type {HostedFields~stateObject} * @example * Listening to a validityChange event * hostedFields.create({ ... }, function (createErr, hostedFieldsInstance) { * hostedFieldsInstance.on('validityChange', function (event) { * var field = event.fields[event.emittedBy]; * * if (field.isValid) { * console.log(event.emittedBy, 'is fully valid'); * } else if (field.isPotentiallyValid) { * console.log(event.emittedBy, 'is potentially valid'); * } else { * console.log(event.emittedBy, 'is not valid'); * } * }); * }); */ function createInputEventHandler(fields) { return function (eventData) { var field; var merchantPayload = eventData.merchantPayload; var emittedBy = merchantPayload.emittedBy; var container = fields[emittedBy].containerElement; Object.keys(merchantPayload.fields).forEach(function (key) { merchantPayload.fields[key].container = fields[key].containerElement; }); field = merchantPayload.fields[emittedBy]; if (eventData.type === 'blur') { performBlurFixForIos(container); } classlist.toggle(container, constants.externalClasses.FOCUSED, field.isFocused); classlist.toggle(container, constants.externalClasses.VALID, field.isValid); classlist.toggle(container, constants.externalClasses.INVALID, !field.isPotentiallyValid); this._state = { // eslint-disable-line no-invalid-this cards: merchantPayload.cards, fields: merchantPayload.fields }; this._emit(eventData.type, merchantPayload); // eslint-disable-line no-invalid-this }; } // iOS Safari has a bug where inputs in iframes // will not dismiss the keyboard when they lose // focus. We create a hidden button input that we // can focus on and blur to force the keyboard to // dismiss. See #229 function performBlurFixForIos(container) { var hiddenInput; if (!browserDetection.isIos()) { return; } if (document.activeElement === document.body) { hiddenInput = container.querySelector('input'); if (!hiddenInput) { hiddenInput = document.createElement('input'); hiddenInput.type = 'button'; hiddenInput.style.height = '0px'; hiddenInput.style.width = '0px'; hiddenInput.style.opacity = '0'; hiddenInput.style.padding = '0'; hiddenInput.style.position = 'absolute'; hiddenInput.style.left = '-200%'; hiddenInput.style.top = '0px'; container.insertBefore(hiddenInput, container.firstChild); } hiddenInput.focus(); hiddenInput.blur(); } } /** * @class HostedFields * @param {object} options The Hosted Fields {@link module:braintree-web/hosted-fields.create create} options. * @description Do not use this constructor directly. Use {@link module:braintree-web/hosted-fields.create|braintree-web.hosted-fields.create} instead. * @classdesc This class represents a Hosted Fields component produced by {@link module:braintree-web/hosted-fields.create|braintree-web/hosted-fields.create}. Instances of this class have methods for interacting with the input fields within Hosted Fields' iframes. */ function HostedFields(options) { var failureTimeout, clientConfig, hostedFieldsUrl; var self = this; var fields = {}; var busOptions = assign({}, options); var fieldCount = 0; var componentId = uuid(); clientConfig = options.client.getConfiguration(); hostedFieldsUrl = composeUrl(clientConfig.gatewayConfiguration.assetsUrl, componentId, clientConfig.isDebug); if (!options.fields || Object.keys(options.fields).length === 0) { throw new BraintreeError({ type: sharedErrors.INSTANTIATION_OPTION_REQUIRED.type, code: sharedErrors.INSTANTIATION_OPTION_REQUIRED.code, message: 'options.fields is required when instantiating Hosted Fields.' }); } EventEmitter.call(this); this._injectedNodes = []; this._destructor = new Destructor(); this._fields = fields; this._state = { fields: {}, cards: getCardTypes('') }; this._bus = new Bus({ channel: componentId, merchantUrl: location.href }); this._destructor.registerFunctionForTeardown(function () { self._bus.teardown(); }); this._client = options.client; analytics.sendEvent(this._client, 'custom.hosted-fields.initialized'); Object.keys(options.fields).forEach(function (key) { var field, container, frame; if (!constants.allowedFields.hasOwnProperty(key)) { throw new BraintreeError({ type: errors.HOSTED_FIELDS_INVALID_FIELD_KEY.type, code: errors.HOSTED_FIELDS_INVALID_FIELD_KEY.code, message: '"' + key + '" is not a valid field.' }); } field = options.fields[key]; container = document.querySelector(field.selector); if (!container) { throw new BraintreeError({ type: errors.HOSTED_FIELDS_INVALID_FIELD_SELECTOR.type, code: errors.HOSTED_FIELDS_INVALID_FIELD_SELECTOR.code, message: errors.HOSTED_FIELDS_INVALID_FIELD_SELECTOR.message, details: { fieldSelector: field.selector, fieldKey: key } }); } else if (container.querySelector('iframe[name^="braintree-"]')) { throw new BraintreeError({ type: errors.HOSTED_FIELDS_FIELD_DUPLICATE_IFRAME.type, code: errors.HOSTED_FIELDS_FIELD_DUPLICATE_IFRAME.code, message: errors.HOSTED_FIELDS_FIELD_DUPLICATE_IFRAME.message, details: { fieldSelector: field.selector, fieldKey: key } }); } if (field.maxlength && typeof field.maxlength !== 'number') { throw new BraintreeError({ type: errors.HOSTED_FIELDS_FIELD_PROPERTY_INVALID.type, code: errors.HOSTED_FIELDS_FIELD_PROPERTY_INVALID.code, message: 'The value for maxlength must be a number.', details: { fieldKey: key } }); } if (field.minlength && typeof field.minlength !== 'number') { throw new BraintreeError({ type: errors.HOSTED_FIELDS_FIELD_PROPERTY_INVALID.type, code: errors.HOSTED_FIELDS_FIELD_PROPERTY_INVALID.code, message: 'The value for minlength must be a number.', details: { fieldKey: key } }); } frame = iFramer({ type: key, name: 'braintree-hosted-field-' + key, style: constants.defaultIFrameStyle, title: 'Secure Credit Card Frame - ' + constants.allowedFields[key].label }); this._injectedNodes = this._injectedNodes.concat(injectFrame(frame, container)); this._setupLabelFocus(key, container); fields[key] = { frameElement: frame, containerElement: container }; fieldCount++; this._state.fields[key] = { isEmpty: true, isValid: false, isPotentiallyValid: true, isFocused: false, container: container }; setTimeout(function () { // Edge has an intermittent issue where // the iframes load, but the JavaScript // can't message out to the parent page. // We can fix this by setting the src // to about:blank first followed by // the actual source. Both instances // of setting the src need to be in a // setTimeout to work. if (browserDetection.isIE() || browserDetection.isEdge()) { frame.src = 'about:blank'; setTimeout(function () { frame.src = hostedFieldsUrl; }, 0); } else { frame.src = hostedFieldsUrl; } }, 0); }.bind(this)); // TODO rejecting unsupported cards should be the default behavior after the next major revision if (options.fields.number && options.fields.number.rejectUnsupportedCards) { busOptions.supportedCardTypes = clientConfig.gatewayConfiguration.creditCards.supportedCardTypes; } if (busOptions.styles) { Object.keys(busOptions.styles).forEach(function (selector) { var className = busOptions.styles[selector]; if (typeof className === 'string') { busOptions.styles[selector] = getStylesFromClass(className); } }); } failureTimeout = setTimeout(function () { analytics.sendEvent(self._client, 'custom.hosted-fields.load.timed-out'); self._emit('timeout'); }, INTEGRATION_TIMEOUT_MS); this._bus.on(events.FRAME_READY, function (reply) { fieldCount--; if (fieldCount === 0) { clearTimeout(failureTimeout); reply(busOptions); self._emit('ready'); } }); this._bus.on( events.INPUT_EVENT, createInputEventHandler(fields).bind(this) ); this._destructor.registerFunctionForTeardown(function () { var j, node, parent; for (j = 0; j < self._injectedNodes.length; j++) { node = self._injectedNodes[j]; parent = node.parentNode; parent.removeChild(node); classlist.remove( parent, constants.externalClasses.FOCUSED, constants.externalClasses.INVALID, constants.externalClasses.VALID ); } }); this._destructor.registerFunctionForTeardown(function () { var methodNames = methods(HostedFields.prototype).concat(methods(EventEmitter.prototype)); convertMethodsToError(self, methodNames); }); } HostedFields.prototype = Object.create(EventEmitter.prototype, { constructor: HostedFields }); HostedFields.prototype._setupLabelFocus = function (type, container) { var labels, i; var shouldSkipLabelFocus = browserDetection.isIos(); var bus = this._bus; if (shouldSkipLabelFocus) { return; } if (container.id == null) { return; } function triggerFocus() { bus.emit(events.TRIGGER_INPUT_FOCUS, type); } labels = Array.prototype.slice.call(document.querySelectorAll('label[for="' + container.id + '"]')); labels = labels.concat(findParentTags(container, 'label')); for (i = 0; i < labels.length; i++) { labels[i].addEventListener('click', triggerFocus, false); } this._destructor.registerFunctionForTeardown(function () { for (i = 0; i < labels.length; i++) { labels[i].removeEventListener('click', triggerFocus, false); } }); }; HostedFields.prototype._attachInvalidFieldContainersToError = function (err) { if (!(err.details && err.details.invalidFieldKeys && err.details.invalidFieldKeys.length > 0)) { return; } err.details.invalidFields = {}; err.details.invalidFieldKeys.forEach(function (field) { err.details.invalidFields[field] = this._fields[field].containerElement; }.bind(this)); }; /** * Cleanly remove anything set up by {@link module:braintree-web/hosted-fields.create|create}. * @public * @param {callback} [callback] Called on completion, containing an error if one occurred. No data is returned if teardown completes successfully. If no callback is provided, `teardown` returns a promise. * @example * hostedFieldsInstance.teardown(function (teardownErr) { * if (teardownErr) { * console.error('Could not tear down Hosted Fields!'); * } else { * console.info('Hosted Fields has been torn down!'); * } * }); * @returns {Promise|void} Returns a promise if no callback is provided. */ HostedFields.prototype.teardown = function () { var self = this; return new Promise(function (resolve, reject) { self._destructor.teardown(function (err) { analytics.sendEvent(self._client, 'custom.hosted-fields.teardown-completed'); if (err) { reject(err); } else { resolve(); } }); }); }; /** * Tokenizes fields and returns a nonce payload. * @public * @param {object} [options] All tokenization options for the Hosted Fields component. * @param {boolean} [options.vault=false] When true, will vault the tokenized card. Cards will only be vaulted when using a client created with a client token that includes a customer ID. * @param {string} [options.cardholderName] When supplied, the cardholder name to be tokenized with the contents of the fields. * @param {string} [options.billingAddress.postalCode] When supplied, this postal code will be tokenized along with the contents of the fields. If a postal code is provided as part of the Hosted Fields configuration, the value of the field will be tokenized and this value will be ignored. * @param {string} [options.billingAddress.firstName] When supplied, this customer first name will be tokenized along with the contents of the fields. * @param {string} [options.billingAddress.lastName] When supplied, this customer last name will be tokenized along with the contents of the fields. * @param {string} [options.billingAddress.company] When supplied, this company name will be tokenized along with the contents of the fields. * @param {string} [options.billingAddress.streetAddress] When supplied, this street address will be tokenized along with the contents of the fields. * @param {string} [options.billingAddress.extendedAddress] When supplied, this extended address will be tokenized along with the contents of the fields. * @param {string} [options.billingAddress.locality] When supplied, this locality (the city) will be tokenized along with the contents of the fields. * @param {string} [options.billingAddress.region] When supplied, this region (the state) will be tokenized along with the contents of the fields. * @param {string} [options.billingAddress.countryCodeNumeric] When supplied, this numeric country code will be tokenized along with the contents of the fields. * @param {string} [options.billingAddress.countryCodeAlpha2] When supplied, this alpha 2 representation of a country will be tokenized along with the contents of the fields. * @param {string} [options.billingAddress.countryCodeAlpha3] When supplied, this alpha 3 representation of a country will be tokenized along with the contents of the fields. * @param {string} [options.billingAddress.countryName] When supplied, this country name will be tokenized along with the contents of the fields. * * @param {callback} [callback] The second argument, data, is a {@link HostedFields~tokenizePayload|tokenizePayload}. If no callback is provided, `tokenize` returns a function that resolves with a {@link HostedFields~tokenizePayload|tokenizePayload}. * @example Tokenize a card * hostedFieldsInstance.tokenize(function (tokenizeErr, payload) { * if (tokenizeErr) { * switch (tokenizeErr.code) { * case 'HOSTED_FIELDS_FIELDS_EMPTY': * // occurs when none of the fields are filled in * console.error('All fields are empty! Please fill out the form.'); * break; * case 'HOSTED_FIELDS_FIELDS_INVALID': * // occurs when certain fields do not pass client side validation * console.error('Some fields are invalid:', tokenizeErr.details.invalidFieldKeys); * * // you can also programtically access the field containers for the invalid fields * tokenizeErr.details.invalidFields.forEach(function (fieldContainer) { * fieldContainer.className = 'invalid'; * }); * break; * case 'HOSTED_FIELDS_TOKENIZATION_FAIL_ON_DUPLICATE': * // occurs when: * // * the client token used for client authorization was generated * // with a customer ID and the fail on duplicate payment method * // option is set to true * // * the card being tokenized has previously been vaulted (with any customer) * // See: https://developers.braintreepayments.com/reference/request/client-token/generate/#options.fail_on_duplicate_payment_method * console.error('This payment method already exists in your vault.'); * break; * case 'HOSTED_FIELDS_TOKENIZATION_CVV_VERIFICATION_FAILED': * // occurs when: * // * the client token used for client authorization was generated * // with a customer ID and the verify card option is set to true * // and you have credit card verification turned on in the Braintree * // control panel * // * the cvv does not pass verfication (https://developers.braintreepayments.com/reference/general/testing/#avs-and-cvv/cid-responses) * // See: https://developers.braintreepayments.com/reference/request/client-token/generate/#options.verify_card * console.error('CVV did not pass verification'); * break; * case 'HOSTED_FIELDS_FAILED_TOKENIZATION': * // occurs for any other tokenization error on the server * console.error('Tokenization failed server side. Is the card valid?'); * break; * case 'HOSTED_FIELDS_TOKENIZATION_NETWORK_ERROR': * // occurs when the Braintree gateway cannot be contacted * console.error('Network error occurred when tokenizing.'); * break; * default: * console.error('Something bad happened!', tokenizeErr); * } * } else { * console.log('Got nonce:', payload.nonce); * } * }); * @example Tokenize and vault a card * hostedFieldsInstance.tokenize({ * vault: true * }, function (tokenizeErr, payload) { * if (tokenizeErr) { * console.error(tokenizeErr); * } else { * console.log('Got nonce:', payload.nonce); * } * }); * @example Tokenize a card with cardholder name * hostedFieldsInstance.tokenize({ * cardholderName: 'First Last' * }, function (tokenizeErr, payload) { * if (tokenizeErr) { * console.error(tokenizeErr); * } else { * console.log('Got nonce:', payload.nonce); * } * }); * @example Tokenize a card with the postal code option * hostedFieldsInstance.tokenize({ * billingAddress: { * postalCode: '11111' * } * }, function (tokenizeErr, payload) { * if (tokenizeErr) { * console.error(tokenizeErr); * } else { * console.log('Got nonce:', payload.nonce); * } * }); * @example Tokenize a card with additional billing address options * hostedFieldsInstance.tokenize({ * billingAddress: { * firstName: 'First', * lastName: 'Last', * company: 'Company', * streetAddress: '123 Street', * extendedAddress: 'Unit 1', * // passing just one of the country options is sufficient to * // associate the card details with a particular country * // valid country names and codes can be found here: * // https://developers.braintreepayments.com/reference/general/countries/ruby#list-of-countries * countryName: 'United States', * countryCodeAlpha2: 'US', * countryCodeAlpha3: 'USA', * countryCodeNumeric: '840' * } * }, function (tokenizeErr, payload) { * if (tokenizeErr) { * console.error(tokenizeErr); * } else { * console.log('Got nonce:', payload.nonce); * } * }); * @returns {Promise|void} Returns a promise if no callback is provided. */ HostedFields.prototype.tokenize = function (options) { var self = this; if (!options) { options = {}; } return new Promise(function (resolve, reject) { self._bus.emit(events.TOKENIZATION_REQUEST, options, function (response) { var err = response[0]; var payload = response[1]; if (err) { self._attachInvalidFieldContainersToError(err); reject(new BraintreeError(err)); } else { resolve(payload); } }); }); }; /** * Add a class to a {@link module:braintree-web/hosted-fields~field field}. Useful for updating field styles when events occur elsewhere in your checkout. * @public * @param {string} field The field you wish to add a class to. Must be a valid {@link module:braintree-web/hosted-fields~fieldOptions fieldOption}. * @param {string} classname The class to be added. * @param {callback} [callback] Callback executed on completion, containing an error if one occurred. No data is returned if the class is added successfully. * * @example * hostedFieldsInstance.addClass('number', 'custom-class', function (addClassErr) { * if (addClassErr) { * console.error(addClassErr); * } * }); * @returns {Promise|void} Returns a promise if no callback is provided. */ HostedFields.prototype.addClass = function (field, classname) { var err; if (!allowedFields.hasOwnProperty(field)) { err = new BraintreeError({ type: errors.HOSTED_FIELDS_FIELD_INVALID.type, code: errors.HOSTED_FIELDS_FIELD_INVALID.code, message: '"' + field + '" is not a valid field. You must use a valid field option when adding a class.' }); } else if (!this._fields.hasOwnProperty(field)) { err = new BraintreeError({ type: errors.HOSTED_FIELDS_FIELD_NOT_PRESENT.type, code: errors.HOSTED_FIELDS_FIELD_NOT_PRESENT.code, message: 'Cannot add class to "' + field + '" field because it is not part of the current Hosted Fields options.' }); } else { this._bus.emit(events.ADD_CLASS, field, classname); } if (err) { return Promise.reject(err); } return Promise.resolve(); }; /** * Removes a class to a {@link module:braintree-web/hosted-fields~field field}. Useful for updating field styles when events occur elsewhere in your checkout. * @public * @param {string} field The field you wish to remove a class from. Must be a valid {@link module:braintree-web/hosted-fields~fieldOptions fieldOption}. * @param {string} classname The class to be removed. * @param {callback} [callback] Callback executed on completion, containing an error if one occurred. No data is returned if the class is removed successfully. * * @example * hostedFieldsInstance.addClass('number', 'custom-class', function (addClassErr) { * if (addClassErr) { * console.error(addClassErr); * return; * } * * // some time later... * hostedFieldsInstance.removeClass('number', 'custom-class'); * }); * @returns {Promise|void} Returns a promise if no callback is provided. */ HostedFields.prototype.removeClass = function (field, classname) { var err; if (!allowedFields.hasOwnProperty(field)) { err = new BraintreeError({ type: errors.HOSTED_FIELDS_FIELD_INVALID.type, code: errors.HOSTED_FIELDS_FIELD_INVALID.code, message: '"' + field + '" is not a valid field. You must use a valid field option when removing a class.' }); } else if (!this._fields.hasOwnProperty(field)) { err = new BraintreeError({ type: errors.HOSTED_FIELDS_FIELD_NOT_PRESENT.type, code: errors.HOSTED_FIELDS_FIELD_NOT_PRESENT.code, message: 'Cannot remove class from "' + field + '" field because it is not part of the current Hosted Fields options.' }); } else { this._bus.emit(events.REMOVE_CLASS, field, classname); } if (err) { return Promise.reject(err); } return Promise.resolve(); }; /** * Sets an attribute of a {@link module:braintree-web/hosted-fields~field field}. * Supported attributes are `aria-invalid`, `aria-required`, `disabled`, and `placeholder`. * * @public * @param {object} options The options for the attribute you wish to set. * @param {string} options.field The field to which you wish to add an attribute. Must be a valid {@link module:braintree-web/hosted-fields~fieldOptions fieldOption}. * @param {string} options.attribute The name of the attribute you wish to add to the field. * @param {string} options.value The value for the attribute. * @param {callback} [callback] Callback executed on completion, containing an error if one occurred. No data is returned if the attribute is set successfully. * * @example Set the placeholder attribute of a field * hostedFieldsInstance.setAttribute({ * field: 'number', * attribute: 'placeholder', * value: '1111 1111 1111 1111' * }, function (attributeErr) { * if (attributeErr) { * console.error(attributeErr); * } * }); * * @example Set the aria-required attribute of a field * hostedFieldsInstance.setAttribute({ * field: 'number', * attribute: 'aria-required', * value: true * }, function (attributeErr) { * if (attributeErr) { * console.error(attributeErr); * } * }); * * @returns {Promise|void} Returns a promise if no callback is provided. */ HostedFields.prototype.setAttribute = function (options) { var attributeErr, err; if (!allowedFields.hasOwnProperty(options.field)) { err = new BraintreeError({ type: errors.HOSTED_FIELDS_FIELD_INVALID.type, code: errors.HOSTED_FIELDS_FIELD_INVALID.code, message: '"' + options.field + '" is not a valid field. You must use a valid field option when setting an attribute.' }); } else if (!this._fields.hasOwnProperty(options.field)) { err = new BraintreeError({ type: errors.HOSTED_FIELDS_FIELD_NOT_PRESENT.type, code: errors.HOSTED_FIELDS_FIELD_NOT_PRESENT.code, message: 'Cannot set attribute for "' + options.field + '" field because it is not part of the current Hosted Fields options.' }); } else { attributeErr = attributeValidationError(options.attribute, options.value); if (attributeErr) { err = attributeErr; } else { this._bus.emit(events.SET_ATTRIBUTE, options.field, options.attribute, options.value); } } if (err) { return Promise.reject(err); } return Promise.resolve(); }; /** * Sets a visually hidden message (for screenreaders) on a {@link module:braintree-web/hosted-fields~field field}. * * @public * @param {object} options The options for the attribute you wish to set. * @param {string} options.field The field to which you wish to add an attribute. Must be a valid {@link module:braintree-web/hosted-fields~field field}. * @param {string} options.message The message to set. * * @example Set an error message on a field * hostedFieldsInstance.setMessage({ * field: 'number', * message: 'Invalid card number' * }); * * @example Remove the message on a field * hostedFieldsInstance.setMessage({ * field: 'number', * message: '' * }); * * @returns {void} */ HostedFields.prototype.setMessage = function (options) { this._bus.emit(events.SET_MESSAGE, options.field, options.message); }; /** * Removes a supported attribute from a {@link module:braintree-web/hosted-fields~field field}. * * @public * @param {object} options The options for the attribute you wish to remove. * @param {string} options.field The field from which you wish to remove an attribute. Must be a valid {@link module:braintree-web/hosted-fields~fieldOptions fieldOption}. * @param {string} options.attribute The name of the attribute you wish to remove from the field. * @param {callback} [callback] Callback executed on completion, containing an error if one occurred. No data is returned if the attribute is removed successfully. * * @example Remove the placeholder attribute of a field * hostedFieldsInstance.removeAttribute({ * field: 'number', * attribute: 'placeholder' * }, function (attributeErr) { * if (attributeErr) { * console.error(attributeErr); * } * }); * * @returns {Promise|void} Returns a promise if no callback is provided. */ HostedFields.prototype.removeAttribute = function (options) { var attributeErr, err; if (!allowedFields.hasOwnProperty(options.field)) { err = new BraintreeError({ type: errors.HOSTED_FIELDS_FIELD_INVALID.type, code: errors.HOSTED_FIELDS_FIELD_INVALID.code, message: '"' + options.field + '" is not a valid field. You must use a valid field option when removing an attribute.' }); } else if (!this._fields.hasOwnProperty(options.field)) { err = new BraintreeError({ type: errors.HOSTED_FIELDS_FIELD_NOT_PRESENT.type, code: errors.HOSTED_FIELDS_FIELD_NOT_PRESENT.code, message: 'Cannot remove attribute for "' + options.field + '" field because it is not part of the current Hosted Fields options.' }); } else { attributeErr = attributeValidationError(options.attribute); if (attributeErr) { err = attributeErr; } else { this._bus.emit(events.REMOVE_ATTRIBUTE, options.field, options.attribute); } } if (err) { return Promise.reject(err); } return Promise.resolve(); }; /** * @deprecated since version 3.8.0. Use {@link HostedFields#setAttribute|setAttribute} instead. * * @public * @param {string} field The field whose placeholder you wish to change. Must be a valid {@link module:braintree-web/hosted-fields~fieldOptions fieldOption}. * @param {string} placeholder Will be used as the `placeholder` attribute of the input. * @param {callback} [callback] Callback executed on completion, containing an error if one occurred. No data is returned if the placeholder updated successfully. * * @returns {Promise|void} Returns a promise if no callback is provided. */ HostedFields.prototype.setPlaceholder = function (field, placeholder) { return this.setAttribute({ field: field, attribute: 'placeholder', value: placeholder }); }; /** * Clear the value of a {@link module:braintree-web/hosted-fields~field field}. * @public * @param {string} field The field you wish to clear. Must be a valid {@link module:braintree-web/hosted-fields~fieldOptions fieldOption}. * @param {callback} [callback] Callback executed on completion, containing an error if one occurred. No data is returned if the field cleared successfully. * @returns {Promise|void} Returns a promise if no callback is provided. * @example * hostedFieldsInstance.clear('number', function (clearErr) { * if (clearErr) { * console.error(clearErr); * } * }); * * @example Clear several fields * hostedFieldsInstance.clear('number'); * hostedFieldsInstance.clear('cvv'); * hostedFieldsInstance.clear('expirationDate'); */ HostedFields.prototype.clear = function (field) { var err; if (!allowedFields.hasOwnProperty(field)) { err = new BraintreeError({ type: errors.HOSTED_FIELDS_FIELD_INVALID.type, code: errors.HOSTED_FIELDS_FIELD_INVALID.code, message: '"' + field + '" is not a valid field. You must use a valid field option when clearing a field.' }); } else if (!this._fields.hasOwnProperty(field)) { err = new BraintreeError({ type: errors.HOSTED_FIELDS_FIELD_NOT_PRESENT.type, code: errors.HOSTED_FIELDS_FIELD_NOT_PRESENT.code, message: 'Cannot clear "' + field + '" field because it is not part of the current Hosted Fields options.' }); } else { this._bus.emit(events.CLEAR_FIELD, field); } if (err) { return Promise.reject(err); } return Promise.resolve(); }; /** * Programmatically focus a {@link module:braintree-web/hosted-fields~field field}. * @public * @param {string} field The field you want to focus. Must be a valid {@link module:braintree-web/hosted-fields~fieldOptions fieldOption}. * @param {callback} [callback] Callback executed on completion, containing an error if one occurred. No data is returned if the field focused successfully. * @returns {void} * @example * hostedFieldsInstance.focus('number', function (focusErr) { * if (focusErr) { * console.error(focusErr); * } * }); * @example Using an event listener * myElement.addEventListener('click', function (e) { * // In Firefox, the focus method can be suppressed * // if the element has a tabindex property or the element * // is an anchor link with an href property. * // In Mobile Safari, the focus method is unable to * // programatically open the keyboard, as only * // touch events are allowed to do so. * e.preventDefault(); * hostedFieldsInstance.focus('number'); * }); */ HostedFields.prototype.focus = function (field) { var err; if (!allowedFields.hasOwnProperty(field)) { err = new BraintreeError({ type: errors.HOSTED_FIELDS_FIELD_INVALID.type, code: errors.HOSTED_FIELDS_FIELD_INVALID.code, message: '"' + field + '" is not a valid field. You must use a valid field option when focusing a field.' }); } else if (!this._fields.hasOwnProperty(field)) { err = new BraintreeError({ type: errors.HOSTED_FIELDS_FIELD_NOT_PRESENT.type, code: errors.HOSTED_FIELDS_FIELD_NOT_PRESENT.code, message: 'Cannot focus "' + field + '" field because it is not part of the current Hosted Fields options.' }); } else { this._bus.emit(events.TRIGGER_INPUT_FOCUS, field); } if (err) { return Promise.reject(err); } return Promise.resolve(); }; /** * Returns an {@link HostedFields~stateObject|object} that includes the state of all fields and possible card types. * @public * @returns {object} {@link HostedFields~stateObject|stateObject} * @example Check if all fields are valid * var state = hostedFieldsInstance.getState(); * * var formValid = Object.keys(state.fields).every(function (key) { * return state.fields[key].isValid; * }); */ HostedFields.prototype.getState = function () { return this._state; }; module.exports = wrapPromise.wrapPrototype(HostedFields); },{"../../lib/analytics":62,"../../lib/assign":63,"../../lib/braintree-error":66,"../../lib/bus":69,"../../lib/classlist":70,"../../lib/constants":71,"../../lib/convert-methods-to-error":72,"../../lib/destructor":76,"../../lib/errors":78,"../../lib/event-emitter":79,"../../lib/methods":85,"../../lib/promise":87,"../../lib/vendor/uuid":91,"../shared/browser-detection":56,"../shared/constants":57,"../shared/errors":58,"../shared/find-parent-tags":59,"../shared/get-card-types":60,"./attribute-validation-error":50,"./compose-url":51,"./get-styles-from-class":52,"./inject-frame":54,"@braintree/iframer":14,"@braintree/wrap-promise":21}],54:[function(require,module,exports){ 'use strict'; module.exports = function injectFrame(frame, container) { var clearboth = document.createElement('div'); var fragment = document.createDocumentFragment(); clearboth.style.clear = 'both'; fragment.appendChild(frame); fragment.appendChild(clearboth); container.appendChild(fragment); return [frame, clearboth]; }; },{}],55:[function(require,module,exports){ 'use strict'; /** @module braintree-web/hosted-fields */ var HostedFields = require('./external/hosted-fields'); var basicComponentVerification = require('../lib/basic-component-verification'); var errors = require('./shared/errors'); var supportsInputFormatting = require('restricted-input/supports-input-formatting'); var wrapPromise = require('@braintree/wrap-promise'); var BraintreeError = require('../lib/braintree-error'); var Promise = require('../lib/promise'); var VERSION = "3.37.0"; /** * Fields used in {@link module:braintree-web/hosted-fields~fieldOptions fields options} * @typedef {object} field * @property {string} selector A CSS selector to find the container where the hosted field will be inserted. * @property {string} [placeholder] Will be used as the `placeholder` attribute of the input. If `placeholder` is not natively supported by the browser, it will be polyfilled. * @property {string} [type] Will be used as the `type` attribute of the input. To mask `cvv` input, for instance, `type: "password"` can be used. * @property {boolean} [formatInput=true] Enable or disable automatic formatting on this field. * @property {object|boolean} [maskInput=false] Enable or disable input masking when input is not focused. If set to `true` instead of an object, the defaults for the `maskInput` parameters will be used. * @property {string} [maskInput.character=•] The character to use when masking the input. The default character ('•') uses a unicode symbol, so the webpage must support UTF-8 characters when using the default. * @property {Boolean} [maskInput.showLastFour=false] Only applicable for the credit card field. Whether or not to show the last 4 digits of the card when masking. * @property {object|boolean} [select] If truthy, this field becomes a `\n \n
\n
\n \n \n \n
\n
\n \n \n
\n \n
\n \n
\n
\n\n
\n
\n \n
\n
\n \n\n
\n \n
\n
\n\n
\n \n
\n
\n
\n \n \n
\n
\n \n \n \n
\n
\n
\n \n \n\n
\n
{{otherWaysToPay}}
\n
\n\n
\n {{chooseAnotherWayToPay}}\n
\n\n
\n"; var svgHTML = "\n \n \n Visa\n \n \n \n \n\n \n MasterCard\n \n \n \n \n \n \n\n \n Union Pay\n \n \n \n \n \n \n \n \n \n \n\n \n American Express\n \n \n \n \n\n \n JCB\n \n \n \n \n \n\n \n Discover\n \n \n \n \n \n\n \n Diners Club\n \n \n \n \n \n\n \n Maestro\n \n \n \n \n \n \n\n \n PayPal Logo\n \n \n \n \n \n \n\n \n PayPal Credit Logo\n \n \n \n \n \n \n \n \n\n \n Generic Card\n \n \n \n \n \n \n \n\n \n CVV Back\n \n \n \n \n \n \n \n\n \n CVV Front\n \n \n \n \n \n \n \n \n\n \n Check\n \n \n\n \n X\n \n \n\n \n Lock Loader\n \n \n\n \n \n \n \n\n \n Apple Pay Logo\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n GooglePay_AcceptanceMark_RGB_60x24pt\n \n \n \n \n \n \n \n \n\n \n Venmo\n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n\n"; var UPDATABLE_CONFIGURATION_OPTIONS = [ paymentOptionIDs.paypal, paymentOptionIDs.paypalCredit, paymentOptionIDs.applePay, paymentOptionIDs.googlePay, 'threeDSecure' ]; var UPDATABLE_CONFIGURATION_OPTIONS_THAT_REQUIRE_UNVAULTED_PAYMENT_METHODS_TO_BE_REMOVED = [ paymentOptionIDs.paypal, paymentOptionIDs.paypalCredit, paymentOptionIDs.applePay, paymentOptionIDs.googlePay ]; var VERSION = "1.13.0"; /** * @typedef {object} Dropin~cardPaymentMethodPayload * @property {string} nonce The payment method nonce, used by your server to charge the card. * @property {object} details Additional account details. * @property {string} details.cardType Type of card, e.g. Visa, Mastercard. * @property {string} details.lastTwo Last two digits of card number. * @property {string} description A human-readable description. * @property {string} type The payment method type, always `CreditCard` when the method requested is a card. * @property {object} binData Information about the card based on the bin. Documented {@link Dropin~binData|here}. * @property {?string} deviceData If data collector is configured, the device data property to be used when making a transaction. * @property {?boolean} liablityShifted If 3D Secure is configured, whether or not liability did shift. * @property {?boolean} liablityShiftPossible If 3D Secure is configured, whether or not liability shift is possible. */ /** * @typedef {object} Dropin~paypalPaymentMethodPayload * @property {string} nonce The payment method nonce, used by your server to charge the PayPal account. * @property {object} details Additional PayPal account details. See a full list of details in the [PayPal client reference](http://braintree.github.io/braintree-web/{@pkg bt-web-version}/PayPalCheckout.html#~tokenizePayload). * @property {string} type The payment method type, always `PayPalAccount` when the method requested is a PayPal account. * @property {?string} deviceData If data collector is configured, the device data property to be used when making a transaction. */ /** * @typedef {object} Dropin~applePayPaymentMethodPayload * @property {string} nonce The payment method nonce, used by your server to charge the Apple Pay provided card. * @property {string} details.cardType Type of card, ex: Visa, Mastercard. * @property {string} details.cardHolderName The name of the card holder. * @property {string} details.dpanLastTwo Last two digits of card number. * @property {string} description A human-readable description. * @property {string} type The payment method type, always `ApplePayCard` when the method requested is an Apple Pay provided card. * @property {object} binData Information about the card based on the bin. Documented {@link Dropin~binData|here}. * @property {?string} deviceData If data collector is configured, the device data property to be used when making a transaction. */ /** * @typedef {object} Dropin~venmoPaymentMethodPayload * @property {string} nonce The payment method nonce, used by your server to charge the Venmo account. * @property {string} details.username The Venmo username. * @property {string} type The payment method type, always `VenmoAccount` when the method requested is a Venmo account. * @property {?string} deviceData If data collector is configured, the device data property to be used when making a transaction. */ /** * @typedef {object} Dropin~googlePayPaymentMethodPayload * @property {string} nonce The payment method nonce, used by your server to charge the Google Pay card. * @property {string} details.cardType Type of card, ex: Visa, Mastercard. * @property {string} details.lastFour The last 4 digits of the card. * @property {string} details.lastTwo The last 2 digits of the card. * @param {external:GooglePayPaymentData} details.rawPaymentData The raw response back from the Google Pay flow, which includes shipping address, phone and email if passed in as required parameters. * @property {string} type The payment method type, always `AndroidPayCard` when the method requested is a Google Pay Card. * @property {object} binData Information about the card based on the bin. Documented {@link Dropin~binData|here}. * @property {?string} deviceData If data collector is configured, the device data property to be used when making a transaction. */ /** * @typedef {object} GooglePayPaymentData A [Google Pay Payment Data object](https://developers.google.com/pay/api/web/object-reference#PaymentData). * @external GooglePayPaymentData * @see {@link https://developers.google.com/pay/api/web/object-reference#PaymentData PaymentData} */ /** * @typedef {object} Dropin~binData Information about the card based on the bin. * @property {string} commercial Possible values: 'Yes', 'No', 'Unknown'. * @property {string} countryOfIssuance The country of issuance. * @property {string} debit Possible values: 'Yes', 'No', 'Unknown'. * @property {string} durbinRegulated Possible values: 'Yes', 'No', 'Unknown'. * @property {string} healthcare Possible values: 'Yes', 'No', 'Unknown'. * @property {string} issuingBank The issuing bank. * @property {string} payroll Possible values: 'Yes', 'No', 'Unknown'. * @property {string} prepaid Possible values: 'Yes', 'No', 'Unknown'. * @property {string} productId The product id. */ /** * @name Dropin#on * @function * @param {string} event The name of the event to which you are subscribing. * @param {function} handler A callback to handle the event. * @description Subscribes a handler function to a named event. `event` should be one of the following: * * [`paymentMethodRequestable`](#event:paymentMethodRequestable) * * [`noPaymentMethodRequestable`](#event:noPaymentMethodRequestable) * * [`paymentOptionSelected`](#event:paymentOptionSelected) * @returns {void} * @example * Dynamically enable or disable your submit button based on whether or not the payment method is requestable * var submitButton = document.querySelector('#submit-button'); * * braintree.dropin.create({ * authorization: 'CLIENT_AUTHORIZATION', * container: '#dropin-container' * }, function (err, dropinInstance) { * submitButton.addEventListener('click', function () { * dropinInstance.requestPaymentMethod(function (err, payload) { * // Send payload.nonce to your server. * }); * }); * * if (dropinInstance.isPaymentMethodRequestable()) { * // This will be true if you generated the client token * // with a customer ID and there is a saved payment method * // available to tokenize with that customer. * submitButton.removeAttribute('disabled'); * } * * dropinInstance.on('paymentMethodRequestable', function (event) { * console.log(event.type); // The type of Payment Method, e.g 'CreditCard', 'PayPalAccount'. * console.log(event.paymentMethodIsSelected); // true if a customer has selected a payment method when paymentMethodRequestable fires * * submitButton.removeAttribute('disabled'); * }); * * dropinInstance.on('noPaymentMethodRequestable', function () { * submitButton.setAttribute('disabled', true); * }); * }); * @example * Automatically submit nonce to server as soon as it becomes available * var submitButton = document.querySelector('#submit-button'); * * braintree.dropin.create({ * authorization: 'CLIENT_AUTHORIZATION', * container: '#dropin-container' * }, function (err, dropinInstance) { * function sendNonceToServer() { * dropinInstance.requestPaymentMethod(function (err, payload) { * if (err) { * // handle errors * } * * // send payload.nonce to your server * }); * } * * // allows us to still request the payment method manually, such as * // when filling out a credit card form * submitButton.addEventListener('click', sendNonceToServer); * * dropinInstance.on('paymentMethodRequestable', function (event) { * // if the nonce is already available (via PayPal authentication * // or by using a stored payment method), we can request the * // nonce right away. Otherwise, we wait for the customer to * // request the nonce by pressing the submit button once they * // are finished entering their credit card details * if (event.paymentMethodIsSelected) { * sendNonceToServer(); * } * }); * }); */ /** * This event is emitted when the payment method available in Drop-in changes. This includes when the state of Drop-in transitions from having no payment method available to having a payment method available and when the payment method available changes. This event is not fired if there is no payment method available on initialization. To check if there is a payment method requestable on initialization, use {@link Dropin#isPaymentMethodRequestable|`isPaymentMethodRequestable`}. * @event Dropin#paymentMethodRequestable * @type {Dropin~paymentMethodRequestablePayload} */ /** * @typedef {object} Dropin~paymentMethodRequestablePayload * @description The event payload sent from {@link Dropin#on|`on`} with the {@link Dropin#event:paymentMethodRequestable|`paymentMethodRequestable`} event. * @property {string} type The type of payment method that is requestable. Either `CreditCard` or `PayPalAccount`. * @property {boolean} paymentMethodIsSelected A property to determine if a payment method is currently selected when the payment method becomes requestable. * * This will be `true` any time a payment method is visably selected in the Drop-in UI, such as when PayPal authentication completes or a stored payment method is selected. * * This will be `false` when {@link Dropin#requestPaymentMethod|`requestPaymentMethod`} can be called, but a payment method is not currently selected. For instance, when a card form has been filled in with valid values, but has not been submitted to be converted into a payment method nonce. */ /** * This event is emitted when there is no payment method available in Drop-in. This event is not fired if there is no payment method available on initialization. To check if there is a payment method requestable on initialization, use {@link Dropin#isPaymentMethodRequestable|`isPaymentMethodRequestable`}. No payload is available in the callback for this event. * @event Dropin#noPaymentMethodRequestable */ /** * This event is emitted when the customer selects a new payment option type (e.g. PayPal, PayPal Credit, credit card). This event is not emitted when the user changes between existing saved payment methods. Only relevant when accepting multiple payment options. * @event Dropin#paymentOptionSelected * @type {Dropin~paymentOptionSelectedPayload} */ /** * @typedef {object} Dropin~paymentOptionSelectedPayload * @description The event payload sent from {@link Dropin#on|`on`} with the {@link Dropin#event:paymentOptionSelected|`paymentOptionSelected`} event. * @property {string} paymentOption The payment option view selected. Either `card`, `paypal`, or `paypalCredit`. */ /** * @class * @param {object} options For create options, see {@link module:braintree-web-drop-in|dropin.create}. * @description Do not use this constructor directly. Use {@link module:braintree-web-drop-in|dropin.create} instead. * @classdesc This class represents a Drop-in component, that will create a pre-made UI for accepting cards and PayPal on your page. Instances of this class have methods for requesting a payment method and subscribing to events. For more information, see the [Drop-in guide](https://developers.braintreepayments.com/guides/drop-in/javascript/v3) in the Braintree Developer Docs. To be used in conjunction with the [Braintree Server SDKs](https://developers.braintreepayments.com/start/hello-server/). */ function Dropin(options) { this._client = options.client; this._componentID = uuid(); this._dropinWrapper = document.createElement('div'); this._dropinWrapper.id = 'braintree--dropin__' + this._componentID; this._dropinWrapper.setAttribute('data-braintree-id', 'wrapper'); this._dropinWrapper.style.display = 'none'; this._dropinWrapper.className = 'braintree-loading'; this._merchantConfiguration = options.merchantConfiguration; EventEmitter.call(this); } Dropin.prototype = Object.create(EventEmitter.prototype, { constructor: Dropin }); Dropin.prototype._initialize = function (callback) { var localizedStrings, localizedHTML; var self = this; var container = self._merchantConfiguration.container || self._merchantConfiguration.selector; self._injectStylesheet(); if (!container) { analytics.sendEvent(self._client, 'configuration-error'); callback(new DropinError('options.container is required.')); return; } else if (self._merchantConfiguration.container && self._merchantConfiguration.selector) { analytics.sendEvent(self._client, 'configuration-error'); callback(new DropinError('Must only have one options.selector or options.container.')); return; } if (typeof container === 'string') { container = document.querySelector(container); } if (!container || container.nodeType !== 1) { analytics.sendEvent(self._client, 'configuration-error'); callback(new DropinError('options.selector or options.container must reference a valid DOM node.')); return; } if (container.innerHTML.trim()) { analytics.sendEvent(self._client, 'configuration-error'); callback(new DropinError('options.selector or options.container must reference an empty DOM node.')); return; } // Backfill with `en` self._strings = assign({}, translations.en); if (self._merchantConfiguration.locale) { localizedStrings = translations[self._merchantConfiguration.locale] || translations[self._merchantConfiguration.locale.split('_')[0]]; // Fill `strings` with `localizedStrings` that may exist self._strings = assign(self._strings, localizedStrings); } if (!isUtf8()) { // non-utf-8 encodings often don't support the bullet character self._strings.endingIn = self._strings.endingIn.replace(/•/g, '*'); } if (self._merchantConfiguration.translations) { Object.keys(self._merchantConfiguration.translations).forEach(function (key) { self._strings[key] = sanitizeHtml(self._merchantConfiguration.translations[key]); }); } localizedHTML = Object.keys(self._strings).reduce(function (result, stringKey) { var stringValue = self._strings[stringKey]; return result.replace(RegExp('{{' + stringKey + '}}', 'g'), stringValue); }, mainHTML); self._dropinWrapper.innerHTML = svgHTML + localizedHTML; container.appendChild(self._dropinWrapper); self._model = new DropinModel({ client: self._client, componentID: self._componentID, merchantConfiguration: self._merchantConfiguration }); self._model.initialize().then(function () { self._model.on('cancelInitialization', function (err) { self._dropinWrapper.innerHTML = ''; analytics.sendEvent(self._client, 'load-error'); callback(err); }); self._model.on('asyncDependenciesReady', function () { if (self._model.dependencySuccessCount >= 1) { analytics.sendEvent(self._client, 'appeared'); self._disableErroredPaymentMethods(); self._handleAppSwitch(); callback(null, self); } else { self._model.cancelInitialization(new DropinError('All payment options failed to load.')); } }); self._model.on('paymentMethodRequestable', function (event) { self._emit('paymentMethodRequestable', event); }); self._model.on('noPaymentMethodRequestable', function () { self._emit('noPaymentMethodRequestable'); }); self._model.on('paymentOptionSelected', function (event) { self._emit('paymentOptionSelected', event); }); return self._setUpDependenciesAndViews(); }).catch(function (err) { self.teardown().then(function () { callback(err); }); }); }; /** * Modify your configuration intially set in {@link module:braintree-web-drop-in|`dropin.create`}. * * If `updateConfiguration` is called after a user completes the PayPal authorization flow, any PayPal accounts not stored in the Vault record will be removed. * @public * @param {string} property The top-level property to update. Either `paypal`, `paypalCredit`, `applePay`, or `googlePay`. * @param {string} key The key of the property to update, such as `amount` or `currency`. * @param {any} value The value of the property to update. Must be the type of the property specified in {@link module:braintree-web-drop-in|`dropin.create`}. * @returns {void} * @example * dropinInstance.updateConfiguration('paypal', 'amount', '10.00'); */ Dropin.prototype.updateConfiguration = function (property, key, value) { var view; if (UPDATABLE_CONFIGURATION_OPTIONS.indexOf(property) === -1) { return; } if (property === 'threeDSecure') { if (this._threeDSecure) { this._threeDSecure.updateConfiguration(key, value); } return; } view = this._mainView.getView(property); if (!view) { return; } view.updateConfiguration(key, value); if (UPDATABLE_CONFIGURATION_OPTIONS_THAT_REQUIRE_UNVAULTED_PAYMENT_METHODS_TO_BE_REMOVED.indexOf(property) === -1) { return; } this._removeUnvaultedPaymentMethods(function (paymentMethod) { return paymentMethod.type === constants.paymentMethodTypes[property]; }); this._navigateToInitialView(); }; /** * Removes the currently selected payment method and returns the customer to the payment options view. Does not remove vaulted payment methods. * @public * @returns {void} * @example * dropinInstance.requestPaymentMethod(function (requestPaymentMethodError, payload) { * if (requestPaymentMethodError) { * // handle errors * return; * } * * functionToSendNonceToServer(payload.nonce, function (transactionError, response) { * if (transactionError) { * // transaction sale with selected payment method failed * // clear the selected payment method and add a message * // to the checkout page about the failure * dropinInstance.clearSelectedPaymentMethod(); * divForErrorMessages.textContent = 'my error message about entering a different payment method.'; * } else { * // redirect to success page * } * }); * }); */ Dropin.prototype.clearSelectedPaymentMethod = function () { this._removeUnvaultedPaymentMethods(); this._model.removeActivePaymentMethod(); if (this._model.getPaymentMethods().length === 0) { this._navigateToInitialView(); return; } this._mainView.showLoadingIndicator(); this._model.refreshPaymentMethods().then(function () { this._navigateToInitialView(); this._mainView.hideLoadingIndicator(); }.bind(this)); }; Dropin.prototype._setUpDataCollector = function () { var self = this; var config = assign({}, self._merchantConfiguration.dataCollector, {client: self._client}); this._model.asyncDependencyStarting(); this._dataCollector = new DataCollector(config); this._dataCollector.initialize().then(function () { self._model.asyncDependencyReady(); }).catch(function (err) { self._model.cancelInitialization(new DropinError({ message: 'Data Collector failed to set up.', braintreeWebError: err })); }); }; Dropin.prototype._setUpThreeDSecure = function () { var self = this; var config = assign({}, this._merchantConfiguration.threeDSecure); this._model.asyncDependencyStarting(); this._threeDSecure = new ThreeDSecure(this._client, config, this._strings.cardVerification); this._threeDSecure.initialize().then(function () { self._model.asyncDependencyReady(); }).catch(function (err) { self._model.cancelInitialization(new DropinError({ message: '3D Secure failed to set up.', braintreeWebError: err })); }); }; Dropin.prototype._setUpDependenciesAndViews = function () { if (this._merchantConfiguration.dataCollector) { this._setUpDataCollector(); } if (this._merchantConfiguration.threeDSecure) { this._setUpThreeDSecure(); } this._mainView = new MainView({ client: this._client, element: this._dropinWrapper, model: this._model, strings: this._strings }); }; Dropin.prototype._removeUnvaultedPaymentMethods = function (filter) { filter = filter || function () { return true; }; this._model.getPaymentMethods().forEach(function (paymentMethod) { if (filter(paymentMethod) && !paymentMethod.vaulted) { this._model.removePaymentMethod(paymentMethod); } }.bind(this)); }; Dropin.prototype._navigateToInitialView = function () { var hasNoSavedPaymentMethods, hasOnlyOneSupportedPaymentOption; var isOnMethodsView = this._mainView.primaryView.ID === paymentMethodsViewID; if (isOnMethodsView) { hasNoSavedPaymentMethods = this._model.getPaymentMethods().length === 0; if (hasNoSavedPaymentMethods) { hasOnlyOneSupportedPaymentOption = this._model.supportedPaymentOptions.length === 1; if (hasOnlyOneSupportedPaymentOption) { this._mainView.setPrimaryView(this._model.supportedPaymentOptions[0]); } else { this._mainView.setPrimaryView(paymentOptionsViewID); } } } }; Dropin.prototype._supportsPaymentOption = function (paymentOption) { return this._model.supportedPaymentOptions.indexOf(paymentOption) !== -1; }; Dropin.prototype._disableErroredPaymentMethods = function () { var paymentMethodOptionsElements; var failedDependencies = Object.keys(this._model.failedDependencies); if (failedDependencies.length === 0) { return; } paymentMethodOptionsElements = this._mainView.getOptionsElements(); failedDependencies.forEach(function (paymentMethodId) { var element = paymentMethodOptionsElements[paymentMethodId]; var div = element.div; var clickHandler = element.clickHandler; var error = this._model.failedDependencies[paymentMethodId]; var errorMessageDiv = div.querySelector('.braintree-option__disabled-message'); classlist.add(div, 'braintree-disabled'); div.removeEventListener('click', clickHandler); errorMessageDiv.innerHTML = constants.errors.DEVELOPER_MISCONFIGURATION_MESSAGE; console.error(error); // eslint-disable-line no-console }.bind(this)); }; Dropin.prototype._handleAppSwitch = function () { if (this._model.appSwitchError) { this._mainView.setPrimaryView(this._model.appSwitchError.id); this._model.reportError(this._model.appSwitchError.error); } else if (this._model.appSwitchPayload) { this._model.addPaymentMethod(this._model.appSwitchPayload); } }; /** * Requests a payment method object which includes the payment method nonce used by by the [Braintree Server SDKs](https://developers.braintreepayments.com/start/hello-server/). * * If a payment method is not available, an error will appear in the UI. When a callback is used, an error will be passed to it. If no callback is used, the returned Promise will be rejected with an error. * @public * @param {callback} [callback] The first argument will be an error if no payment method is available and will otherwise be null. The second argument will be an object containing a payment method nonce; either a {@link Dropin~cardPaymentMethodPayload|cardPaymentMethodPayload}, a {@link Dropin~paypalPaymentMethodPayload|paypalPaymentMethodPayload}, a {@link Dropin~venmoPaymentMethodPayload|venmoPaymentMethodPayload}, a {@link Dropin~googlePayPaymentMethodPayload|googlePayPaymentMethodPayload} or an {@link Dropin~applePayPaymentMethodPayload|applePayPaymentMethodPayload}. If no callback is provided, `requestPaymentMethod` will return a promise. * @returns {void|Promise} Returns a promise if no callback is provided. * @example Requesting a payment method * var form = document.querySelector('#my-form'); * var hiddenNonceInput = document.querySelector('#my-nonce-input'); * * form.addEventListener('submit', function (event) { * event.preventDefault(); * * dropinInstance.requestPaymentMethod(function (err, payload) { * if (err) { * // handle error * return; * } * hiddenNonceInput.value = payload.nonce; * form.submit(); * }); * }); * @example Requesting a payment method with data collector * var form = document.querySelector('#my-form'); * var hiddenNonceInput = document.querySelector('#my-nonce-input'); * var hiddenDeviceDataInput = document.querySelector('#my-device-data-input'); * * form.addEventListener('submit', function (event) { * event.preventDefault(); * * dropinInstance.requestPaymentMethod(function (err, payload) { * if (err) { * // handle error * return; * } * hiddenNonceInput.value = payload.nonce; * hiddenDeviceDataInput.value = payload.deviceData; * form.submit(); * }); * }); * * @example Requesting a payment method with 3D Secure * var form = document.querySelector('#my-form'); * var hiddenNonceInput = document.querySelector('#my-nonce-input'); * * form.addEventListener('submit', function (event) { * event.preventDefault(); * * dropinInstance.requestPaymentMethod(function (err, payload) { * if (err) { * // Handle error * return; * } * * if (payload.liabilityShifted || payload.type !== 'CreditCard') { * hiddenNonceInput.value = payload.nonce; * form.submit(); * } else { * // Decide if you will force the user to enter a different payment method * // if liablity was not shifted * dropinInstance.clearSelectedPaymentMethod(); * } * }); * }); */ Dropin.prototype.requestPaymentMethod = function () { return this._mainView.requestPaymentMethod().then(function (payload) { if (this._threeDSecure && payload.type === constants.paymentMethodTypes.card && payload.liabilityShifted == null) { return this._threeDSecure.verify(payload.nonce).then(function (newPayload) { payload.nonce = newPayload.nonce; payload.liabilityShifted = newPayload.liabilityShifted; payload.liabilityShiftPossible = newPayload.liabilityShiftPossible; return payload; }); } return payload; }.bind(this)).then(function (payload) { if (this._dataCollector) { payload.deviceData = this._dataCollector.getDeviceData(); } return payload; }.bind(this)).then(function (payload) { return formatPaymentMethodPayload(payload); }); }; Dropin.prototype._removeStylesheet = function () { var stylesheet = document.getElementById(constants.STYLESHEET_ID); if (stylesheet) { stylesheet.parentNode.removeChild(stylesheet); } }; Dropin.prototype._injectStylesheet = function () { var stylesheetUrl, assetsUrl; if (document.getElementById(constants.STYLESHEET_ID)) { return; } assetsUrl = this._client.getConfiguration().gatewayConfiguration.assetsUrl; stylesheetUrl = assetsUrl + '/web/dropin/' + VERSION + '/css/dropin.css'; assets.loadStylesheet({ href: stylesheetUrl, id: constants.STYLESHEET_ID }); }; /** * Cleanly remove anything set up by {@link module:braintree-web-drop-in|dropin.create}. This may be be useful in a single-page app. * @public * @param {callback} [callback] Called on completion, containing an error if one occurred. No data is returned if teardown completes successfully. If no callback is provided, `teardown` will return a promise. * @returns {void|Promise} Returns a promise if no callback is provided. */ Dropin.prototype.teardown = function () { var teardownError; var promise = Promise.resolve(); var self = this; this._removeStylesheet(); if (this._mainView) { promise.then(function () { return self._mainView.teardown().catch(function (err) { teardownError = err; }); }); } if (this._dataCollector) { promise.then(function () { return this._dataCollector.teardown().catch(function (error) { teardownError = new DropinError({ message: 'Drop-in errored tearing down Data Collector.', braintreeWebError: error }); }); }.bind(this)); } if (this._threeDSecure) { promise.then(function () { return this._threeDSecure.teardown().catch(function (error) { teardownError = new DropinError({ message: 'Drop-in errored tearing down 3D Secure.', braintreeWebError: error }); }); }.bind(this)); } return promise.then(function () { return self._removeDropinWrapper(); }).then(function () { if (teardownError) { return Promise.reject(teardownError); } return Promise.resolve(); }); }; /** * Returns a boolean indicating if a payment method is available through {@link Dropin#requestPaymentMethod|requestPaymentMethod}. Particularly useful for detecting if using a client token with a customer ID to show vaulted payment methods. * @public * @returns {Boolean} True if a payment method is available, otherwise false. */ Dropin.prototype.isPaymentMethodRequestable = function () { return this._model.isPaymentMethodRequestable(); }; Dropin.prototype._removeDropinWrapper = function () { this._dropinWrapper.parentNode.removeChild(this._dropinWrapper); return Promise.resolve(); }; function formatPaymentMethodPayload(paymentMethod) { var formattedPaymentMethod = { nonce: paymentMethod.nonce, details: paymentMethod.details, type: paymentMethod.type }; if (paymentMethod.vaulted != null) { formattedPaymentMethod.vaulted = paymentMethod.vaulted; } if (paymentMethod.type === constants.paymentMethodTypes.card) { formattedPaymentMethod.description = paymentMethod.description; } if (paymentMethod.type === constants.paymentMethodTypes.googlePay) { formattedPaymentMethod.details.rawPaymentData = paymentMethod.rawPaymentData; } if (typeof paymentMethod.liabilityShiftPossible === 'boolean') { formattedPaymentMethod.liabilityShifted = paymentMethod.liabilityShifted; formattedPaymentMethod.liabilityShiftPossible = paymentMethod.liabilityShiftPossible; } if (paymentMethod.deviceData) { formattedPaymentMethod.deviceData = paymentMethod.deviceData; } if (paymentMethod.binData) { formattedPaymentMethod.binData = paymentMethod.binData; } return formattedPaymentMethod; } module.exports = wrapPrototype(Dropin); },{"./constants":117,"./dropin-model":118,"./lib/analytics":122,"./lib/assets":123,"./lib/assign":124,"./lib/classlist":126,"./lib/data-collector":128,"./lib/dropin-error":129,"./lib/event-emitter":130,"./lib/is-utf-8":134,"./lib/promise":137,"./lib/sanitize-html":138,"./lib/three-d-secure":140,"./lib/uuid":142,"./translations":152,"./views/main-view":169,"./views/payment-methods-view":171,"./views/payment-options-view":172,"@braintree/wrap-promise":21}],120:[function(require,module,exports){ 'use strict'; /** * @module braintree-web-drop-in * @description There are two ways to integrate Drop-in into your page: a script tag integration and a JavaScript integration using [`dropin.create`](#.create). * * The script tag integration is the fastest way to integrate. All you need to do is add the Drop-in script inside your form element where you want Drop-in to appear and include a `data-braintree-dropin-authorization` property with your [tokenization key](https://developers.braintreepayments.com/guides/authorization/tokenization-key/javascript/v3) or [client token](https://developers.braintreepayments.com/guides/authorization/client-token). * * When your form is submitted, Drop-in will intercept the form submission and attempt to tokenize the payment method. If the tokenization is successful, it will insert the payment method nonce into a hidden input with the name `payment_method_nonce` and then submit your form. If the tokenization is unsuccessful, a relevant error will be shown in the UI. * * If you have data collector enabled, the device data will be injected into a hidden input with the name `device_data` before form submission. * * Specify creation options as data attributes in your script tag, as shown in the examples below. The following configuration properties may be set: * * * `data-locale` * * `data-card.cardholder-name.required` * * `data-payment-option-priority` * * `data-data-collector.kount` * * `data-data-collector.paypal` * * `data-paypal.amount` * * `data-paypal.currency` * * `data-paypal.flow` * * `data-paypal-credit.amount` * * `data-paypal-credit.currency` * * `data-paypal-credit.flow` * * For more control and customization, use [`dropin.create` instead](#.create). * * See our [demo app](../../script-tag-integration.html) for an example of using our script tag integration. * * @example * A full example accepting only cards * * * * * Checkout * * *
* * *
* * * * @example * A full example accepting cards, PayPal, and PayPal credit * * * * * Checkout * * *
* * *
* * * * @example * Specifying a locale and payment option priority *
* * *
* * @example * Including an optional cardholder name field in card form *
* * *
* * @example * Including a required cardholder name field in card form *
* * *
*/ var Dropin = require('./dropin'); var client = require('braintree-web/client'); var createFromScriptTag = require('./lib/create-from-script-tag'); var constants = require('./constants'); var analytics = require('./lib/analytics'); var DropinError = require('./lib/dropin-error'); var Promise = require('./lib/promise'); var wrapPromise = require('@braintree/wrap-promise'); var VERSION = "1.13.0"; /** * @typedef {object} cardCreateOptions The configuration options for cards. Internally, Drop-in uses [Hosted Fields](http://braintree.github.io/braintree-web/{@pkg bt-web-version}/module-braintree-web_hosted-fields.html) to render the card form. The `overrides.fields` and `overrides.styles` allow the Hosted Fields to be customized. * * @param {boolean|object} [cardholderName] Will enable a cardholder name field above the card number field. If set to an object, you can specify whether or not the field is required. If set to a `true`, it will default the field to being present, but not required. * @param {boolean} [cardholderName.required=false] When true, the cardholder name field will be required to request the payment method nonce. * @param {object} [overrides.fields] The Hosted Fields [`fields` options](http://braintree.github.io/braintree-web/{@pkg bt-web-version}/module-braintree-web_hosted-fields.html#~fieldOptions). Only `number`, `cvv`, `expirationDate` and `postalCode` can be configured. Each is a [Hosted Fields `field` object](http://braintree.github.io/braintree-web/{@pkg bt-web-version}/module-braintree-web_hosted-fields.html#~field). `selector` cannot be modified. * @param {object} [overrides.styles] The Hosted Fields [`styles` options](http://braintree.github.io/braintree-web/{@pkg bt-web-version}/module-braintree-web_hosted-fields.html#~styleOptions). * @param {boolean} [clearFieldsAfterTokenization=true] When false, the card form will not clear the card data when the customer returns to the card view after a succesful tokenization. */ /** * @typedef {object} dataCollectorOptions The configuration options for Data Collector. Requires [advanced fraud protection](https://developers.braintreepayments.com/guides/advanced-fraud-tools/client-side/javascript/v3) to be enabled in the Braintree gateway. Contact our [support team](https://developers.braintreepayments.com/forms/contact) to configure your Kount ID. The device data will be included on the {@link Dropin#requestPaymentMethod|requestPaymentMethod payload}. * * @param {boolean} [kount] If true, Kount fraud data collection is enabled. Required if `paypal` parameter is not used. * @param {boolean} [paypal] If true, PayPal fraud data collection is enabled. Required if `kount` parameter is not used. */ /** * @typedef {object} threeDSecureOptions The configuration options for 3D Secure. Requires [3D Secure](https://developers.braintreepayments.com/guides/3d-secure/overview) to be enabled in the Braintree gateway. The liability shift information will be included on the {@link Dropin#requestPaymentMethod|requestPaymentMethod payload}. * * @param {string} amount The amount to verify with 3D Secure. */ /** @typedef {object} paypalCreateOptions The configuration options for PayPal and PayPalCredit. For a full list of options see the [PayPal Checkout client reference options](http://braintree.github.io/braintree-web/{@pkg bt-web-version}/PayPalCheckout.html#createPayment). * * @param {string} flow Either `checkout` for a one-time [Checkout with PayPal](https://developers.braintreepayments.com/guides/paypal/checkout-with-paypal/javascript/v3) flow or `vault` for a [Vault flow](https://developers.braintreepayments.com/guides/paypal/vault/javascript/v3). Required when using PayPal or PayPal Credit. * @param {string|number} [amount] The amount of the transaction. Required when using the Checkout flow. * @param {string} [currency] The currency code of the amount, such as `USD`. Required when using the Checkout flow. * @param {string} [buttonStyle] The style object to apply to the PayPal button. Button customization includes color, shape, size, and label. The options [found here](https://developer.paypal.com/docs/integration/direct/express-checkout/integration-jsv4/customize-button/#button-styles) are available. * @param {boolean} [commit] The user action to show on the PayPal review page. If true, a `Pay Now` button will be shown. If false, a `Continue` button will be shown. */ /** @typedef {object} applePayCreateOptions The configuration options for Apple Pay. * * @param {string} [buttonStyle=black] Configures the Apple Pay button style. Valid values are `black`, `white`, `white-outline`. * @param {string} displayName The canonical name for your store. Use a non-localized name. This parameter should be a UTF-8 string that is a maximum of 128 characters. The system may display this name to the user. * @param {external:ApplePayPaymentRequest} paymentRequest The payment request details to apply on top of those from Braintree. */ /** @typedef {object} googlePayCreateOptions The configuration options for Google Pay. Additional options from the few listed here are available, many have default values applied based on the settings found in the Braintree Gateway. For more information, see [Google's Documentation](https://developers.google.com/pay/api/web/object-reference#request-objects). * * @param {string} merchantId The ID provided by Google for processing transactions in production. Not necessary for testing in sandbox. * @param {external:GooglePayTransactionInfo} transactionInfo The transaction details necessary for processing the payment. */ /** * @typedef {object} ApplePayPaymentRequest An [Apple Pay Payment Request object](https://developer.apple.com/reference/applepayjs/1916082-applepay_js_data_types/paymentrequest). * @external ApplePayPaymentRequest * @see {@link https://developer.apple.com/reference/applepayjs/1916082-applepay_js_data_types/paymentrequest PaymentRequest} */ /** * @typedef {object} GooglePayTransactionInfo A [Google Pay TransactionInfo object](https://developers.google.com/pay/api/web/object-reference#TransactionInfo). * @external GooglePayTransactionInfo * @see {@link https://developers.google.com/pay/api/web/object-reference#TransactionInfo TransactionInfo} */ /** @typedef {object|boolean} venmoCreateOptions The configuration options for Venmo. If `true` is passed instead of a configuration object, the default settings listed will be used. * * @param {boolean} [allowNewBrowserTab=true] If false, it restricts supported browsers to those that can app switch to the Venmo app without opening a new tab. */ /** * @static * @function create * @description This function is the entry point for `braintree.dropin`. It is used for creating {@link Dropin} instances. * @param {object} options Object containing all {@link Dropin} options: * @param {string} options.authorization A [tokenization key](https://developers.braintreepayments.com/guides/authorization/tokenization-key/javascript/v3) or a [client token](https://developers.braintreepayments.com/guides/authorization/client-token). If authorization is a client token created with a [customer ID](https://developers.braintreepayments.com/guides/drop-in/javascript/v3#customer-id), Drop-in will render saved payment methods and automatically store any newly-added payment methods in their Vault record. * @param {string|HTMLElement} options.container A reference to an empty element, such as a `
`, where Drop-in will be included on your page or the selector for the empty element. e.g. `#dropin-container`. * @param {string} options.selector Deprecated: Now an alias for `options.container`. * @param {string} [options.locale=`en_US`] Use this option to change the language, links, and terminology used throughout Drop-in. Supported locales include: * `da_DK`, * `de_DE`, * `en_AU`, * `en_GB`, * `en_US`, * `es_ES`, * `fr_CA`, * `fr_FR`, * `id_ID`, * `it_IT`, * `ja_JP`, * `ko_KR`, * `nl_NL`, * `no_NO`, * `pl_PL`, * `pt_BR`, * `pt_PT`, * `ru_RU`, * `sv_SE`, * `th_TH`, * `zh_CN`, * `zh_HK`, * `zh_TW`. * * @param {object} [options.translations] To use your own translations, pass an object with the strings you wish to replace. This object must use the same structure as the object used internally for supported translations, which can be found [here](https://github.com/braintree/braintree-web-drop-in/blob/master/src/translations/en_US.js). Any strings that are not included will be those from the provided `locale` or `en_US` if no `locale` is provided. See below for an example of creating Drop-in with custom translations. * @param {array} [options.paymentOptionPriority] Use this option to indicate the order in which enabled payment options should appear when multiple payment options are enabled. By default, payment options will appear in this order: `['card', 'paypal', 'paypalCredit', 'venmo', 'applePay']`. Payment options omitted from this array will not be offered to the customer. * * @param {object} [options.card] The configuration options for cards. See [`cardCreateOptions`](#~cardCreateOptions) for all `card` options. If this option is omitted, cards will still appear as a payment option. To remove cards as a payment option, use `paymentOptionPriority`. * @param {object} [options.paypal] The configuration options for PayPal. To include a PayPal option in your Drop-in integration, include the `paypal` parameter and [enable PayPal in the Braintree Control Panel](https://developers.braintreepayments.com/guides/paypal/testing-go-live/#go-live). To test in Sandbox, you will need to [link a PayPal sandbox test account to your Braintree sandbox account](https://developers.braintreepayments.com/guides/paypal/testing-go-live/#linked-paypal-testing). * * Some of the PayPal configuration options are listed [here](#~paypalCreateOptions), but for a full list see the [PayPal Checkout client reference options](http://braintree.github.io/braintree-web/{@pkg bt-web-version}/PayPalCheckout.html#createPayment). * * PayPal is not [supported in Internet Explorer versions lower than 11](https://developer.paypal.com/docs/checkout/reference/faq/#which-browsers-does-paypal-checkout-support). * * @param {object} [options.paypalCredit] The configuration options for PayPal Credit. To include a PayPal Credit option in your Drop-in integration, include the `paypalCredit` parameter and [enable PayPal in the Braintree Control Panel](https://developers.braintreepayments.com/guides/paypal/testing-go-live/#go-live). * * Some of the PayPal Credit configuration options are listed [here](#~paypalCreateOptions), but for a full list see the [PayPal Checkout client reference options](http://braintree.github.io/braintree-web/{@pkg bt-web-version}/PayPalCheckout.html#createPayment). For more information on PayPal Credit, see the [Braintree Developer Docs](https://developers.braintreepayments.com/guides/paypal/paypal-credit/javascript/v3). * * PayPal Credit is not [supported in Internet Explorer versions lower than 11](https://developer.paypal.com/docs/checkout/reference/faq/#which-browsers-does-paypal-checkout-support). * * @param {object|boolean} [options.venmo] The configuration options for Pay with Venmo. To include a Venmo option in your Drop-in integration, include the `venmo` parameter and [follow the documentation for setting up Venmo in the Braintree control panel](https://articles.braintreepayments.com/guides/payment-methods/venmo#setup). If a user's browser does not support Venmo, the Venmo option will not be rendered. * * See [`venmoCreateOptions`](#~venmoCreateOptions) for `venmo` options. * * @param {object} [options.applePay] The configuration options for Apple Pay. To include an Apple Pay option in your Drop-in integration, include the `applePay` parameter and [enable Apple Pay in the Braintree Control Panel](https://developers.braintreepayments.com/guides/apple-pay/configuration/javascript/v3). If a user's browser does not support Apple Pay, the Apple Pay option will not be rendered. See [Apple's documentation](https://support.apple.com/en-us/HT201469) for browser and device support. * * See [`applePayCreateOptions`](#~applePayCreateOptions) for `applePay` options. * * @param {object} [options.googlePay] The configuration options for Google Pay. To include a Google Pay option in your Drop-in integration, include the `googlePay` parameter and [enable Google Pay in the Braintree Control Panel](https://developers.braintreepayments.com/guides/google-pay/configuration/javascript/v3). If a user's browser does not support Google Pay, the Google Pay option will not be rendered. See [Google's documentation](https://developers.google.com/pay/api/web/test-and-deploy) for browser and device support. * * See [`googlePayCreateOptions`](#~googlePayCreateOptions) for `googlePay` options. * * @param {object} [options.dataCollector] The configuration options for data collector. See [`dataCollectorOptions`](#~dataCollectorOptions) for all `dataCollector` options. If Data Collector is configured and fails to load, Drop-in creation will fail. * * @param {object} [options.threeDSecure] The configuration options for 3D Secure. See [`threeDSecureOptions`](#~threeDSecureOptions) for all `threeDSecure` options. If 3D Secure is configured and fails to load, Drop-in creation will fail. * * @param {boolean} [options.vaultManager=false] Whether or not to allow a customer to delete saved payment methods when used with a [client token with a customer id](https://developers.braintreepayments.com/reference/request/client-token/generate/#customer_id). *Note:* Deleting a payment method from Drop-in will permanently delete the payment method, so this option is not recomended for merchants using Braintree's recurring billing system. This feature is not supported in Internet Explorer 9. * * @param {boolean} [options.preselectVaultedPaymentMethod=true] Whether or not to initialize Drop-in with a vaulted payment method pre-selected. Only applicable when using a [client token with a customer id](https://developers.braintreepayments.com/reference/request/client-token/generate/#customer_id) and a customer with saved payment methods. * * @param {function} [callback] The second argument, `data`, is the {@link Dropin} instance. Returns a promise if no callback is provided. * @returns {void|Promise} Returns a promise if no callback is provided. * @example * A full example of accepting credit cards with callback API * * * * * Checkout * * *
* * * * * * * * @example * A full example of accepting credit cards with promise API * * * * * Checkout * * *
* * * * * * * * @example * Setting up a Drop-in instance to accept credit cards, PayPal, PayPal Credit, Venmo, and Apple Pay * braintree.dropin.create({ * authorization: 'CLIENT_AUTHORIZATION', * container: '#dropin-container', * applePay: { * displayName: 'Merchant Name', * paymentRequest: { * label: 'Localized Name', * total: '10.00' * } * }, * paypal: { * flow: 'checkout', * amount: '10.00', * currency: 'USD' * }, * paypalCredit: { * flow: 'checkout', * amount: '10.00', * currency: 'USD' * }, * venmo: true * }, function (err, dropinInstance) { * // Set up a handler to request a payment method and * // submit the payment method nonce to your server * }); * @example * Setting up a Drop-in instance to accept Venmo with restricted browser support * braintree.dropin.create({ * authorization: 'CLIENT_AUTHORIZATION', * container: '#dropin-container', * venmo: { * allowNewBrowserTab: false * } * }, function (err, dropinInstance) { * // Set up a handler to request a payment method and * // submit the payment method nonce to your server * }); * * @example * Submitting the payment method nonce to the server using a form * * * * * Checkout * * *
*
* * *
* * * * * * * * @example * Use your own translations * braintree.dropin.create({ * authorization: 'CLIENT_AUTHORIZATION', * container: '#dropin-container', * translations: { * payingWith: 'You are paying with {{paymentSource}}', * chooseAnotherWayToPay: 'My custom chooseAnotherWayToPay string', * // Any other custom translation strings * } * }, callback); * * @example * Customizing Drop-in with card form overrides * braintree.dropin.create({ * authorization: 'CLIENT_AUTHORIZATION', * container: '#dropin-container', * card: { * overrides: { * fields: { * number: { * placeholder: '1111 1111 1111 1111' // Update the number field placeholder * }, * postalCode: { * minlength: 5 // Set the minimum length of the postal code field * }, * cvv: null // Remove the CVV field from your form * }, * styles: { * input: { * 'font-size': '18px' // Change the font size for all inputs * }, * ':focus': { * color: 'red' // Change the focus color to red for all inputs * } * } * } * } * }, callback); * * @example * Mask Card Inputs * braintree.dropin.create({ * authorization: 'CLIENT_AUTHORIZATION', * container: '#dropin-container', * card: { * overrides: { * fields: { * number: { * maskInput: { * showLastFour: true * } * }, * cvv: { * maskInput: true * } * } * } * } * }, callback); * * @example * Including a cardholder name field * braintree.dropin.create({ * authorization: 'CLIENT_AUTHORIZATION', * container: '#dropin-container', * card: { * cardholderName: true * } * }, callback); * * @example * Including a required cardholder name field * braintree.dropin.create({ * authorization: 'CLIENT_AUTHORIZATION', * container: '#dropin-container', * card: { * cardholderName: { * required: true * } * } * }, callback); * * @example * Enabling 3D Secure * braintree.dropin.create({ * authorization: 'CLIENT_AUTHORIZATION', * container: '#dropin-container', * threeDSecure: { * amount: '10.00' * } * }, callback); * * @example * Enabled Vault Manager * braintree.dropin.create({ * authorization: 'CLIENT_AUTHORIZATION', * container: '#dropin-container', * vaultManager: true * }, callback); */ function create(options) { if (!options.authorization) { return Promise.reject(new DropinError('options.authorization is required.')); } return client.create({ authorization: options.authorization }).catch(function (err) { return Promise.reject(new DropinError({ message: 'There was an error creating Drop-in.', braintreeWebError: err })); }).then(function (clientInstance) { clientInstance = setAnalyticsIntegration(clientInstance); if (clientInstance.getConfiguration().authorizationType === 'TOKENIZATION_KEY') { analytics.sendEvent(clientInstance, 'started.tokenization-key'); } else { analytics.sendEvent(clientInstance, 'started.client-token'); } return new Promise(function (resolve, reject) { new Dropin({ merchantConfiguration: options, client: clientInstance })._initialize(function (err, instance) { if (err) { reject(err); return; } resolve(instance); }); }); }); } function setAnalyticsIntegration(clientInstance) { var configuration = clientInstance.getConfiguration(); configuration.analyticsMetadata.integration = constants.INTEGRATION; configuration.analyticsMetadata.integrationType = constants.INTEGRATION; configuration.analyticsMetadata.dropinVersion = VERSION; clientInstance.getConfiguration = function () { return configuration; }; return clientInstance; } // we check for document's existence to support server side rendering createFromScriptTag(create, typeof document !== 'undefined' && document.querySelector('script[data-braintree-dropin-authorization]')); module.exports = { create: wrapPromise(create), /** * @description The current version of Drop-in, i.e. `{@pkg version}`. * @type {string} */ VERSION: VERSION }; },{"./constants":117,"./dropin":119,"./lib/analytics":122,"./lib/create-from-script-tag":127,"./lib/dropin-error":129,"./lib/promise":137,"@braintree/wrap-promise":21,"braintree-web/client":30}],121:[function(require,module,exports){ 'use strict'; function addSelectionEventHandler(element, func) { element.addEventListener('click', func); element.addEventListener('keyup', function (event) { if (event.keyCode === 13) { func(); } }); } module.exports = addSelectionEventHandler; },{}],122:[function(require,module,exports){ 'use strict'; var atob = require('./polyfill').atob; var constants = require('../constants'); var braintreeClientVersion = require('braintree-web/client').VERSION; function _millisToSeconds(millis) { return Math.floor(millis / 1000); } function sendAnalyticsEvent(client, kind, callback) { var configuration = client.getConfiguration(); var analyticsRequest = client._request; var timestamp = _millisToSeconds(Date.now()); var url = configuration.gatewayConfiguration.analytics.url; var data = { analytics: [{ kind: constants.ANALYTICS_PREFIX + kind, timestamp: timestamp }], _meta: configuration.analyticsMetadata, braintreeLibraryVersion: braintreeClientVersion }; if (configuration.authorizationType === 'TOKENIZATION_KEY') { data.tokenizationKey = configuration.authorization; } else { data.authorizationFingerprint = JSON.parse(atob(configuration.authorization)).authorizationFingerprint; } analyticsRequest({ url: url, method: 'post', data: data, timeout: constants.ANALYTICS_REQUEST_TIMEOUT_MS }, callback); } module.exports = { sendEvent: sendAnalyticsEvent }; },{"../constants":117,"./polyfill":136,"braintree-web/client":30}],123:[function(require,module,exports){ 'use strict'; var Promise = require('./promise'); function loadScript(options) { var script = document.createElement('script'); var attrs = options.dataAttributes || {}; var container = options.container || document.head; script.src = options.src; script.id = options.id; script.async = true; Object.keys(attrs).forEach(function (key) { script.setAttribute('data-' + key, attrs[key]); }); return new Promise(function (resolve, reject) { script.addEventListener('load', resolve); script.addEventListener('error', function () { reject(new Error(options.src + ' failed to load.')); }); script.addEventListener('abort', function () { reject(new Error(options.src + ' has aborted.')); }); container.appendChild(script); }); } function loadStylesheet(options) { var stylesheet = document.createElement('link'); var container = options.container || document.head; stylesheet.setAttribute('rel', 'stylesheet'); stylesheet.setAttribute('type', 'text/css'); stylesheet.setAttribute('href', options.href); stylesheet.setAttribute('id', options.id); if (container.firstChild) { container.insertBefore(stylesheet, container.firstChild); } else { container.appendChild(stylesheet); } } module.exports = { loadScript: loadScript, loadStylesheet: loadStylesheet }; },{"./promise":137}],124:[function(require,module,exports){ arguments[4][63][0].apply(exports,arguments) },{"dup":63}],125:[function(require,module,exports){ 'use strict'; var isIe9 = require('@braintree/browser-detection/is-ie9'); var isIe10 = require('@braintree/browser-detection/is-ie10'); module.exports = { isIe9: isIe9, isIe10: isIe10 }; },{"@braintree/browser-detection/is-ie10":5,"@braintree/browser-detection/is-ie9":7}],126:[function(require,module,exports){ 'use strict'; function _classesOf(element) { return element.className.trim().split(/\s+/); } function _hasClass(element, classname) { return new RegExp('\\b' + classname + '\\b').test(element.className); } function add(element) { var toAdd = Array.prototype.slice.call(arguments, 1); var className = _classesOf(element).filter(function (classname) { return toAdd.indexOf(classname) === -1; }).concat(toAdd).join(' '); element.className = className; } function remove(element) { var toRemove = Array.prototype.slice.call(arguments, 1); var className = _classesOf(element).filter(function (classname) { return toRemove.indexOf(classname) === -1; }).join(' '); element.className = className; } function toggle(element, classname, adding) { if (arguments.length < 3) { if (_hasClass(element, classname)) { remove(element, classname); } else { add(element, classname); } } else if (adding) { add(element, classname); } else { remove(element, classname); } } module.exports = { add: add, remove: remove, toggle: toggle }; },{}],127:[function(require,module,exports){ 'use strict'; var analytics = require('./analytics'); var find = require('./find-parent-form'); var uuid = require('./uuid'); var DropinError = require('./dropin-error'); var kebabCaseToCamelCase = require('./kebab-case-to-camel-case'); var WHITELISTED_DATA_ATTRIBUTES = [ 'locale', 'payment-option-priority', 'data-collector.kount', 'data-collector.paypal', // camelcase version was accidentally used initially. // we add the kebab case version to match the docs, but // we retain the camelcase version for backwards compatibility 'card.cardholderName', 'card.cardholderName.required', 'card.cardholder-name', 'card.cardholder-name.required', 'paypal.amount', 'paypal.currency', 'paypal.flow', 'paypal.landing-page-type', 'paypal-credit.amount', 'paypal-credit.currency', 'paypal-credit.flow', 'paypal-credit.landing-page-type' ]; function injectHiddenInput(name, value, form) { var input = form.querySelector('[name="' + name + '"]'); if (!input) { input = document.createElement('input'); input.type = 'hidden'; input.name = name; form.appendChild(input); } input.value = value; } function addCompositeKeyValuePairToObject(obj, key, value) { var decomposedKeys = key.split('.'); var topLevelKey = kebabCaseToCamelCase(decomposedKeys[0]); if (decomposedKeys.length === 1) { obj[topLevelKey] = deserialize(value); } else { obj[topLevelKey] = obj[topLevelKey] || {}; addCompositeKeyValuePairToObject(obj[topLevelKey], decomposedKeys.slice(1).join('.'), value); } } function deserialize(value) { try { return JSON.parse(value); } catch (e) { return value; } } function createFromScriptTag(createFunction, scriptTag) { var authorization, container, createOptions, form; if (!scriptTag) { return; } authorization = scriptTag.getAttribute('data-braintree-dropin-authorization'); if (!authorization) { throw new DropinError('Authorization not found in data-braintree-dropin-authorization attribute'); } container = document.createElement('div'); container.id = 'braintree-dropin-' + uuid(); form = find.findParentForm(scriptTag); if (!form) { throw new DropinError('No form found for script tag integration.'); } form.addEventListener('submit', function (event) { event.preventDefault(); }); scriptTag.parentNode.insertBefore(container, scriptTag); createOptions = { authorization: authorization, container: container }; WHITELISTED_DATA_ATTRIBUTES.forEach(function (compositeKey) { var value = scriptTag.getAttribute('data-' + compositeKey); if (value == null) { return; } addCompositeKeyValuePairToObject(createOptions, compositeKey, value); }); createFunction(createOptions).then(function (instance) { analytics.sendEvent(instance._client, 'integration-type.script-tag'); form.addEventListener('submit', function () { instance.requestPaymentMethod(function (requestPaymentError, payload) { if (requestPaymentError) { return; } injectHiddenInput('payment_method_nonce', payload.nonce, form); if (payload.deviceData) { injectHiddenInput('device_data', payload.deviceData, form); } form.submit(); }); }); }); } module.exports = createFromScriptTag; },{"./analytics":122,"./dropin-error":129,"./find-parent-form":131,"./kebab-case-to-camel-case":135,"./uuid":142}],128:[function(require,module,exports){ (function (global){ 'use strict'; var constants = require('../constants'); var assets = require('./assets'); var Promise = require('./promise'); function DataCollector(config) { this._config = config; } DataCollector.prototype.initialize = function () { var self = this; return Promise.resolve().then(function () { var braintreeWebVersion; if (global.braintree && global.braintree.dataCollector) { return Promise.resolve(); } braintreeWebVersion = self._config.client.getVersion(); return assets.loadScript({ src: 'https://js.braintreegateway.com/web/' + braintreeWebVersion + '/js/data-collector.min.js', id: constants.DATA_COLLECTOR_SCRIPT_ID }); }).then(function () { return global.braintree.dataCollector.create(self._config); }).then(function (instance) { self._instance = instance; }); }; DataCollector.prototype.getDeviceData = function () { return this._instance.deviceData; }; DataCollector.prototype.teardown = function () { return this._instance.teardown(); }; module.exports = DataCollector; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"../constants":117,"./assets":123,"./promise":137}],129:[function(require,module,exports){ 'use strict'; function isBraintreeWebError(err) { return err.name === 'BraintreeError'; } function DropinError(err) { this.name = 'DropinError'; if (typeof err === 'string') { this.message = err; } else { this.message = err.message; } if (isBraintreeWebError(err)) { this._braintreeWebError = err; } else { this._braintreeWebError = err.braintreeWebError; } } DropinError.prototype = Object.create(Error.prototype); DropinError.prototype.constructor = DropinError; module.exports = DropinError; },{}],130:[function(require,module,exports){ arguments[4][79][0].apply(exports,arguments) },{"dup":79}],131:[function(require,module,exports){ 'use strict'; function findParentForm(element) { var parentNode = element.parentNode; if (!parentNode || parentNode.nodeName === 'FORM') { return parentNode; } return findParentForm(parentNode); } module.exports = { findParentForm: findParentForm }; },{}],132:[function(require,module,exports){ 'use strict'; var atob = require('./polyfill').atob; module.exports = function (client) { var authorizationFingerprint; var configuration = client.getConfiguration(); if (configuration.authorizationType !== 'TOKENIZATION_KEY') { authorizationFingerprint = JSON.parse(atob(configuration.authorization)).authorizationFingerprint; return !authorizationFingerprint || authorizationFingerprint.indexOf('customer_id=') === -1; } return true; }; },{"./polyfill":136}],133:[function(require,module,exports){ (function (global){ 'use strict'; function isHTTPS() { return global.location.protocol === 'https:'; } module.exports = { isHTTPS: isHTTPS }; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}],134:[function(require,module,exports){ (function (global){ 'use strict'; module.exports = function (win) { win = win || global; return Boolean(win.document.characterSet && win.document.characterSet.toLowerCase() === 'utf-8'); }; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}],135:[function(require,module,exports){ 'use strict'; function kebabCaseToCamelCase(kebab) { var parts = kebab.split('-'); var first = parts.shift(); var capitalizedParts = parts.map(function (part) { return part.charAt(0).toUpperCase() + part.substring(1); }); return [first].concat(capitalizedParts).join(''); } module.exports = kebabCaseToCamelCase; },{}],136:[function(require,module,exports){ (function (global){ 'use strict'; /* eslint-disable no-mixed-operators */ var atobNormalized = typeof global.atob === 'function' ? global.atob : atob; function atob(base64String) { var a, b, c, b1, b2, b3, b4, i; var base64Matcher = new RegExp('^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})([=]{1,2})?$'); var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; var result = ''; if (!base64Matcher.test(base64String)) { throw new Error('Non base64 encoded input passed to window.atob polyfill'); } i = 0; do { b1 = characters.indexOf(base64String.charAt(i++)); b2 = characters.indexOf(base64String.charAt(i++)); b3 = characters.indexOf(base64String.charAt(i++)); b4 = characters.indexOf(base64String.charAt(i++)); a = (b1 & 0x3F) << 2 | b2 >> 4 & 0x3; b = (b2 & 0xF) << 4 | b3 >> 2 & 0xF; c = (b3 & 0x3) << 6 | b4 & 0x3F; result += String.fromCharCode(a) + (b ? String.fromCharCode(b) : '') + (c ? String.fromCharCode(c) : ''); } while (i < base64String.length); return result; } module.exports = { atob: function (base64String) { return atobNormalized.call(global, base64String); }, _atob: atob }; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}],137:[function(require,module,exports){ arguments[4][87][0].apply(exports,arguments) },{"dup":87,"promise-polyfill":113}],138:[function(require,module,exports){ 'use strict'; module.exports = function (string) { if (typeof string !== 'string') { return ''; } return string .replace(//g, '>'); }; },{}],139:[function(require,module,exports){ 'use strict'; module.exports = function () { var el = document.createElement('div'); var prop = 'flex-basis: 1px'; var prefixes = [ '-webkit-', '-moz-', '-ms-', '-o-', '' ]; prefixes.forEach(function (prefix) { el.style.cssText += prefix + prop; }); return Boolean(el.style.length); }; },{}],140:[function(require,module,exports){ 'use strict'; var classlist = require('./classlist'); var threeDSecure = require('braintree-web/three-d-secure'); var Promise = require('./promise'); function ThreeDSecure(client, merchantConfiguration, cardVerificationString) { this._client = client; this._config = merchantConfiguration; this._modal = this._setupModal(cardVerificationString); } ThreeDSecure.prototype.initialize = function () { var self = this; return threeDSecure.create({ client: this._client }).then(function (instance) { self._instance = instance; }); }; ThreeDSecure.prototype.verify = function (nonce) { var self = this; this._revealModal(); return Promise.all([ this._waitForThreeDSecure(), this._instance.verifyCard({ nonce: nonce, amount: this._config.amount, showLoader: false, addFrame: function (err, iframe) { var modalBody = self._modal.querySelector('.braintree-three-d-secure__modal-body'); iframe.onload = function () { classlist.add(modalBody, 'braintree-three-d-secure__frame-active'); }; modalBody.appendChild(iframe); }, removeFrame: function () { self._cleanupModal(); } }).then(function (payload) { self._resolveThreeDSecure(); return payload; }) ]).then(function (result) { self._cleanupModal(); return result[1]; }).catch(function (err) { self._cleanupModal(); if (err.type === 'THREE_D_SECURE_CANCELLED') { return Promise.resolve(err.payload); } return Promise.reject(err); }); }; ThreeDSecure.prototype.cancel = function () { var self = this; return this._instance.cancelVerifyCard().then(function (payload) { self._rejectThreeDSecure({ type: 'THREE_D_SECURE_CANCELLED', payload: { nonce: payload.nonce, liabilityShifted: payload.liabilityShifted, liabilityShiftPossible: payload.liabilityShiftPossible } }); }).catch(function () { // only reason this would reject // is if there is no verification in progress // so we just swallow the error }).then(function () { self._cleanupModal(); }); }; ThreeDSecure.prototype.updateConfiguration = function (key, value) { this._config[key] = value; }; ThreeDSecure.prototype.teardown = function () { return this._instance.teardown(); }; ThreeDSecure.prototype._cleanupModal = function () { var iframe = this._modal.querySelector('iframe'); classlist.remove(this._modal.querySelector('.braintree-three-d-secure__modal'), 'braintree-three-d-secure__frame_visible'); classlist.remove(this._modal.querySelector('.braintree-three-d-secure__backdrop'), 'braintree-three-d-secure__frame_visible'); if (iframe && iframe.parentNode) { iframe.parentNode.removeChild(iframe); } setTimeout(function () { if (this._modal.parentNode) { this._modal.parentNode.removeChild(this._modal); } }.bind(this), 300); }; ThreeDSecure.prototype._setupModal = function (cardVerificationString) { var self = this; var modal = document.createElement('div'); modal.innerHTML = "
\n
\n
\n
\n
\n \n \n \n
\n
\n
\n {{cardVerification}}\n
\n \n \n \n
\n
\n
\n
\n
\n
\n" .replace('{{cardVerification}}', cardVerificationString); modal.querySelector('.braintree-three-d-secure__modal-close').addEventListener('click', function () { self.cancel(); }); return modal; }; ThreeDSecure.prototype._waitForThreeDSecure = function () { var self = this; return new Promise(function (resolve, reject) { self._resolveThreeDSecure = resolve; self._rejectThreeDSecure = reject; }); }; ThreeDSecure.prototype._revealModal = function () { document.body.appendChild(this._modal); classlist.add(this._modal.querySelector('.braintree-three-d-secure__backdrop'), 'braintree-three-d-secure__frame_visible'); setTimeout(function () { classlist.add(this._modal.querySelector('.braintree-three-d-secure__modal'), 'braintree-three-d-secure__frame_visible'); }.bind(this), 10); }; module.exports = ThreeDSecure; },{"./classlist":126,"./promise":137,"braintree-web/three-d-secure":97}],141:[function(require,module,exports){ 'use strict'; var browserDetection = require('./browser-detection'); function isHidden(element) { if (!element) { // no parentNode, so nothing containing the element is hidden return false; } if (element.style.display === 'none') { return true; } return isHidden(element.parentNode); } function onTransitionEnd(element, propertyName, callback) { if (browserDetection.isIe9() || isHidden(element)) { callback(); return; } function transitionEventListener(event) { if (event.propertyName === propertyName) { element.removeEventListener('transitionend', transitionEventListener); callback(); } } element.addEventListener('transitionend', transitionEventListener); } module.exports = { onTransitionEnd: onTransitionEnd }; },{"./browser-detection":125}],142:[function(require,module,exports){ 'use strict'; /* eslint-disable no-mixed-operators */ function uuid() { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { var r = Math.random() * 16 | 0; var v = c === 'x' ? r : r & 0x3 | 0x8; return v.toString(16); }); } module.exports = uuid; },{}],143:[function(require,module,exports){ 'use strict'; module.exports = { "payingWith": "Betaler med {{paymentSource}}", "chooseAnotherWayToPay": "Vælg en anden betalingsmetode", "chooseAWayToPay": "Vælg, hvordan du vil betale", "otherWaysToPay": "Andre betalingsmetoder", "edit": "Rediger", "doneEditing": "Udført", "editPaymentMethods": "Rediger betalingsmetoder", "CreditCardDeleteConfirmationMessage": "Vil du slette {{secondaryIdentifier}}-kortet, der slutter på {{identifier}}?", "PayPalAccountDeleteConfirmationMessage": "Vil du slette PayPal-kontoen {{identifier}}?", "VenmoAccountDeleteConfirmationMessage": "Er du sikker på, at du vil slette Venmo-kontoen med brugernavnet {{identifier}}?", "genericDeleteConfirmationMessage": "Er du sikker på, at du vil slette denne betalingsmetode?", "deleteCancelButton": "Annuller", "deleteConfirmationButton": "Slet", "cardVerification": "Bekræftelse af kort", "fieldEmptyForCvv": "Du skal angive kontrolcifrene.", "fieldEmptyForExpirationDate": "Du skal angive udløbsdatoen.", "fieldEmptyForCardholderName": "Du skal angive kortindehaverens navn.", "fieldTooLongForCardholderName": "Kortejerens navn skal være mindre end 256 tegn.", "fieldEmptyForNumber": "Du skal angive et nummer.", "fieldEmptyForPostalCode": "Du skal angive et postnummer.", "fieldInvalidForCvv": "Sikkerhedskoden er ugyldig.", "fieldInvalidForExpirationDate": "Udløbsdatoen er ugyldig.", "fieldInvalidForNumber": "Kortnummeret er ugyldigt.", "fieldInvalidForPostalCode": "Postnummeret er ugyldigt.", "genericError": "Der opstod en fejl.", "hostedFieldsTokenizationFailOnDuplicateError": "Dette betalingskort er allerede en gemt betalingsmetode.", "hostedFieldsFailedTokenizationError": "Tjek oplysningerne, og prøv igen.", "hostedFieldsFieldsInvalidError": "Tjek oplysningerne, og prøv igen.", "hostedFieldsTokenizationNetworkErrorError": "Netværksfejl. Prøv igen.", "hostedFieldsTokenizationCvvVerificationFailedError": "Betalingskortet blev ikke bekræftet. Kontrollér oplysningerne, og prøv igen.", "paypalAccountTokenizationFailedError": "PayPal-kontoen blev ikke tilføjet. Prøv igen.", "paypalFlowFailedError": "Der kunne ikke oprettes forbindelse til PayPal. Prøv igen.", "paypalTokenizationRequestActiveError": "PayPal-betalingen er i gang med at blive autoriseret.", "venmoCanceledError": "Der opstod en fejl. Sørg for, at du har den seneste version af Venmo-appen installeret på din enhed, og at din browser understøtter skift til Venmo.", "vaultManagerPaymentMethodDeletionError": "Vi kunne ikke slette betalingsmetode. Prøv igen.", "venmoAppFailedError": "Venmo-appen blev ikke fundet på din enhed.", "unsupportedCardTypeError": "Korttypen understøttes ikke. Prøv et andet kort.", "applePayTokenizationError": "Der opstod en netværksfejl under behandlingen af betalingen med Apple Pay. Prøv igen.", "applePayActiveCardError": "Knyt et understøttet kort til din Apple Pay-e-pung.", "cardholderNameLabel": "Kortindehaverens navn", "cardNumberLabel": "Kortnummer", "cvvLabel": "Kontrolcifre", "cvvThreeDigitLabelSubheading": "(3 cifre)", "cvvFourDigitLabelSubheading": "(4 cifre)", "cardholderNamePlaceholder": "Kortindehaverens navn", "expirationDateLabel": "Udløbsdato", "expirationDateLabelSubheading": "(MM/ÅÅ)", "expirationDatePlaceholder": "MM/ÅÅ", "postalCodeLabel": "Postnummer", "payWithCard": "Betal med kort", "endingIn": "Der slutter på {{lastFourCardDigits}}", "Apple Pay": "Apple Pay", "Venmo": "Venmo", "Card": "Kort", "PayPal": "PayPal", "PayPal Credit": "PayPal Credit", "Google Pay": "Google Pay", "American Express": "American Express", "Discover": "Discover", "Diners Club": "Diners Club", "MasterCard": "Mastercard", "Visa": "Visa", "JCB": "JCB", "Maestro": "Maestro", "UnionPay": "UnionPay" }; },{}],144:[function(require,module,exports){ 'use strict'; module.exports = { "payingWith": "Zahlen mit {{paymentSource}}", "chooseAnotherWayToPay": "Andere Zahlungsmethode wählen", "chooseAWayToPay": "Wie möchten Sie bezahlen?", "otherWaysToPay": "Andere Zahlungsmethoden", "edit": "Bearbeiten", "doneEditing": "Fertig", "editPaymentMethods": "Zahlungsquellen bearbeiten", "CreditCardDeleteConfirmationMessage": "{{secondaryIdentifier}} Karte mit den Endziffern {{identifier}} löschen?", "PayPalAccountDeleteConfirmationMessage": "PayPal-Konto {{identifier}} löschen?", "VenmoAccountDeleteConfirmationMessage": "Wollen Sie das Venmo-Konto mit dem Benutzernamen {{identifier}} wirklich löschen?", "genericDeleteConfirmationMessage": "Wollen Sie diese Zahlungsquelle wirklich löschen?", "deleteCancelButton": "Abbrechen", "deleteConfirmationButton": "Löschen", "cardVerification": "Kartenbestätigung", "fieldEmptyForCvv": "Geben Sie die Kartenprüfnummer ein.", "fieldEmptyForExpirationDate": "Geben Sie das Ablaufdatum ein.", "fieldEmptyForCardholderName": "Geben Sie den Namen des Karteninhabers ein.", "fieldTooLongForCardholderName": "Der Name des Karteninhabers darf 255 Zeichen nicht übersteigen.", "fieldEmptyForNumber": "Geben Sie die Nummer ein.", "fieldEmptyForPostalCode": "Geben Sie die PLZ ein.", "fieldInvalidForCvv": "Die Kartenprüfnummer ist ungültig.", "fieldInvalidForExpirationDate": "Das Ablaufdatum ist ungültig.", "fieldInvalidForNumber": "Die Kreditkartennummer ist ungültig.", "fieldInvalidForPostalCode": "Die PLZ ist ungültig.", "genericError": "Bei uns ist ein Problem aufgetreten.", "hostedFieldsTokenizationFailOnDuplicateError": "Diese Kreditkarte ist bereits als gespeicherte Zahlungsmethode vorhanden.", "hostedFieldsFailedTokenizationError": "Überprüfen Sie Ihre Eingabe und versuchen Sie es erneut.", "hostedFieldsFieldsInvalidError": "Überprüfen Sie Ihre Eingabe und versuchen Sie es erneut.", "hostedFieldsTokenizationNetworkErrorError": "Netzwerkfehler. Versuchen Sie es erneut.", "hostedFieldsTokenizationCvvVerificationFailedError": "Überprüfung der Karte fehlgeschlagen. Überprüfen Sie Ihre Eingabe und versuchen Sie es erneut.", "paypalAccountTokenizationFailedError": "Beim Hinzufügen des PayPal-Kontos ist ein Problem aufgetreten. Versuchen Sie es erneut.", "paypalFlowFailedError": "Beim Verbinden mit PayPal ist ein Problem aufgetreten. Versuchen Sie es erneut.", "paypalTokenizationRequestActiveError": "Die PayPal-Zahlung wird bereits autorisiert.", "venmoCanceledError": "Etwas ist schief gelaufen. Vergewissern Sie sich, dass Sie die neueste Version der Venmo-App auf Ihrem Gerät installiert haben und Ihr Browser den Wechsel zu Venmo unterstützt.", "vaultManagerPaymentMethodDeletionError": "Die Zahlungsquelle konnte nicht gelöscht werden. Versuchen Sie es erneut.", "venmoAppFailedError": "Die Venmo-App wurde auf Ihrem Gerät nicht gefunden.", "unsupportedCardTypeError": "Dieser Kreditkartentyp wird nicht unterstützt. Versuchen Sie es mit einer anderen Karte.", "applePayTokenizationError": "Netzwerkfehler bei der Zahlungsabwicklung mit Apple Pay. Versuchen Sie es erneut.", "applePayActiveCardError": "Fügen Sie der Apple-Pay-Börse eine unterstützte Kreditkarte hinzu.", "cardholderNameLabel": "Name des Karteninhabers", "cardNumberLabel": "Kartennummer", "cvvLabel": "Prüfnr.", "cvvThreeDigitLabelSubheading": "(3-stellig)", "cvvFourDigitLabelSubheading": "(4-stellig)", "cardholderNamePlaceholder": "Name des Karteninhabers", "expirationDateLabel": "Gültig bis", "expirationDateLabelSubheading": "(MM/JJ)", "expirationDatePlaceholder": "MM/JJ", "postalCodeLabel": "PLZ", "payWithCard": "Mit Kreditkarte zahlen", "endingIn": "Mit den Endziffern {{lastFourCardDigits}}", "Apple Pay": "Apple Pay", "Venmo": "Venmo", "Card": "Kreditkarte", "PayPal": "PayPal", "PayPal Credit": "PayPal Credit", "Google Pay": "Google Pay", "American Express": "American Express", "Discover": "Discover", "Diners Club": "Diners Club", "MasterCard": "Mastercard", "Visa": "Visa", "JCB": "JCB", "Maestro": "Maestro", "UnionPay": "UnionPay" }; },{}],145:[function(require,module,exports){ 'use strict'; module.exports = { "payingWith": "Paying with {{paymentSource}}", "chooseAnotherWayToPay": "Choose another way to pay", "chooseAWayToPay": "Choose a way to pay", "otherWaysToPay": "Other ways to pay", "edit": "Edit", "doneEditing": "Done", "editPaymentMethods": "Edit payment methods", "CreditCardDeleteConfirmationMessage": "Delete {{secondaryIdentifier}} card ending in {{identifier}}?", "PayPalAccountDeleteConfirmationMessage": "Delete PayPal account {{identifier}}?", "VenmoAccountDeleteConfirmationMessage": "Are you sure you want to delete the Venmo account with username {{identifier}}?", "genericDeleteConfirmationMessage": "Are you sure you want to delete this payment method?", "deleteCancelButton": "Cancel", "deleteConfirmationButton": "Delete", "cardVerification": "Card verification", "fieldEmptyForCvv": "Please fill out a CVV.", "fieldEmptyForExpirationDate": "Please fill out an expiry date.", "fieldEmptyForCardholderName": "Please fill out a cardholder name.", "fieldTooLongForCardholderName": "Cardholder name must be less than 256 characters.", "fieldEmptyForNumber": "Please fill out a number.", "fieldEmptyForPostalCode": "Please fill out a postcode.", "fieldInvalidForCvv": "This security code is not valid.", "fieldInvalidForExpirationDate": "This expiry date is not valid.", "fieldInvalidForNumber": "This card number is not valid.", "fieldInvalidForPostalCode": "This postcode is not valid.", "genericError": "Something went wrong on our end.", "hostedFieldsTokenizationFailOnDuplicateError": "This credit card already exists as a saved payment method.", "hostedFieldsFailedTokenizationError": "Check your entries and try again.", "hostedFieldsFieldsInvalidError": "Check your entries and try again.", "hostedFieldsTokenizationNetworkErrorError": "Network error. Please try again.", "hostedFieldsTokenizationCvvVerificationFailedError": "Credit card verification failed. Check your entries and try again.", "paypalAccountTokenizationFailedError": "Something went wrong while adding the PayPal account. Please try again.", "paypalFlowFailedError": "Something went wrong while connecting to PayPal. Please try again.", "paypalTokenizationRequestActiveError": "PayPal payment authorisation is already in progress.", "venmoCanceledError": "We're sorry, something seems to have gone wrong. Please ensure you have the most recent version of the Venmo app installed on your device and your browser supports switching to Venmo.", "vaultManagerPaymentMethodDeletionError": "Unable to delete payment method, try again.", "venmoAppFailedError": "The Venmo app wasn't found on your device.", "unsupportedCardTypeError": "This card type is not supported. Please try another card.", "applePayTokenizationError": "A network error occurred while processing the Apple Pay payment. Please try again.", "applePayActiveCardError": "Link a supported card to your Apple Pay wallet.", "cardholderNameLabel": "Cardholder Name", "cardNumberLabel": "Card Number", "cvvLabel": "CVV", "cvvThreeDigitLabelSubheading": "(3 digits)", "cvvFourDigitLabelSubheading": "(4 digits)", "cardholderNamePlaceholder": "Cardholder Name", "expirationDateLabel": "Expiry date", "expirationDateLabelSubheading": "(MM/YY)", "expirationDatePlaceholder": "MM/YY", "postalCodeLabel": "Postcode", "payWithCard": "Pay with credit or debit card", "endingIn": "Ending in {{lastFourCardDigits}}", "Apple Pay": "Apple Pay", "Venmo": "Venmo", "Card": "Card", "PayPal": "PayPal", "PayPal Credit": "PayPal Credit", "Google Pay": "Google Pay", "American Express": "American Express", "Discover": "Discover", "Diners Club": "Diners Club", "MasterCard": "Mastercard", "Visa": "Visa", "JCB": "JCB", "Maestro": "Maestro", "UnionPay": "UnionPay" }; },{}],146:[function(require,module,exports){ 'use strict'; module.exports = { "payingWith": "Paying with {{paymentSource}}", "chooseAnotherWayToPay": "Choose another way to pay", "chooseAWayToPay": "Choose a way to pay", "otherWaysToPay": "Other ways to pay", "edit": "Edit", "doneEditing": "Done", "editPaymentMethods": "Edit funding sources", "CreditCardDeleteConfirmationMessage": "Delete {{secondaryIdentifier}} card ending in {{identifier}}?", "PayPalAccountDeleteConfirmationMessage": "Delete PayPal account {{identifier}}?", "VenmoAccountDeleteConfirmationMessage": "Are you sure you want to delete the Venmo account with username {{identifier}}?", "genericDeleteConfirmationMessage": "Are you sure you want to delete this funding source?", "deleteCancelButton": "Cancel", "deleteConfirmationButton": "Delete", "cardVerification": "Card Verification", "fieldEmptyForCvv": "Please fill in a CSC.", "fieldEmptyForExpirationDate": "Please fill in an expiry date.", "fieldEmptyForCardholderName": "Please fill in a cardholder name.", "fieldTooLongForCardholderName": "Cardholder name must be less than 256 characters.", "fieldEmptyForNumber": "Please fill in a number.", "fieldEmptyForPostalCode": "Please fill in a postcode.", "fieldInvalidForCvv": "This security code is not valid.", "fieldInvalidForExpirationDate": "This expiry date is not valid.", "fieldInvalidForNumber": "This card number is not valid.", "fieldInvalidForPostalCode": "This postcode is not valid.", "genericError": "Something went wrong on our end.", "hostedFieldsTokenizationFailOnDuplicateError": "This credit card has already been added to your account as a funding source.", "hostedFieldsFailedTokenizationError": "Please check your information and try again.", "hostedFieldsFieldsInvalidError": "Please check your information and try again.", "hostedFieldsTokenizationNetworkErrorError": "Network error. Please try again.", "hostedFieldsTokenizationCvvVerificationFailedError": "Credit card verification failed. Please check your information and try again.", "paypalAccountTokenizationFailedError": "Something went wrong while adding the PayPal account. Please try again.", "paypalFlowFailedError": "Something went wrong while connecting to PayPal. Please try again.", "paypalTokenizationRequestActiveError": "PayPal payment authorisation is already in progress.", "venmoCanceledError": "We're sorry, something seems to have gone wrong. Make sure you have the most recent version of the Venmo app installed on your device and your browser supports the switch to Venmo.", "vaultManagerPaymentMethodDeletionError": "Unable to delete funding source, try again.", "venmoAppFailedError": "The Venmo app isn't on your device.", "unsupportedCardTypeError": "This card type is not supported. Please try another card.", "applePayTokenizationError": "A network error occurred while processing the Apple Pay payment. Please try again.", "applePayActiveCardError": "Add a supported card to your Apple Pay wallet.", "cardholderNameLabel": "Cardholder Name", "cardNumberLabel": "Card Number", "cvvLabel": "CSC", "cvvThreeDigitLabelSubheading": "(3 digits)", "cvvFourDigitLabelSubheading": "(4 digits)", "cardholderNamePlaceholder": "Cardholder Name", "expirationDateLabel": "Expiry Date", "expirationDateLabelSubheading": "(MM/YY)", "expirationDatePlaceholder": "MM/YY", "postalCodeLabel": "Postcode", "payWithCard": "Pay with card", "endingIn": "Ending in {{lastFourCardDigits}}", "Apple Pay": "Apple Pay", "Venmo": "Venmo", "Card": "Card", "PayPal": "PayPal", "PayPal Credit": "PayPal Credit", "Google Pay": "Google Pay", "American Express": "American Express", "Discover": "Discover", "Diners Club": "Diners Club", "MasterCard": "Mastercard", "Visa": "Visa", "JCB": "JCB", "Maestro": "Maestro", "UnionPay": "UnionPay" }; },{}],147:[function(require,module,exports){ 'use strict'; module.exports = { payingWith: 'Paying with {{paymentSource}}', chooseAnotherWayToPay: 'Choose another way to pay', chooseAWayToPay: 'Choose a way to pay', otherWaysToPay: 'Other ways to pay', edit: 'Edit', doneEditing: 'Done', editPaymentMethods: 'Edit payment methods', CreditCardDeleteConfirmationMessage: 'Delete {{secondaryIdentifier}} card ending in {{identifier}}?', PayPalAccountDeleteConfirmationMessage: 'Delete PayPal account {{identifier}}?', VenmoAccountDeleteConfirmationMessage: 'Are you sure you want to delete Venmo account with username {{identifier}}?', genericDeleteConfirmationMessage: 'Are you sure you want to delete this payment method?', deleteCancelButton: 'Cancel', deleteConfirmationButton: 'Delete', cardVerification: 'Card Verification', // Errors fieldEmptyForCvv: 'Please fill out a CVV.', fieldEmptyForExpirationDate: 'Please fill out an expiration date.', fieldEmptyForCardholderName: 'Please fill out a cardholder name.', fieldEmptyForNumber: 'Please fill out a card number.', fieldEmptyForPostalCode: 'Please fill out a postal code.', fieldInvalidForCvv: 'This security code is not valid.', fieldInvalidForExpirationDate: 'This expiration date is not valid.', fieldInvalidForNumber: 'This card number is not valid.', fieldInvalidForPostalCode: 'This postal code is not valid.', fieldTooLongForCardholderName: 'Cardholder name must be less than 256 characters.', genericError: 'Something went wrong on our end.', hostedFieldsTokenizationFailOnDuplicateError: 'This credit card already exists as a saved payment method.', hostedFieldsFailedTokenizationError: 'Please check your information and try again.', hostedFieldsTokenizationCvvVerificationFailedError: 'Credit card verification failed. Please check your information and try again.', hostedFieldsTokenizationNetworkErrorError: 'Network error. Please try again.', hostedFieldsFieldsInvalidError: 'Please check your information and try again.', paypalAccountTokenizationFailedError: 'Something went wrong adding the PayPal account. Please try again.', paypalFlowFailedError: 'Something went wrong connecting to PayPal. Please try again.', paypalTokenizationRequestActiveError: 'PayPal payment authorization is already in progress.', applePayTokenizationError: 'A network error occurred while processing the Apple Pay payment. Please try again.', applePayActiveCardError: 'Add a supported card to your Apple Pay wallet.', vaultManagerPaymentMethodDeletionError: 'Unable to delete payment method, try again.', venmoCanceledError: 'Something went wrong. Ensure you have the most recent version of the Venmo app installed on your device and your browser supports switching to Venmo.', venmoAppFailedError: 'The Venmo app could not be found on your device.', unsupportedCardTypeError: 'This card type is not supported. Please try another card.', // Card form cardholderNameLabel: 'Cardholder Name', cardNumberLabel: 'Card Number', cvvLabel: 'CVV', cvvThreeDigitLabelSubheading: '(3 digits)', cvvFourDigitLabelSubheading: '(4 digits)', expirationDateLabel: 'Expiration Date', expirationDateLabelSubheading: '(MM/YY)', cardholderNamePlaceholder: 'Cardholder Name', expirationDatePlaceholder: 'MM/YY', postalCodeLabel: 'Postal Code', payWithCard: 'Pay with card', // Payment Method descriptions endingIn: 'Ending in {{lastFourCardDigits}}', Card: 'Card', PayPal: 'PayPal', 'PayPal Credit': 'PayPal Credit', 'Apple Pay': 'Apple Pay', 'Google Pay': 'Google Pay', 'Venmo': 'Venmo', 'American Express': 'American Express', Discover: 'Discover', 'Diners Club': 'Diners Club', MasterCard: 'Mastercard', Visa: 'Visa', JCB: 'JCB', Maestro: 'Maestro', UnionPay: 'UnionPay' }; },{}],148:[function(require,module,exports){ 'use strict'; module.exports = { "payingWith": "Pago con {{paymentSource}}", "chooseAnotherWayToPay": "Selecciona otra forma de pago.", "chooseAWayToPay": "Selecciona una forma de pago.", "otherWaysToPay": "Otras formas de pago", "edit": "Modificar", "doneEditing": "Hecho", "editPaymentMethods": "Editar formas de pago", "CreditCardDeleteConfirmationMessage": "¿Quieres eliminar la tarjeta {{secondaryIdentifier}} que termina en {{identifier}}?", "PayPalAccountDeleteConfirmationMessage": "¿Quieres eliminar la cuenta PayPal {{identifier}}?", "VenmoAccountDeleteConfirmationMessage": "¿Seguro de que deseas eliminar la cuenta de Venmo con nombre de usuario {{identifier}}?", "genericDeleteConfirmationMessage": "¿Seguro que deseas eliminar esta forma de pago?", "deleteCancelButton": "Cancelar", "deleteConfirmationButton": "Eliminar", "cardVerification": "Verificación de tarjeta", "fieldEmptyForCvv": "Escribe el código CVV.", "fieldEmptyForExpirationDate": "Escribe la fecha de vencimiento.", "fieldEmptyForCardholderName": "Escribe el nombre de un titular de la tarjeta.", "fieldTooLongForCardholderName": "El nombre del titular de la tarjeta debe tener menos de 256 caracteres.", "fieldEmptyForNumber": "Escribe un número.", "fieldEmptyForPostalCode": "Escribe el código postal.", "fieldInvalidForCvv": "Este código de seguridad no es válido.", "fieldInvalidForExpirationDate": "Esta fecha de vencimiento no es válida.", "fieldInvalidForNumber": "Este número de tarjeta no es válido.", "fieldInvalidForPostalCode": "Este código postal no es válido.", "genericError": "Hemos tenido algún problema.", "hostedFieldsTokenizationFailOnDuplicateError": "Esta tarjeta de crédito ya existe como forma de pago guardada.", "hostedFieldsFailedTokenizationError": "Comprueba la información e inténtalo de nuevo.", "hostedFieldsFieldsInvalidError": "Comprueba la información e inténtalo de nuevo.", "hostedFieldsTokenizationNetworkErrorError": "Error de red. Inténtalo de nuevo.", "hostedFieldsTokenizationCvvVerificationFailedError": "Error de verificación de la tarjeta de crédito. Comprueba la información e inténtalo de nuevo.", "paypalAccountTokenizationFailedError": "Se ha producido un error al vincular la cuenta PayPal. Inténtalo de nuevo.", "paypalFlowFailedError": "Se ha producido un error al conectarse a PayPal. Inténtalo de nuevo.", "paypalTokenizationRequestActiveError": "Ya hay una autorización de pago de PayPal en curso.", "venmoCanceledError": "Ha habido un problema. Asegúrate de que tienes la versión más reciente de la aplicación de Venmo instalada en tu dispositivo y de que tu navegador es compatible con cambiar a Venmo.", "vaultManagerPaymentMethodDeletionError": "No se ha podido eliminar la forma de pago. Inténtalo de nuevo.", "venmoAppFailedError": "No se ha encontrado la aplicación de Venmo en tu dispositivo.", "unsupportedCardTypeError": "No se admite este tipo de tarjeta. Prueba con otra tarjeta.", "applePayTokenizationError": "Se ha producido un error de red al procesar el pago con Apple Pay. Inténtalo de nuevo.", "applePayActiveCardError": "Añade una tarjeta admitida a tu Wallet de Apple Pay.", "cardholderNameLabel": "Nombre del titular de la tarjeta", "cardNumberLabel": "Número de tarjeta", "cvvLabel": "CVV", "cvvThreeDigitLabelSubheading": "(3 dígitos)", "cvvFourDigitLabelSubheading": "(4 dígitos)", "cardholderNamePlaceholder": "Nombre del titular de la tarjeta", "expirationDateLabel": "Fecha de vencimiento", "expirationDateLabelSubheading": "(MM/AA)", "expirationDatePlaceholder": "MM/AA", "postalCodeLabel": "Código postal", "payWithCard": "Pagar con tarjeta", "endingIn": "Terminada en {{lastFourCardDigits}}", "Apple Pay": "Apple Pay", "Venmo": "Venmo", "Card": "Tarjeta", "PayPal": "PayPal", "PayPal Credit": "PayPal Credit", "Google Pay": "Google Pay", "American Express": "American Express", "Discover": "Discover", "Diners Club": "Diners Club", "MasterCard": "Mastercard", "Visa": "Visa", "JCB": "JCB", "Maestro": "Maestro", "UnionPay": "UnionPay" }; },{}],149:[function(require,module,exports){ 'use strict'; module.exports = { "payingWith": "Payer avec {{paymentSource}}", "chooseAnotherWayToPay": "Choisir un autre mode de paiement", "chooseAWayToPay": "Choisir le mode de paiement", "otherWaysToPay": "Autres modes de paiement", "edit": "Modifier", "doneEditing": "Terminé", "editPaymentMethods": "Modifier les modes de paiement", "CreditCardDeleteConfirmationMessage": "Supprimer la carte {{secondaryIdentifier}} se terminant par {{identifier}}?", "PayPalAccountDeleteConfirmationMessage": "Supprimer le compte PayPal {{identifier}}?", "VenmoAccountDeleteConfirmationMessage": "Souhaitez-vous vraiment supprimer le compte Venmo avec le nom d’utilisateur {{identifier}}?", "genericDeleteConfirmationMessage": "Voulez-vous vraiment supprimer ce mode de paiement?", "deleteCancelButton": "Annuler", "deleteConfirmationButton": "Supprimer", "cardVerification": "Vérification de la carte", "fieldEmptyForCvv": "Veuillez saisir un cryptogramme visuel.", "fieldEmptyForExpirationDate": "Veuillez saisir une date d'expiration.", "fieldEmptyForCardholderName": "Veuillez saisir un nom de titulaire de la carte.", "fieldTooLongForCardholderName": "Le nom du titulaire de la carte doit contenir moins de 256 caractères.", "fieldEmptyForNumber": "Veuillez saisir un numéro.", "fieldEmptyForPostalCode": "Veuillez saisir un code postal.", "fieldInvalidForCvv": "Ce cryptogramme visuel n'est pas valide.", "fieldInvalidForExpirationDate": "Cette date d'expiration n'est pas valide.", "fieldInvalidForNumber": "Ce numéro de carte n'est pas valide.", "fieldInvalidForPostalCode": "Ce code postal n'est pas valide.", "genericError": "Une erreur s'est produite de notre côté.", "hostedFieldsTokenizationFailOnDuplicateError": "Cette carte de crédit existe déjà comme mode de paiement enregistré.", "hostedFieldsFailedTokenizationError": "Vérifiez vos informations, puis réessayez.", "hostedFieldsFieldsInvalidError": "Vérifiez vos informations, puis réessayez.", "hostedFieldsTokenizationNetworkErrorError": "Erreur réseau. Veuillez réessayer.", "hostedFieldsTokenizationCvvVerificationFailedError": "La vérification de la carte de crédit a échoué. Vérifiez vos informations, puis réessayez.", "paypalAccountTokenizationFailedError": "Une erreur s'est produite lors de l'enregistrement du compte PayPal. Veuillez réessayer.", "paypalFlowFailedError": "Une erreur s'est produite au cours de la connexion à PayPal. Veuillez réessayer.", "paypalTokenizationRequestActiveError": "L'autorisation de paiement PayPal est déjà en cours.", "venmoCanceledError": "Une erreur s'est produite. Assurez-vous que la version la plus récente de l'application Venmo est installée sur votre appareil et que votre navigateur prend Venmo en charge.", "vaultManagerPaymentMethodDeletionError": "Impossible de supprimer le mode de paiement, essayez de nouveau.", "venmoAppFailedError": "L'application Venmo est introuvable sur votre appareil.", "unsupportedCardTypeError": "Ce type de carte n'est pas pris en charge. Veuillez essayer une autre carte.", "applePayTokenizationError": "Une erreur de réseau s'est produite lors du traitement du paiement avec Apple Pay. Veuillez réessayer.", "applePayActiveCardError": "Ajoutez une carte prise en charge à Apple Pay.", "cardholderNameLabel": "Nom du titulaire de la carte", "cardNumberLabel": "Numéro de carte", "cvvLabel": "CVV", "cvvThreeDigitLabelSubheading": "(3 chiffres)", "cvvFourDigitLabelSubheading": "(4 chiffres)", "cardholderNamePlaceholder": "Nom du titulaire de la carte", "expirationDateLabel": "Date d'expiration", "expirationDateLabelSubheading": "(MM/AA)", "expirationDatePlaceholder": "MM/AA", "postalCodeLabel": "Code postal", "payWithCard": "Payer par carte", "endingIn": "Se terminant par {{lastFourCardDigits}}", "Apple Pay": "Apple Pay", "Venmo": "Venmo", "Card": "Carte", "PayPal": "PayPal", "PayPal Credit": "PayPal Credit", "Google Pay": "Google Pay", "American Express": "American Express", "Discover": "Discover", "Diners Club": "Diners Club", "MasterCard": "Mastercard", "Visa": "Visa", "JCB": "JCB", "Maestro": "Maestro", "UnionPay": "UnionPay" }; },{}],150:[function(require,module,exports){ 'use strict'; module.exports = { "payingWith": "Payer avec {{paymentSource}}", "chooseAnotherWayToPay": "Choisissez une autre façon de payer.", "chooseAWayToPay": "Choisissez comment payer.", "otherWaysToPay": "Autres façons de payer", "edit": "Modifier", "doneEditing": "Terminé", "editPaymentMethods": "Modifier les sources d'approvisionnement", "CreditCardDeleteConfirmationMessage": "Supprimer la carte {{secondaryIdentifier}} se terminant par {{identifier}} ?", "PayPalAccountDeleteConfirmationMessage": "Supprimer le compte PayPal {{identifier}} ?", "VenmoAccountDeleteConfirmationMessage": "Êtes-vous sûr de vouloir supprimer le compte Venmo avec le nom d'utilisateur {{identifier}} ?", "genericDeleteConfirmationMessage": "Êtes-vous sûr de vouloir supprimer cette source d'approvisionnement ?", "deleteCancelButton": "Annuler", "deleteConfirmationButton": "Supprimer", "cardVerification": "Vérification de la carte", "fieldEmptyForCvv": "Entrez un cryptogramme visuel.", "fieldEmptyForExpirationDate": "Entrez une date d'expiration.", "fieldEmptyForCardholderName": "Entrez un nom du titulaire de la carte.", "fieldTooLongForCardholderName": "Le nom du titulaire de la carte doit contenir moins de 256 caractères.", "fieldEmptyForNumber": "Entrez un numéro.", "fieldEmptyForPostalCode": "Entrez un code postal.", "fieldInvalidForCvv": "Ce cryptogramme visuel n'est pas valide.", "fieldInvalidForExpirationDate": "Cette date d'expiration n'est pas valide.", "fieldInvalidForNumber": "Ce numéro de carte n'est pas valide.", "fieldInvalidForPostalCode": "Ce code postal n'est pas valide.", "genericError": "Une erreur est survenue.", "hostedFieldsTokenizationFailOnDuplicateError": "Cette carte bancaire existe déjà comme mode de paiement enregistré.", "hostedFieldsFailedTokenizationError": "Vérifiez vos informations et réessayez.", "hostedFieldsFieldsInvalidError": "Vérifiez vos informations et réessayez.", "hostedFieldsTokenizationNetworkErrorError": "Erreur réseau. Réessayez.", "hostedFieldsTokenizationCvvVerificationFailedError": "Échec de vérification de la carte bancaire. Vérifiez vos informations et réessayez.", "paypalAccountTokenizationFailedError": "Une erreur est survenue lors de l'ajout du compte PayPal. Réessayez.", "paypalFlowFailedError": "Une erreur est survenue lors de la connexion à PayPal. Réessayez.", "paypalTokenizationRequestActiveError": "L'autorisation de paiement PayPal est déjà en cours.", "venmoCanceledError": "Une erreur est survenue. Vérifiez que vous disposez de la dernière version de l'application Venmo sur votre appareil et que votre navigateur prend en charge la redirection vers Venmo.", "vaultManagerPaymentMethodDeletionError": "Impossible de supprimer la source d'approvisionnement. Réessayez.", "venmoAppFailedError": "L'application Venmo est introuvable sur votre appareil.", "unsupportedCardTypeError": "Ce type de carte n'est pas pris en charge. Essayez une autre carte.", "applePayTokenizationError": "Une erreur réseau s'est produite lors du traitement du paiement Apple Pay. Réessayez.", "applePayActiveCardError": "Enregistrez une carte prise en charge sur Apple Pay.", "cardholderNameLabel": "Nom du titulaire de la carte", "cardNumberLabel": "Nº de carte", "cvvLabel": "Cryptogramme visuel", "cvvThreeDigitLabelSubheading": "(3 chiffres)", "cvvFourDigitLabelSubheading": "(4 chiffres)", "cardholderNamePlaceholder": "Nom du titulaire de la carte", "expirationDateLabel": "Date d'expiration", "expirationDateLabelSubheading": "(MM/AA)", "expirationDatePlaceholder": "MM/AA", "postalCodeLabel": "Code postal", "payWithCard": "Payer par carte", "endingIn": "Se terminant par {{lastFourCardDigits}}", "Apple Pay": "Apple Pay", "Venmo": "Venmo", "Card": "Carte", "PayPal": "PayPal", "PayPal Credit": "PayPal Credit", "Google Pay": "Google Pay", "American Express": "American Express", "Discover": "Discover", "Diners Club": "Diners Club", "MasterCard": "Mastercard", "Visa": "Visa", "JCB": "JCB", "Maestro": "Maestro", "UnionPay": "UnionPay" }; },{}],151:[function(require,module,exports){ 'use strict'; module.exports = { "payingWith": "Membayar dengan {{paymentSource}}", "chooseAnotherWayToPay": "Pilih metode pembayaran lain", "chooseAWayToPay": "Pilih metode pembayaran", "otherWaysToPay": "Metode pembayaran lain", "edit": "Edit", "doneEditing": "Selesai", "editPaymentMethods": "Edit metode pembayaran", "CreditCardDeleteConfirmationMessage": "Hapus kartu {{secondaryIdentifier}} yang berakhiran {{identifier}}?", "PayPalAccountDeleteConfirmationMessage": "Hapus {{identifier}} rekening PayPal?", "VenmoAccountDeleteConfirmationMessage": "Apakah Anda yakin akan menghapus rekening Venmo dengan nama pengguna {{identifier}}?", "genericDeleteConfirmationMessage": "Apakah Anda yakin akan menghapus metode pembayaran ini?", "deleteCancelButton": "Batalkan", "deleteConfirmationButton": "Hapus", "cardVerification": "Verifikasi Kartu", "fieldEmptyForCvv": "Masukkan CVV.", "fieldEmptyForExpirationDate": "Masukkan tanggal akhir berlaku.", "fieldEmptyForCardholderName": "Masukkan nama pemegang kartu.", "fieldTooLongForCardholderName": "Nama pemegang kartu harus kurang dari 256 karakter.", "fieldEmptyForNumber": "Masukkan nomor.", "fieldEmptyForPostalCode": "Masukkan kode pos.", "fieldInvalidForCvv": "Kode keamanan ini tidak valid.", "fieldInvalidForExpirationDate": "Tanggal akhir berlaku ini tidak valid.", "fieldInvalidForNumber": "Nomor kartu ini tidak valid.", "fieldInvalidForPostalCode": "Kode pos ini tidak valid.", "genericError": "Terjadi kesalahan pada sistem kami.", "hostedFieldsTokenizationFailOnDuplicateError": "Kartu kredit ini sudah dimasukkan sebagai metode pembayaran tersimpan.", "hostedFieldsFailedTokenizationError": "Periksa informasi Anda dan coba lagi.", "hostedFieldsFieldsInvalidError": "Periksa informasi Anda dan coba lagi.", "hostedFieldsTokenizationNetworkErrorError": "Masalah jaringan. Coba lagi.", "hostedFieldsTokenizationCvvVerificationFailedError": "Verifikasi kartu kredit gagal. Periksa informasi Anda dan coba lagi.", "paypalAccountTokenizationFailedError": "Terjadi kesalahan saat menambahkan rekening PayPal. Coba lagi.", "paypalFlowFailedError": "Terjadi kesalahan saat menyambung ke PayPal. Coba lagi.", "paypalTokenizationRequestActiveError": "Otorisasi pembayaran PayPal sedang diproses.", "venmoCanceledError": "Terdapat kesalahan. Pastikan Anda telah menginstal aplikasi Venmo versi terbaru pada perangkat dan peramban Anda mendukung untuk beralih ke Venmo.", "vaultManagerPaymentMethodDeletionError": "Tidak dapat menghapus metode pembayaran, coba lagi.", "venmoAppFailedError": "Aplikasi Venmo tidak dapat ditemukan pada perangkat Anda.", "unsupportedCardTypeError": "Jenis kartu ini tidak didukung. Coba kartu lainnya.", "applePayTokenizationError": "Terjadi kesalahan jaringan sewaktu memproses pembayaran melalui Apple Pay. Coba lagi.", "applePayActiveCardError": "Tambahkan kartu yang didukung ke wallet Apple Pay.", "cardholderNameLabel": "Nama Pemegang Kartu", "cardNumberLabel": "Nomor Kartu", "cvvLabel": "CVV", "cvvThreeDigitLabelSubheading": "(3 angka)", "cvvFourDigitLabelSubheading": "(4 angka)", "cardholderNamePlaceholder": "Nama Pemegang Kartu", "expirationDateLabel": "Tanggal Kedaluwarsa", "expirationDateLabelSubheading": "(BB/TT)", "expirationDatePlaceholder": "BB/TT", "postalCodeLabel": "Kode Pos", "payWithCard": "Bayar dengan kartu", "endingIn": "Berakhiran {{lastTwoCardDigits}}", "Apple Pay": "Apple Pay", "Venmo": "Venmo", "Card": "Kartu", "PayPal": "PayPal", "PayPal Credit": "PayPal Credit", "Google Pay": "Google Pay", "American Express": "American Express", "Discover": "Discover", "Diners Club": "Diners Club", "MasterCard": "Mastercard", "Visa": "Visa", "JCB": "JCB", "Maestro": "Maestro", "UnionPay": "UnionPay" }; },{}],152:[function(require,module,exports){ /* eslint-disable camelcase */ 'use strict'; var assign = require('../lib/assign').assign; var fiveCharacterLocales = { da_DK: require('./da_DK'), de_DE: require('./de_DE'), en_US: require('./en_US'), en_AU: require('./en_AU'), en_GB: require('./en_GB'), es_ES: require('./es_ES'), fr_CA: require('./fr_CA'), fr_FR: require('./fr_FR'), id_ID: require('./id_ID'), it_IT: require('./it_IT'), ja_JP: require('./ja_JP'), ko_KR: require('./ko_KR'), nl_NL: require('./nl_NL'), no_NO: require('./no_NO'), pl_PL: require('./pl_PL'), pt_BR: require('./pt_BR'), pt_PT: require('./pt_PT'), ru_RU: require('./ru_RU'), sv_SE: require('./sv_SE'), th_TH: require('./th_TH'), zh_CN: require('./zh_CN'), zh_HK: require('./zh_HK'), zh_TW: require('./zh_TW') }; var twoCharacterLocaleAliases = { da: fiveCharacterLocales.da_DK, de: fiveCharacterLocales.de_DE, en: fiveCharacterLocales.en_US, es: fiveCharacterLocales.es_ES, fr: fiveCharacterLocales.fr_FR, id: fiveCharacterLocales.id_ID, it: fiveCharacterLocales.it_IT, ja: fiveCharacterLocales.ja_JP, ko: fiveCharacterLocales.ko_KR, nl: fiveCharacterLocales.nl_NL, no: fiveCharacterLocales.no_NO, pl: fiveCharacterLocales.pl_PL, pt: fiveCharacterLocales.pt_PT, ru: fiveCharacterLocales.ru_RU, sv: fiveCharacterLocales.sv_SE, th: fiveCharacterLocales.th_TH, zh: fiveCharacterLocales.zh_CN }; module.exports = { twoCharacterLocaleAliases: twoCharacterLocaleAliases, fiveCharacterLocales: fiveCharacterLocales, translations: assign({}, twoCharacterLocaleAliases, fiveCharacterLocales) }; /* eslint-enable camelcase */ },{"../lib/assign":124,"./da_DK":143,"./de_DE":144,"./en_AU":145,"./en_GB":146,"./en_US":147,"./es_ES":148,"./fr_CA":149,"./fr_FR":150,"./id_ID":151,"./it_IT":153,"./ja_JP":154,"./ko_KR":155,"./nl_NL":156,"./no_NO":157,"./pl_PL":158,"./pt_BR":159,"./pt_PT":160,"./ru_RU":161,"./sv_SE":162,"./th_TH":163,"./zh_CN":164,"./zh_HK":165,"./zh_TW":166}],153:[function(require,module,exports){ 'use strict'; module.exports = { "payingWith": "Pagamento con {{paymentSource}}", "chooseAnotherWayToPay": "Scegli di pagare in un altro modo", "chooseAWayToPay": "Scegli come pagare", "otherWaysToPay": "Altri modi di pagare", "edit": "Modifica", "doneEditing": "Fine", "editPaymentMethods": "Modifica i metodi di pagamento", "CreditCardDeleteConfirmationMessage": "Eliminare la carta {{secondaryIdentifier}} le cui ultime cifre sono {{identifier}}?", "PayPalAccountDeleteConfirmationMessage": "Eliminare il conto PayPal {{identifier}}?", "VenmoAccountDeleteConfirmationMessage": "Vuoi eliminare il conto Venmo con nome utente {{identifier}}?", "genericDeleteConfirmationMessage": "Vuoi eliminare questo metodo di pagamento?", "deleteCancelButton": "Annulla", "deleteConfirmationButton": "Rimuovi", "cardVerification": "Codice di sicurezza", "fieldEmptyForCvv": "Immetti il codice di sicurezza (CVV).", "fieldEmptyForExpirationDate": "Immetti la data di scadenza.", "fieldEmptyForCardholderName": "Immetti il nome del titolare della carta.", "fieldTooLongForCardholderName": "Il nome del titolare della carta deve avere meno di 256 caratteri.", "fieldEmptyForNumber": "Immetti il numero di carta.", "fieldEmptyForPostalCode": "Immetti il CAP.", "fieldInvalidForCvv": "Il codice di sicurezza non è valido.", "fieldInvalidForExpirationDate": "La data di scadenza non è valida.", "fieldInvalidForNumber": "Il numero di carta non è valido.", "fieldInvalidForPostalCode": "Il CAP non è valido.", "genericError": "Si è verificato un errore nei nostri sistemi.", "hostedFieldsTokenizationFailOnDuplicateError": "Questa carta di credito è già registrata come metodo di pagamento salvato.", "hostedFieldsFailedTokenizationError": "Controlla e riprova.", "hostedFieldsFieldsInvalidError": "Controlla e riprova.", "hostedFieldsTokenizationNetworkErrorError": "Errore di rete. Riprova.", "hostedFieldsTokenizationCvvVerificationFailedError": "La verifica della carta di credito non è andata a buon fine. Controlla i dati e riprova.", "paypalAccountTokenizationFailedError": "Si è verificato un errore nel collegamento del conto PayPal. Riprova.", "paypalFlowFailedError": "Si è verificato un errore di connessione a PayPal. Riprova.", "paypalTokenizationRequestActiveError": "L'autorizzazione di pagamento PayPal è già in corso.", "venmoCanceledError": "Si è verificato un errore. Assicurati di avere la versione più recente dell'app Venmo installata sul tuo dispositivo e che il browser supporti l'uso di Venmo.", "vaultManagerPaymentMethodDeletionError": "Impossibile eliminare il metodo di pagamento; riprova.", "venmoAppFailedError": "Impossibile trovare l'app Venmo sul dispositivo in uso.", "unsupportedCardTypeError": "Questo tipo di carta non è supportato. Prova con un'altra carta.", "applePayTokenizationError": "Si è verificato un errore di rete durante l'elaborazione del pagamento con Apple Pay. Riprova.", "applePayActiveCardError": "Collega una carta supportata al tuo Apple Pay Wallet.", "cardholderNameLabel": "Titolare della carta", "cardNumberLabel": "Numero di carta", "cvvLabel": "CVV", "cvvThreeDigitLabelSubheading": "(3 cifre)", "cvvFourDigitLabelSubheading": "(4 cifre)", "cardholderNamePlaceholder": "Titolare della carta", "expirationDateLabel": "Data di scadenza", "expirationDateLabelSubheading": "(MM/AA)", "expirationDatePlaceholder": "MM/AA", "postalCodeLabel": "CAP", "payWithCard": "Paga con una carta", "endingIn": "Le cui ultime cifre sono {{lastFourCardDigits}}", "Apple Pay": "Apple Pay", "Venmo": "Venmo", "Card": "Carta", "PayPal": "PayPal", "PayPal Credit": "PayPal Credit", "Google Pay": "Google Pay", "American Express": "American Express", "Discover": "Discover", "Diners Club": "Diners Club", "MasterCard": "Mastercard", "Visa": "Visa", "JCB": "JCB", "Maestro": "Maestro", "UnionPay": "UnionPay" }; },{}],154:[function(require,module,exports){ 'use strict'; module.exports = { "payingWith": "{{paymentSource}}で支払う", "chooseAnotherWayToPay": "別の支払方法を選択する", "chooseAWayToPay": "支払方法を選択する", "otherWaysToPay": "その他の支払方法", "edit": "編集", "doneEditing": "完了", "editPaymentMethods": "支払方法の編集", "CreditCardDeleteConfirmationMessage": "末尾が{{identifier}}の{{secondaryIdentifier}}カードを削除しますか?", "PayPalAccountDeleteConfirmationMessage": "PayPalアカウント{{identifier}}を削除しますか?", "VenmoAccountDeleteConfirmationMessage": "ユーザー名{{identifier}}のVenmoアカウントを削除してよろしいですか?", "genericDeleteConfirmationMessage": "この支払い方法を削除してよろしいですか?", "deleteCancelButton": "キャンセル", "deleteConfirmationButton": "削除", "cardVerification": "カード確認", "fieldEmptyForCvv": "セキュリティコードを入力してください。", "fieldEmptyForExpirationDate": "有効期限を入力してください。", "fieldEmptyForCardholderName": "カード保有者の名前を入力してください。", "fieldTooLongForCardholderName": "カード保有者の名前は256文字未満にしてください。", "fieldEmptyForNumber": "番号を入力してください。", "fieldEmptyForPostalCode": "郵便番号を入力してください。", "fieldInvalidForCvv": "このセキュリティコードは無効です。", "fieldInvalidForExpirationDate": "この有効期限は無効です。", "fieldInvalidForNumber": "このカード番号は無効です。", "fieldInvalidForPostalCode": "この郵便番号は無効です。", "genericError": "弊社側で問題が発生しました。", "hostedFieldsTokenizationFailOnDuplicateError": "このクレジットカードは、保存済みの支払方法としてすでに登録されています。", "hostedFieldsFailedTokenizationError": "情報を確認してもう一度お試しください。", "hostedFieldsFieldsInvalidError": "情報を確認してもう一度お試しください。", "hostedFieldsTokenizationNetworkErrorError": "ネットワークエラーです。もう一度お試しください。", "hostedFieldsTokenizationCvvVerificationFailedError": "クレジットカードの認証に失敗しました。情報を確認してもう一度お試しください。", "paypalAccountTokenizationFailedError": "PayPalアカウントの追加で問題が発生しました。もう一度お試しください。", "paypalFlowFailedError": "PayPalへの接続に問題が発生しました。もう一度お試しください。", "paypalTokenizationRequestActiveError": "PayPal支払いの承認はすでに処理中です。", "venmoCanceledError": "問題が発生しました。お客さまの端末にインストールされているVenmoアプリが最新のバージョンであること、お使いのブラウザがVenmoへの切り替えをサポートしていることを確認してください。", "vaultManagerPaymentMethodDeletionError": "支払方法を削除できません。もう一度お試しください。", "venmoAppFailedError": "お客さまの端末でVenmoアプリが見つかりませんでした。", "unsupportedCardTypeError": "このカードタイプはサポートされていません。別のカードをご使用ください。", "applePayTokenizationError": "Apple Payの支払いを処理する際にネットワークエラーが発生しました。もう一度お試しください。", "applePayActiveCardError": "Apple Payウォレットに対応しているカードを追加してください。", "cardholderNameLabel": "カード保有者の名前", "cardNumberLabel": "カード番号", "cvvLabel": "セキュリティコード", "cvvThreeDigitLabelSubheading": "(3桁)", "cvvFourDigitLabelSubheading": "(4桁)", "cardholderNamePlaceholder": "カード保有者の名前", "expirationDateLabel": "有効期限", "expirationDateLabelSubheading": "(MM/YY)", "expirationDatePlaceholder": "MM/YY", "postalCodeLabel": "郵便番号", "payWithCard": "カードで支払う", "endingIn": "末尾が{{lastFourCardDigits}}", "Apple Pay": "Apple Pay", "Venmo": "Venmo", "Card": "カード", "PayPal": "PayPal", "PayPal Credit": "PayPal Credit", "Google Pay": "Google Pay", "American Express": "American Express", "Discover": "Discover", "Diners Club": "Diners Club", "MasterCard": "Mastercard", "Visa": "Visa", "JCB": "JCB", "Maestro": "Maestro", "UnionPay": "銀聯(UnionPay)" }; },{}],155:[function(require,module,exports){ 'use strict'; module.exports = { "payingWith": "{{paymentSource}}(으)로 결제", "chooseAnotherWayToPay": "다른 결제수단 선택", "chooseAWayToPay": "결제수단 선택", "otherWaysToPay": "다른 방법으로 결제", "edit": "편집", "doneEditing": "완료", "editPaymentMethods": "결제수단 편집", "CreditCardDeleteConfirmationMessage": "끝번호가 {{identifier}}인 {{secondaryIdentifier}} 카드를 삭제하시겠어요?", "PayPalAccountDeleteConfirmationMessage": "PayPal 계정 {{identifier}}을(를) 삭제하시겠어요?", "VenmoAccountDeleteConfirmationMessage": "사용자 이름이 {{identifier}}인 Venmo 계정을 삭제하시겠어요?", "genericDeleteConfirmationMessage": "이 결제수단을 삭제하시겠어요?", "deleteCancelButton": "취소", "deleteConfirmationButton": "삭제", "cardVerification": "카드 인증", "fieldEmptyForCvv": "CVV를 입력하세요.", "fieldEmptyForExpirationDate": "만료일을 입력하세요.", "fieldEmptyForCardholderName": "카드 소유자 이름을 입력하세요.", "fieldTooLongForCardholderName": "카드 소유자 이름은 256자 미만이어야 합니다.", "fieldEmptyForNumber": "번호를 입력하세요.", "fieldEmptyForPostalCode": "우편번호를 입력하세요.", "fieldInvalidForCvv": "이 보안 코드가 올바르지 않습니다.", "fieldInvalidForExpirationDate": "이 만료일이 올바르지 않습니다.", "fieldInvalidForNumber": "이 카드 번호가 올바르지 않습니다.", "fieldInvalidForPostalCode": "이 우편번호가 올바르지 않습니다.", "genericError": "저희 쪽에 문제가 발생했습니다.", "hostedFieldsTokenizationFailOnDuplicateError": "저장된 결제수단에 이미 이 신용카드가 존재합니다.", "hostedFieldsFailedTokenizationError": "정보를 확인하고 다시 시도해 주세요.", "hostedFieldsFieldsInvalidError": "정보를 확인하고 다시 시도해 주세요.", "hostedFieldsTokenizationNetworkErrorError": "네트워크 오류가 발생했습니다. 다시 시도해 주세요.", "hostedFieldsTokenizationCvvVerificationFailedError": "신용카드 인증에 실패했습니다. 정보를 확인하고 다시 시도해 주세요.", "paypalAccountTokenizationFailedError": "PayPal 계정을 추가하는 동안 문제가 발생했습니다. 다시 시도해 주세요.", "paypalFlowFailedError": "PayPal 계정을 연결하는 동안 문제가 발생했습니다. 다시 시도해 주세요.", "paypalTokenizationRequestActiveError": "PayPal 결제 승인이 이미 진행 중입니다.", "venmoCanceledError": "오류가 발생했습니다. 기기에 최신 버전의 Venmo 앱이 설치되어 있으며 브라우저가 Venmo로 전환 기능을 지원하는지 확인하세요.", "vaultManagerPaymentMethodDeletionError": "결제수단을 삭제할 수 없습니다. 다시 시도해 주세요.", "venmoAppFailedError": "기기에서 Venmo 앱을 찾을 수 없습니다.", "unsupportedCardTypeError": "이 카드 형식은 지원되지 않습니다. 다른 카드로 시도해 주세요.", "applePayTokenizationError": "Apple Pay 결제를 처리하는 동안 네트워크 오류가 발생했습니다. 다시 시도해 주세요.", "applePayActiveCardError": "Apple Pay 전자지갑에 지원되는 카드를 추가하세요.", "cardholderNameLabel": "카드 소유자 이름", "cardNumberLabel": "카드 번호", "cvvLabel": "CVV", "cvvThreeDigitLabelSubheading": "(3자리)", "cvvFourDigitLabelSubheading": "(4자리)", "cardholderNamePlaceholder": "카드 소유자 이름", "expirationDateLabel": "만료일", "expirationDateLabelSubheading": "(MM/YY)", "expirationDatePlaceholder": "MM/YY", "postalCodeLabel": "우편번호", "payWithCard": "카드로 결제", "endingIn": "끝번호: {{lastFourCardDigits}}", "Apple Pay": "Apple Pay", "Venmo": "Venmo", "Card": "카드", "PayPal": "PayPal", "PayPal Credit": "PayPal Credit", "Google Pay": "Google Pay", "American Express": "American Express", "Discover": "Discover", "Diners Club": "Diners Club", "MasterCard": "Mastercard", "Visa": "Visa", "JCB": "JCB", "Maestro": "Maestro", "UnionPay": "UnionPay" }; },{}],156:[function(require,module,exports){ 'use strict'; module.exports = { "payingWith": "Betalen met {{paymentSource}}", "chooseAnotherWayToPay": "Kies een andere betaalmethode", "chooseAWayToPay": "Kies een betaalwijze", "otherWaysToPay": "Andere manieren om te betalen", "edit": "Bewerk", "doneEditing": "Gereed", "editPaymentMethods": "Betaalmethoden aanpassen", "CreditCardDeleteConfirmationMessage": "{{secondaryIdentifier}}-kaart eindigend op {{identifier}} verwijderen?", "PayPalAccountDeleteConfirmationMessage": "PayPal-rekening {{identifier}} verwijderen?", "VenmoAccountDeleteConfirmationMessage": "Weet u zeker dat u Venmo-rekening met gebruikersnaam {{identifier}} wilt verwijderen?", "genericDeleteConfirmationMessage": "Weet u zeker dat u deze betaalmethode wilt verwijderen?", "deleteCancelButton": "Annuleren", "deleteConfirmationButton": "Verwijderen", "cardVerification": "Kaartcontrole", "fieldEmptyForCvv": "Vul een CSC in.", "fieldEmptyForExpirationDate": "Vul een vervaldatum in.", "fieldEmptyForCardholderName": "Vul een naam voor de kaarthouder in.", "fieldTooLongForCardholderName": "De naam van de kaarthouder moet korter zijn dan 256 tekens.", "fieldEmptyForNumber": "Vul een nummer in.", "fieldEmptyForPostalCode": "Vul een postcode in.", "fieldInvalidForCvv": "Deze CSC is ongeldig.", "fieldInvalidForExpirationDate": "Deze vervaldatum is ongeldig.", "fieldInvalidForNumber": "Dit creditcardnummer is ongeldig.", "fieldInvalidForPostalCode": "Deze postcode is ongeldig.", "genericError": "Er is iets fout gegaan.", "hostedFieldsTokenizationFailOnDuplicateError": "Deze creditcard staat al geregistreerd als een opgeslagen betaalmethode.", "hostedFieldsFailedTokenizationError": "Controleer uw gegevens en probeer het opnieuw.", "hostedFieldsFieldsInvalidError": "Controleer uw gegevens en probeer het opnieuw.", "hostedFieldsTokenizationNetworkErrorError": "Netwerkfout. Probeer het opnieuw.", "hostedFieldsTokenizationCvvVerificationFailedError": "De controle van de creditcard is mislukt. Controleer uw gegevens en probeer het opnieuw.", "paypalAccountTokenizationFailedError": "Er is iets misgegaan bij het toevoegen van de PayPal-rekening. Probeer het opnieuw.", "paypalFlowFailedError": "Er is iets misgegaan bij de verbinding met PayPal. Probeer het opnieuw.", "paypalTokenizationRequestActiveError": "De autorisatie van de PayPal-betaling is al in behandeling.", "venmoCanceledError": "Er ging iets fout. Controleer of de meest recente versie van de Venmo-app op je apparaat is geïnstalleerd en dat je browser overschakelen naar Venmo ondersteunt.", "vaultManagerPaymentMethodDeletionError": "Kan de betaalmethode niet verwijderen, probeer het opnieuw.", "venmoAppFailedError": "De Venmo-app is niet aangetroffen op je apparaat.", "unsupportedCardTypeError": "Dit type creditcard wordt niet ondersteund. Gebruik een andere creditcard.", "applePayTokenizationError": "Er is een netwerkfout opgetreden bij het verwerken van de Apple Pay-betaling. Probeer het opnieuw.", "applePayActiveCardError": "Voeg een ondersteunde creditcard toe aan je Apple Pay-wallet.", "cardholderNameLabel": "Naam kaarthouder", "cardNumberLabel": "Creditcardnummer", "cvvLabel": "CVV", "cvvThreeDigitLabelSubheading": "(3 cijfers)", "cvvFourDigitLabelSubheading": "(4 cijfers)", "cardholderNamePlaceholder": "Naam kaarthouder", "expirationDateLabel": "VervaldatumB", "expirationDateLabelSubheading": "(MM/JJ)", "expirationDatePlaceholder": "MM/JJ", "postalCodeLabel": "Postcode", "payWithCard": "Betalen met creditcard", "endingIn": "Eindigend op {{lastFourCardDigits}}", "Apple Pay": "Apple Pay", "Venmo": "Venmo", "Card": "Creditcard", "PayPal": "PayPal", "PayPal Credit": "PayPal Credit", "Google Pay": "Google Pay", "American Express": "American Express", "Discover": "Discover", "Diners Club": "Diners Club", "MasterCard": "Mastercard", "Visa": "Visa", "JCB": "JCB", "Maestro": "Maestro", "UnionPay": "UnionPay" }; },{}],157:[function(require,module,exports){ 'use strict'; module.exports = { "payingWith": "Betaling med {{paymentSource}}", "chooseAnotherWayToPay": "Velg en annen måte å betale på", "chooseAWayToPay": "Velg betalingsmåte", "otherWaysToPay": "Andre måter å betale på", "edit": "Rediger", "doneEditing": "Fullført", "editPaymentMethods": "Endre betalingsmetodene dine", "CreditCardDeleteConfirmationMessage": "Vil du slette {{secondaryIdentifier}}-kortet som slutter på {{identifier}}?", "PayPalAccountDeleteConfirmationMessage": "Vil du slette PayPal-kontoen {{identifier}}?", "VenmoAccountDeleteConfirmationMessage": "Er du sikker på at du vil slette Venmo-kontoen med brukernavnet {{identifier}}?", "genericDeleteConfirmationMessage": "Er du sikker på at du vil slette denne betalingsmetoden?", "deleteCancelButton": "Avbryt", "deleteConfirmationButton": "Slett", "cardVerification": "Kortbekreftelse", "fieldEmptyForCvv": "Oppgi en kortsikkerhetskode (CVV).", "fieldEmptyForExpirationDate": "Oppgi en utløpsdato.", "fieldEmptyForCardholderName": "Oppgi et navn for kortinnehaveren.", "fieldTooLongForCardholderName": "Makslengden for kortinnehaverens navn er 256 tegn.", "fieldEmptyForNumber": "Oppgi et nummer.", "fieldEmptyForPostalCode": "Oppgi et postnummer.", "fieldInvalidForCvv": "Denne sikkerhetskoden er ikke gyldig.", "fieldInvalidForExpirationDate": "Denne utløpsdatoen er ikke gyldig.", "fieldInvalidForNumber": "Dette kortnummeret er ikke gyldig.", "fieldInvalidForPostalCode": "Dette postnummeret er ikke gyldig.", "genericError": "Noe gikk galt hos oss.", "hostedFieldsTokenizationFailOnDuplicateError": "Dette betalingskortet eksisterer allerede som en lagret betalingsmetode.", "hostedFieldsFailedTokenizationError": "Kontroller informasjonen og prøv på nytt.", "hostedFieldsFieldsInvalidError": "Kontroller informasjonen og prøv på nytt.", "hostedFieldsTokenizationNetworkErrorError": "Nettverksfeil. Prøv på nytt.", "hostedFieldsTokenizationCvvVerificationFailedError": "Bekreftelsen av betalingskortet mislyktes. Kontroller informasjonen og prøv på nytt.", "paypalAccountTokenizationFailedError": "Noe gikk galt da PayPal-kontoen ble lagt til. Prøv på nytt.", "paypalFlowFailedError": "Det oppsto et problem med tilkoblingen til PayPal. Prøv på nytt.", "paypalTokenizationRequestActiveError": "Godkjenning av PayPal-betalingen pågår allerede", "venmoCanceledError": "Noe gikk galt. Kontroller at du har installert den nyeste versjonen av Venmo-appen på enheten og at nettleseren din støtter bytte til Venmo.", "vaultManagerPaymentMethodDeletionError": "Kunne ikke slette betalingsmetoden. Prøv på nytt.", "venmoAppFailedError": "Finner ikke Venmo-appen på enheten.", "unsupportedCardTypeError": "Denne korttypen støttes ikke. Prøv med et annet kort.", "applePayTokenizationError": "Det oppsto en nettverksfeil under behandlingen av Apple Pay-betalingen. Prøv på nytt.", "applePayActiveCardError": "Legg til et kort som støttes i Apple Pay-lommeboken din.", "cardholderNameLabel": "Kortinnehaverens navn", "cardNumberLabel": "Kortnummer", "cvvLabel": "CVV", "cvvThreeDigitLabelSubheading": "(3 siffer)", "cvvFourDigitLabelSubheading": "(4 siffer)", "cardholderNamePlaceholder": "Kortinnehaverens navn", "expirationDateLabel": "Utløpsdato", "expirationDateLabelSubheading": "(MM/ÅÅ)", "expirationDatePlaceholder": "MM/ÅÅ", "postalCodeLabel": "Postnummer", "payWithCard": "Betal med kort", "endingIn": "Slutter på {{lastFourCardDigits}}", "Apple Pay": "Apple Pay", "Venmo": "Venmo", "Card": "Kort", "PayPal": "PayPal", "PayPal Credit": "PayPal Credit", "Google Pay": "Google Pay", "American Express": "American Express", "Discover": "Discover", "Diners Club": "Diners Club", "MasterCard": "Mastercard", "Visa": "Visa", "JCB": "JCB", "Maestro": "Maestro", "UnionPay": "UnionPay" }; },{}],158:[function(require,module,exports){ 'use strict'; module.exports = { "payingWith": "Źródło finansowania płatności: {{paymentSource}}", "chooseAnotherWayToPay": "Wybierz inne źródło finansowania płatności", "chooseAWayToPay": "Wybierz źródło finansowania płatności", "otherWaysToPay": "Inne źródła finansowania płatności", "edit": "Edytuj", "doneEditing": "Gotowe", "editPaymentMethods": "Edytuj źródła finansowania płatności", "CreditCardDeleteConfirmationMessage": "Usunąć kartę {{secondaryIdentifier}} o numerze zakończonym cyframi {{identifier}}?", "PayPalAccountDeleteConfirmationMessage": "Usunąć konto PayPal {{identifier}}?", "VenmoAccountDeleteConfirmationMessage": "Czy na pewno chcesz usunąć konto Venmo z nazwą użytkownika {{identifier}}?", "genericDeleteConfirmationMessage": "Czy na pewno chcesz usunąć to źródło finansowania płatności?", "deleteCancelButton": "Anuluj", "deleteConfirmationButton": "Usuń", "cardVerification": "Weryfikacja karty", "fieldEmptyForCvv": "Podaj kod bezpieczeństwa.", "fieldEmptyForExpirationDate": "Podaj datę ważności.", "fieldEmptyForCardholderName": "Podaj imię i nazwisko posiadacza karty.", "fieldTooLongForCardholderName": "Imię i nazwisko posiadacza karty musi mieć mniej niż 256 znaków.", "fieldEmptyForNumber": "Podaj numer.", "fieldEmptyForPostalCode": "Podaj kod pocztowy.", "fieldInvalidForCvv": "Podany kod bezpieczeństwa jest nieprawidłowy.", "fieldInvalidForExpirationDate": "Podana data ważności jest nieprawidłowa.", "fieldInvalidForNumber": "Podany numer karty jest nieprawidłowy.", "fieldInvalidForPostalCode": "Podany kod pocztowy jest nieprawidłowy.", "genericError": "Wystąpił błąd po naszej stronie.", "hostedFieldsTokenizationFailOnDuplicateError": "Ta karta kredytowa jest już zapisana jako źródło finansowania płatności.", "hostedFieldsFailedTokenizationError": "Sprawdź swoje informacje i spróbuj ponownie.", "hostedFieldsFieldsInvalidError": "Sprawdź swoje informacje i spróbuj ponownie.", "hostedFieldsTokenizationNetworkErrorError": "Błąd sieci. Spróbuj ponownie.", "hostedFieldsTokenizationCvvVerificationFailedError": "Weryfikacja karty kredytowej nie powiodła się. Sprawdź swoje informacje i spróbuj ponownie.", "paypalAccountTokenizationFailedError": "Coś poszło nie tak podczas dodawania konta PayPal. Spróbuj ponownie.", "paypalFlowFailedError": "Coś poszło nie tak podczas łączenia z systemem PayPal. Spróbuj ponownie.", "paypalTokenizationRequestActiveError": "Autoryzacja płatności PayPal jest już w trakcie realizacji.", "venmoCanceledError": "Wystąpił problem. Upewnij się, czy na swoim urządzeniu masz zainstalowaną najnowszą wersję aplikacji Venmo i Twoja przeglądarka ją obsługuje.", "vaultManagerPaymentMethodDeletionError": "Nie można usunąć źródła finansowania płatności. Spróbuj ponownie.", "venmoAppFailedError": "Nie można odnaleźć aplikacji Venmo na urządzeniu.", "unsupportedCardTypeError": "Ten typ karty nie jest obsługiwany. Spróbuj użyć innej karty.", "applePayTokenizationError": "Wystąpił błąd sieci podczas przetwarzania płatności Apple Pay. Spróbuj ponownie.", "applePayActiveCardError": "Dodaj obsługiwaną kartę do portfela Apple Pay.", "cardholderNameLabel": "Imię i nazwisko posiadacza karty", "cardNumberLabel": "Numer karty", "cvvLabel": "Kod CVC", "cvvThreeDigitLabelSubheading": "(3 cyfry)", "cvvFourDigitLabelSubheading": "(4 cyfry)", "cardholderNamePlaceholder": "Imię i nazwisko posiadacza karty", "expirationDateLabel": "Data ważności", "expirationDateLabelSubheading": "(MM/RR)", "expirationDatePlaceholder": "MM/RR", "postalCodeLabel": "Kod pocztowy", "payWithCard": "Zapłać kartą", "endingIn": "O numerze zakończonym cyframi {{lastFourCardDigits}}", "Apple Pay": "Apple Pay", "Venmo": "Venmo", "Card": "Karta", "PayPal": "PayPal", "PayPal Credit": "PayPal Credit", "Google Pay": "Google Pay", "American Express": "American Express", "Discover": "Discover", "Diners Club": "Diners Club", "MasterCard": "Mastercard", "Visa": "Visa", "JCB": "JCB", "Maestro": "Maestro", "UnionPay": "UnionPay" }; },{}],159:[function(require,module,exports){ 'use strict'; module.exports = { "payingWith": "Pagando com {{paymentSource}}", "chooseAnotherWayToPay": "Escolher outro meio de pagamento", "chooseAWayToPay": "Escolher um meio de pagamento", "otherWaysToPay": "Outro meio de pagamento", "edit": "Editar", "doneEditing": "Concluído", "editPaymentMethods": "Editar meios de pagamento", "CreditCardDeleteConfirmationMessage": "Excluir cartão com {{secondaryIdentifier}} com final {{identifier}}?", "PayPalAccountDeleteConfirmationMessage": "Excluir conta do PayPal {{identifier}}?", "VenmoAccountDeleteConfirmationMessage": "Tem certeza de que deseja excluir a conta do Venmo com o nome de usuário {{identifier}}?", "genericDeleteConfirmationMessage": "Tem certeza de que deseja excluir este meio de pagamento?", "deleteCancelButton": "Cancelar", "deleteConfirmationButton": "Excluir", "cardVerification": "Verificação do cartão", "fieldEmptyForCvv": "Informe o Código de Segurança.", "fieldEmptyForExpirationDate": "Informe a data de vencimento.", "fieldEmptyForCardholderName": "Informe o nome do titular do cartão.", "fieldTooLongForCardholderName": "O nome do titular do cartão deve ter menos de 256 caracteres.", "fieldEmptyForNumber": "Informe um número.", "fieldEmptyForPostalCode": "Informe um CEP.", "fieldInvalidForCvv": "Este código de segurança não é válido.", "fieldInvalidForExpirationDate": "Esta data de vencimento não é válida.", "fieldInvalidForNumber": "O número do cartão não é válido.", "fieldInvalidForPostalCode": "Este CEP não é válido.", "genericError": "Ocorreu um erro.", "hostedFieldsTokenizationFailOnDuplicateError": "Este cartão de crédito já está salvo em seus meios de pagamento.", "hostedFieldsFailedTokenizationError": "Verifique as informações e tente novamente.", "hostedFieldsFieldsInvalidError": "Verifique as informações e tente novamente.", "hostedFieldsTokenizationNetworkErrorError": "Erro de rede. Tente novamente.", "hostedFieldsTokenizationCvvVerificationFailedError": "Falha ao verificar o cartão de crédito. Verifique as informações e tente novamente.", "paypalAccountTokenizationFailedError": "Ocorreu um erro ao adicionar a conta do PayPal. Tente novamente.", "paypalFlowFailedError": "Ocorreu um erro de conexão com o PayPal. Tente novamente.", "paypalTokenizationRequestActiveError": "A autorização de pagamento do PayPal já está em andamento.", "venmoCanceledError": "Ocorreu um erro. Certifique-se de ter a versão mais recente do aplicativo Venmo instalado no seu dispositivo e que o seu navegador suporte a mudança para o Venmo.", "vaultManagerPaymentMethodDeletionError": "Não é possível excluir o meio de pagamento, tente novamente.", "venmoAppFailedError": "Não foi possível encontrar o aplicativo Venmo no seu dispositivo.", "unsupportedCardTypeError": "Este tipo de cartão não é aceito. Experimente outro cartão.", "applePayTokenizationError": "Ocorreu um erro de rede ao processar o pagamento com Apple Pay. Tente novamente.", "applePayActiveCardError": "Adicione cartão suportado à sua carteira do Apple Pay.", "cardholderNameLabel": "Nome do titular do cartão", "cardNumberLabel": "Número do cartão", "cvvLabel": "CSC", "cvvThreeDigitLabelSubheading": "(3 dígitos)", "cvvFourDigitLabelSubheading": "(4 dígitos)", "cardholderNamePlaceholder": "Nome do titular do cartão", "expirationDateLabel": "Data de vencimento", "expirationDateLabelSubheading": "(MM/AA)", "expirationDatePlaceholder": "MM/AA", "postalCodeLabel": "CEP", "payWithCard": "Pague com seu cartão", "endingIn": "Com final {{lastFourCardDigits}}", "Apple Pay": "Apple Pay", "Venmo": "Venmo", "Card": "Cartão", "PayPal": "PayPal", "PayPal Credit": "PayPal Credit", "Google Pay": "Google Pay", "American Express": "American Express", "Discover": "Discover", "Diners Club": "Diners Club", "MasterCard": "Mastercard", "Visa": "Visa", "JCB": "JCB", "Maestro": "Maestro", "UnionPay": "UnionPay" }; },{}],160:[function(require,module,exports){ 'use strict'; module.exports = { "payingWith": "Pagar com {{paymentSource}}", "chooseAnotherWayToPay": "Escolher outra forma de pagamento", "chooseAWayToPay": "Escolha um meio de pagamento", "otherWaysToPay": "Outras formas de pagamento", "edit": "Editar", "doneEditing": "Concluído", "editPaymentMethods": "Editar meios de pagamento", "CreditCardDeleteConfirmationMessage": "Eliminar o cartão {{secondaryIdentifier}} terminado em {{identifier}}?", "PayPalAccountDeleteConfirmationMessage": "Eliminar {{identifier}} da conta PayPal?", "VenmoAccountDeleteConfirmationMessage": "Tem a certeza de que pretende eliminar a conta Venmo com o nome de utilizador {{identifier}}?", "genericDeleteConfirmationMessage": "Tem certeza de que pretende eliminar este meio de pagamento?", "deleteCancelButton": "Cancelar", "deleteConfirmationButton": "Eliminar", "cardVerification": "Verificação de cartão", "fieldEmptyForCvv": "Introduza o código CVV.", "fieldEmptyForExpirationDate": "Introduza a data de validade.", "fieldEmptyForCardholderName": "Introduza um nome do titular do cartão.", "fieldTooLongForCardholderName": "O nome do titular do cartão tem de ter menos de 256 carateres.", "fieldEmptyForNumber": "Introduza um número.", "fieldEmptyForPostalCode": "Introduza o código postal.", "fieldInvalidForCvv": "Este código de segurança não é válido.", "fieldInvalidForExpirationDate": "Esta data de validade não é correta.", "fieldInvalidForNumber": "Este número de cartão não é válido.", "fieldInvalidForPostalCode": "Este código postal não é válido.", "genericError": "Tudo indica que ocorreu um problema.", "hostedFieldsTokenizationFailOnDuplicateError": "Este cartão de crédito já está registado como um meio de pagamento guardado.", "hostedFieldsFailedTokenizationError": "Verifique os dados e tente novamente.", "hostedFieldsFieldsInvalidError": "Verifique os dados e tente novamente.", "hostedFieldsTokenizationNetworkErrorError": "Erro de rede. Tente novamente.", "hostedFieldsTokenizationCvvVerificationFailedError": "A verificação do cartão de crédito falhou. Verifique os dados e tente novamente.", "paypalAccountTokenizationFailedError": "Ocorreu um erro ao associar a conta PayPal. Tente novamente.", "paypalFlowFailedError": "Ocorreu um erro na ligação com PayPal. Tente novamente.", "paypalTokenizationRequestActiveError": "Já há uma autorização de pagamento PayPal em curso.", "venmoCanceledError": "Ocorreu um erro. Certifique-se de que tem a versão mais recente da aplicação Venmo instalada no seu dispositivo e que o navegador suporta a mudança para o Venmo.", "vaultManagerPaymentMethodDeletionError": "Não é possível eliminar o meio de pagamento, tente novamente.", "venmoAppFailedError": "Não foi possível encontrar a aplicação Venmo no dispositivo.", "unsupportedCardTypeError": "Este tipo de cartão não é suportado. Tente usar outro cartão.", "applePayTokenizationError": "Ocorreu um erro de rede ao processar o pagamento com Apple Pay. Tente novamente.", "applePayActiveCardError": "Adicione um cartão suportado à sua carteira Apple Pay.", "cardholderNameLabel": "Nome do titular do cartão", "cardNumberLabel": "Número do cartão", "cvvLabel": "CVV", "cvvThreeDigitLabelSubheading": "(3 dígitos)", "cvvFourDigitLabelSubheading": "(4 dígitos)", "cardholderNamePlaceholder": "Nome do titular do cartão", "expirationDateLabel": "Data de validade", "expirationDateLabelSubheading": "(MM/AA)", "expirationDatePlaceholder": "MM/AA", "postalCodeLabel": "Código postal", "payWithCard": "Pagar com cartão", "endingIn": "Terminado em {{lastFourCardDigits}}", "Apple Pay": "Apple Pay", "Venmo": "Venmo", "Card": "Cartão", "PayPal": "PayPal", "PayPal Credit": "PayPal Credit", "Google Pay": "Google Pay", "American Express": "American Express", "Discover": "Discover", "Diners Club": "Diners Club", "MasterCard": "Mastercard", "Visa": "Visa", "JCB": "JCB", "Maestro": "Maestro", "UnionPay": "UnionPay" }; },{}],161:[function(require,module,exports){ 'use strict'; module.exports = { "payingWith": "Способы оплаты: {{paymentSource}}", "chooseAnotherWayToPay": "Выберите другой способ оплаты", "chooseAWayToPay": "Выберите способ оплаты", "otherWaysToPay": "Другие способы оплаты", "edit": "Редактировать", "doneEditing": "Готово", "editPaymentMethods": "Редактировать способы оплаты", "CreditCardDeleteConfirmationMessage": "Удалить карту {{secondaryIdentifier}}, оканчивающуюся на {{identifier}}?", "PayPalAccountDeleteConfirmationMessage": "Удалить счет PayPal {{identifier}}?", "VenmoAccountDeleteConfirmationMessage": "Вы действительно хотите удалить счет Venmo с именем пользователя {{identifier}}?", "genericDeleteConfirmationMessage": "Вы действительно хотите удалить этот способ оплаты?", "deleteCancelButton": "Отмена", "deleteConfirmationButton": "Удалить", "cardVerification": "Проверка карты", "fieldEmptyForCvv": "Укажите код безопасности.", "fieldEmptyForExpirationDate": "Укажите дату окончания срока действия.", "fieldEmptyForCardholderName": "Введите имя и фамилию владельца карты.", "fieldTooLongForCardholderName": "Имя владельца карты должно содержать не более 256 символов.", "fieldEmptyForNumber": "Введите номер.", "fieldEmptyForPostalCode": "Укажите почтовый индекс.", "fieldInvalidForCvv": "Этот код безопасности недействителен.", "fieldInvalidForExpirationDate": "Эта дата окончания срока действия недействительна.", "fieldInvalidForNumber": "Этот номер карты недействителен.", "fieldInvalidForPostalCode": "Этот почтовый индекс недействителен.", "genericError": "Возникла проблема с нашей стороны.", "hostedFieldsTokenizationFailOnDuplicateError": "Эта кредитная карта уже указана как сохраненный источник средств.", "hostedFieldsFailedTokenizationError": "Проверьте правильность ввода данных и повторите попытку.", "hostedFieldsFieldsInvalidError": "Проверьте правильность ввода данных и повторите попытку.", "hostedFieldsTokenizationNetworkErrorError": "Ошибка сети. Повторите попытку.", "hostedFieldsTokenizationCvvVerificationFailedError": "Проверка банковской карты не выполнена. Проверьте правильность ввода данных и повторите попытку.", "paypalAccountTokenizationFailedError": "Что-то пошло не так — не удалось добавить учетную запись PayPal. Повторите попытку.", "paypalFlowFailedError": "Что-то пошло не так — не удалось подключиться к системе PayPal. Повторите попытку.", "paypalTokenizationRequestActiveError": "Выполняется авторизация платежа PayPal.", "venmoCanceledError": "Возникла ошибка. Просим вас убедиться, что у вас установлена новейшая версия приложения Venmo и ваш браузер поддерживает переключение к Venmo.", "vaultManagerPaymentMethodDeletionError": "Не удалось удалить способ оплаты. Повторите попытку.", "venmoAppFailedError": "Приложение Venmo не обнаружено на вашем устройстве.", "unsupportedCardTypeError": "Этот тип карты не поддерживается. Попробуйте воспользоваться другой картой.", "applePayTokenizationError": "При обработке платежа через Apple Pay возникла сетевая ошибка. Повторите попытку.", "applePayActiveCardError": "Добавьте поддерживаемую карту к своему счету Apple Pay.", "cardholderNameLabel": "Имя и фамилия владельца", "cardNumberLabel": "Номер карты", "cvvLabel": "Код безопасности", "cvvThreeDigitLabelSubheading": "(3 цифры)", "cvvFourDigitLabelSubheading": "(4 цифры)", "cardholderNamePlaceholder": "Имя и фамилия владельца", "expirationDateLabel": "Срок действия", "expirationDateLabelSubheading": "(ММ/ГГ)", "expirationDatePlaceholder": "ММ/ГГ", "postalCodeLabel": "Индекс", "payWithCard": "Оплатить картой", "endingIn": "Последние четыре цифры номера карты: {{lastFourCardDigits}}", "Apple Pay": "Apple Pay", "Venmo": "Venmo", "Card": "Карта", "PayPal": "PayPal", "PayPal Credit": "PayPal Credit", "Google Pay": "Google Pay", "American Express": "American Express", "Discover": "Discover", "Diners Club": "Diners Club", "MasterCard": "Mastercard", "Visa": "Visa", "JCB": "JCB", "Maestro": "Maestro", "UnionPay": "UnionPay" }; },{}],162:[function(require,module,exports){ 'use strict'; module.exports = { "payingWith": "Betalas med {{paymentSource}}", "chooseAnotherWayToPay": "Välj ett annat sätt att betala", "chooseAWayToPay": "Välj hur du vill betala", "otherWaysToPay": "Andra sätt att betala", "edit": "Ändra", "doneEditing": "Klart", "editPaymentMethods": "Redigera betalningsmetoder", "CreditCardDeleteConfirmationMessage": "Ta bort {{secondaryIdentifier}}-kort som slutar på {{identifier}}?", "PayPalAccountDeleteConfirmationMessage": "Ta bort PayPal-konto {{identifier}}?", "VenmoAccountDeleteConfirmationMessage": "Är du säker på att du vill ta bort Venmo-konto med användarnamn {{identifier}}?", "genericDeleteConfirmationMessage": "Är du säker på att du vill ta bort den här betalningsmetoden?", "deleteCancelButton": "Avbryt", "deleteConfirmationButton": "Ta bort", "cardVerification": "Kortverifiering", "fieldEmptyForCvv": "Fyll i en CVV-kod.", "fieldEmptyForExpirationDate": "Fyll i ett utgångsdatum.", "fieldEmptyForCardholderName": "Fyll i kortinnehavarens namn.", "fieldTooLongForCardholderName": "Kortinnehavarens namn måste vara kortare än 256 tecken.", "fieldEmptyForNumber": "Fyll i ett nummer.", "fieldEmptyForPostalCode": "Fyll i ett postnummer.", "fieldInvalidForCvv": "Den här säkerhetskoden är inte giltig.", "fieldInvalidForExpirationDate": "Det här utgångsdatumet är inte giltigt.", "fieldInvalidForNumber": "Det här kortnumret är inte giltigt.", "fieldInvalidForPostalCode": "Det här postnumret är inte giltigt.", "genericError": "Ett fel uppstod.", "hostedFieldsTokenizationFailOnDuplicateError": "Det här betalkortet finns redan som en sparad betalningsmetod.", "hostedFieldsFailedTokenizationError": "Kontrollera uppgifterna och försök igen.", "hostedFieldsFieldsInvalidError": "Kontrollera uppgifterna och försök igen.", "hostedFieldsTokenizationNetworkErrorError": "Nätverksfel. Försök igen.", "hostedFieldsTokenizationCvvVerificationFailedError": "Verifieringen av betalkort misslyckades. Kontrollera uppgifterna och försök igen.", "paypalAccountTokenizationFailedError": "Ett fel uppstod när PayPal-kontot skulle läggas till. Försök igen.", "paypalFlowFailedError": "Ett fel uppstod när anslutningen till PayPal skulle upprättas. Försök igen.", "paypalTokenizationRequestActiveError": "Betalningsgodkännandet för PayPal behandlas redan.", "venmoCanceledError": "Något gick fel. Se till att du har den senaste versionen av Venmo-appen installerad på din enhet och att webbläsaren stöder att gå över till Venmo.", "vaultManagerPaymentMethodDeletionError": "Det gick inte att ta bort betalningsmetoden. Försök igen.", "venmoAppFailedError": "Venmo-appen kunde inte hittas på din enhet.", "unsupportedCardTypeError": "Den här korttypen stöds inte. Pröva med ett annat kort.", "applePayTokenizationError": "Ett nätverksfel inträffade när Apple Pay-betalningen skulle behandlas. Försök igen.", "applePayActiveCardError": "Lägg till ett kort som stöds i Apple Pay-e-plånboken.", "cardholderNameLabel": "Kortinnehavarens namn", "cardNumberLabel": "Kortnummer", "cvvLabel": "CVV", "cvvThreeDigitLabelSubheading": "(3 siffror)", "cvvFourDigitLabelSubheading": "(4 siffror)", "cardholderNamePlaceholder": "Kortinnehavarens namn", "expirationDateLabel": "Utgångsdatum", "expirationDateLabelSubheading": "(MM/ÅÅ)", "expirationDatePlaceholder": "MM/ÅÅ", "postalCodeLabel": "Postnummer", "payWithCard": "Betala med kort", "endingIn": "Slutar på {{lastFourCardDigits}}", "Apple Pay": "Apple Pay", "Venmo": "Venmo", "Card": "Kort", "PayPal": "PayPal", "PayPal Credit": "PayPal Credit", "Google Pay": "Google Pay", "American Express": "American Express", "Discover": "Discover", "Diners Club": "Diners Club", "MasterCard": "Mastercard", "Visa": "Visa", "JCB": "JCB", "Maestro": "Maestro", "UnionPay": "UnionPay" }; },{}],163:[function(require,module,exports){ 'use strict'; module.exports = { "payingWith": "การชำระเงินด้วย {{paymentSource}}", "chooseAnotherWayToPay": "เลือกวิธีอื่นเพื่อชำระเงิน", "chooseAWayToPay": "เลือกวิธีชำระเงิน", "otherWaysToPay": "วิธีอื่นๆ ในการชำระเงิน", "edit": "แก้ไข", "doneEditing": "เสร็จแล้ว", "editPaymentMethods": "แก้ไขวิธีการชำระเงิน", "CreditCardDeleteConfirmationMessage": "ลบบัตร {{secondaryIdentifier }} ที่ลงท้ายด้วย {{identifier}} หรือไม่", "PayPalAccountDeleteConfirmationMessage": "ลบ {{identifier}} บัญชี PayPal หรือไม่", "VenmoAccountDeleteConfirmationMessage": "คุณมั่นใจว่าต้องการลบบัญชี Venmo ที่มีชื่อผู้ใช้ {{identifier}} หรือไม่", "genericDeleteConfirmationMessage": "คุณมั่นใจว่าต้องการลบวิธีการชำระเงินนี้หรือไม่", "deleteCancelButton": "ยกเลิก", "deleteConfirmationButton": "ลบ", "cardVerification": "การตรวจสอบยืนยันบัตร", "fieldEmptyForCvv": "โปรดกรอก CVV (รหัสการตรวจสอบยืนยันบัตร)", "fieldEmptyForExpirationDate": "โปรดกรอกวันที่หมดอายุ", "fieldEmptyForCardholderName": "โปรดกรอกชื่อเจ้าของบัตร", "fieldTooLongForCardholderName": "ชื่อผู้ถือบัตรจะต้องไม่เกิน 256 อักขระ", "fieldEmptyForNumber": "โปรดกรอกหมายเลข", "fieldEmptyForPostalCode": "โปรดกรอกรหัสไปรษณีย์", "fieldInvalidForCvv": "รหัสความปลอดภัยนี้ไม่ถูกต้อง", "fieldInvalidForExpirationDate": "วันที่หมดอายุนี้ไม่ถูกต้อง", "fieldInvalidForNumber": "หมายเลขบัตรนี้ไม่ถูกต้อง", "fieldInvalidForPostalCode": "รหัสไปรษณีย์นี้ไม่ถูกต้อง", "genericError": "เกิดข้อผิดพลาดขึ้นในระบบของเรา", "hostedFieldsTokenizationFailOnDuplicateError": "บัตรเครดิตนี้ถูกบันทึกไว้เป็นวิธีการชำระเงิน", "hostedFieldsFailedTokenizationError": "โปรดตรวจสอบข้อมูลของคุณ แล้วลองใหม่อีกครั้ง", "hostedFieldsFieldsInvalidError": "โปรดตรวจสอบข้อมูลของคุณ แล้วลองใหม่อีกครั้ง", "hostedFieldsTokenizationNetworkErrorError": "ข้อผิดพลาดด้านเครือข่าย โปรดลองอีกครั้ง", "hostedFieldsTokenizationCvvVerificationFailedError": "การตรวจสอบยืนยันบัตรเครดิตล้มเหลว โปรดตรวจสอบข้อมูลของคุณ แล้วลองใหม่อีกครั้ง", "paypalAccountTokenizationFailedError": "เกิดข้อผิดพลาดในการเพิ่มบัญชี PayPal โปรดลองอีกครั้ง", "paypalFlowFailedError": "เกิดข้อผิดพลาดในการเชื่อมต่อกับ PayPal โปรดลองอีกครั้ง", "paypalTokenizationRequestActiveError": "การอนุญาตการชำระเงินของ PayPal อยู่ในระหว่างดำเนินการ", "venmoCanceledError": "เกิดข้อผิดพลาดบางประการ ตรวจสอบว่าคุณมีแอป Venmo เวอร์ชันล่าสุดติดตั้งในอุปกรณ์ของคุณ และมีเบราเซอร์ที่รองรับ Venmo", "vaultManagerPaymentMethodDeletionError": "ไม่สามารถลบวิธีการชำระเงินได้ ลองอีกครั้ง", "venmoAppFailedError": "ไม่พบแอป Venmo บนอุปกรณ์ของคุณ", "unsupportedCardTypeError": "ไม่รองรับบัตรประเภทนี้ โปรดลองใช้บัตรใบอื่น", "applePayTokenizationError": "เกิดข้อผิดพลาดด้านเครือข่ายขึ้นขณะดำเนินการชำระเงินด้วย Apple Pay โปรดลองอีกครั้ง", "applePayActiveCardError": "เพิ่มบัตรที่รองรับในกระเป๋าสตางค์ Apple Pay ของคุณ", "cardholderNameLabel": "ชื่อเจ้าของบัตร", "cardNumberLabel": "หมายเลขบัตร", "cvvLabel": "CVV", "cvvThreeDigitLabelSubheading": "(3 หลัก)", "cvvFourDigitLabelSubheading": "(4 หลัก)", "cardholderNamePlaceholder": "ชื่อเจ้าของบัตร", "expirationDateLabel": "วันหมดอายุ", "expirationDateLabelSubheading": "(ดด/ปป)", "expirationDatePlaceholder": "ดด/ปป", "postalCodeLabel": "รหัสไปรษณีย์", "payWithCard": "ชำระเงินด้วยบัตร", "endingIn": "ลงท้ายด้วย {{lastFourCardDigits}}", "Apple Pay": "Apple Pay", "Venmo": "Venmo", "Card": "บัตร", "PayPal": "PayPal", "PayPal Credit": "PayPal Credit", "Google Pay": "Google Pay", "American Express": "American Express", "Discover": "Discover", "Diners Club": "Diners Club", "MasterCard": "Mastercard", "Visa": "Visa", "JCB": "JCB", "Maestro": "Maestro", "UnionPay": "UnionPay" }; },{}],164:[function(require,module,exports){ 'use strict'; module.exports = { "payingWith": "正在使用{{paymentSource}}付款", "chooseAnotherWayToPay": "选择其他付款方式", "chooseAWayToPay": "选择付款方式", "otherWaysToPay": "其他付款方式", "edit": "编辑", "doneEditing": "完成", "editPaymentMethods": "编辑付款方式", "CreditCardDeleteConfirmationMessage": "删除尾号为{{identifier}}的{{secondaryIdentifier}}卡?", "PayPalAccountDeleteConfirmationMessage": "删除PayPal账户{{identifier}}?", "VenmoAccountDeleteConfirmationMessage": "确定要删除用户名为{{identifier}}的Venmo账户吗?", "genericDeleteConfirmationMessage": "确定要删除该付款方式吗?", "deleteCancelButton": "取消", "deleteConfirmationButton": "删除", "cardVerification": "卡验证", "fieldEmptyForCvv": "请填写CVV。", "fieldEmptyForExpirationDate": "请填写有效期限。", "fieldEmptyForCardholderName": "请填写持卡人的姓名。", "fieldTooLongForCardholderName": "持卡人姓名必须少于256个字符。", "fieldEmptyForNumber": "请填写一个号码。", "fieldEmptyForPostalCode": "请填写邮政编码。", "fieldInvalidForCvv": "此安全代码无效。", "fieldInvalidForExpirationDate": "此有效期限无效。", "fieldInvalidForNumber": "此卡号无效。", "fieldInvalidForPostalCode": "此邮政编码无效。", "genericError": "我们遇到了一些问题", "hostedFieldsTokenizationFailOnDuplicateError": "此信用卡已作为保存后的付款方式存在。", "hostedFieldsFailedTokenizationError": "请检查您的信息,然后重试。", "hostedFieldsFieldsInvalidError": "请检查您的信息,然后重试。", "hostedFieldsTokenizationNetworkErrorError": "网络错误。请重试。", "hostedFieldsTokenizationCvvVerificationFailedError": "信用卡验证失败。请检查您的信息,然后重试。", "paypalAccountTokenizationFailedError": "添加PayPal账户时出错。请重试。", "paypalFlowFailedError": "连接到PayPal时出错。请重试。", "paypalTokenizationRequestActiveError": "PayPal付款授权已在进行中。", "venmoCanceledError": "我们遇到了问题。请确保您的设备上已安装最新版本的Venmo应用,并且您的浏览器支持切换到Venmo。", "vaultManagerPaymentMethodDeletionError": "无法删除付款方式,请重试。", "venmoAppFailedError": "在您的设备上找不到Venmo应用。", "unsupportedCardTypeError": "不支持该卡类型。请尝试其他卡。", "applePayTokenizationError": "处理Apple Pay付款时出现网络错误。请重试。", "applePayActiveCardError": "请添加受支持的卡到您的Apple Pay钱包。", "cardholderNameLabel": "持卡人姓名", "cardNumberLabel": "卡号", "cvvLabel": "CVV", "cvvThreeDigitLabelSubheading": "(3位数)", "cvvFourDigitLabelSubheading": "(4位数)", "cardholderNamePlaceholder": "持卡人姓名", "expirationDateLabel": "有效期限", "expirationDateLabelSubheading": "(MM/YY)", "expirationDatePlaceholder": "MM/YY", "postalCodeLabel": "邮政编码", "payWithCard": "用卡付款", "endingIn": "尾号为{{lastFourCardDigits}}", "Apple Pay": "Apple Pay", "Venmo": "Venmo", "Card": "卡", "PayPal": "PayPal", "PayPal Credit": "PayPal Credit", "Google Pay": "Google Pay", "American Express": "American Express", "Discover": "Discover", "Diners Club": "Diners Club", "MasterCard": "Mastercard", "Visa": "Visa", "JCB": "JCB", "Maestro": "Maestro", "UnionPay": "银联" }; },{}],165:[function(require,module,exports){ 'use strict'; module.exports = { "payingWith": "付款方式為 {{paymentSource}}", "chooseAnotherWayToPay": "選擇其他付款方式", "chooseAWayToPay": "選擇付款方式", "otherWaysToPay": "其他付款方式", "edit": "編輯", "doneEditing": "完成", "editPaymentMethods": "編輯付款方式", "CreditCardDeleteConfirmationMessage": "要刪除末碼為 {{identifier}} 的 {{secondaryIdentifier}} 卡嗎?", "PayPalAccountDeleteConfirmationMessage": "要刪除 PayPal 帳戶 {{identifier}} 嗎?", "VenmoAccountDeleteConfirmationMessage": "確定要刪除使用者名稱為 {{identifier}} 的 Venmo 帳戶嗎?", "genericDeleteConfirmationMessage": "確定要刪除此付款方式嗎?", "deleteCancelButton": "取消", "deleteConfirmationButton": "刪除", "cardVerification": "信用卡認證", "fieldEmptyForCvv": "請填寫信用卡認證碼。", "fieldEmptyForExpirationDate": "請填寫到期日。", "fieldEmptyForCardholderName": "請填寫持卡人的名字。", "fieldTooLongForCardholderName": "持卡人姓名必須少於 256 個字元。", "fieldEmptyForNumber": "請填寫號碼。", "fieldEmptyForPostalCode": "請填寫郵遞區號。", "fieldInvalidForCvv": "此安全代碼無效。", "fieldInvalidForExpirationDate": "此到期日無效。", "fieldInvalidForNumber": "此卡號無效。", "fieldInvalidForPostalCode": "此郵遞區號無效。", "genericError": "系統發生錯誤。", "hostedFieldsTokenizationFailOnDuplicateError": "此信用卡已存在,為已儲存的付款方式。", "hostedFieldsFailedTokenizationError": "請檢查你的資料並再試一次。", "hostedFieldsFieldsInvalidError": "請檢查你的資料並再試一次。", "hostedFieldsTokenizationNetworkErrorError": "網絡錯誤。再試一次。", "hostedFieldsTokenizationCvvVerificationFailedError": "信用卡認證失敗。請檢查你的資料並再試一次。", "paypalAccountTokenizationFailedError": "加入 PayPal 帳戶時發生錯誤。再試一次。", "paypalFlowFailedError": "連接 PayPal 時發生錯誤。再試一次。", "paypalTokenizationRequestActiveError": "PayPal 付款授權已在處理中。", "venmoCanceledError": "系統發生錯誤,請確保你已在裝置上安裝最新版本的 Venmo 應用程式,而且你的瀏覽器支援切換至 Venmo。", "vaultManagerPaymentMethodDeletionError": "無法刪除付款方式,請再試一次。", "venmoAppFailedError": "在你的裝置上找不到 Venmo 應用程式。", "unsupportedCardTypeError": "不可使用此信用卡類型。請改用其他信用卡。", "applePayTokenizationError": "處理 Apple Pay 付款時發生網絡錯誤。再試一次。", "applePayActiveCardError": "在 Apple Pay 錢包中加入支援的信用卡。", "cardholderNameLabel": "持卡人名字", "cardNumberLabel": "卡號", "cvvLabel": "信用卡認證碼", "cvvThreeDigitLabelSubheading": "(3 位數)", "cvvFourDigitLabelSubheading": "(4 位數)", "cardholderNamePlaceholder": "持卡人名字", "expirationDateLabel": "到期日", "expirationDateLabelSubheading": "(MM/YY)", "expirationDatePlaceholder": "月 / 年", "postalCodeLabel": "郵遞區號", "payWithCard": "使用信用卡付款", "endingIn": "末碼為 {{lastFourCardDigits}}", "Apple Pay": "Apple Pay", "Venmo": "Venmo", "Card": "信用卡", "PayPal": "PayPal", "PayPal Credit": "PayPal Credit", "Google Pay": "Google Pay", "American Express": "American Express", "Discover": "Discover", "Diners Club": "Diners Club", "MasterCard": "Mastercard", "Visa": "Visa", "JCB": "JCB", "Maestro": "Maestro", "UnionPay": "UnionPay" }; },{}],166:[function(require,module,exports){ 'use strict'; module.exports = { "payingWith": "以 {{paymentSource}} 付款", "chooseAnotherWayToPay": "選擇付款的以其他方式付款", "chooseAWayToPay": "選擇付款方式", "otherWaysToPay": "其他付款方式", "edit": "編輯", "doneEditing": "完成", "editPaymentMethods": "編輯付款方式", "CreditCardDeleteConfirmationMessage": "確定要刪除末碼為 {{identifier}} 的 {{secondaryIdentifier}} 卡片嗎?", "PayPalAccountDeleteConfirmationMessage": "確定要刪除 {{identifier}} PayPal 帳戶嗎?", "VenmoAccountDeleteConfirmationMessage": "確定要刪除用戶名稱為 {{identifier}} 的 Venmo 帳戶嗎?", "genericDeleteConfirmationMessage": "確定要刪除此付款方式?", "deleteCancelButton": "取消", "deleteConfirmationButton": "刪除", "cardVerification": "信用卡認證", "fieldEmptyForCvv": "請填妥信用卡驗證碼。", "fieldEmptyForExpirationDate": "請填妥到期日。", "fieldEmptyForCardholderName": "請填妥持卡人姓名。", "fieldTooLongForCardholderName": "持卡人姓名不能超過 256 個字元。", "fieldEmptyForNumber": "請填妥號碼。", "fieldEmptyForPostalCode": "請填寫郵遞區號。", "fieldInvalidForCvv": "這組安全代碼無效。", "fieldInvalidForExpirationDate": "此到期日無效。", "fieldInvalidForNumber": "此卡號無效。", "fieldInvalidForPostalCode": "此郵遞區號無效。", "genericError": "我們的系統發生問題。", "hostedFieldsTokenizationFailOnDuplicateError": "此信用卡已存在,為已儲存的付款方式。", "hostedFieldsFailedTokenizationError": "請檢查你的資料並重試。", "hostedFieldsFieldsInvalidError": "請檢查你的資料並重試。", "hostedFieldsTokenizationNetworkErrorError": "網路錯誤。請重試。", "hostedFieldsTokenizationCvvVerificationFailedError": "信用卡認證失敗。請檢查你的資料並重試。", "paypalAccountTokenizationFailedError": "新增 PayPal 帳戶時,系統發生錯誤。請重試。", "paypalFlowFailedError": "連結至 PayPal 時,系統發生錯誤。請重試。", "paypalTokenizationRequestActiveError": "PayPal 支付款項的授權已在處理中。", "venmoCanceledError": "系統發生錯誤。確認你的裝置上裝有最新版本的 Venmo 應用程式,而且瀏覽器支援切換至 Venmo。", "vaultManagerPaymentMethodDeletionError": "無法刪除付款方式,請再試一次。", "venmoAppFailedError": "你的裝置上找不到 Venmo 應用程式。", "unsupportedCardTypeError": "不支援此卡片類型。請改用其他卡片。", "applePayTokenizationError": "在處理 Apple Pay 付款時發生網路錯誤。請重試。", "applePayActiveCardError": "新增支援的卡片至你的 Apple Pay 錢包。", "cardholderNameLabel": "持卡人姓名", "cardNumberLabel": "卡號", "cvvLabel": "CVV", "cvvThreeDigitLabelSubheading": "(3 位數)", "cvvFourDigitLabelSubheading": "(4 位數)", "cardholderNamePlaceholder": "持卡人姓名", "expirationDateLabel": "到期日", "expirationDateLabelSubheading": "(月 / 年)", "expirationDatePlaceholder": "月 / 年", "postalCodeLabel": "郵遞區號", "payWithCard": "使用信用卡 / 扣帳卡付款", "endingIn": "末碼為 {{lastFourCardDigits}}", "Apple Pay": "Apple Pay", "Venmo": "Venmo", "Card": "信用卡或扣帳卡", "PayPal": "PayPal", "PayPal Credit": "PayPal 信貸", "Google Pay": "Google Pay", "American Express": "美國運通 (American Express)", "Discover": "Discover", "Diners Club": "大來國際 (Diners Club)", "MasterCard": "Mastercard", "Visa": "Visa", "JCB": "JCB", "Maestro": "Maestro", "UnionPay": "UnionPay" }; },{}],167:[function(require,module,exports){ 'use strict'; var assign = require('../lib/assign').assign; var classlist = require('../lib/classlist'); var DropinError = require('../lib/dropin-error'); var errors = require('../constants').errors; var Promise = require('../lib/promise'); function BaseView(options) { options = options || {}; assign(this, options); } BaseView.prototype.getElementById = function (id) { if (!this.element) { return null; } return this.element.querySelector('[data-braintree-id="' + id + '"]'); }; BaseView.prototype.requestPaymentMethod = function () { return Promise.reject(new DropinError(errors.NO_PAYMENT_METHOD_ERROR)); }; BaseView.prototype.getPaymentMethod = function () { return this.activeMethodView && this.activeMethodView.paymentMethod; }; BaseView.prototype.onSelection = function () {}; BaseView.prototype.teardown = function () { return Promise.resolve(); }; BaseView.prototype.preventUserAction = function () { if (this.element) { classlist.add(this.element, 'braintree-sheet--loading'); } this.model.preventUserAction(); }; BaseView.prototype.allowUserAction = function () { if (this.element) { classlist.remove(this.element, 'braintree-sheet--loading'); } this.model.allowUserAction(); }; module.exports = BaseView; },{"../constants":117,"../lib/assign":124,"../lib/classlist":126,"../lib/dropin-error":129,"../lib/promise":137}],168:[function(require,module,exports){ 'use strict'; var BaseView = require('./base-view'); var addSelectionEventHandler = require('../lib/add-selection-event-handler'); var paymentMethodTypes = require('../constants').paymentMethodTypes; function DeleteConfirmationView() { BaseView.apply(this, arguments); this._initialize(); } DeleteConfirmationView.prototype = Object.create(BaseView.prototype); DeleteConfirmationView.prototype.constructor = DeleteConfirmationView; DeleteConfirmationView.ID = DeleteConfirmationView.prototype.ID = 'delete-confirmation'; DeleteConfirmationView.prototype._initialize = function () { this._yesButton = this.getElementById('delete-confirmation__yes'); this._noButton = this.getElementById('delete-confirmation__no'); this._messageBox = this.getElementById('delete-confirmation__message'); addSelectionEventHandler(this._yesButton, function () { this.model.deleteVaultedPaymentMethod(); }.bind(this)); addSelectionEventHandler(this._noButton, function () { this.model.cancelDeleteVaultedPaymentMethod(); }.bind(this)); }; DeleteConfirmationView.prototype.applyPaymentMethod = function (paymentMethod) { var identifier, secondaryIdentifier; var messageText = this.strings[paymentMethod.type + 'DeleteConfirmationMessage']; if (messageText) { switch (paymentMethod.type) { case paymentMethodTypes.card: identifier = paymentMethod.details.lastFour; secondaryIdentifier = paymentMethod.details.cardType; break; case paymentMethodTypes.paypal: identifier = paymentMethod.details.email; break; case paymentMethodTypes.venmo: identifier = paymentMethod.details.username; break; default: break; } messageText = messageText.replace('{{identifier}}', identifier); if (secondaryIdentifier) { messageText = messageText.replace('{{secondaryIdentifier}}', secondaryIdentifier); } } else { messageText = this.strings.genericDeleteConfirmationMessage; } this._messageBox.innerText = messageText; }; module.exports = DeleteConfirmationView; },{"../constants":117,"../lib/add-selection-event-handler":121,"./base-view":167}],169:[function(require,module,exports){ 'use strict'; var analytics = require('../lib/analytics'); var analyticsKinds = require('../constants').analyticsKinds; var BaseView = require('./base-view'); var classlist = require('../lib/classlist'); var sheetViews = require('./payment-sheet-views'); var PaymentMethodsView = require('./payment-methods-view'); var PaymentOptionsView = require('./payment-options-view'); var DeleteConfirmationView = require('./delete-confirmation-view'); var addSelectionEventHandler = require('../lib/add-selection-event-handler'); var Promise = require('../lib/promise'); var supportsFlexbox = require('../lib/supports-flexbox'); var CHANGE_ACTIVE_PAYMENT_METHOD_TIMEOUT = require('../constants').CHANGE_ACTIVE_PAYMENT_METHOD_TIMEOUT; var DEVELOPER_MISCONFIGURATION_MESSAGE = require('../constants').errors.DEVELOPER_MISCONFIGURATION_MESSAGE; function MainView() { BaseView.apply(this, arguments); this.dependenciesInitializing = 0; this._initialize(); } MainView.prototype = Object.create(BaseView.prototype); MainView.prototype.constructor = MainView; MainView.prototype._initialize = function () { var paymentOptionsView; this._hasMultiplePaymentOptions = this.model.supportedPaymentOptions.length > 1; this._views = {}; this.sheetContainer = this.getElementById('sheet-container'); this.sheetErrorText = this.getElementById('sheet-error-text'); this.toggle = this.getElementById('toggle'); this.disableWrapper = this.getElementById('disable-wrapper'); this.lowerContainer = this.getElementById('lower-container'); this.loadingContainer = this.getElementById('loading-container'); this.dropinContainer = this.element.querySelector('.braintree-dropin'); this.supportsFlexbox = supportsFlexbox(); this.model.on('asyncDependenciesReady', this.hideLoadingIndicator.bind(this)); this.model.on('errorOccurred', this.showSheetError.bind(this)); this.model.on('errorCleared', this.hideSheetError.bind(this)); this.model.on('preventUserAction', this.preventUserAction.bind(this)); this.model.on('allowUserAction', this.allowUserAction.bind(this)); this.paymentSheetViewIDs = Object.keys(sheetViews).reduce(function (ids, sheetViewKey) { var PaymentSheetView, paymentSheetView; if (this.model.supportedPaymentOptions.indexOf(sheetViewKey) !== -1) { PaymentSheetView = sheetViews[sheetViewKey]; paymentSheetView = new PaymentSheetView({ element: this.getElementById(PaymentSheetView.ID), mainView: this, model: this.model, client: this.client, strings: this.strings }); paymentSheetView.initialize(); this.addView(paymentSheetView); ids.push(paymentSheetView.ID); } return ids; }.bind(this), []); this.paymentMethodsViews = new PaymentMethodsView({ element: this.element, model: this.model, strings: this.strings }); this.addView(this.paymentMethodsViews); this.deleteConfirmationView = new DeleteConfirmationView({ element: this.getElementById('delete-confirmation'), model: this.model, strings: this.strings }); this.addView(this.deleteConfirmationView); addSelectionEventHandler(this.toggle, this.toggleAdditionalOptions.bind(this)); this.model.on('changeActivePaymentMethod', function () { setTimeout(function () { this.setPrimaryView(PaymentMethodsView.ID); }.bind(this), CHANGE_ACTIVE_PAYMENT_METHOD_TIMEOUT); }.bind(this)); this.model.on('changeActivePaymentView', function (id) { var activePaymentView = this.getView(id); if (id === PaymentMethodsView.ID) { classlist.add(this.paymentMethodsViews.container, 'braintree-methods--active'); classlist.remove(this.sheetContainer, 'braintree-sheet--active'); } else { setTimeout(function () { classlist.add(this.sheetContainer, 'braintree-sheet--active'); }.bind(this), 0); classlist.remove(this.paymentMethodsViews.container, 'braintree-methods--active'); if (!this.getView(id).getPaymentMethod()) { this.model.setPaymentMethodRequestable({ isRequestable: false }); } } activePaymentView.onSelection(); }.bind(this)); this.model.on('removeActivePaymentMethod', function () { var activePaymentView = this.getView(this.model.getActivePaymentView()); if (activePaymentView && typeof activePaymentView.removeActivePaymentMethod === 'function') { activePaymentView.removeActivePaymentMethod(); } }.bind(this)); this.model.on('enableEditMode', this.enableEditMode.bind(this)); this.model.on('disableEditMode', this.disableEditMode.bind(this)); this.model.on('confirmPaymentMethodDeletion', this.openConfirmPaymentMethodDeletionDialog.bind(this)); this.model.on('cancelVaultedPaymentMethodDeletion', this.cancelVaultedPaymentMethodDeletion.bind(this)); this.model.on('startVaultedPaymentMethodDeletion', this.startVaultedPaymentMethodDeletion.bind(this)); this.model.on('finishVaultedPaymentMethodDeletion', this.finishVaultedPaymentMethodDeletion.bind(this)); if (this._hasMultiplePaymentOptions) { paymentOptionsView = new PaymentOptionsView({ client: this.client, element: this.getElementById(PaymentOptionsView.ID), mainView: this, model: this.model, strings: this.strings }); this.addView(paymentOptionsView); } this._sendToDefaultView(); }; MainView.prototype.addView = function (view) { this._views[view.ID] = view; }; MainView.prototype.getView = function (id) { return this._views[id]; }; MainView.prototype.setPrimaryView = function (id, secondaryViewId) { var paymentMethod; setTimeout(function () { this.element.className = prefixShowClass(id); if (secondaryViewId) { classlist.add(this.element, prefixShowClass(secondaryViewId)); } }.bind(this), 0); this.primaryView = this.getView(id); this.model.changeActivePaymentView(id); if (this.paymentSheetViewIDs.indexOf(id) !== -1) { if (this.model.getPaymentMethods().length > 0 || this.getView(PaymentOptionsView.ID)) { this.showToggle(); } else { this.hideToggle(); } } else if (id === PaymentMethodsView.ID) { this.showToggle(); // Move options below the upper-container this.getElementById('lower-container').appendChild(this.getElementById('options')); } else if (id === PaymentOptionsView.ID) { this.hideToggle(); } if (!this.supportsFlexbox) { this.element.setAttribute('data-braintree-no-flexbox', true); } paymentMethod = this.primaryView.getPaymentMethod(); this.model.setPaymentMethodRequestable({ isRequestable: Boolean(paymentMethod), type: paymentMethod && paymentMethod.type, selectedPaymentMethod: paymentMethod }); this.model.clearError(); }; MainView.prototype.requestPaymentMethod = function () { var activePaymentView = this.getView(this.model.getActivePaymentView()); return activePaymentView.requestPaymentMethod().then(function (payload) { analytics.sendEvent(this.client, 'request-payment-method.' + analyticsKinds[payload.type]); return payload; }.bind(this)).catch(function (err) { analytics.sendEvent(this.client, 'request-payment-method.error'); return Promise.reject(err); }.bind(this)); }; MainView.prototype.hideLoadingIndicator = function () { classlist.add(this.dropinContainer, 'braintree-loaded'); classlist.add(this.loadingContainer, 'braintree-hidden'); }; MainView.prototype.showLoadingIndicator = function () { classlist.remove(this.dropinContainer, 'braintree-loaded'); classlist.remove(this.loadingContainer, 'braintree-hidden'); }; MainView.prototype.toggleAdditionalOptions = function () { var sheetViewID; var isPaymentSheetView = this.paymentSheetViewIDs.indexOf(this.primaryView.ID) !== -1; this.hideToggle(); if (!this._hasMultiplePaymentOptions) { sheetViewID = this.paymentSheetViewIDs[0]; classlist.add(this.element, prefixShowClass(sheetViewID)); this.model.changeActivePaymentView(sheetViewID); } else if (isPaymentSheetView) { if (this.model.getPaymentMethods().length === 0) { this.setPrimaryView(PaymentOptionsView.ID); } else { this.setPrimaryView(PaymentMethodsView.ID, PaymentOptionsView.ID); this.hideToggle(); } } else { classlist.add(this.element, prefixShowClass(PaymentOptionsView.ID)); } }; MainView.prototype.showToggle = function () { if (this.model.isInEditMode()) { return; } classlist.remove(this.toggle, 'braintree-hidden'); classlist.add(this.lowerContainer, 'braintree-hidden'); }; MainView.prototype.hideToggle = function () { classlist.add(this.toggle, 'braintree-hidden'); classlist.remove(this.lowerContainer, 'braintree-hidden'); }; MainView.prototype.showSheetError = function (error) { var errorMessage; var genericErrorMessage = this.strings.genericError; if (this.strings.hasOwnProperty(error)) { errorMessage = this.strings[error]; } else if (error && error.code) { errorMessage = this.strings[snakeCaseToCamelCase(error.code) + 'Error'] || genericErrorMessage; } else if (error === 'developerError') { errorMessage = DEVELOPER_MISCONFIGURATION_MESSAGE; } else { errorMessage = genericErrorMessage; } classlist.add(this.dropinContainer, 'braintree-sheet--has-error'); this.sheetErrorText.innerHTML = errorMessage; }; MainView.prototype.hideSheetError = function () { classlist.remove(this.dropinContainer, 'braintree-sheet--has-error'); }; MainView.prototype.getOptionsElements = function () { return this._views.options.elements; }; MainView.prototype.preventUserAction = function () { classlist.remove(this.disableWrapper, 'braintree-hidden'); }; MainView.prototype.allowUserAction = function () { classlist.add(this.disableWrapper, 'braintree-hidden'); }; MainView.prototype.teardown = function () { var error; var viewNames = Object.keys(this._views); var teardownPromises = viewNames.map(function (view) { return this._views[view].teardown().catch(function (err) { error = err; }); }.bind(this)); return Promise.all(teardownPromises).then(function () { if (error) { return Promise.reject(error); } return Promise.resolve(); }); }; MainView.prototype.enableEditMode = function () { this.setPrimaryView(this.paymentMethodsViews.ID); this.paymentMethodsViews.enableEditMode(); this.hideToggle(); this.model.setPaymentMethodRequestable({ isRequestable: false }); }; MainView.prototype.disableEditMode = function () { var paymentMethod; this.hideSheetError(); this.paymentMethodsViews.disableEditMode(); this.showToggle(); paymentMethod = this.primaryView.getPaymentMethod(); this.model.setPaymentMethodRequestable({ isRequestable: Boolean(paymentMethod), type: paymentMethod && paymentMethod.type, selectedPaymentMethod: paymentMethod }); }; MainView.prototype.openConfirmPaymentMethodDeletionDialog = function (paymentMethod) { this.deleteConfirmationView.applyPaymentMethod(paymentMethod); this.setPrimaryView(this.deleteConfirmationView.ID); }; MainView.prototype.cancelVaultedPaymentMethodDeletion = function () { this.setPrimaryView(this.paymentMethodsViews.ID); }; MainView.prototype.startVaultedPaymentMethodDeletion = function () { this.element.className = ''; this.showLoadingIndicator(); }; MainView.prototype.finishVaultedPaymentMethodDeletion = function (error) { var self = this; this.paymentMethodsViews.refreshPaymentMethods(); if (error && this.model.getPaymentMethods().length > 0) { this.model.enableEditMode(); this.showSheetError('vaultManagerPaymentMethodDeletionError'); } else { this._sendToDefaultView(); } return new Promise(function (resolve) { setTimeout(function () { // allow all the views to reset before hiding the loading indicator self.hideLoadingIndicator(); resolve(); }, 500); }); }; MainView.prototype._sendToDefaultView = function () { var paymentMethods = this.model.getPaymentMethods(); var preselectVaultedPaymentMethod = this.model.merchantConfiguration.preselectVaultedPaymentMethod !== false; if (paymentMethods.length > 0) { if (preselectVaultedPaymentMethod) { this.model.changeActivePaymentMethod(paymentMethods[0]); } else { this.setPrimaryView(this.paymentMethodsViews.ID); } } else if (this._hasMultiplePaymentOptions) { this.setPrimaryView(PaymentOptionsView.ID); } else { this.setPrimaryView(this.paymentSheetViewIDs[0]); } }; function snakeCaseToCamelCase(s) { return s.toLowerCase().replace(/(\_\w)/g, function (m) { return m[1].toUpperCase(); }); } function prefixShowClass(classname) { return 'braintree-show-' + classname; } module.exports = MainView; },{"../constants":117,"../lib/add-selection-event-handler":121,"../lib/analytics":122,"../lib/classlist":126,"../lib/promise":137,"../lib/supports-flexbox":139,"./base-view":167,"./delete-confirmation-view":168,"./payment-methods-view":171,"./payment-options-view":172,"./payment-sheet-views":177}],170:[function(require,module,exports){ 'use strict'; var BaseView = require('./base-view'); var classlist = require('../lib/classlist'); var constants = require('../constants'); var addSelectionEventHandler = require('../lib/add-selection-event-handler'); var paymentMethodHTML = "
\n
\n \n \n \n
\n
@DISABLE_MESSAGE
\n
\n\n
\n \n \n \n
\n\n
@TITLE
@SUBTITLE
\n\n
\n
\n \n \n \n
\n
\n"; function PaymentMethodView() { BaseView.apply(this, arguments); this._initialize(); } PaymentMethodView.prototype = Object.create(BaseView.prototype); PaymentMethodView.prototype.constructor = PaymentMethodView; PaymentMethodView.prototype._initialize = function () { var endingInText; var html = paymentMethodHTML; var paymentMethodCardTypes = constants.paymentMethodCardTypes; var paymentMethodTypes = constants.paymentMethodTypes; this.element = document.createElement('div'); this.element.className = 'braintree-method'; this.element.setAttribute('tabindex', '0'); addSelectionEventHandler(this.element, this._choosePaymentMethod.bind(this)); html = html.replace(/@DISABLE_MESSAGE/g, this.strings.hasSubscription); switch (this.paymentMethod.type) { case paymentMethodTypes.applePay: html = html.replace(/@ICON/g, 'logoApplePay') .replace(/@CLASSNAME/g, '') .replace(/@TITLE/g, this.strings['Apple Pay']) .replace(/@SUBTITLE/g, ''); break; case paymentMethodTypes.card: endingInText = this.strings.endingIn.replace('{{lastFourCardDigits}}', this.paymentMethod.details.lastFour); html = html.replace(/@ICON/g, 'icon-' + paymentMethodCardTypes[this.paymentMethod.details.cardType]) .replace(/@CLASSNAME/g, ' braintree-icon--bordered') .replace(/@TITLE/g, endingInText) .replace(/@SUBTITLE/g, this.strings[this.paymentMethod.details.cardType]); break; case paymentMethodTypes.googlePay: html = html.replace(/@ICON/g, 'logoGooglePay') .replace(/@CLASSNAME/g, '') .replace(/@TITLE/g, this.strings['Google Pay']) .replace(/@SUBTITLE/g, ''); break; case paymentMethodTypes.paypal: html = html.replace(/@ICON/g, 'logoPayPal') .replace(/@CLASSNAME/g, '') .replace(/@TITLE/g, this.paymentMethod.details.email) .replace(/@SUBTITLE/g, this.strings.PayPal); break; case paymentMethodTypes.venmo: html = html.replace(/@ICON/g, 'logoVenmo') .replace(/@CLASSNAME/g, '') .replace(/@TITLE/g, this.paymentMethod.details.username) .replace(/@SUBTITLE/g, this.strings.Venmo); break; default: break; } this.element.innerHTML = html; this.checkMark = this.element.querySelector('.braintree-method__check-container'); addSelectionEventHandler(this.element.querySelector('.braintree-method__delete-container'), this._selectDelete.bind(this)); }; PaymentMethodView.prototype.setActive = function (isActive) { // setTimeout required to animate addition of new payment methods setTimeout(function () { classlist.toggle(this.element, 'braintree-method--active', isActive); }.bind(this), 0); }; PaymentMethodView.prototype.enableEditMode = function () { classlist.add(this.checkMark, 'braintree-hidden'); if (this.paymentMethod.hasSubscription) { classlist.add(this.element, 'braintree-method--disabled'); } }; PaymentMethodView.prototype.disableEditMode = function () { classlist.remove(this.checkMark, 'braintree-hidden'); classlist.remove(this.element, 'braintree-method--disabled'); }; PaymentMethodView.prototype._choosePaymentMethod = function () { if (this.model.isInEditMode()) { return; } this.model.changeActivePaymentMethod(this.paymentMethod); }; PaymentMethodView.prototype._selectDelete = function () { this.model.confirmPaymentMethodDeletion(this.paymentMethod); }; module.exports = PaymentMethodView; },{"../constants":117,"../lib/add-selection-event-handler":121,"../lib/classlist":126,"./base-view":167}],171:[function(require,module,exports){ 'use strict'; var BaseView = require('./base-view'); var PaymentMethodView = require('./payment-method-view'); var DropinError = require('../lib/dropin-error'); var classlist = require('../lib/classlist'); var errors = require('../constants').errors; var Promise = require('../lib/promise'); var addSelectionEventHandler = require('../lib/add-selection-event-handler'); var PAYMENT_METHOD_TYPE_TO_TRANSLATION_STRING = { CreditCard: 'Card', PayPalAccount: 'PayPal', ApplePayCard: 'Apple Pay', AndroidPayCard: 'Google Pay', VenmoAccount: 'Venmo' }; function PaymentMethodsView() { BaseView.apply(this, arguments); this._initialize(); } PaymentMethodsView.prototype = Object.create(BaseView.prototype); PaymentMethodsView.prototype.constructor = PaymentMethodsView; PaymentMethodsView.ID = PaymentMethodsView.prototype.ID = 'methods'; PaymentMethodsView.prototype._initialize = function () { this.views = []; this.container = this.getElementById('methods-container'); this._headingLabel = this.getElementById('methods-label'); this._editButton = this.getElementById('methods-edit'); this.model.on('addPaymentMethod', this._addPaymentMethod.bind(this)); this.model.on('changeActivePaymentMethod', this._changeActivePaymentMethodView.bind(this)); this.model.on('refreshPaymentMethods', this.refreshPaymentMethods.bind(this)); this.refreshPaymentMethods(); if (this.model.merchantConfiguration.vaultManager) { this.model.on('removePaymentMethod', this._removePaymentMethod.bind(this)); addSelectionEventHandler(this._editButton, function () { if (this.model.isInEditMode()) { this.model.disableEditMode(); } else { this.model.enableEditMode(); } }.bind(this)); classlist.remove(this._editButton, 'braintree-hidden'); } }; PaymentMethodsView.prototype.removeActivePaymentMethod = function () { if (!this.activeMethodView) { return; } this.activeMethodView.setActive(false); this.activeMethodView = null; classlist.add(this._headingLabel, 'braintree-no-payment-method-selected'); }; PaymentMethodsView.prototype._getPaymentMethodString = function () { var stringKey, paymentMethodTypeString; if (!this.activeMethodView) { return ''; } stringKey = PAYMENT_METHOD_TYPE_TO_TRANSLATION_STRING[this.activeMethodView.paymentMethod.type]; paymentMethodTypeString = this.strings[stringKey]; return this.strings.payingWith.replace('{{paymentSource}}', paymentMethodTypeString); }; PaymentMethodsView.prototype.enableEditMode = function () { classlist.add(this.container, 'braintree-methods--edit'); this._editButton.innerHTML = this.strings.deleteCancelButton; this._headingLabel.innerHTML = this.strings.editPaymentMethods; this.views.forEach(function (view) { view.enableEditMode(); }); }; PaymentMethodsView.prototype.disableEditMode = function () { classlist.remove(this.container, 'braintree-methods--edit'); this._editButton.innerHTML = this.strings.edit; this._headingLabel.innerHTML = this._getPaymentMethodString(); this.views.forEach(function (view) { view.disableEditMode(); }); }; PaymentMethodsView.prototype._addPaymentMethod = function (paymentMethod) { var paymentMethodView = new PaymentMethodView({ model: this.model, paymentMethod: paymentMethod, strings: this.strings }); if (this.model.isGuestCheckout && this.container.firstChild) { this.container.removeChild(this.container.firstChild); this.views.pop(); } if (this.container.firstChild) { this.container.insertBefore(paymentMethodView.element, this.container.firstChild); } else { this.container.appendChild(paymentMethodView.element); } this.views.push(paymentMethodView); }; PaymentMethodsView.prototype._removePaymentMethod = function (paymentMethod) { var i; for (i = 0; i < this.views.length; i++) { if (this.views[i].paymentMethod === paymentMethod) { this.container.removeChild(this.views[i].element); this._headingLabel.innerHTML = ' '; this.views.splice(i, 1); break; } } }; PaymentMethodsView.prototype._changeActivePaymentMethodView = function (paymentMethod) { var i; var previousActiveMethodView = this.activeMethodView; for (i = 0; i < this.views.length; i++) { if (this.views[i].paymentMethod === paymentMethod) { this.activeMethodView = this.views[i]; this._headingLabel.innerHTML = this._getPaymentMethodString(); break; } } if (previousActiveMethodView) { previousActiveMethodView.setActive(false); } this.activeMethodView.setActive(true); classlist.remove(this._headingLabel, 'braintree-no-payment-method-selected'); }; PaymentMethodsView.prototype.requestPaymentMethod = function () { if (!this.activeMethodView || this.model.isInEditMode()) { return Promise.reject(new DropinError(errors.NO_PAYMENT_METHOD_ERROR)); } return Promise.resolve(this.activeMethodView.paymentMethod); }; PaymentMethodsView.prototype.refreshPaymentMethods = function () { var i; var paymentMethods = this.model.getPaymentMethods(); this.views.forEach(function (view) { this.container.removeChild(view.element); }.bind(this)); this.views = []; for (i = paymentMethods.length - 1; i >= 0; i--) { this._addPaymentMethod(paymentMethods[i]); } }; module.exports = PaymentMethodsView; },{"../constants":117,"../lib/add-selection-event-handler":121,"../lib/classlist":126,"../lib/dropin-error":129,"../lib/promise":137,"./base-view":167,"./payment-method-view":170}],172:[function(require,module,exports){ 'use strict'; var analytics = require('../lib/analytics'); var addSelectionEventHandler = require('../lib/add-selection-event-handler'); var BaseView = require('./base-view'); var paymentOptionIDs = require('../constants').paymentOptionIDs; var paymentMethodOptionHTML = "
\n \n \n \n
\n\n
\n @OPTION_TITLE\n
\n
\n"; function PaymentOptionsView() { BaseView.apply(this, arguments); this._initialize(); } PaymentOptionsView.prototype = Object.create(BaseView.prototype); PaymentOptionsView.prototype.constructor = PaymentOptionsView; PaymentOptionsView.ID = PaymentOptionsView.prototype.ID = 'options'; PaymentOptionsView.prototype._initialize = function () { this.container = this.getElementById('payment-options-container'); this.elements = {}; this.model.supportedPaymentOptions.forEach(function (paymentOptionID) { this._addPaymentOption(paymentOptionID); }.bind(this)); }; PaymentOptionsView.prototype._addPaymentOption = function (paymentOptionID) { var paymentSource; var div = document.createElement('div'); var html = paymentMethodOptionHTML; var clickHandler = function clickHandler() { this.mainView.setPrimaryView(paymentOptionID); this.model.selectPaymentOption(paymentOptionID); analytics.sendEvent(this.client, 'selected.' + paymentOptionIDs[paymentOptionID]); }.bind(this); div.className = 'braintree-option braintree-option__' + paymentOptionID; div.setAttribute('tabindex', '0'); switch (paymentOptionID) { case paymentOptionIDs.applePay: paymentSource = this.strings['Apple Pay']; html = html.replace(/@ICON/g, 'logoApplePay'); break; case paymentOptionIDs.card: paymentSource = this.strings.Card; html = html.replace(/@ICON/g, 'iconCardFront'); html = html.replace(/@CLASSNAME/g, 'braintree-icon--bordered'); break; case paymentOptionIDs.googlePay: paymentSource = this.strings['Google Pay']; html = html.replace(/@ICON/g, 'logoGooglePay'); break; case paymentOptionIDs.paypal: paymentSource = this.strings.PayPal; html = html.replace(/@ICON/g, 'logoPayPal'); break; case paymentOptionIDs.paypalCredit: paymentSource = this.strings['PayPal Credit']; html = html.replace(/@ICON/g, 'logoPayPalCredit'); break; case paymentOptionIDs.venmo: paymentSource = this.strings.Venmo; html = html.replace(/@ICON/g, 'logoVenmo'); break; default: break; } html = html.replace(/@OPTION_LABEL/g, this._generateOptionLabel(paymentSource)); html = html.replace(/@OPTION_TITLE/g, paymentSource); html = html.replace(/@CLASSNAME/g, ''); div.innerHTML = html; addSelectionEventHandler(div, clickHandler); this.container.appendChild(div); this.elements[paymentOptionID] = { div: div, clickHandler: clickHandler }; }; PaymentOptionsView.prototype._generateOptionLabel = function (paymentSourceString) { return this.strings.payingWith.replace('{{paymentSource}}', paymentSourceString); }; module.exports = PaymentOptionsView; },{"../constants":117,"../lib/add-selection-event-handler":121,"../lib/analytics":122,"./base-view":167}],173:[function(require,module,exports){ (function (global){ 'use strict'; var assign = require('../../lib/assign').assign; var BaseView = require('../base-view'); var btApplePay = require('braintree-web/apple-pay'); var DropinError = require('../../lib/dropin-error'); var isHTTPS = require('../../lib/is-https'); var Promise = require('../../lib/promise'); var paymentOptionIDs = require('../../constants').paymentOptionIDs; function ApplePayView() { BaseView.apply(this, arguments); } ApplePayView.prototype = Object.create(BaseView.prototype); ApplePayView.prototype.constructor = ApplePayView; ApplePayView.ID = ApplePayView.prototype.ID = paymentOptionIDs.applePay; ApplePayView.prototype.initialize = function () { var self = this; self.applePayConfiguration = assign({}, self.model.merchantConfiguration.applePay); self.model.asyncDependencyStarting(); return btApplePay.create({client: this.client}).then(function (applePayInstance) { var buttonDiv = self.getElementById('apple-pay-button'); self.applePayInstance = applePayInstance; self.model.on('changeActivePaymentView', function (paymentViewID) { if (paymentViewID !== self.ID) { return; } global.ApplePaySession.canMakePaymentsWithActiveCard(self.applePayInstance.merchantIdentifier).then(function (canMakePayments) { if (!canMakePayments) { self.model.reportError('applePayActiveCardError'); } }); }); buttonDiv.onclick = self._showPaymentSheet.bind(self); buttonDiv.style['-apple-pay-button-style'] = self.model.merchantConfiguration.applePay.buttonStyle || 'black'; self.model.asyncDependencyReady(); }).catch(function (err) { self.model.asyncDependencyFailed({ view: self.ID, error: new DropinError(err) }); }); }; ApplePayView.prototype._showPaymentSheet = function () { var self = this; var request = self.applePayInstance.createPaymentRequest(this.applePayConfiguration.paymentRequest); var session = new global.ApplePaySession(2, request); session.onvalidatemerchant = function (event) { self.applePayInstance.performValidation({ validationURL: event.validationURL, displayName: self.applePayConfiguration.displayName }).then(function (validationData) { session.completeMerchantValidation(validationData); }).catch(function (validationErr) { self.model.reportError(validationErr); session.abort(); }); }; session.onpaymentauthorized = function (event) { self.applePayInstance.tokenize({ token: event.payment.token }).then(function (payload) { session.completePayment(global.ApplePaySession.STATUS_SUCCESS); payload.payment = event.payment; self.model.addPaymentMethod(payload); }).catch(function (tokenizeErr) { self.model.reportError(tokenizeErr); session.completePayment(global.ApplePaySession.STATUS_FAILURE); }); }; session.begin(); return false; }; ApplePayView.prototype.updateConfiguration = function (key, value) { this.applePayConfiguration[key] = value; }; ApplePayView.isEnabled = function (options) { var gatewayConfiguration = options.client.getConfiguration().gatewayConfiguration; var applePayEnabled = gatewayConfiguration.applePayWeb && Boolean(options.merchantConfiguration.applePay); var applePayBrowserSupported; if (!applePayEnabled) { return Promise.resolve(false); } applePayBrowserSupported = global.ApplePaySession && isHTTPS.isHTTPS(); if (!applePayBrowserSupported) { return Promise.resolve(false); } return Promise.resolve(Boolean(global.ApplePaySession.canMakePayments())); }; module.exports = ApplePayView; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"../../constants":117,"../../lib/assign":124,"../../lib/dropin-error":129,"../../lib/is-https":133,"../../lib/promise":137,"../base-view":167,"braintree-web/apple-pay":24}],174:[function(require,module,exports){ (function (global){ 'use strict'; var analytics = require('../../lib/analytics'); var assign = require('../../lib/assign').assign; var browserDetection = require('../../lib/browser-detection'); var BaseView = require('../base-view'); var btPaypal = require('braintree-web/paypal-checkout'); var DropinError = require('../../lib/dropin-error'); var constants = require('../../constants'); var assets = require('../../lib/assets'); var translations = require('../../translations').fiveCharacterLocales; var Promise = require('../../lib/promise'); var ASYNC_DEPENDENCY_TIMEOUT = 30000; var READ_ONLY_CONFIGURATION_OPTIONS = ['offerCredit', 'locale']; var DEFAULT_CHECKOUTJS_LOG_LEVEL = 'warn'; var paypalScriptLoadInProgressPromise; function BasePayPalView() { BaseView.apply(this, arguments); } BasePayPalView.prototype = Object.create(BaseView.prototype); BasePayPalView.prototype.initialize = function () { var asyncDependencyTimeoutHandler; var isCredit = Boolean(this._isPayPalCredit); var setupComplete = false; var self = this; var paypalType = isCredit ? 'paypalCredit' : 'paypal'; var paypalConfiguration = this.model.merchantConfiguration[paypalType]; this.paypalConfiguration = assign({}, paypalConfiguration); this.model.asyncDependencyStarting(); asyncDependencyTimeoutHandler = setTimeout(function () { self.model.asyncDependencyFailed({ view: self.ID, error: new DropinError('There was an error connecting to PayPal.') }); }, ASYNC_DEPENDENCY_TIMEOUT); return btPaypal.create({client: this.client}).then(function (paypalInstance) { var checkoutJSConfiguration; var buttonSelector = '[data-braintree-id="paypal-button"]'; var environment = self.client.getConfiguration().gatewayConfiguration.environment === 'production' ? 'production' : 'sandbox'; var locale = self.model.merchantConfiguration.locale; self.paypalInstance = paypalInstance; self.paypalConfiguration.offerCredit = Boolean(isCredit); checkoutJSConfiguration = { env: environment, style: self.paypalConfiguration.buttonStyle || {}, commit: self.paypalConfiguration.commit, payment: function () { return paypalInstance.createPayment(self.paypalConfiguration).catch(reportError); }, onAuthorize: function (data) { return paypalInstance.tokenizePayment(data).then(function (tokenizePayload) { if (self.paypalConfiguration.flow === 'vault' && !self.model.isGuestCheckout) { tokenizePayload.vaulted = true; } self.model.addPaymentMethod(tokenizePayload); }).catch(reportError); }, onError: reportError }; if (locale && locale in translations) { self.paypalConfiguration.locale = locale; checkoutJSConfiguration.locale = locale; } if (isCredit) { buttonSelector = '[data-braintree-id="paypal-credit-button"]'; checkoutJSConfiguration.style.label = 'credit'; } return global.paypal.Button.render(checkoutJSConfiguration, buttonSelector).then(function () { self.model.asyncDependencyReady(); setupComplete = true; clearTimeout(asyncDependencyTimeoutHandler); }); }).catch(reportError); function reportError(err) { if (setupComplete) { self.model.reportError(err); } else { self.model.asyncDependencyFailed({ view: self.ID, error: err }); clearTimeout(asyncDependencyTimeoutHandler); } } }; BasePayPalView.prototype.updateConfiguration = function (key, value) { if (READ_ONLY_CONFIGURATION_OPTIONS.indexOf(key) === -1) { this.paypalConfiguration[key] = value; } }; BasePayPalView.isEnabled = function (options) { var gatewayConfiguration = options.client.getConfiguration().gatewayConfiguration; if (!gatewayConfiguration.paypalEnabled) { return Promise.resolve(false); } if (browserDetection.isIe9() || browserDetection.isIe10()) { analytics.sendEvent(options.client, options.viewID + '.checkout.js-browser-not-supported'); return Promise.resolve(false); } if (global.paypal && global.paypal.Button) { return Promise.resolve(true); } if (paypalScriptLoadInProgressPromise) { return paypalScriptLoadInProgressPromise; } paypalScriptLoadInProgressPromise = assets.loadScript({ src: constants.CHECKOUT_JS_SOURCE, id: constants.PAYPAL_CHECKOUT_SCRIPT_ID, dataAttributes: { 'log-level': options.merchantConfiguration.paypal.logLevel || DEFAULT_CHECKOUTJS_LOG_LEVEL } }).then(function () { return Promise.resolve(true); }).catch(function () { return Promise.resolve(false); }).then(function (result) { paypalScriptLoadInProgressPromise = null; return Promise.resolve(result); }); return paypalScriptLoadInProgressPromise; }; module.exports = BasePayPalView; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"../../constants":117,"../../lib/analytics":122,"../../lib/assets":123,"../../lib/assign":124,"../../lib/browser-detection":125,"../../lib/dropin-error":129,"../../lib/promise":137,"../../translations":152,"../base-view":167,"braintree-web/paypal-checkout":93}],175:[function(require,module,exports){ 'use strict'; var assign = require('../../lib/assign').assign; var BaseView = require('../base-view'); var classlist = require('../../lib/classlist'); var constants = require('../../constants'); var DropinError = require('../../lib/dropin-error'); var hostedFields = require('braintree-web/hosted-fields'); var isUtf8 = require('../../lib/is-utf-8'); var transitionHelper = require('../../lib/transition-helper'); var Promise = require('../../lib/promise'); var cardIconHTML = "
\n \n \n \n
\n
\n \n \n \n
\n
\n \n \n \n
\n
\n \n \n \n
\n
\n \n \n \n
\n\n
\n \n \n \n
\n
\n \n \n \n
\n
\n \n \n \n
\n"; function CardView() { BaseView.apply(this, arguments); } CardView.prototype = Object.create(BaseView.prototype); CardView.prototype.constructor = CardView; CardView.ID = CardView.prototype.ID = constants.paymentOptionIDs.card; CardView.prototype.initialize = function () { var cvvFieldGroup, postalCodeFieldGroup; var cardholderNameField = this.getElementById('cardholder-name-field-group'); var cardIcons = this.getElementById('card-view-icons'); var hfOptions = this._generateHostedFieldsOptions(); cardIcons.innerHTML = cardIconHTML; this._hideUnsupportedCardIcons(); this.hasCVV = hfOptions.fields.cvv; this.hasCardholderName = Boolean(this.model.merchantConfiguration.card && this.model.merchantConfiguration.card.cardholderName); this.cardholderNameInput = cardholderNameField.querySelector('input'); this.cardNumberIcon = this.getElementById('card-number-icon'); this.cardNumberIconSvg = this.getElementById('card-number-icon-svg'); this.cvvIcon = this.getElementById('cvv-icon'); this.cvvIconSvg = this.getElementById('cvv-icon-svg'); this.cvvLabelDescriptor = this.getElementById('cvv-label-descriptor'); this.fieldErrors = {}; this.extraInputs = [ { fieldName: 'cardholderName', enabled: this.hasCardholderName, required: this.hasCardholderName && this.model.merchantConfiguration.card.cardholderName.required, requiredError: this.strings.fieldEmptyForCardholderName, validations: [ { isValid: function (value) { return value.length < 256; }, error: this.strings.fieldTooLongForCardholderName } ] } ]; if (!this.hasCVV) { cvvFieldGroup = this.getElementById('cvv-field-group'); cvvFieldGroup.parentNode.removeChild(cvvFieldGroup); } if (!hfOptions.fields.postalCode) { postalCodeFieldGroup = this.getElementById('postal-code-field-group'); postalCodeFieldGroup.parentNode.removeChild(postalCodeFieldGroup); } this.extraInputs.forEach(function (extraInput) { if (extraInput.enabled) { this._setupExtraInput(extraInput); } else { this._removeExtraInput(extraInput); } }.bind(this)); this.model.asyncDependencyStarting(); return hostedFields.create(hfOptions).then(function (hostedFieldsInstance) { this.hostedFieldsInstance = hostedFieldsInstance; this.hostedFieldsInstance.on('blur', this._onBlurEvent.bind(this)); this.hostedFieldsInstance.on('cardTypeChange', this._onCardTypeChangeEvent.bind(this)); this.hostedFieldsInstance.on('focus', this._onFocusEvent.bind(this)); this.hostedFieldsInstance.on('notEmpty', this._onNotEmptyEvent.bind(this)); this.hostedFieldsInstance.on('validityChange', this._onValidityChangeEvent.bind(this)); this.model.asyncDependencyReady(); }.bind(this)).catch(function (err) { this.model.asyncDependencyFailed({ view: this.ID, error: err }); }.bind(this)); }; CardView.prototype._setupExtraInput = function (extraInput) { var self = this; var fieldNameKebab = camelCaseToKebabCase(extraInput.fieldName); var field = this.getElementById(fieldNameKebab + '-field-group'); var input = field.querySelector('input'); var nameContainer = field.querySelector('.braintree-form__hosted-field'); input.addEventListener('keyup', function () { var valid = self._validateExtraInput(extraInput, true); classlist.toggle(nameContainer, 'braintree-form__field--valid', valid); if (valid) { self.hideFieldError(extraInput.fieldName); } self._sendRequestableEvent(); }, false); if (extraInput.required) { input.addEventListener('blur', function () { // the active element inside the blur event is the document.body // by taking it out of the event loop, we can detect the new // active element (hosted field or other card view element) setTimeout(function () { if (isCardViewElement()) { self._validateExtraInput(extraInput, true); } }, 0); }, false); } }; CardView.prototype._removeExtraInput = function (extraInput) { var field = this.getElementById(camelCaseToKebabCase(extraInput.fieldName) + '-field-group'); field.parentNode.removeChild(field); }; CardView.prototype._sendRequestableEvent = function () { if (!this._isTokenizing) { this.model.setPaymentMethodRequestable({ isRequestable: this._validateForm(), type: constants.paymentMethodTypes.card }); } }; CardView.prototype._generateHostedFieldsOptions = function () { var challenges = this.client.getConfiguration().gatewayConfiguration.challenges; var hasCVVChallenge = challenges.indexOf('cvv') !== -1; var hasPostalCodeChallenge = challenges.indexOf('postal_code') !== -1; var overrides = this.model.merchantConfiguration.card && this.model.merchantConfiguration.card.overrides; var options = { client: this.client, fields: { number: { selector: this._generateFieldSelector('number'), placeholder: generateCardNumberPlaceholder() }, expirationDate: { selector: this._generateFieldSelector('expiration'), placeholder: this.strings.expirationDatePlaceholder }, cvv: { selector: this._generateFieldSelector('cvv'), placeholder: addBullets(3) }, postalCode: { selector: this._generateFieldSelector('postal-code') } }, styles: { input: { 'font-size': '16px', 'font-family': '-apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif', color: '#000' }, ':focus': { color: 'black' }, '::-webkit-input-placeholder': { color: '#6a6a6a' }, ':-moz-placeholder': { color: '#6a6a6a' }, '::-moz-placeholder': { color: '#6a6a6a' }, ':-ms-input-placeholder ': { color: '#6a6a6a' }, 'input::-ms-clear': { color: 'transparent' } } }; if (!hasCVVChallenge) { delete options.fields.cvv; } if (!hasPostalCodeChallenge) { delete options.fields.postalCode; } if (!overrides) { return options; } if (overrides.fields) { if (overrides.fields.cvv && overrides.fields.cvv.placeholder) { this._hasCustomCVVPlaceholder = true; } Object.keys(overrides.fields).forEach(function (field) { if ((field === 'cvv' || field === 'postalCode') && overrides.fields[field] === null) { delete options.fields[field]; return; } if (!options.fields[field]) { return; } assign(options.fields[field], overrides.fields[field], { selector: options.fields[field].selector }); }); } if (overrides.styles) { Object.keys(overrides.styles).forEach(function (style) { if (overrides.styles[style] === null) { delete options.styles[style]; return; } normalizeStyles(overrides.styles[style]); options.styles[style] = options.styles[style] || {}; assign(options.styles[style], overrides.styles[style]); }); } return options; }; CardView.prototype._validateForm = function (showFieldErrors) { var cardType, cardTypeSupported, state; var isValid = true; var supportedCardTypes = this.client.getConfiguration().gatewayConfiguration.creditCards.supportedCardTypes; if (!this.hostedFieldsInstance) { return false; } state = this.hostedFieldsInstance.getState(); Object.keys(state.fields).forEach(function (key) { var field = state.fields[key]; if (!showFieldErrors && !isValid) { // return early if form is already invalid // and we don't need to display all field errors return; } if (field.isEmpty) { isValid = false; if (showFieldErrors) { this.showFieldError(key, this.strings['fieldEmptyFor' + capitalize(key)]); } } else if (!field.isValid) { isValid = false; if (showFieldErrors) { this.showFieldError(key, this.strings['fieldInvalidFor' + capitalize(key)]); } } }.bind(this)); if (state.fields.number.isValid) { cardType = constants.configurationCardTypes[state.cards[0].type]; cardTypeSupported = supportedCardTypes.indexOf(cardType) !== -1; if (!cardTypeSupported) { isValid = false; if (showFieldErrors) { this.showFieldError('number', this.strings.unsupportedCardTypeError); } } } if (this.extraInputs) { this.extraInputs.forEach(function (extraInput) { var fieldIsValid; if (!extraInput.enabled) { return; } fieldIsValid = this._validateExtraInput(extraInput, showFieldErrors); isValid = isValid && fieldIsValid; }.bind(this)); } return isValid; }; CardView.prototype._validateExtraInput = function (extraInput, showFieldError) { var fieldNameKebab = camelCaseToKebabCase(extraInput.fieldName); var field = this.getElementById(fieldNameKebab + '-field-group'); var input = field.querySelector('input'); var valid = true; if (extraInput.required) { valid = input.value.length > 0; if (!valid && showFieldError) { this.showFieldError(extraInput.fieldName, extraInput.requiredError); } } extraInput.validations.forEach(function (validation) { var validationPassed = validation.isValid(input.value); if (!validationPassed && showFieldError) { this.showFieldError(extraInput.fieldName, validation.error); } valid = valid && validationPassed; }.bind(this)); return valid; }; CardView.prototype.getPaymentMethod = function () { // eslint-disable-line consistent-return var formIsValid = this._validateForm(); if (formIsValid) { return { type: constants.paymentMethodTypes.card }; } }; CardView.prototype.tokenize = function () { var transitionCallback; var self = this; var state = self.hostedFieldsInstance.getState(); var tokenizeOptions = { vault: !self.model.isGuestCheckout }; this.model.clearError(); if (!this._validateForm(true)) { self.model.reportError('hostedFieldsFieldsInvalidError'); self.allowUserAction(); return Promise.reject(new DropinError(constants.errors.NO_PAYMENT_METHOD_ERROR)); } if (this.hasCardholderName) { tokenizeOptions.cardholderName = this.cardholderNameInput.value; } self._isTokenizing = true; return self.hostedFieldsInstance.tokenize(tokenizeOptions).then(function (payload) { var retainCardFields = self.model.merchantConfiguration.card && self.model.merchantConfiguration.card.clearFieldsAfterTokenization === false; if (!retainCardFields) { Object.keys(state.fields).forEach(function (field) { self.hostedFieldsInstance.clear(field); }); if (self.hasCardholderName) { self.cardholderNameInput.value = ''; } } if (!self.model.isGuestCheckout) { payload.vaulted = true; } return new Promise(function (resolve) { transitionCallback = function () { // Wait for braintree-sheet--tokenized class to be added in IE 9 // before attempting to remove it setTimeout(function () { self.model.addPaymentMethod(payload); resolve(payload); classlist.remove(self.element, 'braintree-sheet--tokenized'); }, 0); self._isTokenizing = false; }; transitionHelper.onTransitionEnd(self.element, 'max-height', transitionCallback); setTimeout(function () { self.allowUserAction(); }, constants.CHANGE_ACTIVE_PAYMENT_METHOD_TIMEOUT); classlist.add(self.element, 'braintree-sheet--tokenized'); }); }).catch(function (err) { self._isTokenizing = false; // this is a little magical, but if the code property exists // in the translations with the word Error appended to the end, // then reportError will automatically print that translation. // See https://github.com/braintree/braintree-web-drop-in/blob/6ecba73f2f16e8b7ae2119702ac162a1a985908e/src/views/main-view.js#L255-L256 self.model.reportError(err); self.allowUserAction(); return Promise.reject(new DropinError({ message: constants.errors.NO_PAYMENT_METHOD_ERROR, braintreeWebError: err })); }); }; CardView.prototype.showFieldError = function (field, errorMessage) { var fieldError; var fieldGroup = this.getElementById(camelCaseToKebabCase(field) + '-field-group'); var input = fieldGroup.querySelector('input'); if (!this.fieldErrors.hasOwnProperty(field)) { this.fieldErrors[field] = this.getElementById(camelCaseToKebabCase(field) + '-field-error'); } classlist.add(fieldGroup, 'braintree-form__field-group--has-error'); fieldError = this.fieldErrors[field]; fieldError.innerHTML = errorMessage; if (input && isNormalFieldElement(input)) { input.setAttribute('aria-invalid', true); } else { this.hostedFieldsInstance.setAttribute({ field: field, attribute: 'aria-invalid', value: true }); this.hostedFieldsInstance.setMessage({ field: field, message: errorMessage }); } }; CardView.prototype.hideFieldError = function (field) { var fieldGroup = this.getElementById(camelCaseToKebabCase(field) + '-field-group'); var input = fieldGroup.querySelector('input'); if (!this.fieldErrors.hasOwnProperty(field)) { this.fieldErrors[field] = this.getElementById(camelCaseToKebabCase(field) + '-field-error'); } classlist.remove(fieldGroup, 'braintree-form__field-group--has-error'); if (input && isNormalFieldElement(input)) { input.removeAttribute('aria-invalid'); } else { this.hostedFieldsInstance.removeAttribute({ field: field, attribute: 'aria-invalid' }); this.hostedFieldsInstance.setMessage({ field: field, message: '' }); } }; CardView.prototype.teardown = function () { return this.hostedFieldsInstance.teardown(); }; CardView.prototype._generateFieldSelector = function (field) { return '#braintree--dropin__' + this.model.componentID + ' .braintree-form-' + field; }; CardView.prototype._onBlurEvent = function (event) { var field = event.fields[event.emittedBy]; var fieldGroup = this.getElementById(camelCaseToKebabCase(event.emittedBy) + '-field-group'); classlist.remove(fieldGroup, 'braintree-form__field-group--is-focused'); if (shouldApplyFieldEmptyError(field)) { this.showFieldError(event.emittedBy, this.strings['fieldEmptyFor' + capitalize(event.emittedBy)]); } else if (!field.isEmpty && !field.isValid) { this.showFieldError(event.emittedBy, this.strings['fieldInvalidFor' + capitalize(event.emittedBy)]); } else if (event.emittedBy === 'number' && !this._isCardTypeSupported(event.cards[0].type)) { this.showFieldError('number', this.strings.unsupportedCardTypeError); } setTimeout(function () { // when focusing on a field by clicking the label, // we need to wait a bit for the iframe to be // focused properly before applying validations if (shouldApplyFieldEmptyError(field)) { this.showFieldError(event.emittedBy, this.strings['fieldEmptyFor' + capitalize(event.emittedBy)]); } }.bind(this), 150); }; CardView.prototype._onCardTypeChangeEvent = function (event) { var cardType; var cardNumberHrefLink = '#iconCardFront'; var cvvHrefLink = '#iconCVVBack'; var cvvDescriptor = this.strings.cvvThreeDigitLabelSubheading; var cvvPlaceholder = addBullets(3); var numberFieldGroup = this.getElementById('number-field-group'); if (event.cards.length === 1) { cardType = event.cards[0].type; cardNumberHrefLink = '#icon-' + cardType; if (cardType === 'american-express') { cvvHrefLink = '#iconCVVFront'; cvvDescriptor = this.strings.cvvFourDigitLabelSubheading; cvvPlaceholder = addBullets(4); } // Keep icon visible when field is not focused classlist.add(numberFieldGroup, 'braintree-form__field-group--card-type-known'); } else { classlist.remove(numberFieldGroup, 'braintree-form__field-group--card-type-known'); } this.cardNumberIconSvg.setAttribute('xlink:href', cardNumberHrefLink); if (this.hasCVV) { this.cvvIconSvg.setAttribute('xlink:href', cvvHrefLink); this.cvvLabelDescriptor.innerHTML = cvvDescriptor; if (!this._hasCustomCVVPlaceholder) { this.hostedFieldsInstance.setAttribute({ field: 'cvv', attribute: 'placeholder', value: cvvPlaceholder }); } } }; CardView.prototype._onFocusEvent = function (event) { var fieldGroup = this.getElementById(camelCaseToKebabCase(event.emittedBy) + '-field-group'); classlist.add(fieldGroup, 'braintree-form__field-group--is-focused'); }; CardView.prototype._onNotEmptyEvent = function (event) { this.hideFieldError(event.emittedBy); }; CardView.prototype._onValidityChangeEvent = function (event) { var isValid; var field = event.fields[event.emittedBy]; if (event.emittedBy === 'number' && event.cards[0]) { isValid = field.isValid && this._isCardTypeSupported(event.cards[0].type); } else { isValid = field.isValid; } classlist.toggle(field.container, 'braintree-form__field--valid', isValid); if (field.isPotentiallyValid) { this.hideFieldError(event.emittedBy); } this._sendRequestableEvent(); }; CardView.prototype.requestPaymentMethod = function () { this.preventUserAction(); return this.tokenize(); }; CardView.prototype.onSelection = function () { if (!this.hostedFieldsInstance) { return; } if (this.hasCardholderName) { setTimeout(function () { // wait until input is visible this.cardholderNameInput.focus(); }.bind(this), 1); } else { this.hostedFieldsInstance.focus('number'); } }; CardView.prototype._hideUnsupportedCardIcons = function () { var supportedCardTypes = this.client.getConfiguration().gatewayConfiguration.creditCards.supportedCardTypes; Object.keys(constants.configurationCardTypes).forEach(function (paymentMethodCardType) { var cardIcon; var configurationCardType = constants.configurationCardTypes[paymentMethodCardType]; if (supportedCardTypes.indexOf(configurationCardType) === -1) { cardIcon = this.getElementById(paymentMethodCardType + '-card-icon'); classlist.add(cardIcon, 'braintree-hidden'); } }.bind(this)); }; CardView.prototype._isCardTypeSupported = function (cardType) { var configurationCardType = constants.configurationCardTypes[cardType]; var supportedCardTypes = this.client.getConfiguration().gatewayConfiguration.creditCards.supportedCardTypes; return supportedCardTypes.indexOf(configurationCardType) !== -1; }; CardView.isEnabled = function (options) { var gatewayConfiguration = options.client.getConfiguration().gatewayConfiguration; return Promise.resolve(gatewayConfiguration.creditCards.supportedCardTypes.length > 0); }; function isNormalFieldElement(element) { return element.id.indexOf('braintree__card-view-input') !== -1; } function shouldApplyFieldEmptyError(field) { return field.isEmpty && isCardViewElement(); } function isCardViewElement() { var activeId = document.activeElement && document.activeElement.id; var isHostedFieldsElement = document.activeElement instanceof HTMLIFrameElement && activeId.indexOf('braintree-hosted-field') !== -1; return isHostedFieldsElement || isNormalFieldElement(document.activeElement); } function camelCaseToKebabCase(string) { return string.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); } function capitalize(string) { return string[0].toUpperCase() + string.substr(1); } function normalizeStyles(styles) { Object.keys(styles).forEach(function (style) { var transformedKeyName = camelCaseToKebabCase(style); styles[transformedKeyName] = styles[style]; }); } function addBullets(number) { var bulletCharacter = isUtf8() ? '•' : '*'; return Array(number + 1).join(bulletCharacter); } function generateCardNumberPlaceholder() { var four = addBullets(4); return [four, four, four, four].join(' '); } module.exports = CardView; },{"../../constants":117,"../../lib/assign":124,"../../lib/classlist":126,"../../lib/dropin-error":129,"../../lib/is-utf-8":134,"../../lib/promise":137,"../../lib/transition-helper":141,"../base-view":167,"braintree-web/hosted-fields":55}],176:[function(require,module,exports){ (function (global){ 'use strict'; var assign = require('../../lib/assign').assign; var BaseView = require('../base-view'); var btGooglePay = require('braintree-web/google-payment'); var DropinError = require('../../lib/dropin-error'); var constants = require('../../constants'); var assets = require('../../lib/assets'); var Promise = require('../../lib/promise'); var analytics = require('../../lib/analytics'); function GooglePayView() { BaseView.apply(this, arguments); } GooglePayView.prototype = Object.create(BaseView.prototype); GooglePayView.prototype.constructor = GooglePayView; GooglePayView.ID = GooglePayView.prototype.ID = constants.paymentOptionIDs.googlePay; GooglePayView.prototype.initialize = function () { var self = this; self.googlePayConfiguration = assign({}, self.model.merchantConfiguration.googlePay); self.model.asyncDependencyStarting(); return btGooglePay.create({client: self.client}).then(function (googlePayInstance) { self.googlePayInstance = googlePayInstance; self.paymentsClient = createPaymentsClient(self.client); }).then(function () { var buttonDiv = self.getElementById('google-pay-button'); buttonDiv.addEventListener('click', function (event) { event.preventDefault(); self.preventUserAction(); self.tokenize().then(function () { self.allowUserAction(); }); }); self.model.asyncDependencyReady(); }).catch(function (err) { self.model.asyncDependencyFailed({ view: self.ID, error: new DropinError(err) }); }); }; GooglePayView.prototype.tokenize = function () { var self = this; var paymentDataRequest = self.googlePayInstance.createPaymentDataRequest(self.googlePayConfiguration); var rawPaymentData; return self.paymentsClient.loadPaymentData(paymentDataRequest).then(function (paymentData) { rawPaymentData = paymentData; return self.googlePayInstance.parseResponse(paymentData); }).then(function (tokenizePayload) { tokenizePayload.rawPaymentData = rawPaymentData; self.model.addPaymentMethod(tokenizePayload); }).catch(function (err) { var reportedError = err; if (err.statusCode === 'DEVELOPER_ERROR') { console.error(err); // eslint-disable-line no-console reportedError = 'developerError'; } else if (err.statusCode === 'CANCELED') { analytics.sendEvent(self.client, 'googlepay.loadPaymentData.canceled'); return; } else if (err.statusCode) { analytics.sendEvent(self.client, 'googlepay.loadPaymentData.failed'); } self.model.reportError(reportedError); }); }; GooglePayView.prototype.updateConfiguration = function (key, value) { this.googlePayConfiguration[key] = value; }; GooglePayView.isEnabled = function (options) { var gatewayConfiguration = options.client.getConfiguration().gatewayConfiguration; if (!(gatewayConfiguration.androidPay && Boolean(options.merchantConfiguration.googlePay))) { return Promise.resolve(false); } return Promise.resolve().then(function () { if (!(global.google && global.google.payments && global.google.payments.api && global.google.payments.api.PaymentsClient)) { return assets.loadScript({ id: constants.GOOGLE_PAYMENT_SCRIPT_ID, src: constants.GOOGLE_PAYMENT_SOURCE }); } return Promise.resolve(); }).then(function () { var paymentsClient = createPaymentsClient(options.client); return paymentsClient.isReadyToPay({ allowedPaymentMethods: ['CARD', 'TOKENIZED_CARD'] }); }).then(function (response) { return Boolean(response.result); }); }; function createPaymentsClient(client) { return new global.google.payments.api.PaymentsClient({ environment: client.getConfiguration().gatewayConfiguration.environment === 'production' ? 'PRODUCTION' : 'TEST' }); } module.exports = GooglePayView; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"../../constants":117,"../../lib/analytics":122,"../../lib/assets":123,"../../lib/assign":124,"../../lib/dropin-error":129,"../../lib/promise":137,"../base-view":167,"braintree-web/google-payment":49}],177:[function(require,module,exports){ 'use strict'; var paymentOptionIDs = require('../../constants').paymentOptionIDs; var result = {}; result[paymentOptionIDs.applePay] = require('./apple-pay-view'); result[paymentOptionIDs.card] = require('./card-view'); result[paymentOptionIDs.googlePay] = require('./google-pay-view'); result[paymentOptionIDs.paypal] = require('./paypal-view'); result[paymentOptionIDs.paypalCredit] = require('./paypal-credit-view'); result[paymentOptionIDs.venmo] = require('./venmo-view'); module.exports = result; },{"../../constants":117,"./apple-pay-view":173,"./card-view":175,"./google-pay-view":176,"./paypal-credit-view":178,"./paypal-view":179,"./venmo-view":180}],178:[function(require,module,exports){ 'use strict'; var assign = require('../../lib/assign').assign; var Promise = require('../../lib/promise'); var paymentOptionIDs = require('../../constants').paymentOptionIDs; var BasePayPalView = require('./base-paypal-view'); function PayPalCreditView() { BasePayPalView.apply(this, arguments); this._isPayPalCredit = true; } PayPalCreditView.prototype = Object.create(BasePayPalView.prototype); PayPalCreditView.prototype.constructor = PayPalCreditView; PayPalCreditView.ID = PayPalCreditView.prototype.ID = paymentOptionIDs.paypalCredit; PayPalCreditView.isEnabled = function (options) { if (!options.merchantConfiguration.paypalCredit) { return Promise.resolve(false); } return BasePayPalView.isEnabled(assign({ viewID: PayPalCreditView.ID }, options)); }; module.exports = PayPalCreditView; },{"../../constants":117,"../../lib/assign":124,"../../lib/promise":137,"./base-paypal-view":174}],179:[function(require,module,exports){ 'use strict'; var assign = require('../../lib/assign').assign; var Promise = require('../../lib/promise'); var paymentOptionIDs = require('../../constants').paymentOptionIDs; var BasePayPalView = require('./base-paypal-view'); function PayPalView() { BasePayPalView.apply(this, arguments); } PayPalView.prototype = Object.create(BasePayPalView.prototype); PayPalView.prototype.constructor = PayPalView; PayPalView.ID = PayPalView.prototype.ID = paymentOptionIDs.paypal; PayPalView.isEnabled = function (options) { if (!options.merchantConfiguration.paypal) { return Promise.resolve(false); } return BasePayPalView.isEnabled(assign({ viewID: PayPalView.ID }, options)); }; module.exports = PayPalView; },{"../../constants":117,"../../lib/assign":124,"../../lib/promise":137,"./base-paypal-view":174}],180:[function(require,module,exports){ 'use strict'; var assign = require('../../lib/assign').assign; var BaseView = require('../base-view'); var btVenmo = require('braintree-web/venmo'); var DropinError = require('../../lib/dropin-error'); var Promise = require('../../lib/promise'); var paymentOptionIDs = require('../../constants').paymentOptionIDs; function VenmoView() { BaseView.apply(this, arguments); } VenmoView.prototype = Object.create(BaseView.prototype); VenmoView.prototype.constructor = VenmoView; VenmoView.ID = VenmoView.prototype.ID = paymentOptionIDs.venmo; VenmoView.prototype.initialize = function () { var self = this; var venmoConfiguration = assign({}, self.model.merchantConfiguration.venmo, {client: this.client}); self.model.asyncDependencyStarting(); return btVenmo.create(venmoConfiguration).then(function (venmoInstance) { self.venmoInstance = venmoInstance; if (!self.venmoInstance.hasTokenizationResult()) { return Promise.resolve(); } return self.venmoInstance.tokenize().then(function (payload) { self.model.reportAppSwitchPayload(payload); }).catch(function (err) { if (self._isIgnorableError(err)) { return; } self.model.reportAppSwitchError(paymentOptionIDs.venmo, err); }); }).then(function () { var button = self.getElementById('venmo-button'); button.addEventListener('click', function (event) { event.preventDefault(); self.preventUserAction(); return self.venmoInstance.tokenize().then(function (payload) { self.model.addPaymentMethod(payload); }).catch(function (tokenizeErr) { if (self._isIgnorableError(tokenizeErr)) { return; } self.model.reportError(tokenizeErr); }).then(function () { self.allowUserAction(); }); }); self.model.asyncDependencyReady(); }).catch(function (err) { self.model.asyncDependencyFailed({ view: self.ID, error: new DropinError(err) }); }); }; VenmoView.prototype._isIgnorableError = function (error) { // customer cancels the flow in the app // we don't emit an error because the customer // initiated that action return error.code === 'VENMO_APP_CANCELED'; }; VenmoView.isEnabled = function (options) { var gatewayConfiguration = options.client.getConfiguration().gatewayConfiguration; var venmoEnabled = gatewayConfiguration.payWithVenmo && Boolean(options.merchantConfiguration.venmo); if (!venmoEnabled) { return Promise.resolve(false); } return Promise.resolve(btVenmo.isBrowserSupported(options.merchantConfiguration.venmo)); }; module.exports = VenmoView; },{"../../constants":117,"../../lib/assign":124,"../../lib/dropin-error":129,"../../lib/promise":137,"../base-view":167,"braintree-web/venmo":104}]},{},[120])(120) });