From 19f74688d9e571d1c33d396e5389a7ca5599e0c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20M=C3=BCller?= Date: Sat, 25 May 2024 15:53:42 +0200 Subject: [PATCH] [PAYONE-222] Remove old javascript file --- .../app/storefront/dist/storefront/js/payone-payment.js | 1 - 1 file changed, 1 deletion(-) delete mode 100644 src/Resources/app/storefront/dist/storefront/js/payone-payment.js diff --git a/src/Resources/app/storefront/dist/storefront/js/payone-payment.js b/src/Resources/app/storefront/dist/storefront/js/payone-payment.js deleted file mode 100644 index b799a294..00000000 --- a/src/Resources/app/storefront/dist/storefront/js/payone-payment.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([["payone-payment"],{898:(e,t,n)=>{var r,a,i,o=n(6285),s=n(1110);class l extends o.Z{init(){this.iframe=null,this.iframeFieldCheckerStarted=!1,this.orderFormDisabled=!0;const e=document.getElementById("payone-request"),t=e.getAttribute("data-payone-language"),n=JSON.parse(e.innerHTML);this._createScript((()=>{const e=this.getClientConfig(t);this.iframe=new window.Payone.ClientApi.HostedIFrames(e,n);const r=document.getElementById("savedpseudocardpan"),a=document.getElementById("confirmOrderForm");r&&r.addEventListener("change",this._handleChangeSavedCard.bind(this)),a&&a.addEventListener("submit",this._handleOrderSubmit.bind(this))}))}getSelectStyle(){return["width: 100%","padding: .5625rem","color: #8798a9","vertical-align: middle","line-height: 1.5","font-weight: 500","background-color: #fff","border: none","border-radius: 3px"]}getFieldStyle(){return["width: 100%","height: 100%","padding: .5625rem","color: #8798a9","vertical-align: middle","line-height: 1.5","font-weight: 500","background-color: #fff","border: none","border-radius: .1875rem"]}getClientConfig(e){return{fields:{cardpan:{selector:"cardpan",type:"text",style:this.getFieldStyle().join("; ")},cardcvc2:{selector:"cardcvc2",type:"password",size:"4",maxlength:"4",length:{V:3,M:3,A:4,D:3,J:0,O:3,P:3,U:3},style:this.getFieldStyle().join("; ")},cardexpiremonth:{selector:"cardexpiremonth",type:"select",size:"2",maxlength:"2",style:this.getSelectStyle().join("; ")},cardexpireyear:{selector:"cardexpireyear",type:"select",style:this.getSelectStyle().join("; ")}},language:window.Payone.ClientApi.Language[e],defaultStyle:{iframe:{height:"100%",width:"100%"}},autoCardtypeDetection:{supportedCardtypes:l.options.supportedCardtypes,callback:this._cardDetectionCallback}}}_cardDetectionCallback(e){if("-"===e||"?"===e)return;const t="https://cdn.pay1.de/cc/"+e.toLowerCase()+"/xl/default.png",n=document.getElementById("errorOutput"),r=document.getElementById("card-logo");r.setAttribute("src",t),n.style.display="none",r.style.display="block"}_createScript(e){const t=document.createElement("script");t.type="text/javascript",t.src="https://secure.pay1.de/client-api/js/v1/payone_hosted.js",t.addEventListener("load",e.bind(this),!1),document.head.appendChild(t)}_handleOrderSubmit(e){document.getElementById("errorOutput").style.display="none";const t=document.getElementById("savedpseudocardpan");if(t&&t.value.length>0)return!0;if(!this.iframe.isComplete()){const t=document.getElementById("iframeErrorOutput");return this.iframeFieldCheckerStarted||setInterval((()=>{this.iframe.isComplete()?t.style.display="none":t.style.display="block"}),250),this.iframeFieldCheckerStarted=!0,this._handleOrderFormError(e),!1}return this.orderFormDisabled?(window.payoneCreditCardCheckCallback=this._payoneCheckCallback.bind(this),this.iframe.creditCardCheck("payoneCreditCardCheckCallback"),this._handleOrderFormError(e),!1):void 0}_handleOrderFormError(e){const t=document.getElementById("confirmFormSubmit");if(e.preventDefault(),t){const e=new s.Z(t);t.disabled=!1,e.remove()}}_handleChangeSavedCard(){const e=document.getElementById("savedpseudocardpan");e.options[e.selectedIndex].value?[...document.getElementsByClassName("credit-card-input")].forEach((function(e){e.classList.add("hide")})):[...document.getElementsByClassName("credit-card-input")].forEach((function(e){e.classList.remove("hide")}))}_payoneCheckCallback(e){if("VALID"===e.status)document.getElementById("pseudocardpan").value=e.pseudocardpan,document.getElementById("truncatedcardpan").value=e.truncatedcardpan,document.getElementById("cardexpiredate").value=e.cardexpiredate,document.getElementById("cardtype").value=e.cardtype,this.orderFormDisabled=!1,document.getElementById("confirmOrderForm").submit();else{const t=document.getElementById("confirmFormSubmit"),n=document.getElementById("errorOutput");t.removeAttribute("disabled"),n.innerHTML=e.errormessage,n.style.display="block"}}}r=l,i={supportedCardtypes:["#","V","A","M","D","J","O","U","P"]},(a=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(a="options"))in r?Object.defineProperty(r,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[a]=i;var d=n(378),c=n(5659),u=n(8254);class m extends o.Z{init(){this.orderFormDisabled=!0,this._client=new u.Z,document.getElementById("confirmOrderForm").addEventListener("submit",this._handleOrderSubmit.bind(this))}_handleOrderSubmit(e){document.getElementById("errorOutput").style.display="none",this.orderFormDisabled&&(this._handleOrderFormError(e),this._getModal(e))}_handleOrderFormError(e){const t=document.getElementById("confirmFormSubmit");if(e.preventDefault(),t){const e=new s.Z(t);t.disabled=!1,e.remove()}}_getModal(e){e.preventDefault(),c.Z.create();const t=this._getRequestData();this._client.abort(),this._client.post(this._getManageMandateUrl(),JSON.stringify(t),(e=>this._openModal(e)))}_submitForm(){this.orderFormDisabled=!1,document.getElementById("confirmOrderForm").submit()}_openModal(e){if((e=JSON.parse(e)).error){const t=document.getElementById("errorOutput");return t.innerHTML=e.error,t.style.display="block",void c.Z.remove()}if("active"===e.mandate.Status)return void this._submitForm();const t=new d.Z(e.modal_content);t.open(this._onOpen.bind(this,t))}_onOpen(e){e.getModal().classList.add("payone-debit-mandate-modal"),window.PluginManager.initializePlugins(),this._registerEvents(),c.Z.remove()}_getRequestData(){return{iban:document.getElementById("iban").value}}_getManageMandateUrl(){return document.getElementById("payone-configuration").getAttribute("data-manage-mandate-url")}_registerEvents(){document.getElementById("mandateSubmit").addEventListener("click",this._onMandateSubmit.bind(this))}_onMandateSubmit(){document.getElementById("accept-mandate").checked&&this._submitForm()}}!function(e,t,n){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(m,"options",{editorModalClass:"payone-debit-modal"});class h extends o.Z{init(){this.orderFormDisabled=!0,this._client=new u.Z,this._registerEventListeners()}_registerEventListeners(){const e=document.getElementById("confirmOrderForm");e&&e.addEventListener("submit",this._handleOrderSubmit.bind(this))}_handleOrderSubmit(e){this._hideErrorBox(),this.orderFormDisabled&&(this._validateField(e,"payolutionConsent"),this._validateInput(e,"payoneBirthday"),e.defaultPrevented||(this._validatePaymentAcceptance(),e.preventDefault()))}_validateField(e,t){const n=document.getElementById(t);n.checked?n.classList.remove("is-invalid"):(n.scrollIntoView({block:"start",behavior:"smooth"}),n.classList.add("is-invalid"),e.preventDefault())}_validateInput(e,t){const n=document.getElementById(t);n.value?n.classList.remove("is-invalid"):(n.scrollIntoView({block:"start",behavior:"smooth"}),n.classList.add("is-invalid"),e.preventDefault())}_validatePaymentAcceptance(){const e=JSON.stringify(this._getRequestData());c.Z.create(),this._client.abort(),this._client.post(this._getValidateUrl(),e,(e=>this._handleValidateResponse(e)))}_handleValidateResponse(e){if(e=JSON.parse(e),c.Z.remove(),"OK"!==e.status)this._showErrorBox();else{const t=document.getElementById("payoneWorkOrder");t&&(t.value=e.workorderid),this._submitForm()}}_getValidateUrl(){return document.getElementById("payone-configuration").getAttribute("data-validate-url")}_showErrorBox(){const e=document.getElementById("payolutionErrorContainer");e&&(e.hidden=!1)}_hideErrorBox(){const e=document.getElementById("payolutionErrorContainer");e&&(e.hidden=!0)}_submitForm(){this.orderFormDisabled=!1,document.getElementById("confirmOrderForm").submit()}_getRequestData(){return{payoneBirthday:document.getElementById("payoneBirthday").value}}}class p extends o.Z{init(){this.orderFormDisabled=!0,this._client=new u.Z,this._disableSubmitButton(),this._registerEventListeners()}_registerEventListeners(){const e=document.getElementById("confirmOrderForm"),t=document.getElementById("checkInstallmentButton");e&&e.addEventListener("submit",this._handleOrderSubmit.bind(this)),t&&t.addEventListener("click",this._handleCalculationButtonClick.bind(this))}_handleCalculationButtonClick(e){if(this._hideErrorBox(),this._validateField(e,"payolutionConsent"),this._validateInput(e,"payoneBirthday"),e.defaultPrevented)return;c.Z.create();const t=JSON.stringify(this._getRequestData());this._client.abort(),this._client.post(this._getCalculationUrl(),t,(e=>this._handleCalculationCallback(e)))}_handleCalculationCallback(e){if(e=JSON.parse(e),c.Z.remove(),"OK"!==e.status)return void this._showErrorBox();const t=document.getElementById("payoneWorkOrder"),n=document.getElementById("payoneCartHash");t.value=e.workorderid,n.value=e.carthash,this._displayInstallmentSelection(e),this._displayCalculationOverview(e),this._registerSelectionEventListeners(),this._enableSecondStep(),this._activateSubmitButton(),this._hideCheckInstallmentButton()}_hideCheckInstallmentButton(){const e=document.getElementById("checkInstallmentButton");e&&e.classList.add("hidden")}_registerSelectionEventListeners(){document.getElementById("payolutionInstallmentDuration").addEventListener("change",(function(e){const t=e.target.value;document.querySelectorAll(".installmentDetail").forEach((function(e){e.dataset.duration===t?e.hidden=!1:e.hidden="hidden"}))}))}_showErrorBox(){const e=document.getElementById("payolutionErrorContainer");e&&(e.hidden=!1)}_hideErrorBox(){const e=document.getElementById("payolutionErrorContainer");e&&(e.hidden=!0)}_enableSecondStep(){document.querySelectorAll(".payolution-installment .hidden").forEach((function(e){e.classList.remove("hidden")}))}_displayInstallmentSelection(e){const t=document.getElementById("installmentSelection");t&&(t.innerHTML=e.installmentSelection)}_displayCalculationOverview(e){const t=document.getElementById("calculationOverview");t&&(t.innerHTML=e.calculationOverview)}_handleOrderSubmit(e){this._validateField(e,"payolutionConsent"),this._validateInput(e,"payoneBirthday"),this._validateInput(e,"payolutionAccountOwner"),this._validateInput(e,"payolutionIban"),this._validateInput(e,"payolutionBic"),this._validateInput(e,"payolutionInstallmentDuration")}_disableSubmitButton(){this.orderFormDisabled=!0;const e=document.getElementById("confirmFormSubmit");e&&e.setAttribute("disabled","disabled")}_activateSubmitButton(){this.orderFormDisabled=!1;const e=document.getElementById("confirmFormSubmit");e&&e.removeAttribute("disabled")}_getCalculationUrl(){return document.getElementById("payone-configuration").getAttribute("data-calculation-url")}_validateField(e,t){const n=document.getElementById(t);n.checked?n.classList.remove("is-invalid"):(n.scrollIntoView({block:"start",behavior:"smooth"}),n.classList.add("is-invalid"),this._handleOrderFormError(e))}_validateInput(e,t){const n=document.getElementById(t);n.value?n.classList.remove("is-invalid"):(n.scrollIntoView({block:"start",behavior:"smooth"}),n.classList.add("is-invalid"),this._handleOrderFormError(e))}_handleOrderFormError(e){const t=document.getElementById("confirmFormSubmit");if(e.preventDefault(),t){const e=new s.Z(t);t.disabled=!1,e.remove()}}_getRequestData(){const e=document.getElementById("payoneBirthday"),t=document.getElementById("payoneWorkOrder"),n=document.getElementById("payoneCartHash");return{payoneBirthday:e.value,workorder:t.value,carthash:n.value}}}var y=n(3206);function v(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class b extends o.Z{init(){null===this.options.supportedNetworks&&(this.options.supportedNetworks=[]),this._httpClient=new u.Z,this.validateMerchantUrl=this.el.dataset.validateMerchantUrl,this.processPaymentUrl=this.el.dataset.processPaymentUrl,this.orderForm=y.Z.querySelector(document,"#confirmOrderForm"),this._registerEventHandler()}createSession(){try{this.session=new ApplePaySession(3,this.options)}catch(e){return void this.handleErrorOnPayment()}this.session.addEventListener("validatemerchant",this.validateMerchant.bind(this)),this.session.addEventListener("paymentauthorized",this.authorizePayment.bind(this))}performPayment(){this.session.begin()}validateMerchant(e){const t=e.validationURL;this._httpClient.abort(),this._httpClient.post(this.validateMerchantUrl,JSON.stringify({validationUrl:t}),(e=>{let t=null;try{t=JSON.parse(e)}catch(e){return void this.handleErrorOnPayment()}t&&t.merchantSessionIdentifier&&t.signature?this.session.completeMerchantValidation(t):this.handleErrorOnPayment()}))}handleErrorOnPayment(){const e=y.Z.querySelector(document,"#payone-apple-pay-error");e.style.display="block",e.scrollIntoView({block:"start"})}authorizePayment(e){let t=y.Z.querySelector(this.orderForm,"input[name='orderId']").value;this._httpClient.abort(),this._httpClient.post(this.processPaymentUrl,JSON.stringify({token:e.payment.token,orderId:t}),(e=>{this.completePayment(e),this.orderForm.submit()}))}completePayment(e){let t="",n="",r="";try{let a=JSON.parse(e);n=a.status,t=a.txid,r=a.userid}catch(e){this.orderForm.submit()}this.updateFormData(n,t,r,e),"APPROVED"!==n&&"PENDING"!==n||this.session.completePayment({status:ApplePaySession.STATUS_SUCCESS,errors:[]}),this.orderForm.submit()}updateFormData(e,t,n,r){y.Z.querySelector(this.orderForm,"input[name='status']").value=e,y.Z.querySelector(this.orderForm,"input[name='txid']").value=t,y.Z.querySelector(this.orderForm,"input[name='userid']").value=n,y.Z.querySelector(this.orderForm,"input[name='response']").value=r}_handleApplePayButtonClick(){this.orderForm.reportValidity()&&(this.createSession(),this.performPayment())}_registerEventHandler(){this.el.addEventListener("click",this._handleApplePayButtonClick.bind(this))}}v(b,"options",{countryCode:"",currencyCode:"",supportedNetworks:[],merchantCapabilities:["supports3DS","supportsDebit","supportsCredit"],total:{label:"",type:"final",amount:"0.01"}}),v(b,"session",void 0),v(b,"client",void 0),v(b,"validateMerchantUrl",void 0),v(b,"processPaymentUrl",void 0),v(b,"orderForm",void 0);class g extends o.Z{init(){this._client=new u.Z,this.ratepayRateInput=y.Z.querySelector(document,this.options.ratepayRateInputSelector),this.calculateInstallmentBtn=y.Z.querySelector(document,this.options.calculateInstallmentBtnSelector),this.ratepayRuntimeInput=y.Z.querySelector(document,this.options.ratepayRuntimeInputSelector),this.ratepayIbanContainer=y.Z.querySelector(document,this.options.ratepayIbanContainerSelector),this.ratepayIbanInput=y.Z.querySelector(document,this.options.ratepayIbanInputSelector),this._registerEventListeners(),this._handleInstallmentRuntimeChange()}_registerEventListeners(){this.calculateInstallmentBtn&&this.calculateInstallmentBtn.addEventListener("click",this._handleCalculateInstallmentButtonClick.bind(this)),this.ratepayRuntimeInput&&this.ratepayRuntimeInput.addEventListener("change",this._handleInstallmentRuntimeChange.bind(this)),document.querySelector(this.options.ratepayIbanContainerSelector).addEventListener("shown.bs.collapse",(()=>this.ratepayIbanInput.required=!0)),document.querySelector(this.options.ratepayIbanContainerSelector).addEventListener("hidden.bs.collapse",(()=>this.ratepayIbanInput.required=!1))}_handleCalculateInstallmentButtonClick(){const e=this.ratepayRateInput.value;this._sendRequest("rate",e)}_handleInstallmentRuntimeChange(){const e=y.Z.querySelector(document,this.options.ratepayRuntimeInputSelector).value;this._sendRequest("time",e)}_sendRequest(e,t){let n={ratepayInstallmentType:e,ratepayInstallmentValue:t};const r=JSON.stringify(n);this._client.abort(),this._client.post("/payone/ratepay/installment/calculation",r,(e=>this._handleCalculationCallback(e)))}_handleCalculationCallback(e){this._replaceCalculationContent(e)}_replaceCalculationContent(e){y.Z.querySelector(document,this.options.ratepayInstallmentPlanContainerSelector).innerHTML=e,this.ratepayInstallmentTable=y.Z.querySelector(document,this.options.ratepayInstallmentTableSelector),this.ratepayRuntimeInput.value=this.ratepayInstallmentTable.dataset.ratepayNumberOfRates,this.ratepayRateInput.value=this.ratepayInstallmentTable.dataset.ratepayRate}}function f(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}!function(e,t,n){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(g,"options",{ratepayRateInputSelector:"#ratepayRate",ratepayRuntimeInputSelector:"#ratepayRuntime",calculateInstallmentBtnSelector:"#payone-ratepay-calculate-installment-btn",ratepayInstallmentPlanContainerSelector:"#payone-ratepay-installment-plan",ratepayIbanContainerSelector:"#ratepayIbanContainer",ratepayIbanInputSelector:"#ratepayIban",ratepayInstallmentTableSelector:"#ratepayInstallmentTable"});class _ extends o.Z{init(){window.klarnaAsyncCallback=this._initKlarnaWidget.bind(this);const e=document.createElement("script");e.src="https://x.klarnacdn.net/kp/lib/v1/api.js",document.body.appendChild(e),this.orderForm=document.getElementById(this.options.selectorFormId),this.confirmFormSubmit=this.orderForm.querySelector("button[type=submit]"),this._registerEventListeners()}_initKlarnaWidget(){Klarna.Payments.init({client_token:this.options.clientToken}),Klarna.Payments.load({container:this.options.selectorContainer,payment_method_category:this.options.paymentMethodIdentifier},(e=>{new s.Z(this.confirmFormSubmit).remove()}))}_registerEventListeners(){this.orderForm&&this.orderForm.addEventListener("submit",this._handleOrderSubmit.bind(this))}_handleOrderSubmit(e){e.preventDefault(),Klarna.Payments.authorize({payment_method_category:this.options.paymentMethodIdentifier},{},(e=>{e.approved&&e.authorization_token?(document.querySelector(this.options.selectorTokenInput).value=e.authorization_token,this.orderForm.submit()):e.show_form?new s.Z(this.confirmFormSubmit).remove():e.show_form||(window.location.href=window.location.href)}))}}f(_,"options",{clientToken:null,paymentMethodIdentifier:null,selectorContainer:null,selectorTokenInput:'input[name="payoneKlarnaAuthorizationToken"]',selectorFormId:"confirmOrderForm"}),f(_,"orderForm",null),f(_,"confirmFormSubmit",null);class I extends o.Z{init(){if("amazon"in window)this.onLoad();else{var e=document.createElement("script");e.type="text/javascript",e.src="https://static-eu.payments-amazon.com/checkout.js",e.onload=this.onLoad.bind(this),document.head.appendChild(e)}}onLoad(){}}class S extends I{onLoad(){window.amazon.Pay.renderButton("#"+this.el.id,this.options)}}var E=n(4690);PluginManager.register("PayonePaymentAmazonPayExpressButton",S,"[data-payone-payment-amazon-pay-express-button]"),PluginManager.register("PayonePaymentAmazonPayRedirect",class extends S{init(){E.Z.create(document.querySelector(".content-main")),super.init()}onLoad(){super.onLoad(),document.querySelector("#"+this.el.id).dispatchEvent(new CustomEvent("click"))}},"[data-payone-payment-amazon-pay-redirect]");const C=window.PluginManager;C.register("PayonePaymentCreditCard",l,"[data-is-payone-credit-card]"),C.register("PayonePaymentDebitCard",m,"[data-is-payone-debit-card]"),C.register("PayonePaymentPayolutionInvoicing",h,"[data-is-payone-payolution-invoicing]"),C.register("PayonePaymentPayolutionInstallment",p,"[data-is-payone-payolution-installment]"),C.register("PayonePaymentApplePay",b,"[data-payone-payment-apple-pay-options]"),C.register("PayonePaymentRatepayInstallment",g,"[data-is-payone-ratepay-installment]"),C.register("PayonePaymentKlarna",_,"[data-payone-payment-klarna]")}},e=>{e.O(0,["vendor-node","vendor-shared"],(()=>{return t=898,e(e.s=t);var t}));e.O()}]); \ No newline at end of file