{"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:///../rvw_integrations_core/cartridges/rvw_integrations_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","addGooglePayButton","button","createButton","buttonSizeMode","buttonType","$","width","onClick","onGooglePaymentButtonClicked","length","document","getElementById","appendChild","container","attr","data","trigger","getGooglePaymentDataConfiguration","merchantId","merchantID","paymentMethodTokenizationParameters","tokenizationParameters","allowedPaymentMethods","emailRequired","phoneNumberRequired","cardRequirements","allowedCardNetworks","billingAddressRequired","billingAddressFormat","shippingAddressRequired","shippingAddressParameters","allowedCountryCodes","prefetchGooglePaymentData","paymentDataRequest","transactionInfo","totalPriceStatus","currencyCode","prefetchPaymentData","totalPrice","replace","loadPaymentData","then","paymentData","processPayment","err","console","error","postdataUrl","sessionCallBack","urlParams","JSON","stringify","isCart","ajax","url","type","dataType","success","status","location","href","submitURL","redirectUrl","cartURL","gatewayMerchantId","val","tokenizationType","parameters","gateway","onGooglePayLoaded","isReadyToPay","response","result"],"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,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAA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pB,IAAIK,EAAc5D,OAAOY,aAAaiD,gBAElCC,GADIC,KAAKC,UAAUT,GACP,CACZA,YAAaQ,KAAKC,UAAUT,GAC5BU,OAAQ/C,EAAE,cAAcI,OAAS,IAIrCJ,EAAEgD,KAAK,CACHC,IAAKP,EACLQ,KAAM,OACNC,SAAU,OACVzC,KAAMkC,EACNQ,QAAS,SAAU1C,GACK,YAAhBA,EAAK2C,OACLvE,OAAOwE,SAASC,KAAOzE,OAAOY,aAAa8D,UAE3C1E,OAAOwE,SAASC,KAAO7C,EAAK+C,aAAe3E,OAAOY,aAAagE,YAlM3EzC,EAAwB,CAAC,OAAQ,kBAQjCI,EAAsB,CAAC,OAAQ,WAAY,MAAO,aAAc,QAEhEsC,EAAoB3D,EAAE,+BAA+B4D,MAErD9C,EAAad,EAAE,wBAAwB4D,MAWvC5C,EAAyB,CACzB6C,iBAAkB,kBAClBC,WAAY,CACRC,QAAS,cACTJ,kBAAmBA,IAiC3B7E,OAAOkF,kBAjBP,WACyB5E,IACN6E,aAAa,CAAEhD,sBAAuBA,IAChDmB,MAAK,SAAU8B,GACRA,EAASC,SAETxE,IACAgC,QALZ,OAQW,SAAUY,GAEbC,QAAQC,MAAMF","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 = 674);\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\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({ allowedPaymentMethods: allowedPaymentMethods })\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 //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 var button = paymentsClient.createButton({\n buttonSizeMode: 'fill',\n buttonType: $(window).width() >= 768 && $(window).width() <= 1024 ? 'plain' : 'buy',\n onClick: onGooglePaymentButtonClicked,\n });\n if ($('#js-googlepay-container').length > 0) {\n document.getElementById('js-googlepay-container').appendChild(button);\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 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: true,\n shippingAddressParameters: {\n allowedCountryCodes: ['US']\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 return {\n currencyCode: 'USD',\n totalPriceStatus: 'FINAL',\n // set to cart total\n totalPrice: document.getElementById('carttotal').value.replace('$', '')\n };\n }\n\n /**\n * Prefetch payment data to improve performance\n */\n function prefetchGooglePaymentData() {\n var paymentDataRequest = getGooglePaymentDataConfiguration();\n // transactionInfo must be set but does not affect cache\n paymentDataRequest.transactionInfo = {\n totalPriceStatus: 'NOT_CURRENTLY_KNOWN',\n currencyCode: 'USD'\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 // 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 i = JSON.stringify(paymentData);\n var urlParams = {\n paymentData: JSON.stringify(paymentData),\n isCart: $('.cart-page').length > 0\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 } else {\n window.location.href = data.redirectUrl || window.googlepayval.cartURL;\n }\n }\n });\n // pass payment data response to gateway to process payment\n }\n}\n"],"sourceRoot":""}