From 1ec3daa8ade673bda42cc2901312307b86f2e41d Mon Sep 17 00:00:00 2001 From: Can Demiralp Date: Wed, 18 Jan 2023 19:09:32 +0100 Subject: [PATCH] Update frontend files --- .../storefront/dist/storefront/js/adyen-payment-shopware6.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Resources/app/storefront/dist/storefront/js/adyen-payment-shopware6.js b/src/Resources/app/storefront/dist/storefront/js/adyen-payment-shopware6.js index 8a5359cb..e4f419ed 100644 --- a/src/Resources/app/storefront/dist/storefront/js/adyen-payment-shopware6.js +++ b/src/Resources/app/storefront/dist/storefront/js/adyen-payment-shopware6.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([["adyen-payment-shopware6"],{HNRU:function(e,t,n){"use strict";t.a={updatablePaymentMethods:["scheme","ideal","sepadirectdebit","oneclick","dotpay","bcmc","bcmc_mobile","blik","eps","facilypay_3x","facilypay_4x","facilypay_6x","facilypay_10x","facilypay_12x","afterpay_default","ratepay","ratepay_directdebit","giftcard","paybright","affirm","multibanco","mbway","vipps","mobilepay","wechatpayQR","wechatpayWeb"],componentsWithPayButton:{applepay:{extra:{},onClick:function(e,t,n){return n.confirmOrderForm.checkValidity()?(e(),!0):(t(),!1)}},googlepay:{extra:{buttonSizeMode:"fill"},onClick:function(e,t,n){return n.confirmOrderForm.checkValidity()?(e(),!0):(t(),!1)},onError:function(e,t,n){"CANCELED"!==e.statusCode&&("statusMessage"in e?console.log(e.statusMessage):console.log(e.statusCode))}},paypal:{extra:{},onClick:function(e,t,n){return n.confirmOrderForm.checkValidity()},onError:function(e,t,n){t.setStatus("ready"),window.location.href=n.errorUrl.toString()},onCancel:function(e,t,n){t.setStatus("ready"),window.location.href=n.errorUrl.toString()},responseHandler:function(e,t){try{(t=JSON.parse(t)).isFinal&&(location.href=e.returnUrl),this.handleAction(t.action)}catch(e){console.error(e)}}},amazonpay:{extra:{productType:"PayAndShip",checkoutMode:"ProcessOrder",returnUrl:location.href},prePayRedirect:!0,sessionKey:"amazonCheckoutSessionId",onClick:function(e,t,n){return n.confirmOrderForm.checkValidity()?(e(),!0):(t(),!1)},onError:function(e,t){console.log(e),t.setStatus("ready")}}},paymentMethodTypeHandlers:{scheme:"handler_adyen_cardspaymentmethodhandler",ideal:"handler_adyen_idealpaymentmethodhandler",klarna:"handler_adyen_klarnapaylaterpaymentmethodhandler",klarna_account:"handler_adyen_klarnaaccountpaymentmethodhandler",klarna_paynow:"handler_adyen_klarnapaynowpaymentmethodhandler",ratepay:"handler_adyen_ratepaypaymentmethodhandler",ratepay_directdebit:"handler_adyen_ratepaydirectdebitpaymentmethodhandler",sepadirectdebit:"handler_adyen_sepapaymentmethodhandler",sofort:"handler_adyen_sofortpaymentmethodhandler",paypal:"handler_adyen_paypalpaymentmethodhandler",oneclick:"handler_adyen_oneclickpaymentmethodhandler",giropay:"handler_adyen_giropaypaymentmethodhandler",applepay:"handler_adyen_applepaypaymentmethodhandler",googlepay:"handler_adyen_googlepaypaymentmethodhandler",dotpay:"handler_adyen_dotpaypaymentmethodhandler",bcmc:"handler_adyen_bancontactcardpaymentmethodhandler",bcmc_mobile:"handler_adyen_bancontactmobilepaymentmethodhandler",amazonpay:"handler_adyen_amazonpaypaymentmethodhandler",twint:"handler_adyen_twintpaymentmethodhandler",eps:"handler_adyen_epspaymentmethodhandler",swish:"handler_adyen_swishpaymentmethodhandler",alipay:"handler_adyen_alipaypaymentmethodhandler",alipay_hk:"handler_adyen_alipayhkpaymentmethodhandler",blik:"handler_adyen_blikpaymentmethodhandler",clearpay:"handler_adyen_clearpaypaymentmethodhandler",facilypay_3x:"handler_adyen_facilypay3xpaymentmethodhandler",facilypay_4x:"handler_adyen_facilypay4xpaymentmethodhandler",facilypay_6x:"handler_adyen_facilypay6xpaymentmethodhandler",facilypay_10x:"handler_adyen_facilypay10xpaymentmethodhandler",facilypay_12x:"handler_adyen_facilypay12xpaymentmethodhandler",afterpay_default:"handler_adyen_afterpaydefaultpaymentmethodhandler",trustly:"handler_adyen_trustlypaymentmethodhandler",paysafecard:"handler_adyen_paysafecardpaymentmethodhandler",givex:"handler_adyen_givexgiftcardpaymentmethodhandler",webshopgiftcard:"handler_adyen_webshopgiftcardpaymentmethodhandler",kadowereld:"handler_adyen_kadowereldgiftcardpaymentmethodhandler",tcstestgiftcard:"handler_adyen_tcstestgiftcardpaymentmethodhandler",albelligiftcard:"handler_adyen_albelligiftcardpaymentmethodhandler",bijcadeaucard:"handler_adyen_bijenkorfgiftcardpaymentmethodhandler",vvvgiftcard:"handler_adyen_vvvgiftcardpaymentmethodhandler",genericgiftcard:"handler_adyen_genericgiftcardpaymentmethodhandler",gallgall:"handler_adyen_gallgallgiftcardpaymentmethodhandler",hmlingerie:"handler_adyen_hunkemollerlingeriegiftcardpaymentmethodhandler",beautycadeaukaart:"handler_adyen_beautygiftcardpaymentmethodhandler",svs:"handler_adyen_svsgiftcardpaymentmethodhandler",fashioncheque:"handler_adyen_fashionchequegiftcardpaymentmethodhandler",decadeaukaart:"handler_adyen_decadeaukaartgiftcardpaymentmethodhandler",mbway:"handler_adyen_mbwaypaymentmethodhandler",multibanco:"handler_adyen_multibancopaymentmethodhandler",wechatpayQR:"handler_adyen_wechatpayqrpaymentmethodhandler",wechatpayWeb:"handler_adyen_wechatpaywebpaymentmethodhandler",mobilepay:"handler_adyen_mobilepaypaymentmethodhandler",vipps:"handler_adyen_vippspaymentmethodhandler",affirm:"handler_adyen_affirmpaymentmethodhandler",paybright:"handler_adyen_paybrightpaymentmethodhandler"}}},TVZM:function(e,t,n){"use strict";n.r(t);var a=n("n9eb"),r=n("h8V8"),o=n("FGIj"),i=(n("gHbT"),n("p4AR"));n("u0Tz");function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t,n,a,r,o,i){try{var c=e[o](i),d=c.value}catch(e){return void n(e)}c.done?t(d):Promise.resolve(d).then(a,r)}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{},n=adyenCheckoutOptions.orderId;e.set("affiliateCode",adyenCheckoutOptions.affiliateCode),e.set("campaignCode",adyenCheckoutOptions.campaignCode),n?this.updatePayment(e,n,t):this.createOrder(e,t)}},{key:"updatePayment",value:function(e,t,n){e.set("orderId",t),this._client.post(adyenCheckoutOptions.updatePaymentUrl,e,this.afterSetPayment.bind(this,n))}},{key:"createOrder",value:function(e,t){parseInt(adyenCheckoutOptions.giftcardDiscount)&&!parseInt(adyenCheckoutOptions.payInFullWithGiftcard)?this._client.post(adyenCheckoutOptions.createOrderUrl,JSON.stringify({orderAmount:adyenCheckoutOptions.amount,currency:adyenCheckoutOptions.currency}),function(n){var a=JSON.parse(n);"Success"===a.resultCode&&(t=u(t,{order:a})),this._client.post(adyenCheckoutOptions.checkoutOrderUrl,e,this.afterCreateOrder.bind(this,t))}.bind(this)):this._client.post(adyenCheckoutOptions.checkoutOrderUrl,e,this.afterCreateOrder.bind(this,t))}},{key:"afterCreateOrder",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;try{e=JSON.parse(n)}catch(e){return c.a.remove(document.body),void console.log("Error: invalid response from Shopware API",n)}this.orderId=e.id,this.finishUrl=new URL(location.origin+adyenCheckoutOptions.paymentFinishUrl),this.finishUrl.searchParams.set("orderId",e.id),this.errorUrl=new URL(location.origin+adyenCheckoutOptions.paymentErrorUrl),this.errorUrl.searchParams.set("orderId",e.id);var a={orderId:this.orderId,finishUrl:this.finishUrl.toString(),errorUrl:this.errorUrl.toString()};for(var r in t)a[r]=t[r];this._client.post(adyenCheckoutOptions.paymentHandleUrl,JSON.stringify(a),this.afterPayOrder.bind(this,this.orderId))}},{key:"afterSetPayment",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;try{var n=JSON.parse(t);n.success&&this.afterCreateOrder(e,JSON.stringify({id:adyenCheckoutOptions.orderId}))}catch(e){return c.a.remove(document.body),void console.log("Error: invalid response from Shopware API",t)}}},{key:"afterPayOrder",value:function(e,t){try{t=JSON.parse(t),this.returnUrl=t.redirectUrl}catch(e){return c.a.remove(document.body),void console.log("Error: invalid response from Shopware API",t)}this.returnUrl===this.errorUrl.toString()&&(location.href=this.returnUrl);try{this._client.post("".concat(adyenCheckoutOptions.paymentStatusUrl),JSON.stringify({orderId:e}),this.responseHandler.bind(this))}catch(e){console.log(e)}}},{key:"handlePaymentAction",value:function(t){try{var n=JSON.parse(t);if((n.isFinal||"voucher"===n.action.type)&&(location.href=this.returnUrl),n.action){var a={};"threeDS2"===n.action.type&&(a.challengeWindowSize="05"),this.adyenCheckout.createFromAction(n.action,a).mount("[data-adyen-payment-action-container]"),["threeDS2","qrCode"].includes(n.action.type)&&e("[data-adyen-payment-action-modal]").modal({show:!0})}}catch(e){console.log(e)}}},{key:"initializeCustomPayButton",value:function(){var e=this,t=d.a.componentsWithPayButton[this.selectedAdyenPaymentMethod];this.completePendingPayment(this.selectedAdyenPaymentMethod,t);var n=this.adyenCheckout.paymentMethodsResponse.paymentMethods.filter((function(t){return t.type===e.selectedAdyenPaymentMethod}));if(n.length<1&&"googlepay"===this.selectedAdyenPaymentMethod&&(n=this.adyenCheckout.paymentMethodsResponse.paymentMethods.filter((function(e){return"paywithgoogle"===e.type}))),!(n.length<1)){var a=n[0];if(adyenCheckoutOptions.amount)if(t.prePayRedirect)this.renderPrePaymentButton(t,a);else{var r=u(t.extra,a,{amount:{value:adyenCheckoutOptions.amount,currency:adyenCheckoutOptions.currency},data:{personalDetails:shopperDetails,billingAddress:activeBillingAddress,deliveryAddress:activeShippingAddress},onClick:function(n,a){if(!t.onClick(n,a,e))return!1;c.a.create(document.body)},onSubmit:function(e,n){if(e.isValid){var a={stateData:JSON.stringify(e.data)},r=i.a.serialize(this.confirmOrderForm);"responseHandler"in t&&(this.responseHandler=t.responseHandler.bind(n,this)),this.confirmOrder(r,a)}else n.showValidation(),"test"===this.adyenCheckout.options.environment&&console.log("Payment failed: ",e)}.bind(this),onCancel:function(n,a){c.a.remove(document.body),t.onCancel(n,a,e)},onError:function(n,a){"PayPal"===a.props.name&&"CANCEL"===n.name&&e._client.post("".concat(adyenCheckoutOptions.cancelOrderTransactionUrl),JSON.stringify({orderId:e.orderId})),c.a.remove(document.body),t.onError(n,a,e),console.log(n)}}),o=this.adyenCheckout.create(a.type,r);try{"isAvailable"in o?o.isAvailable().then(function(){this.mountCustomPayButton(o)}.bind(this)).catch((function(e){console.log(a.type+" is not available",e)})):this.mountCustomPayButton(o)}catch(e){console.log(e)}}else console.error("Failed to fetch Cart/Order total amount.")}}},{key:"renderPrePaymentButton",value:function(e,t){var n=this;"amazonpay"===t.type&&(e.extra=this.setAddressDetails(e.extra));var a=u(e.extra,t,{configuration:t.configuration,amount:{value:adyenCheckoutOptions.amount,currency:adyenCheckoutOptions.currency},onClick:function(t,a){if(!e.onClick(t,a,n))return!1;c.a.create(document.body)},onError:function(t,a){c.a.remove(document.body),e.onError(t,a,n),console.log(t)}}),r=this.adyenCheckout.create(t.type,a);this.mountCustomPayButton(r)}},{key:"completePendingPayment",value:function(e,t){var n=new URL(location.href);if(n.searchParams.has(t.sessionKey)){var a;c.a.create(document.body);var r=this.adyenCheckout.create(e,(l(a={},t.sessionKey,n.searchParams.get(t.sessionKey)),l(a,"showOrderButton",!1),l(a,"onSubmit",function(e,t){if(e.isValid){var n={stateData:JSON.stringify(e.data)},a=i.a.serialize(this.confirmOrderForm);this.confirmOrder(a,n)}}.bind(this)),a));this.mountCustomPayButton(r),r.submit()}}},{key:"getSelectedPaymentMethodKey",value:function(){return Object.keys(d.a.paymentMethodTypeHandlers).find((function(e){return d.a.paymentMethodTypeHandlers[e]===adyenCheckoutOptions.selectedPaymentMethodHandler}))}},{key:"mountCustomPayButton",value:function(e){var t=document.querySelector("#confirmOrderForm");if(t){var n=t.querySelector("button[type=submit]");if(n&&!n.disabled){var a=document.createElement("div");a.id="adyen-confirm-button",a.setAttribute("data-adyen-confirm-button",""),t.appendChild(a),e.mount(a),n.remove()}}}},{key:"mountPaymentComponent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=u({},e,{data:{personalDetails:shopperDetails,billingAddress:activeBillingAddress,deliveryAddress:activeShippingAddress},onSubmit:function(e,t){if(e.isValid){var n={stateData:JSON.stringify(e.data)},a=i.a.serialize(this.confirmOrderForm);c.a.create(document.body),this.confirmOrder(a,n)}else t.showValidation(),"test"===this.adyenCheckout.options.environment&&console.log("Payment failed: ",e)}.bind(this)});!t&&"scheme"===e.type&&adyenCheckoutOptions.displaySaveCreditCardOption&&(n.enableStoreDetails=!0);try{var a=this.adyenCheckout.create(e.type,n);a.mount("#"+this.el.id),this.confirmFormSubmit.addEventListener("click",function(e){r.a.querySelector(document,"#confirmOrderForm").checkValidity()&&(e.preventDefault(),this.el.parentNode.scrollIntoView({behavior:"smooth",block:"start"}),a.submit())}.bind(this))}catch(t){return console.error(e.type,t),!1}}},{key:"appendGiftcardSummary",value:function(){parseInt(adyenCheckoutOptions.giftcardDiscount)&&this.shoppingCartSummaryBlock.length&&(this.shoppingCartSummaryDetails=e('
Giftcard discount
'+adyenCheckoutOptions.currencySymbol+this.giftcardDiscount+'
Remaining amount
'+adyenCheckoutOptions.currencySymbol+this.remainingAmount+"
"),this.shoppingCartSummaryDetails.appendTo(this.shoppingCartSummaryBlock[0]))}},{key:"setAddressDetails",value:function(e){return""!==activeShippingAddress.phoneNumber?e.addressDetails={name:shopperDetails.firstName+" "+shopperDetails.lastName,addressLine1:activeShippingAddress.street,city:activeShippingAddress.city,postalCode:activeShippingAddress.postalCode,countryCode:activeShippingAddress.country,phoneNumber:activeShippingAddress.phoneNumber}:e.productType="PayOnly",e}}])&&m(a.prototype,s),v&&m(a,v),n}(a.a)}).call(this,n("UoTJ"))},n9eb:function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return f}));var a=n("FGIj"),r=n("gHbT"),o=n("p4AR"),i=n("u0Tz");function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function d(){return(d=Object.assign||function(e){for(var t=1;t0)){this.paymentMethodInstance&&this.paymentMethodInstance.unmount(),i.a.create(r.a.querySelector(document,"#adyen-giftcard-component")),this.giftcardHeader.html(e.name),this.giftcardComponentClose.show();var t=d({},e,{showPayButton:!0,onBalanceCheck:this.handleBalanceCheck.bind(this)});try{this.paymentMethodInstance=this.adyenCheckout.create("giftcard",t),this.paymentMethodInstance.mount("#adyen-giftcard-component")}catch(e){console.log("giftcard not available")}i.a.remove(r.a.querySelector(document,"#adyen-giftcard-component"))}}},{key:"handleBalanceCheck",value:function(e,t,n){this._client.post("".concat(adyenGiftcardsConfiguration.checkBalanceUrl),JSON.stringify({paymentMethod:n.paymentMethod}),function(e){if("Success"!==(e=JSON.parse(e)).resultCode)console.error(e.resultCode),t(e.resultCode);else{var a=parseFloat(e.balance.value),r=a-adyenGiftcardsConfiguration.totalInMinorUnits;a>=adyenGiftcardsConfiguration.totalInMinorUnits?(this.remainingGiftcardBalance=(r/this.minorUnitsQuotient).toFixed(2),this.setGiftcardAsPaymentMethod(n,r)):(this.remainingAmount=((adyenGiftcardsConfiguration.totalInMinorUnits-a)/this.minorUnitsQuotient).toFixed(2),this.saveGiftcardStateData(n,a.toString(),0,this.selectedGiftcard.id)),this.remainingBalanceField.show(),this.remainingBalanceField.html("Remaining giftcard balance: "+adyenGiftcardsConfiguration.currencySymbol+this.remainingGiftcardBalance)}}.bind(this))}},{key:"saveGiftcardStateData",value:function(e,t,n,a){this._client.post(adyenGiftcardsConfiguration.setGiftcardUrl,JSON.stringify({stateData:e,amount:t,balance:n,paymentMethodId:a}),function(e){"paymentMethodId"in(e=JSON.parse(e))&&(this.giftcardDiscount=(t/this.minorUnitsQuotient).toFixed(2),this.remainingAmount=(adyenGiftcardsConfiguration.totalPrice-this.giftcardDiscount).toFixed(2),this.onGiftcardSelected(),i.a.remove(document.body))}.bind(this))}},{key:"setGiftcardAsPaymentMethod",value:function(e,t){this._client.patch(adyenGiftcardsConfiguration.switchContextUrl,JSON.stringify({paymentMethodId:this.selectedGiftcard.id}),function(n){this.saveGiftcardStateData(e,adyenGiftcardsConfiguration.totalInMinorUnits,t,this.selectedGiftcard.id)}.bind(this))}},{key:"removeGiftcard",value:function(){i.a.create(document.body),this._client.post(adyenGiftcardsConfiguration.removeGiftcardUrl,new FormData,function(t){"token"in(t=JSON.parse(t))&&(this.giftcardDiscount=0,this.remainingAmount=(adyenGiftcardsConfiguration.totalPrice-this.giftcardDiscount).toFixed(2),this.offCanvasCartSummaryBlock.length&&this.offCanvasCartSummaryBlock.children(".adyen-giftcard-summary").remove(),this.shoppingCartSummaryBlock.length&&this.shoppingCartSummaryBlock.children(".adyen-giftcard-summary").remove(),this.removeGiftcardButton.hide(),this.remainingBalanceField.hide(),e(".adyen-giftcard").show(),i.a.remove(document.body))}.bind(this))}},{key:"appendGiftcardSummary",value:function(){this.offCanvasCartSummaryBlock.length&&(this.offCanvasSummaryDetails=e('
Giftcard discount
'+adyenGiftcardsConfiguration.currencySymbol+this.giftcardDiscount+'
Remaining amount
'+adyenGiftcardsConfiguration.currencySymbol+this.remainingAmount+"
"),this.offCanvasSummaryDetails.appendTo(this.offCanvasCartSummaryBlock[0])),this.shoppingCartSummaryBlock.length&&(this.shoppingCartSummaryDetails=e('
Giftcard discount
'+adyenGiftcardsConfiguration.currencySymbol+this.giftcardDiscount+'
Remaining amount
'+adyenGiftcardsConfiguration.currencySymbol+this.remainingAmount+"
"),this.shoppingCartSummaryDetails.appendTo(this.shoppingCartSummaryBlock[0]))}},{key:"onGiftcardSelected",value:function(){this.paymentMethodInstance&&this.paymentMethodInstance.unmount(),this.giftcardComponentClose.hide(),e(".adyen-giftcard").hide(),this.giftcardHeader.html(" "),this.appendGiftcardSummary(),this.removeGiftcardButton.show(),this.remainingBalanceField.show(),this.remainingBalanceField.html("Remaining giftcard balance: "+adyenGiftcardsConfiguration.currencySymbol+this.remainingGiftcardBalance)}}])&&u(a.prototype,c),f&&u(a,f),n}(a.a)}).call(this,n("UoTJ"))}},[["TVZM","runtime","vendor-node","vendor-shared"]]]); +(window.webpackJsonp=window.webpackJsonp||[]).push([["adyen-payment-shopware6"],{HNRU:function(e,t,n){"use strict";t.a={updatablePaymentMethods:["scheme","ideal","sepadirectdebit","oneclick","dotpay","bcmc","bcmc_mobile","blik","eps","facilypay_3x","facilypay_4x","facilypay_6x","facilypay_10x","facilypay_12x","afterpay_default","ratepay","ratepay_directdebit","giftcard","paybright","affirm","multibanco","mbway","vipps","mobilepay","wechatpayQR","wechatpayWeb"],componentsWithPayButton:{applepay:{extra:{},onClick:function(e,t,n){return n.confirmOrderForm.checkValidity()?(e(),!0):(t(),!1)}},googlepay:{extra:{buttonSizeMode:"fill"},onClick:function(e,t,n){return n.confirmOrderForm.checkValidity()?(e(),!0):(t(),!1)},onError:function(e,t,n){"CANCELED"!==e.statusCode&&("statusMessage"in e?console.log(e.statusMessage):console.log(e.statusCode))}},paypal:{extra:{},onClick:function(e,t,n){return n.confirmOrderForm.checkValidity()},onError:function(e,t,n){t.setStatus("ready"),window.location.href=n.errorUrl.toString()},onCancel:function(e,t,n){t.setStatus("ready"),window.location.href=n.errorUrl.toString()},responseHandler:function(e,t){try{(t=JSON.parse(t)).isFinal&&(location.href=e.returnUrl),this.handleAction(t.action)}catch(e){console.error(e)}}},amazonpay:{extra:{productType:"PayAndShip",checkoutMode:"ProcessOrder",returnUrl:location.href},prePayRedirect:!0,sessionKey:"amazonCheckoutSessionId",onClick:function(e,t,n){return n.confirmOrderForm.checkValidity()?(e(),!0):(t(),!1)},onError:function(e,t){console.log(e),t.setStatus("ready")}}},paymentMethodTypeHandlers:{scheme:"handler_adyen_cardspaymentmethodhandler",ideal:"handler_adyen_idealpaymentmethodhandler",klarna:"handler_adyen_klarnapaylaterpaymentmethodhandler",klarna_account:"handler_adyen_klarnaaccountpaymentmethodhandler",klarna_paynow:"handler_adyen_klarnapaynowpaymentmethodhandler",ratepay:"handler_adyen_ratepaypaymentmethodhandler",ratepay_directdebit:"handler_adyen_ratepaydirectdebitpaymentmethodhandler",sepadirectdebit:"handler_adyen_sepapaymentmethodhandler",sofort:"handler_adyen_sofortpaymentmethodhandler",paypal:"handler_adyen_paypalpaymentmethodhandler",oneclick:"handler_adyen_oneclickpaymentmethodhandler",giropay:"handler_adyen_giropaypaymentmethodhandler",applepay:"handler_adyen_applepaypaymentmethodhandler",googlepay:"handler_adyen_googlepaypaymentmethodhandler",dotpay:"handler_adyen_dotpaypaymentmethodhandler",bcmc:"handler_adyen_bancontactcardpaymentmethodhandler",bcmc_mobile:"handler_adyen_bancontactmobilepaymentmethodhandler",amazonpay:"handler_adyen_amazonpaypaymentmethodhandler",twint:"handler_adyen_twintpaymentmethodhandler",eps:"handler_adyen_epspaymentmethodhandler",swish:"handler_adyen_swishpaymentmethodhandler",alipay:"handler_adyen_alipaypaymentmethodhandler",alipay_hk:"handler_adyen_alipayhkpaymentmethodhandler",blik:"handler_adyen_blikpaymentmethodhandler",clearpay:"handler_adyen_clearpaypaymentmethodhandler",facilypay_3x:"handler_adyen_facilypay3xpaymentmethodhandler",facilypay_4x:"handler_adyen_facilypay4xpaymentmethodhandler",facilypay_6x:"handler_adyen_facilypay6xpaymentmethodhandler",facilypay_10x:"handler_adyen_facilypay10xpaymentmethodhandler",facilypay_12x:"handler_adyen_facilypay12xpaymentmethodhandler",afterpay_default:"handler_adyen_afterpaydefaultpaymentmethodhandler",trustly:"handler_adyen_trustlypaymentmethodhandler",paysafecard:"handler_adyen_paysafecardpaymentmethodhandler",givex:"handler_adyen_givexgiftcardpaymentmethodhandler",webshopgiftcard:"handler_adyen_webshopgiftcardpaymentmethodhandler",kadowereld:"handler_adyen_kadowereldgiftcardpaymentmethodhandler",tcstestgiftcard:"handler_adyen_tcstestgiftcardpaymentmethodhandler",albelligiftcard:"handler_adyen_albelligiftcardpaymentmethodhandler",bijcadeaucard:"handler_adyen_bijenkorfgiftcardpaymentmethodhandler",vvvgiftcard:"handler_adyen_vvvgiftcardpaymentmethodhandler",genericgiftcard:"handler_adyen_genericgiftcardpaymentmethodhandler",gallgall:"handler_adyen_gallgallgiftcardpaymentmethodhandler",hmlingerie:"handler_adyen_hunkemollerlingeriegiftcardpaymentmethodhandler",beautycadeaukaart:"handler_adyen_beautygiftcardpaymentmethodhandler",svs:"handler_adyen_svsgiftcardpaymentmethodhandler",fashioncheque:"handler_adyen_fashionchequegiftcardpaymentmethodhandler",decadeaukaart:"handler_adyen_decadeaukaartgiftcardpaymentmethodhandler",mbway:"handler_adyen_mbwaypaymentmethodhandler",multibanco:"handler_adyen_multibancopaymentmethodhandler",wechatpayQR:"handler_adyen_wechatpayqrpaymentmethodhandler",wechatpayWeb:"handler_adyen_wechatpaywebpaymentmethodhandler",mobilepay:"handler_adyen_mobilepaypaymentmethodhandler",vipps:"handler_adyen_vippspaymentmethodhandler",affirm:"handler_adyen_affirmpaymentmethodhandler",paybright:"handler_adyen_paybrightpaymentmethodhandler"}}},TVZM:function(e,t,n){"use strict";n.r(t);var a=n("n9eb"),r=n("h8V8"),o=n("FGIj"),i=(n("gHbT"),n("p4AR"));n("u0Tz");function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t,n,a,r,o,i){try{var c=e[o](i),d=c.value}catch(e){return void n(e)}c.done?t(d):Promise.resolve(d).then(a,r)}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{},n=adyenCheckoutOptions.orderId;e.set("affiliateCode",adyenCheckoutOptions.affiliateCode),e.set("campaignCode",adyenCheckoutOptions.campaignCode),n?this.updatePayment(e,n,t):this.createOrder(e,t)}},{key:"updatePayment",value:function(e,t,n){e.set("orderId",t),this._client.post(adyenCheckoutOptions.updatePaymentUrl,e,this.afterSetPayment.bind(this,n))}},{key:"createOrder",value:function(e,t){parseInt(adyenCheckoutOptions.giftcardDiscount,10)&&!parseInt(adyenCheckoutOptions.payInFullWithGiftcard,10)?this._client.post(adyenCheckoutOptions.createOrderUrl,JSON.stringify({orderAmount:adyenCheckoutOptions.amount,currency:adyenCheckoutOptions.currency}),function(n){var a=JSON.parse(n);"Success"===a.resultCode&&(t=u(t,{order:a})),this._client.post(adyenCheckoutOptions.checkoutOrderUrl,e,this.afterCreateOrder.bind(this,t))}.bind(this)):this._client.post(adyenCheckoutOptions.checkoutOrderUrl,e,this.afterCreateOrder.bind(this,t))}},{key:"afterCreateOrder",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;try{e=JSON.parse(n)}catch(e){return c.a.remove(document.body),void console.log("Error: invalid response from Shopware API",n)}this.orderId=e.id,this.finishUrl=new URL(location.origin+adyenCheckoutOptions.paymentFinishUrl),this.finishUrl.searchParams.set("orderId",e.id),this.errorUrl=new URL(location.origin+adyenCheckoutOptions.paymentErrorUrl),this.errorUrl.searchParams.set("orderId",e.id);var a={orderId:this.orderId,finishUrl:this.finishUrl.toString(),errorUrl:this.errorUrl.toString()};for(var r in t)a[r]=t[r];this._client.post(adyenCheckoutOptions.paymentHandleUrl,JSON.stringify(a),this.afterPayOrder.bind(this,this.orderId))}},{key:"afterSetPayment",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;try{var n=JSON.parse(t);n.success&&this.afterCreateOrder(e,JSON.stringify({id:adyenCheckoutOptions.orderId}))}catch(e){return c.a.remove(document.body),void console.log("Error: invalid response from Shopware API",t)}}},{key:"afterPayOrder",value:function(e,t){try{t=JSON.parse(t),this.returnUrl=t.redirectUrl}catch(e){return c.a.remove(document.body),void console.log("Error: invalid response from Shopware API",t)}this.returnUrl===this.errorUrl.toString()&&(location.href=this.returnUrl);try{this._client.post("".concat(adyenCheckoutOptions.paymentStatusUrl),JSON.stringify({orderId:e}),this.responseHandler.bind(this))}catch(e){console.log(e)}}},{key:"handlePaymentAction",value:function(t){try{var n=JSON.parse(t);if((n.isFinal||"voucher"===n.action.type)&&(location.href=this.returnUrl),n.action){var a={};"threeDS2"===n.action.type&&(a.challengeWindowSize="05"),this.adyenCheckout.createFromAction(n.action,a).mount("[data-adyen-payment-action-container]"),["threeDS2","qrCode"].includes(n.action.type)&&e("[data-adyen-payment-action-modal]").modal({show:!0})}}catch(e){console.log(e)}}},{key:"initializeCustomPayButton",value:function(){var e=this,t=d.a.componentsWithPayButton[this.selectedAdyenPaymentMethod];this.completePendingPayment(this.selectedAdyenPaymentMethod,t);var n=this.adyenCheckout.paymentMethodsResponse.paymentMethods.filter((function(t){return t.type===e.selectedAdyenPaymentMethod}));if(n.length<1&&"googlepay"===this.selectedAdyenPaymentMethod&&(n=this.adyenCheckout.paymentMethodsResponse.paymentMethods.filter((function(e){return"paywithgoogle"===e.type}))),!(n.length<1)){var a=n[0];if(adyenCheckoutOptions.amount)if(t.prePayRedirect)this.renderPrePaymentButton(t,a);else{var r=u(t.extra,a,{amount:{value:adyenCheckoutOptions.amount,currency:adyenCheckoutOptions.currency},data:{personalDetails:shopperDetails,billingAddress:activeBillingAddress,deliveryAddress:activeShippingAddress},onClick:function(n,a){if(!t.onClick(n,a,e))return!1;c.a.create(document.body)},onSubmit:function(e,n){if(e.isValid){var a={stateData:JSON.stringify(e.data)},r=i.a.serialize(this.confirmOrderForm);"responseHandler"in t&&(this.responseHandler=t.responseHandler.bind(n,this)),this.confirmOrder(r,a)}else n.showValidation(),"test"===this.adyenCheckout.options.environment&&console.log("Payment failed: ",e)}.bind(this),onCancel:function(n,a){c.a.remove(document.body),t.onCancel(n,a,e)},onError:function(n,a){"PayPal"===a.props.name&&"CANCEL"===n.name&&e._client.post("".concat(adyenCheckoutOptions.cancelOrderTransactionUrl),JSON.stringify({orderId:e.orderId})),c.a.remove(document.body),t.onError(n,a,e),console.log(n)}}),o=this.adyenCheckout.create(a.type,r);try{"isAvailable"in o?o.isAvailable().then(function(){this.mountCustomPayButton(o)}.bind(this)).catch((function(e){console.log(a.type+" is not available",e)})):this.mountCustomPayButton(o)}catch(e){console.log(e)}}else console.error("Failed to fetch Cart/Order total amount.")}}},{key:"renderPrePaymentButton",value:function(e,t){var n=this;"amazonpay"===t.type&&(e.extra=this.setAddressDetails(e.extra));var a=u(e.extra,t,{configuration:t.configuration,amount:{value:adyenCheckoutOptions.amount,currency:adyenCheckoutOptions.currency},onClick:function(t,a){if(!e.onClick(t,a,n))return!1;c.a.create(document.body)},onError:function(t,a){c.a.remove(document.body),e.onError(t,a,n),console.log(t)}}),r=this.adyenCheckout.create(t.type,a);this.mountCustomPayButton(r)}},{key:"completePendingPayment",value:function(e,t){var n=new URL(location.href);if(n.searchParams.has(t.sessionKey)){var a;c.a.create(document.body);var r=this.adyenCheckout.create(e,(l(a={},t.sessionKey,n.searchParams.get(t.sessionKey)),l(a,"showOrderButton",!1),l(a,"onSubmit",function(e,t){if(e.isValid){var n={stateData:JSON.stringify(e.data)},a=i.a.serialize(this.confirmOrderForm);this.confirmOrder(a,n)}}.bind(this)),a));this.mountCustomPayButton(r),r.submit()}}},{key:"getSelectedPaymentMethodKey",value:function(){return Object.keys(d.a.paymentMethodTypeHandlers).find((function(e){return d.a.paymentMethodTypeHandlers[e]===adyenCheckoutOptions.selectedPaymentMethodHandler}))}},{key:"mountCustomPayButton",value:function(e){var t=document.querySelector("#confirmOrderForm");if(t){var n=t.querySelector("button[type=submit]");if(n&&!n.disabled){var a=document.createElement("div");a.id="adyen-confirm-button",a.setAttribute("data-adyen-confirm-button",""),t.appendChild(a),e.mount(a),n.remove()}}}},{key:"mountPaymentComponent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=u({},e,{data:{personalDetails:shopperDetails,billingAddress:activeBillingAddress,deliveryAddress:activeShippingAddress},onSubmit:function(e,t){if(e.isValid){var n={stateData:JSON.stringify(e.data)},a=i.a.serialize(this.confirmOrderForm);c.a.create(document.body),this.confirmOrder(a,n)}else t.showValidation(),"test"===this.adyenCheckout.options.environment&&console.log("Payment failed: ",e)}.bind(this)});!t&&"scheme"===e.type&&adyenCheckoutOptions.displaySaveCreditCardOption&&(n.enableStoreDetails=!0);try{var a=this.adyenCheckout.create(e.type,n);a.mount("#"+this.el.id),this.confirmFormSubmit.addEventListener("click",function(e){r.a.querySelector(document,"#confirmOrderForm").checkValidity()&&(e.preventDefault(),this.el.parentNode.scrollIntoView({behavior:"smooth",block:"start"}),a.submit())}.bind(this))}catch(t){return console.error(e.type,t),!1}}},{key:"appendGiftcardSummary",value:function(){parseInt(adyenCheckoutOptions.giftcardDiscount,10)&&this.shoppingCartSummaryBlock.length&&(this.shoppingCartSummaryDetails=e('
Giftcard discount
'+adyenCheckoutOptions.currencySymbol+this.giftcardDiscount+'
Remaining amount
'+adyenCheckoutOptions.currencySymbol+this.remainingAmount+"
"),this.shoppingCartSummaryDetails.appendTo(this.shoppingCartSummaryBlock[0]))}},{key:"setAddressDetails",value:function(e){return""!==activeShippingAddress.phoneNumber?e.addressDetails={name:shopperDetails.firstName+" "+shopperDetails.lastName,addressLine1:activeShippingAddress.street,city:activeShippingAddress.city,postalCode:activeShippingAddress.postalCode,countryCode:activeShippingAddress.country,phoneNumber:activeShippingAddress.phoneNumber}:e.productType="PayOnly",e}}])&&m(a.prototype,s),v&&m(a,v),n}(a.a)}).call(this,n("UoTJ"))},n9eb:function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return f}));var a=n("FGIj"),r=n("gHbT"),o=n("p4AR"),i=n("u0Tz");function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function d(){return(d=Object.assign||function(e){for(var t=1;t0)){this.paymentMethodInstance&&this.paymentMethodInstance.unmount(),i.a.create(r.a.querySelector(document,"#adyen-giftcard-component")),this.giftcardHeader.html(e.name),this.giftcardComponentClose.show();var t=d({},e,{showPayButton:!0,onBalanceCheck:this.handleBalanceCheck.bind(this)});try{this.paymentMethodInstance=this.adyenCheckout.create("giftcard",t),this.paymentMethodInstance.mount("#adyen-giftcard-component")}catch(e){console.log("giftcard not available")}i.a.remove(r.a.querySelector(document,"#adyen-giftcard-component"))}}},{key:"handleBalanceCheck",value:function(e,t,n){this._client.post("".concat(adyenGiftcardsConfiguration.checkBalanceUrl),JSON.stringify({paymentMethod:n.paymentMethod}),function(e){if("Success"!==(e=JSON.parse(e)).resultCode)console.error(e.resultCode),t(e.resultCode);else{var a=parseFloat(e.balance.value),r=a-adyenGiftcardsConfiguration.totalInMinorUnits;a>=adyenGiftcardsConfiguration.totalInMinorUnits?(this.remainingGiftcardBalance=(r/this.minorUnitsQuotient).toFixed(2),this.setGiftcardAsPaymentMethod(n,r)):(this.remainingAmount=((adyenGiftcardsConfiguration.totalInMinorUnits-a)/this.minorUnitsQuotient).toFixed(2),this.saveGiftcardStateData(n,a.toString(),0,this.selectedGiftcard.id)),this.remainingBalanceField.show(),this.remainingBalanceField.html("Remaining giftcard balance: "+adyenGiftcardsConfiguration.currencySymbol+this.remainingGiftcardBalance)}}.bind(this))}},{key:"saveGiftcardStateData",value:function(e,t,n,a){this._client.post(adyenGiftcardsConfiguration.setGiftcardUrl,JSON.stringify({stateData:e,amount:t,balance:n,paymentMethodId:a}),function(e){"paymentMethodId"in(e=JSON.parse(e))&&(this.giftcardDiscount=(t/this.minorUnitsQuotient).toFixed(2),this.remainingAmount=(adyenGiftcardsConfiguration.totalPrice-this.giftcardDiscount).toFixed(2),this.onGiftcardSelected(),i.a.remove(document.body))}.bind(this))}},{key:"setGiftcardAsPaymentMethod",value:function(e,t){this._client.patch(adyenGiftcardsConfiguration.switchContextUrl,JSON.stringify({paymentMethodId:this.selectedGiftcard.id}),function(n){this.saveGiftcardStateData(e,adyenGiftcardsConfiguration.totalInMinorUnits,t,this.selectedGiftcard.id)}.bind(this))}},{key:"removeGiftcard",value:function(){i.a.create(document.body),this._client.post(adyenGiftcardsConfiguration.removeGiftcardUrl,new FormData,function(t){"token"in(t=JSON.parse(t))&&(this.giftcardDiscount=0,this.remainingAmount=(adyenGiftcardsConfiguration.totalPrice-this.giftcardDiscount).toFixed(2),this.offCanvasCartSummaryBlock.length&&this.offCanvasCartSummaryBlock.children(".adyen-giftcard-summary").remove(),this.shoppingCartSummaryBlock.length&&this.shoppingCartSummaryBlock.children(".adyen-giftcard-summary").remove(),this.removeGiftcardButton.hide(),this.remainingBalanceField.hide(),e(".adyen-giftcard").show(),i.a.remove(document.body))}.bind(this))}},{key:"appendGiftcardSummary",value:function(){this.offCanvasCartSummaryBlock.length&&(this.offCanvasSummaryDetails=e('
Giftcard discount
'+adyenGiftcardsConfiguration.currencySymbol+this.giftcardDiscount+'
Remaining amount
'+adyenGiftcardsConfiguration.currencySymbol+this.remainingAmount+"
"),this.offCanvasSummaryDetails.appendTo(this.offCanvasCartSummaryBlock[0])),this.shoppingCartSummaryBlock.length&&(this.shoppingCartSummaryDetails=e('
Giftcard discount
'+adyenGiftcardsConfiguration.currencySymbol+this.giftcardDiscount+'
Remaining amount
'+adyenGiftcardsConfiguration.currencySymbol+this.remainingAmount+"
"),this.shoppingCartSummaryDetails.appendTo(this.shoppingCartSummaryBlock[0]))}},{key:"onGiftcardSelected",value:function(){this.paymentMethodInstance&&this.paymentMethodInstance.unmount(),this.giftcardComponentClose.hide(),e(".adyen-giftcard").hide(),this.giftcardHeader.html(" "),this.appendGiftcardSummary(),this.removeGiftcardButton.show(),this.remainingBalanceField.show(),this.remainingBalanceField.html("Remaining giftcard balance: "+adyenGiftcardsConfiguration.currencySymbol+this.remainingGiftcardBalance)}}])&&u(a.prototype,c),f&&u(a,f),n}(a.a)}).call(this,n("UoTJ"))}},[["TVZM","runtime","vendor-node","vendor-shared"]]]);