{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///../rvw_autobahn_core/cartridges/rvw_autobahn_core/cartridge/client/default/js/integrations/siteIntegrationsUtils.js","webpack:///../rvw_integrations_core/cartridges/rvw_integrations_core/cartridge/client/default/js/integrations/siteIntegrationsUtils.js","webpack:///../autobahn_client_core/cartridges/autobahn_client_core/cartridge/client/default/custom/googlepay.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","getIntegrationSettings","window","CachedData","siteIntegrations","core","require","cybersourceCartridgeEnabled","getGooglePaymentsClient","google","payments","api","PaymentsClient","environment","googlepayval","onGooglePayLoaded","isReadyToPay","allowedPaymentMethods","then","response","result","addGooglePayButton","prefetchGooglePaymentData","err","console","error","paymentsClient","$","length","document","querySelectorAll","forEach","el","appendChild","createButton","onClick","onGooglePaymentButtonClicked","container","attr","data","trigger","getGooglePaymentDataConfiguration","locale","UncachedData","merchantId","merchantID","paymentMethodTokenizationParameters","tokenizationParameters","emailRequired","phoneNumberRequired","cardRequirements","allowedCardNetworks","billingAddressRequired","billingAddressFormat","shippingAddressRequired","querySelector","shippingAddressParameters","allowedCountryCodes","indexOf","paymentDataRequest","currencyCode","transactionInfo","totalPriceStatus","prefetchPaymentData","currencySymbol","totalPrice","innerText","getElementById","replace","getGoogleTransactionInfo","loadPaymentData","paymentData","processPayment","postdataUrl","sessionCallBack","urlParams","JSON","stringify","ajax","url","type","dataType","success","status","location","href","submitURL","errorHtml","errorMsg","append","cartURL","gatewayMerchantId","val","tokenizationType","parameters","gateway"],"mappings":"aACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IA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E,EAAE,+BAA+BiE,MAErD/C,EAAalB,EAAE,wBAAwBiE,MAWvC7C,EAAyB,CACzB8C,iBAAkB,kBAClBC,WAAY,CACRC,QAAS,cACTJ,kBAAmBA,IAkCW,QAAlChE,EAAE,uBAAuBiE,OACzB7E,IAGJb,OAAOa,kBAAoBA","file":"default/custom/googlepay.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 709);\n","'use strict';\n\n/**\n * This client-side js file just acts as a wrapper for the site preference config toggles\n * that are outputted by Controller: Integrations-OutputIntegrationsConfig\n */\n\nfunction getIntegrationSettings() {\n if (window && window.CachedData && window.CachedData.siteIntegrations) {\n return window.CachedData.siteIntegrations;\n }\n return {};\n}\n\nmodule.exports = {\n getIntegrationSettings : getIntegrationSettings\n};\n","'use strict';\n/*\n * Just have a simple pass through so we can use the site preference integration toggles\n * in rvw_integrations_core as well as rvw_autobahn_core\n */\nvar core = require('core/integrations/siteIntegrationsUtils');\n\nmodule.exports = core;\n\n","/* eslint-disable */\n\n'use strict';\n\nvar siteIntegrations = require('integrations/integrations/siteIntegrationsUtils');\nvar toggleObject = siteIntegrations.getIntegrationSettings();\n//var recaptcha = require('core/components/recaptcha');\n\nif (toggleObject.cybersourceCartridgeEnabled) {\n\n /**\n * Payment methods accepted by your gateway\n *\n * confirm support for both payment methods with your gateway\n */\n var allowedPaymentMethods = ['CARD', 'TOKENIZED_CARD'];\n\n /**\n * Card networks supported by your site and your gateway\n *\n * @see {@link https://developers.google.com/pay/api/web/reference/object#CardRequirements|CardRequirements}\n * confirm card networks supported by your site and gateway\n */\n var allowedCardNetworks = ['AMEX', 'DISCOVER', 'JCB', 'MASTERCARD', 'VISA'];\n\n var gatewayMerchantId = $('#googlePaygatewayMerchantId').val();\n\n var merchantID = $('#googlePayMerchantID').val();\n\n /**\n * Identify your gateway and your site's gateway merchant identifier\n *\n * The Google Pay API response will return an encrypted payment method capable of\n * being charged by a supported gateway after shopper authorization\n *\n * check with your gateway on the parameters to pass\n * @see {@link https://developers.google.com/pay/api/web/reference/object#Gateway|PaymentMethodTokenizationParameters}\n */\n var tokenizationParameters = {\n tokenizationType: 'PAYMENT_GATEWAY',\n parameters: {\n gateway: 'cybersource',\n gatewayMerchantId: gatewayMerchantId\n }\n };\n\n /**\n * Initialize a Google Pay API client\n *\n * @returns {google.payments.api.PaymentsClient} Google Pay API client\n */\n function getGooglePaymentsClient() {\n return (new google.payments.api.PaymentsClient({ environment: window.googlepayval.environment }));\n }\n\n /**\n * Initialize Google PaymentsClient after Google-hosted JavaScript has loaded\n */\n function onGooglePayLoaded() {\n var paymentsClient = getGooglePaymentsClient();\n paymentsClient.isReadyToPay({\n allowedPaymentMethods: allowedPaymentMethods\n })\n .then(function (response) {\n if (response.result) {\n // alert(response.result);\n addGooglePayButton();\n prefetchGooglePaymentData();\n }\n })\n .catch(function (err) {\n // show error in developer console for debugging\n console.error(err); // eslint-disable-line\n });\n }\n\n if ($('#isGooglePayEnabled').val() == 'true') {\n onGooglePayLoaded();\n }\n //AUTOBAHN MOD this is a globally accessed function\n window.onGooglePayLoaded = onGooglePayLoaded;\n\n /**\n * Add a Google Pay purchase button alongside an existing checkout button\n *\n * @see {@link https://developers.google.com/pay/api/web/reference/object#ButtonOptions|Button options}\n * @see {@link https://developers.google.com/pay/api/web/guides/brand-guidelines|Google Pay brand guidelines}\n */\n function addGooglePayButton() {\n var paymentsClient = getGooglePaymentsClient();\n // SAMSONITE MOD - comment out unreferenced code\n // var button = paymentsClient.createButton({ onClick: onGooglePaymentButtonClicked });\n if ($('#js-googlepay-container').length > 0) {\n // SAMSONITE MOD - Inject multiple buttons targets into a page\n // document.getElementById('js-googlepay-container').appendChild(button);\n document.querySelectorAll(\"#js-googlepay-container\")?.forEach(el => el?.appendChild?.(paymentsClient.createButton({ onClick: onGooglePaymentButtonClicked })));\n var container = $('.js-cybergoogle-checkout.js-paymentmethodwarning-msgcontainer');\n if (container) {\n container.attr('data-iframepresent', true);\n container.data('iframepresent', true);\n $('body').trigger('PaymentMethodObserver:iframePresent');\n }\n }\n }\n\n /**\n * Configure support for the Google Pay API\n *\n * @see {@link https://developers.google.com/pay/api/web/reference/object#PaymentDataRequest|PaymentDataRequest}\n * @returns {object} PaymentDataRequest fields\n */\n function getGooglePaymentDataConfiguration() {\n var locale = window.UncachedData.locale;\n return {\n // a merchant ID is available for a production environment after approval by Google\n // @see {@link https://developers.google.com/pay/api/web/guides/test-and-deploy/integration-checklist|Integration checklist}\n merchantId: merchantID,\n paymentMethodTokenizationParameters: tokenizationParameters,\n allowedPaymentMethods: allowedPaymentMethods,\n emailRequired: true,\n phoneNumberRequired: true,\n cardRequirements: {\n allowedCardNetworks: allowedCardNetworks,\n billingAddressRequired: true,\n billingAddressFormat: 'FULL'\n },\n shippingAddressRequired: !(document.querySelector('form[name=dwfrm_shipping] input[name$=postalCode]')?.value),\n shippingAddressParameters: {\n allowedCountryCodes: [locale.indexOf('_CA') !== -1 ? 'CA' : 'US'],\n phoneNumberRequired: true\n }\n };\n }\n\n /**\n * Provide Google Pay API with a payment amount, currency, and amount status\n *\n * @see {@link https://developers.google.com/pay/api/web/reference/object#TransactionInfo|TransactionInfo}\n * @returns {object} transaction info, suitable for use as transactionInfo property of PaymentDataRequest\n */\n function getGoogleTransactionInfo() {\n var locale = window.UncachedData.locale;\n var currencyCode = 'USD';\n var currencySymbol = '$';\n if (locale && (locale === 'en_CA' || locale === 'fr_CA')) {\n var currencyCode = 'CAD';\n var currencySymbol = 'C$ ';\n }\n return {\n currencyCode: currencyCode,\n totalPriceStatus: 'FINAL',\n // set to cart total\n totalPrice: (document.querySelector('#order-product-summary .order-summary-total')?.innerText || document.getElementById('carttotal')?.value).replace(currencySymbol, '')\n };\n }\n\n /**\n * Prefetch payment data to improve performance\n */\n function prefetchGooglePaymentData() {\n var paymentDataRequest = getGooglePaymentDataConfiguration();\n var locale = window.UncachedData.locale;\n var currencyCode = 'USD';\n if (locale && (locale === 'en_CA' || locale === 'fr_CA')) {\n var currencyCode = 'CAD';\n }\n // transactionInfo must be set but does not affect cache\n paymentDataRequest.transactionInfo = {\n totalPriceStatus: 'NOT_CURRENTLY_KNOWN',\n currencyCode: currencyCode\n };\n var paymentsClient = getGooglePaymentsClient();\n paymentsClient.prefetchPaymentData(paymentDataRequest);\n }\n\n /**\n * Show Google Pay chooser when Google Pay purchase button is clicked\n */\n function onGooglePaymentButtonClicked() {\n var paymentDataRequest = getGooglePaymentDataConfiguration();\n paymentDataRequest.transactionInfo = getGoogleTransactionInfo();\n\n var paymentsClient = getGooglePaymentsClient();\n paymentsClient.loadPaymentData(paymentDataRequest)\n .then(function (paymentData) {\n $('.data-checkout-stage .payment-options-accordion .card[data-method-id=DW_GOOGLE_PAY]:not(.active) .custom-radio').trigger('click');\n // handle the response\n processPayment(paymentData);\n })\n .catch(function (err) {\n // show error in developer console for debugging\n console.error(err); // eslint-disable-line\n });\n }\n\n function appendToUrl(url, params) {\n var newUrl = url;\n newUrl += (newUrl.indexOf('?') !== -1 ? '&' : '?') + Object.keys(params).map(function (key) {\n return key + '=' + encodeURIComponent(params[key]);\n }).join('&');\n\n return newUrl;\n }\n\n /**\n * Process payment data returned by the Google Pay API\n *\n * @param {object} paymentData response from Google Pay API after shopper approves payment\n * @see {@link https://developers.google.com/pay/api/web/reference/object#PaymentData|PaymentData object reference}\n */\n function processPayment(paymentData) {\n var postdataUrl = window.googlepayval.sessionCallBack;\n var urlParams = {\n paymentData: JSON.stringify(paymentData)\n\n };\n\n $.ajax({\n url: postdataUrl,\n type: 'post',\n dataType: 'json',\n data: urlParams,\n success: (function (data) {\n if (data.status === 'success') {\n window.location.href = window.googlepayval.submitURL;\n // END SAMSONITE MODIFICATION\n // SAMSONITE MODIFICATION - Update to allow CA block\n } else if (data.status === 'error') { // Display error message when google pay address is invalid\n var errorHtml = ('