From 7b664183b276c2cdcb727075b4dca20588bb315b Mon Sep 17 00:00:00 2001 From: Frederik Rommel <15031079+rommelfreddy@users.noreply.github.com> Date: Mon, 26 Jun 2023 13:15:01 +0200 Subject: [PATCH 01/41] PAYOSWXP-102: klarna: change event name of submitting order to prevent default behavior (reverse mode for ajax mode: twig) (#262) --- .../app/storefront/dist/storefront/js/payone-payment.js | 2 +- .../app/storefront/src/klarna/payone-payment.klarna.js | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Resources/app/storefront/dist/storefront/js/payone-payment.js b/src/Resources/app/storefront/dist/storefront/js/payone-payment.js index 8ccc3cefa..80c83ac5d 100644 --- a/src/Resources/app/storefront/dist/storefront/js/payone-payment.js +++ b/src/Resources/app/storefront/dist/storefront/js/payone-payment.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([["payone-payment"],{T08A:function(e,t,n){"use strict";n.r(t);var a,i,r,o=n("FGIj"),s=n("477Q");class l extends o.a{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 a=document.getElementById("savedpseudocardpan"),i=document.getElementById("confirmOrderForm");a&&a.addEventListener("change",this._handleChangeSavedCard.bind(this)),i&&i.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"),a=document.getElementById("card-logo");a.setAttribute("src",t),n.style.display="none",a.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.a(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={supportedCardtypes:["#","V","A","M","D","J","O","U","P"]},(i="options")in(a=l)?Object.defineProperty(a,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):a[i]=r;var d=n("2Jwc"),c=n("3xtq"),u=n("k8s9");class m extends o.a{init(){this.orderFormDisabled=!0,this._client=new u.a,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.a(t);t.disabled=!1,e.remove()}}_getModal(e){e.preventDefault(),c.a.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.a.remove()}if("active"===e.mandate.Status)return void this._submitForm();const t=new d.a(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.a.remove()}_getRequestData(){const e=document.getElementById("payoneCsrfTokenDebitManageMandate"),t=document.getElementById("iban");return{_csrf_token:e.value,iban:t.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 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.a{init(){this.orderFormDisabled=!0,this._client=new u.a,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,"payolutionBirthday"),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.a.create(),this._client.abort(),this._client.post(this._getValidateUrl(),e,(e=>this._handleValidateResponse(e)))}_handleValidateResponse(e){if(e=JSON.parse(e),c.a.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(){const e=document.getElementById("payoneCsrfTokenPayolutionInvoiceValidation"),t=document.getElementById("payolutionBirthday");return{_csrf_token:e.value,payolutionBirthday:t.value}}}class p extends o.a{init(){this.orderFormDisabled=!0,this._client=new u.a,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,"payolutionBirthday"),e.defaultPrevented)return;c.a.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.a.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,"payolutionBirthday"),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.a(t);t.disabled=!1,e.remove()}}_getRequestData(){const e=document.getElementById("payoneCsrfTokenPayolutionInstallmentCalculation"),t=document.getElementById("payolutionBirthday"),n=document.getElementById("payoneWorkOrder"),a=document.getElementById("payoneCartHash");return{_csrf_token:e.value,payolutionBirthday:t.value,workorder:n.value,carthash:a.value}}}var y=n("gHbT"),b=n("p4AR");function g(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class v extends o.a{init(){null===this.options.supportedNetworks&&(this.options.supportedNetworks=[]),this.client=new b.a,this.validateMerchantUrl=this.el.dataset.validateMerchantUrl,this.processPaymentUrl=this.el.dataset.processPaymentUrl,this.orderForm=y.a.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.client.abort(),this.client.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.a.querySelector(document,"#payone-apple-pay-error");e.style.display="block",e.scrollIntoView({block:"start"})}authorizePayment(e){let t=y.a.querySelector(this.orderForm,"input[name='orderId']").value;this.client.abort(),this.client.post(this.processPaymentUrl,JSON.stringify({token:e.payment.token,orderId:t}),(e=>{this.completePayment(e),this.orderForm.submit()}))}completePayment(e){let t="",n="",a="";try{let i=JSON.parse(e);n=i.status,t=i.txid,a=i.userid}catch(e){this.orderForm.submit()}this.updateFormData(n,t,a,e),"APPROVED"!==n&&"PENDING"!==n||this.session.completePayment({status:ApplePaySession.STATUS_SUCCESS,errors:[]}),this.orderForm.submit()}updateFormData(e,t,n,a){y.a.querySelector(this.orderForm,"input[name='status']").value=e,y.a.querySelector(this.orderForm,"input[name='txid']").value=t,y.a.querySelector(this.orderForm,"input[name='userid']").value=n,y.a.querySelector(this.orderForm,"input[name='response']").value=a}_handleApplePayButtonClick(){this.orderForm.reportValidity()&&(this.createSession(),this.performPayment())}_registerEventHandler(){this.el.addEventListener("click",this._handleApplePayButtonClick.bind(this))}}g(v,"options",{countryCode:"",currencyCode:"",supportedNetworks:[],merchantCapabilities:["supports3DS","supportsDebit","supportsCredit"],total:{label:"",type:"final",amount:"0.01"}}),g(v,"session",void 0),g(v,"client",void 0),g(v,"validateMerchantUrl",void 0),g(v,"processPaymentUrl",void 0),g(v,"orderForm",void 0);var I=n("i8qz");function _(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class E extends o.a{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._registerEventListeners()}_initKlarnaWidget(){Klarna.Payments.init({client_token:this.options.clientToken}),Klarna.Payments.load({container:this.options.selectorContainer,payment_method_category:this.options.paymentMethodIdentifier},(e=>{this.confirmFormSubmit.disabled=!1,ElementLoadingIndicatorUtil.remove(this.el)}))}_registerEventListeners(){this.orderForm&&this.orderForm.addEventListener("beforeSubmit",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 ButtonLoadingIndicator(this.confirmFormSubmit).remove():e.show_form||(window.location.href=window.location.href)}))}}_(E,"options",{clientToken:null,paymentMethodIdentifier:null,selectorContainer:null,selectorTokenInput:'input[name="payoneKlarnaAuthorizationToken"]',selectorFormId:"confirmOrderForm"}),_(E,"orderForm",null),_(E,"confirmFormSubmit",null);const f=window.PluginManager;f.register("PayonePaymentCreditCard",l,"[data-is-payone-credit-card]"),f.register("PayonePaymentDebitCard",m,"[data-is-payone-debit-card]"),f.register("PayonePaymentPayolutionInvoicing",h,"[data-is-payone-payolution-invoicing]"),f.register("PayonePaymentPayolutionInstallment",p,"[data-is-payone-payolution-installment]"),f.register("PayonePaymentApplePay",v,"[data-payone-payment-apple-pay-options]"),f.register("PayonePaymentRatepayInstallment",I.a,"[data-is-payone-ratepay-installment]"),f.register("PayonePaymentKlarna",E,"[data-payone-payment-klarna]")},i8qz:function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return d}));var a,i,r,o=n("FGIj"),s=n("gHbT"),l=n("k8s9");class d extends o.a{init(){this.csrfToken=document.getElementById("payoneCsrfTokenRatepayInstallmentCalculation"),this._client=new l.a,this.ratepayRateInput=s.a.querySelector(document,this.options.ratepayRateInputSelector),this.calculateInstallmentBtn=s.a.querySelector(document,this.options.calculateInstallmentBtnSelector),this.ratepayRuntimeInput=s.a.querySelector(document,this.options.ratepayRuntimeInputSelector),this.ratepayIbanContainer=s.a.querySelector(document,this.options.ratepayIbanContainerSelector),this.ratepayIbanInput=s.a.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)),e(this.options.ratepayIbanContainerSelector).on("shown.bs.collapse",this._handleOpenedIbanContainer.bind(this)),e(this.options.ratepayIbanContainerSelector).on("hidden.bs.collapse",this._handleClosedIbanContainer.bind(this))}_handleCalculateInstallmentButtonClick(){const e=this.ratepayRateInput.value;this._sendRequest("rate",e)}_handleInstallmentRuntimeChange(){const e=s.a.querySelector(document,this.options.ratepayRuntimeInputSelector).value;this._sendRequest("time",e)}_sendRequest(e,t){let n={_csrf_token:this.csrfToken.value};n.ratepayInstallmentType=e,n.ratepayInstallmentValue=t;const a=JSON.stringify(n);this._client.abort(),this._client.post("/payone/ratepay/installment/calculation",a,(e=>this._handleCalculationCallback(e)))}_handleCalculationCallback(e){this._replaceCalculationContent(e)}_replaceCalculationContent(e){s.a.querySelector(document,this.options.ratepayInstallmentPlanContainerSelector).innerHTML=e,this.ratepayInstallmentTable=s.a.querySelector(document,this.options.ratepayInstallmentTableSelector),this.ratepayRuntimeInput.value=this.ratepayInstallmentTable.dataset.ratepayNumberOfRates,this.ratepayRateInput.value=this.ratepayInstallmentTable.dataset.ratepayRate}_handleOpenedIbanContainer(){this.ratepayIbanInput.required=!0}_handleClosedIbanContainer(){this.ratepayIbanInput.required=!1}}r={ratepayRateInputSelector:"#ratepayRate",ratepayRuntimeInputSelector:"#ratepayRuntime",calculateInstallmentBtnSelector:"#payone-ratepay-calculate-installment-btn",ratepayInstallmentPlanContainerSelector:"#payone-ratepay-installment-plan",ratepayIbanContainerSelector:"#ratepayIbanContainer",ratepayIbanInputSelector:"#ratepayIban",ratepayInstallmentTableSelector:"#ratepayInstallmentTable"},(i="options")in(a=d)?Object.defineProperty(a,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):a[i]=r}).call(this,n("UoTJ"))}},[["T08A","runtime","vendor-node","vendor-shared"]]]); \ No newline at end of file +(window.webpackJsonp=window.webpackJsonp||[]).push([["payone-payment"],{T08A:function(e,t,n){"use strict";n.r(t);var a,i,r,o=n("FGIj"),s=n("477Q");class l extends o.a{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 a=document.getElementById("savedpseudocardpan"),i=document.getElementById("confirmOrderForm");a&&a.addEventListener("change",this._handleChangeSavedCard.bind(this)),i&&i.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"),a=document.getElementById("card-logo");a.setAttribute("src",t),n.style.display="none",a.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.a(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={supportedCardtypes:["#","V","A","M","D","J","O","U","P"]},(i="options")in(a=l)?Object.defineProperty(a,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):a[i]=r;var d=n("2Jwc"),c=n("3xtq"),u=n("k8s9");class m extends o.a{init(){this.orderFormDisabled=!0,this._client=new u.a,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.a(t);t.disabled=!1,e.remove()}}_getModal(e){e.preventDefault(),c.a.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.a.remove()}if("active"===e.mandate.Status)return void this._submitForm();const t=new d.a(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.a.remove()}_getRequestData(){const e=document.getElementById("payoneCsrfTokenDebitManageMandate"),t=document.getElementById("iban");return{_csrf_token:e.value,iban:t.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 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.a{init(){this.orderFormDisabled=!0,this._client=new u.a,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,"payolutionBirthday"),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.a.create(),this._client.abort(),this._client.post(this._getValidateUrl(),e,(e=>this._handleValidateResponse(e)))}_handleValidateResponse(e){if(e=JSON.parse(e),c.a.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(){const e=document.getElementById("payoneCsrfTokenPayolutionInvoiceValidation"),t=document.getElementById("payolutionBirthday");return{_csrf_token:e.value,payolutionBirthday:t.value}}}class p extends o.a{init(){this.orderFormDisabled=!0,this._client=new u.a,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,"payolutionBirthday"),e.defaultPrevented)return;c.a.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.a.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,"payolutionBirthday"),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.a(t);t.disabled=!1,e.remove()}}_getRequestData(){const e=document.getElementById("payoneCsrfTokenPayolutionInstallmentCalculation"),t=document.getElementById("payolutionBirthday"),n=document.getElementById("payoneWorkOrder"),a=document.getElementById("payoneCartHash");return{_csrf_token:e.value,payolutionBirthday:t.value,workorder:n.value,carthash:a.value}}}var y=n("gHbT"),b=n("p4AR");function g(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class v extends o.a{init(){null===this.options.supportedNetworks&&(this.options.supportedNetworks=[]),this.client=new b.a,this.validateMerchantUrl=this.el.dataset.validateMerchantUrl,this.processPaymentUrl=this.el.dataset.processPaymentUrl,this.orderForm=y.a.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.client.abort(),this.client.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.a.querySelector(document,"#payone-apple-pay-error");e.style.display="block",e.scrollIntoView({block:"start"})}authorizePayment(e){let t=y.a.querySelector(this.orderForm,"input[name='orderId']").value;this.client.abort(),this.client.post(this.processPaymentUrl,JSON.stringify({token:e.payment.token,orderId:t}),(e=>{this.completePayment(e),this.orderForm.submit()}))}completePayment(e){let t="",n="",a="";try{let i=JSON.parse(e);n=i.status,t=i.txid,a=i.userid}catch(e){this.orderForm.submit()}this.updateFormData(n,t,a,e),"APPROVED"!==n&&"PENDING"!==n||this.session.completePayment({status:ApplePaySession.STATUS_SUCCESS,errors:[]}),this.orderForm.submit()}updateFormData(e,t,n,a){y.a.querySelector(this.orderForm,"input[name='status']").value=e,y.a.querySelector(this.orderForm,"input[name='txid']").value=t,y.a.querySelector(this.orderForm,"input[name='userid']").value=n,y.a.querySelector(this.orderForm,"input[name='response']").value=a}_handleApplePayButtonClick(){this.orderForm.reportValidity()&&(this.createSession(),this.performPayment())}_registerEventHandler(){this.el.addEventListener("click",this._handleApplePayButtonClick.bind(this))}}g(v,"options",{countryCode:"",currencyCode:"",supportedNetworks:[],merchantCapabilities:["supports3DS","supportsDebit","supportsCredit"],total:{label:"",type:"final",amount:"0.01"}}),g(v,"session",void 0),g(v,"client",void 0),g(v,"validateMerchantUrl",void 0),g(v,"processPaymentUrl",void 0),g(v,"orderForm",void 0);var I=n("i8qz");function _(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class E extends o.a{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._registerEventListeners()}_initKlarnaWidget(){Klarna.Payments.init({client_token:this.options.clientToken}),Klarna.Payments.load({container:this.options.selectorContainer,payment_method_category:this.options.paymentMethodIdentifier},(e=>{this.confirmFormSubmit.disabled=!1,ElementLoadingIndicatorUtil.remove(this.el)}))}_registerEventListeners(){this.orderForm&&("csrf"in window&&"twig"!==window.csrf.mode?this.orderForm.addEventListener("beforeSubmit",this._handleOrderSubmit.bind(this)):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 ButtonLoadingIndicator(this.confirmFormSubmit).remove():e.show_form||(window.location.href=window.location.href)}))}}_(E,"options",{clientToken:null,paymentMethodIdentifier:null,selectorContainer:null,selectorTokenInput:'input[name="payoneKlarnaAuthorizationToken"]',selectorFormId:"confirmOrderForm"}),_(E,"orderForm",null),_(E,"confirmFormSubmit",null);const f=window.PluginManager;f.register("PayonePaymentCreditCard",l,"[data-is-payone-credit-card]"),f.register("PayonePaymentDebitCard",m,"[data-is-payone-debit-card]"),f.register("PayonePaymentPayolutionInvoicing",h,"[data-is-payone-payolution-invoicing]"),f.register("PayonePaymentPayolutionInstallment",p,"[data-is-payone-payolution-installment]"),f.register("PayonePaymentApplePay",v,"[data-payone-payment-apple-pay-options]"),f.register("PayonePaymentRatepayInstallment",I.a,"[data-is-payone-ratepay-installment]"),f.register("PayonePaymentKlarna",E,"[data-payone-payment-klarna]")},i8qz:function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return d}));var a,i,r,o=n("FGIj"),s=n("gHbT"),l=n("k8s9");class d extends o.a{init(){this.csrfToken=document.getElementById("payoneCsrfTokenRatepayInstallmentCalculation"),this._client=new l.a,this.ratepayRateInput=s.a.querySelector(document,this.options.ratepayRateInputSelector),this.calculateInstallmentBtn=s.a.querySelector(document,this.options.calculateInstallmentBtnSelector),this.ratepayRuntimeInput=s.a.querySelector(document,this.options.ratepayRuntimeInputSelector),this.ratepayIbanContainer=s.a.querySelector(document,this.options.ratepayIbanContainerSelector),this.ratepayIbanInput=s.a.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)),e(this.options.ratepayIbanContainerSelector).on("shown.bs.collapse",this._handleOpenedIbanContainer.bind(this)),e(this.options.ratepayIbanContainerSelector).on("hidden.bs.collapse",this._handleClosedIbanContainer.bind(this))}_handleCalculateInstallmentButtonClick(){const e=this.ratepayRateInput.value;this._sendRequest("rate",e)}_handleInstallmentRuntimeChange(){const e=s.a.querySelector(document,this.options.ratepayRuntimeInputSelector).value;this._sendRequest("time",e)}_sendRequest(e,t){let n={_csrf_token:this.csrfToken.value};n.ratepayInstallmentType=e,n.ratepayInstallmentValue=t;const a=JSON.stringify(n);this._client.abort(),this._client.post("/payone/ratepay/installment/calculation",a,(e=>this._handleCalculationCallback(e)))}_handleCalculationCallback(e){this._replaceCalculationContent(e)}_replaceCalculationContent(e){s.a.querySelector(document,this.options.ratepayInstallmentPlanContainerSelector).innerHTML=e,this.ratepayInstallmentTable=s.a.querySelector(document,this.options.ratepayInstallmentTableSelector),this.ratepayRuntimeInput.value=this.ratepayInstallmentTable.dataset.ratepayNumberOfRates,this.ratepayRateInput.value=this.ratepayInstallmentTable.dataset.ratepayRate}_handleOpenedIbanContainer(){this.ratepayIbanInput.required=!0}_handleClosedIbanContainer(){this.ratepayIbanInput.required=!1}}r={ratepayRateInputSelector:"#ratepayRate",ratepayRuntimeInputSelector:"#ratepayRuntime",calculateInstallmentBtnSelector:"#payone-ratepay-calculate-installment-btn",ratepayInstallmentPlanContainerSelector:"#payone-ratepay-installment-plan",ratepayIbanContainerSelector:"#ratepayIbanContainer",ratepayIbanInputSelector:"#ratepayIban",ratepayInstallmentTableSelector:"#ratepayInstallmentTable"},(i="options")in(a=d)?Object.defineProperty(a,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):a[i]=r}).call(this,n("UoTJ"))}},[["T08A","runtime","vendor-node","vendor-shared"]]]); \ No newline at end of file diff --git a/src/Resources/app/storefront/src/klarna/payone-payment.klarna.js b/src/Resources/app/storefront/src/klarna/payone-payment.klarna.js index 8a4f4352a..2f38cfc2a 100644 --- a/src/Resources/app/storefront/src/klarna/payone-payment.klarna.js +++ b/src/Resources/app/storefront/src/klarna/payone-payment.klarna.js @@ -39,7 +39,14 @@ export default class PayonePaymentKlarna extends Plugin { _registerEventListeners() { if (this.orderForm) { - this.orderForm.addEventListener('beforeSubmit', this._handleOrderSubmit.bind(this)); + if (!('csrf' in window) || window.csrf.mode === 'twig') { + this.orderForm.addEventListener('submit', this._handleOrderSubmit.bind(this)); + } else { + /** + * @deprecated tag:6.5.0 CSRF will be removed in 6.5.0.0 - we only need to subscribe the `submit`-event. + */ + this.orderForm.addEventListener('beforeSubmit', this._handleOrderSubmit.bind(this)); + } } } From 011aba66241c4c2fc5af0468766a424b1b3587d4 Mon Sep 17 00:00:00 2001 From: Frederik Rommel <15031079+rommelfreddy@users.noreply.github.com> Date: Mon, 26 Jun 2023 15:27:51 +0200 Subject: [PATCH 02/41] [PAYOSWXP-109] postfinance: capturing: remove capturemode (#261) --- CHANGELOG.md | 1 + src/PaymentHandler/PaymentHandlerGroups.php | 4 ++++ .../CaptureRequestParameterBuilder.php | 2 +- .../CaptureRequestParameterBuilderTest.php | 22 +++++++++++++++++++ 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 833d65e8b..cdb9ccac3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -347,6 +347,7 @@ Bugfixes * Payla: fix typo in deviceFingerPrint * Klarna: change event name of submitting order to prevent default behavior * Secured Debit/Secured Installment: add validation for IBAN +* Postfinance: fix that capturing was not possible Maintenance diff --git a/src/PaymentHandler/PaymentHandlerGroups.php b/src/PaymentHandler/PaymentHandlerGroups.php index 2127f6249..fada872ab 100644 --- a/src/PaymentHandler/PaymentHandlerGroups.php +++ b/src/PaymentHandler/PaymentHandlerGroups.php @@ -17,4 +17,8 @@ interface PaymentHandlerGroups PayoneSecuredInvoicePaymentHandler::class, PayoneSecuredInstallmentPaymentHandler::class, ]; + public const POSTFINANCE = [ + PayonePostfinanceCardPaymentHandler::class, + PayonePostfinanceWalletPaymentHandler::class, + ]; } diff --git a/src/Payone/RequestParameter/Builder/Capture/CaptureRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/Capture/CaptureRequestParameterBuilder.php index 45b2ca6f3..a17739d88 100644 --- a/src/Payone/RequestParameter/Builder/Capture/CaptureRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/Capture/CaptureRequestParameterBuilder.php @@ -101,7 +101,7 @@ public function getRequestParameter(AbstractRequestParameterStruct $arguments): $parameters['settleaccount'] = self::SETTLEACCOUNT_YES; } - if (\in_array($arguments->getPaymentMethod(), PaymentHandlerGroups::BNPL, true)) { + if (\in_array($arguments->getPaymentMethod(), [...PaymentHandlerGroups::BNPL, ...PaymentHandlerGroups::POSTFINANCE], true)) { unset($parameters['capturemode']); } diff --git a/tests/Payone/RequestParameter/Builder/Capture/CaptureRequestParameterBuilderTest.php b/tests/Payone/RequestParameter/Builder/Capture/CaptureRequestParameterBuilderTest.php index dc840f954..db69c1e45 100644 --- a/tests/Payone/RequestParameter/Builder/Capture/CaptureRequestParameterBuilderTest.php +++ b/tests/Payone/RequestParameter/Builder/Capture/CaptureRequestParameterBuilderTest.php @@ -8,6 +8,7 @@ use PayonePayment\DataAbstractionLayer\Aggregate\PayonePaymentOrderTransactionDataEntity; use PayonePayment\DataAbstractionLayer\Extension\PayonePaymentOrderTransactionExtension; use PayonePayment\PaymentHandler\AbstractPayonePaymentHandler; +use PayonePayment\PaymentHandler\PaymentHandlerGroups; use PayonePayment\PaymentHandler\PayoneBancontactPaymentHandler; use PayonePayment\PaymentHandler\PayoneCreditCardPaymentHandler; use PayonePayment\PaymentHandler\PayoneRatepayDebitPaymentHandler; @@ -324,4 +325,25 @@ public function testItAddsNullAsCaptureMode(): void static::assertNull($parameters['capturemode']); } + + public function testItRemovesCaptureModeForPaymentHandlers(): void + { + $dataBag = new RequestDataBag([ + 'amount' => 100, + 'complete' => false, + ]); + + $paymentHandlers = [...PaymentHandlerGroups::BNPL, ...PaymentHandlerGroups::POSTFINANCE]; + + foreach ($paymentHandlers as $handler) { + $struct = $this->getFinancialTransactionStruct( + $dataBag, + $handler, + AbstractRequestParameterBuilder::REQUEST_ACTION_CAPTURE + ); + + $builder = $this->getContainer()->get(CaptureRequestParameterBuilder::class); + static::assertArrayNotHasKey('capturemode', $builder->getRequestParameter($struct), sprintf('For the payment-handler `%s` no capture mode should be returned.', $handler)); + } + } } From 0ba59fa5dfe85eac4d1d5dc07628fcd5b5d135b0 Mon Sep 17 00:00:00 2001 From: "D.Metoglou" Date: Mon, 26 Jun 2023 16:39:06 +0200 Subject: [PATCH 03/41] version bump to 4.2.1 --- CHANGELOG.md | 20 ++++++++------------ CHANGELOG_de-DE.md | 17 ++++++++++++++++- composer.json | 2 +- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cdb9ccac3..5ee5214d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -338,17 +338,13 @@ Maintenance # 4.2.1 -New Features - -* - Bugfixes - -* Payla: fix typo in deviceFingerPrint -* Klarna: change event name of submitting order to prevent default behavior -* Secured Debit/Secured Installment: add validation for IBAN -* Postfinance: fix that capturing was not possible - + +* Fixed capture for Bancontact +* Fixed typo in dfp snippet for Payla +* Fixed txid in database +* Fixed Klarna event name + Maintenance - -* add index for transaction-id in transaction-data table for better performance + +* tested with 6.4.20.2 diff --git a/CHANGELOG_de-DE.md b/CHANGELOG_de-DE.md index 206db1cf1..f0498cd0e 100644 --- a/CHANGELOG_de-DE.md +++ b/CHANGELOG_de-DE.md @@ -311,6 +311,8 @@ Wartung # 4.2.0 +Neue Funktionen + * Neue Zahlungsart: PAYONE WeChat Pay * Neue Zahlungsart: PAYONE Postfinance Card * Neue Zahlungsart: PAYONE Postfinance E-Finance @@ -329,4 +331,17 @@ Wartung * Zahlungsartenfilter Technologie verbessert * Geburtstagsfeld aus der Zahlungsart offene Rechnung entfernt * iDEAL Bankliste geupdated -* getestet mit 6.4.20 +* Getestet mit 6.4.20 + +# 4.2.1 + +Fehlerbehebung + +* Fehler beim Capture in Bancontact behoben +* Schreibfehler in dfp snippet für Payla behoben +* Fehler txid in Datenbank behoben +* Fehler Klarna Eventname behoben + +Wartung + +* Getestet mit 6.4.20.2 \ No newline at end of file diff --git a/composer.json b/composer.json index f6192e23f..b455374c0 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "payone-gmbh/shopware-6", "type": "shopware-platform-plugin", "description": "PAYONE Payment Plugin", - "version": "4.2.0", + "version": "4.2.1", "license": "MIT", "authors": [ { From ed319781ec3e431cbf99fa9ad63c3cf6ed49bf79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20M=C3=BCller?= Date: Tue, 28 Mar 2023 08:33:16 +0200 Subject: [PATCH 04/41] [PAYONE-184] Add compatibility for shopware 6.5 --- composer.json | 4 +- composer.lock | 52 +++++------ phpstan.neon | 1 - .../CardRepository/CardRepository.php | 6 +- .../CardRepositoryInterface.php | 2 +- .../CartValidator/ZeroAmountCartValidator.php | 10 +- src/Components/Currency/CurrencyPrecision.php | 4 + .../Transaction/TransactionDataHandler.php | 6 +- .../AbstractDeviceFingerprintService.php | 16 ++-- .../PayoneBNPLDeviceFingerprintService.php | 8 +- .../RatepayDeviceFingerprintService.php | 8 +- src/Components/Document/InvoiceGenerator.php | 91 ------------------- src/Components/Helper/OrderFetcher.php | 6 +- .../LineItemHydrator/LineItemHydrator.php | 6 +- .../MandateService/MandateService.php | 6 +- .../FilteredPaymentMethodRoute.php | 2 - .../RedirectHandler/RedirectHandler.php | 1 + .../AbstractTransactionHandler.php | 6 +- .../Capture/CaptureTransactionHandler.php | 6 +- .../Refund/RefundTransactionHandler.php | 6 +- .../TransactionStatusService.php | 6 +- .../Validator/BirthdayValidator.php | 2 +- .../Validator/PaymentMethodValidator.php | 5 +- src/Controller/CaptureController.php | 6 +- src/Controller/RedirectController.php | 4 +- src/Controller/RefundController.php | 6 +- src/Controller/SettingsController.php | 33 +++---- src/Controller/WebhookController.php | 15 ++- src/DependencyInjection/controllers.xml | 1 + src/DependencyInjection/decorations.xml | 12 --- .../device_fingerprint.xml | 4 +- src/DependencyInjection/listeners.xml | 4 +- src/DependencyInjection/services.xml | 2 +- .../CheckoutConfirmCartDataEventListener.php | 13 ++- ...CheckoutConfirmCreditCardEventListener.php | 10 +- .../CheckoutConfirmDebitEventListener.php | 4 +- .../CheckoutConfirmTemplateEventListener.php | 4 +- .../CheckoutFinishEventListener.php | 12 +-- .../DocumentOrderEventListener.php | 25 ----- .../InvoiceRendererEventListener.php | 74 +++++++++++++++ .../OrderValidationEventListener.php | 4 +- .../StorefrontRenderEventListener.php | 12 +-- src/Installer/CustomFieldInstaller.php | 8 +- src/Installer/PaymentMethodInstaller.php | 21 ++--- .../RuleInstallerSecureInvoice.php | 18 ++-- ...ion1557926559AddTemporaryRedirectTable.php | 2 + ...ion1561379069AddPayonePaymentCardTable.php | 2 + ...1562097986AddPayonePaymentMandateTable.php | 2 + ...n1580996279AddRedirectTableCreatedDate.php | 2 + ...n1625137302AddNotificationForwardTable.php | 2 + ...on1625137302AddNotificationTargetTable.php | 2 + ...tion1637576753FixForeignKeyConstraints.php | 2 + ...1638289341AddOrderTransActionDataTable.php | 1 + ...teOrderTransactionDataFromCustomFields.php | 2 + ...ration1666770470AddCardTypeToCardTable.php | 2 + .../AbstractPayoneInvoicePaymentHandler.php | 4 +- .../AbstractPayonePaymentHandler.php | 6 +- .../PayoneAlipayPaymentHandler.php | 4 +- .../PayoneApplePayPaymentHandler.php | 4 +- .../PayoneBancontactPaymentHandler.php | 4 +- .../PayoneCreditCardPaymentHandler.php | 4 +- .../PayoneDebitPaymentHandler.php | 4 +- .../PayoneEpsPaymentHandler.php | 4 +- .../PayoneIDealPaymentHandler.php | 4 +- .../PayonePaydirektPaymentHandler.php | 4 +- .../PayonePayolutionDebitPaymentHandler.php | 4 +- ...onePayolutionInstallmentPaymentHandler.php | 4 +- ...ayonePayolutionInvoicingPaymentHandler.php | 4 +- .../PayonePaypalExpressPaymentHandler.php | 4 +- .../PayonePaypalPaymentHandler.php | 4 +- .../PayonePrepaymentPaymentHandler.php | 4 +- .../PayonePrzelewy24PaymentHandler.php | 4 +- .../PayoneRatepayDebitPaymentHandler.php | 4 +- ...PayoneRatepayInstallmentPaymentHandler.php | 4 +- .../PayoneRatepayInvoicingPaymentHandler.php | 4 +- ...PayoneSecuredDirectDebitPaymentHandler.php | 4 +- ...PayoneSecuredInstallmentPaymentHandler.php | 4 +- .../PayoneSecuredInvoicePaymentHandler.php | 4 +- .../PayoneSofortBankingPaymentHandler.php | 4 +- .../PayoneTrustlyPaymentHandler.php | 4 +- .../PayoneWeChatPayPaymentHandler.php | 4 +- src/Payone/Client/PayoneClient.php | 2 +- .../AuthorizeRequestParameterBuilder.php | 6 +- ...omerInformationRequestParameterBuilder.php | 6 +- .../CustomerRequestParameterBuilder.php | 14 +-- ...eralTransactionRequestParameterBuilder.php | 6 +- .../AuthorizeRequestParameterBuilder.php | 6 +- .../PreCheckRequestParameterBuilder.php | 1 + .../AuthorizeRequestParameterBuilder.php | 2 - .../AuthorizeRequestParameterBuilder.php | 6 +- .../AuthorizeRequestParameterBuilder.php | 4 +- .../AuthorizeRequestParameterBuilder.php | 6 +- .../AuthorizeRequestParameterBuilder.php | 6 +- .../AuthorizeRequestParameterBuilder.php | 6 +- .../AuthorizeRequestParameterBuilder.php | 6 +- .../Handler/NotificationForwardHandler.php | 10 +- .../NotificationForwardHandler.php | 51 ++++++----- src/PayonePayment.php | 20 ++-- .../payone-ratepay-profiles.html.twig | 2 +- .../payone-notification-target-list.html.twig | 4 +- .../payone-settings/payone-settings.html.twig | 14 +-- .../administration/js/payone-payment.js | 2 +- src/ScheduledTask/RedirectCleanUpHandler.php | 4 +- src/StoreApi/Route/ApplePayRoute.php | 10 +- src/StoreApi/Route/CardRoute.php | 17 +--- src/StoreApi/Route/MandateRoute.php | 16 +--- .../Account/AccountCardController.php | 7 +- .../Account/AccountMandateController.php | 7 +- .../AccountOrderControllerDecorator.php | 8 +- .../Debit/ManageMandateController.php | 4 +- .../Payolution/PayolutionController.php | 13 +-- .../Paypal/PaypalExpressController.php | 17 ++-- .../Controller/Ratepay/RatepayController.php | 4 +- .../Page/Card/AccountCardPageLoader.php | 5 +- .../Page/Mandate/AccountMandatePageLoader.php | 4 +- 115 files changed, 454 insertions(+), 519 deletions(-) delete mode 100644 src/Components/Document/InvoiceGenerator.php delete mode 100644 src/DependencyInjection/decorations.xml delete mode 100644 src/EventListener/DocumentOrderEventListener.php create mode 100644 src/EventListener/InvoiceRendererEventListener.php diff --git a/composer.json b/composer.json index b455374c0..ce8495654 100644 --- a/composer.json +++ b/composer.json @@ -30,9 +30,9 @@ "require-dev": { "dms/phpunit-arraysubset-asserts": "^0.3.0", "kubawerlos/php-cs-fixer-custom-fixers": "^3.11", - "phpstan/phpstan": "1.8.0", + "phpstan/phpstan": "^1.10", "phpstan/phpstan-phpunit": "1.1.1", - "phpstan/phpstan-symfony": "1.2.5", + "phpstan/phpstan-symfony": "^1.2", "phpunit/phpunit": "^9.5", "symplify/easy-coding-standard": "^10.0" }, diff --git a/composer.lock b/composer.lock index 9af0740f2..454442ee3 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "71a3368846c0ffa532311b8437b95424", + "content-hash": "6431aeca1340c673674802cd37e0bde9", "packages": [ { "name": "sinergi/browser-detector", @@ -679,16 +679,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.8.0", + "version": "1.10.6", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "b7648d4ee9321665acaf112e49da9fd93df8fbd5" + "reference": "50d089a3e0904b0fe7e2cf2d4fd37d427d64235a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/b7648d4ee9321665acaf112e49da9fd93df8fbd5", - "reference": "b7648d4ee9321665acaf112e49da9fd93df8fbd5", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/50d089a3e0904b0fe7e2cf2d4fd37d427d64235a", + "reference": "50d089a3e0904b0fe7e2cf2d4fd37d427d64235a", "shasum": "" }, "require": { @@ -712,9 +712,13 @@ "MIT" ], "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.8.0" + "source": "https://github.com/phpstan/phpstan/tree/1.10.6" }, "funding": [ { @@ -725,16 +729,12 @@ "url": "https://github.com/phpstan", "type": "github" }, - { - "url": "https://www.patreon.com/phpstan", - "type": "patreon" - }, { "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", "type": "tidelift" } ], - "time": "2022-06-29T08:53:31+00:00" + "time": "2023-03-09T16:55:12+00:00" }, { "name": "phpstan/phpstan-phpunit", @@ -790,22 +790,22 @@ }, { "name": "phpstan/phpstan-symfony", - "version": "1.2.5", + "version": "1.2.23", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-symfony.git", - "reference": "85be852a17fd5a6b67d4fc6daed21e794f935b2d" + "reference": "8a8d0538ca943b20beda7e9799e14fb3683262d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-symfony/zipball/85be852a17fd5a6b67d4fc6daed21e794f935b2d", - "reference": "85be852a17fd5a6b67d4fc6daed21e794f935b2d", + "url": "https://api.github.com/repos/phpstan/phpstan-symfony/zipball/8a8d0538ca943b20beda7e9799e14fb3683262d4", + "reference": "8a8d0538ca943b20beda7e9799e14fb3683262d4", "shasum": "" }, "require": { "ext-simplexml": "*", "php": "^7.2 || ^8.0", - "phpstan/phpstan": "^1.6" + "phpstan/phpstan": "^1.9.4" }, "conflict": { "symfony/framework-bundle": "<3.0" @@ -817,15 +817,15 @@ "phpstan/phpstan-strict-rules": "^1.0", "phpunit/phpunit": "^9.5", "psr/container": "1.0 || 1.1.1", - "symfony/config": "^4.2 || ^5.0", - "symfony/console": "^4.0 || ^5.0", - "symfony/dependency-injection": "^4.0 || ^5.0", - "symfony/form": "^4.0 || ^5.0", - "symfony/framework-bundle": "^4.4 || ^5.0", - "symfony/http-foundation": "^5.1", - "symfony/messenger": "^4.2 || ^5.0", + "symfony/config": "^5.4 || ^6.1", + "symfony/console": "^5.4 || ^6.1", + "symfony/dependency-injection": "^5.4 || ^6.1", + "symfony/form": "^5.4 || ^6.1", + "symfony/framework-bundle": "^5.4 || ^6.1", + "symfony/http-foundation": "^5.4 || ^6.1", + "symfony/messenger": "^5.4", "symfony/polyfill-php80": "^1.24", - "symfony/serializer": "^4.0 || ^5.0" + "symfony/serializer": "^5.4" }, "type": "phpstan-extension", "extra": { @@ -855,9 +855,9 @@ "description": "Symfony Framework extensions and rules for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-symfony/issues", - "source": "https://github.com/phpstan/phpstan-symfony/tree/1.2.5" + "source": "https://github.com/phpstan/phpstan-symfony/tree/1.2.23" }, - "time": "2022-06-10T08:44:35+00:00" + "time": "2023-02-06T10:42:02+00:00" }, { "name": "phpunit/php-code-coverage", diff --git a/phpstan.neon b/phpstan.neon index 158083027..d64fe5c0d 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -3,7 +3,6 @@ includes: - vendor/phpstan/phpstan/conf/bleedingEdge.neon parameters: - phpVersion: 70400 level: 8 treatPhpDocTypesAsCertain: false checkMissingIterableValueType: false diff --git a/src/Components/CardRepository/CardRepository.php b/src/Components/CardRepository/CardRepository.php index d2742ecf5..8447b03a5 100644 --- a/src/Components/CardRepository/CardRepository.php +++ b/src/Components/CardRepository/CardRepository.php @@ -7,7 +7,7 @@ use PayonePayment\DataAbstractionLayer\Entity\Card\PayonePaymentCardEntity; use Shopware\Core\Checkout\Customer\CustomerEntity; use Shopware\Core\Framework\Context; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; use Shopware\Core\Framework\DataAbstractionLayer\Search\EntitySearchResult; use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter; @@ -16,9 +16,9 @@ class CardRepository implements CardRepositoryInterface { - private EntityRepositoryInterface $cardRepository; + private EntityRepository $cardRepository; - public function __construct(EntityRepositoryInterface $cardRepository) + public function __construct(EntityRepository $cardRepository) { $this->cardRepository = $cardRepository; } diff --git a/src/Components/CardRepository/CardRepositoryInterface.php b/src/Components/CardRepository/CardRepositoryInterface.php index e20895541..8a30a7bde 100644 --- a/src/Components/CardRepository/CardRepositoryInterface.php +++ b/src/Components/CardRepository/CardRepositoryInterface.php @@ -12,7 +12,7 @@ interface CardRepositoryInterface { public function saveCard( - CustomerEntity $transaction, + CustomerEntity $customer, string $truncatedCardPan, string $pseudoCardPan, string $cardType, diff --git a/src/Components/CartValidator/ZeroAmountCartValidator.php b/src/Components/CartValidator/ZeroAmountCartValidator.php index 5e4bc2424..deebcc8c8 100644 --- a/src/Components/CartValidator/ZeroAmountCartValidator.php +++ b/src/Components/CartValidator/ZeroAmountCartValidator.php @@ -4,6 +4,7 @@ namespace PayonePayment\Components\CartValidator; +use PayonePayment\Components\Currency\CurrencyPrecisionInterface; use PayonePayment\Installer\PaymentMethodInstaller; use Shopware\Core\Checkout\Cart\Cart; use Shopware\Core\Checkout\Cart\CartValidatorInterface; @@ -13,13 +14,20 @@ class ZeroAmountCartValidator implements CartValidatorInterface { + protected CurrencyPrecisionInterface $currencyPrecision; + + public function __construct(CurrencyPrecisionInterface $currencyPrecision) + { + $this->currencyPrecision = $currencyPrecision; + } + public function validate(Cart $cart, ErrorCollection $errors, SalesChannelContext $context): void { if ($cart->getLineItems()->count() === 0) { return; } - if (((int) round($cart->getPrice()->getTotalPrice() * (10 ** $context->getCurrency()->getDecimalPrecision()))) > 0) { + if ($this->currencyPrecision->getRoundedItemAmount($cart->getPrice()->getTotalPrice(), $context->getCurrency()) > 0) { return; } diff --git a/src/Components/Currency/CurrencyPrecision.php b/src/Components/Currency/CurrencyPrecision.php index b2d94aea8..0e9617a9c 100644 --- a/src/Components/Currency/CurrencyPrecision.php +++ b/src/Components/Currency/CurrencyPrecision.php @@ -12,10 +12,12 @@ class CurrencyPrecision implements CurrencyPrecisionInterface public function getItemRoundingPrecision(CurrencyEntity $currency): int { + /** @phpstan-ignore-next-line */ if (method_exists($currency, 'getItemRounding')) { return $currency->getItemRounding()->getDecimals(); } + /** @phpstan-ignore-next-line */ if (method_exists($currency, 'getDecimalPrecision')) { /** @noinspection PhpDeprecationInspection */ return $currency->getDecimalPrecision(); @@ -26,10 +28,12 @@ public function getItemRoundingPrecision(CurrencyEntity $currency): int public function getTotalRoundingPrecision(CurrencyEntity $currency): int { + /** @phpstan-ignore-next-line */ if (method_exists($currency, 'getTotalRounding')) { return $currency->getTotalRounding()->getDecimals(); } + /** @phpstan-ignore-next-line */ if (method_exists($currency, 'getDecimalPrecision')) { /** @noinspection PhpDeprecationInspection */ return $currency->getDecimalPrecision(); diff --git a/src/Components/DataHandler/Transaction/TransactionDataHandler.php b/src/Components/DataHandler/Transaction/TransactionDataHandler.php index a74e96f94..931df4f5d 100644 --- a/src/Components/DataHandler/Transaction/TransactionDataHandler.php +++ b/src/Components/DataHandler/Transaction/TransactionDataHandler.php @@ -11,17 +11,17 @@ use PayonePayment\Struct\PaymentTransaction; use Shopware\Core\Checkout\Order\Aggregate\OrderTransaction\OrderTransactionEntity; use Shopware\Core\Framework\Context; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter; class TransactionDataHandler implements TransactionDataHandlerInterface { - private EntityRepositoryInterface $transactionRepository; + private EntityRepository $transactionRepository; private CurrencyPrecisionInterface $currencyPrecision; - public function __construct(EntityRepositoryInterface $transactionRepository, CurrencyPrecisionInterface $currencyPrecision) + public function __construct(EntityRepository $transactionRepository, CurrencyPrecisionInterface $currencyPrecision) { $this->transactionRepository = $transactionRepository; $this->currencyPrecision = $currencyPrecision; diff --git a/src/Components/DeviceFingerprint/AbstractDeviceFingerprintService.php b/src/Components/DeviceFingerprint/AbstractDeviceFingerprintService.php index 828a05f36..5ea178c27 100644 --- a/src/Components/DeviceFingerprint/AbstractDeviceFingerprintService.php +++ b/src/Components/DeviceFingerprint/AbstractDeviceFingerprintService.php @@ -6,15 +6,15 @@ use PayonePayment\PaymentHandler\AbstractPayonePaymentHandler; use Shopware\Core\System\SalesChannel\SalesChannelContext; -use Symfony\Component\HttpFoundation\Session\SessionInterface; +use Symfony\Component\HttpFoundation\RequestStack; abstract class AbstractDeviceFingerprintService { - protected SessionInterface $session; + protected RequestStack $requestStack; - public function __construct(SessionInterface $session) + public function __construct(RequestStack $requestStack) { - $this->session = $session; + $this->requestStack = $requestStack; } /** @@ -26,13 +26,13 @@ abstract public function getDeviceIdentSnippet(string $deviceIdentToken, SalesCh public function getDeviceIdentToken(SalesChannelContext $salesChannelContext): string { - $sessionValue = $this->session->get($this->getSessionVarName()); + $sessionValue = $this->requestStack->getSession()->get($this->getSessionVarName()); if ($sessionValue) { $token = $sessionValue; } else { $token = $this->buildDeviceIdentToken($salesChannelContext); - $this->session->set($this->getSessionVarName(), $token); + $this->requestStack->getSession()->set($this->getSessionVarName(), $token); } return $token; @@ -40,12 +40,12 @@ public function getDeviceIdentToken(SalesChannelContext $salesChannelContext): s public function isDeviceIdentTokenAlreadyGenerated(): bool { - return $this->session->get($this->getSessionVarName()) !== null; + return $this->requestStack->getSession()->get($this->getSessionVarName()) !== null; } public function deleteDeviceIdentToken(): void { - $this->session->remove($this->getSessionVarName()); + $this->requestStack->getSession()->remove($this->getSessionVarName()); } abstract protected function getSessionVarName(): string; diff --git a/src/Components/DeviceFingerprint/PayoneBNPLDeviceFingerprintService.php b/src/Components/DeviceFingerprint/PayoneBNPLDeviceFingerprintService.php index ff98ea85a..4e330a309 100644 --- a/src/Components/DeviceFingerprint/PayoneBNPLDeviceFingerprintService.php +++ b/src/Components/DeviceFingerprint/PayoneBNPLDeviceFingerprintService.php @@ -9,7 +9,7 @@ use PayonePayment\Installer\ConfigInstaller; use PayonePayment\PaymentHandler\PaymentHandlerGroups; use Shopware\Core\System\SalesChannel\SalesChannelContext; -use Symfony\Component\HttpFoundation\Session\SessionInterface; +use Symfony\Component\HttpFoundation\RequestStack; class PayoneBNPLDeviceFingerprintService extends AbstractDeviceFingerprintService { @@ -18,9 +18,9 @@ class PayoneBNPLDeviceFingerprintService extends AbstractDeviceFingerprintServic protected ConfigReaderInterface $configReader; - public function __construct(SessionInterface $session, ConfigReaderInterface $configReader) + public function __construct(RequestStack $requestStack, ConfigReaderInterface $configReader) { - parent::__construct($session); + parent::__construct($requestStack); $this->configReader = $configReader; } @@ -52,7 +52,7 @@ protected function getSessionVarName(): string protected function buildDeviceIdentToken(SalesChannelContext $salesChannelContext): string { - $sessionId = $this->session->get('sessionId'); + $sessionId = $this->requestStack->getSession()->get('sessionId'); return self::PAYLA_PARTNER_ID . '_' . $this->getPartnerMerchantId($salesChannelContext) . '_' . $sessionId; } diff --git a/src/Components/DeviceFingerprint/RatepayDeviceFingerprintService.php b/src/Components/DeviceFingerprint/RatepayDeviceFingerprintService.php index 1bd31df2f..19761eb92 100644 --- a/src/Components/DeviceFingerprint/RatepayDeviceFingerprintService.php +++ b/src/Components/DeviceFingerprint/RatepayDeviceFingerprintService.php @@ -10,7 +10,7 @@ use PayonePayment\PaymentHandler\PayoneRatepayInstallmentPaymentHandler; use PayonePayment\PaymentHandler\PayoneRatepayInvoicingPaymentHandler; use Shopware\Core\System\SalesChannel\SalesChannelContext; -use Symfony\Component\HttpFoundation\Session\SessionInterface; +use Symfony\Component\HttpFoundation\RequestStack; class RatepayDeviceFingerprintService extends AbstractDeviceFingerprintService { @@ -18,9 +18,9 @@ class RatepayDeviceFingerprintService extends AbstractDeviceFingerprintService protected ConfigReaderInterface $configReader; - public function __construct(SessionInterface $session, ConfigReaderInterface $configReader) + public function __construct(RequestStack $requestStack, ConfigReaderInterface $configReader) { - parent::__construct($session); + parent::__construct($requestStack); $this->configReader = $configReader; } @@ -65,7 +65,7 @@ protected function getSessionVarName(): string protected function buildDeviceIdentToken(SalesChannelContext $salesChannelContext): string { - $sessionId = $this->session->get('sessionId'); + $sessionId = $this->requestStack->getSession()->get('sessionId'); return md5($sessionId . '_' . microtime()); } diff --git a/src/Components/Document/InvoiceGenerator.php b/src/Components/Document/InvoiceGenerator.php deleted file mode 100644 index 12084764f..000000000 --- a/src/Components/Document/InvoiceGenerator.php +++ /dev/null @@ -1,91 +0,0 @@ -decoratedService = $decoratedService; - $this->configReader = $configReader; - } - - /** - * {@inheritdoc} - */ - public function supports(): string - { - return $this->decoratedService->supports(); - } - - /** - * {@inheritdoc} - */ - public function generate( - OrderEntity $order, - DocumentConfiguration $config, - Context $context, - ?string $templatePath = null - ): string { - if ($this->isPayoneInstallmentPaymentMethod($order)) { - $this->addInvoiceDocumentExtension($order); - } - - return $this->decoratedService->generate($order, $config, $context, $templatePath); - } - - /** - * {@inheritdoc} - */ - public function getFileName(DocumentConfiguration $config): string - { - return $this->decoratedService->getFileName($config); - } - - private function isPayoneInstallmentPaymentMethod(OrderEntity $order): bool - { - if ($order->getTransactions() !== null) { - foreach ($order->getTransactions() as $transaction) { - if ($transaction->getPaymentMethodId() === PayonePayolutionInvoicing::UUID) { - return true; - } - } - } - - return false; - } - - private function addInvoiceDocumentExtension(OrderEntity $order): void - { - $configuration = $this->configReader->read($order->getSalesChannelId()); - - $iban = $configuration->get('payolutionInvoicingIban'); - $bic = $configuration->get('payolutionInvoicingBic'); - - if (empty($iban) || empty($bic)) { - return; - } - - $extension = new InvoiceDocumentData(); - $extension->assign([ - 'iban' => $iban, - 'bic' => $bic, - ]); - - $order->addExtension(InvoiceDocumentData::EXTENSION_NAME, $extension); - } -} diff --git a/src/Components/Helper/OrderFetcher.php b/src/Components/Helper/OrderFetcher.php index 8bff6e461..2874d7753 100644 --- a/src/Components/Helper/OrderFetcher.php +++ b/src/Components/Helper/OrderFetcher.php @@ -7,7 +7,7 @@ use Shopware\Core\Checkout\Order\Aggregate\OrderAddress\OrderAddressEntity; use Shopware\Core\Checkout\Order\OrderEntity; use Shopware\Core\Framework\Context; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter; use Shopware\Core\Framework\DataAbstractionLayer\Search\Sorting\FieldSorting; @@ -15,9 +15,9 @@ class OrderFetcher implements OrderFetcherInterface { - private EntityRepositoryInterface $orderRepository; + private EntityRepository $orderRepository; - public function __construct(EntityRepositoryInterface $orderRepository) + public function __construct(EntityRepository $orderRepository) { $this->orderRepository = $orderRepository; } diff --git a/src/Components/Hydrator/LineItemHydrator/LineItemHydrator.php b/src/Components/Hydrator/LineItemHydrator/LineItemHydrator.php index b4e31120a..4f132b1e4 100644 --- a/src/Components/Hydrator/LineItemHydrator/LineItemHydrator.php +++ b/src/Components/Hydrator/LineItemHydrator/LineItemHydrator.php @@ -17,7 +17,7 @@ use Shopware\Core\Checkout\Promotion\Cart\PromotionProcessor; use Shopware\Core\Checkout\Shipping\ShippingMethodEntity; use Shopware\Core\Framework\Context; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; use Shopware\Core\System\Currency\CurrencyEntity; use Shopware\Core\System\SalesChannel\SalesChannelContext; @@ -42,9 +42,9 @@ class LineItemHydrator implements LineItemHydratorInterface private CurrencyPrecisionInterface $currencyPrecision; - private EntityRepositoryInterface $shipmentRepository; + private EntityRepository $shipmentRepository; - public function __construct(CurrencyPrecisionInterface $currencyPrecision, EntityRepositoryInterface $shipmentRepository) + public function __construct(CurrencyPrecisionInterface $currencyPrecision, EntityRepository $shipmentRepository) { $this->currencyPrecision = $currencyPrecision; $this->shipmentRepository = $shipmentRepository; diff --git a/src/Components/MandateService/MandateService.php b/src/Components/MandateService/MandateService.php index 38d9a3d35..c96d82a51 100644 --- a/src/Components/MandateService/MandateService.php +++ b/src/Components/MandateService/MandateService.php @@ -11,7 +11,7 @@ use PayonePayment\Payone\RequestParameter\Struct\GetFileStruct; use Shopware\Core\Checkout\Customer\CustomerEntity; use Shopware\Core\Framework\Context; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; use Shopware\Core\Framework\DataAbstractionLayer\Search\EntitySearchResult; use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter; @@ -21,14 +21,14 @@ class MandateService implements MandateServiceInterface { - private EntityRepositoryInterface $mandateRepository; + private EntityRepository $mandateRepository; private PayoneClientInterface $client; private RequestParameterFactory $requestFactory; public function __construct( - EntityRepositoryInterface $mandateRepository, + EntityRepository $mandateRepository, PayoneClientInterface $client, RequestParameterFactory $requestFactory ) { diff --git a/src/Components/PaymentFilter/FilteredPaymentMethodRoute.php b/src/Components/PaymentFilter/FilteredPaymentMethodRoute.php index 4af13fd8c..18c50e33d 100644 --- a/src/Components/PaymentFilter/FilteredPaymentMethodRoute.php +++ b/src/Components/PaymentFilter/FilteredPaymentMethodRoute.php @@ -7,7 +7,6 @@ use Shopware\Core\Checkout\Payment\SalesChannel\AbstractPaymentMethodRoute; use Shopware\Core\Checkout\Payment\SalesChannel\PaymentMethodRouteResponse; use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; -use Shopware\Core\Framework\Routing\Annotation\RouteScope; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; @@ -15,7 +14,6 @@ /** * @Route(defaults={"_routeScope"={"store-api"}}) - * @RouteScope(scopes={"store-api"}) */ class FilteredPaymentMethodRoute extends AbstractPaymentMethodRoute { diff --git a/src/Components/RedirectHandler/RedirectHandler.php b/src/Components/RedirectHandler/RedirectHandler.php index 3836473d5..4115c27d8 100644 --- a/src/Components/RedirectHandler/RedirectHandler.php +++ b/src/Components/RedirectHandler/RedirectHandler.php @@ -51,6 +51,7 @@ public function decode(string $hash): string { $query = 'SELECT url FROM payone_payment_redirect WHERE hash = ?'; + /** @phpstan-ignore-next-line */ if (method_exists($this->connection, 'fetchOne')) { $url = $this->connection->fetchOne($query, [$hash]); } elseif (method_exists($this->connection, 'fetchColumn')) { diff --git a/src/Components/TransactionHandler/AbstractTransactionHandler.php b/src/Components/TransactionHandler/AbstractTransactionHandler.php index 849098c74..d9b6484b2 100644 --- a/src/Components/TransactionHandler/AbstractTransactionHandler.php +++ b/src/Components/TransactionHandler/AbstractTransactionHandler.php @@ -14,7 +14,7 @@ use Shopware\Core\Checkout\Order\Aggregate\OrderTransaction\OrderTransactionEntity; use Shopware\Core\Checkout\Payment\PaymentMethodEntity; use Shopware\Core\Framework\Context; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\ParameterBag; @@ -22,7 +22,7 @@ abstract class AbstractTransactionHandler { - protected EntityRepositoryInterface $lineItemRepository; + protected EntityRepository $lineItemRepository; protected RequestParameterFactory $requestFactory; @@ -30,7 +30,7 @@ abstract class AbstractTransactionHandler protected TransactionDataHandlerInterface $dataHandler; - protected EntityRepositoryInterface $transactionRepository; + protected EntityRepository $transactionRepository; protected Context $context; diff --git a/src/Components/TransactionHandler/Capture/CaptureTransactionHandler.php b/src/Components/TransactionHandler/Capture/CaptureTransactionHandler.php index a2ac2871b..20a29b3ce 100644 --- a/src/Components/TransactionHandler/Capture/CaptureTransactionHandler.php +++ b/src/Components/TransactionHandler/Capture/CaptureTransactionHandler.php @@ -16,7 +16,7 @@ use PayonePayment\Payone\RequestParameter\RequestParameterFactory; use Shopware\Core\Checkout\Order\Aggregate\OrderTransaction\OrderTransactionEntity; use Shopware\Core\Framework\Context; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\System\StateMachine\Aggregation\StateMachineTransition\StateMachineTransitionActions; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\ParameterBag; @@ -30,8 +30,8 @@ public function __construct( PayoneClientInterface $client, TransactionDataHandlerInterface $dataHandler, TransactionStatusServiceInterface $transactionStatusService, - EntityRepositoryInterface $transactionRepository, - EntityRepositoryInterface $lineItemRepository, + EntityRepository $transactionRepository, + EntityRepository $lineItemRepository, CurrencyPrecisionInterface $currencyPrecision ) { $this->requestFactory = $requestFactory; diff --git a/src/Components/TransactionHandler/Refund/RefundTransactionHandler.php b/src/Components/TransactionHandler/Refund/RefundTransactionHandler.php index a89e3185c..20ffd40f8 100644 --- a/src/Components/TransactionHandler/Refund/RefundTransactionHandler.php +++ b/src/Components/TransactionHandler/Refund/RefundTransactionHandler.php @@ -16,7 +16,7 @@ use PayonePayment\Payone\RequestParameter\RequestParameterFactory; use Shopware\Core\Checkout\Order\Aggregate\OrderTransaction\OrderTransactionEntity; use Shopware\Core\Framework\Context; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\System\StateMachine\Aggregation\StateMachineTransition\StateMachineTransitionActions; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\ParameterBag; @@ -30,8 +30,8 @@ public function __construct( PayoneClientInterface $client, TransactionDataHandlerInterface $dataHandler, TransactionStatusServiceInterface $transactionStatusService, - EntityRepositoryInterface $transactionRepository, - EntityRepositoryInterface $lineItemRepository, + EntityRepository $transactionRepository, + EntityRepository $lineItemRepository, CurrencyPrecisionInterface $currencyPrecision ) { $this->requestFactory = $requestFactory; diff --git a/src/Components/TransactionStatus/TransactionStatusService.php b/src/Components/TransactionStatus/TransactionStatusService.php index cfe2ee217..7ee6118e1 100644 --- a/src/Components/TransactionStatus/TransactionStatusService.php +++ b/src/Components/TransactionStatus/TransactionStatusService.php @@ -15,7 +15,7 @@ use Shopware\Core\Checkout\Order\Aggregate\OrderTransaction\OrderTransactionEntity; use Shopware\Core\Checkout\Order\Aggregate\OrderTransaction\OrderTransactionStates; use Shopware\Core\Framework\Context; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; use Shopware\Core\System\Currency\CurrencyEntity; use Shopware\Core\System\SalesChannel\SalesChannelContext; @@ -55,7 +55,7 @@ class TransactionStatusService implements TransactionStatusServiceInterface private ConfigReaderInterface $configReader; - private EntityRepositoryInterface $transactionRepository; + private EntityRepository $transactionRepository; private LoggerInterface $logger; @@ -64,7 +64,7 @@ class TransactionStatusService implements TransactionStatusServiceInterface public function __construct( StateMachineRegistry $stateMachineRegistry, ConfigReaderInterface $configReader, - EntityRepositoryInterface $transactionRepository, + EntityRepository $transactionRepository, LoggerInterface $logger, CurrencyPrecisionInterface $currencyPrecision ) { diff --git a/src/Components/Validator/BirthdayValidator.php b/src/Components/Validator/BirthdayValidator.php index 69242d742..878fbbd07 100644 --- a/src/Components/Validator/BirthdayValidator.php +++ b/src/Components/Validator/BirthdayValidator.php @@ -28,7 +28,7 @@ protected function compareValues($value1, $value2): bool /** * {@inheritdoc} */ - protected function getErrorCode() + protected function getErrorCode(): ?string { return Birthday::TOO_HIGH_ERROR; } diff --git a/src/Components/Validator/PaymentMethodValidator.php b/src/Components/Validator/PaymentMethodValidator.php index 03cb909d8..f0afc59e9 100644 --- a/src/Components/Validator/PaymentMethodValidator.php +++ b/src/Components/Validator/PaymentMethodValidator.php @@ -9,6 +9,9 @@ class PaymentMethodValidator extends AbstractComparisonValidator { /** + * @param mixed $value1 + * @param mixed $value2 + * * @return bool always fails as the check is done inside a subscriber */ protected function compareValues($value1, $value2): bool @@ -19,7 +22,7 @@ protected function compareValues($value1, $value2): bool /** * {@inheritdoc} */ - protected function getErrorCode() + protected function getErrorCode(): ?string { return PaymentMethod::INVALID_ERROR; } diff --git a/src/Controller/CaptureController.php b/src/Controller/CaptureController.php index fbf34e577..a06bf78f3 100644 --- a/src/Controller/CaptureController.php +++ b/src/Controller/CaptureController.php @@ -6,7 +6,6 @@ use PayonePayment\Components\TransactionHandler\Capture\CaptureTransactionHandlerInterface; use Shopware\Core\Framework\Context; -use Shopware\Core\Framework\Routing\Annotation\RouteScope; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; @@ -23,9 +22,8 @@ public function __construct(CaptureTransactionHandlerInterface $captureHandler) } /** - * @RouteScope(scopes={"api"}) - * @Route("/api/_action/payone/capture-payment", name="api.action.payone.capture_payment", methods={"POST"}) - * @Route("/api/v{version}/_action/payone/capture-payment", name="api.action.payone.capture_payment.legacy", methods={"POST"}) + * @Route("/api/_action/payone/capture-payment", name="api.action.payone.capture_payment", methods={"POST"}, defaults={"_routeScope"={"api"}}) + * @Route("/api/v{version}/_action/payone/capture-payment", name="api.action.payone.capture_payment.legacy", methods={"POST"}, defaults={"_routeScope"={"api"}}) */ public function captureAction(Request $request, Context $context): JsonResponse { diff --git a/src/Controller/RedirectController.php b/src/Controller/RedirectController.php index 96caf0085..e81e7e19a 100644 --- a/src/Controller/RedirectController.php +++ b/src/Controller/RedirectController.php @@ -5,7 +5,6 @@ namespace PayonePayment\Controller; use PayonePayment\Components\RedirectHandler\RedirectHandler; -use Shopware\Core\Framework\Routing\Annotation\RouteScope; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -22,8 +21,7 @@ public function __construct(RedirectHandler $redirectHandler) } /** - * @RouteScope(scopes={"storefront"}) - * @Route("/payone/redirect", name="payment.payone_redirect", defaults={"csrf_protected": false}) + * @Route("/payone/redirect", name="payment.payone_redirect", defaults={"csrf_protected": false, "_routeScope"={"storefront"}}) */ public function execute(Request $request): Response { diff --git a/src/Controller/RefundController.php b/src/Controller/RefundController.php index 58f25d024..90fc9f02e 100644 --- a/src/Controller/RefundController.php +++ b/src/Controller/RefundController.php @@ -6,7 +6,6 @@ use PayonePayment\Components\TransactionHandler\Refund\RefundTransactionHandlerInterface; use Shopware\Core\Framework\Context; -use Shopware\Core\Framework\Routing\Annotation\RouteScope; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; @@ -23,9 +22,8 @@ public function __construct(RefundTransactionHandlerInterface $refundHandler) } /** - * @RouteScope(scopes={"api"}) - * @Route("/api/_action/payone/refund-payment", name="api.action.payone.refund_payment", methods={"POST"}) - * @Route("/api/v{version}/_action/payone/refund-payment", name="api.action.payone.refund_payment.legacy", methods={"POST"}) + * @Route("/api/_action/payone/refund-payment", name="api.action.payone.refund_payment", methods={"POST"}, defaults={"_routeScope"={"api"}}) + * @Route("/api/v{version}/_action/payone/refund-payment", name="api.action.payone.refund_payment.legacy", methods={"POST"}, defaults={"_routeScope"={"api"}}) */ public function refundAction(Request $request, Context $context): JsonResponse { diff --git a/src/Controller/SettingsController.php b/src/Controller/SettingsController.php index c04e3b84d..4bba9e109 100644 --- a/src/Controller/SettingsController.php +++ b/src/Controller/SettingsController.php @@ -15,11 +15,10 @@ use Psr\Log\LoggerInterface; use Shopware\Core\Checkout\Payment\PaymentMethodEntity; use Shopware\Core\Framework\Context; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter; use Shopware\Core\Framework\DataAbstractionLayer\Search\Grouping\FieldGrouping; -use Shopware\Core\Framework\Routing\Annotation\RouteScope; use Shopware\Core\System\StateMachine\Aggregation\StateMachineTransition\StateMachineTransitionEntity; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\JsonResponse; @@ -34,43 +33,43 @@ class SettingsController extends AbstractController private RequestParameterFactory $requestFactory; - private EntityRepositoryInterface $stateMachineTransitionRepository; + private EntityRepository $stateMachineTransitionRepository; private LoggerInterface $logger; private string $kernelDirectory; + private EntityRepository $paymentMethodRepository; + public function __construct( PayoneClientInterface $client, RequestParameterFactory $requestFactory, - EntityRepositoryInterface $stateMachineTransitionRepository, + EntityRepository $stateMachineTransitionRepository, LoggerInterface $logger, - string $kernelDirectory + string $kernelDirectory, + EntityRepository $paymentMethodRepository ) { $this->client = $client; $this->requestFactory = $requestFactory; $this->stateMachineTransitionRepository = $stateMachineTransitionRepository; $this->logger = $logger; $this->kernelDirectory = $kernelDirectory; + $this->paymentMethodRepository = $paymentMethodRepository; } /** - * @RouteScope(scopes={"api"}) - * @Route("/api/_action/payone_payment/validate-api-credentials", name="api.action.payone_payment.validate.api.credentials", methods={"POST"}) - * @Route("/api/v{version}/_action/payone_payment/validate-api-credentials", name="api.action.payone_payment.validate.api.credentials.legacy", methods={"POST"}) + * @Route("/api/_action/payone_payment/validate-api-credentials", name="api.action.payone_payment.validate.api.credentials", methods={"POST"}, defaults={"_routeScope"={"api"}}) + * @Route("/api/v{version}/_action/payone_payment/validate-api-credentials", name="api.action.payone_payment.validate.api.credentials.legacy", methods={"POST"}, defaults={"_routeScope"={"api"}}) */ public function validateApiCredentials(Request $request, Context $context): JsonResponse { $testCount = 0; $errors = []; - /** @var EntityRepositoryInterface $paymentMethodRepository */ - $paymentMethodRepository = $this->get('payment_method.repository'); - foreach (ConfigurationPrefixes::CONFIGURATION_PREFIXES as $paymentClass => $configurationPrefix) { /** @var PaymentMethodEntity|null $paymentMethod */ $criteria = (new Criteria())->addFilter(new EqualsFilter('handlerIdentifier', $paymentClass)); - $paymentMethod = $paymentMethodRepository->search($criteria, $context)->first(); + $paymentMethod = $this->paymentMethodRepository->search($criteria, $context)->first(); if (!$paymentMethod || !$paymentMethod->getActive() || \in_array($paymentMethod->getHandlerIdentifier(), Handler\PaymentHandlerGroups::RATEPAY, true)) { continue; @@ -103,9 +102,8 @@ public function validateApiCredentials(Request $request, Context $context): Json } /** - * @RouteScope(scopes={"api"}) - * @Route("/api/_action/payone_payment/get-state-machine-transition-actions", name="api.action.payone_payment.get.state_machine_transition.actions", methods={"GET"}) - * @Route("/api/v{version}/_action/payone_payment/get-state-machine-transition-actions", name="api.action.payone_payment.get.state_machine_transition.actions.legacy", methods={"GET"}) + * @Route("/api/_action/payone_payment/get-state-machine-transition-actions", name="api.action.payone_payment.get.state_machine_transition.actions", methods={"GET"}, defaults={"_routeScope"={"api"}}) + * @Route("/api/v{version}/_action/payone_payment/get-state-machine-transition-actions", name="api.action.payone_payment.get.state_machine_transition.actions.legacy", methods={"GET"}, defaults={"_routeScope"={"api"}}) */ public function getStateMachineTransitionActions(Request $request, Context $context): JsonResponse { @@ -131,9 +129,8 @@ public function getStateMachineTransitionActions(Request $request, Context $cont } /** - * @RouteScope(scopes={"api"}) - * @Route("/api/_action/payone_payment/check-apple-pay-cert", name="api.action.payone_payment.check.apple_pay_cert", methods={"GET"}) - * @Route("/api/v{version}/_action/payone_payment/check-apple-pay-cert", name="api.action.payone_payment.check.apple_pay_cert.legacy", methods={"GET"}) + * @Route("/api/_action/payone_payment/check-apple-pay-cert", name="api.action.payone_payment.check.apple_pay_cert", methods={"GET"}, defaults={"_routeScope"={"api"}}) + * @Route("/api/v{version}/_action/payone_payment/check-apple-pay-cert", name="api.action.payone_payment.check.apple_pay_cert.legacy", methods={"GET"}, defaults={"_routeScope"={"api"}}) */ public function checkApplePayCert(): JsonResponse { diff --git a/src/Controller/WebhookController.php b/src/Controller/WebhookController.php index e382f1b57..fda372596 100644 --- a/src/Controller/WebhookController.php +++ b/src/Controller/WebhookController.php @@ -7,8 +7,7 @@ use PayonePayment\Payone\Webhook\MessageBus\Command\NotificationForwardCommand; use PayonePayment\Payone\Webhook\Processor\WebhookProcessorInterface; use Shopware\Core\Framework\Context; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; -use Shopware\Core\Framework\Routing\Annotation\RouteScope; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Uuid\Uuid; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Shopware\Storefront\Controller\StorefrontController; @@ -21,13 +20,13 @@ class WebhookController extends StorefrontController { private WebhookProcessorInterface $webhookProcessor; - private EntityRepositoryInterface $notificationForwardRepository; + private EntityRepository $notificationForwardRepository; private MessageBusInterface $messageBus; public function __construct( WebhookProcessorInterface $webhookProcessor, - EntityRepositoryInterface $notificationForwardRepository, + EntityRepository $notificationForwardRepository, MessageBusInterface $messageBus ) { $this->webhookProcessor = $webhookProcessor; @@ -36,8 +35,7 @@ public function __construct( } /** - * @RouteScope(scopes={"storefront"}) - * @Route("/payone/webhook", name="payone_webhook", defaults={"csrf_protected": false}, methods={"POST"}) + * @Route("/payone/webhook", name="payone_webhook", defaults={"csrf_protected": false, "_routeScope"={"storefront"}}, methods={"POST"}) */ public function execute(Request $request, SalesChannelContext $salesChannelContext): Response { @@ -45,9 +43,8 @@ public function execute(Request $request, SalesChannelContext $salesChannelConte } /** - * @RouteScope(scopes={"api"}) - * @Route("/api/_action/payone/requeue-forward", name="api.action.payone.requeue.forward", methods={"POST"}) - * @Route("/api/v{version}/_action/payone/requeue-forward", name="api.action.payone.requeue.forward.legacy", methods={"POST"}) + * @Route("/api/_action/payone/requeue-forward", name="api.action.payone.requeue.forward", methods={"POST"}, defaults={"_routeScope"={"api"}}) + * @Route("/api/v{version}/_action/payone/requeue-forward", name="api.action.payone.requeue.forward.legacy", methods={"POST"}, defaults={"_routeScope"={"api"}}) */ public function reQueueForward(Request $request, Context $context): Response { diff --git a/src/DependencyInjection/controllers.xml b/src/DependencyInjection/controllers.xml index c9bc2023e..0f52ff922 100644 --- a/src/DependencyInjection/controllers.xml +++ b/src/DependencyInjection/controllers.xml @@ -42,6 +42,7 @@ %kernel.project_dir% + diff --git a/src/DependencyInjection/decorations.xml b/src/DependencyInjection/decorations.xml deleted file mode 100644 index cb94706df..000000000 --- a/src/DependencyInjection/decorations.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - diff --git a/src/DependencyInjection/device_fingerprint.xml b/src/DependencyInjection/device_fingerprint.xml index 33c097abf..2c8aee0c6 100644 --- a/src/DependencyInjection/device_fingerprint.xml +++ b/src/DependencyInjection/device_fingerprint.xml @@ -13,13 +13,13 @@ - + - + diff --git a/src/DependencyInjection/listeners.xml b/src/DependencyInjection/listeners.xml index 5cf3be59f..42249a358 100644 --- a/src/DependencyInjection/listeners.xml +++ b/src/DependencyInjection/listeners.xml @@ -7,6 +7,7 @@ + @@ -104,7 +105,8 @@ - + + diff --git a/src/DependencyInjection/services.xml b/src/DependencyInjection/services.xml index 58bfdc52e..6a5a5b1b3 100644 --- a/src/DependencyInjection/services.xml +++ b/src/DependencyInjection/services.xml @@ -6,7 +6,6 @@ - @@ -72,6 +71,7 @@ + diff --git a/src/EventListener/CheckoutConfirmCartDataEventListener.php b/src/EventListener/CheckoutConfirmCartDataEventListener.php index 7b431ddbb..d2f87fec6 100644 --- a/src/EventListener/CheckoutConfirmCartDataEventListener.php +++ b/src/EventListener/CheckoutConfirmCartDataEventListener.php @@ -4,6 +4,7 @@ namespace PayonePayment\EventListener; +use PayonePayment\Components\Currency\CurrencyPrecisionInterface; use PayonePayment\Components\Helper\OrderFetcherInterface; use PayonePayment\Installer\PaymentMethodInstaller; use PayonePayment\Storefront\Struct\CheckoutCartPaymentData; @@ -29,12 +30,16 @@ class CheckoutConfirmCartDataEventListener implements EventSubscriberInterface private OrderFetcherInterface $orderFetcher; + private CurrencyPrecisionInterface $currencyPrecision; + public function __construct( OrderConverter $orderConverter, - OrderFetcherInterface $orderFetcher + OrderFetcherInterface $orderFetcher, + CurrencyPrecisionInterface $currencyPrecision ) { $this->orderConverter = $orderConverter; $this->orderFetcher = $orderFetcher; + $this->currencyPrecision = $currencyPrecision; } public static function getSubscribedEvents(): array @@ -75,9 +80,9 @@ public function addCartData(PageLoadedEvent $event): void 'workOrderId' => $extension->getWorkorderId(), 'cartHash' => $extension->getCartHash(), ]); - } - $page->addExtension(CheckoutConfirmPaymentData::EXTENSION_NAME, $payoneData); + $page->addExtension(CheckoutConfirmPaymentData::EXTENSION_NAME, $payoneData); + } } /** @@ -85,7 +90,7 @@ public function addCartData(PageLoadedEvent $event): void */ private function hidePayonePaymentMethodsOnZeroAmountCart(Page $page, Cart $cart, SalesChannelContext $salesChannelContext): void { - $totalAmount = (int) round($cart->getPrice()->getTotalPrice() * (10 ** $salesChannelContext->getCurrency()->getDecimalPrecision())); + $totalAmount = $this->currencyPrecision->getRoundedItemAmount($cart->getPrice()->getTotalPrice(), $salesChannelContext->getCurrency()); if ($totalAmount > 0) { return; diff --git a/src/EventListener/CheckoutConfirmCreditCardEventListener.php b/src/EventListener/CheckoutConfirmCreditCardEventListener.php index c4a13e16f..458a90c68 100644 --- a/src/EventListener/CheckoutConfirmCreditCardEventListener.php +++ b/src/EventListener/CheckoutConfirmCreditCardEventListener.php @@ -12,7 +12,7 @@ use PayonePayment\Storefront\Struct\CheckoutCartPaymentData; use PayonePayment\Storefront\Struct\CheckoutConfirmPaymentData; use Shopware\Core\Framework\Context; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; use Shopware\Core\System\Language\LanguageEntity; use Shopware\Storefront\Page\Account\Order\AccountEditOrderPageLoadedEvent; @@ -24,13 +24,13 @@ class CheckoutConfirmCreditCardEventListener implements EventSubscriberInterface { private RequestParameterFactory $requestParameterFactory; - private EntityRepositoryInterface $languageRepository; + private EntityRepository $languageRepository; private AbstractCardRoute $cardRoute; public function __construct( RequestParameterFactory $requestParameterFactory, - EntityRepositoryInterface $languageRepository, + EntityRepository $languageRepository, AbstractCardRoute $cardRoute ) { $this->requestParameterFactory = $requestParameterFactory; @@ -80,9 +80,9 @@ public function addPayonePageData(PageLoadedEvent $event): void 'language' => $language, 'savedCards' => !empty($savedCards) ? $savedCards : null, ]); - } - $page->addExtension(CheckoutConfirmPaymentData::EXTENSION_NAME, $payoneData); + $page->addExtension(CheckoutConfirmPaymentData::EXTENSION_NAME, $payoneData); + } } private function getCustomerLanguage(Context $context): string diff --git a/src/EventListener/CheckoutConfirmDebitEventListener.php b/src/EventListener/CheckoutConfirmDebitEventListener.php index 1e51e620e..7827dbe7a 100644 --- a/src/EventListener/CheckoutConfirmDebitEventListener.php +++ b/src/EventListener/CheckoutConfirmDebitEventListener.php @@ -53,8 +53,8 @@ public function addPayonePageData(PageLoadedEvent $event): void $payoneData->assign([ 'savedMandates' => $savedMandates, ]); - } - $page->addExtension(CheckoutConfirmPaymentData::EXTENSION_NAME, $payoneData); + $page->addExtension(CheckoutConfirmPaymentData::EXTENSION_NAME, $payoneData); + } } } diff --git a/src/EventListener/CheckoutConfirmTemplateEventListener.php b/src/EventListener/CheckoutConfirmTemplateEventListener.php index 261f35f97..0bbb5eb53 100644 --- a/src/EventListener/CheckoutConfirmTemplateEventListener.php +++ b/src/EventListener/CheckoutConfirmTemplateEventListener.php @@ -44,9 +44,9 @@ public function addPayonePageData(PageLoadedEvent $event): void $payoneData->assign([ 'template' => $template, ]); - } - $page->addExtension(CheckoutConfirmPaymentData::EXTENSION_NAME, $payoneData); + $page->addExtension(CheckoutConfirmPaymentData::EXTENSION_NAME, $payoneData); + } } private function getTemplateFromPaymentMethod(PaymentMethodEntity $paymentMethod): ?string diff --git a/src/EventListener/CheckoutFinishEventListener.php b/src/EventListener/CheckoutFinishEventListener.php index 908db773f..8da20974f 100644 --- a/src/EventListener/CheckoutFinishEventListener.php +++ b/src/EventListener/CheckoutFinishEventListener.php @@ -13,7 +13,7 @@ use Shopware\Core\Checkout\Order\OrderEntity; use Shopware\Core\Checkout\Payment\PaymentMethodEntity; use Shopware\Core\Framework\Context; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter; use Shopware\Storefront\Page\Checkout\Finish\CheckoutFinishPageLoadedEvent; @@ -21,13 +21,13 @@ class CheckoutFinishEventListener implements EventSubscriberInterface { - private EntityRepositoryInterface $mandateRepository; + private EntityRepository $mandateRepository; - private EntityRepositoryInterface $orderTransactionRepository; + private EntityRepository $orderTransactionRepository; public function __construct( - EntityRepositoryInterface $mandateRepository, - EntityRepositoryInterface $orderTransactionRepository + EntityRepository $mandateRepository, + EntityRepository $orderTransactionRepository ) { $this->mandateRepository = $mandateRepository; $this->orderTransactionRepository = $orderTransactionRepository; @@ -94,9 +94,9 @@ private function getMandateIdentification(OrderEntity $order, Context $context): $criteria = new Criteria(); $criteria->addFilter(new EqualsFilter('orderId', $order->getId())); - /** @var OrderTransactionEntity[] $transactions */ $transactions = $this->orderTransactionRepository->search($criteria, $context); + /** @var OrderTransactionEntity $transaction */ foreach ($transactions as $transaction) { /** @var PayonePaymentOrderTransactionDataEntity|null $payoneTransactionData */ $payoneTransactionData = $transaction->getExtension(PayonePaymentOrderTransactionExtension::NAME); diff --git a/src/EventListener/DocumentOrderEventListener.php b/src/EventListener/DocumentOrderEventListener.php deleted file mode 100644 index 4dbde65fa..000000000 --- a/src/EventListener/DocumentOrderEventListener.php +++ /dev/null @@ -1,25 +0,0 @@ - 'addPayonePaymentTransactionDataExtensionAssociation', - ]; - } - - public function addPayonePaymentTransactionDataExtensionAssociation(DocumentOrderCriteriaEvent $event): void - { - $criteria = $event->getCriteria(); - $criteria->addAssociation('transactions.' . PayonePaymentOrderTransactionExtension::NAME); - } -} diff --git a/src/EventListener/InvoiceRendererEventListener.php b/src/EventListener/InvoiceRendererEventListener.php new file mode 100644 index 000000000..3d854fe62 --- /dev/null +++ b/src/EventListener/InvoiceRendererEventListener.php @@ -0,0 +1,74 @@ +configReader = $configReader; + } + + public static function getSubscribedEvents(): array + { + return [ + InvoiceOrdersEvent::class => 'onInvoiceOrdersLoaded', + ]; + } + + public function onInvoiceOrdersLoaded(InvoiceOrdersEvent $event): void + { + $orders = $event->getOrders(); + + foreach ($orders as $order) { + if ($this->hasPayolutionInvoicingTransaction($order)) { + // ToDo 6.5: Write tests so that we can check if it is working in both versions + $this->addInvoiceDocumentExtension($order); + } + } + } + + private function hasPayolutionInvoicingTransaction(OrderEntity $order): bool + { + if ($order->getTransactions()) { + foreach ($order->getTransactions() as $transaction) { + if ($transaction->getPaymentMethodId() === PayonePayolutionInvoicing::UUID) { + return true; + } + } + } + + return false; + } + + private function addInvoiceDocumentExtension(OrderEntity $order): void + { + $configuration = $this->configReader->read($order->getSalesChannelId()); + + $iban = $configuration->get('payolutionInvoicingIban'); + $bic = $configuration->get('payolutionInvoicingBic'); + + if (empty($iban) || empty($bic)) { + return; + } + + $extension = new InvoiceDocumentData(); + $extension->assign([ + 'iban' => $iban, + 'bic' => $bic, + ]); + + $order->addExtension(InvoiceDocumentData::EXTENSION_NAME, $extension); + } +} diff --git a/src/EventListener/OrderValidationEventListener.php b/src/EventListener/OrderValidationEventListener.php index 8f27a071a..acaca8289 100644 --- a/src/EventListener/OrderValidationEventListener.php +++ b/src/EventListener/OrderValidationEventListener.php @@ -42,8 +42,8 @@ public function validateOrderData(BuildValidationEvent $event): void } $salesChannelContext = $this->getSalesChannelContextFromRequest($request); - $paymentHandlerIdentifier = $salesChannelContext->getPaymentMethod()->getHandlerIdentifier(); - $paymentHandler = $this->paymentHandlerRegistry->getHandler($paymentHandlerIdentifier); + $paymentMethodId = $salesChannelContext->getPaymentMethod()->getId(); + $paymentHandler = $this->paymentHandlerRegistry->getPaymentMethodHandler($paymentMethodId); if ($paymentHandler instanceof AbstractPayonePaymentHandler) { $validationDefinitions = $paymentHandler->getValidationDefinitions($salesChannelContext); diff --git a/src/EventListener/StorefrontRenderEventListener.php b/src/EventListener/StorefrontRenderEventListener.php index 1799df9fe..61787e314 100644 --- a/src/EventListener/StorefrontRenderEventListener.php +++ b/src/EventListener/StorefrontRenderEventListener.php @@ -8,13 +8,13 @@ use Psr\Cache\CacheItemPoolInterface; use Shopware\Core\Checkout\Payment\PaymentMethodDefinition; use Shopware\Core\Framework\Context; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\DataAbstractionLayer\Event\EntityWrittenContainerEvent; use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\ContainsFilter; use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter; use Shopware\Core\System\SalesChannel\Aggregate\SalesChannelPaymentMethod\SalesChannelPaymentMethodDefinition; -use Shopware\Core\System\SalesChannel\Entity\SalesChannelRepositoryInterface; +use Shopware\Core\System\SalesChannel\Entity\SalesChannelRepository; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Shopware\Storefront\Event\StorefrontRenderEvent; use Symfony\Component\EventDispatcher\EventSubscriberInterface; @@ -23,14 +23,14 @@ class StorefrontRenderEventListener implements EventSubscriberInterface { private CacheItemPoolInterface $cachePool; - private SalesChannelRepositoryInterface $paymentMethodRepository; + private SalesChannelRepository $paymentMethodRepository; - private EntityRepositoryInterface $salesChannelRepository; + private EntityRepository $salesChannelRepository; public function __construct( CacheItemPoolInterface $cachePool, - SalesChannelRepositoryInterface $repository, - EntityRepositoryInterface $salesChannelRepository + SalesChannelRepository $repository, + EntityRepository $salesChannelRepository ) { $this->cachePool = $cachePool; $this->paymentMethodRepository = $repository; diff --git a/src/Installer/CustomFieldInstaller.php b/src/Installer/CustomFieldInstaller.php index d9f000986..cc887adc6 100644 --- a/src/Installer/CustomFieldInstaller.php +++ b/src/Installer/CustomFieldInstaller.php @@ -5,7 +5,7 @@ namespace PayonePayment\Installer; use Shopware\Core\Framework\Context; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Plugin\Context\ActivateContext; use Shopware\Core\Framework\Plugin\Context\DeactivateContext; use Shopware\Core\Framework\Plugin\Context\InstallContext; @@ -25,15 +25,15 @@ class CustomFieldInstaller implements InstallerInterface public const FIELDSET_ID_PAYMENT_METHOD = 'ed39626e94fd4dfe9d81976fdbcdb06c'; public const FIELDSET_ID_CUSTOMER = '8e4a0b8f7eb04272ad874f3b22cf4935'; - private EntityRepositoryInterface $customFieldRepository; + private EntityRepository $customFieldRepository; - private EntityRepositoryInterface $customFieldSetRepository; + private EntityRepository $customFieldSetRepository; private array $customFields; private array $customFieldSets; - public function __construct(EntityRepositoryInterface $customFieldSetRepository, EntityRepositoryInterface $customFieldRepository) + public function __construct(EntityRepository $customFieldSetRepository, EntityRepository $customFieldRepository) { $this->customFieldSetRepository = $customFieldSetRepository; $this->customFieldRepository = $customFieldRepository; diff --git a/src/Installer/PaymentMethodInstaller.php b/src/Installer/PaymentMethodInstaller.php index 6356c92ec..e8d6deab1 100644 --- a/src/Installer/PaymentMethodInstaller.php +++ b/src/Installer/PaymentMethodInstaller.php @@ -40,7 +40,7 @@ use PayonePayment\PayonePayment; use Shopware\Core\Checkout\Payment\PaymentMethodEntity; use Shopware\Core\Framework\Context; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter; use Shopware\Core\Framework\Plugin\Context\ActivateContext; @@ -148,19 +148,19 @@ class PaymentMethodInstaller implements InstallerInterface private PluginIdProvider $pluginIdProvider; - private EntityRepositoryInterface $paymentMethodRepository; + private EntityRepository $paymentMethodRepository; - private EntityRepositoryInterface $salesChannelRepository; + private EntityRepository $salesChannelRepository; - private EntityRepositoryInterface $paymentMethodSalesChannelRepository; + private EntityRepository $paymentMethodSalesChannelRepository; private Connection $connection; public function __construct( PluginIdProvider $pluginIdProvider, - EntityRepositoryInterface $paymentMethodRepository, - EntityRepositoryInterface $salesChannelRepository, - EntityRepositoryInterface $paymentMethodSalesChannelRepository, + EntityRepository $paymentMethodRepository, + EntityRepository $salesChannelRepository, + EntityRepository $paymentMethodSalesChannelRepository, Connection $connection ) { $this->pluginIdProvider = $pluginIdProvider; @@ -189,6 +189,7 @@ public function update(UpdateContext $context): void // before any update procedures take place otherwise we would have a duplicate payment method. // This is also the reason why a migration is not a viable way here. if ($this->findPaymentMethodEntity('0b532088e2da3092f9f7054ec4009d18', $context->getContext())) { + /** @phpstan-ignore-next-line */ if (method_exists($this->connection, 'executeStatement')) { $this->connection->executeStatement("UPDATE `payment_method` SET `id` = UNHEX('4e8a9d3d3c6e428887573856b38c9003') WHERE `id` = UNHEX('0b532088e2da3092f9f7054ec4009d18');"); $this->connection->executeStatement("UPDATE `sales_channel` SET `payment_method_ids` = REPLACE(`payment_method_ids`, '0b532088e2da3092f9f7054ec4009d18', '4e8a9d3d3c6e428887573856b38c9003');"); @@ -319,10 +320,6 @@ private function paymentMethodExists(array $data, Context $context): bool $result = $this->paymentMethodRepository->search($criteria, $context); - if ($result->getTotal() === 0) { - return false; - } - - return true; + return $result->getTotal() !== 0; } } diff --git a/src/Installer/RuleInstaller/RuleInstallerSecureInvoice.php b/src/Installer/RuleInstaller/RuleInstallerSecureInvoice.php index 4f0323192..6afb4d3fd 100644 --- a/src/Installer/RuleInstaller/RuleInstallerSecureInvoice.php +++ b/src/Installer/RuleInstaller/RuleInstallerSecureInvoice.php @@ -9,7 +9,7 @@ use Shopware\Core\Checkout\Customer\Rule\BillingCountryRule; use Shopware\Core\Checkout\Customer\Rule\DifferentAddressesRule; use Shopware\Core\Framework\Context; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsAnyFilter; use Shopware\Core\Framework\Plugin\Context\ActivateContext; @@ -39,19 +39,19 @@ class RuleInstallerSecureInvoice implements InstallerInterface private const CONDITION_ID_CURRENCY = '6099e1e292f737aa31c126a73339c92e'; private const CONDITION_ID_DIFFERENT_ADDRESSES = 'f1a5251ffcd09b5dc0befc059dfad9c1'; - private EntityRepositoryInterface $ruleRepository; + private EntityRepository $ruleRepository; - private EntityRepositoryInterface $countryRepository; + private EntityRepository $countryRepository; - private EntityRepositoryInterface $currencyRepository; + private EntityRepository $currencyRepository; - private EntityRepositoryInterface $paymentMethodRepository; + private EntityRepository $paymentMethodRepository; public function __construct( - EntityRepositoryInterface $ruleRepository, - EntityRepositoryInterface $countryRepository, - EntityRepositoryInterface $currencyRepository, - EntityRepositoryInterface $paymentMethodRepository + EntityRepository $ruleRepository, + EntityRepository $countryRepository, + EntityRepository $currencyRepository, + EntityRepository $paymentMethodRepository ) { $this->ruleRepository = $ruleRepository; $this->countryRepository = $countryRepository; diff --git a/src/Migration/Migration1557926559AddTemporaryRedirectTable.php b/src/Migration/Migration1557926559AddTemporaryRedirectTable.php index 4ec595afe..7bdee475a 100644 --- a/src/Migration/Migration1557926559AddTemporaryRedirectTable.php +++ b/src/Migration/Migration1557926559AddTemporaryRedirectTable.php @@ -24,12 +24,14 @@ public function update(Connection $connection): void ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; '; + /** @phpstan-ignore-next-line */ if (method_exists($connection, 'executeStatement')) { $connection->executeStatement($sql); return; } + /** @phpstan-ignore-next-line */ if (method_exists($connection, 'exec')) { /** @noinspection PhpDeprecationInspection */ $connection->exec($sql); diff --git a/src/Migration/Migration1561379069AddPayonePaymentCardTable.php b/src/Migration/Migration1561379069AddPayonePaymentCardTable.php index b9eebd6b7..fada690d4 100644 --- a/src/Migration/Migration1561379069AddPayonePaymentCardTable.php +++ b/src/Migration/Migration1561379069AddPayonePaymentCardTable.php @@ -41,12 +41,14 @@ public function update(Connection $connection): void ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci '; + /** @phpstan-ignore-next-line */ if (method_exists($connection, 'executeStatement')) { $connection->executeStatement($sql); return; } + /** @phpstan-ignore-next-line */ if (method_exists($connection, 'exec')) { /** @noinspection PhpDeprecationInspection */ $connection->exec($sql); diff --git a/src/Migration/Migration1562097986AddPayonePaymentMandateTable.php b/src/Migration/Migration1562097986AddPayonePaymentMandateTable.php index e41881664..bad08a432 100644 --- a/src/Migration/Migration1562097986AddPayonePaymentMandateTable.php +++ b/src/Migration/Migration1562097986AddPayonePaymentMandateTable.php @@ -39,12 +39,14 @@ public function update(Connection $connection): void ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci '; + /** @phpstan-ignore-next-line */ if (method_exists($connection, 'executeStatement')) { $connection->executeStatement($sql); return; } + /** @phpstan-ignore-next-line */ if (method_exists($connection, 'exec')) { /** @noinspection PhpDeprecationInspection */ $connection->exec($sql); diff --git a/src/Migration/Migration1580996279AddRedirectTableCreatedDate.php b/src/Migration/Migration1580996279AddRedirectTableCreatedDate.php index fe28cd5a3..81734517a 100644 --- a/src/Migration/Migration1580996279AddRedirectTableCreatedDate.php +++ b/src/Migration/Migration1580996279AddRedirectTableCreatedDate.php @@ -18,12 +18,14 @@ public function update(Connection $connection): void { $sql = 'ALTER TABLE `payone_payment_redirect` ADD `created_at` datetime(3) NULL;'; + /** @phpstan-ignore-next-line */ if (method_exists($connection, 'executeStatement')) { $connection->executeStatement($sql); return; } + /** @phpstan-ignore-next-line */ if (method_exists($connection, 'exec')) { /** @noinspection PhpDeprecationInspection */ $connection->exec($sql); diff --git a/src/Migration/Migration1625137302AddNotificationForwardTable.php b/src/Migration/Migration1625137302AddNotificationForwardTable.php index 0a39a777f..7e4a36687 100644 --- a/src/Migration/Migration1625137302AddNotificationForwardTable.php +++ b/src/Migration/Migration1625137302AddNotificationForwardTable.php @@ -29,12 +29,14 @@ public function update(Connection $connection): void PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;'; + /** @phpstan-ignore-next-line */ if (method_exists($connection, 'executeStatement')) { $connection->executeStatement($sql); return; } + /** @phpstan-ignore-next-line */ if (method_exists($connection, 'exec')) { /** @noinspection PhpDeprecationInspection */ $connection->exec($sql); diff --git a/src/Migration/Migration1625137302AddNotificationTargetTable.php b/src/Migration/Migration1625137302AddNotificationTargetTable.php index 84baa3e1f..f032aaa9f 100644 --- a/src/Migration/Migration1625137302AddNotificationTargetTable.php +++ b/src/Migration/Migration1625137302AddNotificationTargetTable.php @@ -28,12 +28,14 @@ public function update(Connection $connection): void PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;'; + /** @phpstan-ignore-next-line */ if (method_exists($connection, 'executeStatement')) { $connection->executeStatement($sql); return; } + /** @phpstan-ignore-next-line */ if (method_exists($connection, 'exec')) { /** @noinspection PhpDeprecationInspection */ $connection->exec($sql); diff --git a/src/Migration/Migration1637576753FixForeignKeyConstraints.php b/src/Migration/Migration1637576753FixForeignKeyConstraints.php index f47bfa87c..4d8925433 100644 --- a/src/Migration/Migration1637576753FixForeignKeyConstraints.php +++ b/src/Migration/Migration1637576753FixForeignKeyConstraints.php @@ -18,6 +18,7 @@ public function update(Connection $connection): void { $sql = 'ALTER TABLE payone_payment_card DROP FOREIGN KEY `fk.payone_payment_card.customer_id`;'; + /** @phpstan-ignore-next-line */ if (method_exists($connection, 'executeStatement')) { $connection->executeStatement($sql); } elseif (method_exists($connection, 'exec')) { @@ -29,6 +30,7 @@ public function update(Connection $connection): void $sql = 'ALTER TABLE payone_payment_card ADD CONSTRAINT `fk.payone_payment_card.customer_id` FOREIGN KEY (`customer_id`) REFERENCES `customer` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;'; + /** @phpstan-ignore-next-line */ if (method_exists($connection, 'executeStatement')) { $connection->executeStatement($sql); } elseif (method_exists($connection, 'exec')) { diff --git a/src/Migration/Migration1638289341AddOrderTransActionDataTable.php b/src/Migration/Migration1638289341AddOrderTransActionDataTable.php index 7417dcccf..d6179dfe2 100644 --- a/src/Migration/Migration1638289341AddOrderTransActionDataTable.php +++ b/src/Migration/Migration1638289341AddOrderTransActionDataTable.php @@ -49,6 +49,7 @@ public function update(Connection $connection): void CONSTRAINT `json.payone_payment_order_transaction_data.clearing_bank_account` CHECK (JSON_VALID(`clearing_bank_account`)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;'; + /** @phpstan-ignore-next-line */ if (method_exists($connection, 'executeStatement')) { $connection->executeStatement($sql); } elseif (method_exists($connection, 'exec')) { diff --git a/src/Migration/Migration1639050658MigrateOrderTransactionDataFromCustomFields.php b/src/Migration/Migration1639050658MigrateOrderTransactionDataFromCustomFields.php index 35fbd4cf6..f0b4ab715 100644 --- a/src/Migration/Migration1639050658MigrateOrderTransactionDataFromCustomFields.php +++ b/src/Migration/Migration1639050658MigrateOrderTransactionDataFromCustomFields.php @@ -59,6 +59,7 @@ public function update(Connection $connection): void try { $connection->beginTransaction(); + /** @phpstan-ignore-next-line */ if (method_exists($connection, 'executeStatement')) { $connection->executeStatement($sql); } elseif (method_exists($connection, 'exec')) { @@ -100,6 +101,7 @@ public function update(Connection $connection): void try { $connection->beginTransaction(); + /** @phpstan-ignore-next-line */ if (method_exists($connection, 'executeStatement')) { $connection->executeStatement($sql); } elseif (method_exists($connection, 'exec')) { diff --git a/src/Migration/Migration1666770470AddCardTypeToCardTable.php b/src/Migration/Migration1666770470AddCardTypeToCardTable.php index 801471524..6786c7afc 100644 --- a/src/Migration/Migration1666770470AddCardTypeToCardTable.php +++ b/src/Migration/Migration1666770470AddCardTypeToCardTable.php @@ -18,12 +18,14 @@ public function update(Connection $connection): void { $sql = 'ALTER TABLE `payone_payment_card` ADD `card_type` VARCHAR(255) NOT NULL;'; + /** @phpstan-ignore-next-line */ if (method_exists($connection, 'executeStatement')) { $connection->executeStatement($sql); return; } + /** @phpstan-ignore-next-line */ if (method_exists($connection, 'exec')) { /** @noinspection PhpDeprecationInspection */ $connection->exec($sql); diff --git a/src/PaymentHandler/AbstractPayoneInvoicePaymentHandler.php b/src/PaymentHandler/AbstractPayoneInvoicePaymentHandler.php index 017723af4..d35494290 100644 --- a/src/PaymentHandler/AbstractPayoneInvoicePaymentHandler.php +++ b/src/PaymentHandler/AbstractPayoneInvoicePaymentHandler.php @@ -14,7 +14,7 @@ use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\SynchronousPaymentHandlerInterface; use Shopware\Core\Checkout\Payment\Cart\SyncPaymentTransactionStruct; use Shopware\Core\Checkout\Payment\Exception\SyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Symfony\Component\HttpFoundation\RequestStack; @@ -35,7 +35,7 @@ public function __construct( PayoneClientInterface $client, TranslatorInterface $translator, TransactionDataHandlerInterface $dataHandler, - EntityRepositoryInterface $lineItemRepository, + EntityRepository $lineItemRepository, RequestStack $requestStack, RequestParameterFactory $requestParameterFactory ) { diff --git a/src/PaymentHandler/AbstractPayonePaymentHandler.php b/src/PaymentHandler/AbstractPayonePaymentHandler.php index b1db0b837..e98b72a78 100644 --- a/src/PaymentHandler/AbstractPayonePaymentHandler.php +++ b/src/PaymentHandler/AbstractPayonePaymentHandler.php @@ -9,7 +9,7 @@ use PayonePayment\Installer\CustomFieldInstaller; use Shopware\Core\Checkout\Order\Aggregate\OrderLineItem\OrderLineItemCollection; use Shopware\Core\Framework\Context; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Symfony\Component\HttpFoundation\RequestStack; @@ -41,13 +41,13 @@ abstract class AbstractPayonePaymentHandler implements PayonePaymentHandlerInter protected ConfigReaderInterface $configReader; - protected EntityRepositoryInterface $lineItemRepository; + protected EntityRepository $lineItemRepository; protected RequestStack $requestStack; public function __construct( ConfigReaderInterface $configReader, - EntityRepositoryInterface $lineItemRepository, + EntityRepository $lineItemRepository, RequestStack $requestStack ) { $this->configReader = $configReader; diff --git a/src/PaymentHandler/PayoneAlipayPaymentHandler.php b/src/PaymentHandler/PayoneAlipayPaymentHandler.php index 9079db7ca..45a238507 100644 --- a/src/PaymentHandler/PayoneAlipayPaymentHandler.php +++ b/src/PaymentHandler/PayoneAlipayPaymentHandler.php @@ -16,7 +16,7 @@ use Shopware\Core\Checkout\Payment\Cart\AsyncPaymentTransactionStruct; use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\AsynchronousPaymentHandlerInterface; use Shopware\Core\Checkout\Payment\Exception\AsyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Symfony\Component\HttpFoundation\RedirectResponse; @@ -38,7 +38,7 @@ class PayoneAlipayPaymentHandler extends AbstractPayonePaymentHandler implements public function __construct( ConfigReaderInterface $configReader, - EntityRepositoryInterface $lineItemRepository, + EntityRepository $lineItemRepository, PayoneClientInterface $client, TranslatorInterface $translator, TransactionDataHandlerInterface $dataHandler, diff --git a/src/PaymentHandler/PayoneApplePayPaymentHandler.php b/src/PaymentHandler/PayoneApplePayPaymentHandler.php index 09578ca4f..505884d19 100644 --- a/src/PaymentHandler/PayoneApplePayPaymentHandler.php +++ b/src/PaymentHandler/PayoneApplePayPaymentHandler.php @@ -11,7 +11,7 @@ use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\SynchronousPaymentHandlerInterface; use Shopware\Core\Checkout\Payment\Cart\SyncPaymentTransactionStruct; use Shopware\Core\Checkout\Payment\Exception\SyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Symfony\Component\HttpFoundation\RequestStack; @@ -29,7 +29,7 @@ public function __construct( ConfigReaderInterface $configReader, PayoneClientInterface $client, TranslatorInterface $translator, - EntityRepositoryInterface $lineItemRepository, + EntityRepository $lineItemRepository, RequestStack $requestStack, TransactionDataHandlerInterface $dataHandler ) { diff --git a/src/PaymentHandler/PayoneBancontactPaymentHandler.php b/src/PaymentHandler/PayoneBancontactPaymentHandler.php index 818007898..65c00042f 100644 --- a/src/PaymentHandler/PayoneBancontactPaymentHandler.php +++ b/src/PaymentHandler/PayoneBancontactPaymentHandler.php @@ -16,7 +16,7 @@ use Shopware\Core\Checkout\Payment\Cart\AsyncPaymentTransactionStruct; use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\AsynchronousPaymentHandlerInterface; use Shopware\Core\Checkout\Payment\Exception\AsyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Symfony\Component\HttpFoundation\RedirectResponse; @@ -38,7 +38,7 @@ class PayoneBancontactPaymentHandler extends AbstractPayonePaymentHandler implem public function __construct( ConfigReaderInterface $configReader, - EntityRepositoryInterface $lineItemRepository, + EntityRepository $lineItemRepository, PayoneClientInterface $client, TranslatorInterface $translator, TransactionDataHandlerInterface $dataHandler, diff --git a/src/PaymentHandler/PayoneCreditCardPaymentHandler.php b/src/PaymentHandler/PayoneCreditCardPaymentHandler.php index 429e9651e..0f4adb8a3 100644 --- a/src/PaymentHandler/PayoneCreditCardPaymentHandler.php +++ b/src/PaymentHandler/PayoneCreditCardPaymentHandler.php @@ -17,7 +17,7 @@ use Shopware\Core\Checkout\Payment\Cart\AsyncPaymentTransactionStruct; use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\AsynchronousPaymentHandlerInterface; use Shopware\Core\Checkout\Payment\Exception\AsyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Symfony\Component\HttpFoundation\RedirectResponse; @@ -51,7 +51,7 @@ public function __construct( PayoneClientInterface $client, TranslatorInterface $translator, TransactionDataHandlerInterface $dataHandler, - EntityRepositoryInterface $lineItemRepository, + EntityRepository $lineItemRepository, PaymentStateHandlerInterface $stateHandler, CardRepositoryInterface $cardRepository, RequestStack $requestStack, diff --git a/src/PaymentHandler/PayoneDebitPaymentHandler.php b/src/PaymentHandler/PayoneDebitPaymentHandler.php index 2d583a546..0227c7e17 100644 --- a/src/PaymentHandler/PayoneDebitPaymentHandler.php +++ b/src/PaymentHandler/PayoneDebitPaymentHandler.php @@ -16,7 +16,7 @@ use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\SynchronousPaymentHandlerInterface; use Shopware\Core\Checkout\Payment\Cart\SyncPaymentTransactionStruct; use Shopware\Core\Checkout\Payment\Exception\SyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Symfony\Component\HttpFoundation\RequestStack; @@ -41,7 +41,7 @@ public function __construct( PayoneClientInterface $client, TranslatorInterface $translator, TransactionDataHandlerInterface $dataHandler, - EntityRepositoryInterface $lineItemRepository, + EntityRepository $lineItemRepository, MandateServiceInterface $mandateService, RequestStack $requestStack, RequestParameterFactory $requestParameterFactory diff --git a/src/PaymentHandler/PayoneEpsPaymentHandler.php b/src/PaymentHandler/PayoneEpsPaymentHandler.php index 5f9e45e16..88ff308a5 100644 --- a/src/PaymentHandler/PayoneEpsPaymentHandler.php +++ b/src/PaymentHandler/PayoneEpsPaymentHandler.php @@ -16,7 +16,7 @@ use Shopware\Core\Checkout\Payment\Cart\AsyncPaymentTransactionStruct; use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\AsynchronousPaymentHandlerInterface; use Shopware\Core\Checkout\Payment\Exception\AsyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Symfony\Component\HttpFoundation\RedirectResponse; @@ -74,7 +74,7 @@ class PayoneEpsPaymentHandler extends AbstractPayonePaymentHandler implements As public function __construct( ConfigReaderInterface $configReader, - EntityRepositoryInterface $lineItemRepository, + EntityRepository $lineItemRepository, PayoneClientInterface $client, TranslatorInterface $translator, TransactionDataHandlerInterface $dataHandler, diff --git a/src/PaymentHandler/PayoneIDealPaymentHandler.php b/src/PaymentHandler/PayoneIDealPaymentHandler.php index 0e328d145..6865001b2 100644 --- a/src/PaymentHandler/PayoneIDealPaymentHandler.php +++ b/src/PaymentHandler/PayoneIDealPaymentHandler.php @@ -16,7 +16,7 @@ use Shopware\Core\Checkout\Payment\Cart\AsyncPaymentTransactionStruct; use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\AsynchronousPaymentHandlerInterface; use Shopware\Core\Checkout\Payment\Exception\AsyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Symfony\Component\HttpFoundation\RedirectResponse; @@ -57,7 +57,7 @@ class PayoneIDealPaymentHandler extends AbstractPayonePaymentHandler implements public function __construct( ConfigReaderInterface $configReader, - EntityRepositoryInterface $lineItemRepository, + EntityRepository $lineItemRepository, PayoneClientInterface $client, TranslatorInterface $translator, TransactionDataHandlerInterface $dataHandler, diff --git a/src/PaymentHandler/PayonePaydirektPaymentHandler.php b/src/PaymentHandler/PayonePaydirektPaymentHandler.php index cee581cdb..1fd3ba181 100644 --- a/src/PaymentHandler/PayonePaydirektPaymentHandler.php +++ b/src/PaymentHandler/PayonePaydirektPaymentHandler.php @@ -16,7 +16,7 @@ use Shopware\Core\Checkout\Payment\Cart\AsyncPaymentTransactionStruct; use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\AsynchronousPaymentHandlerInterface; use Shopware\Core\Checkout\Payment\Exception\AsyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Symfony\Component\HttpFoundation\RedirectResponse; @@ -38,7 +38,7 @@ class PayonePaydirektPaymentHandler extends AbstractPayonePaymentHandler impleme public function __construct( ConfigReaderInterface $configReader, - EntityRepositoryInterface $lineItemRepository, + EntityRepository $lineItemRepository, PayoneClientInterface $client, TranslatorInterface $translator, TransactionDataHandlerInterface $dataHandler, diff --git a/src/PaymentHandler/PayonePayolutionDebitPaymentHandler.php b/src/PaymentHandler/PayonePayolutionDebitPaymentHandler.php index 09082c2c9..82dc9577e 100644 --- a/src/PaymentHandler/PayonePayolutionDebitPaymentHandler.php +++ b/src/PaymentHandler/PayonePayolutionDebitPaymentHandler.php @@ -14,7 +14,7 @@ use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\SynchronousPaymentHandlerInterface; use Shopware\Core\Checkout\Payment\Cart\SyncPaymentTransactionStruct; use Shopware\Core\Checkout\Payment\Exception\SyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Symfony\Component\HttpFoundation\RequestStack; @@ -35,7 +35,7 @@ public function __construct( PayoneClientInterface $client, TranslatorInterface $translator, TransactionDataHandlerInterface $dataHandler, - EntityRepositoryInterface $lineItemRepository, + EntityRepository $lineItemRepository, RequestStack $requestStack, RequestParameterFactory $requestParameterFactory ) { diff --git a/src/PaymentHandler/PayonePayolutionInstallmentPaymentHandler.php b/src/PaymentHandler/PayonePayolutionInstallmentPaymentHandler.php index b0e7d41ac..248a2e742 100644 --- a/src/PaymentHandler/PayonePayolutionInstallmentPaymentHandler.php +++ b/src/PaymentHandler/PayonePayolutionInstallmentPaymentHandler.php @@ -17,7 +17,7 @@ use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\SynchronousPaymentHandlerInterface; use Shopware\Core\Checkout\Payment\Cart\SyncPaymentTransactionStruct; use Shopware\Core\Checkout\Payment\Exception\SyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Symfony\Component\HttpFoundation\RequestStack; @@ -41,7 +41,7 @@ public function __construct( PayoneClientInterface $client, TranslatorInterface $translator, TransactionDataHandlerInterface $dataHandler, - EntityRepositoryInterface $lineItemRepository, + EntityRepository $lineItemRepository, CartHasherInterface $cartHasher, RequestStack $requestStack, RequestParameterFactory $requestParameterFactory diff --git a/src/PaymentHandler/PayonePayolutionInvoicingPaymentHandler.php b/src/PaymentHandler/PayonePayolutionInvoicingPaymentHandler.php index 0b2091768..f17d59013 100644 --- a/src/PaymentHandler/PayonePayolutionInvoicingPaymentHandler.php +++ b/src/PaymentHandler/PayonePayolutionInvoicingPaymentHandler.php @@ -16,7 +16,7 @@ use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\SynchronousPaymentHandlerInterface; use Shopware\Core\Checkout\Payment\Cart\SyncPaymentTransactionStruct; use Shopware\Core\Checkout\Payment\Exception\SyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Symfony\Component\HttpFoundation\RequestStack; @@ -38,7 +38,7 @@ public function __construct( PayoneClientInterface $client, TranslatorInterface $translator, TransactionDataHandlerInterface $dataHandler, - EntityRepositoryInterface $lineItemRepository, + EntityRepository $lineItemRepository, RequestStack $requestStack, RequestParameterFactory $requestParameterFactory ) { diff --git a/src/PaymentHandler/PayonePaypalExpressPaymentHandler.php b/src/PaymentHandler/PayonePaypalExpressPaymentHandler.php index c7147627c..1b3fc2d3a 100644 --- a/src/PaymentHandler/PayonePaypalExpressPaymentHandler.php +++ b/src/PaymentHandler/PayonePaypalExpressPaymentHandler.php @@ -15,7 +15,7 @@ use Shopware\Core\Checkout\Payment\Cart\AsyncPaymentTransactionStruct; use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\AsynchronousPaymentHandlerInterface; use Shopware\Core\Checkout\Payment\Exception\AsyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Symfony\Component\HttpFoundation\RedirectResponse; @@ -40,7 +40,7 @@ public function __construct( PayoneClientInterface $client, TranslatorInterface $translator, TransactionDataHandlerInterface $dataHandler, - EntityRepositoryInterface $lineItemRepository, + EntityRepository $lineItemRepository, PaymentStateHandlerInterface $stateHandler, RequestStack $requestStack, RequestParameterFactory $requestParameterFactory diff --git a/src/PaymentHandler/PayonePaypalPaymentHandler.php b/src/PaymentHandler/PayonePaypalPaymentHandler.php index 1ccfb6505..23a115840 100644 --- a/src/PaymentHandler/PayonePaypalPaymentHandler.php +++ b/src/PaymentHandler/PayonePaypalPaymentHandler.php @@ -15,7 +15,7 @@ use Shopware\Core\Checkout\Payment\Cart\AsyncPaymentTransactionStruct; use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\AsynchronousPaymentHandlerInterface; use Shopware\Core\Checkout\Payment\Exception\AsyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Symfony\Component\HttpFoundation\RedirectResponse; @@ -40,7 +40,7 @@ public function __construct( PayoneClientInterface $client, TranslatorInterface $translator, TransactionDataHandlerInterface $dataHandler, - EntityRepositoryInterface $lineItemRepository, + EntityRepository $lineItemRepository, PaymentStateHandlerInterface $stateHandler, RequestStack $requestStack, RequestParameterFactory $requestParameterFactory diff --git a/src/PaymentHandler/PayonePrepaymentPaymentHandler.php b/src/PaymentHandler/PayonePrepaymentPaymentHandler.php index e25f63236..4ba615f24 100644 --- a/src/PaymentHandler/PayonePrepaymentPaymentHandler.php +++ b/src/PaymentHandler/PayonePrepaymentPaymentHandler.php @@ -16,7 +16,7 @@ use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\SynchronousPaymentHandlerInterface; use Shopware\Core\Checkout\Payment\Cart\SyncPaymentTransactionStruct; use Shopware\Core\Checkout\Payment\Exception\SyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Symfony\Component\HttpFoundation\RequestStack; @@ -38,7 +38,7 @@ public function __construct( PayoneClientInterface $client, TranslatorInterface $translator, TransactionDataHandlerInterface $dataHandler, - EntityRepositoryInterface $lineItemRepository, + EntityRepository $lineItemRepository, RequestStack $requestStack ) { parent::__construct($configReader, $lineItemRepository, $requestStack); diff --git a/src/PaymentHandler/PayonePrzelewy24PaymentHandler.php b/src/PaymentHandler/PayonePrzelewy24PaymentHandler.php index a5358653e..aaae60846 100644 --- a/src/PaymentHandler/PayonePrzelewy24PaymentHandler.php +++ b/src/PaymentHandler/PayonePrzelewy24PaymentHandler.php @@ -15,7 +15,7 @@ use Shopware\Core\Checkout\Payment\Cart\AsyncPaymentTransactionStruct; use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\AsynchronousPaymentHandlerInterface; use Shopware\Core\Checkout\Payment\Exception\AsyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Symfony\Component\HttpFoundation\RedirectResponse; @@ -37,7 +37,7 @@ class PayonePrzelewy24PaymentHandler extends AbstractPayonePaymentHandler implem public function __construct( ConfigReaderInterface $configReader, - EntityRepositoryInterface $lineItemRepository, + EntityRepository $lineItemRepository, PayoneClientInterface $client, TranslatorInterface $translator, TransactionDataHandlerInterface $dataHandler, diff --git a/src/PaymentHandler/PayoneRatepayDebitPaymentHandler.php b/src/PaymentHandler/PayoneRatepayDebitPaymentHandler.php index 3a297d202..388b667f7 100644 --- a/src/PaymentHandler/PayoneRatepayDebitPaymentHandler.php +++ b/src/PaymentHandler/PayoneRatepayDebitPaymentHandler.php @@ -17,7 +17,7 @@ use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\SynchronousPaymentHandlerInterface; use Shopware\Core\Checkout\Payment\Cart\SyncPaymentTransactionStruct; use Shopware\Core\Checkout\Payment\Exception\SyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Symfony\Component\HttpFoundation\RequestStack; @@ -41,7 +41,7 @@ public function __construct( PayoneClientInterface $client, TranslatorInterface $translator, TransactionDataHandlerInterface $dataHandler, - EntityRepositoryInterface $lineItemRepository, + EntityRepository $lineItemRepository, RequestStack $requestStack, RequestParameterFactory $requestParameterFactory, AbstractDeviceFingerprintService $deviceFingerprintService diff --git a/src/PaymentHandler/PayoneRatepayInstallmentPaymentHandler.php b/src/PaymentHandler/PayoneRatepayInstallmentPaymentHandler.php index 0c5de3014..b5bd30abf 100644 --- a/src/PaymentHandler/PayoneRatepayInstallmentPaymentHandler.php +++ b/src/PaymentHandler/PayoneRatepayInstallmentPaymentHandler.php @@ -17,7 +17,7 @@ use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\SynchronousPaymentHandlerInterface; use Shopware\Core\Checkout\Payment\Cart\SyncPaymentTransactionStruct; use Shopware\Core\Checkout\Payment\Exception\SyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Symfony\Component\HttpFoundation\RequestStack; @@ -41,7 +41,7 @@ public function __construct( PayoneClientInterface $client, TranslatorInterface $translator, TransactionDataHandlerInterface $dataHandler, - EntityRepositoryInterface $lineItemRepository, + EntityRepository $lineItemRepository, RequestStack $requestStack, RequestParameterFactory $requestParameterFactory, AbstractDeviceFingerprintService $deviceFingerprintService diff --git a/src/PaymentHandler/PayoneRatepayInvoicingPaymentHandler.php b/src/PaymentHandler/PayoneRatepayInvoicingPaymentHandler.php index ac279b3b2..25e414ce3 100644 --- a/src/PaymentHandler/PayoneRatepayInvoicingPaymentHandler.php +++ b/src/PaymentHandler/PayoneRatepayInvoicingPaymentHandler.php @@ -16,7 +16,7 @@ use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\SynchronousPaymentHandlerInterface; use Shopware\Core\Checkout\Payment\Cart\SyncPaymentTransactionStruct; use Shopware\Core\Checkout\Payment\Exception\SyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Symfony\Component\HttpFoundation\RequestStack; @@ -40,7 +40,7 @@ public function __construct( PayoneClientInterface $client, TranslatorInterface $translator, TransactionDataHandlerInterface $dataHandler, - EntityRepositoryInterface $lineItemRepository, + EntityRepository $lineItemRepository, RequestStack $requestStack, RequestParameterFactory $requestParameterFactory, AbstractDeviceFingerprintService $deviceFingerprintService diff --git a/src/PaymentHandler/PayoneSecuredDirectDebitPaymentHandler.php b/src/PaymentHandler/PayoneSecuredDirectDebitPaymentHandler.php index 09573d6a4..589139d70 100644 --- a/src/PaymentHandler/PayoneSecuredDirectDebitPaymentHandler.php +++ b/src/PaymentHandler/PayoneSecuredDirectDebitPaymentHandler.php @@ -16,7 +16,7 @@ use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\SynchronousPaymentHandlerInterface; use Shopware\Core\Checkout\Payment\Cart\SyncPaymentTransactionStruct; use Shopware\Core\Checkout\Payment\Exception\SyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Symfony\Component\HttpFoundation\RequestStack; @@ -40,7 +40,7 @@ public function __construct( PayoneClientInterface $client, TranslatorInterface $translator, TransactionDataHandlerInterface $dataHandler, - EntityRepositoryInterface $lineItemRepository, + EntityRepository $lineItemRepository, RequestStack $requestStack, RequestParameterFactory $requestParameterFactory, AbstractDeviceFingerprintService $deviceFingerprintService diff --git a/src/PaymentHandler/PayoneSecuredInstallmentPaymentHandler.php b/src/PaymentHandler/PayoneSecuredInstallmentPaymentHandler.php index 1057fe239..afbeafa0e 100644 --- a/src/PaymentHandler/PayoneSecuredInstallmentPaymentHandler.php +++ b/src/PaymentHandler/PayoneSecuredInstallmentPaymentHandler.php @@ -16,7 +16,7 @@ use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\SynchronousPaymentHandlerInterface; use Shopware\Core\Checkout\Payment\Cart\SyncPaymentTransactionStruct; use Shopware\Core\Checkout\Payment\Exception\SyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Symfony\Component\HttpFoundation\RequestStack; @@ -40,7 +40,7 @@ public function __construct( PayoneClientInterface $client, TranslatorInterface $translator, TransactionDataHandlerInterface $dataHandler, - EntityRepositoryInterface $lineItemRepository, + EntityRepository $lineItemRepository, RequestStack $requestStack, RequestParameterFactory $requestParameterFactory, AbstractDeviceFingerprintService $deviceFingerprintService diff --git a/src/PaymentHandler/PayoneSecuredInvoicePaymentHandler.php b/src/PaymentHandler/PayoneSecuredInvoicePaymentHandler.php index dcdf4ff1d..59f575c9a 100644 --- a/src/PaymentHandler/PayoneSecuredInvoicePaymentHandler.php +++ b/src/PaymentHandler/PayoneSecuredInvoicePaymentHandler.php @@ -15,7 +15,7 @@ use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\SynchronousPaymentHandlerInterface; use Shopware\Core\Checkout\Payment\Cart\SyncPaymentTransactionStruct; use Shopware\Core\Checkout\Payment\Exception\SyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Symfony\Component\HttpFoundation\RequestStack; @@ -38,7 +38,7 @@ public function __construct( PayoneClientInterface $client, TranslatorInterface $translator, TransactionDataHandlerInterface $dataHandler, - EntityRepositoryInterface $lineItemRepository, + EntityRepository $lineItemRepository, RequestStack $requestStack, RequestParameterFactory $requestParameterFactory, AbstractDeviceFingerprintService $deviceFingerprintService diff --git a/src/PaymentHandler/PayoneSofortBankingPaymentHandler.php b/src/PaymentHandler/PayoneSofortBankingPaymentHandler.php index bf1879554..4c1293ffa 100644 --- a/src/PaymentHandler/PayoneSofortBankingPaymentHandler.php +++ b/src/PaymentHandler/PayoneSofortBankingPaymentHandler.php @@ -16,7 +16,7 @@ use Shopware\Core\Checkout\Payment\Cart\AsyncPaymentTransactionStruct; use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\AsynchronousPaymentHandlerInterface; use Shopware\Core\Checkout\Payment\Exception\AsyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Symfony\Component\HttpFoundation\RedirectResponse; @@ -42,7 +42,7 @@ public function __construct( PayoneClientInterface $client, TranslatorInterface $translator, TransactionDataHandlerInterface $dataHandler, - EntityRepositoryInterface $lineItemRepository, + EntityRepository $lineItemRepository, PaymentStateHandlerInterface $stateHandler, RequestStack $requestStack ) { diff --git a/src/PaymentHandler/PayoneTrustlyPaymentHandler.php b/src/PaymentHandler/PayoneTrustlyPaymentHandler.php index 596a254c3..2ab70e037 100644 --- a/src/PaymentHandler/PayoneTrustlyPaymentHandler.php +++ b/src/PaymentHandler/PayoneTrustlyPaymentHandler.php @@ -16,7 +16,7 @@ use Shopware\Core\Checkout\Payment\Cart\AsyncPaymentTransactionStruct; use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\AsynchronousPaymentHandlerInterface; use Shopware\Core\Checkout\Payment\Exception\AsyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Symfony\Component\HttpFoundation\RedirectResponse; @@ -41,7 +41,7 @@ public function __construct( PayoneClientInterface $client, TranslatorInterface $translator, TransactionDataHandlerInterface $dataHandler, - EntityRepositoryInterface $lineItemRepository, + EntityRepository $lineItemRepository, PaymentStateHandlerInterface $stateHandler, RequestStack $requestStack, RequestParameterFactory $requestParameterFactory diff --git a/src/PaymentHandler/PayoneWeChatPayPaymentHandler.php b/src/PaymentHandler/PayoneWeChatPayPaymentHandler.php index 1f6b5ab21..01a4778c0 100644 --- a/src/PaymentHandler/PayoneWeChatPayPaymentHandler.php +++ b/src/PaymentHandler/PayoneWeChatPayPaymentHandler.php @@ -16,7 +16,7 @@ use Shopware\Core\Checkout\Payment\Cart\AsyncPaymentTransactionStruct; use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\AsynchronousPaymentHandlerInterface; use Shopware\Core\Checkout\Payment\Exception\AsyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Symfony\Component\HttpFoundation\RedirectResponse; @@ -38,7 +38,7 @@ class PayoneWeChatPayPaymentHandler extends AbstractPayonePaymentHandler impleme public function __construct( ConfigReaderInterface $configReader, - EntityRepositoryInterface $lineItemRepository, + EntityRepository $lineItemRepository, PayoneClientInterface $client, TranslatorInterface $translator, TransactionDataHandlerInterface $dataHandler, diff --git a/src/Payone/Client/PayoneClient.php b/src/Payone/Client/PayoneClient.php index aa150d69f..348fea44b 100644 --- a/src/Payone/Client/PayoneClient.php +++ b/src/Payone/Client/PayoneClient.php @@ -64,7 +64,7 @@ public function request(array $parameters, bool $json = true): array ]); if (empty($data)) { - throw new PayoneRequestException('payone returned a empty response', $parameters, $data); + throw new PayoneRequestException('payone returned a empty response', $parameters, []); } $response = array_change_key_case($data, \CASE_LOWER); diff --git a/src/Payone/RequestParameter/Builder/ApplePay/AuthorizeRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/ApplePay/AuthorizeRequestParameterBuilder.php index 67dc4caf0..be881e00e 100644 --- a/src/Payone/RequestParameter/Builder/ApplePay/AuthorizeRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/ApplePay/AuthorizeRequestParameterBuilder.php @@ -16,7 +16,7 @@ use Shopware\Core\Checkout\Order\Aggregate\OrderAddress\OrderAddressEntity; use Shopware\Core\Checkout\Order\OrderDefinition; use Shopware\Core\Checkout\Order\OrderEntity; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\Country\CountryEntity; @@ -32,13 +32,13 @@ class AuthorizeRequestParameterBuilder extends AbstractRequestParameterBuilder protected NumberRangeValueGeneratorInterface $numberRangeValueGenerator; - protected EntityRepositoryInterface $orderRepository; + protected EntityRepository $orderRepository; public function __construct( CartService $cartService, CurrencyPrecisionInterface $currencyPrecision, NumberRangeValueGeneratorInterface $numberRangeValueGenerator, - EntityRepositoryInterface $orderRepository + EntityRepository $orderRepository ) { $this->cartService = $cartService; $this->currencyPrecision = $currencyPrecision; diff --git a/src/Payone/RequestParameter/Builder/CustomerInformationRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/CustomerInformationRequestParameterBuilder.php index 75bfbda68..f0bbbbca9 100644 --- a/src/Payone/RequestParameter/Builder/CustomerInformationRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/CustomerInformationRequestParameterBuilder.php @@ -15,14 +15,14 @@ use Shopware\Core\Checkout\Order\Aggregate\OrderAddress\OrderAddressEntity; use Shopware\Core\Checkout\Order\OrderEntity; use Shopware\Core\Framework\Context; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; class CustomerInformationRequestParameterBuilder extends AbstractRequestParameterBuilder { - private EntityRepositoryInterface $orderAddressRepository; + private EntityRepository $orderAddressRepository; - public function __construct(EntityRepositoryInterface $orderAddressRepository) + public function __construct(EntityRepository $orderAddressRepository) { $this->orderAddressRepository = $orderAddressRepository; } diff --git a/src/Payone/RequestParameter/Builder/CustomerRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/CustomerRequestParameterBuilder.php index bd5c1768c..ac0a910ac 100644 --- a/src/Payone/RequestParameter/Builder/CustomerRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/CustomerRequestParameterBuilder.php @@ -38,7 +38,7 @@ use PayonePayment\Payone\RequestParameter\Struct\PayolutionAdditionalActionStruct; use Shopware\Core\Checkout\Customer\Aggregate\CustomerAddress\CustomerAddressEntity; use Shopware\Core\Framework\Context; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; use Shopware\Core\System\Country\CountryEntity; use Shopware\Core\System\Language\LanguageEntity; @@ -48,18 +48,18 @@ class CustomerRequestParameterBuilder extends AbstractRequestParameterBuilder { - private EntityRepositoryInterface $languageRepository; + private EntityRepository $languageRepository; private RequestStack $requestStack; - private EntityRepositoryInterface $salutationRepository; + private EntityRepository $salutationRepository; - private EntityRepositoryInterface $countryRepository; + private EntityRepository $countryRepository; public function __construct( - EntityRepositoryInterface $languageRepository, - EntityRepositoryInterface $salutationRepository, - EntityRepositoryInterface $countryRepository, + EntityRepository $languageRepository, + EntityRepository $salutationRepository, + EntityRepository $countryRepository, RequestStack $requestStack ) { $this->languageRepository = $languageRepository; diff --git a/src/Payone/RequestParameter/Builder/GeneralTransactionRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/GeneralTransactionRequestParameterBuilder.php index 96635c227..75e3b825e 100644 --- a/src/Payone/RequestParameter/Builder/GeneralTransactionRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/GeneralTransactionRequestParameterBuilder.php @@ -17,13 +17,13 @@ use Shopware\Core\Checkout\Order\Aggregate\OrderTransaction\OrderTransactionCollection; use Shopware\Core\Checkout\Order\Aggregate\OrderTransaction\OrderTransactionEntity; use Shopware\Core\Checkout\Order\OrderEntity; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Symfony\Component\HttpFoundation\ParameterBag; class GeneralTransactionRequestParameterBuilder extends AbstractRequestParameterBuilder { - protected EntityRepositoryInterface $currencyRepository; + protected EntityRepository $currencyRepository; protected CurrencyPrecisionInterface $currencyPrecision; @@ -34,7 +34,7 @@ class GeneralTransactionRequestParameterBuilder extends AbstractRequestParameter public function __construct( CartHasherInterface $cartHasher, ConfigReaderInterface $configReader, - EntityRepositoryInterface $currencyRepository, + EntityRepository $currencyRepository, CurrencyPrecisionInterface $currencyPrecision ) { $this->cartHasher = $cartHasher; diff --git a/src/Payone/RequestParameter/Builder/OpenInvoice/AuthorizeRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/OpenInvoice/AuthorizeRequestParameterBuilder.php index ede699ca2..33fe0fef7 100644 --- a/src/Payone/RequestParameter/Builder/OpenInvoice/AuthorizeRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/OpenInvoice/AuthorizeRequestParameterBuilder.php @@ -9,15 +9,15 @@ use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder; use PayonePayment\Payone\RequestParameter\Struct\AbstractRequestParameterStruct; use PayonePayment\Payone\RequestParameter\Struct\PaymentTransactionStruct; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; class AuthorizeRequestParameterBuilder extends AbstractRequestParameterBuilder { protected LineItemHydratorInterface $lineItemHydrator; - protected EntityRepositoryInterface $currencyRepository; + protected EntityRepository $currencyRepository; - public function __construct(LineItemHydratorInterface $lineItemHydrator, EntityRepositoryInterface $currencyRepository) + public function __construct(LineItemHydratorInterface $lineItemHydrator, EntityRepository $currencyRepository) { $this->lineItemHydrator = $lineItemHydrator; $this->currencyRepository = $currencyRepository; diff --git a/src/Payone/RequestParameter/Builder/PayolutionInvoicing/PreCheckRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/PayolutionInvoicing/PreCheckRequestParameterBuilder.php index 36e904f78..fb6a07461 100644 --- a/src/Payone/RequestParameter/Builder/PayolutionInvoicing/PreCheckRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/PayolutionInvoicing/PreCheckRequestParameterBuilder.php @@ -91,6 +91,7 @@ protected function provideCompanyParams(array &$parameters, SalesChannelContext if ($billingAddress->getCompany() || $customer->getCompany()) { $parameters['add_paydata[b2b]'] = 'yes'; + /** @phpstan-ignore-next-line */ if (method_exists($customer, 'getVatIds')) { $vatIds = $customer->getVatIds(); diff --git a/src/Payone/RequestParameter/Builder/Postfinance/AuthorizeRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/Postfinance/AuthorizeRequestParameterBuilder.php index 2e25e02aa..88787e078 100644 --- a/src/Payone/RequestParameter/Builder/Postfinance/AuthorizeRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/Postfinance/AuthorizeRequestParameterBuilder.php @@ -27,8 +27,6 @@ public function getRequestParameter(AbstractRequestParameterStruct $arguments): throw new \RuntimeException('Invalid payment method handler'); } - $billingAddress = $arguments->getPaymentTransaction()->getOrder()->getBillingAddress(); - return [ 'request' => $arguments->getAction(), 'clearingtype' => self::CLEARING_TYPE_ONLINE_BANK_TRANSFER, diff --git a/src/Payone/RequestParameter/Builder/RatepayDebit/AuthorizeRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/RatepayDebit/AuthorizeRequestParameterBuilder.php index 5c5a049d7..8e8a41845 100644 --- a/src/Payone/RequestParameter/Builder/RatepayDebit/AuthorizeRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/RatepayDebit/AuthorizeRequestParameterBuilder.php @@ -16,7 +16,7 @@ use PayonePayment\Payone\RequestParameter\Struct\PaymentTransactionStruct; use Shopware\Core\Checkout\Order\OrderEntity; use Shopware\Core\Framework\Context; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Symfony\Component\HttpFoundation\ParameterBag; class AuthorizeRequestParameterBuilder extends AbstractRequestParameterBuilder @@ -27,7 +27,7 @@ class AuthorizeRequestParameterBuilder extends AbstractRequestParameterBuilder protected AbstractDeviceFingerprintService $deviceFingerprintService; - protected EntityRepositoryInterface $customerRepository; + protected EntityRepository $customerRepository; protected LineItemHydratorInterface $lineItemHydrator; @@ -35,7 +35,7 @@ public function __construct( OrderFetcherInterface $orderFetcher, ProfileServiceInterface $profileService, AbstractDeviceFingerprintService $deviceFingerprintService, - EntityRepositoryInterface $customerRepository, + EntityRepository $customerRepository, LineItemHydratorInterface $lineItemHydrator ) { $this->orderFetcher = $orderFetcher; diff --git a/src/Payone/RequestParameter/Builder/RatepayInstallment/AuthorizeRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/RatepayInstallment/AuthorizeRequestParameterBuilder.php index 5a62f371a..dfe15d49c 100644 --- a/src/Payone/RequestParameter/Builder/RatepayInstallment/AuthorizeRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/RatepayInstallment/AuthorizeRequestParameterBuilder.php @@ -14,7 +14,7 @@ use PayonePayment\Payone\RequestParameter\Builder\RatepayDebit\AuthorizeRequestParameterBuilder as RatepayDebitAuthorizeRequestParameterBuilder; use PayonePayment\Payone\RequestParameter\Struct\AbstractRequestParameterStruct; use PayonePayment\Payone\RequestParameter\Struct\PaymentTransactionStruct; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; class AuthorizeRequestParameterBuilder extends RatepayDebitAuthorizeRequestParameterBuilder { @@ -24,7 +24,7 @@ public function __construct( OrderFetcherInterface $orderFetcher, ProfileServiceInterface $profileService, AbstractDeviceFingerprintService $deviceFingerprintService, - EntityRepositoryInterface $customerRepository, + EntityRepository $customerRepository, LineItemHydratorInterface $lineItemHydrator, CurrencyPrecisionInterface $currencyPrecision ) { diff --git a/src/Payone/RequestParameter/Builder/SecureInvoice/AuthorizeRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/SecureInvoice/AuthorizeRequestParameterBuilder.php index 3afe45a3c..2edfda37c 100644 --- a/src/Payone/RequestParameter/Builder/SecureInvoice/AuthorizeRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/SecureInvoice/AuthorizeRequestParameterBuilder.php @@ -9,15 +9,15 @@ use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder; use PayonePayment\Payone\RequestParameter\Struct\AbstractRequestParameterStruct; use PayonePayment\Payone\RequestParameter\Struct\PaymentTransactionStruct; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; class AuthorizeRequestParameterBuilder extends AbstractRequestParameterBuilder { protected LineItemHydratorInterface $lineItemHydrator; - protected EntityRepositoryInterface $currencyRepository; + protected EntityRepository $currencyRepository; - public function __construct(LineItemHydratorInterface $lineItemHydrator, EntityRepositoryInterface $currencyRepository) + public function __construct(LineItemHydratorInterface $lineItemHydrator, EntityRepository $currencyRepository) { $this->lineItemHydrator = $lineItemHydrator; $this->currencyRepository = $currencyRepository; diff --git a/src/Payone/RequestParameter/Builder/SecuredDirectDebit/AuthorizeRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/SecuredDirectDebit/AuthorizeRequestParameterBuilder.php index 8836c80b6..6874b9a5f 100644 --- a/src/Payone/RequestParameter/Builder/SecuredDirectDebit/AuthorizeRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/SecuredDirectDebit/AuthorizeRequestParameterBuilder.php @@ -15,7 +15,7 @@ use PayonePayment\Payone\RequestParameter\Struct\PaymentTransactionStruct; use Shopware\Core\Checkout\Order\OrderEntity; use Shopware\Core\Framework\Context; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; class AuthorizeRequestParameterBuilder extends AbstractRequestParameterBuilder { @@ -27,14 +27,14 @@ class AuthorizeRequestParameterBuilder extends AbstractRequestParameterBuilder protected LineItemHydratorInterface $lineItemHydrator; - protected EntityRepositoryInterface $customerRepository; + protected EntityRepository $customerRepository; public function __construct( OrderFetcherInterface $orderFetcher, AbstractDeviceFingerprintService $deviceFingerprintService, CurrencyPrecisionInterface $currencyPrecision, LineItemHydratorInterface $lineItemHydrator, - EntityRepositoryInterface $customerRepository + EntityRepository $customerRepository ) { $this->orderFetcher = $orderFetcher; $this->deviceFingerprintService = $deviceFingerprintService; diff --git a/src/Payone/RequestParameter/Builder/SecuredInstallment/AuthorizeRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/SecuredInstallment/AuthorizeRequestParameterBuilder.php index e9225d05f..7cb5fc406 100644 --- a/src/Payone/RequestParameter/Builder/SecuredInstallment/AuthorizeRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/SecuredInstallment/AuthorizeRequestParameterBuilder.php @@ -15,7 +15,7 @@ use PayonePayment\Payone\RequestParameter\Struct\PaymentTransactionStruct; use Shopware\Core\Checkout\Order\OrderEntity; use Shopware\Core\Framework\Context; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; class AuthorizeRequestParameterBuilder extends AbstractRequestParameterBuilder { @@ -27,14 +27,14 @@ class AuthorizeRequestParameterBuilder extends AbstractRequestParameterBuilder protected LineItemHydratorInterface $lineItemHydrator; - protected EntityRepositoryInterface $customerRepository; + protected EntityRepository $customerRepository; public function __construct( OrderFetcherInterface $orderFetcher, AbstractDeviceFingerprintService $deviceFingerprintService, CurrencyPrecisionInterface $currencyPrecision, LineItemHydratorInterface $lineItemHydrator, - EntityRepositoryInterface $customerRepository + EntityRepository $customerRepository ) { $this->orderFetcher = $orderFetcher; $this->deviceFingerprintService = $deviceFingerprintService; diff --git a/src/Payone/RequestParameter/Builder/SecuredInvoice/AuthorizeRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/SecuredInvoice/AuthorizeRequestParameterBuilder.php index 5262e37aa..2af123dd5 100644 --- a/src/Payone/RequestParameter/Builder/SecuredInvoice/AuthorizeRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/SecuredInvoice/AuthorizeRequestParameterBuilder.php @@ -15,7 +15,7 @@ use PayonePayment\Payone\RequestParameter\Struct\PaymentTransactionStruct; use Shopware\Core\Checkout\Order\OrderEntity; use Shopware\Core\Framework\Context; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; class AuthorizeRequestParameterBuilder extends AbstractRequestParameterBuilder { @@ -27,14 +27,14 @@ class AuthorizeRequestParameterBuilder extends AbstractRequestParameterBuilder protected LineItemHydratorInterface $lineItemHydrator; - protected EntityRepositoryInterface $customerRepository; + protected EntityRepository $customerRepository; public function __construct( OrderFetcherInterface $orderFetcher, AbstractDeviceFingerprintService $deviceFingerprintService, CurrencyPrecisionInterface $currencyPrecision, LineItemHydratorInterface $lineItemHydrator, - EntityRepositoryInterface $customerRepository + EntityRepository $customerRepository ) { $this->orderFetcher = $orderFetcher; $this->deviceFingerprintService = $deviceFingerprintService; diff --git a/src/Payone/Webhook/Handler/NotificationForwardHandler.php b/src/Payone/Webhook/Handler/NotificationForwardHandler.php index d32a3f15a..a5042e82f 100644 --- a/src/Payone/Webhook/Handler/NotificationForwardHandler.php +++ b/src/Payone/Webhook/Handler/NotificationForwardHandler.php @@ -8,7 +8,7 @@ use PayonePayment\DataAbstractionLayer\Entity\NotificationTarget\PayonePaymentNotificationTargetCollection; use PayonePayment\Payone\Webhook\MessageBus\Command\NotificationForwardCommand; use PayonePayment\Struct\PaymentTransaction; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\ContainsFilter; use Shopware\Core\Framework\Uuid\Uuid; @@ -18,17 +18,17 @@ class NotificationForwardHandler implements WebhookHandlerInterface { - private EntityRepositoryInterface $notificationTargetRepository; + private EntityRepository $notificationTargetRepository; - private EntityRepositoryInterface $notificationForwardRepository; + private EntityRepository $notificationForwardRepository; private TransactionDataHandlerInterface $transactionDataHandler; private MessageBusInterface $messageBus; public function __construct( - EntityRepositoryInterface $notificationTargetRepository, - EntityRepositoryInterface $notificationForwardRepository, + EntityRepository $notificationTargetRepository, + EntityRepository $notificationForwardRepository, TransactionDataHandlerInterface $transactionDataHandler, MessageBusInterface $messageBus ) { diff --git a/src/Payone/Webhook/MessageBus/MessageHandler/NotificationForwardHandler.php b/src/Payone/Webhook/MessageBus/MessageHandler/NotificationForwardHandler.php index cd0451c2f..34674d86f 100644 --- a/src/Payone/Webhook/MessageBus/MessageHandler/NotificationForwardHandler.php +++ b/src/Payone/Webhook/MessageBus/MessageHandler/NotificationForwardHandler.php @@ -9,30 +9,31 @@ use PayonePayment\Payone\Webhook\MessageBus\Command\NotificationForwardCommand; use Psr\Log\LoggerInterface; use Shopware\Core\Framework\Context; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; use Shopware\Core\Framework\DataAbstractionLayer\Search\EntitySearchResult; -use Shopware\Core\Framework\MessageQueue\Handler\AbstractMessageHandler; +use Symfony\Component\Messenger\Handler\MessageSubscriberInterface; -class NotificationForwardHandler extends AbstractMessageHandler +class NotificationForwardHandler implements MessageSubscriberInterface { - private EntityRepositoryInterface $notificationForwardRepository; + private EntityRepository $notificationForwardRepository; private LoggerInterface $logger; - public function __construct(EntityRepositoryInterface $notificationForwardRepository, LoggerInterface $logger) + public function __construct(EntityRepository $notificationForwardRepository, LoggerInterface $logger) { $this->notificationForwardRepository = $notificationForwardRepository; $this->logger = $logger; } - /** - * @param NotificationForwardCommand $message - */ - public function handle($message): void + public function __invoke(NotificationForwardCommand $message): void + { + $this->handle($message); + } + + public function handle(NotificationForwardCommand $message): void { $notificationForwards = $this->getNotificationForwards($message->getNotificationTargetIds(), $message->getContext()); - /** @var resource $multiHandle */ $multiHandle = curl_multi_init(); $this->logger->info('Forwarding notifications', array_keys($notificationForwards->getElements())); @@ -73,11 +74,12 @@ private function getNotificationForwards(array $ids, Context $context): EntitySe return $this->notificationForwardRepository->search($criteria, $context); } - /** - * @param resource $multiHandle - */ - private function updateResponses($multiHandle, EntitySearchResult $notificationForwards, array $forwardRequests, Context $context): void - { + private function updateResponses( + \CurlMultiHandle $multiHandle, + EntitySearchResult $notificationForwards, + array $forwardRequests, + Context $context + ): void { $data = []; /** @var PayonePaymentNotificationForwardEntity $forward */ @@ -96,10 +98,7 @@ private function updateResponses($multiHandle, EntitySearchResult $notificationF $this->notificationForwardRepository->update($data, $context); } - /** - * @param resource $multiHandle - */ - private function getForwardRequests($multiHandle, EntitySearchResult $notificationForwards): array + private function getForwardRequests(\CurlMultiHandle $multiHandle, EntitySearchResult $notificationForwards): array { $forwardRequests = []; @@ -109,20 +108,24 @@ private function getForwardRequests($multiHandle, EntitySearchResult $notificati $target = $forward->getNotificationTarget(); - if ($target === null) { + if ($target === null || empty($target->getUrl())) { continue; } $forwardRequests[$id] = curl_init(); $serialize = unserialize($forward->getContent(), []); - /** @var array $content */ + /** @var array|string|false $content */ $content = mb_convert_encoding($serialize, 'ISO-8859-1', 'UTF-8'); + if (!\is_array($content)) { + continue; + } + curl_setopt($forwardRequests[$id], \CURLOPT_URL, $target->getUrl()); - curl_setopt($forwardRequests[$id], \CURLOPT_HEADER, 0); - curl_setopt($forwardRequests[$id], \CURLOPT_POST, 1); - curl_setopt($forwardRequests[$id], \CURLOPT_RETURNTRANSFER, 1); + curl_setopt($forwardRequests[$id], \CURLOPT_HEADER, false); + curl_setopt($forwardRequests[$id], \CURLOPT_POST, true); + curl_setopt($forwardRequests[$id], \CURLOPT_RETURNTRANSFER, true); curl_setopt($forwardRequests[$id], \CURLOPT_TIMEOUT, 10); curl_setopt($forwardRequests[$id], \CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($forwardRequests[$id], \CURLOPT_POSTFIELDS, http_build_query($content)); diff --git a/src/PayonePayment.php b/src/PayonePayment.php index e029355fd..6c030831d 100644 --- a/src/PayonePayment.php +++ b/src/PayonePayment.php @@ -9,7 +9,7 @@ use PayonePayment\Installer\CustomFieldInstaller; use PayonePayment\Installer\PaymentMethodInstaller; use PayonePayment\Installer\RuleInstaller\RuleInstallerSecureInvoice; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Plugin; use Shopware\Core\Framework\Plugin\Context\ActivateContext; use Shopware\Core\Framework\Plugin\Context\DeactivateContext; @@ -114,13 +114,13 @@ public function uninstall(UninstallContext $context): void private function getRuleInstallerSecureInvoice(): RuleInstallerSecureInvoice { - /** @var EntityRepositoryInterface $ruleRepository */ + /** @var EntityRepository $ruleRepository */ $ruleRepository = $this->container->get('rule.repository'); - /** @var EntityRepositoryInterface $countryRepository */ + /** @var EntityRepository $countryRepository */ $countryRepository = $this->container->get('country.repository'); - /** @var EntityRepositoryInterface $currencyRepository */ + /** @var EntityRepository $currencyRepository */ $currencyRepository = $this->container->get('currency.repository'); - /** @var EntityRepositoryInterface $paymentMethodRepository */ + /** @var EntityRepository $paymentMethodRepository */ $paymentMethodRepository = $this->container->get('payment_method.repository'); return new RuleInstallerSecureInvoice( @@ -143,11 +143,11 @@ private function getPaymentMethodInstaller(): PaymentMethodInstaller { /** @var PluginIdProvider $pluginIdProvider */ $pluginIdProvider = $this->container->get(PluginIdProvider::class); - /** @var EntityRepositoryInterface $paymentMethodRepository */ + /** @var EntityRepository $paymentMethodRepository */ $paymentMethodRepository = $this->container->get('payment_method.repository'); - /** @var EntityRepositoryInterface $salesChannelRepository */ + /** @var EntityRepository $salesChannelRepository */ $salesChannelRepository = $this->container->get('sales_channel.repository'); - /** @var EntityRepositoryInterface $paymentMethodSalesChannelRepository */ + /** @var EntityRepository $paymentMethodSalesChannelRepository */ $paymentMethodSalesChannelRepository = $this->container->get('sales_channel_payment_method.repository'); /** @var Connection $connection */ $connection = $this->container->get(Connection::class); @@ -163,9 +163,9 @@ private function getPaymentMethodInstaller(): PaymentMethodInstaller private function getCustomFieldInstaller(): CustomFieldInstaller { - /** @var EntityRepositoryInterface $customFieldSetRepository */ + /** @var EntityRepository $customFieldSetRepository */ $customFieldSetRepository = $this->container->get('custom_field_set.repository'); - /** @var EntityRepositoryInterface $customFieldRepository */ + /** @var EntityRepository $customFieldRepository */ $customFieldRepository = $this->container->get('custom_field.repository'); return new CustomFieldInstaller($customFieldSetRepository, $customFieldRepository); diff --git a/src/Resources/app/administration/src/component/payone-ratepay-profiles/payone-ratepay-profiles.html.twig b/src/Resources/app/administration/src/component/payone-ratepay-profiles/payone-ratepay-profiles.html.twig index 82d21bb6a..f932c6370 100644 --- a/src/Resources/app/administration/src/component/payone-ratepay-profiles/payone-ratepay-profiles.html.twig +++ b/src/Resources/app/administration/src/component/payone-ratepay-profiles/payone-ratepay-profiles.html.twig @@ -45,7 +45,7 @@ position: 'bottom' }" v-if="item.error" - name="default-badge-warning" + name="regular-exclamation-triangle" color="red"> diff --git a/src/Resources/app/administration/src/module/payone-notification-target/page/payone-notification-target-list/payone-notification-target-list.html.twig b/src/Resources/app/administration/src/module/payone-notification-target/page/payone-notification-target-list/payone-notification-target-list.html.twig index 2c99c4c99..bf971a26d 100644 --- a/src/Resources/app/administration/src/module/payone-notification-target/page/payone-notification-target-list/payone-notification-target-list.html.twig +++ b/src/Resources/app/administration/src/module/payone-notification-target/page/payone-notification-target-list/payone-notification-target-list.html.twig @@ -63,8 +63,8 @@ {% block payone_notification_target_list_grid_columns_is_basic_auth %} {% endblock %} diff --git a/src/Resources/app/administration/src/module/payone-payment/page/payone-settings/payone-settings.html.twig b/src/Resources/app/administration/src/module/payone-payment/page/payone-settings/payone-settings.html.twig index 720a047f6..bd967fd5a 100644 --- a/src/Resources/app/administration/src/module/payone-payment/page/payone-settings/payone-settings.html.twig +++ b/src/Resources/app/administration/src/module/payone-payment/page/payone-settings/payone-settings.html.twig @@ -4,7 +4,7 @@ @@ -70,7 +70,7 @@
- +

{{ $tc('payone-payment.supportModal.documentation.description') }} @@ -87,7 +87,7 @@

- +

{{ $tc('payone-payment.supportModal.support.description') }} @@ -104,7 +104,7 @@

- +

{{ $tc('payone-payment.supportModal.repository.description') }} @@ -121,7 +121,7 @@

- +

{{ $tc('payone-payment.supportModal.testdata.description') }} @@ -151,8 +151,8 @@ diff --git a/src/Resources/public/administration/js/payone-payment.js b/src/Resources/public/administration/js/payone-payment.js index b2420c7f7..f37961259 100644 --- a/src/Resources/public/administration/js/payone-payment.js +++ b/src/Resources/public/administration/js/payone-payment.js @@ -1 +1 @@ -!function(e){var t={};function n(i){if(t[i])return t[i].exports;var a=t[i]={i:i,l:!1,exports:{}};return e[i].call(a.exports,a,a.exports,n),a.l=!0,a.exports}n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(i,a,function(t){return e[t]}.bind(null,a));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/bundles/payonepayment/",n(n.s="yhSi")}({"0GMb":function(e){e.exports=JSON.parse('{"payonePayment":{"notificationTarget":{"module":{"title":"Payone Notificationweiterleitungen","buttonTitle":"Notifications"},"list":{"title":"Notificationweiterleitungen","empty":"Keine Einträge","buttonCreate":"Weiterleitungsziel anlegen"},"detail":{"headline":"Notificationweiterleitung","placeholder":{"url":"Url","username":"Benutzer","password":"Passwort"},"label":{"url":"Url","isBasicAuth":"Basic Auth","txactions":"txactions","buttonSave":"Speichern","buttonCancel":"Abbrechen","username":"Benutzer","password":"Passwort"}},"columns":{"url":"Url","isBasicAuth":"Basic Auth","txactions":"txactions"},"actions":{"requeue":"Erneut senden"},"messages":{"success":"Die Weiterleitung wurde erfolgreich in Auftrag gegeben."}}}}')},"35DV":function(e,t,n){},"4oQF":function(e,t,n){var i=n("bhoq");i.__esModule&&(i=i.default),"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("SZ7m").default)("4035430e",i,!0,{})},"7RQK":function(e,t,n){},AGDI:function(e,t,n){var i=n("BdDb");i.__esModule&&(i=i.default),"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("SZ7m").default)("da2355f0",i,!0,{})},B7Qk:function(e,t,n){var i=n("MB5G");i.__esModule&&(i=i.default),"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("SZ7m").default)("ad4859b2",i,!0,{})},BdDb:function(e,t,n){},GRpm:function(e){e.exports=JSON.parse('{"payone-payment":{"title":"PAYONE","general":{"mainMenuItemGeneral":"PAYONE","descriptionTextModule":"Settings for PAYONE","headlines":{"ratepayProfiles":"Profile","ratepayProfileConfigurations":"Profil-Konfigurationen"},"label":{"shopId":"Shop-ID","currency":"Currency","error":"Status","invoiceCountry":"Invoice Country","shippingCountry":"Shipping Country","minBasket":"Min. Basket","maxBasket":"Max. Basket","reloadConfigBtn":"Reload Profile Configuration","reloadConfigInfo":"(Plugin Configuration Changes will be saved first)"},"actions":{"addShop":"Add Shop-ID"},"errors":{"existingShopId":"The entered shop-id already exists.","emptyInputs":"Please fill all input fields."}},"capture":{"buttonTitle":"Capture","successTitle":"PAYONE","successMessage":"Capture processed successfully.","errorTitle":"PAYONE","errorMessage":"Capture could not be processed.","tooltips":{"impossible":"Capture impossible"}},"refund":{"buttonTitle":"Refund","successTitle":"PAYONE","successMessage":"Refund processed successfully.","errorTitle":"PAYONE","errorMessage":"Refund could not be processed.","tooltips":{"impossible":"Refund impossible"}},"modal":{"capture":{"title":"Capture","submit":"Capture","fullSubmit":"Full capture","amount":"Capture amount","captured":"Captured amount"},"refund":{"title":"Refund","submit":"Refund","fullSubmit":"Full Refund","amount":"Refund amount","refunded":"Refunded amount"},"orderAmount":"Order amount","remainingAmount":"Remaining amount","shippingCosts":"Shipping costs","descriptionHelpText":"Description help text","close":"Close","labelComment":"Label comment","columns":{"reference":"Reference","product":"Product","quantity":"Quantity","price":"Price"}},"settingsForm":{"save":"Save","test":"Test API Credentials","titleSuccess":"Success","titleError":"Error","labelShowSpecificStatusMapping":"Display state mapping configuration","helpTextShowSpecificStatusMapping":"If not configured the general status mapping config will be applied.","messageSaveError":{"ratepayProfilesUpdateFailed":"At least one Ratepay profile could not be saved successfully, please check your configuration."},"messageTestSuccess":"The API credentials were verified successfully.","messageTestNoTestedPayments":"No payment methods were tested during the check because none of the PAYONE payment methods are activated. Please activate at least one PAYONE payment method under Settings --\x3e Shop --\x3e Payment.","messageTestError":{"general":"The API credentials could not be verified successfully.","creditCard":"The API credentials for PAYONE Credit Card are not valid.","prepayment":"The API credentials for PAYONE Prepayment are not valid.","debit":"The API credentials for PAYONE Direct Debit are not valid.","paypalExpress":"The API credentials for PAYONE PayPal Express are not valid.","paypal":"The API credentials for PAYONE PayPal are not valid.","payolutionInstallment":"The API credentials for PAYONE Unzer Ratenkauf are not valid.","payolutionInvoicing":"The API credentials for PAYONE Unzer Rechnungskauf are not valid.","payolutionDebit":"The API credentials for PAYONE Unzer Lastschrift are not valid.","sofort":"The API credentials for PAYONE Sofort are not valid.","eps":"The API credentials for PAYONE eps are not valid.","iDeal":"The API credentials for PAYONE iDEAL are not valid.","secureInvoice":"The API credentials for PAYONE Secure Invoice are not valid.","openInvoice":"The API credentials for PAYONE Invoice are not valid.","paydirekt":"The API credentials for PAYONE paydirekt are not valid.","trustly":"The API credentials for PAYONE Trustly are not valid.","applePay":"The API credentials for PAYONE Apple Pay are not valid.","bancontact":"The API credentials for PAYONE Bancontact payment are not valid.","ratepayDebit":"The API credentials for PAYONE Ratepay Direct Debit payment are not valid.","ratepayInstallment":"The API credentials for PAYONE Ratepay Installments payment are not valid.","ratepayInvoicing":"The API credentials for PAYONE Ratepay Open Invoice payment are not valid.","klarnaInvoice":"The API credentials for PAYONE Klarna Rechnung are not valid.","klarnaDirectDebit":"The API credentials for PAYONE Klarna Sofort bezahlen are not valid.","klarnaInstallment":"The API credentials for PAYONE Klarna Ratenkauf are not valid.","przelewy24":"The API credentials for PAYONE Przelewy24 are not valid.","weChatPay":"The API credentials for PAYONE WeChat Pay are not valid.","postfinanceCard":"The API credentials for PAYONE Postfinance (Card) are not valid.","postfinanceWallet":"The API credentials for PAYONE Postfinance (Wallet) are not valid.","alipay":"The API credentials for PAYONE Alipay are not valid.","securedInvoice":"The API credentials for PAYONE Secured Invoice are not valid.","securedInstallment":"The API credentials for PAYONE Secured Installment are not valid.","securedDirectDebit":"The API credentials for PAYONE Secured Direct Debit are not valid."}},"supportModal":{"menuButton":"Support","title":"How Can We Help You?","documentation":{"description":"Read our online manual","button":"Online Manual"},"support":{"description":"Contact our technical support","button":"Tech Support"},"repository":{"description":"Report errors on GitHub","button":"GitHub"},"testdata":{"description":"Create your personal test data here","button":"Test Data"}},"applePay":{"cert":{"notification":"The ApplePay merchant authentication requires a certificate/key-pair. Further information:
\\n https://docs.payone.com/display/public/PLATFORM/Special+Remarks+-+Apple+Pay#SpecialRemarks-ApplePay-Onboarding

\\n\\n Create a pem-File afterwards by using the following command:
\\n

openssl x509 -inform der -in merchant_id.cer -out merchant_id.pem

\\n Copy certificate (merchant_id.pem) and key (merchant_id.key) file into the following folder:
\\n
%shopwareRoot%/config/apple-pay-cert
"}},"transitionActionNames":{"cancel":"Cancel","complete":"Complete","pay":"Pay","pay_partially":"Pay partially","process":"Process","refund":"Refund","refund_partially":"Refund partially","remind":"Remind","reopen":"Reopen","retour":"Retour","retour_partially":"Retour partially","ship":"Ship","ship_partially":"Ship partially"},"messageNotBlank":"This field must not be empty.","txid":"TXID","sequenceNumber":{"label":"Sequence Number","empty":"none"},"transactionState":"State","transactionCancelled":"Transaction cancelled in Shopware","error":{"transaction":{"notFound":"No matching transaction could be found","orderNotFound":"No matching order could be found"}}},"sw-privileges":{"additional_permissions":{"Payone":{"label":"PAYONE","payone_order_management":"PAYONE transaction management"}}}}')},"Hh0+":function(e,t){function n(e){return n="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},n(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var i=0;i2&&void 0!==arguments[2]?arguments[2]:"payone";return i(this,l),c.call(this,e,t,n)}return t=l,(n=[{key:"requeueNotificationForward",value:function(e){var t="_action/".concat(this.getApiBasePath(),"/requeue-forward");return this.httpClient.post(t,e,{headers:this.getBasicHeaders()}).then((function(e){return u.handleResponse(e)}))}},{key:"capturePayment",value:function(e){var t="_action/".concat(this.getApiBasePath(),"/capture-payment");return this.httpClient.post(t,e,{headers:this.getBasicHeaders()}).then((function(e){return u.handleResponse(e)}))}},{key:"refundPayment",value:function(e){var t="_action/".concat(this.getApiBasePath(),"/refund-payment");return this.httpClient.post(t,e,{headers:this.getBasicHeaders()}).then((function(e){return u.handleResponse(e)}))}}])&&a(t.prototype,n),s&&a(t,s),Object.defineProperty(t,"prototype",{writable:!1}),l}(u);l.addServiceProvider("PayonePaymentService",(function(e){var t=l.getContainer("init");return new d(t.httpClient,e.loginService)}))},HmBb:function(e){e.exports=JSON.parse('{"payonePayment":{"notificationTarget":{"module":{"title":"Payone notification forward","buttonTitle":"Notifications"},"list":{"title":"Notification forward","empty":"No entries","buttonCreate":"Add new notification target"},"detail":{"headline":"Notification forward","placeholder":{"url":"Url","username":"Username","password":"Password"},"label":{"url":"Url","isBasicAuth":"Basic Auth","txactions":"txactions","buttonSave":"Save","buttonCancel":"Cancel","username":"Username","password":"Password"}},"columns":{"url":"Url","isBasicAuth":"Basic Auth","txactions":"txactions"},"actions":{"requeue":"Requeue"},"messages":{"success":"The notification forward has been successfully queued."}}}}')},I32p:function(e,t,n){var i=n("KOKV");i.__esModule&&(i=i.default),"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("SZ7m").default)("0d8915a8",i,!0,{})},KDI0:function(e,t,n){},KOKV:function(e,t,n){},MB5G:function(e,t,n){},RLQU:function(e,t,n){var i=n("KDI0");i.__esModule&&(i=i.default),"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("SZ7m").default)("8e04b7f4",i,!0,{})},SZ7m:function(e,t,n){"use strict";function i(e,t){for(var n=[],i={},a=0;an.parts.length&&(i.parts.length=n.parts.length)}else{var r=[];for(a=0;a\\n https://docs.payone.com/display/public/PLATFORM/Special+Remarks+-+Apple+Pay#SpecialRemarks-ApplePay-Onboarding

\\n\\n Erstellen Sie im Anschluss unter Verwendung des folgenden Befehls eine PEM-Datei des Zertifikates:
\\n
openssl x509 -inform der -in merchant_id.cer -out merchant_id.pem

\\n Hinterlegen Sie das Zertifikat (merchant_id.pem) und den Key (merchant_id.key) in folgendem Verzeichnis:
\\n
%shopwareRoot%/config/apple-pay-cert
"}},"transitionActionNames":{"cancel":"Stornieren","complete":"Abschließen","pay":"Bezahlen","pay_partially":"Teilweise bezahlen","process":"Durchführen","refund":"Rückerstatten","refund_partially":"Teilweise rückerstatten","remind":"Erinnern","reopen":"Wieder öffnen","retour":"Retoure","retour_partially":"Teilweise retounieren","ship":"Versenden","ship_partially":"Teilweise versenden"},"messageNotBlank":"Dieser Wert darf nicht leer sein.","txid":"TXID","sequenceNumber":{"label":"Sequenznummer","empty":"keine"},"transactionState":"Status","transactionCancelled":"Transaktion in Shopware abgebrochen","error":{"transaction":{"notFound":"Es wurde keine passende Transaktion gefundend","orderNotFound":"Es wurde keine passende Bestellung gefundend"}}},"sw-privileges":{"additional_permissions":{"Payone":{"label":"PAYONE","payone_order_management":"PAYONE Transaktionsmanagement"}}}}')},WrlN:function(e,t){var n=Shopware.Filter,i=Shopware.Utils.format.currency;n.register("payone_currency",(function(e,t,n,a){return null===e?"-":(n||(n=0),e/=Math.pow(10,n),i(e,t,a))}))},YvZz:function(e,t,n){var i=n("35DV");i.__esModule&&(i=i.default),"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("SZ7m").default)("2ddd5d5e",i,!0,{})},bhoq:function(e,t,n){},"eI/6":function(e,t){function n(e){return n="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},n(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var i=0;i2&&void 0!==arguments[2]?arguments[2]:"payone_payment";return i(this,l),c.call(this,e,t,n)}return t=l,(n=[{key:"validateApiCredentials",value:function(e){var t=this.getBasicHeaders();return this.httpClient.post("_action/".concat(this.getApiBasePath(),"/validate-api-credentials"),{credentials:e},{headers:t}).then((function(e){return u.handleResponse(e)}))}},{key:"getStateMachineTransitionActions",value:function(){var e=this.getBasicHeaders();return this.httpClient.get("_action/".concat(this.getApiBasePath(),"/get-state-machine-transition-actions"),{headers:e}).then((function(e){return u.handleResponse(e)}))}},{key:"hasApplePayCert",value:function(){var e=this.getBasicHeaders();return this.httpClient.get("_action/".concat(this.getApiBasePath(),"/check-apple-pay-cert"),{headers:e}).catch((function(){return!1})).then((function(e){return!!e}))}}])&&a(t.prototype,n),s&&a(t,s),Object.defineProperty(t,"prototype",{writable:!1}),l}(u);l.addServiceProvider("PayonePaymentSettingsService",(function(e){var t=l.getContainer("init");return new d(t.httpClient,e.loginService)}))},n0Dh:function(e,t,n){},ne7N:function(e,t,n){var i=n("n0Dh");i.__esModule&&(i=i.default),"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("SZ7m").default)("948438e6",i,!0,{})},nxUl:function(e,t,n){},oUTl:function(e,t,n){var i=n("nxUl");i.__esModule&&(i=i.default),"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("SZ7m").default)("51cefd3f",i,!0,{})},vcYr:function(e,t){try{Shopware.Service("privileges").addPrivilegeMappingEntry({category:"additional_permissions",parent:null,key:"Payone",roles:{payone_order_management:{privileges:["order_transaction:update","order_line_item:update","state_machine_history:create",Shopware.Service("privileges").getPrivileges("order.viewer")],dependencies:[]}}})}catch(e){}},yhSi:function(e,t,n){"use strict";n.r(t);n("AGDI");Shopware.Component.register("payone-ratepay-profile-configurations",{template:"{% block payone_ratepay_profile_configurations %}\n
\n

{{ $tc('payone-payment.general.headlines.ratepayProfileConfigurations') }}

\n\n \n
\n{% endblock %}\n",inject:["PayonePaymentSettingsService"],props:{value:{type:Object,required:!1,default:function(){return{}}},name:{type:String,required:!0}},data:function(){return{isLoading:!1,configuration:this.value}},created:function(){this.createdComponent()},destroyed:function(){this.destroyedComponent()},computed:{profileConfigurations:function(){var e=this.name,t=[];for(var n in this.configuration){var i="",a="";switch(e){case"PayonePayment.settings.ratepayDebitProfileConfigurations":i=this.configuration[n]["tx-limit-elv-min"],a=this.configuration[n]["tx-limit-elv-max"];break;case"PayonePayment.settings.ratepayInstallmentProfileConfigurations":i=this.configuration[n]["tx-limit-installment-min"],a=this.configuration[n]["tx-limit-installment-max"];break;case"PayonePayment.settings.ratepayInvoicingProfileConfigurations":i=this.configuration[n]["tx-limit-invoice-min"],a=this.configuration[n]["tx-limit-invoice-max"];break;default:return}var o={shopId:n,shopCurrency:this.configuration[n].currency,invoiceCountry:this.configuration[n]["country-code-billing"],shippingCountry:this.configuration[n]["country-code-delivery"],minBasket:i,maxBasket:a};t.push(o)}return t}},methods:{createdComponent:function(){this.$root.$on("payone-ratepay-profiles-update-result",this.onProfilesUpdateResult),console.log(this.configuration)},destroyedComponent:function(){this.$root.$off("payone-ratepay-profiles-update-result")},onProfilesUpdateResult:function(e){e.updates[this.name]&&(this.configuration=e.updates[this.name])}}});n("oUTl");function i(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return a(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,s=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){c=!0,r=e},f:function(){try{s||null==n.return||n.return()}finally{if(c)throw r}}}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n\n {% block payone_ratepay_shop_ids %}\n

{{ $tc(\'payone-payment.general.headlines.ratepayProfiles\') }}

\n \n\n {% block payone_ratepay_shop_ids_actions %}\n \n\n {% block payone_ratepay_shop_ids_create_actions %}\n
\n \n {{ $tc(\'payone-payment.general.actions.addShop\') }}\n \n
\n {% endblock %}\n
\n {% endblock %}\n\n {% block payone_ratepay_shop_ids_grid %}\n \n {% block payone_ratepay_shop_ids_grid_columns %}\n {% block payone_ratepay_shop_ids_grid_column_status %}\n \n {% endblock %}\n\n {% block payone_ratepay_shop_ids_bulk_actions %}\n \n {% endblock %}\n {% endblock %}\n \n {% endblock %}\n\n {% block payone_ratepay_shop_ids_error %}\n \n {{ $tc(\'payone-payment.general.errors.existingShopId\') }}\n \n\n \n {{ $tc(\'payone-payment.general.errors.emptyInputs\') }}\n \n {% endblock %}\n
\n {% endblock %}\n
\n{% endblock %}\n',props:{value:{type:Array,required:!1,default:function(){return[]}},name:{type:String,required:!0}},data:function(){return{selectedItems:{},newItem:null,showDuplicateAlert:!1,showEmptyAlert:!1,profiles:this.value}},computed:{getLineItemColumns:function(){return[{property:"shopId",dataIndex:"shopId",label:this.$tc("payone-payment.general.label.shopId"),allowResize:!1,inlineEdit:"string",width:"200px",primary:!0},{property:"currency",dataIndex:"currency",label:this.$tc("payone-payment.general.label.currency"),allowResize:!1,inlineEdit:"string",width:"200px",primary:!0},{property:"error",label:this.$tc("payone-payment.general.label.error"),allowResize:!1,width:"100px",primary:!0}]}},watch:{profiles:function(e){this.$emit("input",e),this.$emit("change",e)}},created:function(){this.createdComponent()},destroyed:function(){this.destroyedComponent()},methods:{createdComponent:function(){this.$root.$on("payone-ratepay-profiles-update-result",this.onProfilesUpdateResult)},destroyedComponent:function(){this.$root.$off("payone-ratepay-profiles-update-result")},onProfilesUpdateResult:function(e){if(e.updates[this.name]&&(this.profiles=e.updates[this.name]),e.errors[this.name]){var t,n=i(e.errors[this.name]);try{for(n.s();!(t=n.n()).done;){var a=t.value;this.profiles.push(a)}}catch(e){n.e(e)}finally{n.f()}}},onInlineEditCancel:function(e){""===e.shopId&&""===e.currency&&this.profiles.forEach((function(t,n,i){t.id===e.id&&i.splice(n,1)})),this.$emit("item-cancel")},onInlineEditSave:function(e){var t=this;if(""!==e.shopId&&""!==e.currency){this.showEmptyAlert=!1;var n=!1;this.profiles.forEach((function(t){t.id!==e.id&&t.shopId===e.shopId&&(n=!0)})),n?(this.showDuplicateAlert=!0,this.$nextTick((function(){t.$refs.shopIdsDataGrid.currentInlineEditId=e.id,t.$refs.shopIdsDataGrid.enableInlineEdit()}))):this.showDuplicateAlert=!1}else this.showEmptyAlert=!0,this.$nextTick((function(){t.$refs.shopIdsDataGrid.currentInlineEditId=e.id,t.$refs.shopIdsDataGrid.enableInlineEdit()}));this.$emit("update-list",this.profiles)},createNewLineItem:function(){(0===this.profiles.length||""!==this.profiles[this.profiles.length-1].shopId)&&this.createLine()},createLine:function(){var e=this,t=s.createId();this.profiles.push({id:t,shopId:"",currency:""}),this.$nextTick((function(){e.$refs.shopIdsDataGrid.currentInlineEditId=t,e.$refs.shopIdsDataGrid.enableInlineEdit()}))},onDeleteSelectedItem:function(e){this.profiles=this.profiles.filter((function(t){return t.shopId!==e.shopId})),this.$emit("deleted",this.profiles)}}});n("I32p");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},c(e)}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function u(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==c(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!==c(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===c(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var d=Shopware,p=d.Component,f=d.Mixin;d.Context;p.register("payone-capture-button",{template:'{% block payone_payment_payment_details %}\n
\n \n \n {{ $tc(\'payone-payment.capture.buttonTitle\') }}\n \n \n\n \n \n \n\n
\n \n \n \n \n \n \n
\n\n \n
\n
\n{% endblock %}\n',mixins:[f.getByName("notification")],inject:["PayonePaymentService","repositoryFactory"],props:{order:{type:Object,required:!0},transaction:{type:Object,required:!0}},computed:{decimalPrecision:function(){return this.order&&this.order.currency?this.order.currency.decimalPrecision?this.order.currency.decimalPrecision:this.order.currency.itemRounding?this.order.currency.itemRounding.decimals:void 0:2},totalTransactionAmount:function(){return Math.round(this.transaction.amount.totalPrice*Math.pow(10,this.decimalPrecision),0)},capturedAmount:function(){return this.transaction.extensions&&this.transaction.extensions.payonePaymentOrderTransactionData&&this.transaction.extensions.payonePaymentOrderTransactionData.capturedAmount?this.transaction.extensions.payonePaymentOrderTransactionData.capturedAmount:0},remainingAmount:function(){return this.totalTransactionAmount-this.capturedAmount},maxCaptureAmount:function(){return this.remainingAmount/Math.pow(10,this.decimalPrecision)},buttonEnabled:function(){return!(!this.transaction.extensions||!this.transaction.extensions.payonePaymentOrderTransactionData)&&(this.remainingAmount>0&&this.capturedAmount>0||this.transaction.extensions.payonePaymentOrderTransactionData.allowCapture)},isItemSelected:function(){var e=!1;return this.selection.forEach((function(t){t.selected&&(e=!0)})),e},hasRemainingShippingCosts:function(){var e=this;if(this.order.shippingCosts.totalPrice<=0)return!1;var t=this.order.shippingCosts.totalPrice*Math.pow(10,this.decimalPrecision),n=0;return this.order.lineItems.forEach((function(t){t.customFields&&t.customFields.payone_captured_quantity&&0=t)}},data:function(){return{isLoading:!1,hasError:!1,showCaptureModal:!1,isCaptureSuccessful:!1,selection:[],captureAmount:0,includeShippingCosts:!1}},methods:{calculateCaptureAmount:function(){var e=0;this.selection.forEach((function(t){t.selected&&(e+=t.unit_price*t.quantity)})),e>this.remainingAmount&&(e=this.remainingAmount),this.captureAmount=e},openCaptureModal:function(){this.showCaptureModal=!0,this.isCaptureSuccessful=!1,this.selection=[]},closeCaptureModal:function(){this.showCaptureModal=!1},onCaptureFinished:function(){this.isCaptureSuccessful=!1},captureOrder:function(){var e=this,t={orderTransactionId:this.transaction.id,payone_order_id:this.transaction.extensions.payonePaymentOrderTransactionData.transactionId,salesChannel:this.order.salesChannel,amount:this.captureAmount,orderLines:[],complete:this.captureAmount===this.remainingAmount,includeShippingCosts:!1};this.isLoading=!0,this.selection.forEach((function(n){e.order.lineItems.forEach((function(e){if(e.id===n.id&&n.selected&&00&&this.selection.push({id:"shipping",quantity:1,unit_price:this.order.shippingCosts.totalPrice,selected:!1})}}});n("4oQF");function m(e){return m="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},m(e)}function y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function h(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==m(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!==m(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===m(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var g=Shopware,b=g.Component,v=g.Mixin;b.register("payone-refund-button",{template:'{% block payone_payment_payment_details %}\n
\n \n \n {{ $tc(\'payone-payment.refund.buttonTitle\') }}\n \n \n\n \n \n \n\n
\n \n \n \n \n \n \n
\n\n \n
\n
\n{% endblock %}\n',mixins:[v.getByName("notification")],inject:["PayonePaymentService"],props:{order:{type:Object,required:!0},transaction:{type:Object,required:!0}},data:function(){return{isLoading:!1,hasError:!1,showRefundModal:!1,isRefundSuccessful:!1,selection:[],refundAmount:0,includeShippingCosts:!1}},computed:{decimalPrecision:function(){return this.order&&this.order.currency?this.order.currency.decimalPrecision?this.order.currency.decimalPrecision:this.order.currency.itemRounding?this.order.currency.itemRounding.decimals:void 0:2},remainingAmount:function(){return this.transaction.extensions&&this.transaction.extensions.payonePaymentOrderTransactionData&&this.transaction.extensions.payonePaymentOrderTransactionData.capturedAmount?this.transaction.extensions.payonePaymentOrderTransactionData.capturedAmount-this.refundedAmount:0},refundedAmount:function(){return this.transaction.extensions&&this.transaction.extensions.payonePaymentOrderTransactionData&&!this.transaction.extensions.payonePaymentOrderTransactionData.refundedAmount?this.transaction.extensions.payonePaymentOrderTransactionData.refundedAmount:0},maxRefundAmount:function(){return this.remainingAmount/Math.pow(10,this.decimalPrecision)},buttonEnabled:function(){return!(!this.transaction.extensions||!this.transaction.extensions.payonePaymentOrderTransactionData)&&(this.remainingAmount>0&&this.refundedAmount>0||this.transaction.extensions.payonePaymentOrderTransactionData.allowRefund)},hasRemainingRefundableShippingCosts:function(){var e=this;if(this.order.shippingCosts.totalPrice<=0)return!1;var t=this.order.shippingCosts.totalPrice*Math.pow(10,this.decimalPrecision),n=0;return this.order.lineItems.forEach((function(t){t.customFields&&t.customFields.payone_refunded_quantity&&0=t)}},methods:{calculateRefundAmount:function(){var e=0;this.selection.forEach((function(t){t.selected&&(e+=t.unit_price*t.quantity)})),Math.round(e*Math.pow(10,this.decimalPrecision)>this.remainingAmount)&&(e=this.remainingAmount/Math.pow(10,this.decimalPrecision)),this.refundAmount=e},openRefundModal:function(){this.showRefundModal=!0,this.isRefundSuccessful=!1,this.selection=[]},closeRefundModal:function(){this.showRefundModal=!1},onRefundFinished:function(){this.isRefundSuccessful=!1},refundOrder:function(){var e=this,t={orderTransactionId:this.transaction.id,payone_order_id:this.transaction.extensions.payonePaymentOrderTransactionData.transactionId,salesChannel:this.order.salesChannel,amount:this.refundAmount,orderLines:[],complete:this.refundAmount===this.maxRefundAmount,includeShippingCosts:!1};this.isLoading=!0,this.selection.forEach((function(n){e.order.lineItems.forEach((function(i){if(i.id===n.id&&n.selected&&00&&this.selection.push({id:"shipping",quantity:1,unit_price:this.order.shippingCosts.totalPrice,selected:!1})}}});n("YvZz");Shopware.Component.register("payone-order-items",{template:'{% block payone_payment_details %}\n
\n \n\n \n\n \n\n \n \n
\n{% endblock %}\n',props:{order:{type:Object,required:!0},mode:{type:String,required:!1}},computed:{orderItems:function(){var e=this,t=[];return this.order.lineItems.forEach((function(n){var i=e.$options.filters.currency(n.totalPrice,e.order.currency.shortName,e.order.decimal_precision),a=!1,o=n.quantity;n.customFields&&("refund"===e.mode?(n.customFields.payone_captured_quantity&&0>n.customFields.payone_captured_quantity&&(o=n.customFields.payone_captured_quantity),n.customFields.payone_refunded_quantity&&(o-=n.customFields.payone_refunded_quantity)):"capture"===e.mode&&n.customFields.payone_captured_quantity&&0o&&(a=!0),t.push({id:n.id,product:n.label,quantity:o,disabled:a,selected:!1,price:i,orderItem:n})})),this.order.shippingCosts.totalPrice>0&&t.push({id:"shipping",product:this.$tc("payone-payment.modal.shippingCosts"),quantity:1,disabled:!1,selected:!1,price:this.$options.filters.currency(this.order.shippingCosts.totalPrice,this.order.currency.shortName,this.order.decimal_precision),orderItem:{}}),t},orderItemColumns:function(){return[{property:"product",label:this.$tc("payone-payment.modal.columns.product"),rawData:!0},{property:"quantity",label:this.$tc("payone-payment.modal.columns.quantity"),rawData:!0},{property:"price",label:this.$tc("payone-payment.modal.columns.price"),rawData:!0}]}},methods:{onSelectItem:function(e,t,n){this.$emit("select-item",t.id,n)},onChangeQuantity:function(e,t){this.$emit("change-quantity",t,e)}}});Shopware.Component.extend("payone-data-grid","sw-data-grid",{template:'{% block sw_data_grid_select_item_checkbox %}\n \n \n\n \n \n{% endblock %}\n'});n("B7Qk");Shopware.Component.register("payone-payment-plugin-icon",{template:'{% block payone_payment_plugin_icon %}\n \n{% endblock %}\n'});n("RLQU");var _=Shopware,P=_.Component,w=_.Mixin,S=Shopware.Utils,k=S.object,A=S.types;P.register("payone-settings",{template:'{% block payone_payment %}\n\n {% block payone_payment_header %}\n \n {% endblock %}\n\n {% block payone_payment_actions %}\n \n {% endblock %}\n\n {% block payone_payment_settings_content %}\n \n {% endblock %}\n\n{% endblock %}\n',mixins:[w.getByName("notification"),w.getByName("sw-inline-snippet")],inject:["PayonePaymentSettingsService"],data:function(){return{isLoading:!1,isTesting:!1,isSaveSuccessful:!1,isTestSuccessful:!1,isApplePayCertConfigured:!0,config:{},merchantIdFilled:!1,accountIdFilled:!1,portalIdFilled:!1,portalKeyFilled:!1,showValidationErrors:!1,isSupportModalOpen:!1,stateMachineTransitionActions:[],displayStatusMapping:{},collapsibleState:{status_mapping:!0,payment_credit_card:!0,payment_paypal:!0,payment_paypal_express:!0,payment_debit:!0,payment_sofort:!0,payment_payolution_installment:!0,payment_payolution_invoicing:!0,payment_payolution_debit:!0,payment_eps:!0,payment_ideal:!0,payment_paydirekt:!0,payment_prepayment:!0,payment_trustly:!0,payment_secure_invoice:!0,payment_open_invoice:!0,payment_apple_pay:!0,payment_bancontact:!0,payment_ratepay_debit:!0,payment_ratepay_installment:!0,payment_ratepay_invoicing:!0,payment_klarna_invoice:!0,payment_klarna_direct_debit:!0,payment_klarna_installment:!0,payment_przelewy24:!0,payment_we_chat_pay:!0,payment_postfinanceCard:!0,payment_postfinanceWallet:!0,payment_alipay:!0,payment_secured_invoice:!0,payment_secured_installment:!0,payment_secured_direct_debit:!0}}},created:function(){this.createdComponent()},computed:{credentialsMissing:function(){return!(this.merchantIdFilled&&this.accountIdFilled&&this.portalIdFilled&&this.portalKeyFilled)}},metaInfo:function(){return{title:this.$createTitle()}},methods:{createdComponent:function(){var e=this,t=this;this.PayonePaymentSettingsService.getStateMachineTransitionActions().then((function(e){e.data.forEach((function(e){var n="payone-payment.transitionActionNames."+e.label,i=t.$t(n);i===n&&(i=e.label),t.stateMachineTransitionActions.push({label:i,value:e.value})}))})),this.PayonePaymentSettingsService.hasApplePayCert().then((function(t){e.isApplePayCertConfigured=t}))},paymentMethodPrefixes:function(){return["creditCard","debit","paypal","paypalExpress","payolutionInvoicing","payolutionInstallment","payolutionDebit","sofort","eps","iDeal","paydirekt","prepayment","trustly","secureInvoice","openInvoice","applePay","bancontact","ratepayDebit","ratepayInstallment","ratepayInvoicing","klarnaInvoice","klarnaDirectDebit","klarnaInstallment","przelewy24","weChatPay","postfinanceCard","postfinanceWallet","alipay","securedInvoice","securedInstallment","securedDirectDebit"]},isVisiblePaymentMethodCard:function(e){return e.name.startsWith("payment")&&!this.isCollapsed(e)},isCollapsible:function(e){return e.name in this.collapsibleState},displayField:function(e,t,n){return!(n.name in this.collapsibleState)||!this.collapsibleState[n.name]},isCollapsed:function(e){return this.collapsibleState[e.name]},toggleCollapsible:function(e){e.name in this.collapsibleState&&(this.collapsibleState[e.name]=!this.collapsibleState[e.name])},saveFinish:function(){this.isSaveSuccessful=!1},testFinish:function(){this.isTestSuccessful=!1},onConfigChange:function(e){this.config=e,this.checkCredentialsFilled(),this.showValidationErrors=!1},checkCredentialsFilled:function(){this.merchantIdFilled=!!this.getConfigValue("merchantId"),this.accountIdFilled=!!this.getConfigValue("accountId"),this.portalIdFilled=!!this.getConfigValue("portalId"),this.portalKeyFilled=!!this.getConfigValue("portalKey")},getConfigValue:function(e){var t=this.$refs.systemConfig.actualConfigData.null;return null===this.$refs.systemConfig.currentSalesChannelId?this.config["PayonePayment.settings.".concat(e)]:this.config["PayonePayment.settings.".concat(e)]||t["PayonePayment.settings.".concat(e)]},getPaymentConfigValue:function(e,t){var n=e.charAt(0).toUpperCase()+e.slice(1);return this.getConfigValue(t+n)||this.getConfigValue(e)},onSave:function(){var e=this;this.credentialsMissing?this.showValidationErrors=!0:(this.isSaveSuccessful=!1,this.isLoading=!0,this.$refs.systemConfig.saveAll().then((function(t){e.handleRatepayProfileUpdates(t),e.isLoading=!1,e.isSaveSuccessful=!0})).catch((function(){e.isLoading=!1})))},onTest:function(){var e=this;this.isTesting=!0,this.isTestSuccessful=!1;var t={};this.paymentMethodPrefixes().forEach((function(n){t[n]={merchantId:e.getPaymentConfigValue("merchantId",n),accountId:e.getPaymentConfigValue("accountId",n),portalId:e.getPaymentConfigValue("portalId",n),portalKey:e.getPaymentConfigValue("portalKey",n)}})),this.PayonePaymentSettingsService.validateApiCredentials(t).then((function(t){var n=t.testCount,i=t.credentialsValid,a=t.errors;if(i)e.createNotificationSuccess({title:e.$tc("payone-payment.settingsForm.titleSuccess"),message:n>0?e.$tc("payone-payment.settingsForm.messageTestSuccess"):e.$tc("payone-payment.settingsForm.messageTestNoTestedPayments")}),e.isTestSuccessful=!0;else for(var o in a)if(a.hasOwnProperty(o)){e.createNotificationError({title:e.$tc("payone-payment.settingsForm.titleError"),message:e.$tc("payone-payment.settingsForm.messageTestError."+o)});var r=a[o];"string"==typeof r&&e.createNotificationError({title:e.$tc("payone-payment.settingsForm.titleError"),message:r})}e.isTesting=!1})).catch((function(t){e.createNotificationError({title:e.$tc("payone-payment.settingsForm.titleError"),message:e.$tc("payone-payment.settingsForm.messageTestError.general")}),e.isTesting=!1}))},getBind:function(e,t){var n;return t!==this.config&&(this.config=t),this.showValidationErrors&&("PayonePayment.settings.merchantId"!==e.name||this.merchantIdFilled||(e.config.error={code:1,detail:this.$tc("payone-payment.messageNotBlank")}),"PayonePayment.settings.accountId"!==e.name||this.accountIdFilled||(e.config.error={code:1,detail:this.$tc("payone-payment.messageNotBlank")}),"PayonePayment.settings.portalId"!==e.name||this.portalIdFilled||(e.config.error={code:1,detail:this.$tc("payone-payment.messageNotBlank")}),"PayonePayment.settings.portalKey"!==e.name||this.portalKeyFilled||(e.config.error={code:1,detail:this.$tc("payone-payment.messageNotBlank")})),this.$refs.systemConfig.config.forEach((function(t){t.elements.forEach((function(t){t.name!==e.name||(n=t)}))})),n||e},getElementBind:function(e){var t=k.deepCopyObject(e);return null!==this.currentSalesChannelId&&this.inherit&&this.actualConfigData.hasOwnProperty("null")&&null!==this.actualConfigData.null[t.name]&&("single-select"===t.type||"sw-entity-single-select"===t.config.componentName?t.placeholder=this.$tc("sw-settings.system-config.inherited"):"bool"===t.type?t.config.inheritedValue=this.actualConfigData.null[t.name]||!1:"password"===t.type?(t.placeholderIsPassword=!0,t.placeholder="".concat(this.actualConfigData.null[t.name])):"multi-select"===t.type||A.isUndefined(this.actualConfigData.null[t.name])||(t.placeholder="".concat(this.actualConfigData.null[t.name]))),["single-select","multi-select"].includes(t.type)&&(t.config.labelProperty="name",t.config.valueProperty="id"),t},handleRatepayProfileUpdates:function(e){var t=this.$refs.systemConfig.currentSalesChannelId;if(e.payoneRatepayProfilesUpdateResult&&e.payoneRatepayProfilesUpdateResult[t]){var n=e.payoneRatepayProfilesUpdateResult[t];this.$root.$emit("payone-ratepay-profiles-update-result",n),Array.isArray(n.errors)||this.createNotificationError({title:this.$tc("payone-payment.settingsForm.titleError"),message:this.$tc("payone-payment.settingsForm.messageSaveError.ratepayProfilesUpdateFailed")})}}}});n("ne7N");var C=Shopware,I=C.Component,T=C.Mixin,E=Shopware.Data.Criteria;I.override("sw-order-detail-base",{template:'{% block sw_order_detail_delivery_metadata %}\n {% parent %}\n\n \n{% endblock %}\n',inject:["PayonePaymentService","repositoryFactory","acl"],mixins:[T.getByName("notification")],data:function(){return{disableButtons:!1,notificationForwards:null}},computed:{payoneTransactions:function(){var e=this;return this.order.transactions.filter((function(t){return e.isPayoneTransaction(t)})).sort((function(e,t){return e.createdAtt.createdAt?-1:0}))},notificationForwardRepository:function(){return this.repositoryFactory.create("payone_payment_notification_forward")},notificationTargetColumns:function(){return[{property:"txaction",type:"text",width:"100px"},{property:"notificationTarget.url",type:"text"},{property:"response",width:"100px"},{property:"updatedAt",align:"right",type:"date"}]}},methods:{requeue:function(e,t){var n=this,i={notificationForwardId:e.id};this.PayonePaymentService.requeueNotificationForward(i).then((function(){n.createNotificationSuccess({title:n.$tc("payonePayment.notificationTarget.actions.requeue"),message:n.$tc("payonePayment.notificationTarget.messages.success")}),n.getNotificationForwards(t)})).catch((function(e){n.createNotificationError({title:n.$tc("payonePayment.notificationTarget.actions.requeue"),message:e.message})})).finally((function(){n.$nextTick().then((function(){n.$emit("reload")}))}))},isPayoneTransaction:function(e){return!!(e.extensions&&e.extensions.payonePaymentOrderTransactionData&&e.extensions.payonePaymentOrderTransactionData.transactionId)&&e.extensions.payonePaymentOrderTransactionData.transactionId},hasNotificationForwards:function(e){return null===this.notificationForwards?(this.getNotificationForwards(e),!1):!(this.notificationForwards.length<=0)},getNotificationForwards:function(e){var t=this,n=new E;return n.addAssociation("notificationTarget"),n.addSorting(E.sort("updatedAt","DESC",!0)),n.addFilter(E.equals("transactionId",e.id)),n.setLimit(500),this.notificationForwardRepository.search(n,Shopware.Context.api).then((function(e){t.notificationForwards=e}))},can:function(e){try{return this.acl.can(e)}catch(e){return!0}},isActiveTransaction:function(e){return"cancelled"!==e.stateMachineState.technicalName},hasPayoneTransaction:function(e){var t=this,n=!1;return!!e.transactions&&(e.transactions.map((function(e){t.isPayoneTransaction(e)&&t.isActiveTransaction(e)&&(n=!0)})),n)}}});n("ynXU");var O=Shopware.Component,x=Shopware.Context.app.config.version.match(/((\d+)\.?(\d+?)\.?(\d+)?\.?(\d*))-?([A-z]+?\d+)?/i);x&&6===parseInt(x[2])&&parseInt(x[3])<4&&O.override("sw-settings-index",{template:'{% block sw_settings_content_card_slot_plugins %}\n {% parent %}\n\n \n \n \n{% endblock %}\n'});n("WrlN");var N=n("WFC+"),D=n("GRpm"),$=Shopware.Module,R={type:"plugin",name:"PayonePayment",title:"payone-payment.general.mainMenuItemGeneral",description:"payone-payment.general.descriptionTextModule",version:"1.0.0",targetVersion:"1.0.0",icon:"default-action-settings",snippets:{"de-DE":N,"en-GB":D},routeMiddleware:function(e,t){e(t)},routes:{index:{component:"payone-settings",path:"index",meta:{parentPath:"sw.settings.index"}}}},M=Shopware.Context.app.config.version.match(/((\d+)\.?(\d+?)\.?(\d+)?\.?(\d*))-?([A-z]+?\d+)?/i);M&&6===parseInt(M[2])&&parseInt(M[3])>3&&(R.settingsItem=[{name:"payone-payment",to:"payone.payment.index",label:"payone-payment.general.mainMenuItemGeneral",group:"plugins",iconComponent:"payone-payment-plugin-icon",backgroundEnabled:!1}]),$.register("payone-payment",R);function F(e){return F="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},F(e)}function q(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function B(e){for(var t=1;t\n\n {% block payone_notification_target_list_smart_bar_header %}\n \n {% endblock %}\n\n {% block payone_notification_target_list_actions %}\n \n {% endblock %}\n\n {% block payone_notification_target_list_content %}\n \n {% endblock %}\n\n {% block payone_notification_target_list_sidebar %}\n \n {% endblock %}\n \n{% endblock %}\n',inject:["repositoryFactory"],mixins:[Z.getByName("listing")],data:function(){return{isLoading:!1,items:null,sortBy:"createdAt",criteriaLimit:500,criteriaPage:1,limit:500}},metaInfo:function(){return{title:this.$createTitle()}},computed:{notificationTargetColumns:function(){return[{dataIndex:"url",property:"url",label:"payonePayment.notificationTarget.columns.url",primary:!0},{dataIndex:"isBasicAuth",property:"isBasicAuth",label:"payonePayment.notificationTarget.columns.isBasicAuth"},{property:"txactions",label:"payonePayment.notificationTarget.columns.txactions"}]},repository:function(){return this.repositoryFactory.create("payone_payment_notification_target")},criteria:function(){var e=new z(this.criteriaPage,this.criteriaLimit);return e}},created:function(){this.createdComponent()},methods:{renderTxactions:function(e){return null!==e&&e.length?e.join(", "):""},createdComponent:function(){this.getList()},getList:function(){var e=this;this.isLoading=!0;var t=B(B({},Shopware.Context.api),{},{inheritance:!0});return this.repository.search(this.criteria,t).then((function(t){e.total=t.total,e.items=t,e.isLoading=!1}))},onDelete:function(e){this.$refs.listing.deleteItem(e),this.getList()}}});var U=Shopware,K=U.Component,G=U.Mixin;U.Data.Criteria;K.register("payone-notification-target-detail",{template:'{% block payone_notification_target_detail %}\n \n\n {% block payone_notification_target_detail_header %}\n \n {% endblock %}\n\n {% block payone_notification_target_detail_actions %}\n \n {% endblock %}\n\n {% block payone_notification_target_detail_content %}\n \n\n {% block payone_notification_target_detail_base_basic_info_card %}\n \n \n \n {% endblock %}\n \n {% endblock %}\n\n \n{% endblock %}\n',inject:["repositoryFactory"],mixins:[G.getByName("notification")],shortcuts:{"SYSTEMKEY+S":"onSave",ESCAPE:"onCancel"},props:{notificationTargetId:{type:String,required:!1,default:null}},data:function(){return{notificationTarget:null,isLoading:!1,isSaveSuccessful:!1}},metaInfo:function(){return{title:this.$createTitle(this.identifier)}},computed:{notificationTargetIsLoading:function(){return this.isLoading||null==this.notificationTarget},notificationTargetRepository:function(){return this.repositoryFactory.create("payone_payment_notification_target")}},watch:{notificationTargetId:function(){this.createdComponent()}},created:function(){this.createdComponent()},methods:{updateSelection:function(e){this.notificationTarget.txactions=e},createdComponent:function(){this.notificationTargetId?this.loadEntityData():(Shopware.State.commit("context/resetLanguageToDefault"),this.notificationTarget=this.notificationTargetRepository.create(Shopware.Context.api))},loadEntityData:function(){var e=this;this.isLoading=!0,this.notificationTargetRepository.get(this.notificationTargetId,Shopware.Context.api).then((function(t){e.isLoading=!1,e.notificationTarget=t,null!==t.txactions&&(t.txactions.length||(e.notificationTarget.txactions=null))}))},isInvalid:function(){return!0===this.notificationTarget.isBasicAuth&&((!this.notificationTarget.username||!this.notificationTarget.password)&&(this.createNotificationError({message:this.$tc("global.notification.notificationSaveErrorMessageRequiredFieldsInvalid")}),!0))},onSave:function(){var e=this;this.isInvalid()||(this.isLoading=!0,this.notificationTargetRepository.save(this.notificationTarget,Shopware.Context.api).then((function(){e.isLoading=!1,e.isSaveSuccessful=!0,null!==e.notificationTargetId?e.loadEntityData():e.$router.push({name:"payone.notification.target.detail",params:{id:e.notificationTarget.id}})})).catch((function(t){throw e.isLoading=!1,e.createNotificationError({message:e.$tc("global.notification.notificationSaveErrorMessageRequiredFieldsInvalid")}),t})))},onCancel:function(){this.$router.push({name:"payone.notification.target.list"})}}});var V=n("0GMb"),W=n("HmBb");Shopware.Module.register("payone-notification-target",{type:"plugin",name:"PayoneNotificationTarget",title:"payonePayment.notificationTarget.module.title",description:"payonePayment.notificationTarget.module.title",color:"#3596d6",icon:"default-shopping-paper-bag-product",snippets:{"de-DE":V,"en-GB":W},routes:{list:{component:"payone-notification-target-list",path:"list"},detail:{component:"payone-notification-target-detail",path:"detail/:id",props:{default:function(e){return{notificationTargetId:e.params.id}}},meta:{parentPath:"payone.notification.target.list"}},create:{component:"payone-notification-target-detail",path:"create",meta:{parentPath:"payone.notification.target.list"}}}});Shopware.Component.override("sw-order-user-card",{template:"{% block sw_order_detail_base_secondary_info_payment %}\n \n{% endblock %}",computed:{payoneCardType:function(){var e,t,n=null===(e=this.currentOrder.transactions.last().extensions.payonePaymentOrderTransactionData)||void 0===e||null===(t=e.additionalData)||void 0===t?void 0:t.card_type;return n?this.$tc("sw-order.payone-payment.creditCard.cardTypes."+n):null}}});n("Hh0+"),n("eI/6"),n("vcYr")},ynXU:function(e,t,n){var i=n("7RQK");i.__esModule&&(i=i.default),"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("SZ7m").default)("3064ff42",i,!0,{})}}); \ No newline at end of file +!function(e){var t={};function n(i){if(t[i])return t[i].exports;var a=t[i]={i:i,l:!1,exports:{}};return e[i].call(a.exports,a,a.exports,n),a.l=!0,a.exports}n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(i,a,function(t){return e[t]}.bind(null,a));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p=(window.__sw__.assetPath + '/bundles/payonepayment/'),n(n.s="UwmX")}({"0sf7":function(e,t,n){var i=n("mi8M");i.__esModule&&(i=i.default),"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("ydqr").default)("e88d0166",i,!0,{})},"2a1E":function(e,t){function n(e){return(n="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 i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var i=0;i2&&void 0!==arguments[2]?arguments[2]:"payone";return i(this,l),c.call(this,e,t,n)}return t=l,(n=[{key:"requeueNotificationForward",value:function(e){var t="_action/".concat(this.getApiBasePath(),"/requeue-forward");return this.httpClient.post(t,e,{headers:this.getBasicHeaders()}).then((function(e){return u.handleResponse(e)}))}},{key:"capturePayment",value:function(e){var t="_action/".concat(this.getApiBasePath(),"/capture-payment");return this.httpClient.post(t,e,{headers:this.getBasicHeaders()}).then((function(e){return u.handleResponse(e)}))}},{key:"refundPayment",value:function(e){var t="_action/".concat(this.getApiBasePath(),"/refund-payment");return this.httpClient.post(t,e,{headers:this.getBasicHeaders()}).then((function(e){return u.handleResponse(e)}))}}])&&a(t.prototype,n),s&&a(t,s),Object.defineProperty(t,"prototype",{writable:!1}),l}(u);l.addServiceProvider("PayonePaymentService",(function(e){var t=l.getContainer("init");return new d(t.httpClient,e.loginService)}))},"2tSu":function(e,t,n){var i=n("bWZA");i.__esModule&&(i=i.default),"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("ydqr").default)("47b1d2d6",i,!0,{})},"6PZk":function(e,t){try{Shopware.Service("privileges").addPrivilegeMappingEntry({category:"additional_permissions",parent:null,key:"Payone",roles:{payone_order_management:{privileges:["order_transaction:update","order_line_item:update","state_machine_history:create",Shopware.Service("privileges").getPrivileges("order.viewer")],dependencies:[]}}})}catch(e){}},CBo4:function(e,t,n){},CY1O:function(e){e.exports=JSON.parse('{"payone-payment":{"title":"PAYONE","general":{"mainMenuItemGeneral":"PAYONE","descriptionTextModule":"Einstellungen für PAYONE","headlines":{"ratepayProfiles":"Profile","ratepayProfileConfigurations":"Profil-Konfigurationen"},"label":{"shopId":"Shop-ID","currency":"Währung","error":"Status","invoiceCountry":"Rechnungsland","shippingCountry":"Lieferland","minBasket":"Min. Warenkorb","maxBasket":"Max. Warenkorb","reloadConfigBtn":"Profil-Konfiguration neu laden","reloadConfigInfo":"(Änderungen an der Plugin-Konfiguration werden dabei zuerst gespeichert)"},"actions":{"addShop":"Shop-ID hinzufügen"},"errors":{"existingShopId":"Die eingegebene ShopId existiert bereits.","emptyInputs":"Bitte füllen Sie alle Eingabefelder aus."}},"capture":{"buttonTitle":"Capture","successTitle":"PAYONE","successMessage":"Capture erfolgreich durchgeführt.","errorTitle":"PAYONE","errorMessage":"Capture konnte nicht durchgeführt werden.","tooltips":{"impossible":"Einzug unmöglich"}},"refund":{"buttonTitle":"Refund","successTitle":"PAYONE","successMessage":"Refund erfolgreich durchgeführt.","errorTitle":"PAYONE","errorMessage":"Refund konnte nicht durchgeführt werden.","tooltips":{"impossible":"Erstattung unmöglich"}},"modal":{"capture":{"title":"Einzug","submit":"Einziehen","fullSubmit":"Alles Einziehen","amount":"Einzugswert","captured":"Eingezogener Wert"},"refund":{"title":"Erstattung","submit":"Erstatten","fullSubmit":"Alles Erstatten","amount":"Erstattungswert","refunded":"Erstatteter Wert"},"close":"Schließen","orderAmount":"Bestellungswert","remainingAmount":"Ausstehender Wert","shippingCosts":"Versandkosten","labelComment":"Label comment","descriptionHelpText":"Description help text","columns":{"reference":"Referenz","product":"Produkt","quantity":"Anzahl","price":"Preis"}},"settingsForm":{"save":"Speichern","test":"API-Zugangsdaten testen","titleSuccess":"Erfolg","titleError":"Fehler","labelShowSpecificStatusMapping":"Statusmappingkonfiguration einblenden","helpTextShowSpecificStatusMapping":"Sie können für jede Zahlungsart ein spezifisches Statusmapping konfigurieren. Existiert eine solche Konfiguration nicht, wird auf die allgemeine Konfiguration zurückgegriffen.","messageSaveError":{"ratepayProfilesUpdateFailed":"Mindestens ein Ratepay Profil konnte nicht erfolgreich gespeichert werden, bitte prüfen Sie Ihre Konfiguration."},"messageTestSuccess":"Die API-Zugangsdaten wurden erfolgreich validiert.","messageTestNoTestedPayments":"Bei der Prüfung wurden keine Zahlarten getestet, weil keine der PAYONE Zahlarten aktiviert ist. Bitte aktivieren Sie mindestens eine PAYONE Zahlart unter Einstellungen --\x3e Shop --\x3e Zahlungsarten.","messageTestError":{"general":"Die API-Zugangsdaten konnten nicht validiert werden.","creditCard":"Die API-Zugangsdaten für PAYONE Kreditkarte sind nicht korrekt.","prepayment":"Die API-Zugangsdaten für PAYONE Vorkasse sind nicht korrekt.","debit":"Die API-Zugangsdaten für PAYONE Lastschrift sind nicht korrekt.","paypalExpress":"Die API-Zugangsdaten für PAYONE PayPal Express sind nicht korrekt.","paypal":"Die API-Zugangsdaten für PAYONE PayPal sind nicht korrekt.","payolutionInstallment":"Die API-Zugangsdaten für PAYONE Unzer Ratenkauf sind nicht korrekt.","payolutionInvoicing":"Die API-Zugangsdaten für PAYONE Unzer Rechnungskauf sind nicht korrekt.","payolutionDebit":"Die API-Zugangsdaten für PAYONE Unzer Lastschrift sind nicht korrekt.","sofort":"Die API-Zugangsdaten für PAYONE Sofort Überweisung sind nicht korrekt.","eps":"Die API-Zugangsdaten für PAYONE eps Überweisung sind nicht korrekt.","iDeal":"Die API-Zugangsdaten für PAYONE iDEAL sind nicht korrekt.","secureInvoice":"Die API-Zugangsdaten für PAYONE Gesicherter Rechnungskauf sind nicht korrekt.","openInvoice":"Die API-Zugangsdaten für PAYONE Rechnungskauf sind nicht korrekt.","paydirekt":"Die API-Zugangsdaten für PAYONE paydirekt sind nicht korrekt.","trustly":"Die API-Zugangsdaten für PAYONE Trustly sind nicht korrekt.","applePay":"Die API-Zugangsdaten für PAYONE Apple Pay sind nicht korrekt.","bancontact":"Die API-Zugangsdaten für PAYONE Bancontact sind nicht korrekt.","ratepayDebit":"Die API-Zugangsdaten für PAYONE Ratepay Lastschrift sind nicht korrekt.","ratepayInstallment":"Die API-Zugangsdaten für PAYONE Ratepay Ratenzahlung sind nicht korrekt.","ratepayInvoicing":"Die API-Zugangsdaten für PAYONE Ratepay Rechnungskauf sind nicht korrekt.","klarnaInvoice":"Die API-Zugangsdaten für PAYONE Klarna Rechnung sind nicht korrekt.","klarnaDirectDebit":"Die API-Zugangsdaten für PAYONE Klarna Sofort bezahlen sind nicht korrekt.","klarnaInstallment":"Die API-Zugangsdaten für PAYONE Klarna Ratenkauf sind nicht korrekt.","przelewy24":"Die API-Zugangsdaten für PAYONE Przelewy24 sind nicht korrekt.","weChatPay":"Die API-Zugangsdaten für PAYONE WeChat Pay sind nicht korrekt.","postfinanceCard":"Die API-Zugangsdaten für PAYONE Postfinance (Card) sind nicht korrekt.","postfinanceWallet":"Die API-Zugangsdaten für PAYONE Postfinance (Wallet) sind nicht korrekt.","alipay":"Die API-Zugangsdaten für PAYONE Alipay sind nicht korrekt.","securedInvoice":"Die API-Zugangsdaten für PAYONE Gesicherter Rechnungskauf sind nicht korrekt.","securedInstallment":"Die API-Zugangsdaten für PAYONE Gesicherter Ratenkauf sind nicht korrekt.","securedDirectDebit":"Die API-Zugangsdaten für PAYONE Gesicherte Lastschrift sind nicht korrekt."}},"supportModal":{"menuButton":"Support","title":"Wie können wir Ihnen helfen?","documentation":{"description":"Lesen Sie unsere Online-Dokumentation","button":"Dokumentation"},"support":{"description":"Kontaktieren Sie unseren Support","button":"Technischer Support"},"repository":{"description":"Melden Sie Fehler und Verbesserungen","button":"GitHub"},"testdata":{"description":"Erstellen Sie hier Ihre persönlichen Testdaten","button":"Testdaten"}},"applePay":{"cert":{"notification":"Für die Nutzung von ApplePay ist ein Zertifikat/Key-Paar zur Authentifizierung des Merchants erforderlich. Die Anlage eines solchen Zertifikats wird hier beschrieben:
\\n https://docs.payone.com/display/public/PLATFORM/Special+Remarks+-+Apple+Pay#SpecialRemarks-ApplePay-Onboarding

\\n\\n Erstellen Sie im Anschluss unter Verwendung des folgenden Befehls eine PEM-Datei des Zertifikates:
\\n
openssl x509 -inform der -in merchant_id.cer -out merchant_id.pem

\\n Hinterlegen Sie das Zertifikat (merchant_id.pem) und den Key (merchant_id.key) in folgendem Verzeichnis:
\\n
%shopwareRoot%/config/apple-pay-cert
"}},"transitionActionNames":{"cancel":"Stornieren","complete":"Abschließen","pay":"Bezahlen","pay_partially":"Teilweise bezahlen","process":"Durchführen","refund":"Rückerstatten","refund_partially":"Teilweise rückerstatten","remind":"Erinnern","reopen":"Wieder öffnen","retour":"Retoure","retour_partially":"Teilweise retounieren","ship":"Versenden","ship_partially":"Teilweise versenden"},"messageNotBlank":"Dieser Wert darf nicht leer sein.","txid":"TXID","sequenceNumber":{"label":"Sequenznummer","empty":"keine"},"transactionState":"Status","transactionCancelled":"Transaktion in Shopware abgebrochen","error":{"transaction":{"notFound":"Es wurde keine passende Transaktion gefundend","orderNotFound":"Es wurde keine passende Bestellung gefundend"}}},"sw-privileges":{"additional_permissions":{"Payone":{"label":"PAYONE","payone_order_management":"PAYONE Transaktionsmanagement"}}}}')},"F2L/":function(e,t,n){var i=n("I+7f");i.__esModule&&(i=i.default),"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("ydqr").default)("30402ea6",i,!0,{})},GmXf:function(e){e.exports=JSON.parse('{"payonePayment":{"notificationTarget":{"module":{"title":"Payone notification forward","buttonTitle":"Notifications"},"list":{"title":"Notification forward","empty":"No entries","buttonCreate":"Add new notification target"},"detail":{"headline":"Notification forward","placeholder":{"url":"Url","username":"Username","password":"Password"},"label":{"url":"Url","isBasicAuth":"Basic Auth","txactions":"txactions","buttonSave":"Save","buttonCancel":"Cancel","username":"Username","password":"Password"}},"columns":{"url":"Url","isBasicAuth":"Basic Auth","txactions":"txactions"},"actions":{"requeue":"Requeue"},"messages":{"success":"The notification forward has been successfully queued."}}}}')},GqT2:function(e){e.exports=JSON.parse('{"payone-payment":{"title":"PAYONE","general":{"mainMenuItemGeneral":"PAYONE","descriptionTextModule":"Settings for PAYONE","headlines":{"ratepayProfiles":"Profile","ratepayProfileConfigurations":"Profil-Konfigurationen"},"label":{"shopId":"Shop-ID","currency":"Currency","error":"Status","invoiceCountry":"Invoice Country","shippingCountry":"Shipping Country","minBasket":"Min. Basket","maxBasket":"Max. Basket","reloadConfigBtn":"Reload Profile Configuration","reloadConfigInfo":"(Plugin Configuration Changes will be saved first)"},"actions":{"addShop":"Add Shop-ID"},"errors":{"existingShopId":"The entered shop-id already exists.","emptyInputs":"Please fill all input fields."}},"capture":{"buttonTitle":"Capture","successTitle":"PAYONE","successMessage":"Capture processed successfully.","errorTitle":"PAYONE","errorMessage":"Capture could not be processed.","tooltips":{"impossible":"Capture impossible"}},"refund":{"buttonTitle":"Refund","successTitle":"PAYONE","successMessage":"Refund processed successfully.","errorTitle":"PAYONE","errorMessage":"Refund could not be processed.","tooltips":{"impossible":"Refund impossible"}},"modal":{"capture":{"title":"Capture","submit":"Capture","fullSubmit":"Full capture","amount":"Capture amount","captured":"Captured amount"},"refund":{"title":"Refund","submit":"Refund","fullSubmit":"Full Refund","amount":"Refund amount","refunded":"Refunded amount"},"orderAmount":"Order amount","remainingAmount":"Remaining amount","shippingCosts":"Shipping costs","descriptionHelpText":"Description help text","close":"Close","labelComment":"Label comment","columns":{"reference":"Reference","product":"Product","quantity":"Quantity","price":"Price"}},"settingsForm":{"save":"Save","test":"Test API Credentials","titleSuccess":"Success","titleError":"Error","labelShowSpecificStatusMapping":"Display state mapping configuration","helpTextShowSpecificStatusMapping":"If not configured the general status mapping config will be applied.","messageSaveError":{"ratepayProfilesUpdateFailed":"At least one Ratepay profile could not be saved successfully, please check your configuration."},"messageTestSuccess":"The API credentials were verified successfully.","messageTestNoTestedPayments":"No payment methods were tested during the check because none of the PAYONE payment methods are activated. Please activate at least one PAYONE payment method under Settings --\x3e Shop --\x3e Payment.","messageTestError":{"general":"The API credentials could not be verified successfully.","creditCard":"The API credentials for PAYONE Credit Card are not valid.","prepayment":"The API credentials for PAYONE Prepayment are not valid.","debit":"The API credentials for PAYONE Direct Debit are not valid.","paypalExpress":"The API credentials for PAYONE PayPal Express are not valid.","paypal":"The API credentials for PAYONE PayPal are not valid.","payolutionInstallment":"The API credentials for PAYONE Unzer Ratenkauf are not valid.","payolutionInvoicing":"The API credentials for PAYONE Unzer Rechnungskauf are not valid.","payolutionDebit":"The API credentials for PAYONE Unzer Lastschrift are not valid.","sofort":"The API credentials for PAYONE Sofort are not valid.","eps":"The API credentials for PAYONE eps are not valid.","iDeal":"The API credentials for PAYONE iDEAL are not valid.","secureInvoice":"The API credentials for PAYONE Secure Invoice are not valid.","openInvoice":"The API credentials for PAYONE Invoice are not valid.","paydirekt":"The API credentials for PAYONE paydirekt are not valid.","trustly":"The API credentials for PAYONE Trustly are not valid.","applePay":"The API credentials for PAYONE Apple Pay are not valid.","bancontact":"The API credentials for PAYONE Bancontact payment are not valid.","ratepayDebit":"The API credentials for PAYONE Ratepay Direct Debit payment are not valid.","ratepayInstallment":"The API credentials for PAYONE Ratepay Installments payment are not valid.","ratepayInvoicing":"The API credentials for PAYONE Ratepay Open Invoice payment are not valid.","klarnaInvoice":"The API credentials for PAYONE Klarna Rechnung are not valid.","klarnaDirectDebit":"The API credentials for PAYONE Klarna Sofort bezahlen are not valid.","klarnaInstallment":"The API credentials for PAYONE Klarna Ratenkauf are not valid.","przelewy24":"The API credentials for PAYONE Przelewy24 are not valid.","weChatPay":"The API credentials for PAYONE WeChat Pay are not valid.","postfinanceCard":"The API credentials for PAYONE Postfinance (Card) are not valid.","postfinanceWallet":"The API credentials for PAYONE Postfinance (Wallet) are not valid.","alipay":"The API credentials for PAYONE Alipay are not valid.","securedInvoice":"The API credentials for PAYONE Secured Invoice are not valid.","securedInstallment":"The API credentials for PAYONE Secured Installment are not valid.","securedDirectDebit":"The API credentials for PAYONE Secured Direct Debit are not valid."}},"supportModal":{"menuButton":"Support","title":"How Can We Help You?","documentation":{"description":"Read our online manual","button":"Online Manual"},"support":{"description":"Contact our technical support","button":"Tech Support"},"repository":{"description":"Report errors on GitHub","button":"GitHub"},"testdata":{"description":"Create your personal test data here","button":"Test Data"}},"applePay":{"cert":{"notification":"The ApplePay merchant authentication requires a certificate/key-pair. Further information:
\\n https://docs.payone.com/display/public/PLATFORM/Special+Remarks+-+Apple+Pay#SpecialRemarks-ApplePay-Onboarding

\\n\\n Create a pem-File afterwards by using the following command:
\\n
openssl x509 -inform der -in merchant_id.cer -out merchant_id.pem

\\n Copy certificate (merchant_id.pem) and key (merchant_id.key) file into the following folder:
\\n
%shopwareRoot%/config/apple-pay-cert
"}},"transitionActionNames":{"cancel":"Cancel","complete":"Complete","pay":"Pay","pay_partially":"Pay partially","process":"Process","refund":"Refund","refund_partially":"Refund partially","remind":"Remind","reopen":"Reopen","retour":"Retour","retour_partially":"Retour partially","ship":"Ship","ship_partially":"Ship partially"},"messageNotBlank":"This field must not be empty.","txid":"TXID","sequenceNumber":{"label":"Sequence Number","empty":"none"},"transactionState":"State","transactionCancelled":"Transaction cancelled in Shopware","error":{"transaction":{"notFound":"No matching transaction could be found","orderNotFound":"No matching order could be found"}}},"sw-privileges":{"additional_permissions":{"Payone":{"label":"PAYONE","payone_order_management":"PAYONE transaction management"}}}}')},HOYe:function(e,t,n){var i=n("vRey");i.__esModule&&(i=i.default),"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("ydqr").default)("0458005f",i,!0,{})},"I+7f":function(e,t,n){},Kdn4:function(e,t,n){var i=n("CBo4");i.__esModule&&(i=i.default),"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("ydqr").default)("5cba0700",i,!0,{})},PaTh:function(e,t,n){var i=n("euFz");i.__esModule&&(i=i.default),"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("ydqr").default)("7669284a",i,!0,{})},UwmX:function(e,t,n){"use strict";n.r(t);n("2tSu");Shopware.Component.register("payone-ratepay-profile-configurations",{template:"{% block payone_ratepay_profile_configurations %}\n
\n

{{ $tc('payone-payment.general.headlines.ratepayProfileConfigurations') }}

\n\n \n
\n{% endblock %}\n",inject:["PayonePaymentSettingsService"],props:{value:{type:Object,required:!1,default:function(){return{}}},name:{type:String,required:!0}},data:function(){return{isLoading:!1,configuration:this.value}},created:function(){this.createdComponent()},destroyed:function(){this.destroyedComponent()},computed:{profileConfigurations:function(){var e=this.name,t=[];for(var n in this.configuration){var i="",a="";switch(e){case"PayonePayment.settings.ratepayDebitProfileConfigurations":i=this.configuration[n]["tx-limit-elv-min"],a=this.configuration[n]["tx-limit-elv-max"];break;case"PayonePayment.settings.ratepayInstallmentProfileConfigurations":i=this.configuration[n]["tx-limit-installment-min"],a=this.configuration[n]["tx-limit-installment-max"];break;case"PayonePayment.settings.ratepayInvoicingProfileConfigurations":i=this.configuration[n]["tx-limit-invoice-min"],a=this.configuration[n]["tx-limit-invoice-max"];break;default:return}var o={shopId:n,shopCurrency:this.configuration[n].currency,invoiceCountry:this.configuration[n]["country-code-billing"],shippingCountry:this.configuration[n]["country-code-delivery"],minBasket:i,maxBasket:a};t.push(o)}return t}},methods:{createdComponent:function(){this.$root.$on("payone-ratepay-profiles-update-result",this.onProfilesUpdateResult),console.log(this.configuration)},destroyedComponent:function(){this.$root.$off("payone-ratepay-profiles-update-result")},onProfilesUpdateResult:function(e){e.updates[this.name]&&(this.configuration=e.updates[this.name])}}});n("0sf7");function i(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return a(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,s=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){c=!0,r=e},f:function(){try{s||null==n.return||n.return()}finally{if(c)throw r}}}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n\n {% block payone_ratepay_shop_ids %}\n

{{ $tc(\'payone-payment.general.headlines.ratepayProfiles\') }}

\n \n\n {% block payone_ratepay_shop_ids_actions %}\n \n\n {% block payone_ratepay_shop_ids_create_actions %}\n
\n \n {{ $tc(\'payone-payment.general.actions.addShop\') }}\n \n
\n {% endblock %}\n
\n {% endblock %}\n\n {% block payone_ratepay_shop_ids_grid %}\n \n {% block payone_ratepay_shop_ids_grid_columns %}\n {% block payone_ratepay_shop_ids_grid_column_status %}\n \n {% endblock %}\n\n {% block payone_ratepay_shop_ids_bulk_actions %}\n \n {% endblock %}\n {% endblock %}\n \n {% endblock %}\n\n {% block payone_ratepay_shop_ids_error %}\n \n {{ $tc(\'payone-payment.general.errors.existingShopId\') }}\n \n\n \n {{ $tc(\'payone-payment.general.errors.emptyInputs\') }}\n \n {% endblock %}\n
\n {% endblock %}\n \n{% endblock %}\n',props:{value:{type:Array,required:!1,default:function(){return[]}},name:{type:String,required:!0}},data:function(){return{selectedItems:{},newItem:null,showDuplicateAlert:!1,showEmptyAlert:!1,profiles:this.value}},computed:{getLineItemColumns:function(){return[{property:"shopId",dataIndex:"shopId",label:this.$tc("payone-payment.general.label.shopId"),allowResize:!1,inlineEdit:"string",width:"200px",primary:!0},{property:"currency",dataIndex:"currency",label:this.$tc("payone-payment.general.label.currency"),allowResize:!1,inlineEdit:"string",width:"200px",primary:!0},{property:"error",label:this.$tc("payone-payment.general.label.error"),allowResize:!1,width:"100px",primary:!0}]}},watch:{profiles:function(e){this.$emit("input",e),this.$emit("change",e)}},created:function(){this.createdComponent()},destroyed:function(){this.destroyedComponent()},methods:{createdComponent:function(){this.$root.$on("payone-ratepay-profiles-update-result",this.onProfilesUpdateResult)},destroyedComponent:function(){this.$root.$off("payone-ratepay-profiles-update-result")},onProfilesUpdateResult:function(e){if(e.updates[this.name]&&(this.profiles=e.updates[this.name]),e.errors[this.name]){var t,n=i(e.errors[this.name]);try{for(n.s();!(t=n.n()).done;){var a=t.value;this.profiles.push(a)}}catch(e){n.e(e)}finally{n.f()}}},onInlineEditCancel:function(e){""===e.shopId&&""===e.currency&&this.profiles.forEach((function(t,n,i){t.id===e.id&&i.splice(n,1)})),this.$emit("item-cancel")},onInlineEditSave:function(e){var t=this;if(""!==e.shopId&&""!==e.currency){this.showEmptyAlert=!1;var n=!1;this.profiles.forEach((function(t){t.id!==e.id&&t.shopId===e.shopId&&(n=!0)})),n?(this.showDuplicateAlert=!0,this.$nextTick((function(){t.$refs.shopIdsDataGrid.currentInlineEditId=e.id,t.$refs.shopIdsDataGrid.enableInlineEdit()}))):this.showDuplicateAlert=!1}else this.showEmptyAlert=!0,this.$nextTick((function(){t.$refs.shopIdsDataGrid.currentInlineEditId=e.id,t.$refs.shopIdsDataGrid.enableInlineEdit()}));this.$emit("update-list",this.profiles)},createNewLineItem:function(){(0===this.profiles.length||""!==this.profiles[this.profiles.length-1].shopId)&&this.createLine()},createLine:function(){var e=this,t=s.createId();this.profiles.push({id:t,shopId:"",currency:""}),this.$nextTick((function(){e.$refs.shopIdsDataGrid.currentInlineEditId=t,e.$refs.shopIdsDataGrid.enableInlineEdit()}))},onDeleteSelectedItem:function(e){this.profiles=this.profiles.filter((function(t){return t.shopId!==e.shopId})),this.$emit("deleted",this.profiles)}}});n("fWC6");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 l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function u(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==c(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!==c(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===c(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var d=Shopware,p=d.Component,f=d.Mixin;d.Context;p.register("payone-capture-button",{template:'{% block payone_payment_payment_details %}\n
\n \n \n {{ $tc(\'payone-payment.capture.buttonTitle\') }}\n \n \n\n \n \n \n\n
\n \n \n \n \n \n \n
\n\n \n
\n
\n{% endblock %}\n',mixins:[f.getByName("notification")],inject:["PayonePaymentService","repositoryFactory"],props:{order:{type:Object,required:!0},transaction:{type:Object,required:!0}},computed:{decimalPrecision:function(){return this.order&&this.order.currency?this.order.currency.decimalPrecision?this.order.currency.decimalPrecision:this.order.currency.itemRounding?this.order.currency.itemRounding.decimals:void 0:2},totalTransactionAmount:function(){return Math.round(this.transaction.amount.totalPrice*Math.pow(10,this.decimalPrecision),0)},capturedAmount:function(){return this.transaction.extensions&&this.transaction.extensions.payonePaymentOrderTransactionData&&this.transaction.extensions.payonePaymentOrderTransactionData.capturedAmount?this.transaction.extensions.payonePaymentOrderTransactionData.capturedAmount:0},remainingAmount:function(){return this.totalTransactionAmount-this.capturedAmount},maxCaptureAmount:function(){return this.remainingAmount/Math.pow(10,this.decimalPrecision)},buttonEnabled:function(){return!(!this.transaction.extensions||!this.transaction.extensions.payonePaymentOrderTransactionData)&&(this.remainingAmount>0&&this.capturedAmount>0||this.transaction.extensions.payonePaymentOrderTransactionData.allowCapture)},isItemSelected:function(){var e=!1;return this.selection.forEach((function(t){t.selected&&(e=!0)})),e},hasRemainingShippingCosts:function(){var e=this;if(this.order.shippingCosts.totalPrice<=0)return!1;var t=this.order.shippingCosts.totalPrice*Math.pow(10,this.decimalPrecision),n=0;return this.order.lineItems.forEach((function(t){t.customFields&&t.customFields.payone_captured_quantity&&0=t)}},data:function(){return{isLoading:!1,hasError:!1,showCaptureModal:!1,isCaptureSuccessful:!1,selection:[],captureAmount:0,includeShippingCosts:!1}},methods:{calculateCaptureAmount:function(){var e=0;this.selection.forEach((function(t){t.selected&&(e+=t.unit_price*t.quantity)})),e>this.remainingAmount&&(e=this.remainingAmount),this.captureAmount=e},openCaptureModal:function(){this.showCaptureModal=!0,this.isCaptureSuccessful=!1,this.selection=[]},closeCaptureModal:function(){this.showCaptureModal=!1},onCaptureFinished:function(){this.isCaptureSuccessful=!1},captureOrder:function(){var e=this,t={orderTransactionId:this.transaction.id,payone_order_id:this.transaction.extensions.payonePaymentOrderTransactionData.transactionId,salesChannel:this.order.salesChannel,amount:this.captureAmount,orderLines:[],complete:this.captureAmount===this.remainingAmount,includeShippingCosts:!1};this.isLoading=!0,this.selection.forEach((function(n){e.order.lineItems.forEach((function(e){if(e.id===n.id&&n.selected&&00&&this.selection.push({id:"shipping",quantity:1,unit_price:this.order.shippingCosts.totalPrice,selected:!1})}}});n("Kdn4");function m(e){return(m="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 y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function h(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==m(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!==m(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===m(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var g=Shopware,b=g.Component,v=g.Mixin;b.register("payone-refund-button",{template:'{% block payone_payment_payment_details %}\n
\n \n \n {{ $tc(\'payone-payment.refund.buttonTitle\') }}\n \n \n\n \n \n \n\n
\n \n \n \n \n \n \n
\n\n \n
\n
\n{% endblock %}\n',mixins:[v.getByName("notification")],inject:["PayonePaymentService"],props:{order:{type:Object,required:!0},transaction:{type:Object,required:!0}},data:function(){return{isLoading:!1,hasError:!1,showRefundModal:!1,isRefundSuccessful:!1,selection:[],refundAmount:0,includeShippingCosts:!1}},computed:{decimalPrecision:function(){return this.order&&this.order.currency?this.order.currency.decimalPrecision?this.order.currency.decimalPrecision:this.order.currency.itemRounding?this.order.currency.itemRounding.decimals:void 0:2},remainingAmount:function(){return this.transaction.extensions&&this.transaction.extensions.payonePaymentOrderTransactionData&&this.transaction.extensions.payonePaymentOrderTransactionData.capturedAmount?this.transaction.extensions.payonePaymentOrderTransactionData.capturedAmount-this.refundedAmount:0},refundedAmount:function(){return this.transaction.extensions&&this.transaction.extensions.payonePaymentOrderTransactionData&&!this.transaction.extensions.payonePaymentOrderTransactionData.refundedAmount?this.transaction.extensions.payonePaymentOrderTransactionData.refundedAmount:0},maxRefundAmount:function(){return this.remainingAmount/Math.pow(10,this.decimalPrecision)},buttonEnabled:function(){return!(!this.transaction.extensions||!this.transaction.extensions.payonePaymentOrderTransactionData)&&(this.remainingAmount>0&&this.refundedAmount>0||this.transaction.extensions.payonePaymentOrderTransactionData.allowRefund)},hasRemainingRefundableShippingCosts:function(){var e=this;if(this.order.shippingCosts.totalPrice<=0)return!1;var t=this.order.shippingCosts.totalPrice*Math.pow(10,this.decimalPrecision),n=0;return this.order.lineItems.forEach((function(t){t.customFields&&t.customFields.payone_refunded_quantity&&0=t)}},methods:{calculateRefundAmount:function(){var e=0;this.selection.forEach((function(t){t.selected&&(e+=t.unit_price*t.quantity)})),Math.round(e*Math.pow(10,this.decimalPrecision)>this.remainingAmount)&&(e=this.remainingAmount/Math.pow(10,this.decimalPrecision)),this.refundAmount=e},openRefundModal:function(){this.showRefundModal=!0,this.isRefundSuccessful=!1,this.selection=[]},closeRefundModal:function(){this.showRefundModal=!1},onRefundFinished:function(){this.isRefundSuccessful=!1},refundOrder:function(){var e=this,t={orderTransactionId:this.transaction.id,payone_order_id:this.transaction.extensions.payonePaymentOrderTransactionData.transactionId,salesChannel:this.order.salesChannel,amount:this.refundAmount,orderLines:[],complete:this.refundAmount===this.maxRefundAmount,includeShippingCosts:!1};this.isLoading=!0,this.selection.forEach((function(n){e.order.lineItems.forEach((function(i){if(i.id===n.id&&n.selected&&00&&this.selection.push({id:"shipping",quantity:1,unit_price:this.order.shippingCosts.totalPrice,selected:!1})}}});n("HOYe");Shopware.Component.register("payone-order-items",{template:'{% block payone_payment_details %}\n
\n \n\n \n\n \n\n \n \n
\n{% endblock %}\n',props:{order:{type:Object,required:!0},mode:{type:String,required:!1}},computed:{orderItems:function(){var e=this,t=[];return this.order.lineItems.forEach((function(n){var i=e.$options.filters.currency(n.totalPrice,e.order.currency.shortName,e.order.decimal_precision),a=!1,o=n.quantity;n.customFields&&("refund"===e.mode?(n.customFields.payone_captured_quantity&&0>n.customFields.payone_captured_quantity&&(o=n.customFields.payone_captured_quantity),n.customFields.payone_refunded_quantity&&(o-=n.customFields.payone_refunded_quantity)):"capture"===e.mode&&n.customFields.payone_captured_quantity&&0o&&(a=!0),t.push({id:n.id,product:n.label,quantity:o,disabled:a,selected:!1,price:i,orderItem:n})})),this.order.shippingCosts.totalPrice>0&&t.push({id:"shipping",product:this.$tc("payone-payment.modal.shippingCosts"),quantity:1,disabled:!1,selected:!1,price:this.$options.filters.currency(this.order.shippingCosts.totalPrice,this.order.currency.shortName,this.order.decimal_precision),orderItem:{}}),t},orderItemColumns:function(){return[{property:"product",label:this.$tc("payone-payment.modal.columns.product"),rawData:!0},{property:"quantity",label:this.$tc("payone-payment.modal.columns.quantity"),rawData:!0},{property:"price",label:this.$tc("payone-payment.modal.columns.price"),rawData:!0}]}},methods:{onSelectItem:function(e,t,n){this.$emit("select-item",t.id,n)},onChangeQuantity:function(e,t){this.$emit("change-quantity",t,e)}}});Shopware.Component.extend("payone-data-grid","sw-data-grid",{template:'{% block sw_data_grid_select_item_checkbox %}\n \n \n\n \n \n{% endblock %}\n'});n("PaTh");Shopware.Component.register("payone-payment-plugin-icon",{template:'{% block payone_payment_plugin_icon %}\n \n{% endblock %}\n'});n("oAJ+");var _=Shopware,P=_.Component,w=_.Mixin,S=Shopware.Utils,k=S.object,A=S.types;P.register("payone-settings",{template:'{% block payone_payment %}\n\n {% block payone_payment_header %}\n \n {% endblock %}\n\n {% block payone_payment_actions %}\n \n {% endblock %}\n\n {% block payone_payment_settings_content %}\n \n {% endblock %}\n\n{% endblock %}\n',mixins:[w.getByName("notification"),w.getByName("sw-inline-snippet")],inject:["PayonePaymentSettingsService"],data:function(){return{isLoading:!1,isTesting:!1,isSaveSuccessful:!1,isTestSuccessful:!1,isApplePayCertConfigured:!0,config:{},merchantIdFilled:!1,accountIdFilled:!1,portalIdFilled:!1,portalKeyFilled:!1,showValidationErrors:!1,isSupportModalOpen:!1,stateMachineTransitionActions:[],displayStatusMapping:{},collapsibleState:{status_mapping:!0,payment_credit_card:!0,payment_paypal:!0,payment_paypal_express:!0,payment_debit:!0,payment_sofort:!0,payment_payolution_installment:!0,payment_payolution_invoicing:!0,payment_payolution_debit:!0,payment_eps:!0,payment_ideal:!0,payment_paydirekt:!0,payment_prepayment:!0,payment_trustly:!0,payment_secure_invoice:!0,payment_open_invoice:!0,payment_apple_pay:!0,payment_bancontact:!0,payment_ratepay_debit:!0,payment_ratepay_installment:!0,payment_ratepay_invoicing:!0,payment_klarna_invoice:!0,payment_klarna_direct_debit:!0,payment_klarna_installment:!0,payment_przelewy24:!0,payment_we_chat_pay:!0,payment_postfinanceCard:!0,payment_postfinanceWallet:!0,payment_alipay:!0,payment_secured_invoice:!0,payment_secured_installment:!0,payment_secured_direct_debit:!0}}},created:function(){this.createdComponent()},computed:{credentialsMissing:function(){return!(this.merchantIdFilled&&this.accountIdFilled&&this.portalIdFilled&&this.portalKeyFilled)}},metaInfo:function(){return{title:this.$createTitle()}},methods:{createdComponent:function(){var e=this,t=this;this.PayonePaymentSettingsService.getStateMachineTransitionActions().then((function(e){e.data.forEach((function(e){var n="payone-payment.transitionActionNames."+e.label,i=t.$t(n);i===n&&(i=e.label),t.stateMachineTransitionActions.push({label:i,value:e.value})}))})),this.PayonePaymentSettingsService.hasApplePayCert().then((function(t){e.isApplePayCertConfigured=t}))},paymentMethodPrefixes:function(){return["creditCard","debit","paypal","paypalExpress","payolutionInvoicing","payolutionInstallment","payolutionDebit","sofort","eps","iDeal","paydirekt","prepayment","trustly","secureInvoice","openInvoice","applePay","bancontact","ratepayDebit","ratepayInstallment","ratepayInvoicing","klarnaInvoice","klarnaDirectDebit","klarnaInstallment","przelewy24","weChatPay","postfinanceCard","postfinanceWallet","alipay","securedInvoice","securedInstallment","securedDirectDebit"]},isVisiblePaymentMethodCard:function(e){return e.name.startsWith("payment")&&!this.isCollapsed(e)},isCollapsible:function(e){return e.name in this.collapsibleState},displayField:function(e,t,n){return!(n.name in this.collapsibleState)||!this.collapsibleState[n.name]},isCollapsed:function(e){return this.collapsibleState[e.name]},toggleCollapsible:function(e){e.name in this.collapsibleState&&(this.collapsibleState[e.name]=!this.collapsibleState[e.name])},saveFinish:function(){this.isSaveSuccessful=!1},testFinish:function(){this.isTestSuccessful=!1},onConfigChange:function(e){this.config=e,this.checkCredentialsFilled(),this.showValidationErrors=!1},checkCredentialsFilled:function(){this.merchantIdFilled=!!this.getConfigValue("merchantId"),this.accountIdFilled=!!this.getConfigValue("accountId"),this.portalIdFilled=!!this.getConfigValue("portalId"),this.portalKeyFilled=!!this.getConfigValue("portalKey")},getConfigValue:function(e){var t=this.$refs.systemConfig.actualConfigData.null;return null===this.$refs.systemConfig.currentSalesChannelId?this.config["PayonePayment.settings.".concat(e)]:this.config["PayonePayment.settings.".concat(e)]||t["PayonePayment.settings.".concat(e)]},getPaymentConfigValue:function(e,t){var n=e.charAt(0).toUpperCase()+e.slice(1);return this.getConfigValue(t+n)||this.getConfigValue(e)},onSave:function(){var e=this;this.credentialsMissing?this.showValidationErrors=!0:(this.isSaveSuccessful=!1,this.isLoading=!0,this.$refs.systemConfig.saveAll().then((function(t){e.handleRatepayProfileUpdates(t),e.isLoading=!1,e.isSaveSuccessful=!0})).catch((function(){e.isLoading=!1})))},onTest:function(){var e=this;this.isTesting=!0,this.isTestSuccessful=!1;var t={};this.paymentMethodPrefixes().forEach((function(n){t[n]={merchantId:e.getPaymentConfigValue("merchantId",n),accountId:e.getPaymentConfigValue("accountId",n),portalId:e.getPaymentConfigValue("portalId",n),portalKey:e.getPaymentConfigValue("portalKey",n)}})),this.PayonePaymentSettingsService.validateApiCredentials(t).then((function(t){var n=t.testCount,i=t.credentialsValid,a=t.errors;if(i)e.createNotificationSuccess({title:e.$tc("payone-payment.settingsForm.titleSuccess"),message:n>0?e.$tc("payone-payment.settingsForm.messageTestSuccess"):e.$tc("payone-payment.settingsForm.messageTestNoTestedPayments")}),e.isTestSuccessful=!0;else for(var o in a)if(a.hasOwnProperty(o)){e.createNotificationError({title:e.$tc("payone-payment.settingsForm.titleError"),message:e.$tc("payone-payment.settingsForm.messageTestError."+o)});var r=a[o];"string"==typeof r&&e.createNotificationError({title:e.$tc("payone-payment.settingsForm.titleError"),message:r})}e.isTesting=!1})).catch((function(t){e.createNotificationError({title:e.$tc("payone-payment.settingsForm.titleError"),message:e.$tc("payone-payment.settingsForm.messageTestError.general")}),e.isTesting=!1}))},getBind:function(e,t){var n;return t!==this.config&&(this.config=t),this.showValidationErrors&&("PayonePayment.settings.merchantId"!==e.name||this.merchantIdFilled||(e.config.error={code:1,detail:this.$tc("payone-payment.messageNotBlank")}),"PayonePayment.settings.accountId"!==e.name||this.accountIdFilled||(e.config.error={code:1,detail:this.$tc("payone-payment.messageNotBlank")}),"PayonePayment.settings.portalId"!==e.name||this.portalIdFilled||(e.config.error={code:1,detail:this.$tc("payone-payment.messageNotBlank")}),"PayonePayment.settings.portalKey"!==e.name||this.portalKeyFilled||(e.config.error={code:1,detail:this.$tc("payone-payment.messageNotBlank")})),this.$refs.systemConfig.config.forEach((function(t){t.elements.forEach((function(t){t.name!==e.name||(n=t)}))})),n||e},getElementBind:function(e){var t=k.deepCopyObject(e);return null!==this.currentSalesChannelId&&this.inherit&&this.actualConfigData.hasOwnProperty("null")&&null!==this.actualConfigData.null[t.name]&&("single-select"===t.type||"sw-entity-single-select"===t.config.componentName?t.placeholder=this.$tc("sw-settings.system-config.inherited"):"bool"===t.type?t.config.inheritedValue=this.actualConfigData.null[t.name]||!1:"password"===t.type?(t.placeholderIsPassword=!0,t.placeholder="".concat(this.actualConfigData.null[t.name])):"multi-select"===t.type||A.isUndefined(this.actualConfigData.null[t.name])||(t.placeholder="".concat(this.actualConfigData.null[t.name]))),["single-select","multi-select"].includes(t.type)&&(t.config.labelProperty="name",t.config.valueProperty="id"),t},handleRatepayProfileUpdates:function(e){var t=this.$refs.systemConfig.currentSalesChannelId;if(e.payoneRatepayProfilesUpdateResult&&e.payoneRatepayProfilesUpdateResult[t]){var n=e.payoneRatepayProfilesUpdateResult[t];this.$root.$emit("payone-ratepay-profiles-update-result",n),Array.isArray(n.errors)||this.createNotificationError({title:this.$tc("payone-payment.settingsForm.titleError"),message:this.$tc("payone-payment.settingsForm.messageSaveError.ratepayProfilesUpdateFailed")})}}}});n("Veh4");var C=Shopware,I=C.Component,T=C.Mixin,E=Shopware.Data.Criteria;I.override("sw-order-detail-base",{template:'{% block sw_order_detail_delivery_metadata %}\n {% parent %}\n\n \n{% endblock %}\n',inject:["PayonePaymentService","repositoryFactory","acl"],mixins:[T.getByName("notification")],data:function(){return{disableButtons:!1,notificationForwards:null}},computed:{payoneTransactions:function(){var e=this;return this.order.transactions.filter((function(t){return e.isPayoneTransaction(t)})).sort((function(e,t){return e.createdAtt.createdAt?-1:0}))},notificationForwardRepository:function(){return this.repositoryFactory.create("payone_payment_notification_forward")},notificationTargetColumns:function(){return[{property:"txaction",type:"text",width:"100px"},{property:"notificationTarget.url",type:"text"},{property:"response",width:"100px"},{property:"updatedAt",align:"right",type:"date"}]}},methods:{requeue:function(e,t){var n=this,i={notificationForwardId:e.id};this.PayonePaymentService.requeueNotificationForward(i).then((function(){n.createNotificationSuccess({title:n.$tc("payonePayment.notificationTarget.actions.requeue"),message:n.$tc("payonePayment.notificationTarget.messages.success")}),n.getNotificationForwards(t)})).catch((function(e){n.createNotificationError({title:n.$tc("payonePayment.notificationTarget.actions.requeue"),message:e.message})})).finally((function(){n.$nextTick().then((function(){n.$emit("reload")}))}))},isPayoneTransaction:function(e){return!!(e.extensions&&e.extensions.payonePaymentOrderTransactionData&&e.extensions.payonePaymentOrderTransactionData.transactionId)&&e.extensions.payonePaymentOrderTransactionData.transactionId},hasNotificationForwards:function(e){return null===this.notificationForwards?(this.getNotificationForwards(e),!1):!(this.notificationForwards.length<=0)},getNotificationForwards:function(e){var t=this,n=new E;return n.addAssociation("notificationTarget"),n.addSorting(E.sort("updatedAt","DESC",!0)),n.addFilter(E.equals("transactionId",e.id)),n.setLimit(500),this.notificationForwardRepository.search(n,Shopware.Context.api).then((function(e){t.notificationForwards=e}))},can:function(e){try{return this.acl.can(e)}catch(e){return!0}},isActiveTransaction:function(e){return"cancelled"!==e.stateMachineState.technicalName},hasPayoneTransaction:function(e){var t=this,n=!1;return!!e.transactions&&(e.transactions.map((function(e){t.isPayoneTransaction(e)&&t.isActiveTransaction(e)&&(n=!0)})),n)}}});n("F2L/");var O=Shopware.Component,x=Shopware.Context.app.config.version.match(/((\d+)\.?(\d+?)\.?(\d+)?\.?(\d*))-?([A-z]+?\d+)?/i);x&&6===parseInt(x[2])&&parseInt(x[3])<4&&O.override("sw-settings-index",{template:'{% block sw_settings_content_card_slot_plugins %}\n {% parent %}\n\n \n \n \n{% endblock %}\n'});n("tWAi");var N=n("CY1O"),$=n("GqT2"),D=Shopware.Module,R={type:"plugin",name:"PayonePayment",title:"payone-payment.general.mainMenuItemGeneral",description:"payone-payment.general.descriptionTextModule",version:"1.0.0",targetVersion:"1.0.0",icon:"default-action-settings",snippets:{"de-DE":N,"en-GB":$},routeMiddleware:function(e,t){e(t)},routes:{index:{component:"payone-settings",path:"index",meta:{parentPath:"sw.settings.index"}}}},M=Shopware.Context.app.config.version.match(/((\d+)\.?(\d+?)\.?(\d+)?\.?(\d*))-?([A-z]+?\d+)?/i);M&&6===parseInt(M[2])&&parseInt(M[3])>3&&(R.settingsItem=[{name:"payone-payment",to:"payone.payment.index",label:"payone-payment.general.mainMenuItemGeneral",group:"plugins",iconComponent:"payone-payment-plugin-icon",backgroundEnabled:!1}]),D.register("payone-payment",R);function F(e){return(F="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 q(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function L(e){for(var t=1;t\n\n {% block payone_notification_target_list_smart_bar_header %}\n \n {% endblock %}\n\n {% block payone_notification_target_list_actions %}\n \n {% endblock %}\n\n {% block payone_notification_target_list_content %}\n \n {% endblock %}\n\n {% block payone_notification_target_list_sidebar %}\n \n {% endblock %}\n \n{% endblock %}\n',inject:["repositoryFactory"],mixins:[z.getByName("listing")],data:function(){return{isLoading:!1,items:null,sortBy:"createdAt",criteriaLimit:500,criteriaPage:1,limit:500}},metaInfo:function(){return{title:this.$createTitle()}},computed:{notificationTargetColumns:function(){return[{dataIndex:"url",property:"url",label:"payonePayment.notificationTarget.columns.url",primary:!0},{dataIndex:"isBasicAuth",property:"isBasicAuth",label:"payonePayment.notificationTarget.columns.isBasicAuth"},{property:"txactions",label:"payonePayment.notificationTarget.columns.txactions"}]},repository:function(){return this.repositoryFactory.create("payone_payment_notification_target")},criteria:function(){var e=new Z(this.criteriaPage,this.criteriaLimit);return e}},created:function(){this.createdComponent()},methods:{renderTxactions:function(e){return null!==e&&e.length?e.join(", "):""},createdComponent:function(){this.getList()},getList:function(){var e=this;this.isLoading=!0;var t=L(L({},Shopware.Context.api),{},{inheritance:!0});return this.repository.search(this.criteria,t).then((function(t){e.total=t.total,e.items=t,e.isLoading=!1}))},onDelete:function(e){this.$refs.listing.deleteItem(e),this.getList()}}});var U=Shopware,K=U.Component,G=U.Mixin;U.Data.Criteria;K.register("payone-notification-target-detail",{template:'{% block payone_notification_target_detail %}\n \n\n {% block payone_notification_target_detail_header %}\n \n {% endblock %}\n\n {% block payone_notification_target_detail_actions %}\n \n {% endblock %}\n\n {% block payone_notification_target_detail_content %}\n \n\n {% block payone_notification_target_detail_base_basic_info_card %}\n \n \n \n {% endblock %}\n \n {% endblock %}\n\n \n{% endblock %}\n',inject:["repositoryFactory"],mixins:[G.getByName("notification")],shortcuts:{"SYSTEMKEY+S":"onSave",ESCAPE:"onCancel"},props:{notificationTargetId:{type:String,required:!1,default:null}},data:function(){return{notificationTarget:null,isLoading:!1,isSaveSuccessful:!1}},metaInfo:function(){return{title:this.$createTitle(this.identifier)}},computed:{notificationTargetIsLoading:function(){return this.isLoading||null==this.notificationTarget},notificationTargetRepository:function(){return this.repositoryFactory.create("payone_payment_notification_target")}},watch:{notificationTargetId:function(){this.createdComponent()}},created:function(){this.createdComponent()},methods:{updateSelection:function(e){this.notificationTarget.txactions=e},createdComponent:function(){this.notificationTargetId?this.loadEntityData():(Shopware.State.commit("context/resetLanguageToDefault"),this.notificationTarget=this.notificationTargetRepository.create(Shopware.Context.api))},loadEntityData:function(){var e=this;this.isLoading=!0,this.notificationTargetRepository.get(this.notificationTargetId,Shopware.Context.api).then((function(t){e.isLoading=!1,e.notificationTarget=t,null!==t.txactions&&(t.txactions.length||(e.notificationTarget.txactions=null))}))},isInvalid:function(){return!0===this.notificationTarget.isBasicAuth&&((!this.notificationTarget.username||!this.notificationTarget.password)&&(this.createNotificationError({message:this.$tc("global.notification.notificationSaveErrorMessageRequiredFieldsInvalid")}),!0))},onSave:function(){var e=this;this.isInvalid()||(this.isLoading=!0,this.notificationTargetRepository.save(this.notificationTarget,Shopware.Context.api).then((function(){e.isLoading=!1,e.isSaveSuccessful=!0,null!==e.notificationTargetId?e.loadEntityData():e.$router.push({name:"payone.notification.target.detail",params:{id:e.notificationTarget.id}})})).catch((function(t){throw e.isLoading=!1,e.createNotificationError({message:e.$tc("global.notification.notificationSaveErrorMessageRequiredFieldsInvalid")}),t})))},onCancel:function(){this.$router.push({name:"payone.notification.target.list"})}}});var V=n("uk8h"),W=n("GmXf");Shopware.Module.register("payone-notification-target",{type:"plugin",name:"PayoneNotificationTarget",title:"payonePayment.notificationTarget.module.title",description:"payonePayment.notificationTarget.module.title",color:"#3596d6",icon:"default-shopping-paper-bag-product",snippets:{"de-DE":V,"en-GB":W},routes:{list:{component:"payone-notification-target-list",path:"list"},detail:{component:"payone-notification-target-detail",path:"detail/:id",props:{default:function(e){return{notificationTargetId:e.params.id}}},meta:{parentPath:"payone.notification.target.list"}},create:{component:"payone-notification-target-detail",path:"create",meta:{parentPath:"payone.notification.target.list"}}}});Shopware.Component.override("sw-order-user-card",{template:"{% block sw_order_detail_base_secondary_info_payment %}\n \n{% endblock %}",computed:{payoneCardType:function(){var e,t,n=null===(e=this.currentOrder.transactions.last().extensions.payonePaymentOrderTransactionData)||void 0===e||null===(t=e.additionalData)||void 0===t?void 0:t.card_type;return n?this.$tc("sw-order.payone-payment.creditCard.cardTypes."+n):null}}});n("2a1E"),n("ldEE"),n("6PZk")},Veh4:function(e,t,n){var i=n("rEvD");i.__esModule&&(i=i.default),"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("ydqr").default)("6d309501",i,!0,{})},bWZA:function(e,t,n){},euFz:function(e,t,n){},fWC6:function(e,t,n){var i=n("qKbt");i.__esModule&&(i=i.default),"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("ydqr").default)("6d4f2f7a",i,!0,{})},jqOd:function(e,t,n){},ldEE:function(e,t){function n(e){return(n="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 i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var i=0;i2&&void 0!==arguments[2]?arguments[2]:"payone_payment";return i(this,l),c.call(this,e,t,n)}return t=l,(n=[{key:"validateApiCredentials",value:function(e){var t=this.getBasicHeaders();return this.httpClient.post("_action/".concat(this.getApiBasePath(),"/validate-api-credentials"),{credentials:e},{headers:t}).then((function(e){return u.handleResponse(e)}))}},{key:"getStateMachineTransitionActions",value:function(){var e=this.getBasicHeaders();return this.httpClient.get("_action/".concat(this.getApiBasePath(),"/get-state-machine-transition-actions"),{headers:e}).then((function(e){return u.handleResponse(e)}))}},{key:"hasApplePayCert",value:function(){var e=this.getBasicHeaders();return this.httpClient.get("_action/".concat(this.getApiBasePath(),"/check-apple-pay-cert"),{headers:e}).catch((function(){return!1})).then((function(e){return!!e}))}}])&&a(t.prototype,n),s&&a(t,s),Object.defineProperty(t,"prototype",{writable:!1}),l}(u);l.addServiceProvider("PayonePaymentSettingsService",(function(e){var t=l.getContainer("init");return new d(t.httpClient,e.loginService)}))},mi8M:function(e,t,n){},"oAJ+":function(e,t,n){var i=n("jqOd");i.__esModule&&(i=i.default),"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("ydqr").default)("8689c210",i,!0,{})},qKbt:function(e,t,n){},rEvD:function(e,t,n){},tWAi:function(e,t){var n=Shopware.Filter,i=Shopware.Utils.format.currency;n.register("payone_currency",(function(e,t,n,a){return null===e?"-":(n||(n=0),e/=Math.pow(10,n),i(e,t,a))}))},uk8h:function(e){e.exports=JSON.parse('{"payonePayment":{"notificationTarget":{"module":{"title":"Payone Notificationweiterleitungen","buttonTitle":"Notifications"},"list":{"title":"Notificationweiterleitungen","empty":"Keine Einträge","buttonCreate":"Weiterleitungsziel anlegen"},"detail":{"headline":"Notificationweiterleitung","placeholder":{"url":"Url","username":"Benutzer","password":"Passwort"},"label":{"url":"Url","isBasicAuth":"Basic Auth","txactions":"txactions","buttonSave":"Speichern","buttonCancel":"Abbrechen","username":"Benutzer","password":"Passwort"}},"columns":{"url":"Url","isBasicAuth":"Basic Auth","txactions":"txactions"},"actions":{"requeue":"Erneut senden"},"messages":{"success":"Die Weiterleitung wurde erfolgreich in Auftrag gegeben."}}}}')},vRey:function(e,t,n){},ydqr:function(e,t,n){"use strict";function i(e,t){for(var n=[],i={},a=0;an.parts.length&&(i.parts.length=n.parts.length)}else{var r=[];for(a=0;agetCustomer(); if ($customer === null) { - throw new CustomerNotLoggedInException(); + throw CartException::customerNotLoggedIn(); } $result = $this->cardRepository->getCards($customer, $context->getContext()); @@ -72,12 +65,12 @@ public function load(SalesChannelContext $context): CardResponse * @OA\JsonContent(ref="#/components/schemas/SuccessResponse") * ) * ) - * @Route("/store-api/payone/account/deleteCard/{pseudoCardPan}", name="store-api.payone.account.deleteCard", methods={"POST"}) + * @Route("/store-api/payone/account/deleteCard/{pseudoCardPan}", name="store-api.payone.account.deleteCard", methods={"POST"}, defaults={"_routeScope"={"store-api"}, "_contextTokenRequired"=true}) */ public function delete(string $pseudoCardPan, SalesChannelContext $context): StoreApiResponse { if ($context->getCustomer() === null) { - throw new CustomerNotLoggedInException(); + throw CartException::customerNotLoggedIn(); } $this->cardRepository->removeCard( diff --git a/src/StoreApi/Route/MandateRoute.php b/src/StoreApi/Route/MandateRoute.php index 316880ed4..ca9938238 100644 --- a/src/StoreApi/Route/MandateRoute.php +++ b/src/StoreApi/Route/MandateRoute.php @@ -6,21 +6,15 @@ use PayonePayment\Components\MandateService\MandateServiceInterface; use PayonePayment\StoreApi\Response\MandateResponse; -use Shopware\Core\Checkout\Cart\Exception\CustomerNotLoggedInException; +use Shopware\Core\Checkout\Cart\CartException; use Shopware\Core\Framework\Plugin\Exception\DecorationPatternException; -use Shopware\Core\Framework\Routing\Annotation\ContextTokenRequired; use Shopware\Core\Framework\Routing\Annotation\Entity; -use Shopware\Core\Framework\Routing\Annotation\RouteScope; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; use Symfony\Component\HttpFoundation\HeaderUtils; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -/** - * @RouteScope(scopes={"store-api"}) - * @ContextTokenRequired - */ class MandateRoute extends AbstractMandateRoute { private MandateServiceInterface $mandateService; @@ -37,14 +31,14 @@ public function getDecorated(): AbstractCardRoute /** * @Entity("payone_payment_mandate") - * @Route("/store-api/payone/account/mandate", name="store-api.payone.account.mandate", methods={"GET"}) + * @Route("/store-api/payone/account/mandate", name="store-api.payone.account.mandate", methods={"GET"}, defaults={"_routeScope"={"store-api"}, "_contextTokenRequired"=true}) */ public function load(SalesChannelContext $context): MandateResponse { $customer = $context->getCustomer(); if ($customer === null) { - throw new CustomerNotLoggedInException(); + throw CartException::customerNotLoggedIn(); } $result = $this->mandateService->getMandates($customer, $context); @@ -54,12 +48,12 @@ public function load(SalesChannelContext $context): MandateResponse /** * @Entity("payone_payment_mandate") - * @Route("/store-api/payone/account/mandate/{mandateId}", name="store-api.payone.account.mandate.file", methods={"GET"}) + * @Route("/store-api/payone/account/mandate/{mandateId}", name="store-api.payone.account.mandate.file", methods={"GET"}, defaults={"_routeScope"={"store-api"}, "_contextTokenRequired"=true}) */ public function getFile(string $mandateId, SalesChannelContext $context): Response { if ($context->getCustomer() === null) { - throw new CustomerNotLoggedInException(); + throw CartException::customerNotLoggedIn(); } try { diff --git a/src/Storefront/Controller/Account/AccountCardController.php b/src/Storefront/Controller/Account/AccountCardController.php index 4d98332a4..0e71edc73 100644 --- a/src/Storefront/Controller/Account/AccountCardController.php +++ b/src/Storefront/Controller/Account/AccountCardController.php @@ -6,7 +6,6 @@ use PayonePayment\StoreApi\Route\AbstractCardRoute; use PayonePayment\Storefront\Page\Card\AccountCardPageLoader; -use Shopware\Core\Framework\Routing\Annotation\RouteScope; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Shopware\Storefront\Controller\StorefrontController; use Symfony\Component\HttpFoundation\RedirectResponse; @@ -27,8 +26,7 @@ public function __construct(AccountCardPageLoader $accountCardPageLoader, Abstra } /** - * @RouteScope(scopes={"storefront"}) - * @Route("/account/card/overview", name="frontend.account.payone.card.page", options={"seo": "false"}, methods={"GET"}) + * @Route("/account/card/overview", name="frontend.account.payone.card.page", options={"seo": "false"}, methods={"GET"}, defaults={"_routeScope"={"storefront"}}) */ public function cardOverview(Request $request, SalesChannelContext $context): Response { @@ -38,8 +36,7 @@ public function cardOverview(Request $request, SalesChannelContext $context): Re } /** - * @RouteScope(scopes={"storefront"}) - * @Route("/account/card/delete", name="frontend.account.payone.card.delete", options={"seo": "false"}, methods={"GET"}) + * @Route("/account/card/delete", name="frontend.account.payone.card.delete", options={"seo": "false"}, methods={"GET"}, defaults={"_routeScope"={"storefront"}}) */ public function deleteCard(Request $request, SalesChannelContext $context): Response { diff --git a/src/Storefront/Controller/Account/AccountMandateController.php b/src/Storefront/Controller/Account/AccountMandateController.php index 4797f0994..430f67919 100644 --- a/src/Storefront/Controller/Account/AccountMandateController.php +++ b/src/Storefront/Controller/Account/AccountMandateController.php @@ -6,7 +6,6 @@ use PayonePayment\StoreApi\Route\AbstractMandateRoute; use PayonePayment\Storefront\Page\Mandate\AccountMandatePageLoader; -use Shopware\Core\Framework\Routing\Annotation\RouteScope; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Shopware\Storefront\Controller\StorefrontController; use Symfony\Component\HttpFoundation\Request; @@ -26,8 +25,7 @@ public function __construct(AccountMandatePageLoader $accountMandatePageLoader, } /** - * @RouteScope(scopes={"storefront"}) - * @Route("/account/mandate/overview", name="frontend.account.payone.mandate.page", options={"seo": "false"}, methods={"GET"}) + * @Route("/account/mandate/overview", name="frontend.account.payone.mandate.page", options={"seo": "false"}, methods={"GET"}, defaults={"_routeScope"={"storefront"}}) */ public function mandateOverview(Request $request, SalesChannelContext $context): Response { @@ -37,8 +35,7 @@ public function mandateOverview(Request $request, SalesChannelContext $context): } /** - * @RouteScope(scopes={"storefront"}) - * @Route("/account/mandate/download", name="frontend.account.payone.mandate.download", options={"seo": "false"}, methods={"GET"}) + * @Route("/account/mandate/download", name="frontend.account.payone.mandate.download", options={"seo": "false"}, methods={"GET"}, defaults={"_routeScope"={"storefront"}}) */ public function downloadMandate(Request $request, SalesChannelContext $context): Response { diff --git a/src/Storefront/Controller/Account/AccountOrderControllerDecorator.php b/src/Storefront/Controller/Account/AccountOrderControllerDecorator.php index cd79e4db0..f2a0572a0 100644 --- a/src/Storefront/Controller/Account/AccountOrderControllerDecorator.php +++ b/src/Storefront/Controller/Account/AccountOrderControllerDecorator.php @@ -6,9 +6,8 @@ use PayonePayment\PaymentHandler\PaymentHandlerGroups; use Shopware\Core\Framework\Context; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; -use Shopware\Core\Framework\Routing\Annotation\RouteScope; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Shopware\Storefront\Controller\AccountOrderController; use Shopware\Storefront\Controller\StorefrontController; @@ -18,7 +17,6 @@ /** * @Route(defaults={"_routeScope": {"storefront"}}) - * @RouteScope(scopes={"storefront"}) */ class AccountOrderControllerDecorator extends StorefrontController { @@ -27,9 +25,9 @@ class AccountOrderControllerDecorator extends StorefrontController */ protected $decoratedController; - protected EntityRepositoryInterface $orderRepository; + protected EntityRepository $orderRepository; - public function __construct(StorefrontController $decoratedController, EntityRepositoryInterface $orderRepository) + public function __construct(StorefrontController $decoratedController, EntityRepository $orderRepository) { /** @phpstan-ignore-next-line */ $this->decoratedController = $decoratedController; diff --git a/src/Storefront/Controller/Debit/ManageMandateController.php b/src/Storefront/Controller/Debit/ManageMandateController.php index 340e8d704..76dcc2553 100644 --- a/src/Storefront/Controller/Debit/ManageMandateController.php +++ b/src/Storefront/Controller/Debit/ManageMandateController.php @@ -9,7 +9,6 @@ use PayonePayment\Payone\Client\PayoneClientInterface; use PayonePayment\Payone\RequestParameter\RequestParameterFactory; use PayonePayment\Payone\RequestParameter\Struct\ManageMandateStruct; -use Shopware\Core\Framework\Routing\Annotation\RouteScope; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Shopware\Storefront\Controller\StorefrontController; use Symfony\Component\HttpFoundation\JsonResponse; @@ -31,8 +30,7 @@ public function __construct( } /** - * @RouteScope(scopes={"storefront"}) - * @Route("/payone/debit/manage-mandate", name="frontend.payone.debit.manage-mandate", options={"seo": "false"}, methods={"POST"}, defaults={"XmlHttpRequest": true}) + * @Route("/payone/debit/manage-mandate", name="frontend.payone.debit.manage-mandate", options={"seo": "false"}, methods={"POST"}, defaults={"XmlHttpRequest": true, "_routeScope"={"storefront"}}) */ public function mandateOverview(Request $request, SalesChannelContext $context): JsonResponse { diff --git a/src/Storefront/Controller/Payolution/PayolutionController.php b/src/Storefront/Controller/Payolution/PayolutionController.php index 2fc3c0649..4d1fc75f1 100644 --- a/src/Storefront/Controller/Payolution/PayolutionController.php +++ b/src/Storefront/Controller/Payolution/PayolutionController.php @@ -21,7 +21,6 @@ use Psr\Log\LoggerInterface; use Shopware\Core\Checkout\Cart\Cart; use Shopware\Core\Checkout\Cart\SalesChannel\CartService; -use Shopware\Core\Framework\Routing\Annotation\RouteScope; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Shopware\Storefront\Controller\StorefrontController; @@ -65,8 +64,7 @@ public function __construct( } /** - * @RouteScope(scopes={"storefront"}) - * @Route("/payone/consent", name="frontend.account.payone.payolution.consent", options={"seo": "false"}, methods={"GET"}, defaults={"XmlHttpRequest": true}) + * @Route("/payone/consent", name="frontend.account.payone.payolution.consent", options={"seo": "false"}, methods={"GET"}, defaults={"XmlHttpRequest": true, "_routeScope"={"storefront"}}) */ public function displayContentModal(SalesChannelContext $context): Response { @@ -93,8 +91,7 @@ public function displayContentModal(SalesChannelContext $context): Response } /** - * @RouteScope(scopes={"storefront"}) - * @Route("/payone/invoicing/validate", name="frontend.payone.payolution.invoicing.validate", options={"seo": "false"}, methods={"POST"}, defaults={"XmlHttpRequest": true}) + * @Route("/payone/invoicing/validate", name="frontend.payone.payolution.invoicing.validate", options={"seo": "false"}, methods={"POST"}, defaults={"XmlHttpRequest": true, "_routeScope"={"storefront"}}) */ public function validate(RequestDataBag $dataBag, SalesChannelContext $context): JsonResponse { @@ -123,8 +120,7 @@ public function validate(RequestDataBag $dataBag, SalesChannelContext $context): } /** - * @RouteScope(scopes={"storefront"}) - * @Route("/payone/installment/calculation", name="frontend.payone.payolution.installment.calculation", options={"seo": "false"}, methods={"POST"}, defaults={"XmlHttpRequest": true}) + * @Route("/payone/installment/calculation", name="frontend.payone.payolution.installment.calculation", options={"seo": "false"}, methods={"POST"}, defaults={"XmlHttpRequest": true, "_routeScope"={"storefront"}}) */ public function calculation(RequestDataBag $dataBag, SalesChannelContext $context): JsonResponse { @@ -194,8 +190,7 @@ public function calculation(RequestDataBag $dataBag, SalesChannelContext $contex } /** - * @RouteScope(scopes={"storefront"}) - * @Route("/payone/installment/download", name="frontend.payone.payolution.installment.download", options={"seo": "false"}, methods={"GET"}, defaults={"XmlHttpRequest": true}) + * @Route("/payone/installment/download", name="frontend.payone.payolution.installment.download", options={"seo": "false"}, methods={"GET"}, defaults={"XmlHttpRequest": true, "_routeScope"={"storefront"}}) */ public function download(Request $request, SalesChannelContext $context): Response { diff --git a/src/Storefront/Controller/Paypal/PaypalExpressController.php b/src/Storefront/Controller/Paypal/PaypalExpressController.php index f420de7af..beb76a5eb 100644 --- a/src/Storefront/Controller/Paypal/PaypalExpressController.php +++ b/src/Storefront/Controller/Paypal/PaypalExpressController.php @@ -18,10 +18,9 @@ use Shopware\Core\Checkout\Customer\SalesChannel\AbstractRegisterRoute; use Shopware\Core\Checkout\Customer\SalesChannel\AccountService; use Shopware\Core\Framework\Context; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter; -use Shopware\Core\Framework\Routing\Annotation\RouteScope; use Shopware\Core\Framework\Validation\DataBag\DataBag; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\Country\CountryEntity; @@ -50,9 +49,9 @@ class PaypalExpressController extends StorefrontController private AbstractSalesChannelContextFactory $salesChannelContextFactory; - private EntityRepositoryInterface $salutationRepository; + private EntityRepository $salutationRepository; - private EntityRepositoryInterface $countryRepository; + private EntityRepository $countryRepository; private SalesChannelContextSwitcher $salesChannelContextSwitcher; @@ -68,8 +67,8 @@ public function __construct( AbstractRegisterRoute $registerRoute, AccountService $accountService, AbstractSalesChannelContextFactory $salesChannelContextFactory, - EntityRepositoryInterface $salutationRepository, - EntityRepositoryInterface $countryRepository, + EntityRepository $salutationRepository, + EntityRepository $countryRepository, SalesChannelContextSwitcher $salesChannelContextSwitcher, CartHasherInterface $cartHasher, RouterInterface $router, @@ -89,8 +88,7 @@ public function __construct( } /** - * @RouteScope(scopes={"storefront"}) - * @Route("/payone/paypal/express-checkout", name="frontend.account.payone.paypal.express-checkout", options={"seo": "false"}, methods={"GET"}) + * @Route("/payone/paypal/express-checkout", name="frontend.account.payone.paypal.express-checkout", options={"seo": "false"}, methods={"GET"}, defaults={"_routeScope"={"storefront"}}) */ public function express(SalesChannelContext $context): Response { @@ -130,8 +128,7 @@ public function express(SalesChannelContext $context): Response } /** - * @RouteScope(scopes={"storefront"}) - * @Route("/payone/paypal/redirect-handler", name="frontend.account.payone.paypal.express-checkout-handler", options={"seo": "false"}, methods={"GET"}) + * @Route("/payone/paypal/redirect-handler", name="frontend.account.payone.paypal.express-checkout-handler", options={"seo": "false"}, methods={"GET"}, defaults={"_routeScope"={"storefront"}}) */ public function redirectHandler(SalesChannelContext $context, Request $request): Response { diff --git a/src/Storefront/Controller/Ratepay/RatepayController.php b/src/Storefront/Controller/Ratepay/RatepayController.php index 315719d83..82689de53 100644 --- a/src/Storefront/Controller/Ratepay/RatepayController.php +++ b/src/Storefront/Controller/Ratepay/RatepayController.php @@ -5,7 +5,6 @@ namespace PayonePayment\Storefront\Controller\Ratepay; use PayonePayment\Components\Ratepay\Installment\InstallmentServiceInterface; -use Shopware\Core\Framework\Routing\Annotation\RouteScope; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Shopware\Storefront\Controller\StorefrontController; @@ -22,8 +21,7 @@ public function __construct(InstallmentServiceInterface $installmentService) } /** - * @RouteScope(scopes={"storefront"}) - * @Route("/payone/ratepay/installment/calculation", name="frontend.payone.ratepay.installment.calculation", options={"seo": "false"}, methods={"POST"}, defaults={"XmlHttpRequest": true}) + * @Route("/payone/ratepay/installment/calculation", name="frontend.payone.ratepay.installment.calculation", options={"seo": "false"}, methods={"POST"}, defaults={"XmlHttpRequest": true, "_routeScope"={"storefront"}}) */ public function calculation(RequestDataBag $dataBag, SalesChannelContext $context): Response { diff --git a/src/Storefront/Page/Card/AccountCardPageLoader.php b/src/Storefront/Page/Card/AccountCardPageLoader.php index 5d5528ef8..a1476a913 100644 --- a/src/Storefront/Page/Card/AccountCardPageLoader.php +++ b/src/Storefront/Page/Card/AccountCardPageLoader.php @@ -5,7 +5,7 @@ namespace PayonePayment\Storefront\Page\Card; use PayonePayment\StoreApi\Route\AbstractCardRoute; -use Shopware\Core\Checkout\Cart\Exception\CustomerNotLoggedInException; +use Shopware\Core\Checkout\Cart\CartException; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Shopware\Storefront\Page\GenericPageLoader; use Symfony\Component\EventDispatcher\EventDispatcherInterface; @@ -32,7 +32,8 @@ public function __construct( public function load(Request $request, SalesChannelContext $context): AccountCardPage { if (!$context->getCustomer()) { - throw new CustomerNotLoggedInException(); + // ToDo 6.5: Die CartException gibt es erst ab 6.4.15.0. Ok das dann als neue Mindestversion zu nehmen? (Kommt auch an anderen Stellen vor) + throw CartException::customerNotLoggedIn(); } $page = AccountCardPage::createFrom( diff --git a/src/Storefront/Page/Mandate/AccountMandatePageLoader.php b/src/Storefront/Page/Mandate/AccountMandatePageLoader.php index d22e1f690..29dc824cf 100644 --- a/src/Storefront/Page/Mandate/AccountMandatePageLoader.php +++ b/src/Storefront/Page/Mandate/AccountMandatePageLoader.php @@ -5,7 +5,7 @@ namespace PayonePayment\Storefront\Page\Mandate; use PayonePayment\StoreApi\Route\AbstractMandateRoute; -use Shopware\Core\Checkout\Cart\Exception\CustomerNotLoggedInException; +use Shopware\Core\Checkout\Cart\CartException; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Shopware\Storefront\Page\GenericPageLoader; use Symfony\Component\EventDispatcher\EventDispatcherInterface; @@ -32,7 +32,7 @@ public function __construct( public function load(Request $request, SalesChannelContext $context): AccountMandatePage { if (!$context->getCustomer()) { - throw new CustomerNotLoggedInException(); + throw CartException::customerNotLoggedIn(); } $page = AccountMandatePage::createFrom( From 9b26e4d939266dabe334465ebaf1fdf466941b48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20M=C3=BCller?= Date: Thu, 27 Apr 2023 14:48:49 +0200 Subject: [PATCH 05/41] [PAYONE-184] Add manual improvements and compatibility changes (before rector) --- composer.json | 9 +- composer.lock | 3833 ++++++++++++----- phpstan.neon | 5 +- phpunit.xml.dist | 1 - rector.php | 18 + src/Components/CartHasher/CartHasher.php | 11 +- .../RedirectHandler/RedirectHandler.php | 11 +- .../handler/global_handlers.xml | 2 + src/DependencyInjection/services.xml | 5 + .../InvoiceRendererEventListener.php | 1 - src/Resources/app/administration/src/main.js | 2 - .../payone-notification-target/index.js | 5 +- .../index.js | 6 +- .../payone-notification-target-list/index.js | 6 +- .../component/payone-data-grid/index.js | 7 - .../payone-payment-plugin-icon/index.js | 6 +- .../index.js | 7 +- ...e-ratepay-profile-configurations.html.twig | 0 ...payone-ratepay-profile-configurations.scss | 0 .../payone-ratepay-profiles/index.js | 6 +- .../payone-ratepay-profiles.html.twig | 0 .../payone-ratepay-profiles.scss | 0 .../extension/sw-order/index.js | 146 - .../extension/sw-order/sw-order.html.twig | 74 - .../extension/sw-settings-index/index.js | 13 - .../sw-settings-index.html.twig | 11 - .../sw-settings-index/sw-settings-index.scss | 8 - .../filter/payone_currency.filter.js | 5 +- .../src/module/payone-payment/index.js | 39 +- .../page/payone-settings/index.js | 10 +- .../module/payone-payment/snippet/de_DE.json | 55 - .../module/payone-payment/snippet/en_GB.json | 55 - .../component/payone-capture-button}/index.js | 16 +- .../payone-capture-button.html.twig} | 20 +- .../payone-capture-button.scss} | 0 .../component/payone-data-grid/index.js | 5 + .../payone-data-grid.html.twig | 0 .../component/payone-order-items}/index.js | 18 +- .../payone-order-items.html.twig} | 0 .../payone-order-items.scss} | 0 .../payone-payment-management/index.js | 133 + .../payone-payment-management.html.twig | 78 + .../payone-payment-management.scss} | 4 +- .../component/payone-refund-button}/index.js | 22 +- .../payone-refund-button.html.twig} | 20 +- .../payone-refund-button.scss} | 0 .../component/sw-order-user-card/index.js | 13 - .../sw-order-user-card.html.twig | 11 - .../src/module/sw-order/index.js | 29 +- .../sw-order/page/sw-order-detail/index.js | 37 + .../sw-order-detail/sw-order-detail.html.twig | 15 + .../src/module/sw-order/snippet/de-DE.json | 60 + .../src/module/sw-order/snippet/en-GB.json | 60 + .../view/sw-order-detail-payone/index.js | 21 + .../sw-order-detail-payone.html.twig | 6 + .../dist/storefront/js/payone-payment.js | 2 +- .../src/apple-pay/payone-payment.apple-pay.js | 12 +- .../debit-card/payone-payment.debit-card.js | 2 - .../payone-payment.payolution-installment.js | 2 - .../payone-payment.payolution-invoicing.js | 2 - .../payone-payment.ratepay-installment.js | 10 +- .../administration/js/payone-payment.js | 2 +- .../payone/debit/debit-form.html.twig | 2 - .../payolution-installment-form.html.twig | 2 - .../payolution-invoicing-form.html.twig | 2 - .../ratepay-installment-form.html.twig | 2 - .../secure-invoice/secure-invoice.html.twig | 3 - src/StoreApi/Route/AbstractApplePayRoute.php | 2 + src/StoreApi/Route/AbstractMandateRoute.php | 2 +- src/StoreApi/Route/ApplePayRoute.php | 2 +- src/StoreApi/Route/MandateRoute.php | 2 +- .../Page/Card/AccountCardPageLoader.php | 1 - .../TransactionDataHandlerTest.php | 6 +- .../AbstractDeviceFingerprintServiceTest.php | 50 +- ...PayoneBNPLDeviceFingerprintServiceTest.php | 6 +- .../RatepayDeviceFingerprintServiceTest.php | 6 +- .../RedirectHandler/RedirectHandlerTest.php | 29 +- .../DeviceFingerprintEventListenerTest.php | 7 + .../InvoiceRendererEventListenerTest.php | 108 + .../OrderValidationEventListenerTest.php | 6 +- .../PayoneCreditCardPaymentHandlerTest.php | 6 +- .../PayonePaypalPaymentHandlerTest.php | 6 +- ...TransactionRequestParameterBuilderTest.php | 14 +- .../AuthorizeRequestParameterBuilderTest.php | 21 +- ...reAuthorizeRequestParameterBuilderTest.php | 11 +- .../AuthorizeRequestParameterBuilderTest.php | 26 +- ...reAuthorizeRequestParameterBuilderTest.php | 11 +- .../AuthorizeRequestParameterBuilderTest.php | 21 +- ...reAuthorizeRequestParameterBuilderTest.php | 11 +- .../AuthorizeRequestParameterBuilderTest.php | 30 +- ...reAuthorizeRequestParameterBuilderTest.php | 10 +- .../AuthorizeRequestParameterBuilderTest.php | 30 +- ...reAuthorizeRequestParameterBuilderTest.php | 10 +- .../AuthorizeRequestParameterBuilderTest.php | 30 +- ...reAuthorizeRequestParameterBuilderTest.php | 10 +- .../Processor/WebhookProcessorTest.php | 14 +- .../AccountOrderControllerDecoratorTest.php | 12 +- ...TransactionStatusWebhookHandlerFactory.php | 6 +- tests/TestCaseBase/PayoneTestBehavior.php | 21 +- 99 files changed, 3760 insertions(+), 1735 deletions(-) create mode 100644 rector.php delete mode 100644 src/Resources/app/administration/src/module/payone-payment/component/payone-data-grid/index.js rename src/Resources/app/administration/src/{ => module/payone-payment}/component/payone-ratepay-profile-configurations/index.js (95%) rename src/Resources/app/administration/src/{ => module/payone-payment}/component/payone-ratepay-profile-configurations/payone-ratepay-profile-configurations.html.twig (100%) rename src/Resources/app/administration/src/{ => module/payone-payment}/component/payone-ratepay-profile-configurations/payone-ratepay-profile-configurations.scss (100%) rename src/Resources/app/administration/src/{ => module/payone-payment}/component/payone-ratepay-profiles/index.js (98%) rename src/Resources/app/administration/src/{ => module/payone-payment}/component/payone-ratepay-profiles/payone-ratepay-profiles.html.twig (100%) rename src/Resources/app/administration/src/{ => module/payone-payment}/component/payone-ratepay-profiles/payone-ratepay-profiles.scss (100%) delete mode 100644 src/Resources/app/administration/src/module/payone-payment/extension/sw-order/index.js delete mode 100644 src/Resources/app/administration/src/module/payone-payment/extension/sw-order/sw-order.html.twig delete mode 100644 src/Resources/app/administration/src/module/payone-payment/extension/sw-settings-index/index.js delete mode 100644 src/Resources/app/administration/src/module/payone-payment/extension/sw-settings-index/sw-settings-index.html.twig delete mode 100644 src/Resources/app/administration/src/module/payone-payment/extension/sw-settings-index/sw-settings-index.scss rename src/Resources/app/administration/src/module/{payone-payment/component/capture => sw-order/component/payone-capture-button}/index.js (95%) rename src/Resources/app/administration/src/module/{payone-payment/component/capture/capture.html.twig => sw-order/component/payone-capture-button/payone-capture-button.html.twig} (62%) rename src/Resources/app/administration/src/module/{payone-payment/component/capture/style.scss => sw-order/component/payone-capture-button/payone-capture-button.scss} (100%) create mode 100644 src/Resources/app/administration/src/module/sw-order/component/payone-data-grid/index.js rename src/Resources/app/administration/src/module/{payone-payment => sw-order}/component/payone-data-grid/payone-data-grid.html.twig (100%) rename src/Resources/app/administration/src/module/{payone-payment/component/order-items => sw-order/component/payone-order-items}/index.js (87%) rename src/Resources/app/administration/src/module/{payone-payment/component/order-items/order-items.html.twig => sw-order/component/payone-order-items/payone-order-items.html.twig} (100%) rename src/Resources/app/administration/src/module/{payone-payment/component/order-items/order-items.scss => sw-order/component/payone-order-items/payone-order-items.scss} (100%) create mode 100644 src/Resources/app/administration/src/module/sw-order/component/payone-payment-management/index.js create mode 100644 src/Resources/app/administration/src/module/sw-order/component/payone-payment-management/payone-payment-management.html.twig rename src/Resources/app/administration/src/module/{payone-payment/extension/sw-order/sw-order.scss => sw-order/component/payone-payment-management/payone-payment-management.scss} (73%) rename src/Resources/app/administration/src/module/{payone-payment/component/refund => sw-order/component/payone-refund-button}/index.js (93%) rename src/Resources/app/administration/src/module/{payone-payment/component/refund/refund.html.twig => sw-order/component/payone-refund-button/payone-refund-button.html.twig} (62%) rename src/Resources/app/administration/src/module/{payone-payment/component/refund/style.scss => sw-order/component/payone-refund-button/payone-refund-button.scss} (100%) delete mode 100644 src/Resources/app/administration/src/module/sw-order/component/sw-order-user-card/index.js delete mode 100644 src/Resources/app/administration/src/module/sw-order/component/sw-order-user-card/sw-order-user-card.html.twig create mode 100644 src/Resources/app/administration/src/module/sw-order/page/sw-order-detail/index.js create mode 100644 src/Resources/app/administration/src/module/sw-order/page/sw-order-detail/sw-order-detail.html.twig create mode 100644 src/Resources/app/administration/src/module/sw-order/view/sw-order-detail-payone/index.js create mode 100644 src/Resources/app/administration/src/module/sw-order/view/sw-order-detail-payone/sw-order-detail-payone.html.twig create mode 100644 tests/EventListener/InvoiceRendererEventListenerTest.php diff --git a/composer.json b/composer.json index ce8495654..ee91dc3b2 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "payone-gmbh/shopware-6", "type": "shopware-platform-plugin", "description": "PAYONE Payment Plugin", - "version": "4.2.1", + "version": "5.0.0", "license": "MIT", "authors": [ { @@ -23,9 +23,9 @@ "ext-curl": "*", "ext-json": "*", "sinergi/browser-detector": "^6.1", - "shopware/core": ">= 6.4", - "shopware/administration": ">= 6.4", - "shopware/storefront": ">= 6.4" + "shopware/core": ">= 6.5", + "shopware/administration": ">= 6.5", + "shopware/storefront": ">= 6.5" }, "require-dev": { "dms/phpunit-arraysubset-asserts": "^0.3.0", @@ -34,6 +34,7 @@ "phpstan/phpstan-phpunit": "1.1.1", "phpstan/phpstan-symfony": "^1.2", "phpunit/phpunit": "^9.5", + "rector/rector": "^0.15.25", "symplify/easy-coding-standard": "^10.0" }, "autoload": { diff --git a/composer.lock b/composer.lock index 454442ee3..de44599f4 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "6431aeca1340c673674802cd37e0bde9", + "content-hash": "543ee0eb270616e9f3bf5adc6ede7ce9", "packages": [ { "name": "sinergi/browser-detector", @@ -57,37 +57,43 @@ "issues": "https://github.com/sinergi/php-browser-detector/issues", "source": "https://github.com/sinergi/php-browser-detector/tree/6.1.4" }, + "abandoned": true, "time": "2021-09-23T13:51:44+00:00" } ], "packages-dev": [ { - "name": "dms/phpunit-arraysubset-asserts", - "version": "v0.3.1", + "name": "composer/pcre", + "version": "3.1.0", "source": { "type": "git", - "url": "https://github.com/rdohms/phpunit-arraysubset-asserts.git", - "reference": "e1b47df99cd0dbb3f63528adc5c990256218c707" + "url": "https://github.com/composer/pcre.git", + "reference": "4bff79ddd77851fe3cdd11616ed3f92841ba5bd2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rdohms/phpunit-arraysubset-asserts/zipball/e1b47df99cd0dbb3f63528adc5c990256218c707", - "reference": "e1b47df99cd0dbb3f63528adc5c990256218c707", + "url": "https://api.github.com/repos/composer/pcre/zipball/4bff79ddd77851fe3cdd11616ed3f92841ba5bd2", + "reference": "4bff79ddd77851fe3cdd11616ed3f92841ba5bd2", "shasum": "" }, "require": { - "php": "^5.4 || ^7.0 || ^8.0", - "phpunit/phpunit": "^4.8.36 || ^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.0" + "php": "^7.4 || ^8.0" }, "require-dev": { - "dms/coding-standard": "^9", - "squizlabs/php_codesniffer": "^3.4" + "phpstan/phpstan": "^1.3", + "phpstan/phpstan-strict-rules": "^1.1", + "symfony/phpunit-bridge": "^5" }, "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, "autoload": { - "files": [ - "assertarraysubset-autoload.php" - ] + "psr-4": { + "Composer\\Pcre\\": "src" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -95,48 +101,68 @@ ], "authors": [ { - "name": "Rafael Dohms", - "email": "rdohms@gmail.com" + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" } ], - "description": "This package provides ArraySubset and related asserts once deprecated in PHPUnit 8", + "description": "PCRE wrapping library that offers type-safe preg_* replacements.", + "keywords": [ + "PCRE", + "preg", + "regex", + "regular expression" + ], "support": { - "issues": "https://github.com/rdohms/phpunit-arraysubset-asserts/issues", - "source": "https://github.com/rdohms/phpunit-arraysubset-asserts/tree/v0.3.1" + "issues": "https://github.com/composer/pcre/issues", + "source": "https://github.com/composer/pcre/tree/3.1.0" }, - "time": "2021-10-17T18:50:58+00:00" + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2022-11-17T09:50:14+00:00" }, { - "name": "doctrine/instantiator", - "version": "1.4.1", + "name": "composer/semver", + "version": "3.3.2", "source": { "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc" + "url": "https://github.com/composer/semver.git", + "reference": "3953f23262f2bff1919fc82183ad9acb13ff62c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc", - "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc", + "url": "https://api.github.com/repos/composer/semver/zipball/3953f23262f2bff1919fc82183ad9acb13ff62c9", + "reference": "3953f23262f2bff1919fc82183ad9acb13ff62c9", "shasum": "" }, "require": { - "php": "^7.1 || ^8.0" + "php": "^5.3.2 || ^7.0 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^9", - "ext-pdo": "*", - "ext-phar": "*", - "phpbench/phpbench": "^0.16 || ^1", "phpstan/phpstan": "^1.4", - "phpstan/phpstan-phpunit": "^1", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "vimeo/psalm": "^4.22" + "symfony/phpunit-bridge": "^4.2 || ^5" }, "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, "autoload": { "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + "Composer\\Semver\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -145,66 +171,77 @@ ], "authors": [ { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "https://ocramius.github.io/" + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" } ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://www.doctrine-project.org/projects/instantiator.html", + "description": "Semver library that offers utilities, version constraint parsing and validation.", "keywords": [ - "constructor", - "instantiate" + "semantic", + "semver", + "validation", + "versioning" ], "support": { - "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.4.1" + "irc": "irc://irc.freenode.org/composer", + "issues": "https://github.com/composer/semver/issues", + "source": "https://github.com/composer/semver/tree/3.3.2" }, "funding": [ { - "url": "https://www.doctrine-project.org/sponsorship.html", + "url": "https://packagist.com", "type": "custom" }, { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" + "url": "https://github.com/composer", + "type": "github" }, { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", + "url": "https://tidelift.com/funding/github/packagist/composer/composer", "type": "tidelift" } ], - "time": "2022-03-03T08:28:38+00:00" + "time": "2022-04-01T19:23:25+00:00" }, { - "name": "kubawerlos/php-cs-fixer-custom-fixers", - "version": "v3.11.2", + "name": "composer/xdebug-handler", + "version": "3.0.3", "source": { "type": "git", - "url": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers.git", - "reference": "b3a7c140ec5400a2772c1e6cdd1852824e415893" + "url": "https://github.com/composer/xdebug-handler.git", + "reference": "ced299686f41dce890debac69273b47ffe98a40c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/kubawerlos/php-cs-fixer-custom-fixers/zipball/b3a7c140ec5400a2772c1e6cdd1852824e415893", - "reference": "b3a7c140ec5400a2772c1e6cdd1852824e415893", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/ced299686f41dce890debac69273b47ffe98a40c", + "reference": "ced299686f41dce890debac69273b47ffe98a40c", "shasum": "" }, "require": { - "ext-filter": "*", - "ext-tokenizer": "*", - "php": "^7.4 || ^8.0" - }, - "conflict": { - "friendsofphp/php-cs-fixer": "<3.6.0" + "composer/pcre": "^1 || ^2 || ^3", + "php": "^7.2.5 || ^8.0", + "psr/log": "^1 || ^2 || ^3" }, "require-dev": { - "phpunit/phpunit": "^9.5.20" + "phpstan/phpstan": "^1.0", + "phpstan/phpstan-strict-rules": "^1.1", + "symfony/phpunit-bridge": "^6.0" }, "type": "library", "autoload": { "psr-4": { - "PhpCsFixerCustomFixers\\": "src" + "Composer\\XdebugHandler\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -213,269 +250,365 @@ ], "authors": [ { - "name": "Kuba Werłos", - "email": "werlos@gmail.com" + "name": "John Stevenson", + "email": "john-stevenson@blueyonder.co.uk" } ], - "description": "A set of custom fixers for PHP CS Fixer", + "description": "Restarts a process without Xdebug.", + "keywords": [ + "Xdebug", + "performance" + ], "support": { - "issues": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers/issues", - "source": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers/tree/v3.11.2" + "irc": "irc://irc.freenode.org/composer", + "issues": "https://github.com/composer/xdebug-handler/issues", + "source": "https://github.com/composer/xdebug-handler/tree/3.0.3" }, - "time": "2022-08-11T18:24:28+00:00" + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2022-02-25T21:32:43+00:00" }, { - "name": "myclabs/deep-copy", - "version": "1.11.0", + "name": "dms/phpunit-arraysubset-asserts", + "version": "v0.3.1", "source": { "type": "git", - "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" + "url": "https://github.com/rdohms/phpunit-arraysubset-asserts.git", + "reference": "e1b47df99cd0dbb3f63528adc5c990256218c707" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", + "url": "https://api.github.com/repos/rdohms/phpunit-arraysubset-asserts/zipball/e1b47df99cd0dbb3f63528adc5c990256218c707", + "reference": "e1b47df99cd0dbb3f63528adc5c990256218c707", "shasum": "" }, "require": { - "php": "^7.1 || ^8.0" - }, - "conflict": { - "doctrine/collections": "<1.6.8", - "doctrine/common": "<2.13.3 || >=3,<3.2.2" + "php": "^5.4 || ^7.0 || ^8.0", + "phpunit/phpunit": "^4.8.36 || ^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.0" }, "require-dev": { - "doctrine/collections": "^1.6.8", - "doctrine/common": "^2.13.3 || ^3.2.2", - "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" + "dms/coding-standard": "^9", + "squizlabs/php_codesniffer": "^3.4" }, "type": "library", "autoload": { "files": [ - "src/DeepCopy/deep_copy.php" - ], - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - } + "assertarraysubset-autoload.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "description": "Create deep copies (clones) of your objects", - "keywords": [ - "clone", - "copy", - "duplicate", - "object", - "object graph" - ], - "support": { - "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" - }, - "funding": [ + "authors": [ { - "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", - "type": "tidelift" + "name": "Rafael Dohms", + "email": "rdohms@gmail.com" } ], - "time": "2022-03-03T13:19:32+00:00" + "description": "This package provides ArraySubset and related asserts once deprecated in PHPUnit 8", + "support": { + "issues": "https://github.com/rdohms/phpunit-arraysubset-asserts/issues", + "source": "https://github.com/rdohms/phpunit-arraysubset-asserts/tree/v0.3.1" + }, + "time": "2021-10-17T18:50:58+00:00" }, { - "name": "nikic/php-parser", - "version": "v4.14.0", + "name": "doctrine/annotations", + "version": "2.0.1", "source": { "type": "git", - "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "34bea19b6e03d8153165d8f30bba4c3be86184c1" + "url": "https://github.com/doctrine/annotations.git", + "reference": "e157ef3f3124bbf6fe7ce0ffd109e8a8ef284e7f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/34bea19b6e03d8153165d8f30bba4c3be86184c1", - "reference": "34bea19b6e03d8153165d8f30bba4c3be86184c1", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/e157ef3f3124bbf6fe7ce0ffd109e8a8ef284e7f", + "reference": "e157ef3f3124bbf6fe7ce0ffd109e8a8ef284e7f", "shasum": "" }, "require": { + "doctrine/lexer": "^2 || ^3", "ext-tokenizer": "*", - "php": ">=7.0" + "php": "^7.2 || ^8.0", + "psr/cache": "^1 || ^2 || ^3" }, "require-dev": { - "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" + "doctrine/cache": "^2.0", + "doctrine/coding-standard": "^10", + "phpstan/phpstan": "^1.8.0", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "symfony/cache": "^5.4 || ^6", + "vimeo/psalm": "^4.10" }, - "bin": [ - "bin/php-parse" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.9-dev" - } + "suggest": { + "php": "PHP 8.0 or higher comes with attributes, a native replacement for annotations" }, + "type": "library", "autoload": { "psr-4": { - "PhpParser\\": "lib/PhpParser" + "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Nikita Popov" + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" } ], - "description": "A PHP parser written in PHP", + "description": "Docblock Annotations Parser", + "homepage": "https://www.doctrine-project.org/projects/annotations.html", "keywords": [ - "parser", - "php" + "annotations", + "docblock", + "parser" ], "support": { - "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.14.0" + "issues": "https://github.com/doctrine/annotations/issues", + "source": "https://github.com/doctrine/annotations/tree/2.0.1" }, - "time": "2022-05-31T20:59:12+00:00" + "time": "2023-02-02T22:02:53+00:00" }, { - "name": "phar-io/manifest", - "version": "2.0.3", + "name": "doctrine/instantiator", + "version": "2.0.0", "source": { "type": "git", - "url": "https://github.com/phar-io/manifest.git", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53" + "url": "https://github.com/doctrine/instantiator.git", + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", "shasum": "" }, "require": { - "ext-dom": "*", + "php": "^8.1" + }, + "require-dev": { + "doctrine/coding-standard": "^11", + "ext-pdo": "*", "ext-phar": "*", - "ext-xmlwriter": "*", - "phar-io/version": "^3.0.1", - "php": "^7.2 || ^8.0" + "phpbench/phpbench": "^1.2", + "phpstan/phpstan": "^1.9.4", + "phpstan/phpstan-phpunit": "^1.3", + "phpunit/phpunit": "^9.5.27", + "vimeo/psalm": "^5.4" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, "autoload": { - "classmap": [ - "src/" - ] + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "https://ocramius.github.io/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", + "keywords": [ + "constructor", + "instantiate" + ], + "support": { + "issues": "https://github.com/doctrine/instantiator/issues", + "source": "https://github.com/doctrine/instantiator/tree/2.0.0" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" }, { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" }, { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", + "type": "tidelift" } ], - "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", - "support": { - "issues": "https://github.com/phar-io/manifest/issues", - "source": "https://github.com/phar-io/manifest/tree/2.0.3" - }, - "time": "2021-07-20T11:28:43+00:00" + "time": "2022-12-30T00:23:10+00:00" }, { - "name": "phar-io/version", - "version": "3.2.1", + "name": "doctrine/lexer", + "version": "3.0.0", "source": { "type": "git", - "url": "https://github.com/phar-io/version.git", - "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" + "url": "https://github.com/doctrine/lexer.git", + "reference": "84a527db05647743d50373e0ec53a152f2cde568" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", - "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/84a527db05647743d50373e0ec53a152f2cde568", + "reference": "84a527db05647743d50373e0ec53a152f2cde568", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0" + "php": "^8.1" + }, + "require-dev": { + "doctrine/coding-standard": "^10", + "phpstan/phpstan": "^1.9", + "phpunit/phpunit": "^9.5", + "psalm/plugin-phpunit": "^0.18.3", + "vimeo/psalm": "^5.0" }, "type": "library", "autoload": { - "classmap": [ - "src/" - ] + "psr-4": { + "Doctrine\\Common\\Lexer\\": "src" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" }, { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" + "name": "Roman Borschel", + "email": "roman@code-factory.org" }, { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" } ], - "description": "Library for handling version information and constraints", + "description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "https://www.doctrine-project.org/projects/lexer.html", + "keywords": [ + "annotations", + "docblock", + "lexer", + "parser", + "php" + ], "support": { - "issues": "https://github.com/phar-io/version/issues", - "source": "https://github.com/phar-io/version/tree/3.2.1" + "issues": "https://github.com/doctrine/lexer/issues", + "source": "https://github.com/doctrine/lexer/tree/3.0.0" }, - "time": "2022-02-21T01:04:05+00:00" + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Flexer", + "type": "tidelift" + } + ], + "time": "2022-12-15T16:57:16+00:00" }, { - "name": "phpdocumentor/reflection-common", - "version": "2.2.0", + "name": "friendsofphp/php-cs-fixer", + "version": "v3.16.0", "source": { "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" + "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", + "reference": "d40f9436e1c448d309fa995ab9c14c5c7a96f2dc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/d40f9436e1c448d309fa995ab9c14c5c7a96f2dc", + "reference": "d40f9436e1c448d309fa995ab9c14c5c7a96f2dc", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0" + "composer/semver": "^3.3", + "composer/xdebug-handler": "^3.0.3", + "doctrine/annotations": "^2", + "doctrine/lexer": "^2 || ^3", + "ext-json": "*", + "ext-tokenizer": "*", + "php": "^7.4 || ^8.0", + "sebastian/diff": "^4.0 || ^5.0", + "symfony/console": "^5.4 || ^6.0", + "symfony/event-dispatcher": "^5.4 || ^6.0", + "symfony/filesystem": "^5.4 || ^6.0", + "symfony/finder": "^5.4 || ^6.0", + "symfony/options-resolver": "^5.4 || ^6.0", + "symfony/polyfill-mbstring": "^1.27", + "symfony/polyfill-php80": "^1.27", + "symfony/polyfill-php81": "^1.27", + "symfony/process": "^5.4 || ^6.0", + "symfony/stopwatch": "^5.4 || ^6.0" }, - "type": "library", - "extra": { - "branch-alias": { - "dev-2.x": "2.x-dev" - } + "require-dev": { + "justinrainbow/json-schema": "^5.2", + "keradus/cli-executor": "^2.0", + "mikey179/vfsstream": "^1.6.11", + "php-coveralls/php-coveralls": "^2.5.3", + "php-cs-fixer/accessible-object": "^1.1", + "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.2", + "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.2.1", + "phpspec/prophecy": "^1.16", + "phpspec/prophecy-phpunit": "^2.0", + "phpunit/phpunit": "^9.5", + "phpunitgoodpractices/polyfill": "^1.6", + "phpunitgoodpractices/traits": "^1.9.2", + "symfony/phpunit-bridge": "^6.2.3", + "symfony/yaml": "^5.4 || ^6.0" + }, + "suggest": { + "ext-dom": "For handling output formats in XML", + "ext-mbstring": "For handling non-UTF8 characters." }, + "bin": [ + "php-cs-fixer" + ], + "type": "application", "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": "src/" + "PhpCsFixer\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -484,59 +617,60 @@ ], "authors": [ { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Dariusz Rumiński", + "email": "dariusz.ruminski@gmail.com" } ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", + "description": "A tool to automatically fix PHP code style", "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", + "Static code analysis", + "fixer", + "standards", "static analysis" ], "support": { - "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", - "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" + "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.16.0" }, - "time": "2020-06-27T09:03:43+00:00" + "funding": [ + { + "url": "https://github.com/keradus", + "type": "github" + } + ], + "time": "2023-04-02T19:30:06+00:00" }, { - "name": "phpdocumentor/reflection-docblock", - "version": "5.3.0", + "name": "kubawerlos/php-cs-fixer-custom-fixers", + "version": "v3.14.0", "source": { "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" + "url": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers.git", + "reference": "0414fbeada4360510df515b613ccc4055921a3c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", + "url": "https://api.github.com/repos/kubawerlos/php-cs-fixer-custom-fixers/zipball/0414fbeada4360510df515b613ccc4055921a3c7", + "reference": "0414fbeada4360510df515b613ccc4055921a3c7", "shasum": "" }, "require": { "ext-filter": "*", - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.2", - "phpdocumentor/type-resolver": "^1.3", - "webmozart/assert": "^1.9.1" + "ext-tokenizer": "*", + "friendsofphp/php-cs-fixer": "^3.16.0", + "php": "^7.4 || ^8.0" }, "require-dev": { - "mockery/mockery": "~1.3.2", - "psalm/phar": "^4.8" + "phpunit/phpunit": "^9.6.4 || ^10.0.14" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.x-dev" - } - }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": "src" + "PhpCsFixerCustomFixers\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -545,150 +679,255 @@ ], "authors": [ { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - }, - { - "name": "Jaap van Otterdijk", - "email": "account@ijaap.nl" + "name": "Kuba Werłos", + "email": "werlos@gmail.com" } ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "description": "A set of custom fixers for PHP CS Fixer", "support": { - "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" + "issues": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers/issues", + "source": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers/tree/v3.14.0" }, - "time": "2021-10-19T17:43:47+00:00" + "time": "2023-04-03T20:47:19+00:00" }, { - "name": "phpdocumentor/type-resolver", - "version": "1.6.1", + "name": "myclabs/deep-copy", + "version": "1.11.1", "source": { "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "77a32518733312af16a44300404e945338981de3" + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/77a32518733312af16a44300404e945338981de3", - "reference": "77a32518733312af16a44300404e945338981de3", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.0" + "php": "^7.1 || ^8.0" + }, + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3,<3.2.2" }, "require-dev": { + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" + }, + "type": "library", + "autoload": { + "files": [ + "src/DeepCopy/deep_copy.php" + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "support": { + "issues": "https://github.com/myclabs/DeepCopy/issues", + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" + }, + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "time": "2023-03-08T13:26:56+00:00" + }, + { + "name": "nikic/php-parser", + "version": "v4.15.4", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "6bb5176bc4af8bcb7d926f88718db9b96a2d4290" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/6bb5176bc4af8bcb7d926f88718db9b96a2d4290", + "reference": "6bb5176bc4af8bcb7d926f88718db9b96a2d4290", + "shasum": "" + }, + "require": { "ext-tokenizer": "*", - "psalm/phar": "^4.8" + "php": ">=7.0" + }, + "require-dev": { + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" }, + "bin": [ + "bin/php-parse" + ], "type": "library", "extra": { "branch-alias": { - "dev-1.x": "1.x-dev" + "dev-master": "4.9-dev" } }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": "src" + "PhpParser\\": "lib/PhpParser" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" + "name": "Nikita Popov" } ], - "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], "support": { - "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.1" + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.4" }, - "time": "2022-03-15T21:29:03+00:00" + "time": "2023-03-05T19:49:14+00:00" }, { - "name": "phpspec/prophecy", - "version": "v1.15.0", + "name": "phar-io/manifest", + "version": "2.0.3", "source": { "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13" + "url": "https://github.com/phar-io/manifest.git", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13", - "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.2", - "php": "^7.2 || ~8.0, <8.2", - "phpdocumentor/reflection-docblock": "^5.2", - "sebastian/comparator": "^3.0 || ^4.0", - "sebastian/recursion-context": "^3.0 || ^4.0" - }, - "require-dev": { - "phpspec/phpspec": "^6.0 || ^7.0", - "phpunit/phpunit": "^8.0 || ^9.0" + "ext-dom": "*", + "ext-phar": "*", + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { - "psr-4": { - "Prophecy\\": "src/Prophecy" - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" }, { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" } ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "support": { + "issues": "https://github.com/phar-io/manifest/issues", + "source": "https://github.com/phar-io/manifest/tree/2.0.3" + }, + "time": "2021-07-20T11:28:43+00:00" + }, + { + "name": "phar-io/version", + "version": "3.2.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } ], + "description": "Library for handling version information and constraints", "support": { - "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/v1.15.0" + "issues": "https://github.com/phar-io/version/issues", + "source": "https://github.com/phar-io/version/tree/3.2.1" }, - "time": "2021-12-08T12:19:24+00:00" + "time": "2022-02-21T01:04:05+00:00" }, { "name": "phpstan/phpstan", - "version": "1.10.6", + "version": "1.10.14", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "50d089a3e0904b0fe7e2cf2d4fd37d427d64235a" + "reference": "d232901b09e67538e5c86a724be841bea5768a7c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/50d089a3e0904b0fe7e2cf2d4fd37d427d64235a", - "reference": "50d089a3e0904b0fe7e2cf2d4fd37d427d64235a", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/d232901b09e67538e5c86a724be841bea5768a7c", + "reference": "d232901b09e67538e5c86a724be841bea5768a7c", "shasum": "" }, "require": { @@ -717,8 +956,11 @@ "static analysis" ], "support": { + "docs": "https://phpstan.org/user-guide/getting-started", + "forum": "https://github.com/phpstan/phpstan/discussions", "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.10.6" + "security": "https://github.com/phpstan/phpstan/security/policy", + "source": "https://github.com/phpstan/phpstan-src" }, "funding": [ { @@ -734,7 +976,7 @@ "type": "tidelift" } ], - "time": "2023-03-09T16:55:12+00:00" + "time": "2023-04-19T13:47:27+00:00" }, { "name": "phpstan/phpstan-phpunit", @@ -746,159 +988,1509 @@ }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/4a3c437c09075736285d1cabb5c75bf27ed0bc84", - "reference": "4a3c437c09075736285d1cabb5c75bf27ed0bc84", + "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/4a3c437c09075736285d1cabb5c75bf27ed0bc84", + "reference": "4a3c437c09075736285d1cabb5c75bf27ed0bc84", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0", + "phpstan/phpstan": "^1.5.0" + }, + "conflict": { + "phpunit/phpunit": "<7.0" + }, + "require-dev": { + "nikic/php-parser": "^4.13.0", + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/phpstan-strict-rules": "^1.0", + "phpunit/phpunit": "^9.5" + }, + "type": "phpstan-extension", + "extra": { + "phpstan": { + "includes": [ + "extension.neon", + "rules.neon" + ] + } + }, + "autoload": { + "psr-4": { + "PHPStan\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPUnit extensions and rules for PHPStan", + "support": { + "issues": "https://github.com/phpstan/phpstan-phpunit/issues", + "source": "https://github.com/phpstan/phpstan-phpunit/tree/1.1.1" + }, + "time": "2022-04-20T15:24:25+00:00" + }, + { + "name": "phpstan/phpstan-symfony", + "version": "1.3.1", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan-symfony.git", + "reference": "7e78605a699d183f5a6936cf91904f4c16ca79b2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan-symfony/zipball/7e78605a699d183f5a6936cf91904f4c16ca79b2", + "reference": "7e78605a699d183f5a6936cf91904f4c16ca79b2", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "php": "^7.2 || ^8.0", + "phpstan/phpstan": "^1.9.18" + }, + "conflict": { + "symfony/framework-bundle": "<3.0" + }, + "require-dev": { + "nikic/php-parser": "^4.13.0", + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/phpstan-phpunit": "^1.0", + "phpstan/phpstan-strict-rules": "^1.0", + "phpunit/phpunit": "^8.5.29 || ^9.5", + "psr/container": "1.0 || 1.1.1", + "symfony/config": "^5.4 || ^6.1", + "symfony/console": "^5.4 || ^6.1", + "symfony/dependency-injection": "^5.4 || ^6.1", + "symfony/form": "^5.4 || ^6.1", + "symfony/framework-bundle": "^5.4 || ^6.1", + "symfony/http-foundation": "^5.4 || ^6.1", + "symfony/messenger": "^5.4", + "symfony/polyfill-php80": "^1.24", + "symfony/serializer": "^5.4" + }, + "type": "phpstan-extension", + "extra": { + "phpstan": { + "includes": [ + "extension.neon", + "rules.neon" + ] + } + }, + "autoload": { + "psr-4": { + "PHPStan\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Lukáš Unger", + "email": "looky.msc@gmail.com", + "homepage": "https://lookyman.net" + } + ], + "description": "Symfony Framework extensions and rules for PHPStan", + "support": { + "issues": "https://github.com/phpstan/phpstan-symfony/issues", + "source": "https://github.com/phpstan/phpstan-symfony/tree/1.3.1" + }, + "time": "2023-04-14T16:59:18+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "9.2.26", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "443bc6912c9bd5b409254a40f4b0f4ced7c80ea1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/443bc6912c9bd5b409254a40f4b0f4ced7c80ea1", + "reference": "443bc6912c9bd5b409254a40f4b0f4ced7c80ea1", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-libxml": "*", + "ext-xmlwriter": "*", + "nikic/php-parser": "^4.15", + "php": ">=7.3", + "phpunit/php-file-iterator": "^3.0.3", + "phpunit/php-text-template": "^2.0.2", + "sebastian/code-unit-reverse-lookup": "^2.0.2", + "sebastian/complexity": "^2.0", + "sebastian/environment": "^5.1.2", + "sebastian/lines-of-code": "^1.0.3", + "sebastian/version": "^3.0.1", + "theseer/tokenizer": "^1.2.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-pcov": "PHP extension that provides line coverage", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "9.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.26" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-03-06T12:58:08+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "3.0.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-12-02T12:48:52+00:00" + }, + { + "name": "phpunit/php-invoker", + "version": "3.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "ext-pcntl": "*", + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-pcntl": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Invoke callables with a timeout", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", + "keywords": [ + "process" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-invoker/issues", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:58:55+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T05:33:50+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "5.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:16:10+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "9.6.7", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "c993f0d3b0489ffc42ee2fe0bd645af1538a63b2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c993f0d3b0489ffc42ee2fe0bd645af1538a63b2", + "reference": "c993f0d3b0489ffc42ee2fe0bd645af1538a63b2", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.3.1 || ^2", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.10.1", + "phar-io/manifest": "^2.0.3", + "phar-io/version": "^3.0.2", + "php": ">=7.3", + "phpunit/php-code-coverage": "^9.2.13", + "phpunit/php-file-iterator": "^3.0.5", + "phpunit/php-invoker": "^3.1.1", + "phpunit/php-text-template": "^2.0.3", + "phpunit/php-timer": "^5.0.2", + "sebastian/cli-parser": "^1.0.1", + "sebastian/code-unit": "^1.0.6", + "sebastian/comparator": "^4.0.8", + "sebastian/diff": "^4.0.3", + "sebastian/environment": "^5.1.3", + "sebastian/exporter": "^4.0.5", + "sebastian/global-state": "^5.0.1", + "sebastian/object-enumerator": "^4.0.3", + "sebastian/resource-operations": "^3.0.3", + "sebastian/type": "^3.2", + "sebastian/version": "^3.0.2" + }, + "suggest": { + "ext-soap": "To be able to generate mocks based on WSDL files", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "9.6-dev" + } + }, + "autoload": { + "files": [ + "src/Framework/Assert/Functions.php" + ], + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "security": "https://github.com/sebastianbergmann/phpunit/security/policy", + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.7" + }, + "funding": [ + { + "url": "https://phpunit.de/sponsors.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", + "type": "tidelift" + } + ], + "time": "2023-04-14T08:58:40+00:00" + }, + { + "name": "psr/cache", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "support": { + "source": "https://github.com/php-fig/cache/tree/3.0.0" + }, + "time": "2021-02-03T23:26:27+00:00" + }, + { + "name": "psr/container", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "shasum": "" + }, + "require": { + "php": ">=7.4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/2.0.2" + }, + "time": "2021-11-05T16:47:00+00:00" + }, + { + "name": "psr/event-dispatcher", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", + "shasum": "" + }, + "require": { + "php": ">=7.2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\EventDispatcher\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Standard interfaces for event handling.", + "keywords": [ + "events", + "psr", + "psr-14" + ], + "support": { + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + }, + "time": "2019-01-08T18:20:26+00:00" + }, + { + "name": "psr/log", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001", + "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/3.0.0" + }, + "time": "2021-07-14T16:46:02+00:00" + }, + { + "name": "rector/rector", + "version": "0.15.25", + "source": { + "type": "git", + "url": "https://github.com/rectorphp/rector.git", + "reference": "015935c7ed9e48a4f5895ba974f337e20a263841" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/015935c7ed9e48a4f5895ba974f337e20a263841", + "reference": "015935c7ed9e48a4f5895ba974f337e20a263841", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0", + "phpstan/phpstan": "^1.10.14" + }, + "conflict": { + "rector/rector-doctrine": "*", + "rector/rector-downgrade-php": "*", + "rector/rector-phpunit": "*", + "rector/rector-symfony": "*" + }, + "bin": [ + "bin/rector" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "0.15-dev" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Instant Upgrade and Automated Refactoring of any PHP code", + "keywords": [ + "automation", + "dev", + "migration", + "refactoring" + ], + "support": { + "issues": "https://github.com/rectorphp/rector/issues", + "source": "https://github.com/rectorphp/rector/tree/0.15.25" + }, + "funding": [ + { + "url": "https://github.com/tomasvotruba", + "type": "github" + } + ], + "time": "2023-04-20T16:07:39+00:00" + }, + { + "name": "sebastian/cli-parser", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/cli-parser.git", + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for parsing CLI options", + "homepage": "https://github.com/sebastianbergmann/cli-parser", + "support": { + "issues": "https://github.com/sebastianbergmann/cli-parser/issues", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:08:49+00:00" + }, + { + "name": "sebastian/code-unit", + "version": "1.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit.git", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the PHP code units", + "homepage": "https://github.com/sebastianbergmann/code-unit", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit/issues", + "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:08:54+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:30:19+00:00" + }, + { + "name": "sebastian/comparator", + "version": "4.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "fa0f136dd2334583309d32b62544682ee972b51a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", + "reference": "fa0f136dd2334583309d32b62544682ee972b51a", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/diff": "^4.0", + "sebastian/exporter": "^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/comparator/issues", + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-09-14T12:41:17+00:00" + }, + { + "name": "sebastian/complexity", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/complexity.git", + "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", + "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.7", + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for calculating the complexity of PHP code units", + "homepage": "https://github.com/sebastianbergmann/complexity", + "support": { + "issues": "https://github.com/sebastianbergmann/complexity/issues", + "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T15:52:27+00:00" + }, + { + "name": "sebastian/diff", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3", + "symfony/process": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:10:38+00:00" + }, + { + "name": "sebastian/environment", + "version": "5.1.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-posix": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/environment/issues", + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:03:51+00:00" + }, + { + "name": "sebastian/exporter", + "version": "4.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "https://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-09-14T06:03:37+00:00" + }, + { + "name": "sebastian/global-state", + "version": "5.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "ext-dom": "*", + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/global-state/issues", + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-02-14T08:28:10+00:00" + }, + { + "name": "sebastian/lines-of-code", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/lines-of-code.git", + "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0", - "phpstan/phpstan": "^1.5.0" - }, - "conflict": { - "phpunit/phpunit": "<7.0" + "nikic/php-parser": "^4.6", + "php": ">=7.3" }, "require-dev": { - "nikic/php-parser": "^4.13.0", - "php-parallel-lint/php-parallel-lint": "^1.2", - "phpstan/phpstan-strict-rules": "^1.0", - "phpunit/phpunit": "^9.5" + "phpunit/phpunit": "^9.3" }, - "type": "phpstan-extension", + "type": "library", "extra": { - "phpstan": { - "includes": [ - "extension.neon", - "rules.neon" - ] + "branch-alias": { + "dev-master": "1.0-dev" } }, "autoload": { - "psr-4": { - "PHPStan\\": "src/" - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], - "description": "PHPUnit extensions and rules for PHPStan", + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for counting the lines of code in PHP source code", + "homepage": "https://github.com/sebastianbergmann/lines-of-code", "support": { - "issues": "https://github.com/phpstan/phpstan-phpunit/issues", - "source": "https://github.com/phpstan/phpstan-phpunit/tree/1.1.1" + "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" }, - "time": "2022-04-20T15:24:25+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-28T06:42:11+00:00" }, { - "name": "phpstan/phpstan-symfony", - "version": "1.2.23", + "name": "sebastian/object-enumerator", + "version": "4.0.4", "source": { "type": "git", - "url": "https://github.com/phpstan/phpstan-symfony.git", - "reference": "8a8d0538ca943b20beda7e9799e14fb3683262d4" + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-symfony/zipball/8a8d0538ca943b20beda7e9799e14fb3683262d4", - "reference": "8a8d0538ca943b20beda7e9799e14fb3683262d4", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", "shasum": "" }, "require": { - "ext-simplexml": "*", - "php": "^7.2 || ^8.0", - "phpstan/phpstan": "^1.9.4" - }, - "conflict": { - "symfony/framework-bundle": "<3.0" + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" }, "require-dev": { - "nikic/php-parser": "^4.13.0", - "php-parallel-lint/php-parallel-lint": "^1.2", - "phpstan/phpstan-phpunit": "^1.0", - "phpstan/phpstan-strict-rules": "^1.0", - "phpunit/phpunit": "^9.5", - "psr/container": "1.0 || 1.1.1", - "symfony/config": "^5.4 || ^6.1", - "symfony/console": "^5.4 || ^6.1", - "symfony/dependency-injection": "^5.4 || ^6.1", - "symfony/form": "^5.4 || ^6.1", - "symfony/framework-bundle": "^5.4 || ^6.1", - "symfony/http-foundation": "^5.4 || ^6.1", - "symfony/messenger": "^5.4", - "symfony/polyfill-php80": "^1.24", - "symfony/serializer": "^5.4" + "phpunit/phpunit": "^9.3" }, - "type": "phpstan-extension", + "type": "library", "extra": { - "phpstan": { - "includes": [ - "extension.neon", - "rules.neon" - ] + "branch-alias": { + "dev-master": "4.0-dev" } }, "autoload": { - "psr-4": { - "PHPStan\\": "src/" - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Lukáš Unger", - "email": "looky.msc@gmail.com", - "homepage": "https://lookyman.net" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" } ], - "description": "Symfony Framework extensions and rules for PHPStan", + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", "support": { - "issues": "https://github.com/phpstan/phpstan-symfony/issues", - "source": "https://github.com/phpstan/phpstan-symfony/tree/1.2.23" + "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" }, - "time": "2023-02-06T10:42:02+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:12:34+00:00" }, { - "name": "phpunit/php-code-coverage", - "version": "9.2.15", + "name": "sebastian/object-reflector", + "version": "2.0.4", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f" + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2e9da11878c4202f97915c1cb4bb1ca318a63f5f", - "reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", "shasum": "" }, "require": { - "ext-dom": "*", - "ext-libxml": "*", - "ext-xmlwriter": "*", - "nikic/php-parser": "^4.13.0", - "php": ">=7.3", - "phpunit/php-file-iterator": "^3.0.3", - "phpunit/php-text-template": "^2.0.2", - "sebastian/code-unit-reverse-lookup": "^2.0.2", - "sebastian/complexity": "^2.0", - "sebastian/environment": "^5.1.2", - "sebastian/lines-of-code": "^1.0.3", - "sebastian/version": "^3.0.1", - "theseer/tokenizer": "^1.2.0" + "php": ">=7.3" }, "require-dev": { "phpunit/phpunit": "^9.3" }, - "suggest": { - "ext-pcov": "*", - "ext-xdebug": "*" - }, "type": "library", "extra": { "branch-alias": { - "dev-master": "9.2-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -913,20 +2505,14 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "email": "sebastian@phpunit.de" } ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", - "keywords": [ - "coverage", - "testing", - "xunit" - ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", "support": { - "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.15" + "issues": "https://github.com/sebastianbergmann/object-reflector/issues", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" }, "funding": [ { @@ -934,20 +2520,20 @@ "type": "github" } ], - "time": "2022-03-07T09:28:20+00:00" + "time": "2020-10-26T13:14:26+00:00" }, { - "name": "phpunit/php-file-iterator", - "version": "3.0.6", + "name": "sebastian/recursion-context", + "version": "4.0.5", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", "shasum": "" }, "require": { @@ -959,7 +2545,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -974,19 +2560,22 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" } ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { - "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" }, "funding": [ { @@ -994,36 +2583,32 @@ "type": "github" } ], - "time": "2021-12-02T12:48:52+00:00" + "time": "2023-02-03T06:07:39+00:00" }, { - "name": "phpunit/php-invoker", - "version": "3.1.1", + "name": "sebastian/resource-operations", + "version": "3.0.3", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", "shasum": "" }, "require": { "php": ">=7.3" }, "require-dev": { - "ext-pcntl": "*", - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-pcntl": "*" + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -1038,18 +2623,14 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "email": "sebastian@phpunit.de" } ], - "description": "Invoke callables with a timeout", - "homepage": "https://github.com/sebastianbergmann/php-invoker/", - "keywords": [ - "process" - ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", "support": { - "issues": "https://github.com/sebastianbergmann/php-invoker/issues", - "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" + "issues": "https://github.com/sebastianbergmann/resource-operations/issues", + "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" }, "funding": [ { @@ -1057,32 +2638,32 @@ "type": "github" } ], - "time": "2020-09-28T05:58:55+00:00" + "time": "2020-09-28T06:45:17+00:00" }, { - "name": "phpunit/php-text-template", - "version": "2.0.4", + "name": "sebastian/type", + "version": "3.2.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", "shasum": "" }, "require": { "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^9.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -1101,14 +2682,11 @@ "role": "lead" } ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-text-template/issues", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "support": { + "issues": "https://github.com/sebastianbergmann/type/issues", + "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" }, "funding": [ { @@ -1116,32 +2694,29 @@ "type": "github" } ], - "time": "2020-10-26T05:33:50+00:00" + "time": "2023-02-03T06:13:03+00:00" }, { - "name": "phpunit/php-timer", - "version": "5.0.3", + "name": "sebastian/version", + "version": "3.0.2", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "c6c1022351a901512170118436c764e473f6de8c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", + "reference": "c6c1022351a901512170118436c764e473f6de8c", "shasum": "" }, "require": { "php": ">=7.3" }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -1160,14 +2735,11 @@ "role": "lead" } ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", "support": { - "issues": "https://github.com/sebastianbergmann/php-timer/issues", - "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" + "issues": "https://github.com/sebastianbergmann/version/issues", + "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" }, "funding": [ { @@ -1175,1073 +2747,1312 @@ "type": "github" } ], - "time": "2020-10-26T13:16:10+00:00" + "time": "2020-09-28T06:39:44+00:00" }, { - "name": "phpunit/phpunit", - "version": "9.5.21", + "name": "symfony/console", + "version": "v6.2.8", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "0e32b76be457de00e83213528f6bb37e2a38fcb1" + "url": "https://github.com/symfony/console.git", + "reference": "3582d68a64a86ec25240aaa521ec8bc2342b369b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0e32b76be457de00e83213528f6bb37e2a38fcb1", - "reference": "0e32b76be457de00e83213528f6bb37e2a38fcb1", + "url": "https://api.github.com/repos/symfony/console/zipball/3582d68a64a86ec25240aaa521ec8bc2342b369b", + "reference": "3582d68a64a86ec25240aaa521ec8bc2342b369b", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.3.1", - "ext-dom": "*", - "ext-json": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-xml": "*", - "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.10.1", - "phar-io/manifest": "^2.0.3", - "phar-io/version": "^3.0.2", - "php": ">=7.3", - "phpspec/prophecy": "^1.12.1", - "phpunit/php-code-coverage": "^9.2.13", - "phpunit/php-file-iterator": "^3.0.5", - "phpunit/php-invoker": "^3.1.1", - "phpunit/php-text-template": "^2.0.3", - "phpunit/php-timer": "^5.0.2", - "sebastian/cli-parser": "^1.0.1", - "sebastian/code-unit": "^1.0.6", - "sebastian/comparator": "^4.0.5", - "sebastian/diff": "^4.0.3", - "sebastian/environment": "^5.1.3", - "sebastian/exporter": "^4.0.3", - "sebastian/global-state": "^5.0.1", - "sebastian/object-enumerator": "^4.0.3", - "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^3.0", - "sebastian/version": "^3.0.2" + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/string": "^5.4|^6.0" + }, + "conflict": { + "symfony/dependency-injection": "<5.4", + "symfony/dotenv": "<5.4", + "symfony/event-dispatcher": "<5.4", + "symfony/lock": "<5.4", + "symfony/process": "<5.4" + }, + "provide": { + "psr/log-implementation": "1.0|2.0|3.0" }, "require-dev": { - "phpspec/prophecy-phpunit": "^2.0.1" + "psr/log": "^1|^2|^3", + "symfony/config": "^5.4|^6.0", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/event-dispatcher": "^5.4|^6.0", + "symfony/lock": "^5.4|^6.0", + "symfony/process": "^5.4|^6.0", + "symfony/var-dumper": "^5.4|^6.0" }, "suggest": { - "ext-soap": "*", - "ext-xdebug": "*" + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" }, - "bin": [ - "phpunit" - ], "type": "library", - "extra": { - "branch-alias": { - "dev-master": "9.5-dev" - } - }, "autoload": { - "files": [ - "src/Framework/Assert/Functions.php" - ], - "classmap": [ - "src/" + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", + "description": "Eases the creation of beautiful and testable command line interfaces", + "homepage": "https://symfony.com", "keywords": [ - "phpunit", - "testing", - "xunit" + "cli", + "command-line", + "console", + "terminal" ], "support": { - "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.21" + "source": "https://github.com/symfony/console/tree/v6.2.8" }, "funding": [ { - "url": "https://phpunit.de/sponsors.html", + "url": "https://symfony.com/sponsor", "type": "custom" }, { - "url": "https://github.com/sebastianbergmann", + "url": "https://github.com/fabpot", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "time": "2022-06-19T12:14:25+00:00" + "time": "2023-03-29T21:42:15+00:00" }, { - "name": "sebastian/cli-parser", - "version": "1.0.1", + "name": "symfony/deprecation-contracts", + "version": "v3.2.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e", + "reference": "e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e", "shasum": "" }, "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" + "php": ">=8.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "3.3-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" } }, "autoload": { - "classmap": [ - "src/" + "files": [ + "function.php" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Library for parsing CLI options", - "homepage": "https://github.com/sebastianbergmann/cli-parser", + "description": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", "support": { - "issues": "https://github.com/sebastianbergmann/cli-parser/issues", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.2.1" }, "funding": [ { - "url": "https://github.com/sebastianbergmann", + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "time": "2020-09-28T06:08:49+00:00" + "time": "2023-03-01T10:25:55+00:00" }, { - "name": "sebastian/code-unit", - "version": "1.0.8", + "name": "symfony/event-dispatcher", + "version": "v6.2.8", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "04046f35fd7d72f9646e721fc2ecb8f9c67d3339" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/04046f35fd7d72f9646e721fc2ecb8f9c67d3339", + "reference": "04046f35fd7d72f9646e721fc2ecb8f9c67d3339", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1", + "symfony/event-dispatcher-contracts": "^2|^3" + }, + "conflict": { + "symfony/dependency-injection": "<5.4" + }, + "provide": { + "psr/event-dispatcher-implementation": "1.0", + "symfony/event-dispatcher-implementation": "2.0|3.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "psr/log": "^1|^2|^3", + "symfony/config": "^5.4|^6.0", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/error-handler": "^5.4|^6.0", + "symfony/expression-language": "^5.4|^6.0", + "symfony/http-foundation": "^5.4|^6.0", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/stopwatch": "^5.4|^6.0" }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" }, + "type": "library", "autoload": { - "classmap": [ - "src/" + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Collection of value objects that represent the PHP code units", - "homepage": "https://github.com/sebastianbergmann/code-unit", + "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", + "homepage": "https://symfony.com", "support": { - "issues": "https://github.com/sebastianbergmann/code-unit/issues", - "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" + "source": "https://github.com/symfony/event-dispatcher/tree/v6.2.8" }, "funding": [ { - "url": "https://github.com/sebastianbergmann", + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "time": "2020-10-26T13:08:54+00:00" + "time": "2023-03-20T16:06:02+00:00" }, { - "name": "sebastian/code-unit-reverse-lookup", - "version": "2.0.3", + "name": "symfony/event-dispatcher-contracts", + "version": "v3.2.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" + "url": "https://github.com/symfony/event-dispatcher-contracts.git", + "reference": "0ad3b6f1e4e2da5690fefe075cd53a238646d8dd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/0ad3b6f1e4e2da5690fefe075cd53a238646d8dd", + "reference": "0ad3b6f1e4e2da5690fefe075cd53a238646d8dd", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1", + "psr/event-dispatcher": "^1" }, - "require-dev": { - "phpunit/phpunit": "^9.3" + "suggest": { + "symfony/event-dispatcher-implementation": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "3.3-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" } }, "autoload": { - "classmap": [ - "src/" - ] + "psr-4": { + "Symfony\\Contracts\\EventDispatcher\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Looks up which function or method a line of code belongs to", - "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "description": "Generic abstractions related to dispatching event", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], "support": { - "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", - "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.2.1" }, "funding": [ { - "url": "https://github.com/sebastianbergmann", + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "time": "2020-09-28T05:30:19+00:00" + "time": "2023-03-01T10:32:47+00:00" }, { - "name": "sebastian/comparator", - "version": "4.0.6", + "name": "symfony/filesystem", + "version": "v6.2.7", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "55f4261989e546dc112258c7a75935a81a7ce382" + "url": "https://github.com/symfony/filesystem.git", + "reference": "82b6c62b959f642d000456f08c6d219d749215b3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/55f4261989e546dc112258c7a75935a81a7ce382", - "reference": "55f4261989e546dc112258c7a75935a81a7ce382", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/82b6c62b959f642d000456f08c6d219d749215b3", + "reference": "82b6c62b959f642d000456f08c6d219d749215b3", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/diff": "^4.0", - "sebastian/exporter": "^4.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" + "php": ">=8.1", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-mbstring": "~1.8" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, "autoload": { - "classmap": [ - "src/" + "psr-4": { + "Symfony\\Component\\Filesystem\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" }, { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "https://github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], + "description": "Provides basic utilities for the filesystem", + "homepage": "https://symfony.com", "support": { - "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.6" + "source": "https://github.com/symfony/filesystem/tree/v6.2.7" }, "funding": [ { - "url": "https://github.com/sebastianbergmann", + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "time": "2020-10-26T15:49:45+00:00" + "time": "2023-02-14T08:44:56+00:00" }, { - "name": "sebastian/complexity", - "version": "2.0.2", + "name": "symfony/finder", + "version": "v6.2.7", "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "20808dc6631aecafbe67c186af5dcb370be3a0eb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", + "url": "https://api.github.com/repos/symfony/finder/zipball/20808dc6631aecafbe67c186af5dcb370be3a0eb", + "reference": "20808dc6631aecafbe67c186af5dcb370be3a0eb", "shasum": "" }, "require": { - "nikic/php-parser": "^4.7", - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "symfony/filesystem": "^6.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, "autoload": { - "classmap": [ - "src/" + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Library for calculating the complexity of PHP code units", - "homepage": "https://github.com/sebastianbergmann/complexity", + "description": "Finds files and directories via an intuitive fluent interface", + "homepage": "https://symfony.com", "support": { - "issues": "https://github.com/sebastianbergmann/complexity/issues", - "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" + "source": "https://github.com/symfony/finder/tree/v6.2.7" }, "funding": [ { - "url": "https://github.com/sebastianbergmann", + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "time": "2020-10-26T15:52:27+00:00" + "time": "2023-02-16T09:57:23+00:00" }, { - "name": "sebastian/diff", - "version": "4.0.4", + "name": "symfony/options-resolver", + "version": "v6.2.7", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d" + "url": "https://github.com/symfony/options-resolver.git", + "reference": "aa0e85b53bbb2b4951960efd61d295907eacd629" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/aa0e85b53bbb2b4951960efd61d295907eacd629", + "reference": "aa0e85b53bbb2b4951960efd61d295907eacd629", "shasum": "" }, "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3", - "symfony/process": "^4.2 || ^5" + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.1|^3" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, "autoload": { - "classmap": [ - "src/" + "psr-4": { + "Symfony\\Component\\OptionsResolver\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" }, { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", + "description": "Provides an improved replacement for the array_replace PHP function", + "homepage": "https://symfony.com", "keywords": [ - "diff", - "udiff", - "unidiff", - "unified diff" + "config", + "configuration", + "options" ], "support": { - "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" + "source": "https://github.com/symfony/options-resolver/tree/v6.2.7" }, "funding": [ { - "url": "https://github.com/sebastianbergmann", + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "time": "2020-10-26T13:10:38+00:00" + "time": "2023-02-14T08:44:56+00:00" }, { - "name": "sebastian/environment", - "version": "5.1.4", + "name": "symfony/polyfill-ctype", + "version": "v1.27.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7" + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "5bbc823adecdae860bb64756d639ecfec17b050a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/1b5dff7bb151a4db11d49d90e5408e4e938270f7", - "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a", + "reference": "5bbc823adecdae860bb64756d639ecfec17b050a", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=7.1" }, - "require-dev": { - "phpunit/phpunit": "^9.3" + "provide": { + "ext-ctype": "*" }, "suggest": { - "ext-posix": "*" + "ext-ctype": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.1-dev" + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { - "classmap": [ - "src/" - ] + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", "keywords": [ - "Xdebug", - "environment", - "hhvm" + "compatibility", + "ctype", + "polyfill", + "portable" ], "support": { - "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.4" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.27.0" }, "funding": [ { - "url": "https://github.com/sebastianbergmann", + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "time": "2022-04-03T09:37:03+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { - "name": "sebastian/exporter", - "version": "4.0.4", + "name": "symfony/polyfill-intl-grapheme", + "version": "v1.27.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9" + "url": "https://github.com/symfony/polyfill-intl-grapheme.git", + "reference": "511a08c03c1960e08a883f4cffcacd219b758354" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/65e8b7db476c5dd267e65eea9cab77584d3cfff9", - "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/511a08c03c1960e08a883f4cffcacd219b758354", + "reference": "511a08c03c1960e08a883f4cffcacd219b758354", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/recursion-context": "^4.0" + "php": ">=7.1" }, - "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "^9.3" + "suggest": { + "ext-intl": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { - "classmap": [ - "src/" - ] + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "https://www.github.com/sebastianbergmann/exporter", + "description": "Symfony polyfill for intl's grapheme_* functions", + "homepage": "https://symfony.com", "keywords": [ - "export", - "exporter" + "compatibility", + "grapheme", + "intl", + "polyfill", + "portable", + "shim" ], "support": { - "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.4" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.27.0" }, "funding": [ { - "url": "https://github.com/sebastianbergmann", + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "time": "2021-11-11T14:18:36+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { - "name": "sebastian/global-state", - "version": "5.0.5", + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.27.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/19bd1e4fcd5b91116f14d8533c57831ed00571b6", + "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" - }, - "require-dev": { - "ext-dom": "*", - "phpunit/phpunit": "^9.3" + "php": ">=7.1" }, "suggest": { - "ext-uopz": "*" + "ext-intl": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, "classmap": [ - "src/" + "Resources/stubs" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", + "description": "Symfony polyfill for intl's Normalizer class and related functions", + "homepage": "https://symfony.com", "keywords": [ - "global state" + "compatibility", + "intl", + "normalizer", + "polyfill", + "portable", + "shim" ], "support": { - "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.27.0" }, "funding": [ { - "url": "https://github.com/sebastianbergmann", + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "time": "2022-02-14T08:28:10+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { - "name": "sebastian/lines-of-code", - "version": "1.0.3", + "name": "symfony/polyfill-mbstring", + "version": "v1.27.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534", + "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534", "shasum": "" }, "require": { - "nikic/php-parser": "^4.6", - "php": ">=7.3" + "php": ">=7.1" }, - "require-dev": { - "phpunit/phpunit": "^9.3" + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { - "classmap": [ - "src/" - ] + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Library for counting the lines of code in PHP source code", - "homepage": "https://github.com/sebastianbergmann/lines-of-code", + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], "support": { - "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0" }, "funding": [ { - "url": "https://github.com/sebastianbergmann", + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "time": "2020-11-28T06:42:11+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { - "name": "sebastian/object-enumerator", - "version": "4.0.4", + "name": "symfony/polyfill-php80", + "version": "v1.27.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" + "php": ">=7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, "classmap": [ - "src/" + "Resources/stubs" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Traverses array structures and object graphs to enumerate all referenced objects", - "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], "support": { - "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", - "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" }, "funding": [ { - "url": "https://github.com/sebastianbergmann", + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "time": "2020-10-26T13:12:34+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { - "name": "sebastian/object-reflector", - "version": "2.0.4", + "name": "symfony/polyfill-php81", + "version": "v1.27.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" + "url": "https://github.com/symfony/polyfill-php81.git", + "reference": "707403074c8ea6e2edaf8794b0157a0bfa52157a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/707403074c8ea6e2edaf8794b0157a0bfa52157a", + "reference": "707403074c8ea6e2edaf8794b0157a0bfa52157a", "shasum": "" }, "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" + "php": ">=7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php81\\": "" + }, "classmap": [ - "src/" + "Resources/stubs" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Allows reflection of object attributes, including inherited and non-public ones", - "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], "support": { - "issues": "https://github.com/sebastianbergmann/object-reflector/issues", - "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" + "source": "https://github.com/symfony/polyfill-php81/tree/v1.27.0" }, "funding": [ { - "url": "https://github.com/sebastianbergmann", + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "time": "2020-10-26T13:14:26+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { - "name": "sebastian/recursion-context", - "version": "4.0.4", + "name": "symfony/process", + "version": "v6.2.8", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172" + "url": "https://github.com/symfony/process.git", + "reference": "75ed64103df4f6615e15a7fe38b8111099f47416" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/cd9d8cf3c5804de4341c283ed787f099f5506172", - "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172", + "url": "https://api.github.com/repos/symfony/process/zipball/75ed64103df4f6615e15a7fe38b8111099f47416", + "reference": "75ed64103df4f6615e15a7fe38b8111099f47416", "shasum": "" }, "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" + "php": ">=8.1" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, "autoload": { - "classmap": [ - "src/" + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" }, { - "name": "Adam Harvey", - "email": "aharvey@php.net" + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "description": "Executes commands in sub-processes", + "homepage": "https://symfony.com", "support": { - "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.4" + "source": "https://github.com/symfony/process/tree/v6.2.8" }, "funding": [ { - "url": "https://github.com/sebastianbergmann", + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "time": "2020-10-26T13:17:30+00:00" + "time": "2023-03-09T16:20:02+00:00" }, { - "name": "sebastian/resource-operations", - "version": "3.0.3", + "name": "symfony/service-contracts", + "version": "v3.2.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" + "url": "https://github.com/symfony/service-contracts.git", + "reference": "a8c9cedf55f314f3a186041d19537303766df09a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/a8c9cedf55f314f3a186041d19537303766df09a", + "reference": "a8c9cedf55f314f3a186041d19537303766df09a", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1", + "psr/container": "^2.0" }, - "require-dev": { - "phpunit/phpunit": "^9.0" + "conflict": { + "ext-psr": "<1.1|>=2" + }, + "suggest": { + "symfony/service-implementation": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "3.3-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" } }, "autoload": { - "classmap": [ - "src/" + "psr-4": { + "Symfony\\Contracts\\Service\\": "" + }, + "exclude-from-classmap": [ + "/Test/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "description": "Generic abstractions related to writing services", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], "support": { - "issues": "https://github.com/sebastianbergmann/resource-operations/issues", - "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" + "source": "https://github.com/symfony/service-contracts/tree/v3.2.1" }, "funding": [ { - "url": "https://github.com/sebastianbergmann", + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "time": "2020-09-28T06:45:17+00:00" + "time": "2023-03-01T10:32:47+00:00" }, { - "name": "sebastian/type", - "version": "3.0.0", + "name": "symfony/stopwatch", + "version": "v6.2.7", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/type.git", - "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad" + "url": "https://github.com/symfony/stopwatch.git", + "reference": "f3adc98c1061875dd2edcd45e5b04e63d0e29f8f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", - "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/f3adc98c1061875dd2edcd45e5b04e63d0e29f8f", + "reference": "f3adc98c1061875dd2edcd45e5b04e63d0e29f8f", "shasum": "" }, "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.5" + "php": ">=8.1", + "symfony/service-contracts": "^1|^2|^3" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, "autoload": { - "classmap": [ - "src/" + "psr-4": { + "Symfony\\Component\\Stopwatch\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Collection of value objects that represent the types of the PHP type system", - "homepage": "https://github.com/sebastianbergmann/type", + "description": "Provides a way to profile code", + "homepage": "https://symfony.com", "support": { - "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.0.0" + "source": "https://github.com/symfony/stopwatch/tree/v6.2.7" }, "funding": [ { - "url": "https://github.com/sebastianbergmann", + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "time": "2022-03-15T09:54:48+00:00" + "time": "2023-02-14T08:44:56+00:00" }, { - "name": "sebastian/version", - "version": "3.0.2", + "name": "symfony/string", + "version": "v6.2.8", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "c6c1022351a901512170118436c764e473f6de8c" + "url": "https://github.com/symfony/string.git", + "reference": "193e83bbd6617d6b2151c37fff10fa7168ebddef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", - "reference": "c6c1022351a901512170118436c764e473f6de8c", + "url": "https://api.github.com/repos/symfony/string/zipball/193e83bbd6617d6b2151c37fff10fa7168ebddef", + "reference": "193e83bbd6617d6b2151c37fff10fa7168ebddef", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-intl-grapheme": "~1.0", + "symfony/polyfill-intl-normalizer": "~1.0", + "symfony/polyfill-mbstring": "~1.0" }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } + "conflict": { + "symfony/translation-contracts": "<2.0" + }, + "require-dev": { + "symfony/error-handler": "^5.4|^6.0", + "symfony/http-client": "^5.4|^6.0", + "symfony/intl": "^6.2", + "symfony/translation-contracts": "^2.0|^3.0", + "symfony/var-exporter": "^5.4|^6.0" }, + "type": "library", "autoload": { - "classmap": [ - "src/" + "files": [ + "Resources/functions.php" + ], + "psr-4": { + "Symfony\\Component\\String\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", + "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", + "homepage": "https://symfony.com", + "keywords": [ + "grapheme", + "i18n", + "string", + "unicode", + "utf-8", + "utf8" + ], "support": { - "issues": "https://github.com/sebastianbergmann/version/issues", - "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" + "source": "https://github.com/symfony/string/tree/v6.2.8" }, "funding": [ { - "url": "https://github.com/sebastianbergmann", + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "time": "2020-09-28T06:39:44+00:00" + "time": "2023-03-20T16:06:02+00:00" }, { "name": "symplify/easy-coding-standard", @@ -2347,64 +4158,6 @@ } ], "time": "2021-07-28T10:34:58+00:00" - }, - { - "name": "webmozart/assert", - "version": "1.11.0", - "source": { - "type": "git", - "url": "https://github.com/webmozarts/assert.git", - "reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/11cb2199493b2f8a3b53e7f19068fc6aac760991", - "reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991", - "shasum": "" - }, - "require": { - "ext-ctype": "*", - "php": "^7.2 || ^8.0" - }, - "conflict": { - "phpstan/phpstan": "<0.12.20", - "vimeo/psalm": "<4.6.1 || 4.6.2" - }, - "require-dev": { - "phpunit/phpunit": "^8.5.13" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.10-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" - ], - "support": { - "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/1.11.0" - }, - "time": "2022-06-03T18:03:27+00:00" } ], "aliases": [], diff --git a/phpstan.neon b/phpstan.neon index d64fe5c0d..e319c2412 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -24,4 +24,7 @@ parameters: ignoreErrors: - # This only occurs in Shopware < 6.4.4.0 message: "#Strict comparison using === between string and null will always evaluate to false#" - path: src/Payone/RequestParameter/Builder/CustomerRequestParameterBuilder.php \ No newline at end of file + path: src/Payone/RequestParameter/Builder/CustomerRequestParameterBuilder.php + - # This only occurs in Shopware >= 6.5.0.0 + message: "#.*#" + path: src/Twig/CsrfWrapper.php \ No newline at end of file diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 066d4737d..b038fc4aa 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -6,7 +6,6 @@ colors="true"> - diff --git a/rector.php b/rector.php new file mode 100644 index 000000000..a1afb763a --- /dev/null +++ b/rector.php @@ -0,0 +1,18 @@ +paths([ + __DIR__ . '/src', + __DIR__ . '/tests', + ]); + + // define sets of rules + $rectorConfig->sets([ + LevelSetList::UP_TO_PHP_81 + ]); +}; diff --git a/src/Components/CartHasher/CartHasher.php b/src/Components/CartHasher/CartHasher.php index bcdac9dd0..90189300b 100644 --- a/src/Components/CartHasher/CartHasher.php +++ b/src/Components/CartHasher/CartHasher.php @@ -25,9 +25,12 @@ class CartHasher implements CartHasherInterface private CurrencyPrecisionInterface $currencyPrecision; - public function __construct(CurrencyPrecisionInterface $currencyPrecision) + private string $appSecret; + + public function __construct(CurrencyPrecisionInterface $currencyPrecision, string $appSecret = '') { $this->currencyPrecision = $currencyPrecision; + $this->appSecret = $appSecret; } /** @@ -177,12 +180,10 @@ private function generateHash(array $hashData): string throw new \LogicException('could not generate hash'); } - $secret = getenv('APP_SECRET'); - - if (empty($secret)) { + if (empty($this->appSecret)) { throw new \LogicException('empty app secret'); } - return hash_hmac('sha256', $json, $secret); + return hash_hmac('sha256', $json, $this->appSecret); } } diff --git a/src/Components/RedirectHandler/RedirectHandler.php b/src/Components/RedirectHandler/RedirectHandler.php index 4115c27d8..7af8520cd 100644 --- a/src/Components/RedirectHandler/RedirectHandler.php +++ b/src/Components/RedirectHandler/RedirectHandler.php @@ -17,21 +17,22 @@ class RedirectHandler private RouterInterface $router; - public function __construct(Connection $connection, RouterInterface $router) + private string $appSecret; + + public function __construct(Connection $connection, RouterInterface $router, string $appSecret = '') { $this->connection = $connection; $this->router = $router; + $this->appSecret = $appSecret; } public function encode(string $url): string { - $secret = getenv('APP_SECRET'); - - if (empty($secret)) { + if (empty($this->appSecret)) { throw new \LogicException('empty app secret'); } - $hash = base64_encode(hash_hmac('sha256', $url, $secret)); + $hash = base64_encode(hash_hmac('sha256', $url, $this->appSecret)); $this->connection->insert('payone_payment_redirect', [ 'id' => Uuid::randomBytes(), diff --git a/src/DependencyInjection/handler/global_handlers.xml b/src/DependencyInjection/handler/global_handlers.xml index c3f78de3f..dc54f146f 100644 --- a/src/DependencyInjection/handler/global_handlers.xml +++ b/src/DependencyInjection/handler/global_handlers.xml @@ -2,6 +2,7 @@ + @@ -27,6 +28,7 @@ + %env.app_secret% diff --git a/src/DependencyInjection/services.xml b/src/DependencyInjection/services.xml index 6a5a5b1b3..95e1ff5c3 100644 --- a/src/DependencyInjection/services.xml +++ b/src/DependencyInjection/services.xml @@ -19,6 +19,10 @@ + + %env(APP_SECRET)% + + @@ -26,6 +30,7 @@ + %env.app_secret% diff --git a/src/EventListener/InvoiceRendererEventListener.php b/src/EventListener/InvoiceRendererEventListener.php index 3d854fe62..a67c264a4 100644 --- a/src/EventListener/InvoiceRendererEventListener.php +++ b/src/EventListener/InvoiceRendererEventListener.php @@ -33,7 +33,6 @@ public function onInvoiceOrdersLoaded(InvoiceOrdersEvent $event): void foreach ($orders as $order) { if ($this->hasPayolutionInvoicingTransaction($order)) { - // ToDo 6.5: Write tests so that we can check if it is working in both versions $this->addInvoiceDocumentExtension($order); } } diff --git a/src/Resources/app/administration/src/main.js b/src/Resources/app/administration/src/main.js index 8d46533b3..c74dc115d 100644 --- a/src/Resources/app/administration/src/main.js +++ b/src/Resources/app/administration/src/main.js @@ -1,5 +1,3 @@ -import './component/payone-ratepay-profile-configurations'; -import './component/payone-ratepay-profiles'; import './module/payone-payment'; import './module/payone-notification-target'; import './module/sw-order'; diff --git a/src/Resources/app/administration/src/module/payone-notification-target/index.js b/src/Resources/app/administration/src/module/payone-notification-target/index.js index 3489595a4..427ab64ce 100644 --- a/src/Resources/app/administration/src/module/payone-notification-target/index.js +++ b/src/Resources/app/administration/src/module/payone-notification-target/index.js @@ -1,8 +1,9 @@ -import './page/payone-notification-target-list'; -import './page/payone-notification-target-detail'; import deDE from './snippet/de_DE.json'; import enGB from './snippet/en_GB.json'; +Shopware.Component.register('payone-notification-target-detail', import('./page/payone-notification-target-detail')); +Shopware.Component.register('payone-notification-target-list', import('./page/payone-notification-target-list')); + Shopware.Module.register('payone-notification-target', { type: 'plugin', name: 'PayoneNotificationTarget', diff --git a/src/Resources/app/administration/src/module/payone-notification-target/page/payone-notification-target-detail/index.js b/src/Resources/app/administration/src/module/payone-notification-target/page/payone-notification-target-detail/index.js index f0b05b187..059c09689 100644 --- a/src/Resources/app/administration/src/module/payone-notification-target/page/payone-notification-target-detail/index.js +++ b/src/Resources/app/administration/src/module/payone-notification-target/page/payone-notification-target-detail/index.js @@ -1,8 +1,8 @@ import template from './payone-notification-target-detail.html.twig'; -const { Component, Mixin, Data: { Criteria } } = Shopware; +const { Mixin } = Shopware; -Component.register('payone-notification-target-detail', { +export default { template, inject: ['repositoryFactory'], @@ -140,4 +140,4 @@ Component.register('payone-notification-target-detail', { this.$router.push({ name: 'payone.notification.target.list' }); } } -}); +}; diff --git a/src/Resources/app/administration/src/module/payone-notification-target/page/payone-notification-target-list/index.js b/src/Resources/app/administration/src/module/payone-notification-target/page/payone-notification-target-list/index.js index 056347c12..d089d677f 100644 --- a/src/Resources/app/administration/src/module/payone-notification-target/page/payone-notification-target-list/index.js +++ b/src/Resources/app/administration/src/module/payone-notification-target/page/payone-notification-target-list/index.js @@ -1,7 +1,7 @@ import template from './payone-notification-target-list.html.twig'; -const { Component, Mixin, Data: { Criteria } } = Shopware; +const { Mixin, Data: { Criteria } } = Shopware; -Component.register('payone-notification-target-list', { +export default { template, inject: ['repositoryFactory'], @@ -90,4 +90,4 @@ Component.register('payone-notification-target-list', { this.getList(); }, } -}) +}; diff --git a/src/Resources/app/administration/src/module/payone-payment/component/payone-data-grid/index.js b/src/Resources/app/administration/src/module/payone-payment/component/payone-data-grid/index.js deleted file mode 100644 index 6e627ba39..000000000 --- a/src/Resources/app/administration/src/module/payone-payment/component/payone-data-grid/index.js +++ /dev/null @@ -1,7 +0,0 @@ -import template from './payone-data-grid.html.twig'; - -const { Component } = Shopware; - -Component.extend('payone-data-grid', 'sw-data-grid',{ - template: template -}); diff --git a/src/Resources/app/administration/src/module/payone-payment/component/payone-payment-plugin-icon/index.js b/src/Resources/app/administration/src/module/payone-payment/component/payone-payment-plugin-icon/index.js index 21bc57b2f..22d081c85 100644 --- a/src/Resources/app/administration/src/module/payone-payment/component/payone-payment-plugin-icon/index.js +++ b/src/Resources/app/administration/src/module/payone-payment/component/payone-payment-plugin-icon/index.js @@ -1,8 +1,6 @@ import template from './payone-payment-plugin-icon.html.twig'; import './payone-payment-plugin-icon.scss'; -const { Component } = Shopware; - -Component.register('payone-payment-plugin-icon', { +export default { template -}); +}; diff --git a/src/Resources/app/administration/src/component/payone-ratepay-profile-configurations/index.js b/src/Resources/app/administration/src/module/payone-payment/component/payone-ratepay-profile-configurations/index.js similarity index 95% rename from src/Resources/app/administration/src/component/payone-ratepay-profile-configurations/index.js rename to src/Resources/app/administration/src/module/payone-payment/component/payone-ratepay-profile-configurations/index.js index 6ccba551c..2e5618a58 100644 --- a/src/Resources/app/administration/src/component/payone-ratepay-profile-configurations/index.js +++ b/src/Resources/app/administration/src/module/payone-payment/component/payone-ratepay-profile-configurations/index.js @@ -1,9 +1,7 @@ import './payone-ratepay-profile-configurations.scss'; import template from './payone-ratepay-profile-configurations.html.twig'; -const {Component} = Shopware; - -Component.register('payone-ratepay-profile-configurations', { +export default { template, inject: ['PayonePaymentSettingsService'], @@ -82,7 +80,6 @@ Component.register('payone-ratepay-profile-configurations', { methods: { createdComponent() { this.$root.$on('payone-ratepay-profiles-update-result', this.onProfilesUpdateResult); - console.log(this.configuration); }, destroyedComponent() { @@ -95,4 +92,4 @@ Component.register('payone-ratepay-profile-configurations', { } } } -}); +}; diff --git a/src/Resources/app/administration/src/component/payone-ratepay-profile-configurations/payone-ratepay-profile-configurations.html.twig b/src/Resources/app/administration/src/module/payone-payment/component/payone-ratepay-profile-configurations/payone-ratepay-profile-configurations.html.twig similarity index 100% rename from src/Resources/app/administration/src/component/payone-ratepay-profile-configurations/payone-ratepay-profile-configurations.html.twig rename to src/Resources/app/administration/src/module/payone-payment/component/payone-ratepay-profile-configurations/payone-ratepay-profile-configurations.html.twig diff --git a/src/Resources/app/administration/src/component/payone-ratepay-profile-configurations/payone-ratepay-profile-configurations.scss b/src/Resources/app/administration/src/module/payone-payment/component/payone-ratepay-profile-configurations/payone-ratepay-profile-configurations.scss similarity index 100% rename from src/Resources/app/administration/src/component/payone-ratepay-profile-configurations/payone-ratepay-profile-configurations.scss rename to src/Resources/app/administration/src/module/payone-payment/component/payone-ratepay-profile-configurations/payone-ratepay-profile-configurations.scss diff --git a/src/Resources/app/administration/src/component/payone-ratepay-profiles/index.js b/src/Resources/app/administration/src/module/payone-payment/component/payone-ratepay-profiles/index.js similarity index 98% rename from src/Resources/app/administration/src/component/payone-ratepay-profiles/index.js rename to src/Resources/app/administration/src/module/payone-payment/component/payone-ratepay-profiles/index.js index 5b81b4b9e..b7f693628 100644 --- a/src/Resources/app/administration/src/component/payone-ratepay-profiles/index.js +++ b/src/Resources/app/administration/src/module/payone-payment/component/payone-ratepay-profiles/index.js @@ -1,9 +1,9 @@ import './payone-ratepay-profiles.scss'; import template from './payone-ratepay-profiles.html.twig'; -const { Component, Utils } = Shopware; +const { Utils } = Shopware; -Component.register('payone-ratepay-profiles', { +export default { template, props: { @@ -169,4 +169,4 @@ Component.register('payone-ratepay-profiles', { this.$emit('deleted', this.profiles); }, } -}); +}; diff --git a/src/Resources/app/administration/src/component/payone-ratepay-profiles/payone-ratepay-profiles.html.twig b/src/Resources/app/administration/src/module/payone-payment/component/payone-ratepay-profiles/payone-ratepay-profiles.html.twig similarity index 100% rename from src/Resources/app/administration/src/component/payone-ratepay-profiles/payone-ratepay-profiles.html.twig rename to src/Resources/app/administration/src/module/payone-payment/component/payone-ratepay-profiles/payone-ratepay-profiles.html.twig diff --git a/src/Resources/app/administration/src/component/payone-ratepay-profiles/payone-ratepay-profiles.scss b/src/Resources/app/administration/src/module/payone-payment/component/payone-ratepay-profiles/payone-ratepay-profiles.scss similarity index 100% rename from src/Resources/app/administration/src/component/payone-ratepay-profiles/payone-ratepay-profiles.scss rename to src/Resources/app/administration/src/module/payone-payment/component/payone-ratepay-profiles/payone-ratepay-profiles.scss diff --git a/src/Resources/app/administration/src/module/payone-payment/extension/sw-order/index.js b/src/Resources/app/administration/src/module/payone-payment/extension/sw-order/index.js deleted file mode 100644 index 3571943f7..000000000 --- a/src/Resources/app/administration/src/module/payone-payment/extension/sw-order/index.js +++ /dev/null @@ -1,146 +0,0 @@ -const { Component, Mixin } = Shopware; -const { Criteria } = Shopware.Data; -import template from './sw-order.html.twig'; -import './sw-order.scss'; - -Component.override('sw-order-detail-base', { - template, - - inject: ['PayonePaymentService', 'repositoryFactory', 'acl'], - - mixins: [ - Mixin.getByName('notification') - ], - - data() { - return { - disableButtons: false, - notificationForwards: null - }; - }, - - computed: { - payoneTransactions: function() { - return this.order.transactions.filter(transaction => this.isPayoneTransaction(transaction)).sort((a, b) => { // newest transaction first - if(a.createdAt < b.createdAt) { - return 1; - } else if(a.createdAt > b.createdAt) { - return -1; - } else { - return 0; - } - }); - }, - - notificationForwardRepository() { - return this.repositoryFactory.create('payone_payment_notification_forward'); - }, - - notificationTargetColumns() { - return [{ - property: 'txaction', - type: 'text', - width: '100px' - },{ - property: 'notificationTarget.url', - type: 'text', - }, { - property: 'response', - width: '100px' - }, { - property: 'updatedAt', - align: 'right', - type: 'date' - }]; - } - }, - - methods: { - requeue(notificationForward, transaction) { - const request = { - notificationForwardId: notificationForward.id - }; - - this.PayonePaymentService.requeueNotificationForward(request).then(() => { - this.createNotificationSuccess({ - title: this.$tc('payonePayment.notificationTarget.actions.requeue'), - message: this.$tc('payonePayment.notificationTarget.messages.success') - }); - - this.getNotificationForwards(transaction); - }).catch((error) => { - this.createNotificationError({ - title: this.$tc('payonePayment.notificationTarget.actions.requeue'), - message: error.message - }); - }).finally(() => { - this.$nextTick().then(() => { - this.$emit('reload') - }); - }); - }, - - isPayoneTransaction(transaction) { - if (!transaction.extensions || !transaction.extensions.payonePaymentOrderTransactionData || !transaction.extensions.payonePaymentOrderTransactionData.transactionId) { - return false; - } - - return transaction.extensions.payonePaymentOrderTransactionData.transactionId; - }, - - hasNotificationForwards(transaction) { - if(null === this.notificationForwards) { - this.getNotificationForwards(transaction); - return false; - } - - if(this.notificationForwards.length <= 0) { - return false; - } - - return true; - }, - - getNotificationForwards(transaction) { - const criteria = new Criteria(); - criteria.addAssociation('notificationTarget'); - criteria.addSorting(Criteria.sort('updatedAt', 'DESC', true)); - criteria.addFilter(Criteria.equals('transactionId', transaction.id)); - criteria.setLimit(500); - - return this.notificationForwardRepository.search(criteria, Shopware.Context.api) - .then((searchResult) => { - this.notificationForwards = searchResult; - }); - }, - - can: function(permission) { - try { - return this.acl.can(permission); - } catch(e) { - return true; - } - }, - - isActiveTransaction(transaction) { - return transaction.stateMachineState.technicalName !== 'cancelled'; - }, - - hasPayoneTransaction(order) { - let me = this; - let isPayone = false; - - if (!order.transactions) { - return false; - } - - order.transactions.map(function(transaction) { - if (me.isPayoneTransaction(transaction) && me.isActiveTransaction(transaction)) { - isPayone = true; - } - }); - - return isPayone; - } - } -}); diff --git a/src/Resources/app/administration/src/module/payone-payment/extension/sw-order/sw-order.html.twig b/src/Resources/app/administration/src/module/payone-payment/extension/sw-order/sw-order.html.twig deleted file mode 100644 index 6d4522142..000000000 --- a/src/Resources/app/administration/src/module/payone-payment/extension/sw-order/sw-order.html.twig +++ /dev/null @@ -1,74 +0,0 @@ -{% block sw_order_detail_delivery_metadata %} - {% parent %} - - -{% endblock %} diff --git a/src/Resources/app/administration/src/module/payone-payment/extension/sw-settings-index/index.js b/src/Resources/app/administration/src/module/payone-payment/extension/sw-settings-index/index.js deleted file mode 100644 index b8a7cead6..000000000 --- a/src/Resources/app/administration/src/module/payone-payment/extension/sw-settings-index/index.js +++ /dev/null @@ -1,13 +0,0 @@ -import template from './sw-settings-index.html.twig'; -import './sw-settings-index.scss'; - -const { Component } = Shopware; - -const version = Shopware.Context.app.config.version; -const match = version.match(/((\d+)\.?(\d+?)\.?(\d+)?\.?(\d*))-?([A-z]+?\d+)?/i); - -if(match && parseInt(match[2]) === 6 && parseInt(match[3]) < 4) { - Component.override('sw-settings-index', { - template - }); -} diff --git a/src/Resources/app/administration/src/module/payone-payment/extension/sw-settings-index/sw-settings-index.html.twig b/src/Resources/app/administration/src/module/payone-payment/extension/sw-settings-index/sw-settings-index.html.twig deleted file mode 100644 index 8b40e585d..000000000 --- a/src/Resources/app/administration/src/module/payone-payment/extension/sw-settings-index/sw-settings-index.html.twig +++ /dev/null @@ -1,11 +0,0 @@ -{% block sw_settings_content_card_slot_plugins %} - {% parent %} - - - - -{% endblock %} diff --git a/src/Resources/app/administration/src/module/payone-payment/extension/sw-settings-index/sw-settings-index.scss b/src/Resources/app/administration/src/module/payone-payment/extension/sw-settings-index/sw-settings-index.scss deleted file mode 100644 index f3c6a764a..000000000 --- a/src/Resources/app/administration/src/module/payone-payment/extension/sw-settings-index/sw-settings-index.scss +++ /dev/null @@ -1,8 +0,0 @@ -.payone-context-button__button { - height: 48px; - line-height: 40px; -} - -.sw-settings-index__payone-icon { - height: 40px; -} diff --git a/src/Resources/app/administration/src/module/payone-payment/filter/payone_currency.filter.js b/src/Resources/app/administration/src/module/payone-payment/filter/payone_currency.filter.js index da4f02216..80169a58f 100644 --- a/src/Resources/app/administration/src/module/payone-payment/filter/payone_currency.filter.js +++ b/src/Resources/app/administration/src/module/payone-payment/filter/payone_currency.filter.js @@ -1,7 +1,6 @@ -const { Filter } = Shopware; const { currency } = Shopware.Utils.format; -Filter.register('payone_currency', (value, format, decimalPrecision, decimalPlaces) => { +export default (value, format, decimalPrecision, decimalPlaces) => { if (value === null) { return '-'; } @@ -13,4 +12,4 @@ Filter.register('payone_currency', (value, format, decimalPrecision, decimalPlac value /= (10 ** decimalPrecision); return currency(value, format, decimalPlaces); -}); +}; diff --git a/src/Resources/app/administration/src/module/payone-payment/index.js b/src/Resources/app/administration/src/module/payone-payment/index.js index 3db76fceb..f0810a73d 100644 --- a/src/Resources/app/administration/src/module/payone-payment/index.js +++ b/src/Resources/app/administration/src/module/payone-payment/index.js @@ -1,22 +1,14 @@ -const { Module } = Shopware; - -import './component/capture'; -import './component/refund'; -import './component/order-items'; -import './component/payone-data-grid'; -import './component/payone-payment-plugin-icon'; - -import './page/payone-settings'; - -import './extension/sw-order'; -import './extension/sw-settings-index'; - -import './filter/payone_currency.filter'; - import deDE from './snippet/de_DE.json'; import enGB from './snippet/en_GB.json'; -let configuration = { +Shopware.Component.register('payone-payment-plugin-icon', () => import('./component/payone-payment-plugin-icon')); +Shopware.Component.register('payone-ratepay-profile-configurations', () => import('./component/payone-ratepay-profile-configurations')); +Shopware.Component.register('payone-ratepay-profiles', () => import('./component/payone-ratepay-profiles')); +Shopware.Component.register('payone-settings', () => import('./page/payone-settings')); + +Shopware.Filter.register('payone_currency', () => import('./filter/payone_currency.filter')); + +Shopware.Module.register('payone-payment', { type: 'plugin', name: 'PayonePayment', title: 'payone-payment.general.mainMenuItemGeneral', @@ -42,21 +34,14 @@ let configuration = { parentPath: 'sw.settings.index' } } - } -}; - -const version = Shopware.Context.app.config.version; -const match = version.match(/((\d+)\.?(\d+?)\.?(\d+)?\.?(\d*))-?([A-z]+?\d+)?/i); + }, -if(match && parseInt(match[2]) === 6 && parseInt(match[3]) > 3) { - configuration.settingsItem = [{ + settingsItem: [{ name: 'payone-payment', to: 'payone.payment.index', label: 'payone-payment.general.mainMenuItemGeneral', group: 'plugins', iconComponent: 'payone-payment-plugin-icon', backgroundEnabled: false - }]; -} - -Module.register('payone-payment', configuration); + }], +}); diff --git a/src/Resources/app/administration/src/module/payone-payment/page/payone-settings/index.js b/src/Resources/app/administration/src/module/payone-payment/page/payone-settings/index.js index 0054d077f..037db679a 100644 --- a/src/Resources/app/administration/src/module/payone-payment/page/payone-settings/index.js +++ b/src/Resources/app/administration/src/module/payone-payment/page/payone-settings/index.js @@ -1,10 +1,10 @@ -const { Component, Mixin } = Shopware; -const { object, types } = Shopware.Utils; - import template from './payone-settings.html.twig'; import './style.scss'; -Component.register('payone-settings', { +const { Mixin } = Shopware; +const { object, types } = Shopware.Utils; + +export default { template, mixins: [ @@ -387,4 +387,4 @@ Component.register('payone-settings', { } } } -}); +}; diff --git a/src/Resources/app/administration/src/module/payone-payment/snippet/de_DE.json b/src/Resources/app/administration/src/module/payone-payment/snippet/de_DE.json index e13474494..0ccef78e8 100644 --- a/src/Resources/app/administration/src/module/payone-payment/snippet/de_DE.json +++ b/src/Resources/app/administration/src/module/payone-payment/snippet/de_DE.json @@ -27,54 +27,6 @@ "emptyInputs": "Bitte füllen Sie alle Eingabefelder aus." } }, - "capture": { - "buttonTitle": "Capture", - "successTitle": "PAYONE", - "successMessage": "Capture erfolgreich durchgeführt.", - "errorTitle": "PAYONE", - "errorMessage": "Capture konnte nicht durchgeführt werden.", - "tooltips": { - "impossible": "Einzug unmöglich" - } - }, - "refund": { - "buttonTitle": "Refund", - "successTitle": "PAYONE", - "successMessage": "Refund erfolgreich durchgeführt.", - "errorTitle": "PAYONE", - "errorMessage": "Refund konnte nicht durchgeführt werden.", - "tooltips": { - "impossible": "Erstattung unmöglich" - } - }, - "modal": { - "capture": { - "title": "Einzug", - "submit": "Einziehen", - "fullSubmit": "Alles Einziehen", - "amount": "Einzugswert", - "captured": "Eingezogener Wert" - }, - "refund": { - "title": "Erstattung", - "submit": "Erstatten", - "fullSubmit": "Alles Erstatten", - "amount": "Erstattungswert", - "refunded": "Erstatteter Wert" - }, - "close": "Schließen", - "orderAmount": "Bestellungswert", - "remainingAmount": "Ausstehender Wert", - "shippingCosts": "Versandkosten", - "labelComment": "Label comment", - "descriptionHelpText": "Description help text", - "columns": { - "reference": "Referenz", - "product": "Produkt", - "quantity": "Anzahl", - "price": "Preis" - } - }, "settingsForm": { "save": "Speichern", "test": "API-Zugangsdaten testen", @@ -163,13 +115,6 @@ "ship_partially": "Teilweise versenden" }, "messageNotBlank": "Dieser Wert darf nicht leer sein.", - "txid": "TXID", - "sequenceNumber": { - "label": "Sequenznummer", - "empty": "keine" - }, - "transactionState": "Status", - "transactionCancelled": "Transaktion in Shopware abgebrochen", "error": { "transaction": { "notFound": "Es wurde keine passende Transaktion gefundend", diff --git a/src/Resources/app/administration/src/module/payone-payment/snippet/en_GB.json b/src/Resources/app/administration/src/module/payone-payment/snippet/en_GB.json index 18b7aa136..86b655408 100644 --- a/src/Resources/app/administration/src/module/payone-payment/snippet/en_GB.json +++ b/src/Resources/app/administration/src/module/payone-payment/snippet/en_GB.json @@ -27,54 +27,6 @@ "emptyInputs": "Please fill all input fields." } }, - "capture": { - "buttonTitle": "Capture", - "successTitle": "PAYONE", - "successMessage": "Capture processed successfully.", - "errorTitle": "PAYONE", - "errorMessage": "Capture could not be processed.", - "tooltips": { - "impossible": "Capture impossible" - } - }, - "refund": { - "buttonTitle": "Refund", - "successTitle": "PAYONE", - "successMessage": "Refund processed successfully.", - "errorTitle": "PAYONE", - "errorMessage": "Refund could not be processed.", - "tooltips": { - "impossible": "Refund impossible" - } - }, - "modal": { - "capture": { - "title": "Capture", - "submit": "Capture", - "fullSubmit": "Full capture", - "amount": "Capture amount", - "captured": "Captured amount" - }, - "refund": { - "title": "Refund", - "submit": "Refund", - "fullSubmit": "Full Refund", - "amount": "Refund amount", - "refunded": "Refunded amount" - }, - "orderAmount": "Order amount", - "remainingAmount": "Remaining amount", - "shippingCosts": "Shipping costs", - "descriptionHelpText": "Description help text", - "close": "Close", - "labelComment": "Label comment", - "columns": { - "reference": "Reference", - "product": "Product", - "quantity": "Quantity", - "price": "Price" - } - }, "settingsForm": { "save": "Save", "test": "Test API Credentials", @@ -163,13 +115,6 @@ "ship_partially": "Ship partially" }, "messageNotBlank": "This field must not be empty.", - "txid": "TXID", - "sequenceNumber": { - "label": "Sequence Number", - "empty": "none" - }, - "transactionState": "State", - "transactionCancelled": "Transaction cancelled in Shopware", "error": { "transaction": { "notFound": "No matching transaction could be found", diff --git a/src/Resources/app/administration/src/module/payone-payment/component/capture/index.js b/src/Resources/app/administration/src/module/sw-order/component/payone-capture-button/index.js similarity index 95% rename from src/Resources/app/administration/src/module/payone-payment/component/capture/index.js rename to src/Resources/app/administration/src/module/sw-order/component/payone-capture-button/index.js index 010bb7497..07645b67e 100644 --- a/src/Resources/app/administration/src/module/payone-payment/component/capture/index.js +++ b/src/Resources/app/administration/src/module/sw-order/component/payone-capture-button/index.js @@ -1,9 +1,9 @@ -import template from './capture.html.twig'; -import './style.scss'; +import template from './payone-capture-button.html.twig'; +import './payone-capture-button.scss'; -const { Component, Mixin, Context } = Shopware; +const { Mixin } = Shopware; -Component.register('payone-capture-button', { +export default { template, mixins: [ @@ -220,14 +220,14 @@ Component.register('payone-capture-button', { executeCapture(request) { this.PayonePaymentService.capturePayment(request).then(() => { this.createNotificationSuccess({ - title: this.$tc('payone-payment.capture.successTitle'), - message: this.$tc('payone-payment.capture.successMessage') + title: this.$tc('sw-order.payone-payment.capture.successTitle'), + message: this.$tc('sw-order.payone-payment.capture.successMessage') }); this.isCaptureSuccessful = true; }).catch((error) => { this.createNotificationError({ - title: this.$tc('payone-payment.capture.errorTitle'), + title: this.$tc('sw-order.payone-payment.capture.errorTitle'), message: error.message }); @@ -297,4 +297,4 @@ Component.register('payone-capture-button', { } } } -}); +}; diff --git a/src/Resources/app/administration/src/module/payone-payment/component/capture/capture.html.twig b/src/Resources/app/administration/src/module/sw-order/component/payone-capture-button/payone-capture-button.html.twig similarity index 62% rename from src/Resources/app/administration/src/module/payone-payment/component/capture/capture.html.twig rename to src/Resources/app/administration/src/module/sw-order/component/payone-capture-button/payone-capture-button.html.twig index d56e6a8c6..7a7354b73 100644 --- a/src/Resources/app/administration/src/module/payone-payment/component/capture/capture.html.twig +++ b/src/Resources/app/administration/src/module/sw-order/component/payone-capture-button/payone-capture-button.html.twig @@ -1,12 +1,12 @@ {% block payone_payment_payment_details %}
- + - {{ $tc('payone-payment.capture.buttonTitle') }} + {{ $tc('sw-order.payone-payment.capture.buttonTitle') }} - + - - - - + + + @@ -28,15 +28,15 @@ diff --git a/src/Resources/app/administration/src/module/payone-payment/component/capture/style.scss b/src/Resources/app/administration/src/module/sw-order/component/payone-capture-button/payone-capture-button.scss similarity index 100% rename from src/Resources/app/administration/src/module/payone-payment/component/capture/style.scss rename to src/Resources/app/administration/src/module/sw-order/component/payone-capture-button/payone-capture-button.scss diff --git a/src/Resources/app/administration/src/module/sw-order/component/payone-data-grid/index.js b/src/Resources/app/administration/src/module/sw-order/component/payone-data-grid/index.js new file mode 100644 index 000000000..667b65bcb --- /dev/null +++ b/src/Resources/app/administration/src/module/sw-order/component/payone-data-grid/index.js @@ -0,0 +1,5 @@ +import template from './payone-data-grid.html.twig'; + +export default { + template: template +}; diff --git a/src/Resources/app/administration/src/module/payone-payment/component/payone-data-grid/payone-data-grid.html.twig b/src/Resources/app/administration/src/module/sw-order/component/payone-data-grid/payone-data-grid.html.twig similarity index 100% rename from src/Resources/app/administration/src/module/payone-payment/component/payone-data-grid/payone-data-grid.html.twig rename to src/Resources/app/administration/src/module/sw-order/component/payone-data-grid/payone-data-grid.html.twig diff --git a/src/Resources/app/administration/src/module/payone-payment/component/order-items/index.js b/src/Resources/app/administration/src/module/sw-order/component/payone-order-items/index.js similarity index 87% rename from src/Resources/app/administration/src/module/payone-payment/component/order-items/index.js rename to src/Resources/app/administration/src/module/sw-order/component/payone-order-items/index.js index d6eba32f4..dc1eb62d9 100644 --- a/src/Resources/app/administration/src/module/payone-payment/component/order-items/index.js +++ b/src/Resources/app/administration/src/module/sw-order/component/payone-order-items/index.js @@ -1,9 +1,7 @@ -import template from './order-items.html.twig'; -import './order-items.scss'; +import template from './payone-order-items.html.twig'; +import './payone-order-items.scss'; -const { Component } = Shopware; - -Component.register('payone-order-items', { +export default { template, props: { @@ -66,7 +64,7 @@ Component.register('payone-order-items', { if (this.order.shippingCosts.totalPrice > 0) { data.push({ id: 'shipping', - product: this.$tc('payone-payment.modal.shippingCosts'), + product: this.$tc('sw-order.payone-payment.modal.shippingCosts'), quantity: 1, disabled: false, selected: false, @@ -82,17 +80,17 @@ Component.register('payone-order-items', { return [ { property: 'product', - label: this.$tc('payone-payment.modal.columns.product'), + label: this.$tc('sw-order.payone-payment.modal.columns.product'), rawData: true }, { property: 'quantity', - label: this.$tc('payone-payment.modal.columns.quantity'), + label: this.$tc('sw-order.payone-payment.modal.columns.quantity'), rawData: true }, { property: 'price', - label: this.$tc('payone-payment.modal.columns.price'), + label: this.$tc('sw-order.payone-payment.modal.columns.price'), rawData: true } ]; @@ -108,4 +106,4 @@ Component.register('payone-order-items', { this.$emit('change-quantity', id, value); } } -}); +}; diff --git a/src/Resources/app/administration/src/module/payone-payment/component/order-items/order-items.html.twig b/src/Resources/app/administration/src/module/sw-order/component/payone-order-items/payone-order-items.html.twig similarity index 100% rename from src/Resources/app/administration/src/module/payone-payment/component/order-items/order-items.html.twig rename to src/Resources/app/administration/src/module/sw-order/component/payone-order-items/payone-order-items.html.twig diff --git a/src/Resources/app/administration/src/module/payone-payment/component/order-items/order-items.scss b/src/Resources/app/administration/src/module/sw-order/component/payone-order-items/payone-order-items.scss similarity index 100% rename from src/Resources/app/administration/src/module/payone-payment/component/order-items/order-items.scss rename to src/Resources/app/administration/src/module/sw-order/component/payone-order-items/payone-order-items.scss diff --git a/src/Resources/app/administration/src/module/sw-order/component/payone-payment-management/index.js b/src/Resources/app/administration/src/module/sw-order/component/payone-payment-management/index.js new file mode 100644 index 000000000..bbacde31c --- /dev/null +++ b/src/Resources/app/administration/src/module/sw-order/component/payone-payment-management/index.js @@ -0,0 +1,133 @@ +import template from './payone-payment-management.html.twig'; +import './payone-payment-management.scss'; + +const { Mixin } = Shopware; +const { Criteria } = Shopware.Data; + +export default { + template, + + inject: ['acl', 'PayonePaymentService', 'repositoryFactory'], + + mixins: [ + Mixin.getByName('notification'), + ], + + props: { + order: { + type: Object, + required: true, + }, + }, + + data() { + return { + notificationForwards: null + }; + }, + + computed: { + payoneTransactions: function () { + return this.order.transactions.filter(transaction => this.isPayoneTransaction(transaction)).sort((a, b) => { // newest transaction first + if (a.createdAt < b.createdAt) { + return 1; + } else if (a.createdAt > b.createdAt) { + return -1; + } else { + return 0; + } + }); + }, + notificationForwardRepository() { + return this.repositoryFactory.create('payone_payment_notification_forward'); + }, + notificationTargetColumns() { + return [{ + property: 'txaction', + type: 'text', + width: '100px' + },{ + property: 'notificationTarget.url', + type: 'text', + }, { + property: 'response', + width: '100px' + }, { + property: 'updatedAt', + align: 'right', + type: 'date' + }]; + }, + }, + + methods: { + isPayoneTransaction(transaction) { + if (!transaction.extensions || !transaction.extensions.payonePaymentOrderTransactionData || !transaction.extensions.payonePaymentOrderTransactionData.transactionId) { + return false; + } + + return transaction.extensions.payonePaymentOrderTransactionData.transactionId; + }, + isActiveTransaction(transaction) { + return transaction.stateMachineState.technicalName !== 'cancelled'; + }, + hasNotificationForwards(transaction) { + if (this.notificationForwards === null) { + this.getNotificationForwards(transaction); + return false; + } + + return this.notificationForwards.length > 0; + }, + getNotificationForwards(transaction) { + const criteria = new Criteria(); + criteria.addAssociation('notificationTarget'); + criteria.addSorting(Criteria.sort('updatedAt', 'DESC', true)); + criteria.addFilter(Criteria.equals('transactionId', transaction.id)); + criteria.setLimit(500); + + return this.notificationForwardRepository.search(criteria, Shopware.Context.api) + .then((searchResult) => { + this.notificationForwards = searchResult; + }); + }, + requeue(notificationForward, transaction) { + const request = { + notificationForwardId: notificationForward.id + }; + + this.PayonePaymentService.requeueNotificationForward(request).then(() => { + this.createNotificationSuccess({ + title: this.$tc('payonePayment.notificationTarget.actions.requeue'), + message: this.$tc('payonePayment.notificationTarget.messages.success') + }); + + this.getNotificationForwards(transaction); + }).catch((error) => { + this.createNotificationError({ + title: this.$tc('payonePayment.notificationTarget.actions.requeue'), + message: error.message + }); + }).finally(() => { + this.$nextTick().then(() => { + this.$emit('reload') + }); + }); + }, + can(permission) { + try { + return this.acl.can(permission); + } catch(e) { + return true; + } + }, + reloadEntityData() { + // ToDo 6.5: Reload order after capture/refund? + }, + getPayoneCardType(transaction) { + let cardType = transaction.extensions.payonePaymentOrderTransactionData?.additionalData?.card_type; + + return cardType ? this.$tc('sw-order.payone-payment.creditCard.cardTypes.' + cardType) : null; + }, + } +}; diff --git a/src/Resources/app/administration/src/module/sw-order/component/payone-payment-management/payone-payment-management.html.twig b/src/Resources/app/administration/src/module/sw-order/component/payone-payment-management/payone-payment-management.html.twig new file mode 100644 index 000000000..c08d3b601 --- /dev/null +++ b/src/Resources/app/administration/src/module/sw-order/component/payone-payment-management/payone-payment-management.html.twig @@ -0,0 +1,78 @@ +{% block payone_payment_management %} +
+ +
+{% endblock %} diff --git a/src/Resources/app/administration/src/module/payone-payment/extension/sw-order/sw-order.scss b/src/Resources/app/administration/src/module/sw-order/component/payone-payment-management/payone-payment-management.scss similarity index 73% rename from src/Resources/app/administration/src/module/payone-payment/extension/sw-order/sw-order.scss rename to src/Resources/app/administration/src/module/sw-order/component/payone-payment-management/payone-payment-management.scss index c288ef28a..bf408a8a5 100644 --- a/src/Resources/app/administration/src/module/payone-payment/extension/sw-order/sw-order.scss +++ b/src/Resources/app/administration/src/module/sw-order/component/payone-payment-management/payone-payment-management.scss @@ -1,5 +1,5 @@ -.sw-order-payone-card { - .payone-payment-detail--notification-forwards { +.payone-payment-management-card { + .payone-payment-management-notification-forwards { margin-top: 30px; } diff --git a/src/Resources/app/administration/src/module/payone-payment/component/refund/index.js b/src/Resources/app/administration/src/module/sw-order/component/payone-refund-button/index.js similarity index 93% rename from src/Resources/app/administration/src/module/payone-payment/component/refund/index.js rename to src/Resources/app/administration/src/module/sw-order/component/payone-refund-button/index.js index ee2d0416d..8eb5164dc 100644 --- a/src/Resources/app/administration/src/module/payone-payment/component/refund/index.js +++ b/src/Resources/app/administration/src/module/sw-order/component/payone-refund-button/index.js @@ -1,9 +1,9 @@ -import template from './refund.html.twig'; -import './style.scss'; +import template from './payone-refund-button.html.twig'; +import './payone-refund-button.scss'; -const { Component, Mixin } = Shopware; +const { Mixin } = Shopware; -Component.register('payone-refund-button', { +export default { template, mixins: [ @@ -169,14 +169,14 @@ Component.register('payone-refund-button', { this.PayonePaymentService.refundPayment(request).then(() => { this.createNotificationSuccess({ - title: this.$tc('payone-payment.refund.successTitle'), - message: this.$tc('payone-payment.refund.successMessage') + title: this.$tc('sw-order.payone-payment.refund.successTitle'), + message: this.$tc('sw-order.payone-payment.refund.successMessage') }); this.isRefundSuccessful = true; }).catch((error) => { this.createNotificationError({ - title: this.$tc('payone-payment.refund.errorTitle'), + title: this.$tc('sw-order.payone-payment.refund.errorTitle'), message: error.message }); @@ -222,14 +222,14 @@ Component.register('payone-refund-button', { this.PayonePaymentService.refundPayment(request).then(() => { this.createNotificationSuccess({ - title: this.$tc('payone-payment.refund.successTitle'), - message: this.$tc('payone-payment.refund.successMessage') + title: this.$tc('sw-order.payone-payment.refund.successTitle'), + message: this.$tc('sw-order.payone-payment.refund.successMessage') }); this.isRefundSuccessful = true; }).catch((error) => { this.createNotificationError({ - title: this.$tc('payone-payment.refund.errorTitle'), + title: this.$tc('sw-order.payone-payment.refund.errorTitle'), message: error.message }); @@ -299,4 +299,4 @@ Component.register('payone-refund-button', { } } } -}); +}; diff --git a/src/Resources/app/administration/src/module/payone-payment/component/refund/refund.html.twig b/src/Resources/app/administration/src/module/sw-order/component/payone-refund-button/payone-refund-button.html.twig similarity index 62% rename from src/Resources/app/administration/src/module/payone-payment/component/refund/refund.html.twig rename to src/Resources/app/administration/src/module/sw-order/component/payone-refund-button/payone-refund-button.html.twig index 07ecdac37..078c973e9 100644 --- a/src/Resources/app/administration/src/module/payone-payment/component/refund/refund.html.twig +++ b/src/Resources/app/administration/src/module/sw-order/component/payone-refund-button/payone-refund-button.html.twig @@ -1,12 +1,12 @@ {% block payone_payment_payment_details %}
- + - {{ $tc('payone-payment.refund.buttonTitle') }} + {{ $tc('sw-order.payone-payment.refund.buttonTitle') }} - + - - - - + + + @@ -28,15 +28,15 @@ diff --git a/src/Resources/app/administration/src/module/payone-payment/component/refund/style.scss b/src/Resources/app/administration/src/module/sw-order/component/payone-refund-button/payone-refund-button.scss similarity index 100% rename from src/Resources/app/administration/src/module/payone-payment/component/refund/style.scss rename to src/Resources/app/administration/src/module/sw-order/component/payone-refund-button/payone-refund-button.scss diff --git a/src/Resources/app/administration/src/module/sw-order/component/sw-order-user-card/index.js b/src/Resources/app/administration/src/module/sw-order/component/sw-order-user-card/index.js deleted file mode 100644 index 5dd127211..000000000 --- a/src/Resources/app/administration/src/module/sw-order/component/sw-order-user-card/index.js +++ /dev/null @@ -1,13 +0,0 @@ -import template from './sw-order-user-card.html.twig'; - -Shopware.Component.override('sw-order-user-card', { - template, - - computed: { - payoneCardType() { - let cardType = this.currentOrder.transactions.last().extensions.payonePaymentOrderTransactionData?.additionalData?.card_type; - - return cardType ? this.$tc('sw-order.payone-payment.creditCard.cardTypes.' + cardType) : null; - } - } -}); \ No newline at end of file diff --git a/src/Resources/app/administration/src/module/sw-order/component/sw-order-user-card/sw-order-user-card.html.twig b/src/Resources/app/administration/src/module/sw-order/component/sw-order-user-card/sw-order-user-card.html.twig deleted file mode 100644 index 8b488fefa..000000000 --- a/src/Resources/app/administration/src/module/sw-order/component/sw-order-user-card/sw-order-user-card.html.twig +++ /dev/null @@ -1,11 +0,0 @@ -{% block sw_order_detail_base_secondary_info_payment %} - -{% endblock %} \ No newline at end of file diff --git a/src/Resources/app/administration/src/module/sw-order/index.js b/src/Resources/app/administration/src/module/sw-order/index.js index 3905c9a62..c97020dd1 100644 --- a/src/Resources/app/administration/src/module/sw-order/index.js +++ b/src/Resources/app/administration/src/module/sw-order/index.js @@ -1 +1,28 @@ -import './component/sw-order-user-card'; \ No newline at end of file +Shopware.Component.register('payone-capture-button', () => import('./component/payone-capture-button')); +Shopware.Component.register('payone-order-items', () => import('./component/payone-order-items')); +Shopware.Component.register('payone-payment-management', () => import('./component/payone-payment-management')); +Shopware.Component.register('payone-refund-button', () => import('./component/payone-refund-button')); +Shopware.Component.register('sw-order-detail-payone', () => import('./view/sw-order-detail-payone')); + +Shopware.Component.override('sw-order-detail', () => import('./page/sw-order-detail')); +Shopware.Component.extend('payone-data-grid', 'sw-data-grid', () => import('./component/payone-data-grid')); + +Shopware.Module.register('sw-order-detail-tab-payone', { + routeMiddleware(next, currentRoute) { + if (currentRoute.name === 'sw.order.detail') { + currentRoute.children.push({ + name: 'sw.order.detail.payone', + path: 'payone', + component: 'sw-order-detail-payone', + meta: { + parentPath: "sw.order.detail", + meta: { + parentPath: 'sw.order.index', + privilege: 'order.viewer', + }, + } + }); + } + next(currentRoute); + } +}); diff --git a/src/Resources/app/administration/src/module/sw-order/page/sw-order-detail/index.js b/src/Resources/app/administration/src/module/sw-order/page/sw-order-detail/index.js new file mode 100644 index 000000000..71363ce37 --- /dev/null +++ b/src/Resources/app/administration/src/module/sw-order/page/sw-order-detail/index.js @@ -0,0 +1,37 @@ +import template from './sw-order-detail.html.twig'; + +export default { + template, + + methods: { + hasPayoneTransaction(order) { + let me = this; + let isPayone = false; + + if (!order.transactions) { + return false; + } + + order.transactions.map(function(transaction) { + if (me.isPayoneTransaction(transaction) && me.isActiveTransaction(transaction)) { + isPayone = true; + } + }); + + + return isPayone; + }, + + isPayoneTransaction(transaction) { + if (!transaction.extensions || !transaction.extensions.payonePaymentOrderTransactionData || !transaction.extensions.payonePaymentOrderTransactionData.transactionId) { + return false; + } + + return transaction.extensions.payonePaymentOrderTransactionData.transactionId; + }, + + isActiveTransaction(transaction) { + return transaction.stateMachineState.technicalName !== 'cancelled'; + }, + } +}; diff --git a/src/Resources/app/administration/src/module/sw-order/page/sw-order-detail/sw-order-detail.html.twig b/src/Resources/app/administration/src/module/sw-order/page/sw-order-detail/sw-order-detail.html.twig new file mode 100644 index 000000000..ae310a81a --- /dev/null +++ b/src/Resources/app/administration/src/module/sw-order/page/sw-order-detail/sw-order-detail.html.twig @@ -0,0 +1,15 @@ +{% block sw_order_detail_content_tabs_extension %} + {% parent %} + + {% block sw_order_detail_content_tabs_payone %} + + {{ $tc('sw-order.detail.payone') }} + + {% endblock %} + +{% endblock %} \ No newline at end of file diff --git a/src/Resources/app/administration/src/module/sw-order/snippet/de-DE.json b/src/Resources/app/administration/src/module/sw-order/snippet/de-DE.json index 317469d35..a9170c437 100644 --- a/src/Resources/app/administration/src/module/sw-order/snippet/de-DE.json +++ b/src/Resources/app/administration/src/module/sw-order/snippet/de-DE.json @@ -1,6 +1,18 @@ { "sw-order": { + "detail": { + "payone": "PAYONE" + }, "payone-payment": { + "title": "PAYONE", + "paymentMethod": "Zahlungsart", + "txid": "TXID", + "transactionState": "Status", + "transactionCancelled": "Transaktion in Shopware abgebrochen", + "sequenceNumber": { + "label": "Sequenznummer", + "empty": "keine" + }, "creditCard": { "cardTypeLabel": "Kartentyp", "cardTypes": { @@ -14,6 +26,54 @@ "U": "UATP / Airplus", "G": "girocard" } + }, + "capture": { + "buttonTitle": "Capture", + "successTitle": "PAYONE", + "successMessage": "Capture erfolgreich durchgeführt.", + "errorTitle": "PAYONE", + "errorMessage": "Capture konnte nicht durchgeführt werden.", + "tooltips": { + "impossible": "Einzug unmöglich" + } + }, + "refund": { + "buttonTitle": "Refund", + "successTitle": "PAYONE", + "successMessage": "Refund erfolgreich durchgeführt.", + "errorTitle": "PAYONE", + "errorMessage": "Refund konnte nicht durchgeführt werden.", + "tooltips": { + "impossible": "Erstattung unmöglich" + } + }, + "modal": { + "capture": { + "title": "Einzug", + "submit": "Einziehen", + "fullSubmit": "Alles Einziehen", + "amount": "Einzugswert", + "captured": "Eingezogener Wert" + }, + "refund": { + "title": "Erstattung", + "submit": "Erstatten", + "fullSubmit": "Alles Erstatten", + "amount": "Erstattungswert", + "refunded": "Erstatteter Wert" + }, + "close": "Schließen", + "orderAmount": "Bestellungswert", + "remainingAmount": "Ausstehender Wert", + "shippingCosts": "Versandkosten", + "labelComment": "Label comment", + "descriptionHelpText": "Description help text", + "columns": { + "reference": "Referenz", + "product": "Produkt", + "quantity": "Anzahl", + "price": "Preis" + } } } } diff --git a/src/Resources/app/administration/src/module/sw-order/snippet/en-GB.json b/src/Resources/app/administration/src/module/sw-order/snippet/en-GB.json index 52ec04f0a..f6dc0bef7 100644 --- a/src/Resources/app/administration/src/module/sw-order/snippet/en-GB.json +++ b/src/Resources/app/administration/src/module/sw-order/snippet/en-GB.json @@ -1,6 +1,18 @@ { "sw-order": { + "detail": { + "payone": "PAYONE" + }, "payone-payment": { + "title": "PAYONE", + "paymentMethod": "Payment Method", + "txid": "TXID", + "transactionState": "State", + "transactionCancelled": "Transaction cancelled in Shopware", + "sequenceNumber": { + "label": "Sequence Number", + "empty": "none" + }, "creditCard": { "cardTypeLabel": "Card Type", "cardTypes": { @@ -14,6 +26,54 @@ "U": "UATP / Airplus", "G": "girocard" } + }, + "capture": { + "buttonTitle": "Capture", + "successTitle": "PAYONE", + "successMessage": "Capture processed successfully.", + "errorTitle": "PAYONE", + "errorMessage": "Capture could not be processed.", + "tooltips": { + "impossible": "Capture impossible" + } + }, + "refund": { + "buttonTitle": "Refund", + "successTitle": "PAYONE", + "successMessage": "Refund processed successfully.", + "errorTitle": "PAYONE", + "errorMessage": "Refund could not be processed.", + "tooltips": { + "impossible": "Refund impossible" + } + }, + "modal": { + "capture": { + "title": "Capture", + "submit": "Capture", + "fullSubmit": "Full capture", + "amount": "Capture amount", + "captured": "Captured amount" + }, + "refund": { + "title": "Refund", + "submit": "Refund", + "fullSubmit": "Full Refund", + "amount": "Refund amount", + "refunded": "Refunded amount" + }, + "orderAmount": "Order amount", + "remainingAmount": "Remaining amount", + "shippingCosts": "Shipping costs", + "descriptionHelpText": "Description help text", + "close": "Close", + "labelComment": "Label comment", + "columns": { + "reference": "Reference", + "product": "Product", + "quantity": "Quantity", + "price": "Price" + } } } } diff --git a/src/Resources/app/administration/src/module/sw-order/view/sw-order-detail-payone/index.js b/src/Resources/app/administration/src/module/sw-order/view/sw-order-detail-payone/index.js new file mode 100644 index 000000000..e265c7e65 --- /dev/null +++ b/src/Resources/app/administration/src/module/sw-order/view/sw-order-detail-payone/index.js @@ -0,0 +1,21 @@ +import template from './sw-order-detail-payone.html.twig'; + +const { Component } = Shopware; +const { mapState } = Component.getComponentHelper(); + +export default { + template, + + props: { + orderId: { + type: String, + required: true, + }, + }, + + computed: { + ...mapState('swOrderDetail', [ + 'order', + ]), + }, +}; diff --git a/src/Resources/app/administration/src/module/sw-order/view/sw-order-detail-payone/sw-order-detail-payone.html.twig b/src/Resources/app/administration/src/module/sw-order/view/sw-order-detail-payone/sw-order-detail-payone.html.twig new file mode 100644 index 000000000..474bd28e8 --- /dev/null +++ b/src/Resources/app/administration/src/module/sw-order/view/sw-order-detail-payone/sw-order-detail-payone.html.twig @@ -0,0 +1,6 @@ +{% block sw_order_detail_payone %} +
+ + +
+{% endblock %} diff --git a/src/Resources/app/storefront/dist/storefront/js/payone-payment.js b/src/Resources/app/storefront/dist/storefront/js/payone-payment.js index 80c83ac5d..0c08d0794 100644 --- a/src/Resources/app/storefront/dist/storefront/js/payone-payment.js +++ b/src/Resources/app/storefront/dist/storefront/js/payone-payment.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([["payone-payment"],{T08A:function(e,t,n){"use strict";n.r(t);var a,i,r,o=n("FGIj"),s=n("477Q");class l extends o.a{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 a=document.getElementById("savedpseudocardpan"),i=document.getElementById("confirmOrderForm");a&&a.addEventListener("change",this._handleChangeSavedCard.bind(this)),i&&i.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"),a=document.getElementById("card-logo");a.setAttribute("src",t),n.style.display="none",a.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.a(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={supportedCardtypes:["#","V","A","M","D","J","O","U","P"]},(i="options")in(a=l)?Object.defineProperty(a,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):a[i]=r;var d=n("2Jwc"),c=n("3xtq"),u=n("k8s9");class m extends o.a{init(){this.orderFormDisabled=!0,this._client=new u.a,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.a(t);t.disabled=!1,e.remove()}}_getModal(e){e.preventDefault(),c.a.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.a.remove()}if("active"===e.mandate.Status)return void this._submitForm();const t=new d.a(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.a.remove()}_getRequestData(){const e=document.getElementById("payoneCsrfTokenDebitManageMandate"),t=document.getElementById("iban");return{_csrf_token:e.value,iban:t.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 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.a{init(){this.orderFormDisabled=!0,this._client=new u.a,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,"payolutionBirthday"),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.a.create(),this._client.abort(),this._client.post(this._getValidateUrl(),e,(e=>this._handleValidateResponse(e)))}_handleValidateResponse(e){if(e=JSON.parse(e),c.a.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(){const e=document.getElementById("payoneCsrfTokenPayolutionInvoiceValidation"),t=document.getElementById("payolutionBirthday");return{_csrf_token:e.value,payolutionBirthday:t.value}}}class p extends o.a{init(){this.orderFormDisabled=!0,this._client=new u.a,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,"payolutionBirthday"),e.defaultPrevented)return;c.a.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.a.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,"payolutionBirthday"),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.a(t);t.disabled=!1,e.remove()}}_getRequestData(){const e=document.getElementById("payoneCsrfTokenPayolutionInstallmentCalculation"),t=document.getElementById("payolutionBirthday"),n=document.getElementById("payoneWorkOrder"),a=document.getElementById("payoneCartHash");return{_csrf_token:e.value,payolutionBirthday:t.value,workorder:n.value,carthash:a.value}}}var y=n("gHbT"),b=n("p4AR");function g(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class v extends o.a{init(){null===this.options.supportedNetworks&&(this.options.supportedNetworks=[]),this.client=new b.a,this.validateMerchantUrl=this.el.dataset.validateMerchantUrl,this.processPaymentUrl=this.el.dataset.processPaymentUrl,this.orderForm=y.a.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.client.abort(),this.client.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.a.querySelector(document,"#payone-apple-pay-error");e.style.display="block",e.scrollIntoView({block:"start"})}authorizePayment(e){let t=y.a.querySelector(this.orderForm,"input[name='orderId']").value;this.client.abort(),this.client.post(this.processPaymentUrl,JSON.stringify({token:e.payment.token,orderId:t}),(e=>{this.completePayment(e),this.orderForm.submit()}))}completePayment(e){let t="",n="",a="";try{let i=JSON.parse(e);n=i.status,t=i.txid,a=i.userid}catch(e){this.orderForm.submit()}this.updateFormData(n,t,a,e),"APPROVED"!==n&&"PENDING"!==n||this.session.completePayment({status:ApplePaySession.STATUS_SUCCESS,errors:[]}),this.orderForm.submit()}updateFormData(e,t,n,a){y.a.querySelector(this.orderForm,"input[name='status']").value=e,y.a.querySelector(this.orderForm,"input[name='txid']").value=t,y.a.querySelector(this.orderForm,"input[name='userid']").value=n,y.a.querySelector(this.orderForm,"input[name='response']").value=a}_handleApplePayButtonClick(){this.orderForm.reportValidity()&&(this.createSession(),this.performPayment())}_registerEventHandler(){this.el.addEventListener("click",this._handleApplePayButtonClick.bind(this))}}g(v,"options",{countryCode:"",currencyCode:"",supportedNetworks:[],merchantCapabilities:["supports3DS","supportsDebit","supportsCredit"],total:{label:"",type:"final",amount:"0.01"}}),g(v,"session",void 0),g(v,"client",void 0),g(v,"validateMerchantUrl",void 0),g(v,"processPaymentUrl",void 0),g(v,"orderForm",void 0);var I=n("i8qz");function _(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class E extends o.a{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._registerEventListeners()}_initKlarnaWidget(){Klarna.Payments.init({client_token:this.options.clientToken}),Klarna.Payments.load({container:this.options.selectorContainer,payment_method_category:this.options.paymentMethodIdentifier},(e=>{this.confirmFormSubmit.disabled=!1,ElementLoadingIndicatorUtil.remove(this.el)}))}_registerEventListeners(){this.orderForm&&("csrf"in window&&"twig"!==window.csrf.mode?this.orderForm.addEventListener("beforeSubmit",this._handleOrderSubmit.bind(this)):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 ButtonLoadingIndicator(this.confirmFormSubmit).remove():e.show_form||(window.location.href=window.location.href)}))}}_(E,"options",{clientToken:null,paymentMethodIdentifier:null,selectorContainer:null,selectorTokenInput:'input[name="payoneKlarnaAuthorizationToken"]',selectorFormId:"confirmOrderForm"}),_(E,"orderForm",null),_(E,"confirmFormSubmit",null);const f=window.PluginManager;f.register("PayonePaymentCreditCard",l,"[data-is-payone-credit-card]"),f.register("PayonePaymentDebitCard",m,"[data-is-payone-debit-card]"),f.register("PayonePaymentPayolutionInvoicing",h,"[data-is-payone-payolution-invoicing]"),f.register("PayonePaymentPayolutionInstallment",p,"[data-is-payone-payolution-installment]"),f.register("PayonePaymentApplePay",v,"[data-payone-payment-apple-pay-options]"),f.register("PayonePaymentRatepayInstallment",I.a,"[data-is-payone-ratepay-installment]"),f.register("PayonePaymentKlarna",E,"[data-payone-payment-klarna]")},i8qz:function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return d}));var a,i,r,o=n("FGIj"),s=n("gHbT"),l=n("k8s9");class d extends o.a{init(){this.csrfToken=document.getElementById("payoneCsrfTokenRatepayInstallmentCalculation"),this._client=new l.a,this.ratepayRateInput=s.a.querySelector(document,this.options.ratepayRateInputSelector),this.calculateInstallmentBtn=s.a.querySelector(document,this.options.calculateInstallmentBtnSelector),this.ratepayRuntimeInput=s.a.querySelector(document,this.options.ratepayRuntimeInputSelector),this.ratepayIbanContainer=s.a.querySelector(document,this.options.ratepayIbanContainerSelector),this.ratepayIbanInput=s.a.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)),e(this.options.ratepayIbanContainerSelector).on("shown.bs.collapse",this._handleOpenedIbanContainer.bind(this)),e(this.options.ratepayIbanContainerSelector).on("hidden.bs.collapse",this._handleClosedIbanContainer.bind(this))}_handleCalculateInstallmentButtonClick(){const e=this.ratepayRateInput.value;this._sendRequest("rate",e)}_handleInstallmentRuntimeChange(){const e=s.a.querySelector(document,this.options.ratepayRuntimeInputSelector).value;this._sendRequest("time",e)}_sendRequest(e,t){let n={_csrf_token:this.csrfToken.value};n.ratepayInstallmentType=e,n.ratepayInstallmentValue=t;const a=JSON.stringify(n);this._client.abort(),this._client.post("/payone/ratepay/installment/calculation",a,(e=>this._handleCalculationCallback(e)))}_handleCalculationCallback(e){this._replaceCalculationContent(e)}_replaceCalculationContent(e){s.a.querySelector(document,this.options.ratepayInstallmentPlanContainerSelector).innerHTML=e,this.ratepayInstallmentTable=s.a.querySelector(document,this.options.ratepayInstallmentTableSelector),this.ratepayRuntimeInput.value=this.ratepayInstallmentTable.dataset.ratepayNumberOfRates,this.ratepayRateInput.value=this.ratepayInstallmentTable.dataset.ratepayRate}_handleOpenedIbanContainer(){this.ratepayIbanInput.required=!0}_handleClosedIbanContainer(){this.ratepayIbanInput.required=!1}}r={ratepayRateInputSelector:"#ratepayRate",ratepayRuntimeInputSelector:"#ratepayRuntime",calculateInstallmentBtnSelector:"#payone-ratepay-calculate-installment-btn",ratepayInstallmentPlanContainerSelector:"#payone-ratepay-installment-plan",ratepayIbanContainerSelector:"#ratepayIbanContainer",ratepayIbanInputSelector:"#ratepayIban",ratepayInstallmentTableSelector:"#ratepayInstallmentTable"},(i="options")in(a=d)?Object.defineProperty(a,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):a[i]=r}).call(this,n("UoTJ"))}},[["T08A","runtime","vendor-node","vendor-shared"]]]); \ No newline at end of file +(window.webpackJsonp=window.webpackJsonp||[]).push([["payone-payment"],{T08A:function(e,t,n){"use strict";n.r(t);var a,i,r,o=n("FGIj"),s=n("477Q");class l extends o.a{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 a=document.getElementById("savedpseudocardpan"),i=document.getElementById("confirmOrderForm");a&&a.addEventListener("change",this._handleChangeSavedCard.bind(this)),i&&i.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"),a=document.getElementById("card-logo");a.setAttribute("src",t),n.style.display="none",a.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.a(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={supportedCardtypes:["#","V","A","M","D","J","O","U","P"]},(i="options")in(a=l)?Object.defineProperty(a,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):a[i]=r;var d=n("2Jwc"),c=n("3xtq"),u=n("k8s9");class m extends o.a{init(){this.orderFormDisabled=!0,this._client=new u.a,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.a(t);t.disabled=!1,e.remove()}}_getModal(e){e.preventDefault(),c.a.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.a.remove()}if("active"===e.mandate.Status)return void this._submitForm();const t=new d.a(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.a.remove()}_getRequestData(){const e=document.getElementById("payoneCsrfTokenDebitManageMandate"),t=document.getElementById("iban");return{_csrf_token:e.value,iban:t.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 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.a{init(){this.orderFormDisabled=!0,this._client=new u.a,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,"payolutionBirthday"),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.a.create(),this._client.abort(),this._client.post(this._getValidateUrl(),e,(e=>this._handleValidateResponse(e)))}_handleValidateResponse(e){if(e=JSON.parse(e),c.a.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(){const e=document.getElementById("payoneCsrfTokenPayolutionInvoiceValidation"),t=document.getElementById("payolutionBirthday");return{_csrf_token:e.value,payolutionBirthday:t.value}}}class p extends o.a{init(){this.orderFormDisabled=!0,this._client=new u.a,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,"payolutionBirthday"),e.defaultPrevented)return;c.a.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.a.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,"payolutionBirthday"),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.a(t);t.disabled=!1,e.remove()}}_getRequestData(){const e=document.getElementById("payoneCsrfTokenPayolutionInstallmentCalculation"),t=document.getElementById("payolutionBirthday"),n=document.getElementById("payoneWorkOrder"),a=document.getElementById("payoneCartHash");return{_csrf_token:e.value,payolutionBirthday:t.value,workorder:n.value,carthash:a.value}}}var y=n("gHbT"),b=n("p4AR");function g(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class v extends o.a{init(){null===this.options.supportedNetworks&&(this.options.supportedNetworks=[]),this.client=new b.a,this.validateMerchantUrl=this.el.dataset.validateMerchantUrl,this.processPaymentUrl=this.el.dataset.processPaymentUrl,this.orderForm=y.a.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.client.abort(),this.client.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.a.querySelector(document,"#payone-apple-pay-error");e.style.display="block",e.scrollIntoView({block:"start"})}authorizePayment(e){let t=y.a.querySelector(this.orderForm,"input[name='orderId']").value;this.client.abort(),this.client.post(this.processPaymentUrl,JSON.stringify({token:e.payment.token,orderId:t}),(e=>{this.completePayment(e),this.orderForm.submit()}))}completePayment(e){let t="",n="",a="";try{let i=JSON.parse(e);n=i.status,t=i.txid,a=i.userid}catch(e){this.orderForm.submit()}this.updateFormData(n,t,a,e),"APPROVED"!==n&&"PENDING"!==n||this.session.completePayment({status:ApplePaySession.STATUS_SUCCESS,errors:[]}),this.orderForm.submit()}updateFormData(e,t,n,a){y.a.querySelector(this.orderForm,"input[name='status']").value=e,y.a.querySelector(this.orderForm,"input[name='txid']").value=t,y.a.querySelector(this.orderForm,"input[name='userid']").value=n,y.a.querySelector(this.orderForm,"input[name='response']").value=a}_handleApplePayButtonClick(){this.orderForm.reportValidity()&&(this.createSession(),this.performPayment())}_registerEventHandler(){this.el.addEventListener("click",this._handleApplePayButtonClick.bind(this))}}g(v,"options",{countryCode:"",currencyCode:"",supportedNetworks:[],merchantCapabilities:["supports3DS","supportsDebit","supportsCredit"],total:{label:"",type:"final",amount:"0.01"}}),g(v,"session",void 0),g(v,"client",void 0),g(v,"validateMerchantUrl",void 0),g(v,"processPaymentUrl",void 0),g(v,"orderForm",void 0);var I=n("i8qz");function _(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class E extends o.a{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._registerEventListeners()}_initKlarnaWidget(){Klarna.Payments.init({client_token:this.options.clientToken}),Klarna.Payments.load({container:this.options.selectorContainer,payment_method_category:this.options.paymentMethodIdentifier},(e=>{this.confirmFormSubmit.disabled=!1,ElementLoadingIndicatorUtil.remove(this.el)}))}_registerEventListeners(){this.orderForm&&("csrf"in window&&"twig"!==window.csrf.mode?this.orderForm.addEventListener("beforeSubmit",this._handleOrderSubmit.bind(this)):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 ButtonLoadingIndicator(this.confirmFormSubmit).remove():e.show_form||(window.location.href=window.location.href)}))}}_(E,"options",{clientToken:null,paymentMethodIdentifier:null,selectorContainer:null,selectorTokenInput:'input[name="payoneKlarnaAuthorizationToken"]',selectorFormId:"confirmOrderForm"}),_(E,"orderForm",null),_(E,"confirmFormSubmit",null);const f=window.PluginManager;f.register("PayonePaymentCreditCard",l,"[data-is-payone-credit-card]"),f.register("PayonePaymentDebitCard",m,"[data-is-payone-debit-card]"),f.register("PayonePaymentPayolutionInvoicing",h,"[data-is-payone-payolution-invoicing]"),f.register("PayonePaymentPayolutionInstallment",p,"[data-is-payone-payolution-installment]"),f.register("PayonePaymentApplePay",v,"[data-payone-payment-apple-pay-options]"),f.register("PayonePaymentRatepayInstallment",I.a,"[data-is-payone-ratepay-installment]"),f.register("PayonePaymentKlarna",E,"[data-payone-payment-klarna]")},i8qz:function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return d}));var a,i,r,o=n("FGIj"),s=n("gHbT"),l=n("k8s9");class d extends o.a{init(){this.csrfToken=document.getElementById("payoneCsrfTokenRatepayInstallmentCalculation"),this._client=new l.a,this.ratepayRateInput=s.a.querySelector(document,this.options.ratepayRateInputSelector),this.calculateInstallmentBtn=s.a.querySelector(document,this.options.calculateInstallmentBtnSelector),this.ratepayRuntimeInput=s.a.querySelector(document,this.options.ratepayRuntimeInputSelector),this.ratepayIbanContainer=s.a.querySelector(document,this.options.ratepayIbanContainerSelector),this.ratepayIbanInput=s.a.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)),e(this.options.ratepayIbanContainerSelector).on("shown.bs.collapse",this._handleOpenedIbanContainer.bind(this)),e(this.options.ratepayIbanContainerSelector).on("hidden.bs.collapse",this._handleClosedIbanContainer.bind(this))}_handleCalculateInstallmentButtonClick(){const e=this.ratepayRateInput.value;this._sendRequest("rate",e)}_handleInstallmentRuntimeChange(){const e=s.a.querySelector(document,this.options.ratepayRuntimeInputSelector).value;this._sendRequest("time",e)}_sendRequest(e,t){let n={_csrf_token:this.csrfToken.value};n.ratepayInstallmentType=e,n.ratepayInstallmentValue=t;const a=JSON.stringify(n);this._client.abort(),this._client.post("/payone/ratepay/installment/calculation",a,(e=>this._handleCalculationCallback(e)))}_handleCalculationCallback(e){this._replaceCalculationContent(e)}_replaceCalculationContent(e){s.a.querySelector(document,this.options.ratepayInstallmentPlanContainerSelector).innerHTML=e,this.ratepayInstallmentTable=s.a.querySelector(document,this.options.ratepayInstallmentTableSelector),this.ratepayRuntimeInput.value=this.ratepayInstallmentTable.dataset.ratepayNumberOfRates,this.ratepayRateInput.value=this.ratepayInstallmentTable.dataset.ratepayRate}_handleOpenedIbanContainer(){this.ratepayIbanInput.required=!0}_handleClosedIbanContainer(){this.ratepayIbanInput.required=!1}}r={ratepayRateInputSelector:"#ratepayRate",ratepayRuntimeInputSelector:"#ratepayRuntime",calculateInstallmentBtnSelector:"#payone-ratepay-calculate-installment-btn",ratepayInstallmentPlanContainerSelector:"#payone-ratepay-installment-plan",ratepayIbanContainerSelector:"#ratepayIbanContainer",ratepayIbanInputSelector:"#ratepayIban",ratepayInstallmentTableSelector:"#ratepayInstallmentTable"},(i="options")in(a=d)?Object.defineProperty(a,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):a[i]=r}).call(this,n("UoTJ"))}},[["T08A","runtime","vendor-node","vendor-shared"]]]); diff --git a/src/Resources/app/storefront/src/apple-pay/payone-payment.apple-pay.js b/src/Resources/app/storefront/src/apple-pay/payone-payment.apple-pay.js index ebcf4f345..15b5304c0 100644 --- a/src/Resources/app/storefront/src/apple-pay/payone-payment.apple-pay.js +++ b/src/Resources/app/storefront/src/apple-pay/payone-payment.apple-pay.js @@ -2,7 +2,7 @@ import Plugin from 'src/plugin-system/plugin.class'; import DomAccess from 'src/helper/dom-access.helper'; -import StoreApiClient from "src/service/store-api-client.service"; +import HttpClient from 'src/service/http-client.service'; export default class PayonePaymentApplePay extends Plugin { static options = { @@ -28,7 +28,7 @@ export default class PayonePaymentApplePay extends Plugin { this.options.supportedNetworks = []; } - this.client = new StoreApiClient(); + this._httpClient = new HttpClient(); this.validateMerchantUrl = this.el.dataset.validateMerchantUrl; this.processPaymentUrl = this.el.dataset.processPaymentUrl; this.orderForm = DomAccess.querySelector(document, '#confirmOrderForm'); @@ -56,8 +56,8 @@ export default class PayonePaymentApplePay extends Plugin { validateMerchant(event) { const validationUrl = event.validationURL; - this.client.abort(); - this.client.post(this.validateMerchantUrl, JSON.stringify({validationUrl: validationUrl}), (response) => { + this._httpClient.abort(); + this._httpClient.post(this.validateMerchantUrl, JSON.stringify({validationUrl: validationUrl}), (response) => { let merchantSession = null; try { @@ -85,8 +85,8 @@ export default class PayonePaymentApplePay extends Plugin { authorizePayment(event) { let orderId = DomAccess.querySelector(this.orderForm, 'input[name=\'orderId\']').value; - this.client.abort(); - this.client.post(this.processPaymentUrl, JSON.stringify({token: event.payment.token, orderId: orderId}), (response) => { + this._httpClient.abort(); + this._httpClient.post(this.processPaymentUrl, JSON.stringify({token: event.payment.token, orderId: orderId}), (response) => { this.completePayment(response); this.orderForm.submit(); }) diff --git a/src/Resources/app/storefront/src/debit-card/payone-payment.debit-card.js b/src/Resources/app/storefront/src/debit-card/payone-payment.debit-card.js index 39b6467e3..784ddc2a3 100644 --- a/src/Resources/app/storefront/src/debit-card/payone-payment.debit-card.js +++ b/src/Resources/app/storefront/src/debit-card/payone-payment.debit-card.js @@ -103,11 +103,9 @@ export default class PayonePaymentDebitCard extends Plugin { } _getRequestData() { - const csrfToken = document.getElementById('payoneCsrfTokenDebitManageMandate'); const iban = document.getElementById('iban'); return { - '_csrf_token': csrfToken.value, 'iban': iban.value, }; } diff --git a/src/Resources/app/storefront/src/payolution-installment/payone-payment.payolution-installment.js b/src/Resources/app/storefront/src/payolution-installment/payone-payment.payolution-installment.js index f959a04d1..c2efed0ef 100644 --- a/src/Resources/app/storefront/src/payolution-installment/payone-payment.payolution-installment.js +++ b/src/Resources/app/storefront/src/payolution-installment/payone-payment.payolution-installment.js @@ -225,13 +225,11 @@ export default class PayonePaymentPayolutionInstallment extends Plugin { } _getRequestData() { - const csrfToken = document.getElementById('payoneCsrfTokenPayolutionInstallmentCalculation'); const birthday = document.getElementById('payolutionBirthday'); const workorder = document.getElementById('payoneWorkOrder'); const carthash = document.getElementById('payoneCartHash'); return { - '_csrf_token': csrfToken.value, 'payolutionBirthday': birthday.value, 'workorder': workorder.value, 'carthash': carthash.value diff --git a/src/Resources/app/storefront/src/payolution-invoicing/payone-payment.payolution-invoicing.js b/src/Resources/app/storefront/src/payolution-invoicing/payone-payment.payolution-invoicing.js index d045ce644..851c166e7 100644 --- a/src/Resources/app/storefront/src/payolution-invoicing/payone-payment.payolution-invoicing.js +++ b/src/Resources/app/storefront/src/payolution-invoicing/payone-payment.payolution-invoicing.js @@ -136,11 +136,9 @@ export default class PayonePaymentPayolutionInvoicing extends Plugin { } _getRequestData() { - const csrfToken = document.getElementById('payoneCsrfTokenPayolutionInvoiceValidation'); const birthday = document.getElementById('payolutionBirthday'); return { - '_csrf_token': csrfToken.value, 'payolutionBirthday': birthday.value }; } diff --git a/src/Resources/app/storefront/src/ratepay-installment/payone-payment.ratepay-installment.js b/src/Resources/app/storefront/src/ratepay-installment/payone-payment.ratepay-installment.js index 7e78b6f36..07ca16759 100644 --- a/src/Resources/app/storefront/src/ratepay-installment/payone-payment.ratepay-installment.js +++ b/src/Resources/app/storefront/src/ratepay-installment/payone-payment.ratepay-installment.js @@ -15,8 +15,6 @@ export default class PayonePaymentRatepayInstallment extends Plugin { } init() { - this.csrfToken = document.getElementById('payoneCsrfTokenRatepayInstallmentCalculation'); - this._client = new HttpClient(); this.ratepayRateInput = DomAccess.querySelector(document, this.options.ratepayRateInputSelector); @@ -57,11 +55,9 @@ export default class PayonePaymentRatepayInstallment extends Plugin { _sendRequest(type, value) { let requestData = { - '_csrf_token': this.csrfToken.value - } - - requestData.ratepayInstallmentType = type; - requestData.ratepayInstallmentValue = value; + ratepayInstallmentType: type, + ratepayInstallmentValue: value + }; const data = JSON.stringify(requestData); diff --git a/src/Resources/public/administration/js/payone-payment.js b/src/Resources/public/administration/js/payone-payment.js index f37961259..256973f56 100644 --- a/src/Resources/public/administration/js/payone-payment.js +++ b/src/Resources/public/administration/js/payone-payment.js @@ -1 +1 @@ -!function(e){var t={};function n(i){if(t[i])return t[i].exports;var a=t[i]={i:i,l:!1,exports:{}};return e[i].call(a.exports,a,a.exports,n),a.l=!0,a.exports}n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(i,a,function(t){return e[t]}.bind(null,a));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p=(window.__sw__.assetPath + '/bundles/payonepayment/'),n(n.s="UwmX")}({"0sf7":function(e,t,n){var i=n("mi8M");i.__esModule&&(i=i.default),"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("ydqr").default)("e88d0166",i,!0,{})},"2a1E":function(e,t){function n(e){return(n="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 i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var i=0;i2&&void 0!==arguments[2]?arguments[2]:"payone";return i(this,l),c.call(this,e,t,n)}return t=l,(n=[{key:"requeueNotificationForward",value:function(e){var t="_action/".concat(this.getApiBasePath(),"/requeue-forward");return this.httpClient.post(t,e,{headers:this.getBasicHeaders()}).then((function(e){return u.handleResponse(e)}))}},{key:"capturePayment",value:function(e){var t="_action/".concat(this.getApiBasePath(),"/capture-payment");return this.httpClient.post(t,e,{headers:this.getBasicHeaders()}).then((function(e){return u.handleResponse(e)}))}},{key:"refundPayment",value:function(e){var t="_action/".concat(this.getApiBasePath(),"/refund-payment");return this.httpClient.post(t,e,{headers:this.getBasicHeaders()}).then((function(e){return u.handleResponse(e)}))}}])&&a(t.prototype,n),s&&a(t,s),Object.defineProperty(t,"prototype",{writable:!1}),l}(u);l.addServiceProvider("PayonePaymentService",(function(e){var t=l.getContainer("init");return new d(t.httpClient,e.loginService)}))},"2tSu":function(e,t,n){var i=n("bWZA");i.__esModule&&(i=i.default),"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("ydqr").default)("47b1d2d6",i,!0,{})},"6PZk":function(e,t){try{Shopware.Service("privileges").addPrivilegeMappingEntry({category:"additional_permissions",parent:null,key:"Payone",roles:{payone_order_management:{privileges:["order_transaction:update","order_line_item:update","state_machine_history:create",Shopware.Service("privileges").getPrivileges("order.viewer")],dependencies:[]}}})}catch(e){}},CBo4:function(e,t,n){},CY1O:function(e){e.exports=JSON.parse('{"payone-payment":{"title":"PAYONE","general":{"mainMenuItemGeneral":"PAYONE","descriptionTextModule":"Einstellungen für PAYONE","headlines":{"ratepayProfiles":"Profile","ratepayProfileConfigurations":"Profil-Konfigurationen"},"label":{"shopId":"Shop-ID","currency":"Währung","error":"Status","invoiceCountry":"Rechnungsland","shippingCountry":"Lieferland","minBasket":"Min. Warenkorb","maxBasket":"Max. Warenkorb","reloadConfigBtn":"Profil-Konfiguration neu laden","reloadConfigInfo":"(Änderungen an der Plugin-Konfiguration werden dabei zuerst gespeichert)"},"actions":{"addShop":"Shop-ID hinzufügen"},"errors":{"existingShopId":"Die eingegebene ShopId existiert bereits.","emptyInputs":"Bitte füllen Sie alle Eingabefelder aus."}},"capture":{"buttonTitle":"Capture","successTitle":"PAYONE","successMessage":"Capture erfolgreich durchgeführt.","errorTitle":"PAYONE","errorMessage":"Capture konnte nicht durchgeführt werden.","tooltips":{"impossible":"Einzug unmöglich"}},"refund":{"buttonTitle":"Refund","successTitle":"PAYONE","successMessage":"Refund erfolgreich durchgeführt.","errorTitle":"PAYONE","errorMessage":"Refund konnte nicht durchgeführt werden.","tooltips":{"impossible":"Erstattung unmöglich"}},"modal":{"capture":{"title":"Einzug","submit":"Einziehen","fullSubmit":"Alles Einziehen","amount":"Einzugswert","captured":"Eingezogener Wert"},"refund":{"title":"Erstattung","submit":"Erstatten","fullSubmit":"Alles Erstatten","amount":"Erstattungswert","refunded":"Erstatteter Wert"},"close":"Schließen","orderAmount":"Bestellungswert","remainingAmount":"Ausstehender Wert","shippingCosts":"Versandkosten","labelComment":"Label comment","descriptionHelpText":"Description help text","columns":{"reference":"Referenz","product":"Produkt","quantity":"Anzahl","price":"Preis"}},"settingsForm":{"save":"Speichern","test":"API-Zugangsdaten testen","titleSuccess":"Erfolg","titleError":"Fehler","labelShowSpecificStatusMapping":"Statusmappingkonfiguration einblenden","helpTextShowSpecificStatusMapping":"Sie können für jede Zahlungsart ein spezifisches Statusmapping konfigurieren. Existiert eine solche Konfiguration nicht, wird auf die allgemeine Konfiguration zurückgegriffen.","messageSaveError":{"ratepayProfilesUpdateFailed":"Mindestens ein Ratepay Profil konnte nicht erfolgreich gespeichert werden, bitte prüfen Sie Ihre Konfiguration."},"messageTestSuccess":"Die API-Zugangsdaten wurden erfolgreich validiert.","messageTestNoTestedPayments":"Bei der Prüfung wurden keine Zahlarten getestet, weil keine der PAYONE Zahlarten aktiviert ist. Bitte aktivieren Sie mindestens eine PAYONE Zahlart unter Einstellungen --\x3e Shop --\x3e Zahlungsarten.","messageTestError":{"general":"Die API-Zugangsdaten konnten nicht validiert werden.","creditCard":"Die API-Zugangsdaten für PAYONE Kreditkarte sind nicht korrekt.","prepayment":"Die API-Zugangsdaten für PAYONE Vorkasse sind nicht korrekt.","debit":"Die API-Zugangsdaten für PAYONE Lastschrift sind nicht korrekt.","paypalExpress":"Die API-Zugangsdaten für PAYONE PayPal Express sind nicht korrekt.","paypal":"Die API-Zugangsdaten für PAYONE PayPal sind nicht korrekt.","payolutionInstallment":"Die API-Zugangsdaten für PAYONE Unzer Ratenkauf sind nicht korrekt.","payolutionInvoicing":"Die API-Zugangsdaten für PAYONE Unzer Rechnungskauf sind nicht korrekt.","payolutionDebit":"Die API-Zugangsdaten für PAYONE Unzer Lastschrift sind nicht korrekt.","sofort":"Die API-Zugangsdaten für PAYONE Sofort Überweisung sind nicht korrekt.","eps":"Die API-Zugangsdaten für PAYONE eps Überweisung sind nicht korrekt.","iDeal":"Die API-Zugangsdaten für PAYONE iDEAL sind nicht korrekt.","secureInvoice":"Die API-Zugangsdaten für PAYONE Gesicherter Rechnungskauf sind nicht korrekt.","openInvoice":"Die API-Zugangsdaten für PAYONE Rechnungskauf sind nicht korrekt.","paydirekt":"Die API-Zugangsdaten für PAYONE paydirekt sind nicht korrekt.","trustly":"Die API-Zugangsdaten für PAYONE Trustly sind nicht korrekt.","applePay":"Die API-Zugangsdaten für PAYONE Apple Pay sind nicht korrekt.","bancontact":"Die API-Zugangsdaten für PAYONE Bancontact sind nicht korrekt.","ratepayDebit":"Die API-Zugangsdaten für PAYONE Ratepay Lastschrift sind nicht korrekt.","ratepayInstallment":"Die API-Zugangsdaten für PAYONE Ratepay Ratenzahlung sind nicht korrekt.","ratepayInvoicing":"Die API-Zugangsdaten für PAYONE Ratepay Rechnungskauf sind nicht korrekt.","klarnaInvoice":"Die API-Zugangsdaten für PAYONE Klarna Rechnung sind nicht korrekt.","klarnaDirectDebit":"Die API-Zugangsdaten für PAYONE Klarna Sofort bezahlen sind nicht korrekt.","klarnaInstallment":"Die API-Zugangsdaten für PAYONE Klarna Ratenkauf sind nicht korrekt.","przelewy24":"Die API-Zugangsdaten für PAYONE Przelewy24 sind nicht korrekt.","weChatPay":"Die API-Zugangsdaten für PAYONE WeChat Pay sind nicht korrekt.","postfinanceCard":"Die API-Zugangsdaten für PAYONE Postfinance (Card) sind nicht korrekt.","postfinanceWallet":"Die API-Zugangsdaten für PAYONE Postfinance (Wallet) sind nicht korrekt.","alipay":"Die API-Zugangsdaten für PAYONE Alipay sind nicht korrekt.","securedInvoice":"Die API-Zugangsdaten für PAYONE Gesicherter Rechnungskauf sind nicht korrekt.","securedInstallment":"Die API-Zugangsdaten für PAYONE Gesicherter Ratenkauf sind nicht korrekt.","securedDirectDebit":"Die API-Zugangsdaten für PAYONE Gesicherte Lastschrift sind nicht korrekt."}},"supportModal":{"menuButton":"Support","title":"Wie können wir Ihnen helfen?","documentation":{"description":"Lesen Sie unsere Online-Dokumentation","button":"Dokumentation"},"support":{"description":"Kontaktieren Sie unseren Support","button":"Technischer Support"},"repository":{"description":"Melden Sie Fehler und Verbesserungen","button":"GitHub"},"testdata":{"description":"Erstellen Sie hier Ihre persönlichen Testdaten","button":"Testdaten"}},"applePay":{"cert":{"notification":"Für die Nutzung von ApplePay ist ein Zertifikat/Key-Paar zur Authentifizierung des Merchants erforderlich. Die Anlage eines solchen Zertifikats wird hier beschrieben:
\\n https://docs.payone.com/display/public/PLATFORM/Special+Remarks+-+Apple+Pay#SpecialRemarks-ApplePay-Onboarding

\\n\\n Erstellen Sie im Anschluss unter Verwendung des folgenden Befehls eine PEM-Datei des Zertifikates:
\\n
openssl x509 -inform der -in merchant_id.cer -out merchant_id.pem

\\n Hinterlegen Sie das Zertifikat (merchant_id.pem) und den Key (merchant_id.key) in folgendem Verzeichnis:
\\n
%shopwareRoot%/config/apple-pay-cert
"}},"transitionActionNames":{"cancel":"Stornieren","complete":"Abschließen","pay":"Bezahlen","pay_partially":"Teilweise bezahlen","process":"Durchführen","refund":"Rückerstatten","refund_partially":"Teilweise rückerstatten","remind":"Erinnern","reopen":"Wieder öffnen","retour":"Retoure","retour_partially":"Teilweise retounieren","ship":"Versenden","ship_partially":"Teilweise versenden"},"messageNotBlank":"Dieser Wert darf nicht leer sein.","txid":"TXID","sequenceNumber":{"label":"Sequenznummer","empty":"keine"},"transactionState":"Status","transactionCancelled":"Transaktion in Shopware abgebrochen","error":{"transaction":{"notFound":"Es wurde keine passende Transaktion gefundend","orderNotFound":"Es wurde keine passende Bestellung gefundend"}}},"sw-privileges":{"additional_permissions":{"Payone":{"label":"PAYONE","payone_order_management":"PAYONE Transaktionsmanagement"}}}}')},"F2L/":function(e,t,n){var i=n("I+7f");i.__esModule&&(i=i.default),"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("ydqr").default)("30402ea6",i,!0,{})},GmXf:function(e){e.exports=JSON.parse('{"payonePayment":{"notificationTarget":{"module":{"title":"Payone notification forward","buttonTitle":"Notifications"},"list":{"title":"Notification forward","empty":"No entries","buttonCreate":"Add new notification target"},"detail":{"headline":"Notification forward","placeholder":{"url":"Url","username":"Username","password":"Password"},"label":{"url":"Url","isBasicAuth":"Basic Auth","txactions":"txactions","buttonSave":"Save","buttonCancel":"Cancel","username":"Username","password":"Password"}},"columns":{"url":"Url","isBasicAuth":"Basic Auth","txactions":"txactions"},"actions":{"requeue":"Requeue"},"messages":{"success":"The notification forward has been successfully queued."}}}}')},GqT2:function(e){e.exports=JSON.parse('{"payone-payment":{"title":"PAYONE","general":{"mainMenuItemGeneral":"PAYONE","descriptionTextModule":"Settings for PAYONE","headlines":{"ratepayProfiles":"Profile","ratepayProfileConfigurations":"Profil-Konfigurationen"},"label":{"shopId":"Shop-ID","currency":"Currency","error":"Status","invoiceCountry":"Invoice Country","shippingCountry":"Shipping Country","minBasket":"Min. Basket","maxBasket":"Max. Basket","reloadConfigBtn":"Reload Profile Configuration","reloadConfigInfo":"(Plugin Configuration Changes will be saved first)"},"actions":{"addShop":"Add Shop-ID"},"errors":{"existingShopId":"The entered shop-id already exists.","emptyInputs":"Please fill all input fields."}},"capture":{"buttonTitle":"Capture","successTitle":"PAYONE","successMessage":"Capture processed successfully.","errorTitle":"PAYONE","errorMessage":"Capture could not be processed.","tooltips":{"impossible":"Capture impossible"}},"refund":{"buttonTitle":"Refund","successTitle":"PAYONE","successMessage":"Refund processed successfully.","errorTitle":"PAYONE","errorMessage":"Refund could not be processed.","tooltips":{"impossible":"Refund impossible"}},"modal":{"capture":{"title":"Capture","submit":"Capture","fullSubmit":"Full capture","amount":"Capture amount","captured":"Captured amount"},"refund":{"title":"Refund","submit":"Refund","fullSubmit":"Full Refund","amount":"Refund amount","refunded":"Refunded amount"},"orderAmount":"Order amount","remainingAmount":"Remaining amount","shippingCosts":"Shipping costs","descriptionHelpText":"Description help text","close":"Close","labelComment":"Label comment","columns":{"reference":"Reference","product":"Product","quantity":"Quantity","price":"Price"}},"settingsForm":{"save":"Save","test":"Test API Credentials","titleSuccess":"Success","titleError":"Error","labelShowSpecificStatusMapping":"Display state mapping configuration","helpTextShowSpecificStatusMapping":"If not configured the general status mapping config will be applied.","messageSaveError":{"ratepayProfilesUpdateFailed":"At least one Ratepay profile could not be saved successfully, please check your configuration."},"messageTestSuccess":"The API credentials were verified successfully.","messageTestNoTestedPayments":"No payment methods were tested during the check because none of the PAYONE payment methods are activated. Please activate at least one PAYONE payment method under Settings --\x3e Shop --\x3e Payment.","messageTestError":{"general":"The API credentials could not be verified successfully.","creditCard":"The API credentials for PAYONE Credit Card are not valid.","prepayment":"The API credentials for PAYONE Prepayment are not valid.","debit":"The API credentials for PAYONE Direct Debit are not valid.","paypalExpress":"The API credentials for PAYONE PayPal Express are not valid.","paypal":"The API credentials for PAYONE PayPal are not valid.","payolutionInstallment":"The API credentials for PAYONE Unzer Ratenkauf are not valid.","payolutionInvoicing":"The API credentials for PAYONE Unzer Rechnungskauf are not valid.","payolutionDebit":"The API credentials for PAYONE Unzer Lastschrift are not valid.","sofort":"The API credentials for PAYONE Sofort are not valid.","eps":"The API credentials for PAYONE eps are not valid.","iDeal":"The API credentials for PAYONE iDEAL are not valid.","secureInvoice":"The API credentials for PAYONE Secure Invoice are not valid.","openInvoice":"The API credentials for PAYONE Invoice are not valid.","paydirekt":"The API credentials for PAYONE paydirekt are not valid.","trustly":"The API credentials for PAYONE Trustly are not valid.","applePay":"The API credentials for PAYONE Apple Pay are not valid.","bancontact":"The API credentials for PAYONE Bancontact payment are not valid.","ratepayDebit":"The API credentials for PAYONE Ratepay Direct Debit payment are not valid.","ratepayInstallment":"The API credentials for PAYONE Ratepay Installments payment are not valid.","ratepayInvoicing":"The API credentials for PAYONE Ratepay Open Invoice payment are not valid.","klarnaInvoice":"The API credentials for PAYONE Klarna Rechnung are not valid.","klarnaDirectDebit":"The API credentials for PAYONE Klarna Sofort bezahlen are not valid.","klarnaInstallment":"The API credentials for PAYONE Klarna Ratenkauf are not valid.","przelewy24":"The API credentials for PAYONE Przelewy24 are not valid.","weChatPay":"The API credentials for PAYONE WeChat Pay are not valid.","postfinanceCard":"The API credentials for PAYONE Postfinance (Card) are not valid.","postfinanceWallet":"The API credentials for PAYONE Postfinance (Wallet) are not valid.","alipay":"The API credentials for PAYONE Alipay are not valid.","securedInvoice":"The API credentials for PAYONE Secured Invoice are not valid.","securedInstallment":"The API credentials for PAYONE Secured Installment are not valid.","securedDirectDebit":"The API credentials for PAYONE Secured Direct Debit are not valid."}},"supportModal":{"menuButton":"Support","title":"How Can We Help You?","documentation":{"description":"Read our online manual","button":"Online Manual"},"support":{"description":"Contact our technical support","button":"Tech Support"},"repository":{"description":"Report errors on GitHub","button":"GitHub"},"testdata":{"description":"Create your personal test data here","button":"Test Data"}},"applePay":{"cert":{"notification":"The ApplePay merchant authentication requires a certificate/key-pair. Further information:
\\n https://docs.payone.com/display/public/PLATFORM/Special+Remarks+-+Apple+Pay#SpecialRemarks-ApplePay-Onboarding

\\n\\n Create a pem-File afterwards by using the following command:
\\n
openssl x509 -inform der -in merchant_id.cer -out merchant_id.pem

\\n Copy certificate (merchant_id.pem) and key (merchant_id.key) file into the following folder:
\\n
%shopwareRoot%/config/apple-pay-cert
"}},"transitionActionNames":{"cancel":"Cancel","complete":"Complete","pay":"Pay","pay_partially":"Pay partially","process":"Process","refund":"Refund","refund_partially":"Refund partially","remind":"Remind","reopen":"Reopen","retour":"Retour","retour_partially":"Retour partially","ship":"Ship","ship_partially":"Ship partially"},"messageNotBlank":"This field must not be empty.","txid":"TXID","sequenceNumber":{"label":"Sequence Number","empty":"none"},"transactionState":"State","transactionCancelled":"Transaction cancelled in Shopware","error":{"transaction":{"notFound":"No matching transaction could be found","orderNotFound":"No matching order could be found"}}},"sw-privileges":{"additional_permissions":{"Payone":{"label":"PAYONE","payone_order_management":"PAYONE transaction management"}}}}')},HOYe:function(e,t,n){var i=n("vRey");i.__esModule&&(i=i.default),"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("ydqr").default)("0458005f",i,!0,{})},"I+7f":function(e,t,n){},Kdn4:function(e,t,n){var i=n("CBo4");i.__esModule&&(i=i.default),"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("ydqr").default)("5cba0700",i,!0,{})},PaTh:function(e,t,n){var i=n("euFz");i.__esModule&&(i=i.default),"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("ydqr").default)("7669284a",i,!0,{})},UwmX:function(e,t,n){"use strict";n.r(t);n("2tSu");Shopware.Component.register("payone-ratepay-profile-configurations",{template:"{% block payone_ratepay_profile_configurations %}\n
\n

{{ $tc('payone-payment.general.headlines.ratepayProfileConfigurations') }}

\n\n \n
\n{% endblock %}\n",inject:["PayonePaymentSettingsService"],props:{value:{type:Object,required:!1,default:function(){return{}}},name:{type:String,required:!0}},data:function(){return{isLoading:!1,configuration:this.value}},created:function(){this.createdComponent()},destroyed:function(){this.destroyedComponent()},computed:{profileConfigurations:function(){var e=this.name,t=[];for(var n in this.configuration){var i="",a="";switch(e){case"PayonePayment.settings.ratepayDebitProfileConfigurations":i=this.configuration[n]["tx-limit-elv-min"],a=this.configuration[n]["tx-limit-elv-max"];break;case"PayonePayment.settings.ratepayInstallmentProfileConfigurations":i=this.configuration[n]["tx-limit-installment-min"],a=this.configuration[n]["tx-limit-installment-max"];break;case"PayonePayment.settings.ratepayInvoicingProfileConfigurations":i=this.configuration[n]["tx-limit-invoice-min"],a=this.configuration[n]["tx-limit-invoice-max"];break;default:return}var o={shopId:n,shopCurrency:this.configuration[n].currency,invoiceCountry:this.configuration[n]["country-code-billing"],shippingCountry:this.configuration[n]["country-code-delivery"],minBasket:i,maxBasket:a};t.push(o)}return t}},methods:{createdComponent:function(){this.$root.$on("payone-ratepay-profiles-update-result",this.onProfilesUpdateResult),console.log(this.configuration)},destroyedComponent:function(){this.$root.$off("payone-ratepay-profiles-update-result")},onProfilesUpdateResult:function(e){e.updates[this.name]&&(this.configuration=e.updates[this.name])}}});n("0sf7");function i(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return a(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,s=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){c=!0,r=e},f:function(){try{s||null==n.return||n.return()}finally{if(c)throw r}}}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n\n {% block payone_ratepay_shop_ids %}\n

{{ $tc(\'payone-payment.general.headlines.ratepayProfiles\') }}

\n \n\n {% block payone_ratepay_shop_ids_actions %}\n \n\n {% block payone_ratepay_shop_ids_create_actions %}\n
\n \n {{ $tc(\'payone-payment.general.actions.addShop\') }}\n \n
\n {% endblock %}\n
\n {% endblock %}\n\n {% block payone_ratepay_shop_ids_grid %}\n \n {% block payone_ratepay_shop_ids_grid_columns %}\n {% block payone_ratepay_shop_ids_grid_column_status %}\n \n {% endblock %}\n\n {% block payone_ratepay_shop_ids_bulk_actions %}\n \n {% endblock %}\n {% endblock %}\n \n {% endblock %}\n\n {% block payone_ratepay_shop_ids_error %}\n \n {{ $tc(\'payone-payment.general.errors.existingShopId\') }}\n \n\n \n {{ $tc(\'payone-payment.general.errors.emptyInputs\') }}\n \n {% endblock %}\n
\n {% endblock %}\n
\n{% endblock %}\n',props:{value:{type:Array,required:!1,default:function(){return[]}},name:{type:String,required:!0}},data:function(){return{selectedItems:{},newItem:null,showDuplicateAlert:!1,showEmptyAlert:!1,profiles:this.value}},computed:{getLineItemColumns:function(){return[{property:"shopId",dataIndex:"shopId",label:this.$tc("payone-payment.general.label.shopId"),allowResize:!1,inlineEdit:"string",width:"200px",primary:!0},{property:"currency",dataIndex:"currency",label:this.$tc("payone-payment.general.label.currency"),allowResize:!1,inlineEdit:"string",width:"200px",primary:!0},{property:"error",label:this.$tc("payone-payment.general.label.error"),allowResize:!1,width:"100px",primary:!0}]}},watch:{profiles:function(e){this.$emit("input",e),this.$emit("change",e)}},created:function(){this.createdComponent()},destroyed:function(){this.destroyedComponent()},methods:{createdComponent:function(){this.$root.$on("payone-ratepay-profiles-update-result",this.onProfilesUpdateResult)},destroyedComponent:function(){this.$root.$off("payone-ratepay-profiles-update-result")},onProfilesUpdateResult:function(e){if(e.updates[this.name]&&(this.profiles=e.updates[this.name]),e.errors[this.name]){var t,n=i(e.errors[this.name]);try{for(n.s();!(t=n.n()).done;){var a=t.value;this.profiles.push(a)}}catch(e){n.e(e)}finally{n.f()}}},onInlineEditCancel:function(e){""===e.shopId&&""===e.currency&&this.profiles.forEach((function(t,n,i){t.id===e.id&&i.splice(n,1)})),this.$emit("item-cancel")},onInlineEditSave:function(e){var t=this;if(""!==e.shopId&&""!==e.currency){this.showEmptyAlert=!1;var n=!1;this.profiles.forEach((function(t){t.id!==e.id&&t.shopId===e.shopId&&(n=!0)})),n?(this.showDuplicateAlert=!0,this.$nextTick((function(){t.$refs.shopIdsDataGrid.currentInlineEditId=e.id,t.$refs.shopIdsDataGrid.enableInlineEdit()}))):this.showDuplicateAlert=!1}else this.showEmptyAlert=!0,this.$nextTick((function(){t.$refs.shopIdsDataGrid.currentInlineEditId=e.id,t.$refs.shopIdsDataGrid.enableInlineEdit()}));this.$emit("update-list",this.profiles)},createNewLineItem:function(){(0===this.profiles.length||""!==this.profiles[this.profiles.length-1].shopId)&&this.createLine()},createLine:function(){var e=this,t=s.createId();this.profiles.push({id:t,shopId:"",currency:""}),this.$nextTick((function(){e.$refs.shopIdsDataGrid.currentInlineEditId=t,e.$refs.shopIdsDataGrid.enableInlineEdit()}))},onDeleteSelectedItem:function(e){this.profiles=this.profiles.filter((function(t){return t.shopId!==e.shopId})),this.$emit("deleted",this.profiles)}}});n("fWC6");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 l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function u(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==c(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!==c(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===c(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var d=Shopware,p=d.Component,f=d.Mixin;d.Context;p.register("payone-capture-button",{template:'{% block payone_payment_payment_details %}\n
\n \n \n {{ $tc(\'payone-payment.capture.buttonTitle\') }}\n \n \n\n \n \n \n\n
\n \n \n \n \n \n \n
\n\n \n
\n
\n{% endblock %}\n',mixins:[f.getByName("notification")],inject:["PayonePaymentService","repositoryFactory"],props:{order:{type:Object,required:!0},transaction:{type:Object,required:!0}},computed:{decimalPrecision:function(){return this.order&&this.order.currency?this.order.currency.decimalPrecision?this.order.currency.decimalPrecision:this.order.currency.itemRounding?this.order.currency.itemRounding.decimals:void 0:2},totalTransactionAmount:function(){return Math.round(this.transaction.amount.totalPrice*Math.pow(10,this.decimalPrecision),0)},capturedAmount:function(){return this.transaction.extensions&&this.transaction.extensions.payonePaymentOrderTransactionData&&this.transaction.extensions.payonePaymentOrderTransactionData.capturedAmount?this.transaction.extensions.payonePaymentOrderTransactionData.capturedAmount:0},remainingAmount:function(){return this.totalTransactionAmount-this.capturedAmount},maxCaptureAmount:function(){return this.remainingAmount/Math.pow(10,this.decimalPrecision)},buttonEnabled:function(){return!(!this.transaction.extensions||!this.transaction.extensions.payonePaymentOrderTransactionData)&&(this.remainingAmount>0&&this.capturedAmount>0||this.transaction.extensions.payonePaymentOrderTransactionData.allowCapture)},isItemSelected:function(){var e=!1;return this.selection.forEach((function(t){t.selected&&(e=!0)})),e},hasRemainingShippingCosts:function(){var e=this;if(this.order.shippingCosts.totalPrice<=0)return!1;var t=this.order.shippingCosts.totalPrice*Math.pow(10,this.decimalPrecision),n=0;return this.order.lineItems.forEach((function(t){t.customFields&&t.customFields.payone_captured_quantity&&0=t)}},data:function(){return{isLoading:!1,hasError:!1,showCaptureModal:!1,isCaptureSuccessful:!1,selection:[],captureAmount:0,includeShippingCosts:!1}},methods:{calculateCaptureAmount:function(){var e=0;this.selection.forEach((function(t){t.selected&&(e+=t.unit_price*t.quantity)})),e>this.remainingAmount&&(e=this.remainingAmount),this.captureAmount=e},openCaptureModal:function(){this.showCaptureModal=!0,this.isCaptureSuccessful=!1,this.selection=[]},closeCaptureModal:function(){this.showCaptureModal=!1},onCaptureFinished:function(){this.isCaptureSuccessful=!1},captureOrder:function(){var e=this,t={orderTransactionId:this.transaction.id,payone_order_id:this.transaction.extensions.payonePaymentOrderTransactionData.transactionId,salesChannel:this.order.salesChannel,amount:this.captureAmount,orderLines:[],complete:this.captureAmount===this.remainingAmount,includeShippingCosts:!1};this.isLoading=!0,this.selection.forEach((function(n){e.order.lineItems.forEach((function(e){if(e.id===n.id&&n.selected&&00&&this.selection.push({id:"shipping",quantity:1,unit_price:this.order.shippingCosts.totalPrice,selected:!1})}}});n("Kdn4");function m(e){return(m="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 y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function h(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==m(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!==m(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===m(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var g=Shopware,b=g.Component,v=g.Mixin;b.register("payone-refund-button",{template:'{% block payone_payment_payment_details %}\n
\n \n \n {{ $tc(\'payone-payment.refund.buttonTitle\') }}\n \n \n\n \n \n \n\n
\n \n \n \n \n \n \n
\n\n \n
\n
\n{% endblock %}\n',mixins:[v.getByName("notification")],inject:["PayonePaymentService"],props:{order:{type:Object,required:!0},transaction:{type:Object,required:!0}},data:function(){return{isLoading:!1,hasError:!1,showRefundModal:!1,isRefundSuccessful:!1,selection:[],refundAmount:0,includeShippingCosts:!1}},computed:{decimalPrecision:function(){return this.order&&this.order.currency?this.order.currency.decimalPrecision?this.order.currency.decimalPrecision:this.order.currency.itemRounding?this.order.currency.itemRounding.decimals:void 0:2},remainingAmount:function(){return this.transaction.extensions&&this.transaction.extensions.payonePaymentOrderTransactionData&&this.transaction.extensions.payonePaymentOrderTransactionData.capturedAmount?this.transaction.extensions.payonePaymentOrderTransactionData.capturedAmount-this.refundedAmount:0},refundedAmount:function(){return this.transaction.extensions&&this.transaction.extensions.payonePaymentOrderTransactionData&&!this.transaction.extensions.payonePaymentOrderTransactionData.refundedAmount?this.transaction.extensions.payonePaymentOrderTransactionData.refundedAmount:0},maxRefundAmount:function(){return this.remainingAmount/Math.pow(10,this.decimalPrecision)},buttonEnabled:function(){return!(!this.transaction.extensions||!this.transaction.extensions.payonePaymentOrderTransactionData)&&(this.remainingAmount>0&&this.refundedAmount>0||this.transaction.extensions.payonePaymentOrderTransactionData.allowRefund)},hasRemainingRefundableShippingCosts:function(){var e=this;if(this.order.shippingCosts.totalPrice<=0)return!1;var t=this.order.shippingCosts.totalPrice*Math.pow(10,this.decimalPrecision),n=0;return this.order.lineItems.forEach((function(t){t.customFields&&t.customFields.payone_refunded_quantity&&0=t)}},methods:{calculateRefundAmount:function(){var e=0;this.selection.forEach((function(t){t.selected&&(e+=t.unit_price*t.quantity)})),Math.round(e*Math.pow(10,this.decimalPrecision)>this.remainingAmount)&&(e=this.remainingAmount/Math.pow(10,this.decimalPrecision)),this.refundAmount=e},openRefundModal:function(){this.showRefundModal=!0,this.isRefundSuccessful=!1,this.selection=[]},closeRefundModal:function(){this.showRefundModal=!1},onRefundFinished:function(){this.isRefundSuccessful=!1},refundOrder:function(){var e=this,t={orderTransactionId:this.transaction.id,payone_order_id:this.transaction.extensions.payonePaymentOrderTransactionData.transactionId,salesChannel:this.order.salesChannel,amount:this.refundAmount,orderLines:[],complete:this.refundAmount===this.maxRefundAmount,includeShippingCosts:!1};this.isLoading=!0,this.selection.forEach((function(n){e.order.lineItems.forEach((function(i){if(i.id===n.id&&n.selected&&00&&this.selection.push({id:"shipping",quantity:1,unit_price:this.order.shippingCosts.totalPrice,selected:!1})}}});n("HOYe");Shopware.Component.register("payone-order-items",{template:'{% block payone_payment_details %}\n
\n \n\n \n\n \n\n \n \n
\n{% endblock %}\n',props:{order:{type:Object,required:!0},mode:{type:String,required:!1}},computed:{orderItems:function(){var e=this,t=[];return this.order.lineItems.forEach((function(n){var i=e.$options.filters.currency(n.totalPrice,e.order.currency.shortName,e.order.decimal_precision),a=!1,o=n.quantity;n.customFields&&("refund"===e.mode?(n.customFields.payone_captured_quantity&&0>n.customFields.payone_captured_quantity&&(o=n.customFields.payone_captured_quantity),n.customFields.payone_refunded_quantity&&(o-=n.customFields.payone_refunded_quantity)):"capture"===e.mode&&n.customFields.payone_captured_quantity&&0o&&(a=!0),t.push({id:n.id,product:n.label,quantity:o,disabled:a,selected:!1,price:i,orderItem:n})})),this.order.shippingCosts.totalPrice>0&&t.push({id:"shipping",product:this.$tc("payone-payment.modal.shippingCosts"),quantity:1,disabled:!1,selected:!1,price:this.$options.filters.currency(this.order.shippingCosts.totalPrice,this.order.currency.shortName,this.order.decimal_precision),orderItem:{}}),t},orderItemColumns:function(){return[{property:"product",label:this.$tc("payone-payment.modal.columns.product"),rawData:!0},{property:"quantity",label:this.$tc("payone-payment.modal.columns.quantity"),rawData:!0},{property:"price",label:this.$tc("payone-payment.modal.columns.price"),rawData:!0}]}},methods:{onSelectItem:function(e,t,n){this.$emit("select-item",t.id,n)},onChangeQuantity:function(e,t){this.$emit("change-quantity",t,e)}}});Shopware.Component.extend("payone-data-grid","sw-data-grid",{template:'{% block sw_data_grid_select_item_checkbox %}\n \n \n\n \n \n{% endblock %}\n'});n("PaTh");Shopware.Component.register("payone-payment-plugin-icon",{template:'{% block payone_payment_plugin_icon %}\n \n{% endblock %}\n'});n("oAJ+");var _=Shopware,P=_.Component,w=_.Mixin,S=Shopware.Utils,k=S.object,A=S.types;P.register("payone-settings",{template:'{% block payone_payment %}\n\n {% block payone_payment_header %}\n \n {% endblock %}\n\n {% block payone_payment_actions %}\n \n {% endblock %}\n\n {% block payone_payment_settings_content %}\n \n {% endblock %}\n\n{% endblock %}\n',mixins:[w.getByName("notification"),w.getByName("sw-inline-snippet")],inject:["PayonePaymentSettingsService"],data:function(){return{isLoading:!1,isTesting:!1,isSaveSuccessful:!1,isTestSuccessful:!1,isApplePayCertConfigured:!0,config:{},merchantIdFilled:!1,accountIdFilled:!1,portalIdFilled:!1,portalKeyFilled:!1,showValidationErrors:!1,isSupportModalOpen:!1,stateMachineTransitionActions:[],displayStatusMapping:{},collapsibleState:{status_mapping:!0,payment_credit_card:!0,payment_paypal:!0,payment_paypal_express:!0,payment_debit:!0,payment_sofort:!0,payment_payolution_installment:!0,payment_payolution_invoicing:!0,payment_payolution_debit:!0,payment_eps:!0,payment_ideal:!0,payment_paydirekt:!0,payment_prepayment:!0,payment_trustly:!0,payment_secure_invoice:!0,payment_open_invoice:!0,payment_apple_pay:!0,payment_bancontact:!0,payment_ratepay_debit:!0,payment_ratepay_installment:!0,payment_ratepay_invoicing:!0,payment_klarna_invoice:!0,payment_klarna_direct_debit:!0,payment_klarna_installment:!0,payment_przelewy24:!0,payment_we_chat_pay:!0,payment_postfinanceCard:!0,payment_postfinanceWallet:!0,payment_alipay:!0,payment_secured_invoice:!0,payment_secured_installment:!0,payment_secured_direct_debit:!0}}},created:function(){this.createdComponent()},computed:{credentialsMissing:function(){return!(this.merchantIdFilled&&this.accountIdFilled&&this.portalIdFilled&&this.portalKeyFilled)}},metaInfo:function(){return{title:this.$createTitle()}},methods:{createdComponent:function(){var e=this,t=this;this.PayonePaymentSettingsService.getStateMachineTransitionActions().then((function(e){e.data.forEach((function(e){var n="payone-payment.transitionActionNames."+e.label,i=t.$t(n);i===n&&(i=e.label),t.stateMachineTransitionActions.push({label:i,value:e.value})}))})),this.PayonePaymentSettingsService.hasApplePayCert().then((function(t){e.isApplePayCertConfigured=t}))},paymentMethodPrefixes:function(){return["creditCard","debit","paypal","paypalExpress","payolutionInvoicing","payolutionInstallment","payolutionDebit","sofort","eps","iDeal","paydirekt","prepayment","trustly","secureInvoice","openInvoice","applePay","bancontact","ratepayDebit","ratepayInstallment","ratepayInvoicing","klarnaInvoice","klarnaDirectDebit","klarnaInstallment","przelewy24","weChatPay","postfinanceCard","postfinanceWallet","alipay","securedInvoice","securedInstallment","securedDirectDebit"]},isVisiblePaymentMethodCard:function(e){return e.name.startsWith("payment")&&!this.isCollapsed(e)},isCollapsible:function(e){return e.name in this.collapsibleState},displayField:function(e,t,n){return!(n.name in this.collapsibleState)||!this.collapsibleState[n.name]},isCollapsed:function(e){return this.collapsibleState[e.name]},toggleCollapsible:function(e){e.name in this.collapsibleState&&(this.collapsibleState[e.name]=!this.collapsibleState[e.name])},saveFinish:function(){this.isSaveSuccessful=!1},testFinish:function(){this.isTestSuccessful=!1},onConfigChange:function(e){this.config=e,this.checkCredentialsFilled(),this.showValidationErrors=!1},checkCredentialsFilled:function(){this.merchantIdFilled=!!this.getConfigValue("merchantId"),this.accountIdFilled=!!this.getConfigValue("accountId"),this.portalIdFilled=!!this.getConfigValue("portalId"),this.portalKeyFilled=!!this.getConfigValue("portalKey")},getConfigValue:function(e){var t=this.$refs.systemConfig.actualConfigData.null;return null===this.$refs.systemConfig.currentSalesChannelId?this.config["PayonePayment.settings.".concat(e)]:this.config["PayonePayment.settings.".concat(e)]||t["PayonePayment.settings.".concat(e)]},getPaymentConfigValue:function(e,t){var n=e.charAt(0).toUpperCase()+e.slice(1);return this.getConfigValue(t+n)||this.getConfigValue(e)},onSave:function(){var e=this;this.credentialsMissing?this.showValidationErrors=!0:(this.isSaveSuccessful=!1,this.isLoading=!0,this.$refs.systemConfig.saveAll().then((function(t){e.handleRatepayProfileUpdates(t),e.isLoading=!1,e.isSaveSuccessful=!0})).catch((function(){e.isLoading=!1})))},onTest:function(){var e=this;this.isTesting=!0,this.isTestSuccessful=!1;var t={};this.paymentMethodPrefixes().forEach((function(n){t[n]={merchantId:e.getPaymentConfigValue("merchantId",n),accountId:e.getPaymentConfigValue("accountId",n),portalId:e.getPaymentConfigValue("portalId",n),portalKey:e.getPaymentConfigValue("portalKey",n)}})),this.PayonePaymentSettingsService.validateApiCredentials(t).then((function(t){var n=t.testCount,i=t.credentialsValid,a=t.errors;if(i)e.createNotificationSuccess({title:e.$tc("payone-payment.settingsForm.titleSuccess"),message:n>0?e.$tc("payone-payment.settingsForm.messageTestSuccess"):e.$tc("payone-payment.settingsForm.messageTestNoTestedPayments")}),e.isTestSuccessful=!0;else for(var o in a)if(a.hasOwnProperty(o)){e.createNotificationError({title:e.$tc("payone-payment.settingsForm.titleError"),message:e.$tc("payone-payment.settingsForm.messageTestError."+o)});var r=a[o];"string"==typeof r&&e.createNotificationError({title:e.$tc("payone-payment.settingsForm.titleError"),message:r})}e.isTesting=!1})).catch((function(t){e.createNotificationError({title:e.$tc("payone-payment.settingsForm.titleError"),message:e.$tc("payone-payment.settingsForm.messageTestError.general")}),e.isTesting=!1}))},getBind:function(e,t){var n;return t!==this.config&&(this.config=t),this.showValidationErrors&&("PayonePayment.settings.merchantId"!==e.name||this.merchantIdFilled||(e.config.error={code:1,detail:this.$tc("payone-payment.messageNotBlank")}),"PayonePayment.settings.accountId"!==e.name||this.accountIdFilled||(e.config.error={code:1,detail:this.$tc("payone-payment.messageNotBlank")}),"PayonePayment.settings.portalId"!==e.name||this.portalIdFilled||(e.config.error={code:1,detail:this.$tc("payone-payment.messageNotBlank")}),"PayonePayment.settings.portalKey"!==e.name||this.portalKeyFilled||(e.config.error={code:1,detail:this.$tc("payone-payment.messageNotBlank")})),this.$refs.systemConfig.config.forEach((function(t){t.elements.forEach((function(t){t.name!==e.name||(n=t)}))})),n||e},getElementBind:function(e){var t=k.deepCopyObject(e);return null!==this.currentSalesChannelId&&this.inherit&&this.actualConfigData.hasOwnProperty("null")&&null!==this.actualConfigData.null[t.name]&&("single-select"===t.type||"sw-entity-single-select"===t.config.componentName?t.placeholder=this.$tc("sw-settings.system-config.inherited"):"bool"===t.type?t.config.inheritedValue=this.actualConfigData.null[t.name]||!1:"password"===t.type?(t.placeholderIsPassword=!0,t.placeholder="".concat(this.actualConfigData.null[t.name])):"multi-select"===t.type||A.isUndefined(this.actualConfigData.null[t.name])||(t.placeholder="".concat(this.actualConfigData.null[t.name]))),["single-select","multi-select"].includes(t.type)&&(t.config.labelProperty="name",t.config.valueProperty="id"),t},handleRatepayProfileUpdates:function(e){var t=this.$refs.systemConfig.currentSalesChannelId;if(e.payoneRatepayProfilesUpdateResult&&e.payoneRatepayProfilesUpdateResult[t]){var n=e.payoneRatepayProfilesUpdateResult[t];this.$root.$emit("payone-ratepay-profiles-update-result",n),Array.isArray(n.errors)||this.createNotificationError({title:this.$tc("payone-payment.settingsForm.titleError"),message:this.$tc("payone-payment.settingsForm.messageSaveError.ratepayProfilesUpdateFailed")})}}}});n("Veh4");var C=Shopware,I=C.Component,T=C.Mixin,E=Shopware.Data.Criteria;I.override("sw-order-detail-base",{template:'{% block sw_order_detail_delivery_metadata %}\n {% parent %}\n\n \n{% endblock %}\n',inject:["PayonePaymentService","repositoryFactory","acl"],mixins:[T.getByName("notification")],data:function(){return{disableButtons:!1,notificationForwards:null}},computed:{payoneTransactions:function(){var e=this;return this.order.transactions.filter((function(t){return e.isPayoneTransaction(t)})).sort((function(e,t){return e.createdAtt.createdAt?-1:0}))},notificationForwardRepository:function(){return this.repositoryFactory.create("payone_payment_notification_forward")},notificationTargetColumns:function(){return[{property:"txaction",type:"text",width:"100px"},{property:"notificationTarget.url",type:"text"},{property:"response",width:"100px"},{property:"updatedAt",align:"right",type:"date"}]}},methods:{requeue:function(e,t){var n=this,i={notificationForwardId:e.id};this.PayonePaymentService.requeueNotificationForward(i).then((function(){n.createNotificationSuccess({title:n.$tc("payonePayment.notificationTarget.actions.requeue"),message:n.$tc("payonePayment.notificationTarget.messages.success")}),n.getNotificationForwards(t)})).catch((function(e){n.createNotificationError({title:n.$tc("payonePayment.notificationTarget.actions.requeue"),message:e.message})})).finally((function(){n.$nextTick().then((function(){n.$emit("reload")}))}))},isPayoneTransaction:function(e){return!!(e.extensions&&e.extensions.payonePaymentOrderTransactionData&&e.extensions.payonePaymentOrderTransactionData.transactionId)&&e.extensions.payonePaymentOrderTransactionData.transactionId},hasNotificationForwards:function(e){return null===this.notificationForwards?(this.getNotificationForwards(e),!1):!(this.notificationForwards.length<=0)},getNotificationForwards:function(e){var t=this,n=new E;return n.addAssociation("notificationTarget"),n.addSorting(E.sort("updatedAt","DESC",!0)),n.addFilter(E.equals("transactionId",e.id)),n.setLimit(500),this.notificationForwardRepository.search(n,Shopware.Context.api).then((function(e){t.notificationForwards=e}))},can:function(e){try{return this.acl.can(e)}catch(e){return!0}},isActiveTransaction:function(e){return"cancelled"!==e.stateMachineState.technicalName},hasPayoneTransaction:function(e){var t=this,n=!1;return!!e.transactions&&(e.transactions.map((function(e){t.isPayoneTransaction(e)&&t.isActiveTransaction(e)&&(n=!0)})),n)}}});n("F2L/");var O=Shopware.Component,x=Shopware.Context.app.config.version.match(/((\d+)\.?(\d+?)\.?(\d+)?\.?(\d*))-?([A-z]+?\d+)?/i);x&&6===parseInt(x[2])&&parseInt(x[3])<4&&O.override("sw-settings-index",{template:'{% block sw_settings_content_card_slot_plugins %}\n {% parent %}\n\n \n \n \n{% endblock %}\n'});n("tWAi");var N=n("CY1O"),$=n("GqT2"),D=Shopware.Module,R={type:"plugin",name:"PayonePayment",title:"payone-payment.general.mainMenuItemGeneral",description:"payone-payment.general.descriptionTextModule",version:"1.0.0",targetVersion:"1.0.0",icon:"default-action-settings",snippets:{"de-DE":N,"en-GB":$},routeMiddleware:function(e,t){e(t)},routes:{index:{component:"payone-settings",path:"index",meta:{parentPath:"sw.settings.index"}}}},M=Shopware.Context.app.config.version.match(/((\d+)\.?(\d+?)\.?(\d+)?\.?(\d*))-?([A-z]+?\d+)?/i);M&&6===parseInt(M[2])&&parseInt(M[3])>3&&(R.settingsItem=[{name:"payone-payment",to:"payone.payment.index",label:"payone-payment.general.mainMenuItemGeneral",group:"plugins",iconComponent:"payone-payment-plugin-icon",backgroundEnabled:!1}]),D.register("payone-payment",R);function F(e){return(F="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 q(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function L(e){for(var t=1;t\n\n {% block payone_notification_target_list_smart_bar_header %}\n \n {% endblock %}\n\n {% block payone_notification_target_list_actions %}\n \n {% endblock %}\n\n {% block payone_notification_target_list_content %}\n \n {% endblock %}\n\n {% block payone_notification_target_list_sidebar %}\n \n {% endblock %}\n \n{% endblock %}\n',inject:["repositoryFactory"],mixins:[z.getByName("listing")],data:function(){return{isLoading:!1,items:null,sortBy:"createdAt",criteriaLimit:500,criteriaPage:1,limit:500}},metaInfo:function(){return{title:this.$createTitle()}},computed:{notificationTargetColumns:function(){return[{dataIndex:"url",property:"url",label:"payonePayment.notificationTarget.columns.url",primary:!0},{dataIndex:"isBasicAuth",property:"isBasicAuth",label:"payonePayment.notificationTarget.columns.isBasicAuth"},{property:"txactions",label:"payonePayment.notificationTarget.columns.txactions"}]},repository:function(){return this.repositoryFactory.create("payone_payment_notification_target")},criteria:function(){var e=new Z(this.criteriaPage,this.criteriaLimit);return e}},created:function(){this.createdComponent()},methods:{renderTxactions:function(e){return null!==e&&e.length?e.join(", "):""},createdComponent:function(){this.getList()},getList:function(){var e=this;this.isLoading=!0;var t=L(L({},Shopware.Context.api),{},{inheritance:!0});return this.repository.search(this.criteria,t).then((function(t){e.total=t.total,e.items=t,e.isLoading=!1}))},onDelete:function(e){this.$refs.listing.deleteItem(e),this.getList()}}});var U=Shopware,K=U.Component,G=U.Mixin;U.Data.Criteria;K.register("payone-notification-target-detail",{template:'{% block payone_notification_target_detail %}\n \n\n {% block payone_notification_target_detail_header %}\n \n {% endblock %}\n\n {% block payone_notification_target_detail_actions %}\n \n {% endblock %}\n\n {% block payone_notification_target_detail_content %}\n \n\n {% block payone_notification_target_detail_base_basic_info_card %}\n \n \n \n {% endblock %}\n \n {% endblock %}\n\n \n{% endblock %}\n',inject:["repositoryFactory"],mixins:[G.getByName("notification")],shortcuts:{"SYSTEMKEY+S":"onSave",ESCAPE:"onCancel"},props:{notificationTargetId:{type:String,required:!1,default:null}},data:function(){return{notificationTarget:null,isLoading:!1,isSaveSuccessful:!1}},metaInfo:function(){return{title:this.$createTitle(this.identifier)}},computed:{notificationTargetIsLoading:function(){return this.isLoading||null==this.notificationTarget},notificationTargetRepository:function(){return this.repositoryFactory.create("payone_payment_notification_target")}},watch:{notificationTargetId:function(){this.createdComponent()}},created:function(){this.createdComponent()},methods:{updateSelection:function(e){this.notificationTarget.txactions=e},createdComponent:function(){this.notificationTargetId?this.loadEntityData():(Shopware.State.commit("context/resetLanguageToDefault"),this.notificationTarget=this.notificationTargetRepository.create(Shopware.Context.api))},loadEntityData:function(){var e=this;this.isLoading=!0,this.notificationTargetRepository.get(this.notificationTargetId,Shopware.Context.api).then((function(t){e.isLoading=!1,e.notificationTarget=t,null!==t.txactions&&(t.txactions.length||(e.notificationTarget.txactions=null))}))},isInvalid:function(){return!0===this.notificationTarget.isBasicAuth&&((!this.notificationTarget.username||!this.notificationTarget.password)&&(this.createNotificationError({message:this.$tc("global.notification.notificationSaveErrorMessageRequiredFieldsInvalid")}),!0))},onSave:function(){var e=this;this.isInvalid()||(this.isLoading=!0,this.notificationTargetRepository.save(this.notificationTarget,Shopware.Context.api).then((function(){e.isLoading=!1,e.isSaveSuccessful=!0,null!==e.notificationTargetId?e.loadEntityData():e.$router.push({name:"payone.notification.target.detail",params:{id:e.notificationTarget.id}})})).catch((function(t){throw e.isLoading=!1,e.createNotificationError({message:e.$tc("global.notification.notificationSaveErrorMessageRequiredFieldsInvalid")}),t})))},onCancel:function(){this.$router.push({name:"payone.notification.target.list"})}}});var V=n("uk8h"),W=n("GmXf");Shopware.Module.register("payone-notification-target",{type:"plugin",name:"PayoneNotificationTarget",title:"payonePayment.notificationTarget.module.title",description:"payonePayment.notificationTarget.module.title",color:"#3596d6",icon:"default-shopping-paper-bag-product",snippets:{"de-DE":V,"en-GB":W},routes:{list:{component:"payone-notification-target-list",path:"list"},detail:{component:"payone-notification-target-detail",path:"detail/:id",props:{default:function(e){return{notificationTargetId:e.params.id}}},meta:{parentPath:"payone.notification.target.list"}},create:{component:"payone-notification-target-detail",path:"create",meta:{parentPath:"payone.notification.target.list"}}}});Shopware.Component.override("sw-order-user-card",{template:"{% block sw_order_detail_base_secondary_info_payment %}\n \n{% endblock %}",computed:{payoneCardType:function(){var e,t,n=null===(e=this.currentOrder.transactions.last().extensions.payonePaymentOrderTransactionData)||void 0===e||null===(t=e.additionalData)||void 0===t?void 0:t.card_type;return n?this.$tc("sw-order.payone-payment.creditCard.cardTypes."+n):null}}});n("2a1E"),n("ldEE"),n("6PZk")},Veh4:function(e,t,n){var i=n("rEvD");i.__esModule&&(i=i.default),"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("ydqr").default)("6d309501",i,!0,{})},bWZA:function(e,t,n){},euFz:function(e,t,n){},fWC6:function(e,t,n){var i=n("qKbt");i.__esModule&&(i=i.default),"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("ydqr").default)("6d4f2f7a",i,!0,{})},jqOd:function(e,t,n){},ldEE:function(e,t){function n(e){return(n="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 i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var i=0;i2&&void 0!==arguments[2]?arguments[2]:"payone_payment";return i(this,l),c.call(this,e,t,n)}return t=l,(n=[{key:"validateApiCredentials",value:function(e){var t=this.getBasicHeaders();return this.httpClient.post("_action/".concat(this.getApiBasePath(),"/validate-api-credentials"),{credentials:e},{headers:t}).then((function(e){return u.handleResponse(e)}))}},{key:"getStateMachineTransitionActions",value:function(){var e=this.getBasicHeaders();return this.httpClient.get("_action/".concat(this.getApiBasePath(),"/get-state-machine-transition-actions"),{headers:e}).then((function(e){return u.handleResponse(e)}))}},{key:"hasApplePayCert",value:function(){var e=this.getBasicHeaders();return this.httpClient.get("_action/".concat(this.getApiBasePath(),"/check-apple-pay-cert"),{headers:e}).catch((function(){return!1})).then((function(e){return!!e}))}}])&&a(t.prototype,n),s&&a(t,s),Object.defineProperty(t,"prototype",{writable:!1}),l}(u);l.addServiceProvider("PayonePaymentSettingsService",(function(e){var t=l.getContainer("init");return new d(t.httpClient,e.loginService)}))},mi8M:function(e,t,n){},"oAJ+":function(e,t,n){var i=n("jqOd");i.__esModule&&(i=i.default),"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n("ydqr").default)("8689c210",i,!0,{})},qKbt:function(e,t,n){},rEvD:function(e,t,n){},tWAi:function(e,t){var n=Shopware.Filter,i=Shopware.Utils.format.currency;n.register("payone_currency",(function(e,t,n,a){return null===e?"-":(n||(n=0),e/=Math.pow(10,n),i(e,t,a))}))},uk8h:function(e){e.exports=JSON.parse('{"payonePayment":{"notificationTarget":{"module":{"title":"Payone Notificationweiterleitungen","buttonTitle":"Notifications"},"list":{"title":"Notificationweiterleitungen","empty":"Keine Einträge","buttonCreate":"Weiterleitungsziel anlegen"},"detail":{"headline":"Notificationweiterleitung","placeholder":{"url":"Url","username":"Benutzer","password":"Passwort"},"label":{"url":"Url","isBasicAuth":"Basic Auth","txactions":"txactions","buttonSave":"Speichern","buttonCancel":"Abbrechen","username":"Benutzer","password":"Passwort"}},"columns":{"url":"Url","isBasicAuth":"Basic Auth","txactions":"txactions"},"actions":{"requeue":"Erneut senden"},"messages":{"success":"Die Weiterleitung wurde erfolgreich in Auftrag gegeben."}}}}')},vRey:function(e,t,n){},ydqr:function(e,t,n){"use strict";function i(e,t){for(var n=[],i={},a=0;an.parts.length&&(i.parts.length=n.parts.length)}else{var r=[];for(a=0;a2&&void 0!==arguments[2]?arguments[2]:"payone";return r(this,c),l.call(this,e,t,n)}return t=c,(n=[{key:"requeueNotificationForward",value:function(e){var t="_action/".concat(this.getApiBasePath(),"/requeue-forward");return this.httpClient.post(t,e,{headers:this.getBasicHeaders()}).then((function(e){return u.handleResponse(e)}))}},{key:"capturePayment",value:function(e){var t="_action/".concat(this.getApiBasePath(),"/capture-payment");return this.httpClient.post(t,e,{headers:this.getBasicHeaders()}).then((function(e){return u.handleResponse(e)}))}},{key:"refundPayment",value:function(e){var t="_action/".concat(this.getApiBasePath(),"/refund-payment");return this.httpClient.post(t,e,{headers:this.getBasicHeaders()}).then((function(e){return u.handleResponse(e)}))}}])&&a(t.prototype,n),s&&a(t,s),Object.defineProperty(t,"prototype",{writable:!1}),c}(u);c.addServiceProvider("PayonePaymentService",(function(e){var t=c.getContainer("init");return new p(t.httpClient,e.loginService)}))},"6PZk":function(e,t){try{Shopware.Service("privileges").addPrivilegeMappingEntry({category:"additional_permissions",parent:null,key:"Payone",roles:{payone_order_management:{privileges:["order_transaction:update","order_line_item:update","state_machine_history:create",Shopware.Service("privileges").getPrivileges("order.viewer")],dependencies:[]}}})}catch(e){}},CY1O:function(e){e.exports=JSON.parse('{"payone-payment":{"title":"PAYONE","general":{"mainMenuItemGeneral":"PAYONE","descriptionTextModule":"Einstellungen für PAYONE","headlines":{"ratepayProfiles":"Profile","ratepayProfileConfigurations":"Profil-Konfigurationen"},"label":{"shopId":"Shop-ID","currency":"Währung","error":"Status","invoiceCountry":"Rechnungsland","shippingCountry":"Lieferland","minBasket":"Min. Warenkorb","maxBasket":"Max. Warenkorb","reloadConfigBtn":"Profil-Konfiguration neu laden","reloadConfigInfo":"(Änderungen an der Plugin-Konfiguration werden dabei zuerst gespeichert)"},"actions":{"addShop":"Shop-ID hinzufügen"},"errors":{"existingShopId":"Die eingegebene ShopId existiert bereits.","emptyInputs":"Bitte füllen Sie alle Eingabefelder aus."}},"settingsForm":{"save":"Speichern","test":"API-Zugangsdaten testen","titleSuccess":"Erfolg","titleError":"Fehler","labelShowSpecificStatusMapping":"Statusmappingkonfiguration einblenden","helpTextShowSpecificStatusMapping":"Sie können für jede Zahlungsart ein spezifisches Statusmapping konfigurieren. Existiert eine solche Konfiguration nicht, wird auf die allgemeine Konfiguration zurückgegriffen.","messageSaveError":{"ratepayProfilesUpdateFailed":"Mindestens ein Ratepay Profil konnte nicht erfolgreich gespeichert werden, bitte prüfen Sie Ihre Konfiguration."},"messageTestSuccess":"Die API-Zugangsdaten wurden erfolgreich validiert.","messageTestNoTestedPayments":"Bei der Prüfung wurden keine Zahlarten getestet, weil keine der PAYONE Zahlarten aktiviert ist. Bitte aktivieren Sie mindestens eine PAYONE Zahlart unter Einstellungen --\x3e Shop --\x3e Zahlungsarten.","messageTestError":{"general":"Die API-Zugangsdaten konnten nicht validiert werden.","creditCard":"Die API-Zugangsdaten für PAYONE Kreditkarte sind nicht korrekt.","prepayment":"Die API-Zugangsdaten für PAYONE Vorkasse sind nicht korrekt.","debit":"Die API-Zugangsdaten für PAYONE Lastschrift sind nicht korrekt.","paypalExpress":"Die API-Zugangsdaten für PAYONE PayPal Express sind nicht korrekt.","paypal":"Die API-Zugangsdaten für PAYONE PayPal sind nicht korrekt.","payolutionInstallment":"Die API-Zugangsdaten für PAYONE Unzer Ratenkauf sind nicht korrekt.","payolutionInvoicing":"Die API-Zugangsdaten für PAYONE Unzer Rechnungskauf sind nicht korrekt.","payolutionDebit":"Die API-Zugangsdaten für PAYONE Unzer Lastschrift sind nicht korrekt.","sofort":"Die API-Zugangsdaten für PAYONE Sofort Überweisung sind nicht korrekt.","eps":"Die API-Zugangsdaten für PAYONE eps Überweisung sind nicht korrekt.","iDeal":"Die API-Zugangsdaten für PAYONE iDEAL sind nicht korrekt.","secureInvoice":"Die API-Zugangsdaten für PAYONE Gesicherter Rechnungskauf sind nicht korrekt.","openInvoice":"Die API-Zugangsdaten für PAYONE Rechnungskauf sind nicht korrekt.","paydirekt":"Die API-Zugangsdaten für PAYONE paydirekt sind nicht korrekt.","trustly":"Die API-Zugangsdaten für PAYONE Trustly sind nicht korrekt.","applePay":"Die API-Zugangsdaten für PAYONE Apple Pay sind nicht korrekt.","bancontact":"Die API-Zugangsdaten für PAYONE Bancontact sind nicht korrekt.","ratepayDebit":"Die API-Zugangsdaten für PAYONE Ratepay Lastschrift sind nicht korrekt.","ratepayInstallment":"Die API-Zugangsdaten für PAYONE Ratepay Ratenzahlung sind nicht korrekt.","ratepayInvoicing":"Die API-Zugangsdaten für PAYONE Ratepay Rechnungskauf sind nicht korrekt.","klarnaInvoice":"Die API-Zugangsdaten für PAYONE Klarna Rechnung sind nicht korrekt.","klarnaDirectDebit":"Die API-Zugangsdaten für PAYONE Klarna Sofort bezahlen sind nicht korrekt.","klarnaInstallment":"Die API-Zugangsdaten für PAYONE Klarna Ratenkauf sind nicht korrekt.","przelewy24":"Die API-Zugangsdaten für PAYONE Przelewy24 sind nicht korrekt.","weChatPay":"Die API-Zugangsdaten für PAYONE WeChat Pay sind nicht korrekt.","postfinanceCard":"Die API-Zugangsdaten für PAYONE Postfinance (Card) sind nicht korrekt.","postfinanceWallet":"Die API-Zugangsdaten für PAYONE Postfinance (Wallet) sind nicht korrekt.","alipay":"Die API-Zugangsdaten für PAYONE Alipay sind nicht korrekt.","securedInvoice":"Die API-Zugangsdaten für PAYONE Gesicherter Rechnungskauf sind nicht korrekt.","securedInstallment":"Die API-Zugangsdaten für PAYONE Gesicherter Ratenkauf sind nicht korrekt.","securedDirectDebit":"Die API-Zugangsdaten für PAYONE Gesicherte Lastschrift sind nicht korrekt."}},"supportModal":{"menuButton":"Support","title":"Wie können wir Ihnen helfen?","documentation":{"description":"Lesen Sie unsere Online-Dokumentation","button":"Dokumentation"},"support":{"description":"Kontaktieren Sie unseren Support","button":"Technischer Support"},"repository":{"description":"Melden Sie Fehler und Verbesserungen","button":"GitHub"},"testdata":{"description":"Erstellen Sie hier Ihre persönlichen Testdaten","button":"Testdaten"}},"applePay":{"cert":{"notification":"Für die Nutzung von ApplePay ist ein Zertifikat/Key-Paar zur Authentifizierung des Merchants erforderlich. Die Anlage eines solchen Zertifikats wird hier beschrieben:
\\n https://docs.payone.com/display/public/PLATFORM/Special+Remarks+-+Apple+Pay#SpecialRemarks-ApplePay-Onboarding

\\n\\n Erstellen Sie im Anschluss unter Verwendung des folgenden Befehls eine PEM-Datei des Zertifikates:
\\n
openssl x509 -inform der -in merchant_id.cer -out merchant_id.pem

\\n Hinterlegen Sie das Zertifikat (merchant_id.pem) und den Key (merchant_id.key) in folgendem Verzeichnis:
\\n
%shopwareRoot%/config/apple-pay-cert
"}},"transitionActionNames":{"cancel":"Stornieren","complete":"Abschließen","pay":"Bezahlen","pay_partially":"Teilweise bezahlen","process":"Durchführen","refund":"Rückerstatten","refund_partially":"Teilweise rückerstatten","remind":"Erinnern","reopen":"Wieder öffnen","retour":"Retoure","retour_partially":"Teilweise retounieren","ship":"Versenden","ship_partially":"Teilweise versenden"},"messageNotBlank":"Dieser Wert darf nicht leer sein.","error":{"transaction":{"notFound":"Es wurde keine passende Transaktion gefundend","orderNotFound":"Es wurde keine passende Bestellung gefundend"}}},"sw-privileges":{"additional_permissions":{"Payone":{"label":"PAYONE","payone_order_management":"PAYONE Transaktionsmanagement"}}}}')},GmXf:function(e){e.exports=JSON.parse('{"payonePayment":{"notificationTarget":{"module":{"title":"Payone notification forward","buttonTitle":"Notifications"},"list":{"title":"Notification forward","empty":"No entries","buttonCreate":"Add new notification target"},"detail":{"headline":"Notification forward","placeholder":{"url":"Url","username":"Username","password":"Password"},"label":{"url":"Url","isBasicAuth":"Basic Auth","txactions":"txactions","buttonSave":"Save","buttonCancel":"Cancel","username":"Username","password":"Password"}},"columns":{"url":"Url","isBasicAuth":"Basic Auth","txactions":"txactions"},"actions":{"requeue":"Requeue"},"messages":{"success":"The notification forward has been successfully queued."}}}}')},GqT2:function(e){e.exports=JSON.parse('{"payone-payment":{"title":"PAYONE","general":{"mainMenuItemGeneral":"PAYONE","descriptionTextModule":"Settings for PAYONE","headlines":{"ratepayProfiles":"Profile","ratepayProfileConfigurations":"Profil-Konfigurationen"},"label":{"shopId":"Shop-ID","currency":"Currency","error":"Status","invoiceCountry":"Invoice Country","shippingCountry":"Shipping Country","minBasket":"Min. Basket","maxBasket":"Max. Basket","reloadConfigBtn":"Reload Profile Configuration","reloadConfigInfo":"(Plugin Configuration Changes will be saved first)"},"actions":{"addShop":"Add Shop-ID"},"errors":{"existingShopId":"The entered shop-id already exists.","emptyInputs":"Please fill all input fields."}},"settingsForm":{"save":"Save","test":"Test API Credentials","titleSuccess":"Success","titleError":"Error","labelShowSpecificStatusMapping":"Display state mapping configuration","helpTextShowSpecificStatusMapping":"If not configured the general status mapping config will be applied.","messageSaveError":{"ratepayProfilesUpdateFailed":"At least one Ratepay profile could not be saved successfully, please check your configuration."},"messageTestSuccess":"The API credentials were verified successfully.","messageTestNoTestedPayments":"No payment methods were tested during the check because none of the PAYONE payment methods are activated. Please activate at least one PAYONE payment method under Settings --\x3e Shop --\x3e Payment.","messageTestError":{"general":"The API credentials could not be verified successfully.","creditCard":"The API credentials for PAYONE Credit Card are not valid.","prepayment":"The API credentials for PAYONE Prepayment are not valid.","debit":"The API credentials for PAYONE Direct Debit are not valid.","paypalExpress":"The API credentials for PAYONE PayPal Express are not valid.","paypal":"The API credentials for PAYONE PayPal are not valid.","payolutionInstallment":"The API credentials for PAYONE Unzer Ratenkauf are not valid.","payolutionInvoicing":"The API credentials for PAYONE Unzer Rechnungskauf are not valid.","payolutionDebit":"The API credentials for PAYONE Unzer Lastschrift are not valid.","sofort":"The API credentials for PAYONE Sofort are not valid.","eps":"The API credentials for PAYONE eps are not valid.","iDeal":"The API credentials for PAYONE iDEAL are not valid.","secureInvoice":"The API credentials for PAYONE Secure Invoice are not valid.","openInvoice":"The API credentials for PAYONE Invoice are not valid.","paydirekt":"The API credentials for PAYONE paydirekt are not valid.","trustly":"The API credentials for PAYONE Trustly are not valid.","applePay":"The API credentials for PAYONE Apple Pay are not valid.","bancontact":"The API credentials for PAYONE Bancontact payment are not valid.","ratepayDebit":"The API credentials for PAYONE Ratepay Direct Debit payment are not valid.","ratepayInstallment":"The API credentials for PAYONE Ratepay Installments payment are not valid.","ratepayInvoicing":"The API credentials for PAYONE Ratepay Open Invoice payment are not valid.","klarnaInvoice":"The API credentials for PAYONE Klarna Rechnung are not valid.","klarnaDirectDebit":"The API credentials for PAYONE Klarna Sofort bezahlen are not valid.","klarnaInstallment":"The API credentials for PAYONE Klarna Ratenkauf are not valid.","przelewy24":"The API credentials for PAYONE Przelewy24 are not valid.","weChatPay":"The API credentials for PAYONE WeChat Pay are not valid.","postfinanceCard":"The API credentials for PAYONE Postfinance (Card) are not valid.","postfinanceWallet":"The API credentials for PAYONE Postfinance (Wallet) are not valid.","alipay":"The API credentials for PAYONE Alipay are not valid.","securedInvoice":"The API credentials for PAYONE Secured Invoice are not valid.","securedInstallment":"The API credentials for PAYONE Secured Installment are not valid.","securedDirectDebit":"The API credentials for PAYONE Secured Direct Debit are not valid."}},"supportModal":{"menuButton":"Support","title":"How Can We Help You?","documentation":{"description":"Read our online manual","button":"Online Manual"},"support":{"description":"Contact our technical support","button":"Tech Support"},"repository":{"description":"Report errors on GitHub","button":"GitHub"},"testdata":{"description":"Create your personal test data here","button":"Test Data"}},"applePay":{"cert":{"notification":"The ApplePay merchant authentication requires a certificate/key-pair. Further information:
\\n https://docs.payone.com/display/public/PLATFORM/Special+Remarks+-+Apple+Pay#SpecialRemarks-ApplePay-Onboarding

\\n\\n Create a pem-File afterwards by using the following command:
\\n
openssl x509 -inform der -in merchant_id.cer -out merchant_id.pem

\\n Copy certificate (merchant_id.pem) and key (merchant_id.key) file into the following folder:
\\n
%shopwareRoot%/config/apple-pay-cert
"}},"transitionActionNames":{"cancel":"Cancel","complete":"Complete","pay":"Pay","pay_partially":"Pay partially","process":"Process","refund":"Refund","refund_partially":"Refund partially","remind":"Remind","reopen":"Reopen","retour":"Retour","retour_partially":"Retour partially","ship":"Ship","ship_partially":"Ship partially"},"messageNotBlank":"This field must not be empty.","error":{"transaction":{"notFound":"No matching transaction could be found","orderNotFound":"No matching order could be found"}}},"sw-privileges":{"additional_permissions":{"Payone":{"label":"PAYONE","payone_order_management":"PAYONE transaction management"}}}}')},"Hbf+":function(e,t,n){Shopware.Component.register("payone-capture-button",(function(){return n.e(4).then(n.bind(null,"R+3S"))})),Shopware.Component.register("payone-order-items",(function(){return n.e(5).then(n.bind(null,"EsCN"))})),Shopware.Component.register("payone-payment-management",(function(){return n.e(6).then(n.bind(null,"RXfx"))})),Shopware.Component.register("payone-refund-button",(function(){return n.e(7).then(n.bind(null,"LNMh"))})),Shopware.Component.register("sw-order-detail-payone",(function(){return n.e(13).then(n.bind(null,"lZb8"))})),Shopware.Component.override("sw-order-detail",(function(){return n.e(12).then(n.bind(null,"wAwH"))})),Shopware.Component.extend("payone-data-grid","sw-data-grid",(function(){return n.e(11).then(n.bind(null,"vQ7F"))})),Shopware.Module.register("sw-order-detail-tab-payone",{routeMiddleware:function(e,t){"sw.order.detail"===t.name&&t.children.push({name:"sw.order.detail.payone",path:"payone",component:"sw-order-detail-payone",meta:{parentPath:"sw.order.detail",meta:{parentPath:"sw.order.index",privilege:"order.viewer"}}}),e(t)}})},UwmX:function(e,t,n){"use strict";n.r(t);var r=n("CY1O"),a=n("GqT2");Shopware.Component.register("payone-payment-plugin-icon",(function(){return n.e(0).then(n.bind(null,"2iz0"))})),Shopware.Component.register("payone-ratepay-profile-configurations",(function(){return n.e(1).then(n.bind(null,"riVl"))})),Shopware.Component.register("payone-ratepay-profiles",(function(){return n.e(2).then(n.bind(null,"6DdA"))})),Shopware.Component.register("payone-settings",(function(){return n.e(3).then(n.bind(null,"VwDc"))})),Shopware.Filter.register("payone_currency",(function(){return n.e(10).then(n.bind(null,"tWAi"))})),Shopware.Module.register("payone-payment",{type:"plugin",name:"PayonePayment",title:"payone-payment.general.mainMenuItemGeneral",description:"payone-payment.general.descriptionTextModule",version:"1.0.0",targetVersion:"1.0.0",icon:"default-action-settings",snippets:{"de-DE":r,"en-GB":a},routeMiddleware:function(e,t){e(t)},routes:{index:{component:"payone-settings",path:"index",meta:{parentPath:"sw.settings.index"}}},settingsItem:[{name:"payone-payment",to:"payone.payment.index",label:"payone-payment.general.mainMenuItemGeneral",group:"plugins",iconComponent:"payone-payment-plugin-icon",backgroundEnabled:!1}]});var i=n("uk8h"),o=n("GmXf");Shopware.Component.register("payone-notification-target-detail",n.e(8).then(n.bind(null,"hS/x"))),Shopware.Component.register("payone-notification-target-list",n.e(9).then(n.bind(null,"G2C5"))),Shopware.Module.register("payone-notification-target",{type:"plugin",name:"PayoneNotificationTarget",title:"payonePayment.notificationTarget.module.title",description:"payonePayment.notificationTarget.module.title",color:"#3596d6",icon:"default-shopping-paper-bag-product",snippets:{"de-DE":i,"en-GB":o},routes:{list:{component:"payone-notification-target-list",path:"list"},detail:{component:"payone-notification-target-detail",path:"detail/:id",props:{default:function(e){return{notificationTargetId:e.params.id}}},meta:{parentPath:"payone.notification.target.list"}},create:{component:"payone-notification-target-detail",path:"create",meta:{parentPath:"payone.notification.target.list"}}}});n("Hbf+"),n("2a1E"),n("ldEE"),n("6PZk")},ldEE:function(e,t){function n(e){return(n="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 r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var r=0;r2&&void 0!==arguments[2]?arguments[2]:"payone_payment";return r(this,c),l.call(this,e,t,n)}return t=c,(n=[{key:"validateApiCredentials",value:function(e){var t=this.getBasicHeaders();return this.httpClient.post("_action/".concat(this.getApiBasePath(),"/validate-api-credentials"),{credentials:e},{headers:t}).then((function(e){return u.handleResponse(e)}))}},{key:"getStateMachineTransitionActions",value:function(){var e=this.getBasicHeaders();return this.httpClient.get("_action/".concat(this.getApiBasePath(),"/get-state-machine-transition-actions"),{headers:e}).then((function(e){return u.handleResponse(e)}))}},{key:"hasApplePayCert",value:function(){var e=this.getBasicHeaders();return this.httpClient.get("_action/".concat(this.getApiBasePath(),"/check-apple-pay-cert"),{headers:e}).catch((function(){return!1})).then((function(e){return!!e}))}}])&&a(t.prototype,n),s&&a(t,s),Object.defineProperty(t,"prototype",{writable:!1}),c}(u);c.addServiceProvider("PayonePaymentSettingsService",(function(e){var t=c.getContainer("init");return new p(t.httpClient,e.loginService)}))},uk8h:function(e){e.exports=JSON.parse('{"payonePayment":{"notificationTarget":{"module":{"title":"Payone Notificationweiterleitungen","buttonTitle":"Notifications"},"list":{"title":"Notificationweiterleitungen","empty":"Keine Einträge","buttonCreate":"Weiterleitungsziel anlegen"},"detail":{"headline":"Notificationweiterleitung","placeholder":{"url":"Url","username":"Benutzer","password":"Passwort"},"label":{"url":"Url","isBasicAuth":"Basic Auth","txactions":"txactions","buttonSave":"Speichern","buttonCancel":"Abbrechen","username":"Benutzer","password":"Passwort"}},"columns":{"url":"Url","isBasicAuth":"Basic Auth","txactions":"txactions"},"actions":{"requeue":"Erneut senden"},"messages":{"success":"Die Weiterleitung wurde erfolgreich in Auftrag gegeben."}}}}')}}); \ No newline at end of file diff --git a/src/Resources/views/storefront/payone/debit/debit-form.html.twig b/src/Resources/views/storefront/payone/debit/debit-form.html.twig index 6c7f21be8..ae076ab2e 100644 --- a/src/Resources/views/storefront/payone/debit/debit-form.html.twig +++ b/src/Resources/views/storefront/payone/debit/debit-form.html.twig @@ -1,6 +1,4 @@
- - {% block page_checkout_confirm_payone_card_title_debit_card %}
{{ "PayonePayment.checkoutConfirmPage.defaultCardTitle" | trans }} diff --git a/src/Resources/views/storefront/payone/payolution/payolution-installment-form.html.twig b/src/Resources/views/storefront/payone/payolution/payolution-installment-form.html.twig index 6872564e1..bd8a9bcd2 100644 --- a/src/Resources/views/storefront/payone/payolution/payolution-installment-form.html.twig +++ b/src/Resources/views/storefront/payone/payolution/payolution-installment-form.html.twig @@ -1,6 +1,4 @@
- - {% block page_checkout_confirm_payone_card_title_payolution_installment %}
{{ "PayonePayment.payolution.cardTitleInstallment" | trans }} diff --git a/src/Resources/views/storefront/payone/payolution/payolution-invoicing-form.html.twig b/src/Resources/views/storefront/payone/payolution/payolution-invoicing-form.html.twig index ba1be81d3..a53682fd2 100644 --- a/src/Resources/views/storefront/payone/payolution/payolution-invoicing-form.html.twig +++ b/src/Resources/views/storefront/payone/payolution/payolution-invoicing-form.html.twig @@ -1,6 +1,4 @@
- - {% block page_checkout_confirm_payone_card_title_payolution_installment %}
{{ "PayonePayment.payolution.cardTitleInvoicing" | trans }} diff --git a/src/Resources/views/storefront/payone/ratepay/ratepay-installment-form.html.twig b/src/Resources/views/storefront/payone/ratepay/ratepay-installment-form.html.twig index 094f7e809..174633cd4 100644 --- a/src/Resources/views/storefront/payone/ratepay/ratepay-installment-form.html.twig +++ b/src/Resources/views/storefront/payone/ratepay/ratepay-installment-form.html.twig @@ -1,6 +1,4 @@
- - {% block page_checkout_confirm_payone_card_content_ratepay_installment_card %} {% set customerCustomFields = context.customer.customFields %} diff --git a/src/Resources/views/storefront/payone/secure-invoice/secure-invoice.html.twig b/src/Resources/views/storefront/payone/secure-invoice/secure-invoice.html.twig index ca1f6c933..5e0e877e2 100644 --- a/src/Resources/views/storefront/payone/secure-invoice/secure-invoice.html.twig +++ b/src/Resources/views/storefront/payone/secure-invoice/secure-invoice.html.twig @@ -1,8 +1,5 @@ {% if context.customer.activeBillingAddress and context.customer.activeBillingAddress.company is empty %}
- - {% block page_checkout_confirm_payone_card_title_secure_invoice %}
{{ "PayonePayment.secureInvoice.cardTitle" | trans }} diff --git a/src/StoreApi/Route/AbstractApplePayRoute.php b/src/StoreApi/Route/AbstractApplePayRoute.php index e04151e4a..9e7d69497 100644 --- a/src/StoreApi/Route/AbstractApplePayRoute.php +++ b/src/StoreApi/Route/AbstractApplePayRoute.php @@ -10,6 +10,8 @@ abstract class AbstractApplePayRoute { + abstract public function getDecorated(): AbstractApplePayRoute; + abstract public function validateMerchant(Request $request, SalesChannelContext $context): Response; abstract public function process(Request $request, SalesChannelContext $context): Response; diff --git a/src/StoreApi/Route/AbstractMandateRoute.php b/src/StoreApi/Route/AbstractMandateRoute.php index de66a4922..f02f3168c 100644 --- a/src/StoreApi/Route/AbstractMandateRoute.php +++ b/src/StoreApi/Route/AbstractMandateRoute.php @@ -10,7 +10,7 @@ abstract class AbstractMandateRoute { - abstract public function getDecorated(): AbstractCardRoute; + abstract public function getDecorated(): AbstractMandateRoute; abstract public function load(SalesChannelContext $context): MandateResponse; diff --git a/src/StoreApi/Route/ApplePayRoute.php b/src/StoreApi/Route/ApplePayRoute.php index ad4882a81..24d44036e 100644 --- a/src/StoreApi/Route/ApplePayRoute.php +++ b/src/StoreApi/Route/ApplePayRoute.php @@ -52,7 +52,7 @@ public function __construct( $this->kernelDirectory = $kernelDirectory; } - public function getDecorated(): AbstractCardRoute + public function getDecorated(): AbstractApplePayRoute { throw new DecorationPatternException(self::class); } diff --git a/src/StoreApi/Route/MandateRoute.php b/src/StoreApi/Route/MandateRoute.php index ca9938238..8cb57d679 100644 --- a/src/StoreApi/Route/MandateRoute.php +++ b/src/StoreApi/Route/MandateRoute.php @@ -24,7 +24,7 @@ public function __construct(MandateServiceInterface $mandateService) $this->mandateService = $mandateService; } - public function getDecorated(): AbstractCardRoute + public function getDecorated(): AbstractMandateRoute { throw new DecorationPatternException(self::class); } diff --git a/src/Storefront/Page/Card/AccountCardPageLoader.php b/src/Storefront/Page/Card/AccountCardPageLoader.php index a1476a913..548b4a104 100644 --- a/src/Storefront/Page/Card/AccountCardPageLoader.php +++ b/src/Storefront/Page/Card/AccountCardPageLoader.php @@ -32,7 +32,6 @@ public function __construct( public function load(Request $request, SalesChannelContext $context): AccountCardPage { if (!$context->getCustomer()) { - // ToDo 6.5: Die CartException gibt es erst ab 6.4.15.0. Ok das dann als neue Mindestversion zu nehmen? (Kommt auch an anderen Stellen vor) throw CartException::customerNotLoggedIn(); } diff --git a/tests/Components/DataHandler/Transaction/TransactionDataHandlerTest.php b/tests/Components/DataHandler/Transaction/TransactionDataHandlerTest.php index 8141c3f48..397710e73 100644 --- a/tests/Components/DataHandler/Transaction/TransactionDataHandlerTest.php +++ b/tests/Components/DataHandler/Transaction/TransactionDataHandlerTest.php @@ -12,7 +12,7 @@ use Shopware\Core\Checkout\Order\Aggregate\OrderTransaction\OrderTransactionEntity; use Shopware\Core\Checkout\Order\OrderEntity; use Shopware\Core\Framework\Context; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; class TransactionDataHandlerTest extends TestCase { @@ -31,7 +31,7 @@ public function testItSavesTransactionDataWithoutExistingTransactionExtension(): ->method('getId') ->willReturn('the-id'); - $transactionRepository = $this->createMock(EntityRepositoryInterface::class); + $transactionRepository = $this->createMock(EntityRepository::class); $transactionRepository->expects(static::once()) ->method('upsert') ->with(static::callback(static function (array $data) { @@ -78,7 +78,7 @@ public function testItSavesTransactionDataWithExistingTransactionExtension(): vo ->method('getId') ->willReturn('the-transaction-id'); - $transactionRepository = $this->createMock(EntityRepositoryInterface::class); + $transactionRepository = $this->createMock(EntityRepository::class); $transactionRepository->expects(static::once()) ->method('upsert') ->with(static::callback(static function (array $data) { diff --git a/tests/Components/DeviceFingerprint/AbstractDeviceFingerprintServiceTest.php b/tests/Components/DeviceFingerprint/AbstractDeviceFingerprintServiceTest.php index 99bbe38d6..cb79dfdc9 100644 --- a/tests/Components/DeviceFingerprint/AbstractDeviceFingerprintServiceTest.php +++ b/tests/Components/DeviceFingerprint/AbstractDeviceFingerprintServiceTest.php @@ -7,7 +7,7 @@ use PayonePayment\TestCaseBase\PayoneTestBehavior; use PHPUnit\Framework\TestCase; use Shopware\Core\System\SalesChannel\SalesChannelContext; -use Symfony\Component\HttpFoundation\Session\SessionInterface; +use Symfony\Component\HttpFoundation\RequestStack; abstract class AbstractDeviceFingerprintServiceTest extends TestCase { @@ -17,11 +17,14 @@ public function testItReturnsNewDeviceIdentTokenAndSetsItToSession(): void { $serviceClass = $this->getDeviceFingerprintServiceClass(); $salesChannelContext = $this->getSalesChannelContext(); - $session = $this->getContainer()->get(SessionInterface::class); - $deviceFingerprintService = $this->getDeviceFingerprintService($session); + + $request = $this->getRequestWithSession([]); + $this->getContainer()->get(RequestStack::class)->push($request); + + $deviceFingerprintService = $this->getDeviceFingerprintService($this->getContainer()->get(RequestStack::class)); $token = $deviceFingerprintService->getDeviceIdentToken($salesChannelContext); - static::assertSame($token, $session->get($serviceClass::SESSION_VAR_NAME)); + static::assertSame($token, $request->getSession()->get($serviceClass::SESSION_VAR_NAME)); } public function testItReturnsExistingDeviceIdentTokenFromSession(): void @@ -29,10 +32,12 @@ public function testItReturnsExistingDeviceIdentTokenFromSession(): void $serviceClass = $this->getDeviceFingerprintServiceClass(); $salesChannelContext = $this->getSalesChannelContext(); - $session = $this->getContainer()->get(SessionInterface::class); - $session->set($serviceClass::SESSION_VAR_NAME, 'the-device-ident-token'); + $request = $this->getRequestWithSession([ + $serviceClass::SESSION_VAR_NAME => 'the-device-ident-token', + ]); + $this->getContainer()->get(RequestStack::class)->push($request); - $deviceFingerprintService = $this->getDeviceFingerprintService($session); + $deviceFingerprintService = $this->getDeviceFingerprintService($this->getContainer()->get(RequestStack::class)); $token = $deviceFingerprintService->getDeviceIdentToken($salesChannelContext); static::assertSame('the-device-ident-token', $token); @@ -41,21 +46,26 @@ public function testItReturnsExistingDeviceIdentTokenFromSession(): void public function testItDeletesDeviceIdentTokenFromSession(): void { $serviceClass = $this->getDeviceFingerprintServiceClass(); - $session = $this->getContainer()->get(SessionInterface::class); - $session->set($serviceClass::SESSION_VAR_NAME, 'the-device-ident-token'); - $deviceFingerprintService = $this->getDeviceFingerprintService($session); + $request = $this->getRequestWithSession([ + $serviceClass::SESSION_VAR_NAME => 'the-device-ident-token', + ]); + $this->getContainer()->get(RequestStack::class)->push($request); + + $deviceFingerprintService = $this->getDeviceFingerprintService($this->getContainer()->get(RequestStack::class)); $deviceFingerprintService->deleteDeviceIdentToken(); - static::assertNull($session->get($serviceClass::SESSION_VAR_NAME)); + static::assertNull($request->getSession()->get($serviceClass::SESSION_VAR_NAME)); } public function testItReturnsTrueIfDeviceIdentTokenIsAlreadyGenerated(): void { $salesChannelContext = $this->getSalesChannelContext(); - $session = $this->getContainer()->get(SessionInterface::class); - $deviceFingerprintService = $this->getDeviceFingerprintService($session); + $request = $this->getRequestWithSession([]); + $this->getContainer()->get(RequestStack::class)->push($request); + + $deviceFingerprintService = $this->getDeviceFingerprintService($this->getContainer()->get(RequestStack::class)); $deviceFingerprintService->getDeviceIdentToken($salesChannelContext); static::assertTrue($deviceFingerprintService->isDeviceIdentTokenAlreadyGenerated()); @@ -63,8 +73,10 @@ public function testItReturnsTrueIfDeviceIdentTokenIsAlreadyGenerated(): void public function testItReturnsFalseIfDeviceIdentTokenIsNotAlreadyGenerated(): void { - $session = $this->getContainer()->get(SessionInterface::class); - $deviceFingerprintService = $this->getDeviceFingerprintService($session); + $request = $this->getRequestWithSession([]); + $this->getContainer()->get(RequestStack::class)->push($request); + + $deviceFingerprintService = $this->getDeviceFingerprintService($this->getContainer()->get(RequestStack::class)); static::assertFalse($deviceFingerprintService->isDeviceIdentTokenAlreadyGenerated()); } @@ -73,8 +85,10 @@ public function testItReturnsDeviceIdentSnippet(): void { $salesChannelContext = $this->getSalesChannelContext(); - $session = $this->getContainer()->get(SessionInterface::class); - $deviceFingerprintService = $this->getDeviceFingerprintService($session); + $request = $this->getRequestWithSession([]); + $this->getContainer()->get(RequestStack::class)->push($request); + + $deviceFingerprintService = $this->getDeviceFingerprintService($this->getContainer()->get(RequestStack::class)); $token = $deviceFingerprintService->getDeviceIdentToken($salesChannelContext); $snippet = $deviceFingerprintService->getDeviceIdentSnippet($token, $salesChannelContext); @@ -88,7 +102,7 @@ abstract protected function getDeviceFingerprintServiceClass(): string; abstract protected function getSupportedPaymentHandlerClass(): string; - abstract protected function getDeviceFingerprintService(SessionInterface $session): AbstractDeviceFingerprintService; + abstract protected function getDeviceFingerprintService(RequestStack $requestStack): AbstractDeviceFingerprintService; abstract protected function getExpectedSnippet(string $token): string; diff --git a/tests/Components/DeviceFingerprint/PayoneBNPLDeviceFingerprintServiceTest.php b/tests/Components/DeviceFingerprint/PayoneBNPLDeviceFingerprintServiceTest.php index eb4daf8bd..dab1304a8 100644 --- a/tests/Components/DeviceFingerprint/PayoneBNPLDeviceFingerprintServiceTest.php +++ b/tests/Components/DeviceFingerprint/PayoneBNPLDeviceFingerprintServiceTest.php @@ -7,7 +7,7 @@ use PayonePayment\Components\ConfigReader\ConfigReaderInterface; use PayonePayment\PaymentHandler\PayoneSecuredInvoicePaymentHandler; use PayonePayment\Struct\Configuration; -use Symfony\Component\HttpFoundation\Session\SessionInterface; +use Symfony\Component\HttpFoundation\RequestStack; /** * @covers \PayonePayment\Components\DeviceFingerprint\PayoneBNPLDeviceFingerprintService @@ -24,7 +24,7 @@ protected function getSupportedPaymentHandlerClass(): string return PayoneSecuredInvoicePaymentHandler::class; } - protected function getDeviceFingerprintService(SessionInterface $session): AbstractDeviceFingerprintService + protected function getDeviceFingerprintService(RequestStack $requestStack): AbstractDeviceFingerprintService { $configuration = $this->createMock(Configuration::class); $configuration->method('getByPrefix')->willReturn('the-merchant-id'); @@ -33,7 +33,7 @@ protected function getDeviceFingerprintService(SessionInterface $session): Abstr $configReader = $this->createMock(ConfigReaderInterface::class); $configReader->method('read')->willReturn($configuration); - return new PayoneBNPLDeviceFingerprintService($session, $configReader); + return new PayoneBNPLDeviceFingerprintService($requestStack, $configReader); } protected function getExpectedSnippet(string $token): string diff --git a/tests/Components/DeviceFingerprint/RatepayDeviceFingerprintServiceTest.php b/tests/Components/DeviceFingerprint/RatepayDeviceFingerprintServiceTest.php index 13e1643c1..e5cc7277f 100644 --- a/tests/Components/DeviceFingerprint/RatepayDeviceFingerprintServiceTest.php +++ b/tests/Components/DeviceFingerprint/RatepayDeviceFingerprintServiceTest.php @@ -7,7 +7,7 @@ use PayonePayment\Components\ConfigReader\ConfigReaderInterface; use PayonePayment\PaymentHandler\PayoneRatepayDebitPaymentHandler; use PayonePayment\Struct\Configuration; -use Symfony\Component\HttpFoundation\Session\SessionInterface; +use Symfony\Component\HttpFoundation\RequestStack; /** * @covers \PayonePayment\Components\DeviceFingerprint\RatepayDeviceFingerprintService @@ -24,7 +24,7 @@ protected function getSupportedPaymentHandlerClass(): string return PayoneRatepayDebitPaymentHandler::class; } - protected function getDeviceFingerprintService(SessionInterface $session): AbstractDeviceFingerprintService + protected function getDeviceFingerprintService(RequestStack $requestStack): AbstractDeviceFingerprintService { $configuration = $this->createMock(Configuration::class); $configuration->method('getByPrefix')->willReturn('ratepay'); @@ -32,7 +32,7 @@ protected function getDeviceFingerprintService(SessionInterface $session): Abstr $configReader = $this->createMock(ConfigReaderInterface::class); $configReader->method('read')->willReturn($configuration); - return new RatepayDeviceFingerprintService($session, $configReader); + return new RatepayDeviceFingerprintService($requestStack, $configReader); } protected function getExpectedSnippet(string $token): string diff --git a/tests/Components/RedirectHandler/RedirectHandlerTest.php b/tests/Components/RedirectHandler/RedirectHandlerTest.php index 0342bdb71..3f6d71f71 100644 --- a/tests/Components/RedirectHandler/RedirectHandlerTest.php +++ b/tests/Components/RedirectHandler/RedirectHandlerTest.php @@ -17,18 +17,6 @@ class RedirectHandlerTest extends TestCase { use KernelTestBehaviour; - private string $appSecret; - - protected function setUp(): void - { - $this->appSecret = getenv('APP_SECRET'); - } - - protected function tearDown(): void - { - putenv('APP_SECRET=' . $this->appSecret); - } - public function testItEncodesUrlWithoutDatabase(): void { $connection = $this->createMock(Connection::class); @@ -46,7 +34,8 @@ static function (array $parameters): bool { $redirectHandler = new RedirectHandler( $connection, - $router + $router, + $this->getContainer()->getParameter('env.app_secret') ); $url = $redirectHandler->encode('the-url'); @@ -64,7 +53,8 @@ public function testItEncodesUrlWithDatabase(): array $redirectHandler = new RedirectHandler( $connection, - $router + $router, + $this->getContainer()->getParameter('env.app_secret') ); $originalUrl = 'the-url'; @@ -94,7 +84,8 @@ public function testItDecodesHashWithDatabase(array $data): void $redirectHandler = new RedirectHandler( $connection, - $router + $router, + $this->getContainer()->getParameter('env.app_secret') ); $originalUrl = $redirectHandler->decode($data['hash']); @@ -107,8 +98,6 @@ public function testItDecodesHashWithDatabase(array $data): void public function testItThrowsExceptionOnEncodingWithMissingSecret(): void { - putenv('APP_SECRET='); - $connection = $this->createMock(Connection::class); $router = $this->getContainer()->get('router.default'); @@ -132,7 +121,8 @@ public function testItThrowsExceptionOnDecodingWithMissingUrl(): void $redirectHandler = new RedirectHandler( $connection, - $router + $router, + $this->getContainer()->getParameter('env.app_secret') ); $this->expectException(\RuntimeException::class); @@ -151,7 +141,8 @@ public function testItCleansUpOldUrls(): void $redirectHandler = new RedirectHandler( $connection, - $router + $router, + $this->getContainer()->getParameter('env.app_secret') ); $redirectHandler->encode('the-url-2'); diff --git a/tests/EventListener/DeviceFingerprintEventListenerTest.php b/tests/EventListener/DeviceFingerprintEventListenerTest.php index 6ef985d6c..366e3a5e7 100644 --- a/tests/EventListener/DeviceFingerprintEventListenerTest.php +++ b/tests/EventListener/DeviceFingerprintEventListenerTest.php @@ -24,6 +24,7 @@ use Shopware\Storefront\Page\Checkout\Confirm\CheckoutConfirmPageLoadedEvent; use Shopware\Storefront\Page\Page; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\RequestStack; /** * @covers \PayonePayment\EventListener\DeviceFingerprintEventListener @@ -34,6 +35,9 @@ class DeviceFingerprintEventListenerTest extends TestCase public function testItAddsDeviceFingerprintDataExtensionOnCheckoutConfirmPage(): void { + $request = $this->getRequestWithSession([]); + $this->getContainer()->get(RequestStack::class)->push($request); + $page = new CheckoutConfirmPage(); $this->setPaymentMethods($page); @@ -52,6 +56,9 @@ public function testItAddsDeviceFingerprintDataExtensionOnCheckoutConfirmPage(): public function testItAddsDeviceFingerprintDataExtensionOnAccountEditOrderPage(): void { + $request = $this->getRequestWithSession([]); + $this->getContainer()->get(RequestStack::class)->push($request); + $page = new AccountEditOrderPage(); $this->setPaymentMethods($page); diff --git a/tests/EventListener/InvoiceRendererEventListenerTest.php b/tests/EventListener/InvoiceRendererEventListenerTest.php new file mode 100644 index 000000000..37136c5f9 --- /dev/null +++ b/tests/EventListener/InvoiceRendererEventListenerTest.php @@ -0,0 +1,108 @@ +setPaymentMethodId(PayonePayolutionInvoicing::UUID); + $transaction->setUniqueIdentifier(Uuid::randomHex()); + + $order = new OrderEntity(); + $order->setTransactions(new OrderTransactionCollection([$transaction])); + $order->setSalesChannelId(TestDefaults::SALES_CHANNEL); + $order->setUniqueIdentifier(Uuid::randomHex()); + + $event = new InvoiceOrdersEvent(new OrderCollection([$order]), Context::createDefaultContext()); + + $configuration = new Configuration([ + 'payolutionInvoicingIban' => 'the-iban', + 'payolutionInvoicingBic' => 'the-bic', + ]); + + $configReader = $this->createMock(ConfigReaderInterface::class); + $configReader->expects(static::once())->method('read')->with(TestDefaults::SALES_CHANNEL)->willReturn($configuration); + + $listener = new InvoiceRendererEventListener($configReader); + $listener->onInvoiceOrdersLoaded($event); + + static::assertTrue($order->hasExtension(InvoiceDocumentData::EXTENSION_NAME)); + + /** @var InvoiceDocumentData $extension */ + $extension = $order->getExtension(InvoiceDocumentData::EXTENSION_NAME); + + static::assertSame('the-iban', $extension->getIban()); + static::assertSame('the-bic', $extension->getBic()); + } + + public function testItNotAddsInvoiceDocumentDataExtensionToOrderOnWrongPaymentMethod(): void + { + $transaction = new OrderTransactionEntity(); + $transaction->setPaymentMethodId(PayonePayolutionInstallment::UUID); + $transaction->setUniqueIdentifier(Uuid::randomHex()); + + $order = new OrderEntity(); + $order->setTransactions(new OrderTransactionCollection([$transaction])); + $order->setSalesChannelId(TestDefaults::SALES_CHANNEL); + $order->setUniqueIdentifier(Uuid::randomHex()); + + $event = new InvoiceOrdersEvent(new OrderCollection([$order]), Context::createDefaultContext()); + + $configReader = $this->createMock(ConfigReaderInterface::class); + $configReader->expects(static::never())->method('read'); + + $listener = new InvoiceRendererEventListener($configReader); + $listener->onInvoiceOrdersLoaded($event); + + static::assertFalse($order->hasExtension(InvoiceDocumentData::EXTENSION_NAME)); + } + + public function testItNotAddsInvoiceDocumentDataExtensionToOrderOnMissingConfiguration(): void + { + $transaction = new OrderTransactionEntity(); + $transaction->setPaymentMethodId(PayonePayolutionInvoicing::UUID); + $transaction->setUniqueIdentifier(Uuid::randomHex()); + + $order = new OrderEntity(); + $order->setTransactions(new OrderTransactionCollection([$transaction])); + $order->setSalesChannelId(TestDefaults::SALES_CHANNEL); + $order->setUniqueIdentifier(Uuid::randomHex()); + + $event = new InvoiceOrdersEvent(new OrderCollection([$order]), Context::createDefaultContext()); + + $configuration = new Configuration([]); + + $configReader = $this->createMock(ConfigReaderInterface::class); + $configReader->expects(static::once())->method('read')->with(TestDefaults::SALES_CHANNEL)->willReturn($configuration); + + $listener = new InvoiceRendererEventListener($configReader); + $listener->onInvoiceOrdersLoaded($event); + + static::assertFalse($order->hasExtension(InvoiceDocumentData::EXTENSION_NAME)); + } +} diff --git a/tests/EventListener/OrderValidationEventListenerTest.php b/tests/EventListener/OrderValidationEventListenerTest.php index 478915bbe..bea9b2d2d 100644 --- a/tests/EventListener/OrderValidationEventListenerTest.php +++ b/tests/EventListener/OrderValidationEventListenerTest.php @@ -6,7 +6,7 @@ use PayonePayment\Components\Validator\Birthday; use PayonePayment\Components\Validator\Iban; -use PayonePayment\PaymentHandler\AbstractPayonePaymentHandler; +use PayonePayment\PaymentHandler\AbstractKlarnaPaymentHandler; use PayonePayment\TestCaseBase\PayoneTestBehavior; use PHPUnit\Framework\TestCase; use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\PaymentHandlerRegistry; @@ -40,11 +40,11 @@ public function testItAddsValidationDefinitions(): void 'sub' => new DataValidationDefinition(), ]; - $paymentHandler = $this->createMock(AbstractPayonePaymentHandler::class); + $paymentHandler = $this->createMock(AbstractKlarnaPaymentHandler::class); $paymentHandler->expects(static::once())->method('getValidationDefinitions')->willReturn($definitions); $paymentHandlerRegistry = $this->createMock(PaymentHandlerRegistry::class); - $paymentHandlerRegistry->expects(static::once())->method('getHandler')->willReturn($paymentHandler); + $paymentHandlerRegistry->expects(static::once())->method('getPaymentMethodHandler')->willReturn($paymentHandler); $listener = new OrderValidationEventListener($requestStack, $paymentHandlerRegistry); $listener->validateOrderData($event); diff --git a/tests/PaymentHandler/PayoneCreditCardPaymentHandlerTest.php b/tests/PaymentHandler/PayoneCreditCardPaymentHandlerTest.php index eba894c6e..6ef98ac40 100644 --- a/tests/PaymentHandler/PayoneCreditCardPaymentHandlerTest.php +++ b/tests/PaymentHandler/PayoneCreditCardPaymentHandlerTest.php @@ -17,7 +17,7 @@ use PayonePayment\TestCaseBase\PayoneTestBehavior; use PHPUnit\Framework\TestCase; use Shopware\Core\Checkout\Payment\Cart\AsyncPaymentTransactionStruct; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Symfony\Component\HttpFoundation\RedirectResponse; @@ -278,7 +278,7 @@ private function getPaymentHandler( if (!$dataHandler) { $dataHandler = new TransactionDataHandler( - $this->createMock(EntityRepositoryInterface::class), + $this->createMock(EntityRepository::class), new CurrencyPrecision() ); } @@ -288,7 +288,7 @@ private function getPaymentHandler( $client, $translator, $dataHandler, - $this->createMock(EntityRepositoryInterface::class), + $this->createMock(EntityRepository::class), new PaymentStateHandler($translator), $cardRepository, $this->getRequestStack($dataBag), diff --git a/tests/PaymentHandler/PayonePaypalPaymentHandlerTest.php b/tests/PaymentHandler/PayonePaypalPaymentHandlerTest.php index 82471bc15..5a5d0f510 100644 --- a/tests/PaymentHandler/PayonePaypalPaymentHandlerTest.php +++ b/tests/PaymentHandler/PayonePaypalPaymentHandlerTest.php @@ -14,7 +14,7 @@ use PayonePayment\TestCaseBase\PayoneTestBehavior; use PHPUnit\Framework\TestCase; use Shopware\Core\Checkout\Payment\Cart\AsyncPaymentTransactionStruct; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Symfony\Component\HttpFoundation\RedirectResponse; @@ -73,8 +73,8 @@ private function getPaymentHandler( $configReader, $client, $translator, - new TransactionDataHandler($this->createMock(EntityRepositoryInterface::class), new CurrencyPrecision()), - $this->createMock(EntityRepositoryInterface::class), + new TransactionDataHandler($this->createMock(EntityRepository::class), new CurrencyPrecision()), + $this->createMock(EntityRepository::class), new PaymentStateHandler($translator), $this->getRequestStack($dataBag), $requestFactory diff --git a/tests/Payone/RequestParameter/Builder/GeneralTransactionRequestParameterBuilderTest.php b/tests/Payone/RequestParameter/Builder/GeneralTransactionRequestParameterBuilderTest.php index d2debfde0..4170c18e4 100644 --- a/tests/Payone/RequestParameter/Builder/GeneralTransactionRequestParameterBuilderTest.php +++ b/tests/Payone/RequestParameter/Builder/GeneralTransactionRequestParameterBuilderTest.php @@ -13,7 +13,7 @@ use PHPUnit\Framework\TestCase; use Shopware\Core\Checkout\Order\Aggregate\OrderTransaction\OrderTransactionCollection; use Shopware\Core\Checkout\Order\Aggregate\OrderTransaction\OrderTransactionEntity; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\Currency\CurrencyEntity; use Symfony\Component\HttpFoundation\ParameterBag; @@ -81,7 +81,7 @@ public function testItAddsCorrectAmountAndCurrency(): void $builder = new GeneralTransactionRequestParameterBuilder( $this->createMock(CartHasherInterface::class), $this->createMock(ConfigReaderInterface::class), - $this->createMock(EntityRepositoryInterface::class), + $this->createMock(EntityRepository::class), $currencyPrecision ); @@ -108,7 +108,7 @@ public function testItAddsCorrectWorkorderId(): void $builder = new GeneralTransactionRequestParameterBuilder( $cartHasher, $this->createMock(ConfigReaderInterface::class), - $this->createMock(EntityRepositoryInterface::class), + $this->createMock(EntityRepository::class), $this->createMock(CurrencyPrecisionInterface::class) ); @@ -130,7 +130,7 @@ public function testItAddsNoWorkorderIdOnMissingHash(): void $builder = new GeneralTransactionRequestParameterBuilder( $this->createMock(CartHasherInterface::class), $this->createMock(ConfigReaderInterface::class), - $this->createMock(EntityRepositoryInterface::class), + $this->createMock(EntityRepository::class), $this->createMock(CurrencyPrecisionInterface::class) ); @@ -156,7 +156,7 @@ public function testItAddsNoWorkorderIdOnInvalidHash(): void $builder = new GeneralTransactionRequestParameterBuilder( $cartHasher, $this->createMock(ConfigReaderInterface::class), - $this->createMock(EntityRepositoryInterface::class), + $this->createMock(EntityRepository::class), $this->createMock(CurrencyPrecisionInterface::class) ); @@ -178,7 +178,7 @@ public function testItAddsOrderNumberAsReference(): void $builder = new GeneralTransactionRequestParameterBuilder( $this->createMock(CartHasherInterface::class), $this->createMock(ConfigReaderInterface::class), - $this->createMock(EntityRepositoryInterface::class), + $this->createMock(EntityRepository::class), $this->createMock(CurrencyPrecisionInterface::class) ); @@ -214,7 +214,7 @@ public function testItAddsOrderNumberWithSuffixAsReference(): void $builder = new GeneralTransactionRequestParameterBuilder( $this->createMock(CartHasherInterface::class), $this->createMock(ConfigReaderInterface::class), - $this->createMock(EntityRepositoryInterface::class), + $this->createMock(EntityRepository::class), $this->createMock(CurrencyPrecisionInterface::class) ); diff --git a/tests/Payone/RequestParameter/Builder/RatepayDebit/AuthorizeRequestParameterBuilderTest.php b/tests/Payone/RequestParameter/Builder/RatepayDebit/AuthorizeRequestParameterBuilderTest.php index 1d8ef1101..972d5e72b 100644 --- a/tests/Payone/RequestParameter/Builder/RatepayDebit/AuthorizeRequestParameterBuilderTest.php +++ b/tests/Payone/RequestParameter/Builder/RatepayDebit/AuthorizeRequestParameterBuilderTest.php @@ -15,7 +15,7 @@ use PayonePayment\TestCaseBase\PaymentTransactionParameterBuilderTestTrait; use PHPUnit\Framework\TestCase; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; -use Symfony\Component\HttpFoundation\Session\SessionInterface; +use Symfony\Component\HttpFoundation\RequestStack; /** * @covers \PayonePayment\Payone\RequestParameter\Builder\RatepayDebit\AuthorizeRequestParameterBuilder @@ -28,10 +28,11 @@ class AuthorizeRequestParameterBuilderTest extends TestCase public function testItAddsCorrectAuthorizeParameters(): void { $this->setValidRatepayProfiles($this->getContainer(), $this->getValidPaymentHandler()); - $this->getContainer()->get(SessionInterface::class)->set( - RatepayDeviceFingerprintService::SESSION_VAR_NAME, - 'the-device-ident-token' - ); + + $request = $this->getRequestWithSession([ + RatepayDeviceFingerprintService::SESSION_VAR_NAME => 'the-device-ident-token', + ]); + $this->getContainer()->get(RequestStack::class)->push($request); $dataBag = new RequestDataBag([ 'ratepayIban' => 'DE81500105177147426471', @@ -69,6 +70,11 @@ public function testItThrowsExceptionOnMissingPhoneNumber(): void { $this->setValidRatepayProfiles($this->getContainer(), $this->getValidPaymentHandler()); + $request = $this->getRequestWithSession([ + RatepayDeviceFingerprintService::SESSION_VAR_NAME => 'the-device-ident-token', + ]); + $this->getContainer()->get(RequestStack::class)->push($request); + $dataBag = new RequestDataBag([ 'ratepayIban' => 'DE81500105177147426471', 'ratepayBirthday' => '2000-01-01', @@ -92,6 +98,11 @@ public function testItAddsCorrectAuthorizeParametersWithSavedPhoneNumber(): void { $this->setValidRatepayProfiles($this->getContainer(), $this->getValidPaymentHandler()); + $request = $this->getRequestWithSession([ + RatepayDeviceFingerprintService::SESSION_VAR_NAME => 'the-device-ident-token', + ]); + $this->getContainer()->get(RequestStack::class)->push($request); + $dataBag = new RequestDataBag([ 'ratepayIban' => 'DE81500105177147426471', 'ratepayBirthday' => '2000-01-01', diff --git a/tests/Payone/RequestParameter/Builder/RatepayDebit/PreAuthorizeRequestParameterBuilderTest.php b/tests/Payone/RequestParameter/Builder/RatepayDebit/PreAuthorizeRequestParameterBuilderTest.php index c919cb8aa..68ad8da81 100644 --- a/tests/Payone/RequestParameter/Builder/RatepayDebit/PreAuthorizeRequestParameterBuilderTest.php +++ b/tests/Payone/RequestParameter/Builder/RatepayDebit/PreAuthorizeRequestParameterBuilderTest.php @@ -14,7 +14,7 @@ use PayonePayment\TestCaseBase\PaymentTransactionParameterBuilderTestTrait; use PHPUnit\Framework\TestCase; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; -use Symfony\Component\HttpFoundation\Session\SessionInterface; +use Symfony\Component\HttpFoundation\RequestStack; /** * @covers \PayonePayment\Payone\RequestParameter\Builder\RatepayDebit\PreAuthorizeRequestParameterBuilder @@ -27,10 +27,11 @@ class PreAuthorizeRequestParameterBuilderTest extends TestCase public function testItAddsCorrectPreAuthorizeParameters(): void { $this->setValidRatepayProfiles($this->getContainer(), $this->getValidPaymentHandler()); - $this->getContainer()->get(SessionInterface::class)->set( - RatepayDeviceFingerprintService::SESSION_VAR_NAME, - 'the-device-ident-token' - ); + + $request = $this->getRequestWithSession([ + RatepayDeviceFingerprintService::SESSION_VAR_NAME => 'the-device-ident-token', + ]); + $this->getContainer()->get(RequestStack::class)->push($request); $dataBag = new RequestDataBag([ 'ratepayIban' => 'DE81500105177147426471', diff --git a/tests/Payone/RequestParameter/Builder/RatepayInstallment/AuthorizeRequestParameterBuilderTest.php b/tests/Payone/RequestParameter/Builder/RatepayInstallment/AuthorizeRequestParameterBuilderTest.php index 379b2aae4..2671049ea 100644 --- a/tests/Payone/RequestParameter/Builder/RatepayInstallment/AuthorizeRequestParameterBuilderTest.php +++ b/tests/Payone/RequestParameter/Builder/RatepayInstallment/AuthorizeRequestParameterBuilderTest.php @@ -15,7 +15,7 @@ use PayonePayment\TestCaseBase\PaymentTransactionParameterBuilderTestTrait; use PHPUnit\Framework\TestCase; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; -use Symfony\Component\HttpFoundation\Session\SessionInterface; +use Symfony\Component\HttpFoundation\RequestStack; /** * @covers \PayonePayment\Payone\RequestParameter\Builder\RatepayInstallment\AuthorizeRequestParameterBuilder @@ -34,10 +34,11 @@ public function testItAddsCorrectAuthorizeParametersWithIban(): void 'tx-limit-installment-min' => '10', ] ); - $this->getContainer()->get(SessionInterface::class)->set( - RatepayDeviceFingerprintService::SESSION_VAR_NAME, - 'the-device-ident-token' - ); + + $request = $this->getRequestWithSession([ + RatepayDeviceFingerprintService::SESSION_VAR_NAME => 'the-device-ident-token', + ]); + $this->getContainer()->get(RequestStack::class)->push($request); $dataBag = new RequestDataBag([ 'ratepayIban' => 'DE81500105177147426471', @@ -92,6 +93,11 @@ public function testItAddsCorrectAuthorizeParametersWithoutIban(): void ] ); + $request = $this->getRequestWithSession([ + RatepayDeviceFingerprintService::SESSION_VAR_NAME => 'the-device-ident-token', + ]); + $this->getContainer()->get(RequestStack::class)->push($request); + $dataBag = new RequestDataBag([ 'ratepayPhone' => '0123456789', 'ratepayBirthday' => '2000-01-01', @@ -125,6 +131,11 @@ public function testItThrowsExceptionOnMissingPhoneNumber(): void ] ); + $request = $this->getRequestWithSession([ + RatepayDeviceFingerprintService::SESSION_VAR_NAME => 'the-device-ident-token', + ]); + $this->getContainer()->get(RequestStack::class)->push($request); + $dataBag = new RequestDataBag([ 'ratepayIban' => 'DE81500105177147426471', 'ratepayBirthday' => '2000-01-01', @@ -159,6 +170,11 @@ public function testItAddsCorrectAuthorizeParametersWithSavedPhoneNumber(): void ] ); + $request = $this->getRequestWithSession([ + RatepayDeviceFingerprintService::SESSION_VAR_NAME => 'the-device-ident-token', + ]); + $this->getContainer()->get(RequestStack::class)->push($request); + $dataBag = new RequestDataBag([ 'ratepayIban' => 'DE81500105177147426471', 'ratepayBirthday' => '2000-01-01', diff --git a/tests/Payone/RequestParameter/Builder/RatepayInstallment/PreAuthorizeRequestParameterBuilderTest.php b/tests/Payone/RequestParameter/Builder/RatepayInstallment/PreAuthorizeRequestParameterBuilderTest.php index 83e333eec..a133844cc 100644 --- a/tests/Payone/RequestParameter/Builder/RatepayInstallment/PreAuthorizeRequestParameterBuilderTest.php +++ b/tests/Payone/RequestParameter/Builder/RatepayInstallment/PreAuthorizeRequestParameterBuilderTest.php @@ -14,7 +14,7 @@ use PayonePayment\TestCaseBase\PaymentTransactionParameterBuilderTestTrait; use PHPUnit\Framework\TestCase; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; -use Symfony\Component\HttpFoundation\Session\SessionInterface; +use Symfony\Component\HttpFoundation\RequestStack; /** * @covers \PayonePayment\Payone\RequestParameter\Builder\RatepayInstallment\PreAuthorizeRequestParameterBuilder @@ -33,10 +33,11 @@ public function testItAddsCorrectPreAuthorizeParameters(): void 'tx-limit-installment-min' => '10', ] ); - $this->getContainer()->get(SessionInterface::class)->set( - RatepayDeviceFingerprintService::SESSION_VAR_NAME, - 'the-device-ident-token' - ); + + $request = $this->getRequestWithSession([ + RatepayDeviceFingerprintService::SESSION_VAR_NAME => 'the-device-ident-token', + ]); + $this->getContainer()->get(RequestStack::class)->push($request); $dataBag = new RequestDataBag([ 'ratepayIban' => 'DE81500105177147426471', diff --git a/tests/Payone/RequestParameter/Builder/RatepayInvoicing/AuthorizeRequestParameterBuilderTest.php b/tests/Payone/RequestParameter/Builder/RatepayInvoicing/AuthorizeRequestParameterBuilderTest.php index 8fa804b15..e998f8173 100644 --- a/tests/Payone/RequestParameter/Builder/RatepayInvoicing/AuthorizeRequestParameterBuilderTest.php +++ b/tests/Payone/RequestParameter/Builder/RatepayInvoicing/AuthorizeRequestParameterBuilderTest.php @@ -15,7 +15,7 @@ use PayonePayment\TestCaseBase\PaymentTransactionParameterBuilderTestTrait; use PHPUnit\Framework\TestCase; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; -use Symfony\Component\HttpFoundation\Session\SessionInterface; +use Symfony\Component\HttpFoundation\RequestStack; /** * @covers \PayonePayment\Payone\RequestParameter\Builder\RatepayInvoicing\AuthorizeRequestParameterBuilder @@ -28,10 +28,11 @@ class AuthorizeRequestParameterBuilderTest extends TestCase public function testItAddsCorrectAuthorizeParameters(): void { $this->setValidRatepayProfiles($this->getContainer(), $this->getValidPaymentHandler()); - $this->getContainer()->get(SessionInterface::class)->set( - RatepayDeviceFingerprintService::SESSION_VAR_NAME, - 'the-device-ident-token' - ); + + $request = $this->getRequestWithSession([ + RatepayDeviceFingerprintService::SESSION_VAR_NAME => 'the-device-ident-token', + ]); + $this->getContainer()->get(RequestStack::class)->push($request); $dataBag = new RequestDataBag([ 'ratepayPhone' => '0123456789', @@ -67,6 +68,11 @@ public function testItThrowsExceptionOnMissingPhoneNumber(): void { $this->setValidRatepayProfiles($this->getContainer(), $this->getValidPaymentHandler()); + $request = $this->getRequestWithSession([ + RatepayDeviceFingerprintService::SESSION_VAR_NAME => 'the-device-ident-token', + ]); + $this->getContainer()->get(RequestStack::class)->push($request); + $dataBag = new RequestDataBag([ 'ratepayBirthday' => '2000-01-01', ]); @@ -89,6 +95,11 @@ public function testItAddsCorrectAuthorizeParametersWithSavedPhoneNumber(): void { $this->setValidRatepayProfiles($this->getContainer(), $this->getValidPaymentHandler()); + $request = $this->getRequestWithSession([ + RatepayDeviceFingerprintService::SESSION_VAR_NAME => 'the-device-ident-token', + ]); + $this->getContainer()->get(RequestStack::class)->push($request); + $dataBag = new RequestDataBag([ 'ratepayBirthday' => '2000-01-01', ]); diff --git a/tests/Payone/RequestParameter/Builder/RatepayInvoicing/PreAuthorizeRequestParameterBuilderTest.php b/tests/Payone/RequestParameter/Builder/RatepayInvoicing/PreAuthorizeRequestParameterBuilderTest.php index bf9343b8b..8edad96c1 100644 --- a/tests/Payone/RequestParameter/Builder/RatepayInvoicing/PreAuthorizeRequestParameterBuilderTest.php +++ b/tests/Payone/RequestParameter/Builder/RatepayInvoicing/PreAuthorizeRequestParameterBuilderTest.php @@ -14,7 +14,7 @@ use PayonePayment\TestCaseBase\PaymentTransactionParameterBuilderTestTrait; use PHPUnit\Framework\TestCase; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; -use Symfony\Component\HttpFoundation\Session\SessionInterface; +use Symfony\Component\HttpFoundation\RequestStack; /** * @covers \PayonePayment\Payone\RequestParameter\Builder\RatepayInvoicing\PreAuthorizeRequestParameterBuilder @@ -27,10 +27,11 @@ class PreAuthorizeRequestParameterBuilderTest extends TestCase public function testItAddsCorrectPreAuthorizeParameters(): void { $this->setValidRatepayProfiles($this->getContainer(), $this->getValidPaymentHandler()); - $this->getContainer()->get(SessionInterface::class)->set( - RatepayDeviceFingerprintService::SESSION_VAR_NAME, - 'the-device-ident-token' - ); + + $request = $this->getRequestWithSession([ + RatepayDeviceFingerprintService::SESSION_VAR_NAME => 'the-device-ident-token', + ]); + $this->getContainer()->get(RequestStack::class)->push($request); $dataBag = new RequestDataBag([ 'ratepayPhone' => '0123456789', diff --git a/tests/Payone/RequestParameter/Builder/SecuredDirectDebit/AuthorizeRequestParameterBuilderTest.php b/tests/Payone/RequestParameter/Builder/SecuredDirectDebit/AuthorizeRequestParameterBuilderTest.php index 35046186e..fe016eaac 100644 --- a/tests/Payone/RequestParameter/Builder/SecuredDirectDebit/AuthorizeRequestParameterBuilderTest.php +++ b/tests/Payone/RequestParameter/Builder/SecuredDirectDebit/AuthorizeRequestParameterBuilderTest.php @@ -14,7 +14,7 @@ use PayonePayment\TestCaseBase\PaymentTransactionParameterBuilderTestTrait; use PHPUnit\Framework\TestCase; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; -use Symfony\Component\HttpFoundation\Session\SessionInterface; +use Symfony\Component\HttpFoundation\RequestStack; /** * @covers \PayonePayment\Payone\RequestParameter\Builder\SecuredDirectDebit\AuthorizeRequestParameterBuilder @@ -25,10 +25,10 @@ class AuthorizeRequestParameterBuilderTest extends TestCase public function testItAddsCorrectAuthorizeParameters(): void { - $this->getContainer()->get(SessionInterface::class)->set( - PayoneBNPLDeviceFingerprintService::SESSION_VAR_NAME, - 'the-device-ident-token' - ); + $request = $this->getRequestWithSession([ + PayoneBNPLDeviceFingerprintService::SESSION_VAR_NAME => 'the-device-ident-token', + ]); + $this->getContainer()->get(RequestStack::class)->push($request); $dataBag = new RequestDataBag([ 'securedDirectDebitPhone' => '0123456789', @@ -66,6 +66,11 @@ public function testItAddsCorrectAuthorizeParameters(): void public function testItThrowsExceptionOnMissingPhoneNumber(): void { + $request = $this->getRequestWithSession([ + PayoneBNPLDeviceFingerprintService::SESSION_VAR_NAME => 'the-device-ident-token', + ]); + $this->getContainer()->get(RequestStack::class)->push($request); + $dataBag = new RequestDataBag([ 'securedDirectDebitBirthday' => '2000-01-01', 'securedDirectDebitIban' => 'DE85500105173716329595', @@ -87,6 +92,11 @@ public function testItThrowsExceptionOnMissingPhoneNumber(): void public function testItThrowsExceptionOnMissingBirthday(): void { + $request = $this->getRequestWithSession([ + PayoneBNPLDeviceFingerprintService::SESSION_VAR_NAME => 'the-device-ident-token', + ]); + $this->getContainer()->get(RequestStack::class)->push($request); + $dataBag = new RequestDataBag([ 'securedDirectDebitPhone' => '0123456789', 'securedDirectDebitIban' => 'DE85500105173716329595', @@ -108,6 +118,11 @@ public function testItThrowsExceptionOnMissingBirthday(): void public function testItAddsCorrectAuthorizeParametersWithSavedPhoneNumber(): void { + $request = $this->getRequestWithSession([ + PayoneBNPLDeviceFingerprintService::SESSION_VAR_NAME => 'the-device-ident-token', + ]); + $this->getContainer()->get(RequestStack::class)->push($request); + $dataBag = new RequestDataBag([ 'securedDirectDebitBirthday' => '2000-01-01', 'securedDirectDebitIban' => 'DE85500105173716329595', @@ -150,6 +165,11 @@ public function testItAddsCorrectAuthorizeParametersWithSavedPhoneNumber(): void public function testItAddsCorrectAuthorizeParametersWithSavedBirthday(): void { + $request = $this->getRequestWithSession([ + PayoneBNPLDeviceFingerprintService::SESSION_VAR_NAME => 'the-device-ident-token', + ]); + $this->getContainer()->get(RequestStack::class)->push($request); + $dataBag = new RequestDataBag([ 'securedDirectDebitPhone' => '0123456789', 'securedDirectDebitIban' => 'DE85500105173716329595', diff --git a/tests/Payone/RequestParameter/Builder/SecuredDirectDebit/PreAuthorizeRequestParameterBuilderTest.php b/tests/Payone/RequestParameter/Builder/SecuredDirectDebit/PreAuthorizeRequestParameterBuilderTest.php index 8840df47c..f795bb83d 100644 --- a/tests/Payone/RequestParameter/Builder/SecuredDirectDebit/PreAuthorizeRequestParameterBuilderTest.php +++ b/tests/Payone/RequestParameter/Builder/SecuredDirectDebit/PreAuthorizeRequestParameterBuilderTest.php @@ -13,7 +13,7 @@ use PayonePayment\TestCaseBase\PaymentTransactionParameterBuilderTestTrait; use PHPUnit\Framework\TestCase; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; -use Symfony\Component\HttpFoundation\Session\SessionInterface; +use Symfony\Component\HttpFoundation\RequestStack; /** * @covers \PayonePayment\Payone\RequestParameter\Builder\SecuredDirectDebit\PreAuthorizeRequestParameterBuilder @@ -24,10 +24,10 @@ class PreAuthorizeRequestParameterBuilderTest extends TestCase public function testItAddsCorrectPreAuthorizeParameters(): void { - $this->getContainer()->get(SessionInterface::class)->set( - PayoneBNPLDeviceFingerprintService::SESSION_VAR_NAME, - 'the-device-ident-token' - ); + $request = $this->getRequestWithSession([ + PayoneBNPLDeviceFingerprintService::SESSION_VAR_NAME => 'the-device-ident-token', + ]); + $this->getContainer()->get(RequestStack::class)->push($request); $dataBag = new RequestDataBag([ 'securedDirectDebitPhone' => '0123456789', diff --git a/tests/Payone/RequestParameter/Builder/SecuredInstallment/AuthorizeRequestParameterBuilderTest.php b/tests/Payone/RequestParameter/Builder/SecuredInstallment/AuthorizeRequestParameterBuilderTest.php index 615fc0be4..13c0f3d59 100644 --- a/tests/Payone/RequestParameter/Builder/SecuredInstallment/AuthorizeRequestParameterBuilderTest.php +++ b/tests/Payone/RequestParameter/Builder/SecuredInstallment/AuthorizeRequestParameterBuilderTest.php @@ -14,7 +14,7 @@ use PayonePayment\TestCaseBase\PaymentTransactionParameterBuilderTestTrait; use PHPUnit\Framework\TestCase; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; -use Symfony\Component\HttpFoundation\Session\SessionInterface; +use Symfony\Component\HttpFoundation\RequestStack; /** * @covers \PayonePayment\Payone\RequestParameter\Builder\SecuredInstallment\AuthorizeRequestParameterBuilder @@ -25,10 +25,10 @@ class AuthorizeRequestParameterBuilderTest extends TestCase public function testItAddsCorrectAuthorizeParameters(): void { - $this->getContainer()->get(SessionInterface::class)->set( - PayoneBNPLDeviceFingerprintService::SESSION_VAR_NAME, - 'the-device-ident-token' - ); + $request = $this->getRequestWithSession([ + PayoneBNPLDeviceFingerprintService::SESSION_VAR_NAME => 'the-device-ident-token', + ]); + $this->getContainer()->get(RequestStack::class)->push($request); $dataBag = new RequestDataBag([ 'securedInstallmentPhone' => '0123456789', @@ -68,6 +68,11 @@ public function testItAddsCorrectAuthorizeParameters(): void public function testItThrowsExceptionOnMissingPhoneNumber(): void { + $request = $this->getRequestWithSession([ + PayoneBNPLDeviceFingerprintService::SESSION_VAR_NAME => 'the-device-ident-token', + ]); + $this->getContainer()->get(RequestStack::class)->push($request); + $dataBag = new RequestDataBag([ 'securedInstallmentBirthday' => '2000-01-01', 'securedInstallmentIban' => 'DE85500105173716329595', @@ -90,6 +95,11 @@ public function testItThrowsExceptionOnMissingPhoneNumber(): void public function testItThrowsExceptionOnMissingBirthday(): void { + $request = $this->getRequestWithSession([ + PayoneBNPLDeviceFingerprintService::SESSION_VAR_NAME => 'the-device-ident-token', + ]); + $this->getContainer()->get(RequestStack::class)->push($request); + $dataBag = new RequestDataBag([ 'securedInstallmentPhone' => '0123456789', 'securedInstallmentIban' => 'DE85500105173716329595', @@ -112,6 +122,11 @@ public function testItThrowsExceptionOnMissingBirthday(): void public function testItAddsCorrectAuthorizeParametersWithSavedPhoneNumber(): void { + $request = $this->getRequestWithSession([ + PayoneBNPLDeviceFingerprintService::SESSION_VAR_NAME => 'the-device-ident-token', + ]); + $this->getContainer()->get(RequestStack::class)->push($request); + $dataBag = new RequestDataBag([ 'securedInstallmentBirthday' => '2000-01-01', 'securedInstallmentIban' => 'DE85500105173716329595', @@ -156,6 +171,11 @@ public function testItAddsCorrectAuthorizeParametersWithSavedPhoneNumber(): void public function testItAddsCorrectAuthorizeParametersWithSavedBirthday(): void { + $request = $this->getRequestWithSession([ + PayoneBNPLDeviceFingerprintService::SESSION_VAR_NAME => 'the-device-ident-token', + ]); + $this->getContainer()->get(RequestStack::class)->push($request); + $dataBag = new RequestDataBag([ 'securedInstallmentPhone' => '0123456789', 'securedInstallmentIban' => 'DE85500105173716329595', diff --git a/tests/Payone/RequestParameter/Builder/SecuredInstallment/PreAuthorizeRequestParameterBuilderTest.php b/tests/Payone/RequestParameter/Builder/SecuredInstallment/PreAuthorizeRequestParameterBuilderTest.php index fd2fc3a4f..c98c61781 100644 --- a/tests/Payone/RequestParameter/Builder/SecuredInstallment/PreAuthorizeRequestParameterBuilderTest.php +++ b/tests/Payone/RequestParameter/Builder/SecuredInstallment/PreAuthorizeRequestParameterBuilderTest.php @@ -13,7 +13,7 @@ use PayonePayment\TestCaseBase\PaymentTransactionParameterBuilderTestTrait; use PHPUnit\Framework\TestCase; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; -use Symfony\Component\HttpFoundation\Session\SessionInterface; +use Symfony\Component\HttpFoundation\RequestStack; /** * @covers \PayonePayment\Payone\RequestParameter\Builder\SecuredInstallment\PreAuthorizeRequestParameterBuilder @@ -24,10 +24,10 @@ class PreAuthorizeRequestParameterBuilderTest extends TestCase public function testItAddsCorrectPreAuthorizeParameters(): void { - $this->getContainer()->get(SessionInterface::class)->set( - PayoneBNPLDeviceFingerprintService::SESSION_VAR_NAME, - 'the-device-ident-token' - ); + $request = $this->getRequestWithSession([ + PayoneBNPLDeviceFingerprintService::SESSION_VAR_NAME => 'the-device-ident-token', + ]); + $this->getContainer()->get(RequestStack::class)->push($request); $dataBag = new RequestDataBag([ 'securedInstallmentPhone' => '0123456789', diff --git a/tests/Payone/RequestParameter/Builder/SecuredInvoice/AuthorizeRequestParameterBuilderTest.php b/tests/Payone/RequestParameter/Builder/SecuredInvoice/AuthorizeRequestParameterBuilderTest.php index e05e2f932..c98dd989d 100644 --- a/tests/Payone/RequestParameter/Builder/SecuredInvoice/AuthorizeRequestParameterBuilderTest.php +++ b/tests/Payone/RequestParameter/Builder/SecuredInvoice/AuthorizeRequestParameterBuilderTest.php @@ -14,7 +14,7 @@ use PayonePayment\TestCaseBase\PaymentTransactionParameterBuilderTestTrait; use PHPUnit\Framework\TestCase; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; -use Symfony\Component\HttpFoundation\Session\SessionInterface; +use Symfony\Component\HttpFoundation\RequestStack; /** * @covers \PayonePayment\Payone\RequestParameter\Builder\SecuredInvoice\AuthorizeRequestParameterBuilder @@ -25,10 +25,10 @@ class AuthorizeRequestParameterBuilderTest extends TestCase public function testItAddsCorrectAuthorizeParameters(): void { - $this->getContainer()->get(SessionInterface::class)->set( - PayoneBNPLDeviceFingerprintService::SESSION_VAR_NAME, - 'the-device-ident-token' - ); + $request = $this->getRequestWithSession([ + PayoneBNPLDeviceFingerprintService::SESSION_VAR_NAME => 'the-device-ident-token', + ]); + $this->getContainer()->get(RequestStack::class)->push($request); $dataBag = new RequestDataBag([ 'securedInvoicePhone' => '0123456789', @@ -63,6 +63,11 @@ public function testItAddsCorrectAuthorizeParameters(): void public function testItThrowsExceptionOnMissingPhoneNumber(): void { + $request = $this->getRequestWithSession([ + PayoneBNPLDeviceFingerprintService::SESSION_VAR_NAME => 'the-device-ident-token', + ]); + $this->getContainer()->get(RequestStack::class)->push($request); + $dataBag = new RequestDataBag([ 'payoneInvoiceBirthday' => '2000-01-01', ]); @@ -83,6 +88,11 @@ public function testItThrowsExceptionOnMissingPhoneNumber(): void public function testItThrowsExceptionOnMissingBirthday(): void { + $request = $this->getRequestWithSession([ + PayoneBNPLDeviceFingerprintService::SESSION_VAR_NAME => 'the-device-ident-token', + ]); + $this->getContainer()->get(RequestStack::class)->push($request); + $dataBag = new RequestDataBag([ 'securedInvoicePhone' => '0123456789', ]); @@ -103,6 +113,11 @@ public function testItThrowsExceptionOnMissingBirthday(): void public function testItAddsCorrectAuthorizeParametersWithSavedPhoneNumber(): void { + $request = $this->getRequestWithSession([ + PayoneBNPLDeviceFingerprintService::SESSION_VAR_NAME => 'the-device-ident-token', + ]); + $this->getContainer()->get(RequestStack::class)->push($request); + $dataBag = new RequestDataBag([ 'payoneInvoiceBirthday' => '2000-01-01', ]); @@ -142,6 +157,11 @@ public function testItAddsCorrectAuthorizeParametersWithSavedPhoneNumber(): void public function testItAddsCorrectAuthorizeParametersWithSavedBirthday(): void { + $request = $this->getRequestWithSession([ + PayoneBNPLDeviceFingerprintService::SESSION_VAR_NAME => 'the-device-ident-token', + ]); + $this->getContainer()->get(RequestStack::class)->push($request); + $dataBag = new RequestDataBag([ 'securedInvoicePhone' => '0123456789', ]); diff --git a/tests/Payone/RequestParameter/Builder/SecuredInvoice/PreAuthorizeRequestParameterBuilderTest.php b/tests/Payone/RequestParameter/Builder/SecuredInvoice/PreAuthorizeRequestParameterBuilderTest.php index 05af5b051..baaa98ffc 100644 --- a/tests/Payone/RequestParameter/Builder/SecuredInvoice/PreAuthorizeRequestParameterBuilderTest.php +++ b/tests/Payone/RequestParameter/Builder/SecuredInvoice/PreAuthorizeRequestParameterBuilderTest.php @@ -13,7 +13,7 @@ use PayonePayment\TestCaseBase\PaymentTransactionParameterBuilderTestTrait; use PHPUnit\Framework\TestCase; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; -use Symfony\Component\HttpFoundation\Session\SessionInterface; +use Symfony\Component\HttpFoundation\RequestStack; /** * @covers \PayonePayment\Payone\RequestParameter\Builder\SecuredInvoice\PreAuthorizeRequestParameterBuilder @@ -24,10 +24,10 @@ class PreAuthorizeRequestParameterBuilderTest extends TestCase public function testItAddsCorrectPreAuthorizeParameters(): void { - $this->getContainer()->get(SessionInterface::class)->set( - PayoneBNPLDeviceFingerprintService::SESSION_VAR_NAME, - 'the-device-ident-token' - ); + $request = $this->getRequestWithSession([ + PayoneBNPLDeviceFingerprintService::SESSION_VAR_NAME => 'the-device-ident-token', + ]); + $this->getContainer()->get(RequestStack::class)->push($request); $dataBag = new RequestDataBag([ 'securedInvoicePhone' => '0123456789', diff --git a/tests/Payone/Webhook/Processor/WebhookProcessorTest.php b/tests/Payone/Webhook/Processor/WebhookProcessorTest.php index 6938c9f88..6deb8f5a0 100644 --- a/tests/Payone/Webhook/Processor/WebhookProcessorTest.php +++ b/tests/Payone/Webhook/Processor/WebhookProcessorTest.php @@ -22,7 +22,6 @@ use Shopware\Core\Checkout\Order\OrderEntity; use Shopware\Core\Checkout\Payment\PaymentMethodEntity; use Shopware\Core\Checkout\Test\Cart\Common\Generator; -use Shopware\Core\Defaults; use Shopware\Core\Framework\Context; use Shopware\Core\Framework\DataAbstractionLayer\Pricing\CashRoundingConfig; use Shopware\Core\System\Currency\CurrencyEntity; @@ -30,6 +29,7 @@ use Shopware\Core\System\StateMachine\Aggregation\StateMachineTransition\StateMachineTransitionActions; use Shopware\Core\System\StateMachine\StateMachineRegistry; use Shopware\Core\System\StateMachine\Transition; +use Shopware\Core\Test\TestDefaults; use Symfony\Component\HttpFoundation\Request; /** @@ -41,7 +41,7 @@ public function testItAppointsCreditCard(): void { $context = Context::createDefaultContext(); $salesChannelContext = Generator::createSalesChannelContext($context); - $salesChannelContext->getSalesChannel()->setId(Defaults::SALES_CHANNEL); + $salesChannelContext->getSalesChannel()->setId(TestDefaults::SALES_CHANNEL); $request = new Request(); $request->request->set('key', md5('')); @@ -62,7 +62,7 @@ public function testItPartialCapturesCreditCard(): void { $context = Context::createDefaultContext(); $salesChannelContext = Generator::createSalesChannelContext($context); - $salesChannelContext->getSalesChannel()->setId(Defaults::SALES_CHANNEL); + $salesChannelContext->getSalesChannel()->setId(TestDefaults::SALES_CHANNEL); $request = new Request(); $request->request->set('key', md5('')); @@ -84,7 +84,7 @@ public function testItFullCapturesCreditCard(): void { $context = Context::createDefaultContext(); $salesChannelContext = Generator::createSalesChannelContext($context); - $salesChannelContext->getSalesChannel()->setId(Defaults::SALES_CHANNEL); + $salesChannelContext->getSalesChannel()->setId(TestDefaults::SALES_CHANNEL); $request = new Request(); $request->request->set('key', md5('')); @@ -107,7 +107,7 @@ public function testItProcessesPaidCreditCard(): void { $context = Context::createDefaultContext(); $salesChannelContext = Generator::createSalesChannelContext($context); - $salesChannelContext->getSalesChannel()->setId(Defaults::SALES_CHANNEL); + $salesChannelContext->getSalesChannel()->setId(TestDefaults::SALES_CHANNEL); $request = new Request(); $request->request->set('key', md5('')); @@ -128,7 +128,7 @@ protected function getWebhookProcessor(string $transition, array $transactionDat { $context = Context::createDefaultContext(); $salesChannelContext = Generator::createSalesChannelContext($context); - $salesChannelContext->getSalesChannel()->setId(Defaults::SALES_CHANNEL); + $salesChannelContext->getSalesChannel()->setId(TestDefaults::SALES_CHANNEL); $stateMachineRegistry = $this->createMock(StateMachineRegistry::class); $stateMachineRegistry->expects(static::once())->method('transition')->with( @@ -169,7 +169,7 @@ protected function getWebhookProcessor(string $transition, array $transactionDat $orderEntity = new OrderEntity(); $orderEntity->setId(Constants::ORDER_ID); - $orderEntity->setSalesChannelId(Defaults::SALES_CHANNEL); + $orderEntity->setSalesChannelId(TestDefaults::SALES_CHANNEL); $orderEntity->setAmountTotal(100); $orderEntity->setCurrencyId(Constants::CURRENCY_ID); $orderEntity->setCurrency($currency); diff --git a/tests/Storefront/Controller/Account/AccountOrderControllerDecoratorTest.php b/tests/Storefront/Controller/Account/AccountOrderControllerDecoratorTest.php index 339782ce6..efb284d2b 100644 --- a/tests/Storefront/Controller/Account/AccountOrderControllerDecoratorTest.php +++ b/tests/Storefront/Controller/Account/AccountOrderControllerDecoratorTest.php @@ -11,7 +11,7 @@ use Shopware\Core\Checkout\Order\Aggregate\OrderTransaction\OrderTransactionCollection; use Shopware\Core\Checkout\Order\OrderEntity; use Shopware\Core\Framework\DataAbstractionLayer\EntityCollection; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; use Shopware\Core\Framework\DataAbstractionLayer\Search\EntitySearchResult; use Shopware\Core\Framework\Uuid\Uuid; @@ -38,7 +38,7 @@ public function testItRedirectsFromEditOrderPageToOverviewPageOnRatepayOrder(): $paymentTransaction = $this->getPaymentTransaction($order, PayoneRatepayDebitPaymentHandler::class); $order->setTransactions(new OrderTransactionCollection([$paymentTransaction->getOrderTransaction()])); - $orderRepository = $this->createMock(EntityRepositoryInterface::class); + $orderRepository = $this->createMock(EntityRepository::class); $orderRepository->expects(static::once())->method('search')->willReturn( $this->getEntitySearchResult($order, $salesChannelContext) ); @@ -64,7 +64,7 @@ public function testItNotRedirectsFromEditOrderPageToOverviewPageOnOtherPaymentM $paymentTransaction = $this->getPaymentTransaction($order, PayoneDebitPaymentHandler::class); $order->setTransactions(new OrderTransactionCollection([$paymentTransaction->getOrderTransaction()])); - $orderRepository = $this->createMock(EntityRepositoryInterface::class); + $orderRepository = $this->createMock(EntityRepository::class); $orderRepository->expects(static::once())->method('search')->willReturn( $this->getEntitySearchResult($order, $salesChannelContext) ); @@ -95,7 +95,7 @@ public function testItRedirectsFromUpdateOrderRequestToOverviewPageOnRatepayOrde $paymentTransaction = $this->getPaymentTransaction($order, PayoneRatepayDebitPaymentHandler::class); $order->setTransactions(new OrderTransactionCollection([$paymentTransaction->getOrderTransaction()])); - $orderRepository = $this->createMock(EntityRepositoryInterface::class); + $orderRepository = $this->createMock(EntityRepository::class); $orderRepository->expects(static::once())->method('search')->willReturn( $this->getEntitySearchResult($order, $salesChannelContext) ); @@ -121,7 +121,7 @@ public function testItNotRedirectsFromUpdateOrderRequestToOverviewPageOnOtherPay $paymentTransaction = $this->getPaymentTransaction($order, PayoneDebitPaymentHandler::class); $order->setTransactions(new OrderTransactionCollection([$paymentTransaction->getOrderTransaction()])); - $orderRepository = $this->createMock(EntityRepositoryInterface::class); + $orderRepository = $this->createMock(EntityRepository::class); $orderRepository->expects(static::once())->method('search')->willReturn( $this->getEntitySearchResult($order, $salesChannelContext) ); @@ -176,7 +176,7 @@ public function testItCallsParentFunctions(): void $controller = new AccountOrderControllerDecorator( $decoratedController, - $this->createMock(EntityRepositoryInterface::class) + $this->createMock(EntityRepository::class) ); $controller->orderOverview($request, $salesChannelContext); diff --git a/tests/TestCaseBase/Factory/TransactionStatusWebhookHandlerFactory.php b/tests/TestCaseBase/Factory/TransactionStatusWebhookHandlerFactory.php index 219c834bf..49ba4bc08 100644 --- a/tests/TestCaseBase/Factory/TransactionStatusWebhookHandlerFactory.php +++ b/tests/TestCaseBase/Factory/TransactionStatusWebhookHandlerFactory.php @@ -17,7 +17,7 @@ use Shopware\Core\Checkout\Order\Aggregate\OrderTransaction\OrderTransactionEntity; use Shopware\Core\Framework\Context; use Shopware\Core\Framework\DataAbstractionLayer\EntityCollection; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; +use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\DataAbstractionLayer\Event\EntityWrittenContainerEvent; use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; use Shopware\Core\Framework\DataAbstractionLayer\Search\EntitySearchResult; @@ -45,7 +45,7 @@ public static function createTransactionStatusService( ?OrderTransactionEntity $transaction = null ): TransactionStatusServiceInterface { /** @var MockObject $entityRepositoryMock */ - $entityRepositoryMock = (new Generator())->getMock(EntityRepositoryInterface::class); + $entityRepositoryMock = (new Generator())->getMock(EntityRepository::class, [], [], '', false); try { $entitySearchResult = new EntitySearchResult( @@ -64,7 +64,7 @@ public static function createTransactionStatusService( $entityRepositoryMock->method('search')->willReturn($entitySearchResult); $entityRepositoryMock->method('update')->willReturn(new EntityWrittenContainerEvent(Context::createDefaultContext(), new NestedEventCollection(), [])); - /** @var EntityRepositoryInterface $entityRepositoryMock */ + /** @var EntityRepository $entityRepositoryMock */ return new TransactionStatusService( $stateMachineRegistry, new ConfigReaderMock($configuration), diff --git a/tests/TestCaseBase/PayoneTestBehavior.php b/tests/TestCaseBase/PayoneTestBehavior.php index 9f6af6d88..4532cf25e 100644 --- a/tests/TestCaseBase/PayoneTestBehavior.php +++ b/tests/TestCaseBase/PayoneTestBehavior.php @@ -35,10 +35,12 @@ use Shopware\Core\Defaults; use Shopware\Core\Framework\Context; use Shopware\Core\Framework\Test\TestCaseBase\IntegrationTestBehaviour; +use Shopware\Core\Framework\Test\TestCaseBase\SessionTestBehaviour; use Shopware\Core\Framework\Uuid\Uuid; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Shopware\Core\System\StateMachine\Aggregation\StateMachineState\StateMachineStateEntity; +use Shopware\Core\Test\TestDefaults; use Shopware\Storefront\Page\Checkout\Confirm\CheckoutConfirmPageLoader; use Shopware\Storefront\Test\Page\StorefrontPageTestBehaviour; use Symfony\Component\HttpFoundation\ParameterBag; @@ -49,6 +51,7 @@ trait PayoneTestBehavior { use IntegrationTestBehaviour; use StorefrontPageTestBehaviour; + use SessionTestBehaviour; /** * @deprecated use `createCartWithProduct` @@ -110,7 +113,7 @@ protected function createProduct(float $price): string 'visibilities' => [ [ 'id' => $productId, - 'salesChannelId' => Defaults::SALES_CHANNEL, + 'salesChannelId' => TestDefaults::SALES_CHANNEL, 'visibility' => ProductVisibilityDefinition::VISIBILITY_ALL, ], ], @@ -152,7 +155,7 @@ protected function getRatepayProfileStruct( return new RatepayProfileStruct( '88880103', 'EUR', - Defaults::SALES_CHANNEL, + TestDefaults::SALES_CHANNEL, $paymentHandler, $requestAction ); @@ -278,4 +281,18 @@ protected function getPageLoader(): CheckoutConfirmPageLoader { return $this->getContainer()->get(CheckoutConfirmPageLoader::class); } + + protected function getRequestWithSession(array $sessionVariables): Request + { + $session = $this->getSession(); + + foreach ($sessionVariables as $key => $value) { + $session->set($key, $value); + } + + $request = new Request(); + $request->setSession($session); + + return $request; + } } From ca76bcdc2daa71a468d57f49c7045772e73875fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20M=C3=BCller?= Date: Thu, 27 Apr 2023 14:50:02 +0200 Subject: [PATCH 06/41] [PAYONE-184] Add changes made by rector (up to PHP 8.1) --- .../AutomaticCaptureService.php | 30 ++----- .../CardRepository/CardRepository.php | 6 +- src/Components/CartHasher/CartHasher.php | 16 ++-- .../CartValidator/ZeroAmountCartValidator.php | 7 +- src/Components/ConfigReader/ConfigReader.php | 6 +- src/Components/Currency/CurrencyPrecision.php | 2 +- .../Transaction/TransactionDataHandler.php | 11 +-- .../PayoneBNPLDeviceFingerprintService.php | 7 +- .../RatepayDeviceFingerprintService.php | 9 +-- .../Document/Struct/InvoiceDocumentData.php | 2 +- src/Components/Helper/OrderFetcher.php | 2 +- .../LineItemHydrator/LineItemHydrator.php | 29 +++---- .../KlarnaSessionService.php | 19 ++--- .../MandateService/MandateService.php | 18 ++--- .../DefaultPaymentFilterService.php | 37 +-------- .../FilteredPaymentMethodRoute.php | 21 ++--- .../PaymentFilter/IterablePaymentFilter.php | 5 +- .../PaymentFilter/PaymentFilterContext.php | 18 +---- .../PaymentFilterContextFactory.php | 5 +- .../PayonePaymentMethodValidator.php | 12 +-- .../PaymentStateHandler.php | 2 +- .../Installment/InstallmentService.php | 19 ++--- .../Ratepay/Profile/ProfileService.php | 27 +++---- .../RedirectHandler/RedirectHandler.php | 9 +-- .../SecuredInstallment/InstallmentService.php | 14 +--- .../AbstractTransactionHandler.php | 2 +- .../Capture/CaptureTransactionHandler.php | 5 +- .../Refund/RefundTransactionHandler.php | 5 +- .../TransactionStatusService.php | 81 +++++++++---------- src/Components/Validator/Birthday.php | 2 +- src/Components/Validator/PaymentMethod.php | 2 +- .../Validator/PaymentMethodValidator.php | 4 +- src/Controller/CaptureController.php | 5 +- src/Controller/RedirectController.php | 7 +- src/Controller/RefundController.php | 5 +- src/Controller/SettingsController.php | 76 ++++++++--------- src/Controller/WebhookController.php | 9 +-- .../Card/PayonePaymentCardDefinition.php | 2 +- .../PayonePaymentMandateDefinition.php | 2 +- ...nePaymentNotificationForwardDefinition.php | 2 +- ...onePaymentNotificationTargetDefinition.php | 2 +- ...PayonePaymentOrderTransactionExtension.php | 2 +- .../CheckoutConfirmApplePayEventListener.php | 5 +- .../CheckoutConfirmCartDataEventListener.php | 16 +--- ...CheckoutConfirmCreditCardEventListener.php | 14 +--- .../CheckoutConfirmDebitEventListener.php | 5 +- .../CheckoutConfirmEpsEventListener.php | 4 +- .../CheckoutConfirmIDealEventListener.php | 4 +- ...ckoutConfirmKlarnaPaymentEventListener.php | 9 +-- ...CheckoutConfirmPayolutionEventListener.php | 9 +-- .../CheckoutConfirmRatepayEventListener.php | 14 +--- ...ConfirmSecuredInstallmentEventListener.php | 9 +-- .../CheckoutConfirmTrustlyEventListener.php | 4 +- .../CheckoutFinishEventListener.php | 4 +- .../DeviceFingerprintEventListener.php | 5 +- .../InvoiceRendererEventListener.php | 5 +- src/EventListener/KernelEventListener.php | 7 +- .../OrderValidationEventListener.php | 4 +- ...lExpressAddressValidationEventListener.php | 6 +- src/EventListener/RemovesPaymentMethod.php | 4 +- .../StorefrontRenderEventListener.php | 11 +-- src/Installer/ConfigInstaller.php | 18 ++--- src/Installer/CustomFieldInstaller.php | 24 +++--- src/Installer/PaymentMethodInstaller.php | 20 ++--- .../RuleInstallerSecureInvoice.php | 16 ++-- ...ion1557926559AddTemporaryRedirectTable.php | 2 +- ...ion1561379069AddPayonePaymentCardTable.php | 2 +- ...1562097986AddPayonePaymentMandateTable.php | 2 +- ...n1580996279AddRedirectTableCreatedDate.php | 2 +- ...n1625137302AddNotificationForwardTable.php | 2 +- ...on1625137302AddNotificationTargetTable.php | 2 +- ...tion1637576753FixForeignKeyConstraints.php | 2 +- ...1638289341AddOrderTransActionDataTable.php | 2 +- ...teOrderTransactionDataFromCustomFields.php | 6 +- ...ration1666770470AddCardTypeToCardTable.php | 2 +- .../AbstractKlarnaPaymentHandler.php | 25 ++---- .../AbstractPayoneInvoicePaymentHandler.php | 20 ++--- .../AbstractPayonePaymentHandler.php | 41 +++++----- .../AbstractPostfinancePaymentHandler.php | 31 +++---- .../PayoneAlipayPaymentHandler.php | 33 +++----- .../PayoneApplePayPaymentHandler.php | 13 +-- .../PayoneBancontactPaymentHandler.php | 33 +++----- .../PayoneCreditCardPaymentHandler.php | 46 ++++------- .../PayoneDebitPaymentHandler.php | 29 ++----- .../PayoneEpsPaymentHandler.php | 31 +++---- .../PayoneIDealPaymentHandler.php | 31 +++---- .../PayoneOpenInvoicePaymentHandler.php | 2 +- .../PayonePaydirektPaymentHandler.php | 29 ++----- .../PayonePayolutionDebitPaymentHandler.php | 22 ++--- ...onePayolutionInstallmentPaymentHandler.php | 27 ++----- ...ayonePayolutionInvoicingPaymentHandler.php | 22 ++--- .../PayonePaypalExpressPaymentHandler.php | 29 ++----- .../PayonePaypalPaymentHandler.php | 29 ++----- .../PayonePrepaymentPaymentHandler.php | 24 ++---- .../PayonePrzelewy24PaymentHandler.php | 27 ++----- .../PayoneRatepayDebitPaymentHandler.php | 25 ++---- ...PayoneRatepayInstallmentPaymentHandler.php | 25 ++---- .../PayoneRatepayInvoicingPaymentHandler.php | 27 ++----- .../PayoneSecureInvoicePaymentHandler.php | 2 +- ...PayoneSecuredDirectDebitPaymentHandler.php | 27 ++----- ...PayoneSecuredInstallmentPaymentHandler.php | 27 ++----- .../PayoneSecuredInvoicePaymentHandler.php | 27 ++----- .../PayoneSofortBankingPaymentHandler.php | 29 ++----- .../PayoneTrustlyPaymentHandler.php | 33 +++----- .../PayoneWeChatPayPaymentHandler.php | 33 +++----- src/PaymentMethod/PayoneAlipay.php | 2 +- src/PaymentMethod/PayoneApplePay.php | 2 +- src/PaymentMethod/PayoneBancontact.php | 2 +- src/PaymentMethod/PayoneCreditCard.php | 2 +- src/PaymentMethod/PayoneDebit.php | 2 +- src/PaymentMethod/PayoneEps.php | 2 +- src/PaymentMethod/PayoneIDeal.php | 2 +- src/PaymentMethod/PayoneKlarnaDirectDebit.php | 2 +- src/PaymentMethod/PayoneKlarnaInstallment.php | 2 +- src/PaymentMethod/PayoneKlarnaInvoice.php | 2 +- src/PaymentMethod/PayoneOpenInvoice.php | 2 +- src/PaymentMethod/PayonePaydirekt.php | 2 +- src/PaymentMethod/PayonePayolutionDebit.php | 2 +- .../PayonePayolutionInstallment.php | 2 +- .../PayonePayolutionInvoicing.php | 2 +- src/PaymentMethod/PayonePaypal.php | 2 +- src/PaymentMethod/PayonePaypalExpress.php | 2 +- src/PaymentMethod/PayonePostfinanceCard.php | 2 +- src/PaymentMethod/PayonePostfinanceWallet.php | 2 +- src/PaymentMethod/PayonePrepayment.php | 2 +- src/PaymentMethod/PayonePrzelewy24.php | 2 +- src/PaymentMethod/PayoneRatepayDebit.php | 2 +- .../PayoneRatepayInstallment.php | 2 +- src/PaymentMethod/PayoneRatepayInvoicing.php | 2 +- src/PaymentMethod/PayoneSecureInvoice.php | 6 +- .../PayoneSecuredDirectDebit.php | 2 +- .../PayoneSecuredInstallment.php | 2 +- src/PaymentMethod/PayoneSecuredInvoice.php | 2 +- src/PaymentMethod/PayoneSofortBanking.php | 2 +- src/PaymentMethod/PayoneTrustly.php | 2 +- src/PaymentMethod/PayoneWeChatPay.php | 2 +- .../Exception/PayoneRequestException.php | 9 +-- src/Payone/Client/PayoneClient.php | 5 +- .../AbstractRequestParameterBuilder.php | 52 ++++++------ .../AuthorizeRequestParameterBuilder.php | 7 +- .../CaptureRequestParameterBuilder.php | 15 ++-- ...omerInformationRequestParameterBuilder.php | 3 +- .../CustomerRequestParameterBuilder.php | 10 +-- ...eralTransactionRequestParameterBuilder.php | 19 +---- .../AuthorizeRequestParameterBuilder.php | 5 +- .../CreateSessionRequestParameterBuilder.php | 17 +--- .../AuthorizeRequestParameterBuilder.php | 5 +- .../OrderLinesRequestParameterBuilder.php | 7 +- .../AuthorizeRequestParameterBuilder.php | 10 +-- .../PreCheckRequestParameterBuilder.php | 2 +- .../AbstractRequestParameterBuilder.php | 4 +- .../AuthorizeRequestParameterBuilder.php | 20 +---- .../AuthorizeRequestParameterBuilder.php | 5 +- .../CalculationRequestParameterBuilder.php | 4 +- .../Refund/RefundRequestParameterBuilder.php | 5 +- .../ReturnUrlRequestParameterBuilder.php | 8 +- .../AuthorizeRequestParameterBuilder.php | 5 +- .../AuthorizeRequestParameterBuilder.php | 20 +---- .../AuthorizeRequestParameterBuilder.php | 20 +---- .../AuthorizeRequestParameterBuilder.php | 20 +---- .../Builder/SystemRequestParameterBuilder.php | 12 +-- .../RequestParameterFactory.php | 15 ++-- .../Struct/ApplePayTransactionStruct.php | 5 +- .../Struct/CheckoutDetailsStruct.php | 5 +- .../RequestParameter/Struct/GetFileStruct.php | 5 +- .../Struct/KlarnaCreateSessionStruct.php | 2 +- .../Struct/ManageMandateStruct.php | 10 +-- .../Struct/RatepayCalculationStruct.php | 5 +- .../Struct/RatepayProfileStruct.php | 15 +--- .../Struct/TestCredentialsStruct.php | 5 +- .../Handler/NotificationForwardHandler.php | 15 ++-- .../TransactionStatusWebhookHandler.php | 22 +---- .../Command/NotificationForwardCommand.php | 5 +- .../NotificationForwardHandler.php | 9 +-- .../Webhook/Processor/WebhookProcessor.php | 18 ++--- src/PayonePayment.php | 2 +- src/ScheduledTask/RedirectCleanUpHandler.php | 11 +-- src/StoreApi/Route/ApplePayRoute.php | 33 +++----- src/StoreApi/Route/CardRoute.php | 5 +- src/StoreApi/Route/MandateRoute.php | 7 +- .../Account/AccountCardController.php | 10 +-- .../Account/AccountMandateController.php | 10 +-- .../Debit/ManageMandateController.php | 16 +--- .../Payolution/PayolutionController.php | 45 +++-------- .../Paypal/PaypalExpressController.php | 37 ++++----- .../Controller/Ratepay/RatepayController.php | 7 +- .../Page/Card/AccountCardPageLoadedEvent.php | 7 +- .../Page/Card/AccountCardPageLoader.php | 12 +-- .../Mandate/AccountMandatePageLoadedEvent.php | 7 +- .../Page/Mandate/AccountMandatePageLoader.php | 12 +-- .../Struct/CheckoutCartPaymentData.php | 8 +- .../Struct/CheckoutConfirmPaymentData.php | 2 +- .../Struct/CheckoutFinishPaymentData.php | 2 +- .../Struct/CheckoutKlarnaSessionData.php | 10 +-- .../Struct/DeviceFingerprintData.php | 2 +- .../RatepayInstallmentCalculatorData.php | 2 +- .../Struct/SecuredInstallmentOptionsData.php | 2 +- src/Struct/Configuration.php | 19 +---- 198 files changed, 729 insertions(+), 1616 deletions(-) diff --git a/src/Components/AutomaticCaptureService/AutomaticCaptureService.php b/src/Components/AutomaticCaptureService/AutomaticCaptureService.php index 70c79b2f9..75ff102d9 100644 --- a/src/Components/AutomaticCaptureService/AutomaticCaptureService.php +++ b/src/Components/AutomaticCaptureService/AutomaticCaptureService.php @@ -17,20 +17,8 @@ class AutomaticCaptureService implements AutomaticCaptureServiceInterface { - protected ConfigReaderInterface $configReader; - - protected CaptureTransactionHandlerInterface $captureTransactionHandler; - - protected LoggerInterface $logger; - - public function __construct( - ConfigReaderInterface $configReader, - CaptureTransactionHandlerInterface $captureTransactionHandler, - LoggerInterface $logger - ) { - $this->configReader = $configReader; - $this->captureTransactionHandler = $captureTransactionHandler; - $this->logger = $logger; + public function __construct(protected ConfigReaderInterface $configReader, protected CaptureTransactionHandlerInterface $captureTransactionHandler, protected LoggerInterface $logger) + { } public function captureIfPossible(PaymentTransaction $paymentTransaction, SalesChannelContext $salesChannelContext): void @@ -86,14 +74,12 @@ public function captureIfPossible(PaymentTransaction $paymentTransaction, SalesC 'amount' => $order->getAmountTotal(), 'complete' => true, 'includeShippingCosts' => true, - 'orderLines' => $orderLines->map(static function (OrderLineItemEntity $lineItem) { - return [ - 'id' => $lineItem->getId(), - 'quantity' => $lineItem->getQuantity(), - 'unit_price' => $lineItem->getUnitPrice(), - 'selected' => false, - ]; - }), + 'orderLines' => $orderLines->map(static fn(OrderLineItemEntity $lineItem) => [ + 'id' => $lineItem->getId(), + 'quantity' => $lineItem->getQuantity(), + 'unit_price' => $lineItem->getUnitPrice(), + 'selected' => false, + ]), 'orderTransactionId' => $orderTransaction->getId(), 'payone_order_id' => $payoneExtension->getTransactionId(), 'salesChannel' => $salesChannelContext->getSalesChannel()->getVars(), diff --git a/src/Components/CardRepository/CardRepository.php b/src/Components/CardRepository/CardRepository.php index 8447b03a5..799546a0a 100644 --- a/src/Components/CardRepository/CardRepository.php +++ b/src/Components/CardRepository/CardRepository.php @@ -16,7 +16,7 @@ class CardRepository implements CardRepositoryInterface { - private EntityRepository $cardRepository; + private readonly EntityRepository $cardRepository; public function __construct(EntityRepository $cardRepository) { @@ -93,9 +93,7 @@ public function removeAllCardsForCustomer(CustomerEntity $customer, Context $con { $cards = $this->getCards($customer, $context); - $ids = array_map(static function ($item) { - return ['id' => $item]; - }, array_values($cards->getIds())); + $ids = array_map(static fn($item) => ['id' => $item], array_values($cards->getIds())); $this->cardRepository->delete($ids, $context); } diff --git a/src/Components/CartHasher/CartHasher.php b/src/Components/CartHasher/CartHasher.php index 90189300b..156565e07 100644 --- a/src/Components/CartHasher/CartHasher.php +++ b/src/Components/CartHasher/CartHasher.php @@ -23,14 +23,8 @@ class CartHasher implements CartHasherInterface OrderEntity::class, ]; - private CurrencyPrecisionInterface $currencyPrecision; - - private string $appSecret; - - public function __construct(CurrencyPrecisionInterface $currencyPrecision, string $appSecret = '') + public function __construct(private readonly CurrencyPrecisionInterface $currencyPrecision, private readonly string $appSecret = '') { - $this->currencyPrecision = $currencyPrecision; - $this->appSecret = $appSecret; } /** @@ -38,7 +32,7 @@ public function __construct(CurrencyPrecisionInterface $currencyPrecision, strin */ public function generate(Struct $entity, SalesChannelContext $context): string { - if (!\in_array(\get_class($entity), self::VALID_TYPES, true)) { + if (!\in_array($entity::class, self::VALID_TYPES, true)) { throw new \LogicException('unsupported struct type during hash creation or validation'); } @@ -52,7 +46,7 @@ public function generate(Struct $entity, SalesChannelContext $context): string */ public function validate(Struct $entity, string $cartHash, SalesChannelContext $context): bool { - if (!\in_array(\get_class($entity), self::VALID_TYPES, true)) { + if (!\in_array($entity::class, self::VALID_TYPES, true)) { throw new \LogicException('unsupported struct type during hash creation or validation'); } $hashData = $this->getHashData($entity, $context); @@ -113,7 +107,7 @@ private function getHashData(Struct $entity, SalesChannelContext $context): arra && (!method_exists($lineItem, 'getParentId') || $lineItem->getParentId() === null)) { continue; } - } catch (\Exception $exception) { + } catch (\Exception) { // Catch class not found if SwagCustomizedProducts plugin is not installed } @@ -127,7 +121,7 @@ private function getHashData(Struct $entity, SalesChannelContext $context): arra $detail['price'] = $this->currencyPrecision->getRoundedItemAmount($lineItem->getPrice()->getTotalPrice(), $context->getCurrency()); } - $hashData['items'][] = md5((string) json_encode($detail)); + $hashData['items'][] = md5((string) json_encode($detail, JSON_THROW_ON_ERROR)); } } diff --git a/src/Components/CartValidator/ZeroAmountCartValidator.php b/src/Components/CartValidator/ZeroAmountCartValidator.php index deebcc8c8..c51c6a0b2 100644 --- a/src/Components/CartValidator/ZeroAmountCartValidator.php +++ b/src/Components/CartValidator/ZeroAmountCartValidator.php @@ -14,11 +14,8 @@ class ZeroAmountCartValidator implements CartValidatorInterface { - protected CurrencyPrecisionInterface $currencyPrecision; - - public function __construct(CurrencyPrecisionInterface $currencyPrecision) + public function __construct(protected CurrencyPrecisionInterface $currencyPrecision) { - $this->currencyPrecision = $currencyPrecision; } public function validate(Cart $cart, ErrorCollection $errors, SalesChannelContext $context): void @@ -31,7 +28,7 @@ public function validate(Cart $cart, ErrorCollection $errors, SalesChannelContex return; } - if (mb_strpos($context->getPaymentMethod()->getHandlerIdentifier(), PaymentMethodInstaller::HANDLER_IDENTIFIER_ROOT_NAMESPACE) === false) { + if (mb_strpos((string) $context->getPaymentMethod()->getHandlerIdentifier(), PaymentMethodInstaller::HANDLER_IDENTIFIER_ROOT_NAMESPACE) === false) { return; } diff --git a/src/Components/ConfigReader/ConfigReader.php b/src/Components/ConfigReader/ConfigReader.php index 13215d665..0de2c4d75 100644 --- a/src/Components/ConfigReader/ConfigReader.php +++ b/src/Components/ConfigReader/ConfigReader.php @@ -10,9 +10,9 @@ class ConfigReader implements ConfigReaderInterface { - public const SYSTEM_CONFIG_DOMAIN = 'PayonePayment.settings.'; + final public const SYSTEM_CONFIG_DOMAIN = 'PayonePayment.settings.'; - private SystemConfigService $systemConfigService; + private readonly SystemConfigService $systemConfigService; public function __construct(SystemConfigService $systemConfigService) { @@ -35,7 +35,7 @@ public function read(?string $salesChannelId = null, bool $fallback = true): Con $config = []; foreach ($values as $key => $value) { - $property = substr($key, \strlen(self::SYSTEM_CONFIG_DOMAIN)); + $property = substr((string) $key, \strlen(self::SYSTEM_CONFIG_DOMAIN)); $config[$property] = $value; } diff --git a/src/Components/Currency/CurrencyPrecision.php b/src/Components/Currency/CurrencyPrecision.php index 0e9617a9c..22f0194e6 100644 --- a/src/Components/Currency/CurrencyPrecision.php +++ b/src/Components/Currency/CurrencyPrecision.php @@ -8,7 +8,7 @@ class CurrencyPrecision implements CurrencyPrecisionInterface { - public const DEFAULT_ROUNDING_PRECISION = 2; + final public const DEFAULT_ROUNDING_PRECISION = 2; public function getItemRoundingPrecision(CurrencyEntity $currency): int { diff --git a/src/Components/DataHandler/Transaction/TransactionDataHandler.php b/src/Components/DataHandler/Transaction/TransactionDataHandler.php index 931df4f5d..7091b28d9 100644 --- a/src/Components/DataHandler/Transaction/TransactionDataHandler.php +++ b/src/Components/DataHandler/Transaction/TransactionDataHandler.php @@ -17,14 +17,11 @@ class TransactionDataHandler implements TransactionDataHandlerInterface { - private EntityRepository $transactionRepository; + private readonly EntityRepository $transactionRepository; - private CurrencyPrecisionInterface $currencyPrecision; - - public function __construct(EntityRepository $transactionRepository, CurrencyPrecisionInterface $currencyPrecision) + public function __construct(EntityRepository $transactionRepository, private readonly CurrencyPrecisionInterface $currencyPrecision) { $this->transactionRepository = $transactionRepository; - $this->currencyPrecision = $currencyPrecision; } public function getPaymentTransactionByPayoneTransactionId(Context $context, int $payoneTransactionId): ?PaymentTransaction @@ -60,7 +57,7 @@ public function getTransactionDataFromWebhook(PaymentTransaction $paymentTransac $currentSequenceNumber = $payoneTransactionData->getSequenceNumber(); $newTransactionData['sequenceNumber'] = max((int) $transactionData['sequencenumber'], $currentSequenceNumber); - $newTransactionData['transactionState'] = strtolower($transactionData['txaction']); + $newTransactionData['transactionState'] = strtolower((string) $transactionData['txaction']); $newTransactionData['authorizationType'] = $payoneTransactionData->getAuthorizationType(); $newTransactionData['transactionData'] = array_merge( @@ -161,7 +158,7 @@ public function saveTransactionState(string $stateId, PaymentTransaction $transa */ private function neverChangesCapturableOrRefundableState(array $transactionData): bool { - $txAction = isset($transactionData['txaction']) ? strtolower($transactionData['txaction']) : null; + $txAction = isset($transactionData['txaction']) ? strtolower((string) $transactionData['txaction']) : null; // The following TX actions do not affect any capturable or refundable state return \in_array($txAction, [ diff --git a/src/Components/DeviceFingerprint/PayoneBNPLDeviceFingerprintService.php b/src/Components/DeviceFingerprint/PayoneBNPLDeviceFingerprintService.php index 4e330a309..4de8bcec4 100644 --- a/src/Components/DeviceFingerprint/PayoneBNPLDeviceFingerprintService.php +++ b/src/Components/DeviceFingerprint/PayoneBNPLDeviceFingerprintService.php @@ -13,15 +13,12 @@ class PayoneBNPLDeviceFingerprintService extends AbstractDeviceFingerprintService { - public const SESSION_VAR_NAME = 'payone_bnpl_device_ident_token'; + final public const SESSION_VAR_NAME = 'payone_bnpl_device_ident_token'; private const PAYLA_PARTNER_ID = 'e7yeryF2of8X'; - protected ConfigReaderInterface $configReader; - - public function __construct(RequestStack $requestStack, ConfigReaderInterface $configReader) + public function __construct(RequestStack $requestStack, protected ConfigReaderInterface $configReader) { parent::__construct($requestStack); - $this->configReader = $configReader; } public function getSupportedPaymentHandlerClasses(): array diff --git a/src/Components/DeviceFingerprint/RatepayDeviceFingerprintService.php b/src/Components/DeviceFingerprint/RatepayDeviceFingerprintService.php index 19761eb92..dafdeb845 100644 --- a/src/Components/DeviceFingerprint/RatepayDeviceFingerprintService.php +++ b/src/Components/DeviceFingerprint/RatepayDeviceFingerprintService.php @@ -14,14 +14,11 @@ class RatepayDeviceFingerprintService extends AbstractDeviceFingerprintService { - public const SESSION_VAR_NAME = 'payone_ratepay_device_ident_token'; + final public const SESSION_VAR_NAME = 'payone_ratepay_device_ident_token'; - protected ConfigReaderInterface $configReader; - - public function __construct(RequestStack $requestStack, ConfigReaderInterface $configReader) + public function __construct(RequestStack $requestStack, protected ConfigReaderInterface $configReader) { parent::__construct($requestStack); - $this->configReader = $configReader; } public function getSupportedPaymentHandlerClasses(): array @@ -44,7 +41,7 @@ public function getDeviceIdentSnippet(string $deviceIdentToken, SalesChannelCont 'v' => $snippetId, 't' => $deviceIdentToken, 'l' => $location, - ]) + ], JSON_THROW_ON_ERROR) ); $snippet .= sprintf( diff --git a/src/Components/Document/Struct/InvoiceDocumentData.php b/src/Components/Document/Struct/InvoiceDocumentData.php index 2aaec08ae..e9e7404ea 100644 --- a/src/Components/Document/Struct/InvoiceDocumentData.php +++ b/src/Components/Document/Struct/InvoiceDocumentData.php @@ -8,7 +8,7 @@ class InvoiceDocumentData extends Struct { - public const EXTENSION_NAME = 'payone_document'; + final public const EXTENSION_NAME = 'payone_document'; protected string $iban = ''; diff --git a/src/Components/Helper/OrderFetcher.php b/src/Components/Helper/OrderFetcher.php index 2874d7753..e83fed3cf 100644 --- a/src/Components/Helper/OrderFetcher.php +++ b/src/Components/Helper/OrderFetcher.php @@ -15,7 +15,7 @@ class OrderFetcher implements OrderFetcherInterface { - private EntityRepository $orderRepository; + private readonly EntityRepository $orderRepository; public function __construct(EntityRepository $orderRepository) { diff --git a/src/Components/Hydrator/LineItemHydrator/LineItemHydrator.php b/src/Components/Hydrator/LineItemHydrator/LineItemHydrator.php index 4f132b1e4..b449c34f8 100644 --- a/src/Components/Hydrator/LineItemHydrator/LineItemHydrator.php +++ b/src/Components/Hydrator/LineItemHydrator/LineItemHydrator.php @@ -28,25 +28,22 @@ class LineItemHydrator implements LineItemHydratorInterface /** * @see https://docs.payone.com/display/public/PLATFORM/it%5Bn%5D+-+definition */ - public const TYPE_GOODS = 'goods'; - public const TYPE_VOUCHER = 'voucher'; - public const TYPE_SHIPMENT = 'shipment'; - public const TYPE_HANDLING = 'handling'; + final public const TYPE_GOODS = 'goods'; + final public const TYPE_VOUCHER = 'voucher'; + final public const TYPE_SHIPMENT = 'shipment'; + final public const TYPE_HANDLING = 'handling'; - public const PAYONE_ARRAY_KEY_TYPE = 'it'; - public const PAYONE_ARRAY_KEY_NUMBER = 'id'; - public const PAYONE_ARRAY_KEY_PRICE = 'pr'; - public const PAYONE_ARRAY_KEY_QTY = 'no'; - public const PAYONE_ARRAY_KEY_NAME = 'de'; - public const PAYONE_ARRAY_KEY_TAX_RATE = 'va'; + final public const PAYONE_ARRAY_KEY_TYPE = 'it'; + final public const PAYONE_ARRAY_KEY_NUMBER = 'id'; + final public const PAYONE_ARRAY_KEY_PRICE = 'pr'; + final public const PAYONE_ARRAY_KEY_QTY = 'no'; + final public const PAYONE_ARRAY_KEY_NAME = 'de'; + final public const PAYONE_ARRAY_KEY_TAX_RATE = 'va'; - private CurrencyPrecisionInterface $currencyPrecision; + private readonly EntityRepository $shipmentRepository; - private EntityRepository $shipmentRepository; - - public function __construct(CurrencyPrecisionInterface $currencyPrecision, EntityRepository $shipmentRepository) + public function __construct(private readonly CurrencyPrecisionInterface $currencyPrecision, EntityRepository $shipmentRepository) { - $this->currencyPrecision = $currencyPrecision; $this->shipmentRepository = $shipmentRepository; } @@ -173,7 +170,7 @@ private function isCustomizedProduct(OrderLineItemEntity $lineItemEntity): bool && $lineItemEntity->getParentId() === null) { return true; } - } catch (\Exception $exception) { + } catch (\Exception) { // Catch class not found if SwagCustomizedProducts plugin is not installed } diff --git a/src/Components/KlarnaSessionService/KlarnaSessionService.php b/src/Components/KlarnaSessionService/KlarnaSessionService.php index 6a95dd5de..c2c4aa23a 100644 --- a/src/Components/KlarnaSessionService/KlarnaSessionService.php +++ b/src/Components/KlarnaSessionService/KlarnaSessionService.php @@ -15,27 +15,18 @@ class KlarnaSessionService implements KlarnaSessionServiceInterface { - private RequestParameterFactory $requestParameterFactory; + private readonly CartService $cartService; - private PayoneClientInterface $payoneClient; - - private CartService $cartService; - - private CartHasherInterface $cartHasher; - - private EntityRepository $orderEntityRepository; + private readonly EntityRepository $orderEntityRepository; public function __construct( - PayoneClientInterface $payoneClient, - RequestParameterFactory $requestParameterFactory, + private readonly PayoneClientInterface $payoneClient, + private readonly RequestParameterFactory $requestParameterFactory, CartService $cartService, - CartHasherInterface $cartHasher, + private readonly CartHasherInterface $cartHasher, EntityRepository $orderEntityRepository ) { - $this->requestParameterFactory = $requestParameterFactory; - $this->payoneClient = $payoneClient; $this->cartService = $cartService; - $this->cartHasher = $cartHasher; $this->orderEntityRepository = $orderEntityRepository; } diff --git a/src/Components/MandateService/MandateService.php b/src/Components/MandateService/MandateService.php index c96d82a51..50f0d9d15 100644 --- a/src/Components/MandateService/MandateService.php +++ b/src/Components/MandateService/MandateService.php @@ -21,20 +21,14 @@ class MandateService implements MandateServiceInterface { - private EntityRepository $mandateRepository; - - private PayoneClientInterface $client; - - private RequestParameterFactory $requestFactory; + private readonly EntityRepository $mandateRepository; public function __construct( EntityRepository $mandateRepository, - PayoneClientInterface $client, - RequestParameterFactory $requestFactory + private readonly PayoneClientInterface $client, + private readonly RequestParameterFactory $requestFactory ) { $this->mandateRepository = $mandateRepository; - $this->client = $client; - $this->requestFactory = $requestFactory; } public function getMandates(CustomerEntity $customer, SalesChannelContext $context): EntitySearchResult @@ -95,7 +89,7 @@ public function downloadMandate( try { $response = $this->client->request($request, false); - } catch (\Throwable $exception) { + } catch (\Throwable) { throw new \RuntimeException('mandate not found'); } @@ -106,9 +100,7 @@ public function removeAllMandatesForCustomer(CustomerEntity $customer, SalesChan { $mandates = $this->getMandates($customer, $context); - $ids = array_map(static function ($item) { - return ['id' => $item]; - }, array_values($mandates->getIds())); + $ids = array_map(static fn($item) => ['id' => $item], array_values($mandates->getIds())); $this->mandateRepository->delete($ids, $context->getContext()); } diff --git a/src/Components/PaymentFilter/DefaultPaymentFilterService.php b/src/Components/PaymentFilter/DefaultPaymentFilterService.php index 14f18a1f7..a78d9cf0e 100644 --- a/src/Components/PaymentFilter/DefaultPaymentFilterService.php +++ b/src/Components/PaymentFilter/DefaultPaymentFilterService.php @@ -13,38 +13,11 @@ class DefaultPaymentFilterService implements PaymentFilterServiceInterface { - /** - * @var class-string<\PayonePayment\PaymentHandler\AbstractPayonePaymentHandler> - */ - private string $paymentHandlerClass; - - private ?array $allowedCountries; - - private ?array $allowedB2bCountries; - - private ?array $allowedCurrencies; - - private float $allowedMinValue; - - private ?float $allowedMaxValue; - /** * @param class-string<\PayonePayment\PaymentHandler\AbstractPayonePaymentHandler> $paymentHandlerClass */ - public function __construct( - string $paymentHandlerClass, - ?array $allowedCountries = null, - ?array $allowedB2bCountries = null, - ?array $allowedCurrencies = null, - float $allowedMinValue = 0.0, - ?float $allowedMaxValue = null - ) { - $this->paymentHandlerClass = $paymentHandlerClass; - $this->allowedCountries = $allowedCountries; - $this->allowedB2bCountries = $allowedB2bCountries; - $this->allowedCurrencies = $allowedCurrencies; - $this->allowedMinValue = $allowedMinValue; - $this->allowedMaxValue = $allowedMaxValue; + public function __construct(private readonly string $paymentHandlerClass, private readonly ?array $allowedCountries = null, private readonly ?array $allowedB2bCountries = null, private readonly ?array $allowedCurrencies = null, private readonly float $allowedMinValue = 0.0, private readonly ?float $allowedMaxValue = null) + { } public function filterPaymentMethods( @@ -69,7 +42,7 @@ public function filterPaymentMethods( $this->validateMinValue($currentValue); $this->validateMaxValue($currentValue); } - } catch (PaymentMethodNotAllowedException $e) { + } catch (PaymentMethodNotAllowedException) { $methodCollection = $this->removePaymentMethod($methodCollection); } @@ -94,9 +67,7 @@ protected function removePaymentMethod(PaymentMethodCollection $paymentMethodCol { $that = $this; // filter-method needs a closure (forced anonymous function) so we can not use [$this, 'filterMethod'] - return $paymentMethodCollection->filter(static function (PaymentMethodEntity $entity) use ($that) { - return !$that->canMethodRemoved($entity); - }); + return $paymentMethodCollection->filter(static fn(PaymentMethodEntity $entity) => !$that->canMethodRemoved($entity)); } /** diff --git a/src/Components/PaymentFilter/FilteredPaymentMethodRoute.php b/src/Components/PaymentFilter/FilteredPaymentMethodRoute.php index 18c50e33d..1a2ef1798 100644 --- a/src/Components/PaymentFilter/FilteredPaymentMethodRoute.php +++ b/src/Components/PaymentFilter/FilteredPaymentMethodRoute.php @@ -17,32 +17,23 @@ */ class FilteredPaymentMethodRoute extends AbstractPaymentMethodRoute { - private AbstractPaymentMethodRoute $decorated; + private readonly AbstractPaymentMethodRoute $decorated; - private IterablePaymentFilter $iterablePaymentFilter; + private readonly RequestStack $requestStack; - private RequestStack $requestStack; - - private OrderFetcherInterface $orderFetcher; - - private CartService $cartService; - - private PaymentFilterContextFactoryInterface $paymentFilterContextFactory; + private readonly CartService $cartService; public function __construct( AbstractPaymentMethodRoute $decorated, - IterablePaymentFilter $iterablePaymentFilter, + private readonly IterablePaymentFilter $iterablePaymentFilter, RequestStack $requestStack, - OrderFetcherInterface $orderFetcher, + private readonly OrderFetcherInterface $orderFetcher, CartService $cartService, - PaymentFilterContextFactoryInterface $paymentFilterContextFactory + private readonly PaymentFilterContextFactoryInterface $paymentFilterContextFactory ) { $this->decorated = $decorated; - $this->iterablePaymentFilter = $iterablePaymentFilter; $this->requestStack = $requestStack; - $this->orderFetcher = $orderFetcher; $this->cartService = $cartService; - $this->paymentFilterContextFactory = $paymentFilterContextFactory; } public function getDecorated(): AbstractPaymentMethodRoute diff --git a/src/Components/PaymentFilter/IterablePaymentFilter.php b/src/Components/PaymentFilter/IterablePaymentFilter.php index 4c47bdd99..cb13708ad 100644 --- a/src/Components/PaymentFilter/IterablePaymentFilter.php +++ b/src/Components/PaymentFilter/IterablePaymentFilter.php @@ -6,14 +6,11 @@ class IterablePaymentFilter implements PaymentFilterServiceInterface { - private iterable $services; - /** * @param iterable $services */ - public function __construct(iterable $services) + public function __construct(private readonly iterable $services) { - $this->services = $services; } public function filterPaymentMethods( diff --git a/src/Components/PaymentFilter/PaymentFilterContext.php b/src/Components/PaymentFilter/PaymentFilterContext.php index 0976b993b..0e0a9e1f7 100644 --- a/src/Components/PaymentFilter/PaymentFilterContext.php +++ b/src/Components/PaymentFilter/PaymentFilterContext.php @@ -14,17 +14,7 @@ class PaymentFilterContext extends Struct { - private SalesChannelContext $salesChannelContext; - - /** - * @var CustomerAddressEntity|OrderAddressEntity|null - */ - private $billingAddress = null; - - /** - * @var CustomerAddressEntity|OrderAddressEntity|null - */ - private $shippingAddress = null; + private readonly SalesChannelContext $salesChannelContext; private ?CurrencyEntity $currency = null; @@ -38,15 +28,13 @@ class PaymentFilterContext extends Struct */ public function __construct( SalesChannelContext $salesChannelContext, - $billingAddress = null, - $shippingAddress = null, + private readonly \Shopware\Core\Checkout\Customer\Aggregate\CustomerAddress\CustomerAddressEntity|\Shopware\Core\Checkout\Order\Aggregate\OrderAddress\OrderAddressEntity|null $billingAddress = null, + private readonly \Shopware\Core\Checkout\Customer\Aggregate\CustomerAddress\CustomerAddressEntity|\Shopware\Core\Checkout\Order\Aggregate\OrderAddress\OrderAddressEntity|null $shippingAddress = null, ?CurrencyEntity $currency = null, ?OrderEntity $order = null, ?Cart $cart = null ) { $this->salesChannelContext = $salesChannelContext; - $this->billingAddress = $billingAddress; - $this->shippingAddress = $shippingAddress; $this->currency = $currency; $this->order = $order; $this->cart = $cart; diff --git a/src/Components/PaymentFilter/PaymentFilterContextFactory.php b/src/Components/PaymentFilter/PaymentFilterContextFactory.php index 9c796fceb..115607bdf 100644 --- a/src/Components/PaymentFilter/PaymentFilterContextFactory.php +++ b/src/Components/PaymentFilter/PaymentFilterContextFactory.php @@ -11,11 +11,8 @@ class PaymentFilterContextFactory implements PaymentFilterContextFactoryInterface { - private OrderFetcherInterface $orderFetcher; - - public function __construct(OrderFetcherInterface $orderFetcher) + public function __construct(private readonly OrderFetcherInterface $orderFetcher) { - $this->orderFetcher = $orderFetcher; } public function createContextForOrder(OrderEntity $order, SalesChannelContext $salesChannelContext): PaymentFilterContext diff --git a/src/Components/PaymentFilter/PayonePaymentMethodValidator.php b/src/Components/PaymentFilter/PayonePaymentMethodValidator.php index f6885d4de..dddd53819 100644 --- a/src/Components/PaymentFilter/PayonePaymentMethodValidator.php +++ b/src/Components/PaymentFilter/PayonePaymentMethodValidator.php @@ -11,16 +11,8 @@ class PayonePaymentMethodValidator implements CartValidatorInterface { - private IterablePaymentFilter $iterablePaymentFilter; - - private PaymentFilterContextFactoryInterface $paymentFilterContextFactory; - - public function __construct( - IterablePaymentFilter $iterablePaymentFilter, - PaymentFilterContextFactoryInterface $paymentFilterContextFactory - ) { - $this->iterablePaymentFilter = $iterablePaymentFilter; - $this->paymentFilterContextFactory = $paymentFilterContextFactory; + public function __construct(private readonly IterablePaymentFilter $iterablePaymentFilter, private readonly PaymentFilterContextFactoryInterface $paymentFilterContextFactory) + { } /** diff --git a/src/Components/PaymentStateHandler/PaymentStateHandler.php b/src/Components/PaymentStateHandler/PaymentStateHandler.php index cdfa235c0..1ca18cc1c 100644 --- a/src/Components/PaymentStateHandler/PaymentStateHandler.php +++ b/src/Components/PaymentStateHandler/PaymentStateHandler.php @@ -11,7 +11,7 @@ class PaymentStateHandler implements PaymentStateHandlerInterface { - private TranslatorInterface $translator; + private readonly TranslatorInterface $translator; public function __construct(TranslatorInterface $translator) { diff --git a/src/Components/Ratepay/Installment/InstallmentService.php b/src/Components/Ratepay/Installment/InstallmentService.php index 56b3493d0..ea0ea4318 100644 --- a/src/Components/Ratepay/Installment/InstallmentService.php +++ b/src/Components/Ratepay/Installment/InstallmentService.php @@ -19,24 +19,15 @@ class InstallmentService implements InstallmentServiceInterface { - private CartService $cartService; - - private PayoneClientInterface $client; - - private RequestParameterFactory $requestParameterFactory; - - private ProfileServiceInterface $profileService; + private readonly CartService $cartService; public function __construct( CartService $cartService, - PayoneClientInterface $client, - RequestParameterFactory $requestParameterFactory, - ProfileServiceInterface $profileService + private readonly PayoneClientInterface $client, + private readonly RequestParameterFactory $requestParameterFactory, + private readonly ProfileServiceInterface $profileService ) { $this->cartService = $cartService; - $this->client = $client; - $this->requestParameterFactory = $requestParameterFactory; - $this->profileService = $profileService; } public function getInstallmentCalculatorData(SalesChannelContext $salesChannelContext, ?RequestDataBag $dataBag = null): ?RatepayInstallmentCalculatorData @@ -55,7 +46,7 @@ public function getInstallmentCalculatorData(SalesChannelContext $salesChannelCo return null; } - $allowedMonths = explode(',', $profileConfiguration['month-allowed']); + $allowedMonths = explode(',', (string) $profileConfiguration['month-allowed']); $defaults = [ 'type' => CalculationRequestParameterBuilder::INSTALLMENT_TYPE_TIME, diff --git a/src/Components/Ratepay/Profile/ProfileService.php b/src/Components/Ratepay/Profile/ProfileService.php index da517eb68..de69fd3bd 100644 --- a/src/Components/Ratepay/Profile/ProfileService.php +++ b/src/Components/Ratepay/Profile/ProfileService.php @@ -22,33 +22,24 @@ class ProfileService implements ProfileServiceInterface { - public const PAYMENT_KEYS = [ + final public const PAYMENT_KEYS = [ PayoneRatepayDebitPaymentHandler::class => 'elv', PayoneRatepayInstallmentPaymentHandler::class => 'installment', PayoneRatepayInvoicingPaymentHandler::class => 'invoice', ]; - private PayoneClientInterface $client; + private readonly SystemConfigService $systemConfigService; - private RequestParameterFactory $requestParameterFactory; - - private SystemConfigService $systemConfigService; - - private OrderFetcherInterface $orderFetcher; - - private CartService $cartService; + private readonly CartService $cartService; public function __construct( - PayoneClientInterface $client, - RequestParameterFactory $requestParameterFactory, + private readonly PayoneClientInterface $client, + private readonly RequestParameterFactory $requestParameterFactory, SystemConfigService $systemConfigService, - OrderFetcherInterface $orderFetcher, + private readonly OrderFetcherInterface $orderFetcher, CartService $cartService ) { - $this->client = $client; - $this->requestParameterFactory = $requestParameterFactory; $this->systemConfigService = $systemConfigService; - $this->orderFetcher = $orderFetcher; $this->cartService = $cartService; } @@ -70,19 +61,19 @@ public function getProfile(ProfileSearch $profileSearch): ?Profile continue; } - $allowedBillingCountries = explode(',', $configuration['country-code-billing']); + $allowedBillingCountries = explode(',', (string) $configuration['country-code-billing']); if (!\in_array($profileSearch->getBillingCountryCode(), $allowedBillingCountries, true)) { continue; } - $allowedDeliveryCountries = explode(',', $configuration['country-code-delivery']); + $allowedDeliveryCountries = explode(',', (string) $configuration['country-code-delivery']); if (!\in_array($profileSearch->getShippingCountryCode(), $allowedDeliveryCountries, true)) { continue; } - $allowedCurrencies = explode(',', $configuration['currency']); + $allowedCurrencies = explode(',', (string) $configuration['currency']); if (!\in_array($profileSearch->getCurrency(), $allowedCurrencies, true)) { continue; diff --git a/src/Components/RedirectHandler/RedirectHandler.php b/src/Components/RedirectHandler/RedirectHandler.php index 7af8520cd..f8048f1e9 100644 --- a/src/Components/RedirectHandler/RedirectHandler.php +++ b/src/Components/RedirectHandler/RedirectHandler.php @@ -13,17 +13,14 @@ class RedirectHandler { - private Connection $connection; + private readonly Connection $connection; - private RouterInterface $router; + private readonly RouterInterface $router; - private string $appSecret; - - public function __construct(Connection $connection, RouterInterface $router, string $appSecret = '') + public function __construct(Connection $connection, RouterInterface $router, private readonly string $appSecret = '') { $this->connection = $connection; $this->router = $router; - $this->appSecret = $appSecret; } public function encode(string $url): string diff --git a/src/Components/SecuredInstallment/InstallmentService.php b/src/Components/SecuredInstallment/InstallmentService.php index ea2c07d45..597909eec 100644 --- a/src/Components/SecuredInstallment/InstallmentService.php +++ b/src/Components/SecuredInstallment/InstallmentService.php @@ -17,20 +17,14 @@ class InstallmentService implements InstallmentServiceInterface { - private CartService $cartService; - - private PayoneClientInterface $client; - - private RequestParameterFactory $requestParameterFactory; + private readonly CartService $cartService; public function __construct( CartService $cartService, - PayoneClientInterface $client, - RequestParameterFactory $requestParameterFactory + private readonly PayoneClientInterface $client, + private readonly RequestParameterFactory $requestParameterFactory ) { $this->cartService = $cartService; - $this->client = $client; - $this->requestParameterFactory = $requestParameterFactory; } public function getInstallmentOptions(SalesChannelContext $salesChannelContext, ?RequestDataBag $dataBag = null): SecuredInstallmentOptionsData @@ -45,7 +39,7 @@ public function getInstallmentOptions(SalesChannelContext $salesChannelContext, if (isset($response['addpaydata']) && \is_array($response['addpaydata'])) { $optionIndices = []; foreach ($response['addpaydata'] as $key => $value) { - if (strpos($key, 'installment_option_id_') === 0) { + if (str_starts_with($key, 'installment_option_id_')) { $parts = explode('_', $key); $optionIndices[] = (int) end($parts); } diff --git a/src/Components/TransactionHandler/AbstractTransactionHandler.php b/src/Components/TransactionHandler/AbstractTransactionHandler.php index d9b6484b2..a0454440d 100644 --- a/src/Components/TransactionHandler/AbstractTransactionHandler.php +++ b/src/Components/TransactionHandler/AbstractTransactionHandler.php @@ -183,7 +183,7 @@ protected function isSuccessResponse(JsonResponse $requestResponse): bool $requestContent = $requestResponse->getContent(); if ($requestContent) { - $decodedResultContent = json_decode($requestContent, true); + $decodedResultContent = json_decode($requestContent, true, 512, JSON_THROW_ON_ERROR); } return !empty($decodedResultContent) && $decodedResultContent['status']; diff --git a/src/Components/TransactionHandler/Capture/CaptureTransactionHandler.php b/src/Components/TransactionHandler/Capture/CaptureTransactionHandler.php index 20a29b3ce..6d5ad2659 100644 --- a/src/Components/TransactionHandler/Capture/CaptureTransactionHandler.php +++ b/src/Components/TransactionHandler/Capture/CaptureTransactionHandler.php @@ -23,13 +23,11 @@ class CaptureTransactionHandler extends AbstractTransactionHandler implements CaptureTransactionHandlerInterface { - private TransactionStatusServiceInterface $transactionStatusService; - public function __construct( RequestParameterFactory $requestFactory, PayoneClientInterface $client, TransactionDataHandlerInterface $dataHandler, - TransactionStatusServiceInterface $transactionStatusService, + private readonly TransactionStatusServiceInterface $transactionStatusService, EntityRepository $transactionRepository, EntityRepository $lineItemRepository, CurrencyPrecisionInterface $currencyPrecision @@ -37,7 +35,6 @@ public function __construct( $this->requestFactory = $requestFactory; $this->client = $client; $this->dataHandler = $dataHandler; - $this->transactionStatusService = $transactionStatusService; $this->transactionRepository = $transactionRepository; $this->lineItemRepository = $lineItemRepository; $this->currencyPrecision = $currencyPrecision; diff --git a/src/Components/TransactionHandler/Refund/RefundTransactionHandler.php b/src/Components/TransactionHandler/Refund/RefundTransactionHandler.php index 20ffd40f8..2aaa18cd3 100644 --- a/src/Components/TransactionHandler/Refund/RefundTransactionHandler.php +++ b/src/Components/TransactionHandler/Refund/RefundTransactionHandler.php @@ -23,13 +23,11 @@ class RefundTransactionHandler extends AbstractTransactionHandler implements RefundTransactionHandlerInterface { - private TransactionStatusServiceInterface $transactionStatusService; - public function __construct( RequestParameterFactory $requestFactory, PayoneClientInterface $client, TransactionDataHandlerInterface $dataHandler, - TransactionStatusServiceInterface $transactionStatusService, + private readonly TransactionStatusServiceInterface $transactionStatusService, EntityRepository $transactionRepository, EntityRepository $lineItemRepository, CurrencyPrecisionInterface $currencyPrecision @@ -37,7 +35,6 @@ public function __construct( $this->requestFactory = $requestFactory; $this->client = $client; $this->dataHandler = $dataHandler; - $this->transactionStatusService = $transactionStatusService; $this->transactionRepository = $transactionRepository; $this->lineItemRepository = $lineItemRepository; $this->currencyPrecision = $currencyPrecision; diff --git a/src/Components/TransactionStatus/TransactionStatusService.php b/src/Components/TransactionStatus/TransactionStatusService.php index 7ee6118e1..dacb5a378 100644 --- a/src/Components/TransactionStatus/TransactionStatusService.php +++ b/src/Components/TransactionStatus/TransactionStatusService.php @@ -26,53 +26,44 @@ class TransactionStatusService implements TransactionStatusServiceInterface { - public const ACTION_APPOINTED = 'appointed'; - public const ACTION_PAID = 'paid'; - public const ACTION_CAPTURE = 'capture'; - public const ACTION_PARTIAL_CAPTURE = 'partialCapture'; - public const ACTION_COMPLETED = 'completed'; - public const ACTION_DEBIT = 'debit'; - public const ACTION_PARTIAL_DEBIT = 'partialDebit'; - public const ACTION_CANCELATION = 'cancelation'; - public const ACTION_FAILED = 'failed'; - public const ACTION_REDIRECT = 'redirect'; - public const ACTION_INVOICE = 'invoice'; - public const ACTION_UNDERPAID = 'underpaid'; - public const ACTION_TRANSFER = 'transfer'; - public const ACTION_REMINDER = 'reminder'; - public const ACTION_VAUTHORIZATION = 'vauthorization'; - public const ACTION_VSETTLEMENT = 'vsettlement'; - - public const STATUS_PREFIX = 'paymentStatus'; - public const STATUS_COMPLETED = 'completed'; - - public const AUTHORIZATION_TYPE_AUTHORIZATION = 'authorization'; - public const AUTHORIZATION_TYPE_PREAUTHORIZATION = 'preauthorization'; - - public const TRANSACTION_TYPE_GT = 'GT'; - - private StateMachineRegistry $stateMachineRegistry; - - private ConfigReaderInterface $configReader; - - private EntityRepository $transactionRepository; - - private LoggerInterface $logger; - - private CurrencyPrecisionInterface $currencyPrecision; + final public const ACTION_APPOINTED = 'appointed'; + final public const ACTION_PAID = 'paid'; + final public const ACTION_CAPTURE = 'capture'; + final public const ACTION_PARTIAL_CAPTURE = 'partialCapture'; + final public const ACTION_COMPLETED = 'completed'; + final public const ACTION_DEBIT = 'debit'; + final public const ACTION_PARTIAL_DEBIT = 'partialDebit'; + final public const ACTION_CANCELATION = 'cancelation'; + final public const ACTION_FAILED = 'failed'; + final public const ACTION_REDIRECT = 'redirect'; + final public const ACTION_INVOICE = 'invoice'; + final public const ACTION_UNDERPAID = 'underpaid'; + final public const ACTION_TRANSFER = 'transfer'; + final public const ACTION_REMINDER = 'reminder'; + final public const ACTION_VAUTHORIZATION = 'vauthorization'; + final public const ACTION_VSETTLEMENT = 'vsettlement'; + + final public const STATUS_PREFIX = 'paymentStatus'; + final public const STATUS_COMPLETED = 'completed'; + + final public const AUTHORIZATION_TYPE_AUTHORIZATION = 'authorization'; + final public const AUTHORIZATION_TYPE_PREAUTHORIZATION = 'preauthorization'; + + final public const TRANSACTION_TYPE_GT = 'GT'; + + private readonly StateMachineRegistry $stateMachineRegistry; + + private readonly EntityRepository $transactionRepository; public function __construct( StateMachineRegistry $stateMachineRegistry, - ConfigReaderInterface $configReader, + private readonly ConfigReaderInterface $configReader, EntityRepository $transactionRepository, - LoggerInterface $logger, - CurrencyPrecisionInterface $currencyPrecision + private readonly LoggerInterface $logger, + private readonly CurrencyPrecisionInterface $currencyPrecision ) { $this->stateMachineRegistry = $stateMachineRegistry; - $this->configReader = $configReader; $this->transactionRepository = $transactionRepository; - $this->logger = $logger; - $this->currencyPrecision = $currencyPrecision; } public function transitionByConfigMapping(SalesChannelContext $salesChannelContext, PaymentTransaction $paymentTransaction, array $transactionData): void @@ -95,7 +86,7 @@ public function transitionByConfigMapping(SalesChannelContext $salesChannelConte } elseif ($this->isTransactionPartialRefund($transactionData, $currency)) { $configurationKey = self::STATUS_PREFIX . ucfirst(self::ACTION_PARTIAL_DEBIT); } else { - $configurationKey = self::STATUS_PREFIX . ucfirst(strtolower($transactionData['txaction'])); + $configurationKey = self::STATUS_PREFIX . ucfirst(strtolower((string) $transactionData['txaction'])); } $transitionName = $configuration->getString($configurationKey); @@ -152,7 +143,7 @@ private function executeTransition(Context $context, string $transactionId, stri ), $context ); - } catch (IllegalTransitionException $exception) { + } catch (IllegalTransitionException) { /** false-positiv handling (paid -> paid, open -> open) */ $this->logger->notice(sprintf('Transition %s not possible from state %s for transaction ID %s', $transitionName, $transaction->getStateMachineState()->getTechnicalName(), $transactionId), $transactionData); } @@ -160,7 +151,7 @@ private function executeTransition(Context $context, string $transactionId, stri private function isTransactionPartialPaid(array $transactionData, CurrencyEntity $currency): bool { - if (!\in_array(strtolower($transactionData['txaction']), [self::ACTION_DEBIT, self::ACTION_CAPTURE, self::ACTION_INVOICE], true)) { + if (!\in_array(strtolower((string) $transactionData['txaction']), [self::ACTION_DEBIT, self::ACTION_CAPTURE, self::ACTION_INVOICE], true)) { return false; } @@ -191,7 +182,7 @@ private function isTransactionPartialRefund(array $transactionData, CurrencyEnti { $precision = $this->currencyPrecision->getTotalRoundingPrecision($currency); - if (strtolower($transactionData['txaction']) !== self::ACTION_DEBIT) { + if (strtolower((string) $transactionData['txaction']) !== self::ACTION_DEBIT) { return false; } @@ -234,6 +225,6 @@ private function isFailedRedirect(array $firstTransaction, array $transactionDat return \array_key_exists('response', $firstTransaction) && \array_key_exists('status', $firstTransaction['response']) && $firstTransaction['response']['status'] === strtoupper(self::ACTION_REDIRECT) - && strtolower($transactionData['txaction']) === self::ACTION_FAILED; + && strtolower((string) $transactionData['txaction']) === self::ACTION_FAILED; } } diff --git a/src/Components/Validator/Birthday.php b/src/Components/Validator/Birthday.php index c53ba0fd8..5e71ceab1 100644 --- a/src/Components/Validator/Birthday.php +++ b/src/Components/Validator/Birthday.php @@ -12,7 +12,7 @@ */ class Birthday extends AbstractComparison { - public const TOO_HIGH_ERROR = 'ac2f93c6-f906-47c9-8b09-6f7cf41f4f49'; + final public const TOO_HIGH_ERROR = 'ac2f93c6-f906-47c9-8b09-6f7cf41f4f49'; /** * @phpstan-ignore-next-line diff --git a/src/Components/Validator/PaymentMethod.php b/src/Components/Validator/PaymentMethod.php index 1ce213c3c..f9b841ef9 100644 --- a/src/Components/Validator/PaymentMethod.php +++ b/src/Components/Validator/PaymentMethod.php @@ -12,7 +12,7 @@ */ class PaymentMethod extends AbstractComparison { - public const INVALID_ERROR = '8608fc941e7a4407bc8d259866ca64b4'; + final public const INVALID_ERROR = '8608fc941e7a4407bc8d259866ca64b4'; /** * @phpstan-ignore-next-line diff --git a/src/Components/Validator/PaymentMethodValidator.php b/src/Components/Validator/PaymentMethodValidator.php index f0afc59e9..9eb547703 100644 --- a/src/Components/Validator/PaymentMethodValidator.php +++ b/src/Components/Validator/PaymentMethodValidator.php @@ -9,12 +9,10 @@ class PaymentMethodValidator extends AbstractComparisonValidator { /** - * @param mixed $value1 - * @param mixed $value2 * * @return bool always fails as the check is done inside a subscriber */ - protected function compareValues($value1, $value2): bool + protected function compareValues(mixed $value1, mixed $value2): bool { return false; } diff --git a/src/Controller/CaptureController.php b/src/Controller/CaptureController.php index a06bf78f3..bba7612ff 100644 --- a/src/Controller/CaptureController.php +++ b/src/Controller/CaptureController.php @@ -14,11 +14,8 @@ class CaptureController extends AbstractController { - private CaptureTransactionHandlerInterface $captureHandler; - - public function __construct(CaptureTransactionHandlerInterface $captureHandler) + public function __construct(private readonly CaptureTransactionHandlerInterface $captureHandler) { - $this->captureHandler = $captureHandler; } /** diff --git a/src/Controller/RedirectController.php b/src/Controller/RedirectController.php index e81e7e19a..a6b0869d2 100644 --- a/src/Controller/RedirectController.php +++ b/src/Controller/RedirectController.php @@ -13,11 +13,8 @@ class RedirectController { - private RedirectHandler $redirectHandler; - - public function __construct(RedirectHandler $redirectHandler) + public function __construct(private readonly RedirectHandler $redirectHandler) { - $this->redirectHandler = $redirectHandler; } /** @@ -33,7 +30,7 @@ public function execute(Request $request): Response try { $target = $this->redirectHandler->decode($hash); - } catch (\Throwable $exception) { + } catch (\Throwable) { throw new NotFoundHttpException(); } diff --git a/src/Controller/RefundController.php b/src/Controller/RefundController.php index 90fc9f02e..ba5e61682 100644 --- a/src/Controller/RefundController.php +++ b/src/Controller/RefundController.php @@ -14,11 +14,8 @@ class RefundController extends AbstractController { - private RefundTransactionHandlerInterface $refundHandler; - - public function __construct(RefundTransactionHandlerInterface $refundHandler) + public function __construct(private readonly RefundTransactionHandlerInterface $refundHandler) { - $this->refundHandler = $refundHandler; } /** diff --git a/src/Controller/SettingsController.php b/src/Controller/SettingsController.php index 4bba9e109..d26b068cb 100644 --- a/src/Controller/SettingsController.php +++ b/src/Controller/SettingsController.php @@ -29,31 +29,19 @@ class SettingsController extends AbstractController { private const REFERENCE_PREFIX_TEST = 'TESTPO-'; - private PayoneClientInterface $client; + private readonly EntityRepository $stateMachineTransitionRepository; - private RequestParameterFactory $requestFactory; - - private EntityRepository $stateMachineTransitionRepository; - - private LoggerInterface $logger; - - private string $kernelDirectory; - - private EntityRepository $paymentMethodRepository; + private readonly EntityRepository $paymentMethodRepository; public function __construct( - PayoneClientInterface $client, - RequestParameterFactory $requestFactory, + private readonly PayoneClientInterface $client, + private readonly RequestParameterFactory $requestFactory, EntityRepository $stateMachineTransitionRepository, - LoggerInterface $logger, - string $kernelDirectory, + private readonly LoggerInterface $logger, + private readonly string $kernelDirectory, EntityRepository $paymentMethodRepository ) { - $this->client = $client; - $this->requestFactory = $requestFactory; $this->stateMachineTransitionRepository = $stateMachineTransitionRepository; - $this->logger = $logger; - $this->kernelDirectory = $kernelDirectory; $this->paymentMethodRepository = $paymentMethodRepository; } @@ -84,7 +72,7 @@ public function validateApiCredentials(Request $request, Context $context): Json $this->client->request($testRequest); } catch (PayoneRequestException $e) { $errors[$configurationPrefix] = $e->getResponse()['error']['ErrorMessage']; - } catch (\Throwable $exception) { + } catch (\Throwable) { $errors[$configurationPrefix] = true; } } @@ -115,7 +103,7 @@ public function getStateMachineTransitionActions(Request $request, Context $cont $searchResult = $this->stateMachineTransitionRepository->search($criteria, $context); $transitionNames = []; - if (\count($searchResult->getElements()) > 0) { + if ((is_countable($searchResult->getElements()) ? \count($searchResult->getElements()) : 0) > 0) { /** @var StateMachineTransitionEntity $stateMachineAction */ foreach ($searchResult->getElements() as $stateMachineAction) { $transitionNames[] = [ @@ -154,7 +142,7 @@ private function getPaymentParameters(string $paymentClass): array 'clearingtype' => 'cc', 'amount' => 100, 'currency' => 'EUR', - 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1000000000000, 9999999999999)), + 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1_000_000_000_000, 9_999_999_999_999)), 'cardpan' => '5500000000000004', 'pseudocardpan' => '5500000000099999', 'cardtype' => 'M', @@ -175,7 +163,7 @@ private function getPaymentParameters(string $paymentClass): array 'bankaccountholder' => 'Test Test', 'amount' => 100, 'currency' => 'EUR', - 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1000000000000, 9999999999999)), + 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1_000_000_000_000, 9_999_999_999_999)), 'firstname' => 'Test', 'lastname' => 'Test', 'country' => 'DE', @@ -190,7 +178,7 @@ private function getPaymentParameters(string $paymentClass): array 'wallettype' => 'PPE', 'amount' => 100, 'currency' => 'EUR', - 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1000000000000, 9999999999999)), + 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1_000_000_000_000, 9_999_999_999_999)), 'firstname' => 'Test', 'lastname' => 'Test', 'country' => 'DE', @@ -205,7 +193,7 @@ private function getPaymentParameters(string $paymentClass): array 'bankcountry' => 'DE', 'amount' => 100, 'currency' => 'EUR', - 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1000000000000, 9999999999999)), + 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1_000_000_000_000, 9_999_999_999_999)), 'firstname' => 'Test', 'lastname' => 'Test', 'country' => 'DE', @@ -221,7 +209,7 @@ private function getPaymentParameters(string $paymentClass): array 'bankgrouptype' => 'ARZ_HTB', 'amount' => 100, 'currency' => 'EUR', - 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1000000000000, 9999999999999)), + 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1_000_000_000_000, 9_999_999_999_999)), 'firstname' => 'Test', 'lastname' => 'Test', 'country' => 'AT', @@ -237,7 +225,7 @@ private function getPaymentParameters(string $paymentClass): array 'bankgrouptype' => 'ING_BANK', 'amount' => 100, 'currency' => 'EUR', - 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1000000000000, 9999999999999)), + 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1_000_000_000_000, 9_999_999_999_999)), 'firstname' => 'Test', 'lastname' => 'Test', 'country' => 'NL', @@ -252,7 +240,7 @@ private function getPaymentParameters(string $paymentClass): array 'bankcountry' => 'BE', 'amount' => 100, 'currency' => 'EUR', - 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1000000000000, 9999999999999)), + 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1_000_000_000_000, 9_999_999_999_999)), 'lastname' => 'Test', 'country' => 'BE', 'successurl' => 'https://www.payone.com', @@ -269,7 +257,7 @@ private function getPaymentParameters(string $paymentClass): array 'add_paydata[payment_type]' => 'Payolution-Invoicing', 'amount' => 10000, 'currency' => 'EUR', - 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1000000000000, 9999999999999)), + 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1_000_000_000_000, 9_999_999_999_999)), 'birthday' => '19900505', 'firstname' => 'Test', 'lastname' => 'Test', @@ -290,7 +278,7 @@ private function getPaymentParameters(string $paymentClass): array 'add_paydata[payment_type]' => 'Payolution-Debit', 'amount' => 10000, 'currency' => 'EUR', - 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1000000000000, 9999999999999)), + 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1_000_000_000_000, 9_999_999_999_999)), 'birthday' => '19900505', 'firstname' => 'Test', 'lastname' => 'Test', @@ -313,7 +301,7 @@ private function getPaymentParameters(string $paymentClass): array 'add_paydata[payment_type]' => 'Payolution-Installment', 'amount' => 10000, 'currency' => 'EUR', - 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1000000000000, 9999999999999)), + 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1_000_000_000_000, 9_999_999_999_999)), 'birthday' => '19900505', 'firstname' => 'Test', 'lastname' => 'Test', @@ -331,7 +319,7 @@ private function getPaymentParameters(string $paymentClass): array 'clearingtype' => 'vor', 'amount' => 10000, 'currency' => 'EUR', - 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1000000000000, 9999999999999)), + 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1_000_000_000_000, 9_999_999_999_999)), 'firstname' => 'Test', 'lastname' => 'Test', 'country' => 'DE', @@ -350,7 +338,7 @@ private function getPaymentParameters(string $paymentClass): array 'iban' => 'DE00123456782599100004', 'amount' => 100, 'currency' => 'EUR', - 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1000000000000, 9999999999999)), + 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1_000_000_000_000, 9_999_999_999_999)), 'firstname' => 'Test', 'lastname' => 'Test', 'country' => 'DE', @@ -364,7 +352,7 @@ private function getPaymentParameters(string $paymentClass): array 'financingtype' => 'POV', 'amount' => 10000, 'currency' => 'EUR', - 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1000000000000, 9999999999999)), + 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1_000_000_000_000, 9_999_999_999_999)), 'birthday' => '19900505', 'firstname' => 'Test', 'lastname' => 'Test', @@ -383,7 +371,7 @@ private function getPaymentParameters(string $paymentClass): array 'clearingtype' => 'rec', 'amount' => 10000, 'currency' => 'EUR', - 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1000000000000, 9999999999999)), + 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1_000_000_000_000, 9_999_999_999_999)), 'birthday' => '19900505', 'firstname' => 'Test', 'lastname' => 'Test', @@ -403,7 +391,7 @@ private function getPaymentParameters(string $paymentClass): array 'wallettype' => 'PDT', 'amount' => 10000, 'currency' => 'EUR', - 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1000000000000, 9999999999999)), + 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1_000_000_000_000, 9_999_999_999_999)), 'add_paydata[action]' => 'checkout', 'add_paydata[type]' => 'order', 'add_paydata[web_url_shipping_terms]' => 'https://www.payone.com', @@ -419,7 +407,7 @@ private function getPaymentParameters(string $paymentClass): array 'clearingtype' => 'vor', 'amount' => 10000, 'currency' => 'EUR', - 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1000000000000, 9999999999999)), + 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1_000_000_000_000, 9_999_999_999_999)), 'firstname' => 'Test', 'lastname' => 'Test', 'country' => 'DE', @@ -454,7 +442,7 @@ private function getPaymentParameters(string $paymentClass): array 'bankcountry' => 'PL', 'amount' => 100, 'currency' => 'EUR', - 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1000000000000, 9999999999999)), + 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1_000_000_000_000, 9_999_999_999_999)), 'lastname' => 'Test', 'country' => 'PL', 'successurl' => 'https://www.payone.com', @@ -470,7 +458,7 @@ private function getPaymentParameters(string $paymentClass): array 'amount' => 100, 'country' => 'DE', 'currency' => 'EUR', - 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1000000000000, 9999999999999)), + 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1_000_000_000_000, 9_999_999_999_999)), 'lastname' => 'Test', 'successurl' => 'https://www.payone.com', 'errorurl' => 'https://www.payone.com', @@ -486,7 +474,7 @@ private function getPaymentParameters(string $paymentClass): array 'bankcountry' => 'CH', 'amount' => 100, 'currency' => 'CHF', - 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1000000000000, 9999999999999)), + 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1_000_000_000_000, 9_999_999_999_999)), 'lastname' => 'Test', 'country' => 'CH', 'successurl' => 'https://www.payone.com', @@ -502,7 +490,7 @@ private function getPaymentParameters(string $paymentClass): array 'bankcountry' => 'CH', 'amount' => 100, 'currency' => 'CHF', - 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1000000000000, 9999999999999)), + 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1_000_000_000_000, 9_999_999_999_999)), 'lastname' => 'Test', 'country' => 'CH', 'successurl' => 'https://www.payone.com', @@ -518,7 +506,7 @@ private function getPaymentParameters(string $paymentClass): array 'amount' => 100, 'country' => 'DE', 'currency' => 'EUR', - 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1000000000000, 9999999999999)), + 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1_000_000_000_000, 9_999_999_999_999)), 'lastname' => 'Test', 'successurl' => 'https://www.payone.com', 'errorurl' => 'https://www.payone.com', @@ -536,7 +524,7 @@ private function getPaymentParameters(string $paymentClass): array 'businessrelation' => 'b2c', 'amount' => 10000, 'currency' => 'EUR', - 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1000000000000, 9999999999999)), + 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1_000_000_000_000, 9_999_999_999_999)), 'email' => 'test@example.com', 'firstname' => 'Test', 'lastname' => 'Test', @@ -572,7 +560,7 @@ private function getPaymentParameters(string $paymentClass): array 'businessrelation' => 'b2c', 'amount' => 30000, 'currency' => 'EUR', - 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1000000000000, 9999999999999)), + 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1_000_000_000_000, 9_999_999_999_999)), 'email' => 'test@example.com', 'bankaccountholder' => 'Test Test', 'iban' => 'DE62500105171314583819', @@ -611,7 +599,7 @@ private function getPaymentParameters(string $paymentClass): array 'businessrelation' => 'b2c', 'amount' => 10000, 'currency' => 'EUR', - 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1000000000000, 9999999999999)), + 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1_000_000_000_000, 9_999_999_999_999)), 'email' => 'test@example.com', 'bankaccountholder' => 'Test Test', 'iban' => 'DE62500105171314583819', diff --git a/src/Controller/WebhookController.php b/src/Controller/WebhookController.php index fda372596..ff9e74261 100644 --- a/src/Controller/WebhookController.php +++ b/src/Controller/WebhookController.php @@ -18,18 +18,15 @@ class WebhookController extends StorefrontController { - private WebhookProcessorInterface $webhookProcessor; + private readonly EntityRepository $notificationForwardRepository; - private EntityRepository $notificationForwardRepository; - - private MessageBusInterface $messageBus; + private readonly MessageBusInterface $messageBus; public function __construct( - WebhookProcessorInterface $webhookProcessor, + private readonly WebhookProcessorInterface $webhookProcessor, EntityRepository $notificationForwardRepository, MessageBusInterface $messageBus ) { - $this->webhookProcessor = $webhookProcessor; $this->notificationForwardRepository = $notificationForwardRepository; $this->messageBus = $messageBus; } diff --git a/src/DataAbstractionLayer/Entity/Card/PayonePaymentCardDefinition.php b/src/DataAbstractionLayer/Entity/Card/PayonePaymentCardDefinition.php index fdf9675a2..8231c4234 100644 --- a/src/DataAbstractionLayer/Entity/Card/PayonePaymentCardDefinition.php +++ b/src/DataAbstractionLayer/Entity/Card/PayonePaymentCardDefinition.php @@ -20,7 +20,7 @@ class PayonePaymentCardDefinition extends EntityDefinition { - public const ENTITY_NAME = 'payone_payment_card'; + final public const ENTITY_NAME = 'payone_payment_card'; public function getEntityName(): string { diff --git a/src/DataAbstractionLayer/Entity/Mandate/PayonePaymentMandateDefinition.php b/src/DataAbstractionLayer/Entity/Mandate/PayonePaymentMandateDefinition.php index 803b9e84d..e58ef93da 100644 --- a/src/DataAbstractionLayer/Entity/Mandate/PayonePaymentMandateDefinition.php +++ b/src/DataAbstractionLayer/Entity/Mandate/PayonePaymentMandateDefinition.php @@ -20,7 +20,7 @@ class PayonePaymentMandateDefinition extends EntityDefinition { - public const ENTITY_NAME = 'payone_payment_mandate'; + final public const ENTITY_NAME = 'payone_payment_mandate'; public function getEntityName(): string { diff --git a/src/DataAbstractionLayer/Entity/NotificationForward/PayonePaymentNotificationForwardDefinition.php b/src/DataAbstractionLayer/Entity/NotificationForward/PayonePaymentNotificationForwardDefinition.php index c7a47c46b..a8364f035 100644 --- a/src/DataAbstractionLayer/Entity/NotificationForward/PayonePaymentNotificationForwardDefinition.php +++ b/src/DataAbstractionLayer/Entity/NotificationForward/PayonePaymentNotificationForwardDefinition.php @@ -18,7 +18,7 @@ class PayonePaymentNotificationForwardDefinition extends EntityDefinition { - public const ENTITY_NAME = 'payone_payment_notification_forward'; + final public const ENTITY_NAME = 'payone_payment_notification_forward'; public function getEntityName(): string { diff --git a/src/DataAbstractionLayer/Entity/NotificationTarget/PayonePaymentNotificationTargetDefinition.php b/src/DataAbstractionLayer/Entity/NotificationTarget/PayonePaymentNotificationTargetDefinition.php index 92e31d035..6e9240358 100644 --- a/src/DataAbstractionLayer/Entity/NotificationTarget/PayonePaymentNotificationTargetDefinition.php +++ b/src/DataAbstractionLayer/Entity/NotificationTarget/PayonePaymentNotificationTargetDefinition.php @@ -15,7 +15,7 @@ class PayonePaymentNotificationTargetDefinition extends EntityDefinition { - public const ENTITY_NAME = 'payone_payment_notification_target'; + final public const ENTITY_NAME = 'payone_payment_notification_target'; public function getEntityName(): string { diff --git a/src/DataAbstractionLayer/Extension/PayonePaymentOrderTransactionExtension.php b/src/DataAbstractionLayer/Extension/PayonePaymentOrderTransactionExtension.php index 6fb90fb61..48409fdb9 100644 --- a/src/DataAbstractionLayer/Extension/PayonePaymentOrderTransactionExtension.php +++ b/src/DataAbstractionLayer/Extension/PayonePaymentOrderTransactionExtension.php @@ -12,7 +12,7 @@ class PayonePaymentOrderTransactionExtension extends EntityExtension { - public const NAME = 'payonePaymentOrderTransactionData'; + final public const NAME = 'payonePaymentOrderTransactionData'; public function extendFields(FieldCollection $collection): void { diff --git a/src/EventListener/CheckoutConfirmApplePayEventListener.php b/src/EventListener/CheckoutConfirmApplePayEventListener.php index 51d1e7e7e..fd3d74f49 100644 --- a/src/EventListener/CheckoutConfirmApplePayEventListener.php +++ b/src/EventListener/CheckoutConfirmApplePayEventListener.php @@ -21,11 +21,8 @@ class CheckoutConfirmApplePayEventListener implements EventSubscriberInterface { use RemovesPaymentMethod; - private string $kernelDirectory; - - public function __construct(string $kernelDirectory) + public function __construct(private readonly string $kernelDirectory) { - $this->kernelDirectory = $kernelDirectory; } public static function getSubscribedEvents(): array diff --git a/src/EventListener/CheckoutConfirmCartDataEventListener.php b/src/EventListener/CheckoutConfirmCartDataEventListener.php index d2f87fec6..d3a9fb115 100644 --- a/src/EventListener/CheckoutConfirmCartDataEventListener.php +++ b/src/EventListener/CheckoutConfirmCartDataEventListener.php @@ -26,20 +26,14 @@ class CheckoutConfirmCartDataEventListener implements EventSubscriberInterface { - private OrderConverter $orderConverter; - - private OrderFetcherInterface $orderFetcher; - - private CurrencyPrecisionInterface $currencyPrecision; + private readonly OrderConverter $orderConverter; public function __construct( OrderConverter $orderConverter, - OrderFetcherInterface $orderFetcher, - CurrencyPrecisionInterface $currencyPrecision + private readonly OrderFetcherInterface $orderFetcher, + private readonly CurrencyPrecisionInterface $currencyPrecision ) { $this->orderConverter = $orderConverter; - $this->orderFetcher = $orderFetcher; - $this->currencyPrecision = $currencyPrecision; } public static function getSubscribedEvents(): array @@ -97,9 +91,7 @@ private function hidePayonePaymentMethodsOnZeroAmountCart(Page $page, Cart $cart } $page->setPaymentMethods( - $page->getPaymentMethods()->filter(static function (PaymentMethodEntity $paymentMethod) { - return mb_strpos($paymentMethod->getHandlerIdentifier(), PaymentMethodInstaller::HANDLER_IDENTIFIER_ROOT_NAMESPACE) === false; - }) + $page->getPaymentMethods()->filter(static fn(PaymentMethodEntity $paymentMethod) => mb_strpos((string) $paymentMethod->getHandlerIdentifier(), PaymentMethodInstaller::HANDLER_IDENTIFIER_ROOT_NAMESPACE) === false) ); $salesChannelContext->assign(['paymentMethods' => $page->getPaymentMethods()]); diff --git a/src/EventListener/CheckoutConfirmCreditCardEventListener.php b/src/EventListener/CheckoutConfirmCreditCardEventListener.php index 458a90c68..9a40c4649 100644 --- a/src/EventListener/CheckoutConfirmCreditCardEventListener.php +++ b/src/EventListener/CheckoutConfirmCreditCardEventListener.php @@ -22,20 +22,14 @@ class CheckoutConfirmCreditCardEventListener implements EventSubscriberInterface { - private RequestParameterFactory $requestParameterFactory; - - private EntityRepository $languageRepository; - - private AbstractCardRoute $cardRoute; + private readonly EntityRepository $languageRepository; public function __construct( - RequestParameterFactory $requestParameterFactory, + private readonly RequestParameterFactory $requestParameterFactory, EntityRepository $languageRepository, - AbstractCardRoute $cardRoute + private readonly AbstractCardRoute $cardRoute ) { - $this->requestParameterFactory = $requestParameterFactory; $this->languageRepository = $languageRepository; - $this->cardRoute = $cardRoute; } public static function getSubscribedEvents(): array @@ -98,6 +92,6 @@ private function getCustomerLanguage(Context $context): string return 'en'; } - return substr($language->getLocale()->getCode(), 0, 2); + return substr((string) $language->getLocale()->getCode(), 0, 2); } } diff --git a/src/EventListener/CheckoutConfirmDebitEventListener.php b/src/EventListener/CheckoutConfirmDebitEventListener.php index 7827dbe7a..8aa7b821f 100644 --- a/src/EventListener/CheckoutConfirmDebitEventListener.php +++ b/src/EventListener/CheckoutConfirmDebitEventListener.php @@ -15,11 +15,8 @@ class CheckoutConfirmDebitEventListener implements EventSubscriberInterface { - private AbstractMandateRoute $mandateRoute; - - public function __construct(AbstractMandateRoute $mandateRoute) + public function __construct(private readonly AbstractMandateRoute $mandateRoute) { - $this->mandateRoute = $mandateRoute; } public static function getSubscribedEvents(): array diff --git a/src/EventListener/CheckoutConfirmEpsEventListener.php b/src/EventListener/CheckoutConfirmEpsEventListener.php index 7575e460c..61ff7d1d4 100644 --- a/src/EventListener/CheckoutConfirmEpsEventListener.php +++ b/src/EventListener/CheckoutConfirmEpsEventListener.php @@ -79,9 +79,7 @@ private function isAtCustomer(SalesChannelContext $context): bool private function removePaymentMethod(PaymentMethodCollection $paymentMethods, string $paymentMethodId): PaymentMethodCollection { return $paymentMethods->filter( - static function (PaymentMethodEntity $paymentMethod) use ($paymentMethodId) { - return $paymentMethod->getId() !== $paymentMethodId; - } + static fn(PaymentMethodEntity $paymentMethod) => $paymentMethod->getId() !== $paymentMethodId ); } } diff --git a/src/EventListener/CheckoutConfirmIDealEventListener.php b/src/EventListener/CheckoutConfirmIDealEventListener.php index 17073729f..71db4674e 100644 --- a/src/EventListener/CheckoutConfirmIDealEventListener.php +++ b/src/EventListener/CheckoutConfirmIDealEventListener.php @@ -79,9 +79,7 @@ private function isNlCustomer(SalesChannelContext $context): bool private function removePaymentMethod(PaymentMethodCollection $paymentMethods, string $paymentMethodId): PaymentMethodCollection { return $paymentMethods->filter( - static function (PaymentMethodEntity $paymentMethod) use ($paymentMethodId) { - return $paymentMethod->getId() !== $paymentMethodId; - } + static fn(PaymentMethodEntity $paymentMethod) => $paymentMethod->getId() !== $paymentMethodId ); } } diff --git a/src/EventListener/CheckoutConfirmKlarnaPaymentEventListener.php b/src/EventListener/CheckoutConfirmKlarnaPaymentEventListener.php index 846b47d8e..729c98b9e 100644 --- a/src/EventListener/CheckoutConfirmKlarnaPaymentEventListener.php +++ b/src/EventListener/CheckoutConfirmKlarnaPaymentEventListener.php @@ -18,16 +18,13 @@ class CheckoutConfirmKlarnaPaymentEventListener implements EventSubscriberInterface { - private TranslatorInterface $translator; - - private KlarnaSessionServiceInterface $klarnaSessionService; + private readonly TranslatorInterface $translator; public function __construct( TranslatorInterface $translator, - KlarnaSessionServiceInterface $klarnaSessionService + private readonly KlarnaSessionServiceInterface $klarnaSessionService ) { $this->translator = $translator; - $this->klarnaSessionService = $klarnaSessionService; } public static function getSubscribedEvents(): array @@ -69,7 +66,7 @@ public function initiateSession($event): void CheckoutCartPaymentData::DATA_WORK_ORDER_ID => $sessionStruct->getWorkorderId(), CheckoutCartPaymentData::DATA_CART_HASH => $sessionStruct->getCartHash(), ]); - } catch (PayoneRequestException $e) { + } catch (PayoneRequestException) { $session = $event->getRequest()->getSession(); if ($session instanceof Session) { $session->getFlashBag()->add( diff --git a/src/EventListener/CheckoutConfirmPayolutionEventListener.php b/src/EventListener/CheckoutConfirmPayolutionEventListener.php index a27c1f7a4..87d42cdea 100644 --- a/src/EventListener/CheckoutConfirmPayolutionEventListener.php +++ b/src/EventListener/CheckoutConfirmPayolutionEventListener.php @@ -18,11 +18,8 @@ class CheckoutConfirmPayolutionEventListener implements EventSubscriberInterface { - private ConfigReaderInterface $configReader; - - public function __construct(ConfigReaderInterface $configReader) + public function __construct(private readonly ConfigReaderInterface $configReader) { - $this->configReader = $configReader; } public static function getSubscribedEvents(): array @@ -63,9 +60,7 @@ public function hidePaymentMethodsForCompanies(PageLoadedEvent $event): void private function removePaymentMethod(PaymentMethodCollection $paymentMethods, string $paymentMethodId): PaymentMethodCollection { return $paymentMethods->filter( - static function (PaymentMethodEntity $paymentMethod) use ($paymentMethodId) { - return $paymentMethod->getId() !== $paymentMethodId; - } + static fn(PaymentMethodEntity $paymentMethod) => $paymentMethod->getId() !== $paymentMethodId ); } diff --git a/src/EventListener/CheckoutConfirmRatepayEventListener.php b/src/EventListener/CheckoutConfirmRatepayEventListener.php index 10a912b6c..1b5ab3bbc 100644 --- a/src/EventListener/CheckoutConfirmRatepayEventListener.php +++ b/src/EventListener/CheckoutConfirmRatepayEventListener.php @@ -25,18 +25,12 @@ class CheckoutConfirmRatepayEventListener implements EventSubscriberInterface { protected SystemConfigService $systemConfigService; - protected InstallmentServiceInterface $installmentService; - - protected ProfileServiceInterface $profileService; - public function __construct( SystemConfigService $systemConfigService, - InstallmentServiceInterface $installmentService, - ProfileServiceInterface $profileService + protected InstallmentServiceInterface $installmentService, + protected ProfileServiceInterface $profileService ) { $this->systemConfigService = $systemConfigService; - $this->installmentService = $installmentService; - $this->profileService = $profileService; } public static function getSubscribedEvents(): array @@ -117,9 +111,7 @@ public function addPayonePageData(PageLoadedEvent $event): void protected function removePaymentMethods(PaymentMethodCollection $paymentMethods, array $paymentHandler): PaymentMethodCollection { return $paymentMethods->filter( - static function (PaymentMethodEntity $paymentMethod) use ($paymentHandler) { - return !\in_array($paymentMethod->getHandlerIdentifier(), $paymentHandler, true); - } + static fn(PaymentMethodEntity $paymentMethod) => !\in_array($paymentMethod->getHandlerIdentifier(), $paymentHandler, true) ); } diff --git a/src/EventListener/CheckoutConfirmSecuredInstallmentEventListener.php b/src/EventListener/CheckoutConfirmSecuredInstallmentEventListener.php index 4d522afd0..89963fc51 100644 --- a/src/EventListener/CheckoutConfirmSecuredInstallmentEventListener.php +++ b/src/EventListener/CheckoutConfirmSecuredInstallmentEventListener.php @@ -18,11 +18,8 @@ class CheckoutConfirmSecuredInstallmentEventListener implements EventSubscriberInterface { - protected InstallmentServiceInterface $installmentService; - - public function __construct(InstallmentServiceInterface $installmentService) + public function __construct(protected InstallmentServiceInterface $installmentService) { - $this->installmentService = $installmentService; } public static function getSubscribedEvents(): array @@ -64,9 +61,7 @@ protected function addInstallmentOptionsData(Page $page, SalesChannelContext $co protected function removePaymentMethods(PaymentMethodCollection $paymentMethods, array $paymentHandler): PaymentMethodCollection { return $paymentMethods->filter( - static function (PaymentMethodEntity $paymentMethod) use ($paymentHandler) { - return !\in_array($paymentMethod->getHandlerIdentifier(), $paymentHandler, true); - } + static fn(PaymentMethodEntity $paymentMethod) => !\in_array($paymentMethod->getHandlerIdentifier(), $paymentHandler, true) ); } } diff --git a/src/EventListener/CheckoutConfirmTrustlyEventListener.php b/src/EventListener/CheckoutConfirmTrustlyEventListener.php index f89d3f5bb..d7f3d01bb 100644 --- a/src/EventListener/CheckoutConfirmTrustlyEventListener.php +++ b/src/EventListener/CheckoutConfirmTrustlyEventListener.php @@ -92,9 +92,7 @@ private function isAllowedCountryCustomer(SalesChannelContext $context): bool private function removePaymentMethod(PaymentMethodCollection $paymentMethods, string $paymentMethodId): PaymentMethodCollection { return $paymentMethods->filter( - static function (PaymentMethodEntity $paymentMethod) use ($paymentMethodId) { - return $paymentMethod->getId() !== $paymentMethodId; - } + static fn(PaymentMethodEntity $paymentMethod) => $paymentMethod->getId() !== $paymentMethodId ); } } diff --git a/src/EventListener/CheckoutFinishEventListener.php b/src/EventListener/CheckoutFinishEventListener.php index 8da20974f..2b0d9f717 100644 --- a/src/EventListener/CheckoutFinishEventListener.php +++ b/src/EventListener/CheckoutFinishEventListener.php @@ -21,9 +21,9 @@ class CheckoutFinishEventListener implements EventSubscriberInterface { - private EntityRepository $mandateRepository; + private readonly EntityRepository $mandateRepository; - private EntityRepository $orderTransactionRepository; + private readonly EntityRepository $orderTransactionRepository; public function __construct( EntityRepository $mandateRepository, diff --git a/src/EventListener/DeviceFingerprintEventListener.php b/src/EventListener/DeviceFingerprintEventListener.php index e8a407c0f..4ddf49d8a 100644 --- a/src/EventListener/DeviceFingerprintEventListener.php +++ b/src/EventListener/DeviceFingerprintEventListener.php @@ -14,11 +14,8 @@ class DeviceFingerprintEventListener implements EventSubscriberInterface { - protected DeviceFingerprintServiceCollectionInterface $deviceFingerprintServiceCollection; - - public function __construct(DeviceFingerprintServiceCollectionInterface $deviceFingerprintServiceCollection) + public function __construct(protected DeviceFingerprintServiceCollectionInterface $deviceFingerprintServiceCollection) { - $this->deviceFingerprintServiceCollection = $deviceFingerprintServiceCollection; } public static function getSubscribedEvents(): array diff --git a/src/EventListener/InvoiceRendererEventListener.php b/src/EventListener/InvoiceRendererEventListener.php index a67c264a4..c67fbed5a 100644 --- a/src/EventListener/InvoiceRendererEventListener.php +++ b/src/EventListener/InvoiceRendererEventListener.php @@ -13,11 +13,8 @@ class InvoiceRendererEventListener implements EventSubscriberInterface { - private ConfigReaderInterface $configReader; - - public function __construct(ConfigReaderInterface $configReader) + public function __construct(private readonly ConfigReaderInterface $configReader) { - $this->configReader = $configReader; } public static function getSubscribedEvents(): array diff --git a/src/EventListener/KernelEventListener.php b/src/EventListener/KernelEventListener.php index 0445d810f..cead3f173 100644 --- a/src/EventListener/KernelEventListener.php +++ b/src/EventListener/KernelEventListener.php @@ -14,11 +14,8 @@ class KernelEventListener implements EventSubscriberInterface { - private ProfileServiceInterface $profileService; - - public function __construct(ProfileServiceInterface $profileService) + public function __construct(private readonly ProfileServiceInterface $profileService) { - $this->profileService = $profileService; } public static function getSubscribedEvents(): array @@ -62,7 +59,7 @@ protected function setResponseData(JsonResponse $response, array $updateResults) $data = []; if ($response->getContent()) { - $data = json_decode($response->getContent(), true); + $data = json_decode((string) $response->getContent(), true, 512, JSON_THROW_ON_ERROR); } $data['payoneRatepayProfilesUpdateResult'] = []; diff --git a/src/EventListener/OrderValidationEventListener.php b/src/EventListener/OrderValidationEventListener.php index acaca8289..26473a013 100644 --- a/src/EventListener/OrderValidationEventListener.php +++ b/src/EventListener/OrderValidationEventListener.php @@ -16,9 +16,9 @@ class OrderValidationEventListener implements EventSubscriberInterface { - private RequestStack $requestStack; + private readonly RequestStack $requestStack; - private PaymentHandlerRegistry $paymentHandlerRegistry; + private readonly PaymentHandlerRegistry $paymentHandlerRegistry; public function __construct(RequestStack $requestStack, PaymentHandlerRegistry $paymentHandlerRegistry) { diff --git a/src/EventListener/PaypalExpressAddressValidationEventListener.php b/src/EventListener/PaypalExpressAddressValidationEventListener.php index a794fdcb2..a0dfe1355 100644 --- a/src/EventListener/PaypalExpressAddressValidationEventListener.php +++ b/src/EventListener/PaypalExpressAddressValidationEventListener.php @@ -14,7 +14,7 @@ class PaypalExpressAddressValidationEventListener implements EventSubscriberInterface { - private RequestStack $requestStack; + private readonly RequestStack $requestStack; public function __construct(RequestStack $requestStack) { @@ -72,7 +72,7 @@ public function disableAdditionalAddressValidation(BuildValidationEvent $event): return; } - if (\mb_strpos($request->getPathInfo(), '/payone/paypal/redirect-handler') === false) { + if (\mb_strpos((string) $request->getPathInfo(), '/payone/paypal/redirect-handler') === false) { return; } @@ -87,7 +87,7 @@ public function disableBirthdayValidation(BuildValidationEvent $event): void return; } - if (\mb_strpos($request->getPathInfo(), '/payone/paypal/redirect-handler') === false) { + if (\mb_strpos((string) $request->getPathInfo(), '/payone/paypal/redirect-handler') === false) { return; } diff --git a/src/EventListener/RemovesPaymentMethod.php b/src/EventListener/RemovesPaymentMethod.php index ae780fcc2..447866d01 100644 --- a/src/EventListener/RemovesPaymentMethod.php +++ b/src/EventListener/RemovesPaymentMethod.php @@ -16,9 +16,7 @@ trait RemovesPaymentMethod protected function removePaymentMethod(PaymentMethodCollection $paymentMethods, string $paymentMethodId): PaymentMethodCollection { return $paymentMethods->filter( - static function (PaymentMethodEntity $paymentMethod) use ($paymentMethodId) { - return $paymentMethod->getId() !== $paymentMethodId; - } + static fn(PaymentMethodEntity $paymentMethod) => $paymentMethod->getId() !== $paymentMethodId ); } } diff --git a/src/EventListener/StorefrontRenderEventListener.php b/src/EventListener/StorefrontRenderEventListener.php index 61787e314..acc8ac095 100644 --- a/src/EventListener/StorefrontRenderEventListener.php +++ b/src/EventListener/StorefrontRenderEventListener.php @@ -21,18 +21,15 @@ class StorefrontRenderEventListener implements EventSubscriberInterface { - private CacheItemPoolInterface $cachePool; + private readonly SalesChannelRepository $paymentMethodRepository; - private SalesChannelRepository $paymentMethodRepository; - - private EntityRepository $salesChannelRepository; + private readonly EntityRepository $salesChannelRepository; public function __construct( - CacheItemPoolInterface $cachePool, + private readonly CacheItemPoolInterface $cachePool, SalesChannelRepository $repository, EntityRepository $salesChannelRepository ) { - $this->cachePool = $cachePool; $this->paymentMethodRepository = $repository; $this->salesChannelRepository = $salesChannelRepository; } @@ -105,7 +102,7 @@ private function collectPrimaryKeys(array $primaryKeys): array foreach ($primaryKeys as $key) { if (\is_array($key)) { - $ids = array_merge($ids, array_values($key)); + $ids = [...$ids, ...array_values($key)]; } else { $ids[] = $key; } diff --git a/src/Installer/ConfigInstaller.php b/src/Installer/ConfigInstaller.php index d987fe372..60475a093 100644 --- a/src/Installer/ConfigInstaller.php +++ b/src/Installer/ConfigInstaller.php @@ -15,14 +15,14 @@ class ConfigInstaller implements InstallerInterface { - public const CONFIG_FIELD_ACCOUNT_ID = 'accountId'; - public const CONFIG_FIELD_MERCHANT_ID = 'merchantId'; - public const CONFIG_FIELD_PORTAL_ID = 'portalId'; - public const CONFIG_FIELD_PORTAL_KEY = 'portalKey'; - public const CONFIG_FIELD_TRANSACTION_MODE = 'transactionMode'; - public const CONFIG_FIELD_PAYOLUTION_INVOICING_TRANSFER_COMPANY_DATA = 'payolutionInvoicingTransferCompanyData'; - public const CONFIG_FIELD_PAYOLUTION_INSTALLMENT_CHANNEL_NAME = 'payolutionInstallmentChannelName'; - public const CONFIG_FIELD_PAYOLUTION_INSTALLMENT_CHANNEL_PASSWORD = 'payolutionInstallmentChannelPassword'; + final public const CONFIG_FIELD_ACCOUNT_ID = 'accountId'; + final public const CONFIG_FIELD_MERCHANT_ID = 'merchantId'; + final public const CONFIG_FIELD_PORTAL_ID = 'portalId'; + final public const CONFIG_FIELD_PORTAL_KEY = 'portalKey'; + final public const CONFIG_FIELD_TRANSACTION_MODE = 'transactionMode'; + final public const CONFIG_FIELD_PAYOLUTION_INVOICING_TRANSFER_COMPANY_DATA = 'payolutionInvoicingTransferCompanyData'; + final public const CONFIG_FIELD_PAYOLUTION_INSTALLMENT_CHANNEL_NAME = 'payolutionInstallmentChannelName'; + final public const CONFIG_FIELD_PAYOLUTION_INSTALLMENT_CHANNEL_PASSWORD = 'payolutionInstallmentChannelPassword'; private const STATE_MACHINE_TRANSITION_ACTION_PAY = 'pay'; private const STATE_MACHINE_TRANSITION_ACTION_PAY_PARTIALLY = 'pay_partially'; @@ -68,7 +68,7 @@ class ConfigInstaller implements InstallerInterface 'paymentStatusInvoice' => [self::STATE_MACHINE_TRANSITION_ACTION_PAY => StateMachineTransitionActions::ACTION_PAID], ]; - private SystemConfigService $systemConfigService; + private readonly SystemConfigService $systemConfigService; public function __construct(SystemConfigService $systemConfigService) { diff --git a/src/Installer/CustomFieldInstaller.php b/src/Installer/CustomFieldInstaller.php index cc887adc6..f5a5f3e31 100644 --- a/src/Installer/CustomFieldInstaller.php +++ b/src/Installer/CustomFieldInstaller.php @@ -15,23 +15,23 @@ class CustomFieldInstaller implements InstallerInterface { - public const CAPTURED_QUANTITY = 'payone_captured_quantity'; - public const REFUNDED_QUANTITY = 'payone_refunded_quantity'; - public const CUSTOMER_PHONE_NUMBER = 'payone_customer_phone_number'; - public const CUSTOMER_BIRTHDAY = 'payone_customer_birthday'; + final public const CAPTURED_QUANTITY = 'payone_captured_quantity'; + final public const REFUNDED_QUANTITY = 'payone_refunded_quantity'; + final public const CUSTOMER_PHONE_NUMBER = 'payone_customer_phone_number'; + final public const CUSTOMER_BIRTHDAY = 'payone_customer_birthday'; - public const FIELDSET_ID_ORDER_TRANSACTION = 'aacbcf9bedfb4827853b75c5fd278d3f'; - public const FIELDSET_ID_ORDER_LINE_ITEM = '12f3f06c895e11eabc550242ac130003'; - public const FIELDSET_ID_PAYMENT_METHOD = 'ed39626e94fd4dfe9d81976fdbcdb06c'; - public const FIELDSET_ID_CUSTOMER = '8e4a0b8f7eb04272ad874f3b22cf4935'; + final public const FIELDSET_ID_ORDER_TRANSACTION = 'aacbcf9bedfb4827853b75c5fd278d3f'; + final public const FIELDSET_ID_ORDER_LINE_ITEM = '12f3f06c895e11eabc550242ac130003'; + final public const FIELDSET_ID_PAYMENT_METHOD = 'ed39626e94fd4dfe9d81976fdbcdb06c'; + final public const FIELDSET_ID_CUSTOMER = '8e4a0b8f7eb04272ad874f3b22cf4935'; - private EntityRepository $customFieldRepository; + private readonly EntityRepository $customFieldRepository; - private EntityRepository $customFieldSetRepository; + private readonly EntityRepository $customFieldSetRepository; - private array $customFields; + private readonly array $customFields; - private array $customFieldSets; + private readonly array $customFieldSets; public function __construct(EntityRepository $customFieldSetRepository, EntityRepository $customFieldRepository) { diff --git a/src/Installer/PaymentMethodInstaller.php b/src/Installer/PaymentMethodInstaller.php index e8d6deab1..255079e31 100644 --- a/src/Installer/PaymentMethodInstaller.php +++ b/src/Installer/PaymentMethodInstaller.php @@ -52,7 +52,7 @@ class PaymentMethodInstaller implements InstallerInterface { - public const PAYMENT_METHOD_IDS = [ + final public const PAYMENT_METHOD_IDS = [ PayoneApplePay::class => '4cbc89a06e544c06b413a41d158f5e00', PayoneCreditCard::class => '37f90a48d9194762977c9e6db36334e0', PayoneDebit::class => '1b017bef157b4222b734659361d996fd', @@ -86,9 +86,9 @@ class PaymentMethodInstaller implements InstallerInterface PayoneSecuredDirectDebit::class => '72c4c88b918441848e20081de67a16c4', ]; - public const HANDLER_IDENTIFIER_ROOT_NAMESPACE = 'PayonePayment'; + final public const HANDLER_IDENTIFIER_ROOT_NAMESPACE = 'PayonePayment'; - public const PAYMENT_METHODS = [ + final public const PAYMENT_METHODS = [ PayoneApplePay::class, PayoneCreditCard::class, PayoneDebit::class, @@ -122,7 +122,7 @@ class PaymentMethodInstaller implements InstallerInterface PayoneSecuredDirectDebit::class, ]; - public const AFTER_ORDER_PAYMENT_METHODS = [ + final public const AFTER_ORDER_PAYMENT_METHODS = [ PayoneApplePay::class, PayoneCreditCard::class, PayoneDebit::class, @@ -146,15 +146,15 @@ class PaymentMethodInstaller implements InstallerInterface PayonePostfinanceWallet::class, ]; - private PluginIdProvider $pluginIdProvider; + private readonly PluginIdProvider $pluginIdProvider; - private EntityRepository $paymentMethodRepository; + private readonly EntityRepository $paymentMethodRepository; - private EntityRepository $salesChannelRepository; + private readonly EntityRepository $salesChannelRepository; - private EntityRepository $paymentMethodSalesChannelRepository; + private readonly EntityRepository $paymentMethodSalesChannelRepository; - private Connection $connection; + private readonly Connection $connection; public function __construct( PluginIdProvider $pluginIdProvider, @@ -248,7 +248,7 @@ private function upsertPaymentMethod(PaymentMethodInterface $paymentMethod, Cont 'id' => $paymentMethod->getId(), 'handlerIdentifier' => $paymentMethod->getPaymentHandler(), 'pluginId' => $pluginId, - 'afterOrderEnabled' => \in_array(\get_class($paymentMethod), self::AFTER_ORDER_PAYMENT_METHODS, true), + 'afterOrderEnabled' => \in_array($paymentMethod::class, self::AFTER_ORDER_PAYMENT_METHODS, true), ]; // Find existing payment method by ID for update / install decision diff --git a/src/Installer/RuleInstaller/RuleInstallerSecureInvoice.php b/src/Installer/RuleInstaller/RuleInstallerSecureInvoice.php index 6afb4d3fd..50aa2091d 100644 --- a/src/Installer/RuleInstaller/RuleInstallerSecureInvoice.php +++ b/src/Installer/RuleInstaller/RuleInstallerSecureInvoice.php @@ -23,13 +23,13 @@ class RuleInstallerSecureInvoice implements InstallerInterface { - public const VALID_COUNTRIES = [ + final public const VALID_COUNTRIES = [ 'AT', 'CH', 'DE', ]; - public const CURRENCIES = [ + final public const CURRENCIES = [ 'EUR', ]; @@ -39,13 +39,13 @@ class RuleInstallerSecureInvoice implements InstallerInterface private const CONDITION_ID_CURRENCY = '6099e1e292f737aa31c126a73339c92e'; private const CONDITION_ID_DIFFERENT_ADDRESSES = 'f1a5251ffcd09b5dc0befc059dfad9c1'; - private EntityRepository $ruleRepository; + private readonly EntityRepository $ruleRepository; - private EntityRepository $countryRepository; + private readonly EntityRepository $countryRepository; - private EntityRepository $currencyRepository; + private readonly EntityRepository $currencyRepository; - private EntityRepository $paymentMethodRepository; + private readonly EntityRepository $paymentMethodRepository; public function __construct( EntityRepository $ruleRepository, @@ -170,7 +170,7 @@ private function getCountryIds(Context $context): array $countryIds = $this->countryRepository->searchIds($criteria, $context)->getIds(); - if (\count($countryIds) === 0) { + if ((is_countable($countryIds) ? \count($countryIds) : 0) === 0) { // if country does not exist, enter invalid uuid so rule always fails. empty is not allowed return [Uuid::randomHex()]; } @@ -187,7 +187,7 @@ private function getCurrencyIds(Context $context): array $currencyIds = $this->currencyRepository->searchIds($criteria, $context)->getIds(); - if (\count($currencyIds) === 0) { + if ((is_countable($currencyIds) ? \count($currencyIds) : 0) === 0) { // if currency does not exist, enter invalid uuid so rule always fails. empty is not allowed return [Uuid::randomHex()]; } diff --git a/src/Migration/Migration1557926559AddTemporaryRedirectTable.php b/src/Migration/Migration1557926559AddTemporaryRedirectTable.php index 7bdee475a..827cbab5b 100644 --- a/src/Migration/Migration1557926559AddTemporaryRedirectTable.php +++ b/src/Migration/Migration1557926559AddTemporaryRedirectTable.php @@ -11,7 +11,7 @@ class Migration1557926559AddTemporaryRedirectTable extends MigrationStep { public function getCreationTimestamp(): int { - return 1557926559; + return 1_557_926_559; } public function update(Connection $connection): void diff --git a/src/Migration/Migration1561379069AddPayonePaymentCardTable.php b/src/Migration/Migration1561379069AddPayonePaymentCardTable.php index fada690d4..aa7dfc15b 100644 --- a/src/Migration/Migration1561379069AddPayonePaymentCardTable.php +++ b/src/Migration/Migration1561379069AddPayonePaymentCardTable.php @@ -11,7 +11,7 @@ class Migration1561379069AddPayonePaymentCardTable extends MigrationStep { public function getCreationTimestamp(): int { - return 1561379069; + return 1_561_379_069; } public function update(Connection $connection): void diff --git a/src/Migration/Migration1562097986AddPayonePaymentMandateTable.php b/src/Migration/Migration1562097986AddPayonePaymentMandateTable.php index bad08a432..be66d9aae 100644 --- a/src/Migration/Migration1562097986AddPayonePaymentMandateTable.php +++ b/src/Migration/Migration1562097986AddPayonePaymentMandateTable.php @@ -11,7 +11,7 @@ class Migration1562097986AddPayonePaymentMandateTable extends MigrationStep { public function getCreationTimestamp(): int { - return 1562097986; + return 1_562_097_986; } public function update(Connection $connection): void diff --git a/src/Migration/Migration1580996279AddRedirectTableCreatedDate.php b/src/Migration/Migration1580996279AddRedirectTableCreatedDate.php index 81734517a..d9f102157 100644 --- a/src/Migration/Migration1580996279AddRedirectTableCreatedDate.php +++ b/src/Migration/Migration1580996279AddRedirectTableCreatedDate.php @@ -11,7 +11,7 @@ class Migration1580996279AddRedirectTableCreatedDate extends MigrationStep { public function getCreationTimestamp(): int { - return 1580996279; + return 1_580_996_279; } public function update(Connection $connection): void diff --git a/src/Migration/Migration1625137302AddNotificationForwardTable.php b/src/Migration/Migration1625137302AddNotificationForwardTable.php index 7e4a36687..06318704f 100644 --- a/src/Migration/Migration1625137302AddNotificationForwardTable.php +++ b/src/Migration/Migration1625137302AddNotificationForwardTable.php @@ -11,7 +11,7 @@ class Migration1625137302AddNotificationForwardTable extends MigrationStep { public function getCreationTimestamp(): int { - return 1625137302; + return 1_625_137_302; } public function update(Connection $connection): void diff --git a/src/Migration/Migration1625137302AddNotificationTargetTable.php b/src/Migration/Migration1625137302AddNotificationTargetTable.php index f032aaa9f..6ba4d6a09 100644 --- a/src/Migration/Migration1625137302AddNotificationTargetTable.php +++ b/src/Migration/Migration1625137302AddNotificationTargetTable.php @@ -11,7 +11,7 @@ class Migration1625137302AddNotificationTargetTable extends MigrationStep { public function getCreationTimestamp(): int { - return 1625137302; + return 1_625_137_302; } public function update(Connection $connection): void diff --git a/src/Migration/Migration1637576753FixForeignKeyConstraints.php b/src/Migration/Migration1637576753FixForeignKeyConstraints.php index 4d8925433..eaf94fbfd 100644 --- a/src/Migration/Migration1637576753FixForeignKeyConstraints.php +++ b/src/Migration/Migration1637576753FixForeignKeyConstraints.php @@ -11,7 +11,7 @@ class Migration1637576753FixForeignKeyConstraints extends MigrationStep { public function getCreationTimestamp(): int { - return 1637576753; + return 1_637_576_753; } public function update(Connection $connection): void diff --git a/src/Migration/Migration1638289341AddOrderTransActionDataTable.php b/src/Migration/Migration1638289341AddOrderTransActionDataTable.php index d6179dfe2..5d162d53d 100644 --- a/src/Migration/Migration1638289341AddOrderTransActionDataTable.php +++ b/src/Migration/Migration1638289341AddOrderTransActionDataTable.php @@ -14,7 +14,7 @@ class Migration1638289341AddOrderTransActionDataTable extends MigrationStep public function getCreationTimestamp(): int { - return 1638289341; + return 1_638_289_341; } public function update(Connection $connection): void diff --git a/src/Migration/Migration1639050658MigrateOrderTransactionDataFromCustomFields.php b/src/Migration/Migration1639050658MigrateOrderTransactionDataFromCustomFields.php index f0b4ab715..27c321775 100644 --- a/src/Migration/Migration1639050658MigrateOrderTransactionDataFromCustomFields.php +++ b/src/Migration/Migration1639050658MigrateOrderTransactionDataFromCustomFields.php @@ -11,7 +11,7 @@ class Migration1639050658MigrateOrderTransactionDataFromCustomFields extends Mig { public function getCreationTimestamp(): int { - return 1639050658; + return 1_639_050_658; } public function update(Connection $connection): void @@ -68,7 +68,7 @@ public function update(Connection $connection): void } $connection->commit(); - } catch (\Throwable $e) { + } catch (\Throwable) { $connection->rollBack(); throw new \RuntimeException('An error occurred while migrating payone custom field values'); @@ -110,7 +110,7 @@ public function update(Connection $connection): void } $connection->commit(); - } catch (\Throwable $e) { + } catch (\Throwable) { $connection->rollBack(); throw new \RuntimeException('An error occurred while unsetting payone custom field values'); diff --git a/src/Migration/Migration1666770470AddCardTypeToCardTable.php b/src/Migration/Migration1666770470AddCardTypeToCardTable.php index 6786c7afc..4c3ab32da 100644 --- a/src/Migration/Migration1666770470AddCardTypeToCardTable.php +++ b/src/Migration/Migration1666770470AddCardTypeToCardTable.php @@ -11,7 +11,7 @@ class Migration1666770470AddCardTypeToCardTable extends MigrationStep { public function getCreationTimestamp(): int { - return 1666770470; + return 1_666_770_470; } public function update(Connection $connection): void diff --git a/src/PaymentHandler/AbstractKlarnaPaymentHandler.php b/src/PaymentHandler/AbstractKlarnaPaymentHandler.php index dbe92f74e..8ff3be2c8 100644 --- a/src/PaymentHandler/AbstractKlarnaPaymentHandler.php +++ b/src/PaymentHandler/AbstractKlarnaPaymentHandler.php @@ -30,37 +30,22 @@ abstract class AbstractKlarnaPaymentHandler extends AbstractPayonePaymentHandler { protected TranslatorInterface $translator; - protected CartHasherInterface $cartHasher; - - private RequestParameterFactory $requestParameterFactory; - - private PayoneClientInterface $client; - - private TransactionDataHandlerInterface $dataHandler; - - private PaymentStateHandlerInterface $stateHandler; - public function __construct( ConfigReaderInterface $configReader, EntityRepository $lineItemRepository, RequestStack $requestStack, TranslatorInterface $translator, - RequestParameterFactory $requestParameterFactory, - PayoneClientInterface $client, - TransactionDataHandlerInterface $dataHandler, - CartHasherInterface $cartHasher, - PaymentStateHandlerInterface $stateHandler + private readonly RequestParameterFactory $requestParameterFactory, + private readonly PayoneClientInterface $client, + private readonly TransactionDataHandlerInterface $dataHandler, + protected CartHasherInterface $cartHasher, + private readonly PaymentStateHandlerInterface $stateHandler ) { $this->configReader = $configReader; $this->lineItemRepository = $lineItemRepository; $this->requestStack = $requestStack; $this->translator = $translator; - $this->requestParameterFactory = $requestParameterFactory; - $this->client = $client; - $this->dataHandler = $dataHandler; - $this->cartHasher = $cartHasher; parent::__construct($configReader, $lineItemRepository, $requestStack); - $this->stateHandler = $stateHandler; } public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $dataBag, SalesChannelContext $salesChannelContext): RedirectResponse diff --git a/src/PaymentHandler/AbstractPayoneInvoicePaymentHandler.php b/src/PaymentHandler/AbstractPayoneInvoicePaymentHandler.php index d35494290..41f4372bf 100644 --- a/src/PaymentHandler/AbstractPayoneInvoicePaymentHandler.php +++ b/src/PaymentHandler/AbstractPayoneInvoicePaymentHandler.php @@ -22,29 +22,19 @@ abstract class AbstractPayoneInvoicePaymentHandler extends AbstractPayonePaymentHandler implements SynchronousPaymentHandlerInterface { - private PayoneClientInterface $client; - - private TranslatorInterface $translator; - - private TransactionDataHandlerInterface $dataHandler; - - private RequestParameterFactory $requestParameterFactory; + private readonly TranslatorInterface $translator; public function __construct( ConfigReaderInterface $configReader, - PayoneClientInterface $client, + private readonly PayoneClientInterface $client, TranslatorInterface $translator, - TransactionDataHandlerInterface $dataHandler, + private readonly TransactionDataHandlerInterface $dataHandler, EntityRepository $lineItemRepository, RequestStack $requestStack, - RequestParameterFactory $requestParameterFactory + private readonly RequestParameterFactory $requestParameterFactory ) { parent::__construct($configReader, $lineItemRepository, $requestStack); - - $this->client = $client; $this->translator = $translator; - $this->dataHandler = $dataHandler; - $this->requestParameterFactory = $requestParameterFactory; } /** @@ -80,7 +70,7 @@ public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $d $transaction->getOrderTransaction()->getId(), $exception->getResponse()['error']['CustomerMessage'] ); - } catch (\Throwable $exception) { + } catch (\Throwable) { throw new SyncPaymentProcessException( $transaction->getOrderTransaction()->getId(), $this->translator->trans('PayonePayment.errorMessages.genericError') diff --git a/src/PaymentHandler/AbstractPayonePaymentHandler.php b/src/PaymentHandler/AbstractPayonePaymentHandler.php index e98b72a78..f01b200d1 100644 --- a/src/PaymentHandler/AbstractPayonePaymentHandler.php +++ b/src/PaymentHandler/AbstractPayonePaymentHandler.php @@ -20,37 +20,34 @@ */ abstract class AbstractPayonePaymentHandler implements PayonePaymentHandlerInterface { - public const PAYONE_STATE_COMPLETED = 'completed'; - public const PAYONE_STATE_PENDING = 'pending'; + final public const PAYONE_STATE_COMPLETED = 'completed'; + final public const PAYONE_STATE_PENDING = 'pending'; - public const PAYONE_CLEARING_FNC = 'fnc'; - public const PAYONE_CLEARING_VOR = 'vor'; - public const PAYONE_CLEARING_REC = 'rec'; + final public const PAYONE_CLEARING_FNC = 'fnc'; + final public const PAYONE_CLEARING_VOR = 'vor'; + final public const PAYONE_CLEARING_REC = 'rec'; - public const PAYONE_FINANCING_PIV = 'PIV'; - public const PAYONE_FINANCING_PIN = 'PIN'; - public const PAYONE_FINANCING_PDD = 'PDD'; + final public const PAYONE_FINANCING_PIV = 'PIV'; + final public const PAYONE_FINANCING_PIN = 'PIN'; + final public const PAYONE_FINANCING_PDD = 'PDD'; - public const PAYONE_FINANCING_PYV = 'PYV'; - public const PAYONE_FINANCING_PYS = 'PYS'; - public const PAYONE_FINANCING_PYD = 'PYD'; + final public const PAYONE_FINANCING_PYV = 'PYV'; + final public const PAYONE_FINANCING_PYS = 'PYS'; + final public const PAYONE_FINANCING_PYD = 'PYD'; - public const PAYONE_FINANCING_RPV = 'RPV'; - public const PAYONE_FINANCING_RPS = 'RPS'; - public const PAYONE_FINANCING_RPD = 'RPD'; - - protected ConfigReaderInterface $configReader; + final public const PAYONE_FINANCING_RPV = 'RPV'; + final public const PAYONE_FINANCING_RPS = 'RPS'; + final public const PAYONE_FINANCING_RPD = 'RPD'; protected EntityRepository $lineItemRepository; protected RequestStack $requestStack; public function __construct( - ConfigReaderInterface $configReader, + protected ConfigReaderInterface $configReader, EntityRepository $lineItemRepository, RequestStack $requestStack ) { - $this->configReader = $configReader; $this->lineItemRepository = $lineItemRepository; $this->requestStack = $requestStack; } @@ -89,7 +86,7 @@ final protected static function isNeverCapturable(array $payoneTransactionData): */ final protected static function matchesIsCapturableDefaults(array $transactionData): bool { - $txAction = isset($transactionData['txaction']) ? strtolower($transactionData['txaction']) : null; + $txAction = isset($transactionData['txaction']) ? strtolower((string) $transactionData['txaction']) : null; $price = isset($transactionData['price']) ? ((float) $transactionData['price']) : null; $receivable = isset($transactionData['receivable']) ? ((float) $transactionData['receivable']) : null; @@ -109,8 +106,8 @@ final protected static function matchesIsCapturableDefaults(array $transactionDa */ final protected static function isTransactionAppointedAndCompleted(array $transactionData): bool { - $txAction = isset($transactionData['txaction']) ? strtolower($transactionData['txaction']) : null; - $transactionStatus = isset($transactionData['transaction_status']) ? strtolower($transactionData['transaction_status']) : null; + $txAction = isset($transactionData['txaction']) ? strtolower((string) $transactionData['txaction']) : null; + $transactionStatus = isset($transactionData['transaction_status']) ? strtolower((string) $transactionData['transaction_status']) : null; return $txAction === TransactionStatusService::ACTION_APPOINTED && $transactionStatus === TransactionStatusService::STATUS_COMPLETED; } @@ -141,7 +138,7 @@ final protected static function isNeverRefundable(array $transactionData): bool */ final protected static function matchesIsRefundableDefaults(array $transactionData): bool { - $txAction = isset($transactionData['txaction']) ? strtolower($transactionData['txaction']) : null; + $txAction = isset($transactionData['txaction']) ? strtolower((string) $transactionData['txaction']) : null; $receivable = isset($transactionData['receivable']) ? ((float) $transactionData['receivable']) : null; // Allow refund if capture TX status and receivable indicate we have outstanding funds diff --git a/src/PaymentHandler/AbstractPostfinancePaymentHandler.php b/src/PaymentHandler/AbstractPostfinancePaymentHandler.php index dce019132..d01a0c9c8 100644 --- a/src/PaymentHandler/AbstractPostfinancePaymentHandler.php +++ b/src/PaymentHandler/AbstractPostfinancePaymentHandler.php @@ -28,33 +28,20 @@ abstract class AbstractPostfinancePaymentHandler extends AbstractPayonePaymentHandler implements AsynchronousPaymentHandlerInterface { - private PayoneClientInterface $client; - - private TranslatorInterface $translator; - - private TransactionDataHandlerInterface $dataHandler; - - private PaymentStateHandlerInterface $stateHandler; - - private RequestParameterFactory $requestParameterFactory; + private readonly TranslatorInterface $translator; public function __construct( ConfigReaderInterface $configReader, EntityRepository $lineItemRepository, - PayoneClientInterface $client, + private readonly PayoneClientInterface $client, TranslatorInterface $translator, - TransactionDataHandlerInterface $dataHandler, - PaymentStateHandlerInterface $stateHandler, + private readonly TransactionDataHandlerInterface $dataHandler, + private readonly PaymentStateHandlerInterface $stateHandler, RequestStack $requestStack, - RequestParameterFactory $requestParameterFactory + private readonly RequestParameterFactory $requestParameterFactory ) { parent::__construct($configReader, $lineItemRepository, $requestStack); - - $this->client = $client; $this->translator = $translator; - $this->dataHandler = $dataHandler; - $this->stateHandler = $stateHandler; - $this->requestParameterFactory = $requestParameterFactory; } public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $dataBag, SalesChannelContext $salesChannelContext): RedirectResponse @@ -84,7 +71,7 @@ public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $ $transaction->getOrderTransaction()->getId(), $exception->getResponse()['error']['CustomerMessage'] ); - } catch (\Throwable $exception) { + } catch (\Throwable) { throw new AsyncPaymentProcessException( $transaction->getOrderTransaction()->getId(), $this->translator->trans('PayonePayment.errorMessages.genericError') @@ -120,7 +107,7 @@ public static function isCapturable(array $transactionData, array $payoneTransAc return false; } - return strtolower($transactionData['txaction']) === TransactionStatusService::ACTION_PAID; + return strtolower((string) $transactionData['txaction']) === TransactionStatusService::ACTION_PAID; } /** @@ -128,11 +115,11 @@ public static function isCapturable(array $transactionData, array $payoneTransAc */ public static function isRefundable(array $transactionData): bool { - if (strtolower($transactionData['txaction']) === TransactionStatusService::ACTION_CAPTURE && (float) $transactionData['receivable'] !== 0.0) { + if (strtolower((string) $transactionData['txaction']) === TransactionStatusService::ACTION_CAPTURE && (float) $transactionData['receivable'] !== 0.0) { return true; } - return strtolower($transactionData['txaction']) === TransactionStatusService::ACTION_PAID; + return strtolower((string) $transactionData['txaction']) === TransactionStatusService::ACTION_PAID; } protected function getConfigKeyPrefix(): string diff --git a/src/PaymentHandler/PayoneAlipayPaymentHandler.php b/src/PaymentHandler/PayoneAlipayPaymentHandler.php index 45a238507..74c814dfe 100644 --- a/src/PaymentHandler/PayoneAlipayPaymentHandler.php +++ b/src/PaymentHandler/PayoneAlipayPaymentHandler.php @@ -26,33 +26,20 @@ class PayoneAlipayPaymentHandler extends AbstractPayonePaymentHandler implements AsynchronousPaymentHandlerInterface { - private PayoneClientInterface $client; - - private TranslatorInterface $translator; - - private TransactionDataHandlerInterface $dataHandler; - - private PaymentStateHandlerInterface $stateHandler; - - private RequestParameterFactory $requestParameterFactory; + private readonly TranslatorInterface $translator; public function __construct( ConfigReaderInterface $configReader, EntityRepository $lineItemRepository, - PayoneClientInterface $client, + private readonly PayoneClientInterface $client, TranslatorInterface $translator, - TransactionDataHandlerInterface $dataHandler, - PaymentStateHandlerInterface $stateHandler, + private readonly TransactionDataHandlerInterface $dataHandler, + private readonly PaymentStateHandlerInterface $stateHandler, RequestStack $requestStack, - RequestParameterFactory $requestParameterFactory + private readonly RequestParameterFactory $requestParameterFactory ) { parent::__construct($configReader, $lineItemRepository, $requestStack); - - $this->client = $client; $this->translator = $translator; - $this->dataHandler = $dataHandler; - $this->stateHandler = $stateHandler; - $this->requestParameterFactory = $requestParameterFactory; } /** @@ -76,7 +63,7 @@ public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $ $paymentTransaction, $requestData, $salesChannelContext, - __CLASS__, + self::class, $authorizationMethod ) ); @@ -88,7 +75,7 @@ public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $ $transaction->getOrderTransaction()->getId(), $exception->getResponse()['error']['CustomerMessage'] ); - } catch (\Throwable $exception) { + } catch (\Throwable) { throw new AsyncPaymentProcessException( $transaction->getOrderTransaction()->getId(), $this->translator->trans('PayonePayment.errorMessages.genericError') @@ -130,7 +117,7 @@ public static function isCapturable(array $transactionData, array $payoneTransAc return false; } - return strtolower($transactionData['txaction']) === TransactionStatusService::ACTION_PAID; + return strtolower((string) $transactionData['txaction']) === TransactionStatusService::ACTION_PAID; } /** @@ -138,10 +125,10 @@ public static function isCapturable(array $transactionData, array $payoneTransAc */ public static function isRefundable(array $transactionData): bool { - if (strtolower($transactionData['txaction']) === TransactionStatusService::ACTION_CAPTURE && (float) $transactionData['receivable'] !== 0.0) { + if (strtolower((string) $transactionData['txaction']) === TransactionStatusService::ACTION_CAPTURE && (float) $transactionData['receivable'] !== 0.0) { return true; } - return strtolower($transactionData['txaction']) === TransactionStatusService::ACTION_PAID; + return strtolower((string) $transactionData['txaction']) === TransactionStatusService::ACTION_PAID; } } diff --git a/src/PaymentHandler/PayoneApplePayPaymentHandler.php b/src/PaymentHandler/PayoneApplePayPaymentHandler.php index 505884d19..051d16b42 100644 --- a/src/PaymentHandler/PayoneApplePayPaymentHandler.php +++ b/src/PaymentHandler/PayoneApplePayPaymentHandler.php @@ -19,25 +19,18 @@ class PayoneApplePayPaymentHandler extends AbstractPayonePaymentHandler implements SynchronousPaymentHandlerInterface { - protected PayoneClientInterface $client; - protected TranslatorInterface $translator; - private TransactionDataHandlerInterface $dataHandler; - public function __construct( ConfigReaderInterface $configReader, - PayoneClientInterface $client, + protected PayoneClientInterface $client, TranslatorInterface $translator, EntityRepository $lineItemRepository, RequestStack $requestStack, - TransactionDataHandlerInterface $dataHandler + private readonly TransactionDataHandlerInterface $dataHandler ) { parent::__construct($configReader, $lineItemRepository, $requestStack); - - $this->client = $client; $this->translator = $translator; - $this->dataHandler = $dataHandler; } /** @@ -48,7 +41,7 @@ public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $d $requestData = $this->fetchRequestData(); $configuration = $this->configReader->read($salesChannelContext->getSalesChannel()->getId()); - $response = json_decode($requestData->get('response', '{}'), true); + $response = json_decode((string) $requestData->get('response', '{}'), true, 512, JSON_THROW_ON_ERROR); if ($response === null || !\array_key_exists('status', $response) || !\array_key_exists('txid', $response)) { throw new SyncPaymentProcessException( diff --git a/src/PaymentHandler/PayoneBancontactPaymentHandler.php b/src/PaymentHandler/PayoneBancontactPaymentHandler.php index 65c00042f..3b927e25f 100644 --- a/src/PaymentHandler/PayoneBancontactPaymentHandler.php +++ b/src/PaymentHandler/PayoneBancontactPaymentHandler.php @@ -26,33 +26,20 @@ class PayoneBancontactPaymentHandler extends AbstractPayonePaymentHandler implements AsynchronousPaymentHandlerInterface { - private PayoneClientInterface $client; - - private TranslatorInterface $translator; - - private TransactionDataHandlerInterface $dataHandler; - - private PaymentStateHandlerInterface $stateHandler; - - private RequestParameterFactory $requestParameterFactory; + private readonly TranslatorInterface $translator; public function __construct( ConfigReaderInterface $configReader, EntityRepository $lineItemRepository, - PayoneClientInterface $client, + private readonly PayoneClientInterface $client, TranslatorInterface $translator, - TransactionDataHandlerInterface $dataHandler, - PaymentStateHandlerInterface $stateHandler, + private readonly TransactionDataHandlerInterface $dataHandler, + private readonly PaymentStateHandlerInterface $stateHandler, RequestStack $requestStack, - RequestParameterFactory $requestParameterFactory + private readonly RequestParameterFactory $requestParameterFactory ) { parent::__construct($configReader, $lineItemRepository, $requestStack); - - $this->client = $client; $this->translator = $translator; - $this->dataHandler = $dataHandler; - $this->stateHandler = $stateHandler; - $this->requestParameterFactory = $requestParameterFactory; } /** @@ -76,7 +63,7 @@ public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $ $paymentTransaction, $requestData, $salesChannelContext, - __CLASS__, + self::class, $authorizationMethod ) ); @@ -88,7 +75,7 @@ public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $ $transaction->getOrderTransaction()->getId(), $exception->getResponse()['error']['CustomerMessage'] ); - } catch (\Throwable $exception) { + } catch (\Throwable) { throw new AsyncPaymentProcessException( $transaction->getOrderTransaction()->getId(), $this->translator->trans('PayonePayment.errorMessages.genericError') @@ -130,7 +117,7 @@ public static function isCapturable(array $transactionData, array $payoneTransAc return false; } - return strtolower($transactionData['txaction']) === TransactionStatusService::ACTION_PAID; + return strtolower((string) $transactionData['txaction']) === TransactionStatusService::ACTION_PAID; } /** @@ -138,10 +125,10 @@ public static function isCapturable(array $transactionData, array $payoneTransAc */ public static function isRefundable(array $transactionData): bool { - if (strtolower($transactionData['txaction']) === TransactionStatusService::ACTION_CAPTURE && (float) $transactionData['receivable'] !== 0.0) { + if (strtolower((string) $transactionData['txaction']) === TransactionStatusService::ACTION_CAPTURE && (float) $transactionData['receivable'] !== 0.0) { return true; } - return strtolower($transactionData['txaction']) === TransactionStatusService::ACTION_PAID; + return strtolower((string) $transactionData['txaction']) === TransactionStatusService::ACTION_PAID; } } diff --git a/src/PaymentHandler/PayoneCreditCardPaymentHandler.php b/src/PaymentHandler/PayoneCreditCardPaymentHandler.php index 0f4adb8a3..5f4385590 100644 --- a/src/PaymentHandler/PayoneCreditCardPaymentHandler.php +++ b/src/PaymentHandler/PayoneCreditCardPaymentHandler.php @@ -27,44 +27,28 @@ class PayoneCreditCardPaymentHandler extends AbstractPayonePaymentHandler implements AsynchronousPaymentHandlerInterface { - public const REQUEST_PARAM_SAVE_CREDIT_CARD = 'saveCreditCard'; - public const REQUEST_PARAM_PSEUDO_CARD_PAN = 'pseudoCardPan'; - public const REQUEST_PARAM_SAVED_PSEUDO_CARD_PAN = 'savedPseudoCardPan'; - public const REQUEST_PARAM_CARD_EXPIRE_DATE = 'cardExpireDate'; - public const REQUEST_PARAM_CARD_TYPE = 'cardType'; - public const REQUEST_PARAM_TRUNCATED_CARD_PAN = 'truncatedCardPan'; - - protected PayoneClientInterface $client; + final public const REQUEST_PARAM_SAVE_CREDIT_CARD = 'saveCreditCard'; + final public const REQUEST_PARAM_PSEUDO_CARD_PAN = 'pseudoCardPan'; + final public const REQUEST_PARAM_SAVED_PSEUDO_CARD_PAN = 'savedPseudoCardPan'; + final public const REQUEST_PARAM_CARD_EXPIRE_DATE = 'cardExpireDate'; + final public const REQUEST_PARAM_CARD_TYPE = 'cardType'; + final public const REQUEST_PARAM_TRUNCATED_CARD_PAN = 'truncatedCardPan'; protected TranslatorInterface $translator; - private TransactionDataHandlerInterface $dataHandler; - - private PaymentStateHandlerInterface $stateHandler; - - private CardRepositoryInterface $cardRepository; - - private RequestParameterFactory $requestParameterFactory; - public function __construct( ConfigReaderInterface $configReader, - PayoneClientInterface $client, + protected PayoneClientInterface $client, TranslatorInterface $translator, - TransactionDataHandlerInterface $dataHandler, + private readonly TransactionDataHandlerInterface $dataHandler, EntityRepository $lineItemRepository, - PaymentStateHandlerInterface $stateHandler, - CardRepositoryInterface $cardRepository, + private readonly PaymentStateHandlerInterface $stateHandler, + private readonly CardRepositoryInterface $cardRepository, RequestStack $requestStack, - RequestParameterFactory $requestParameterFactory + private readonly RequestParameterFactory $requestParameterFactory ) { parent::__construct($configReader, $lineItemRepository, $requestStack); - - $this->client = $client; $this->translator = $translator; - $this->dataHandler = $dataHandler; - $this->stateHandler = $stateHandler; - $this->cardRepository = $cardRepository; - $this->requestParameterFactory = $requestParameterFactory; } /** @@ -88,7 +72,7 @@ public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $ $paymentTransaction, $requestData, $salesChannelContext, - __CLASS__, + self::class, $authorizationMethod ) ); @@ -100,7 +84,7 @@ public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $ $transaction->getOrderTransaction()->getId(), $exception->getResponse()['error']['CustomerMessage'] ); - } catch (\Throwable $exception) { + } catch (\Throwable) { throw new AsyncPaymentProcessException( $transaction->getOrderTransaction()->getId(), $this->translator->trans('PayonePayment.errorMessages.genericError') @@ -153,7 +137,7 @@ public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $ $this->setLineItemCustomFields($paymentTransaction->getOrder()->getLineItems(), $salesChannelContext->getContext()); } - if (strtolower($response['status']) === 'redirect') { + if (strtolower((string) $response['status']) === 'redirect') { return new RedirectResponse($response['redirecturl']); } @@ -177,7 +161,7 @@ public static function isCapturable(array $transactionData, array $payoneTransAc return false; } - $txAction = isset($transactionData['txaction']) ? strtolower($transactionData['txaction']) : null; + $txAction = isset($transactionData['txaction']) ? strtolower((string) $transactionData['txaction']) : null; if ($txAction === TransactionStatusService::ACTION_APPOINTED) { return true; diff --git a/src/PaymentHandler/PayoneDebitPaymentHandler.php b/src/PaymentHandler/PayoneDebitPaymentHandler.php index 0227c7e17..fec3a8f6c 100644 --- a/src/PaymentHandler/PayoneDebitPaymentHandler.php +++ b/src/PaymentHandler/PayoneDebitPaymentHandler.php @@ -24,35 +24,22 @@ class PayoneDebitPaymentHandler extends AbstractPayonePaymentHandler implements SynchronousPaymentHandlerInterface { - public const REQUEST_PARAM_SAVE_MANDATE = 'saveMandate'; - - protected PayoneClientInterface $client; + final public const REQUEST_PARAM_SAVE_MANDATE = 'saveMandate'; protected TranslatorInterface $translator; - private TransactionDataHandlerInterface $dataHandler; - - private MandateServiceInterface $mandateService; - - private RequestParameterFactory $requestParameterFactory; - public function __construct( ConfigReaderInterface $configReader, - PayoneClientInterface $client, + protected PayoneClientInterface $client, TranslatorInterface $translator, - TransactionDataHandlerInterface $dataHandler, + private readonly TransactionDataHandlerInterface $dataHandler, EntityRepository $lineItemRepository, - MandateServiceInterface $mandateService, + private readonly MandateServiceInterface $mandateService, RequestStack $requestStack, - RequestParameterFactory $requestParameterFactory + private readonly RequestParameterFactory $requestParameterFactory ) { parent::__construct($configReader, $lineItemRepository, $requestStack); - - $this->client = $client; $this->translator = $translator; - $this->dataHandler = $dataHandler; - $this->mandateService = $mandateService; - $this->requestParameterFactory = $requestParameterFactory; } /** @@ -76,7 +63,7 @@ public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $d $paymentTransaction, $requestData, $salesChannelContext, - __CLASS__, + self::class, $authorizationMethod ) ); @@ -88,7 +75,7 @@ public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $d $transaction->getOrderTransaction()->getId(), $exception->getResponse()['error']['CustomerMessage'] ); - } catch (\Throwable $exception) { + } catch (\Throwable) { throw new SyncPaymentProcessException( $transaction->getOrderTransaction()->getId(), $this->translator->trans('PayonePayment.errorMessages.genericError') @@ -138,7 +125,7 @@ public static function isCapturable(array $transactionData, array $payoneTransAc return false; } - $txAction = isset($transactionData['txaction']) ? strtolower($transactionData['txaction']) : null; + $txAction = isset($transactionData['txaction']) ? strtolower((string) $transactionData['txaction']) : null; if ($txAction === TransactionStatusService::ACTION_APPOINTED) { return true; diff --git a/src/PaymentHandler/PayoneEpsPaymentHandler.php b/src/PaymentHandler/PayoneEpsPaymentHandler.php index 88ff308a5..d064337dc 100644 --- a/src/PaymentHandler/PayoneEpsPaymentHandler.php +++ b/src/PaymentHandler/PayoneEpsPaymentHandler.php @@ -62,33 +62,20 @@ class PayoneEpsPaymentHandler extends AbstractPayonePaymentHandler implements As 'EPS_VKB', ]; - private PayoneClientInterface $client; - - private TranslatorInterface $translator; - - private TransactionDataHandlerInterface $dataHandler; - - private PaymentStateHandlerInterface $stateHandler; - - private RequestParameterFactory $requestParameterFactory; + private readonly TranslatorInterface $translator; public function __construct( ConfigReaderInterface $configReader, EntityRepository $lineItemRepository, - PayoneClientInterface $client, + private readonly PayoneClientInterface $client, TranslatorInterface $translator, - TransactionDataHandlerInterface $dataHandler, - PaymentStateHandlerInterface $stateHandler, + private readonly TransactionDataHandlerInterface $dataHandler, + private readonly PaymentStateHandlerInterface $stateHandler, RequestStack $requestStack, - RequestParameterFactory $requestParameterFactory + private readonly RequestParameterFactory $requestParameterFactory ) { parent::__construct($configReader, $lineItemRepository, $requestStack); - - $this->client = $client; $this->translator = $translator; - $this->dataHandler = $dataHandler; - $this->stateHandler = $stateHandler; - $this->requestParameterFactory = $requestParameterFactory; } /** @@ -109,7 +96,7 @@ public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $ try { $this->validate($requestData); - } catch (PayoneRequestException $e) { + } catch (PayoneRequestException) { throw new AsyncPaymentProcessException( $transaction->getOrderTransaction()->getId(), $this->translator->trans('PayonePayment.errorMessages.genericError') @@ -121,7 +108,7 @@ public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $ $paymentTransaction, $requestData, $salesChannelContext, - __CLASS__, + self::class, $authorizationMethod ) ); @@ -133,7 +120,7 @@ public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $ $transaction->getOrderTransaction()->getId(), $exception->getResponse()['error']['CustomerMessage'] ); - } catch (\Throwable $exception) { + } catch (\Throwable) { throw new AsyncPaymentProcessException( $transaction->getOrderTransaction()->getId(), $this->translator->trans('PayonePayment.errorMessages.genericError') @@ -170,7 +157,7 @@ public static function isCapturable(array $transactionData, array $payoneTransAc return false; } - $txAction = isset($transactionData['txaction']) ? strtolower($transactionData['txaction']) : null; + $txAction = isset($transactionData['txaction']) ? strtolower((string) $transactionData['txaction']) : null; if ($txAction === TransactionStatusService::ACTION_PAID) { return true; diff --git a/src/PaymentHandler/PayoneIDealPaymentHandler.php b/src/PaymentHandler/PayoneIDealPaymentHandler.php index 6865001b2..c1c5101a8 100644 --- a/src/PaymentHandler/PayoneIDealPaymentHandler.php +++ b/src/PaymentHandler/PayoneIDealPaymentHandler.php @@ -45,33 +45,20 @@ class PayoneIDealPaymentHandler extends AbstractPayonePaymentHandler implements 'YOURSAFE', ]; - private PayoneClientInterface $client; - - private TranslatorInterface $translator; - - private TransactionDataHandlerInterface $dataHandler; - - private PaymentStateHandlerInterface $stateHandler; - - private RequestParameterFactory $requestParameterFactory; + private readonly TranslatorInterface $translator; public function __construct( ConfigReaderInterface $configReader, EntityRepository $lineItemRepository, - PayoneClientInterface $client, + private readonly PayoneClientInterface $client, TranslatorInterface $translator, - TransactionDataHandlerInterface $dataHandler, - PaymentStateHandlerInterface $stateHandler, + private readonly TransactionDataHandlerInterface $dataHandler, + private readonly PaymentStateHandlerInterface $stateHandler, RequestStack $requestStack, - RequestParameterFactory $requestParameterFactory + private readonly RequestParameterFactory $requestParameterFactory ) { parent::__construct($configReader, $lineItemRepository, $requestStack); - - $this->client = $client; $this->translator = $translator; - $this->dataHandler = $dataHandler; - $this->stateHandler = $stateHandler; - $this->requestParameterFactory = $requestParameterFactory; } /** @@ -92,7 +79,7 @@ public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $ try { $this->validate($requestData); - } catch (PayoneRequestException $e) { + } catch (PayoneRequestException) { throw new AsyncPaymentProcessException( $transaction->getOrderTransaction()->getId(), $this->translator->trans('PayonePayment.errorMessages.genericError') @@ -104,7 +91,7 @@ public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $ $paymentTransaction, $requestData, $salesChannelContext, - __CLASS__, + self::class, $authorizationMethod ) ); @@ -116,7 +103,7 @@ public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $ $transaction->getOrderTransaction()->getId(), $exception->getResponse()['error']['CustomerMessage'] ); - } catch (\Throwable $exception) { + } catch (\Throwable) { throw new AsyncPaymentProcessException( $transaction->getOrderTransaction()->getId(), $this->translator->trans('PayonePayment.errorMessages.genericError') @@ -153,7 +140,7 @@ public static function isCapturable(array $transactionData, array $payoneTransAc return false; } - $txAction = isset($transactionData['txaction']) ? strtolower($transactionData['txaction']) : null; + $txAction = isset($transactionData['txaction']) ? strtolower((string) $transactionData['txaction']) : null; if ($txAction === TransactionStatusService::ACTION_PAID) { return true; diff --git a/src/PaymentHandler/PayoneOpenInvoicePaymentHandler.php b/src/PaymentHandler/PayoneOpenInvoicePaymentHandler.php index df67911b7..31a38e9fd 100644 --- a/src/PaymentHandler/PayoneOpenInvoicePaymentHandler.php +++ b/src/PaymentHandler/PayoneOpenInvoicePaymentHandler.php @@ -43,6 +43,6 @@ protected function getConfigKey(): string */ protected function getPaymentMethod(): string { - return __CLASS__; + return self::class; } } diff --git a/src/PaymentHandler/PayonePaydirektPaymentHandler.php b/src/PaymentHandler/PayonePaydirektPaymentHandler.php index 1fd3ba181..94264a7e4 100644 --- a/src/PaymentHandler/PayonePaydirektPaymentHandler.php +++ b/src/PaymentHandler/PayonePaydirektPaymentHandler.php @@ -26,33 +26,20 @@ class PayonePaydirektPaymentHandler extends AbstractPayonePaymentHandler implements AsynchronousPaymentHandlerInterface { - private PayoneClientInterface $client; - - private TranslatorInterface $translator; - - private TransactionDataHandlerInterface $dataHandler; - - private PaymentStateHandlerInterface $stateHandler; - - private RequestParameterFactory $requestParameterFactory; + private readonly TranslatorInterface $translator; public function __construct( ConfigReaderInterface $configReader, EntityRepository $lineItemRepository, - PayoneClientInterface $client, + private readonly PayoneClientInterface $client, TranslatorInterface $translator, - TransactionDataHandlerInterface $dataHandler, - PaymentStateHandlerInterface $stateHandler, + private readonly TransactionDataHandlerInterface $dataHandler, + private readonly PaymentStateHandlerInterface $stateHandler, RequestStack $requestStack, - RequestParameterFactory $requestParameterFactory + private readonly RequestParameterFactory $requestParameterFactory ) { parent::__construct($configReader, $lineItemRepository, $requestStack); - - $this->client = $client; $this->translator = $translator; - $this->dataHandler = $dataHandler; - $this->stateHandler = $stateHandler; - $this->requestParameterFactory = $requestParameterFactory; } /** @@ -74,7 +61,7 @@ public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $ $paymentTransaction, $dataBag, $salesChannelContext, - __CLASS__, + self::class, $authorizationMethod ) ); @@ -86,7 +73,7 @@ public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $ $transaction->getOrderTransaction()->getId(), $exception->getResponse()['error']['CustomerMessage'] ); - } catch (\Throwable $exception) { + } catch (\Throwable) { throw new AsyncPaymentProcessException( $transaction->getOrderTransaction()->getId(), $this->translator->trans('PayonePayment.errorMessages.genericError') @@ -123,7 +110,7 @@ public static function isCapturable(array $transactionData, array $payoneTransAc return false; } - $txAction = isset($transactionData['txaction']) ? strtolower($transactionData['txaction']) : null; + $txAction = isset($transactionData['txaction']) ? strtolower((string) $transactionData['txaction']) : null; if ($txAction === TransactionStatusService::ACTION_APPOINTED) { return true; diff --git a/src/PaymentHandler/PayonePayolutionDebitPaymentHandler.php b/src/PaymentHandler/PayonePayolutionDebitPaymentHandler.php index 82dc9577e..c008be4d8 100644 --- a/src/PaymentHandler/PayonePayolutionDebitPaymentHandler.php +++ b/src/PaymentHandler/PayonePayolutionDebitPaymentHandler.php @@ -22,29 +22,19 @@ class PayonePayolutionDebitPaymentHandler extends AbstractPayonePaymentHandler implements SynchronousPaymentHandlerInterface { - protected PayoneClientInterface $client; - protected TranslatorInterface $translator; - private TransactionDataHandlerInterface $dataHandler; - - private RequestParameterFactory $requestParameterFactory; - public function __construct( ConfigReaderInterface $configReader, - PayoneClientInterface $client, + protected PayoneClientInterface $client, TranslatorInterface $translator, - TransactionDataHandlerInterface $dataHandler, + private readonly TransactionDataHandlerInterface $dataHandler, EntityRepository $lineItemRepository, RequestStack $requestStack, - RequestParameterFactory $requestParameterFactory + private readonly RequestParameterFactory $requestParameterFactory ) { parent::__construct($configReader, $lineItemRepository, $requestStack); - - $this->client = $client; $this->translator = $translator; - $this->dataHandler = $dataHandler; - $this->requestParameterFactory = $requestParameterFactory; } /** @@ -89,7 +79,7 @@ public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $d try { $this->validate($requestData); - } catch (PayoneRequestException $e) { + } catch (PayoneRequestException) { throw new SyncPaymentProcessException( $transaction->getOrderTransaction()->getId(), $this->translator->trans('PayonePayment.errorMessages.genericError') @@ -101,7 +91,7 @@ public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $d $paymentTransaction, $requestData, $salesChannelContext, - __CLASS__, + self::class, $authorizationMethod ) ); @@ -113,7 +103,7 @@ public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $d $transaction->getOrderTransaction()->getId(), $exception->getResponse()['error']['CustomerMessage'] ); - } catch (\Throwable $exception) { + } catch (\Throwable) { throw new SyncPaymentProcessException( $transaction->getOrderTransaction()->getId(), $this->translator->trans('PayonePayment.errorMessages.genericError') diff --git a/src/PaymentHandler/PayonePayolutionInstallmentPaymentHandler.php b/src/PaymentHandler/PayonePayolutionInstallmentPaymentHandler.php index 248a2e742..eb4a41951 100644 --- a/src/PaymentHandler/PayonePayolutionInstallmentPaymentHandler.php +++ b/src/PaymentHandler/PayonePayolutionInstallmentPaymentHandler.php @@ -26,33 +26,20 @@ class PayonePayolutionInstallmentPaymentHandler extends AbstractPayonePaymentHandler implements SynchronousPaymentHandlerInterface { - protected CartHasherInterface $cartHasher; - - private PayoneClientInterface $client; - - private TranslatorInterface $translator; - - private TransactionDataHandlerInterface $dataHandler; - - private RequestParameterFactory $requestParameterFactory; + private readonly TranslatorInterface $translator; public function __construct( ConfigReaderInterface $configReader, - PayoneClientInterface $client, + private readonly PayoneClientInterface $client, TranslatorInterface $translator, - TransactionDataHandlerInterface $dataHandler, + private readonly TransactionDataHandlerInterface $dataHandler, EntityRepository $lineItemRepository, - CartHasherInterface $cartHasher, + protected CartHasherInterface $cartHasher, RequestStack $requestStack, - RequestParameterFactory $requestParameterFactory + private readonly RequestParameterFactory $requestParameterFactory ) { parent::__construct($configReader, $lineItemRepository, $requestStack); - - $this->client = $client; $this->translator = $translator; - $this->dataHandler = $dataHandler; - $this->cartHasher = $cartHasher; - $this->requestParameterFactory = $requestParameterFactory; } /** @@ -78,7 +65,7 @@ public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $d $paymentTransaction, $requestData, $salesChannelContext, - __CLASS__, + self::class, $authorizationMethod ) ); @@ -90,7 +77,7 @@ public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $d $transaction->getOrderTransaction()->getId(), $exception->getResponse()['error']['CustomerMessage'] ); - } catch (\Throwable $exception) { + } catch (\Throwable) { throw new SyncPaymentProcessException( $transaction->getOrderTransaction()->getId(), $this->translator->trans('PayonePayment.errorMessages.genericError') diff --git a/src/PaymentHandler/PayonePayolutionInvoicingPaymentHandler.php b/src/PaymentHandler/PayonePayolutionInvoicingPaymentHandler.php index f17d59013..26cfa6d8b 100644 --- a/src/PaymentHandler/PayonePayolutionInvoicingPaymentHandler.php +++ b/src/PaymentHandler/PayonePayolutionInvoicingPaymentHandler.php @@ -25,29 +25,19 @@ class PayonePayolutionInvoicingPaymentHandler extends AbstractPayonePaymentHandler implements SynchronousPaymentHandlerInterface { - private PayoneClientInterface $client; - - private TranslatorInterface $translator; - - private TransactionDataHandlerInterface $dataHandler; - - private RequestParameterFactory $requestParameterFactory; + private readonly TranslatorInterface $translator; public function __construct( ConfigReaderInterface $configReader, - PayoneClientInterface $client, + private readonly PayoneClientInterface $client, TranslatorInterface $translator, - TransactionDataHandlerInterface $dataHandler, + private readonly TransactionDataHandlerInterface $dataHandler, EntityRepository $lineItemRepository, RequestStack $requestStack, - RequestParameterFactory $requestParameterFactory + private readonly RequestParameterFactory $requestParameterFactory ) { parent::__construct($configReader, $lineItemRepository, $requestStack); - - $this->client = $client; $this->translator = $translator; - $this->dataHandler = $dataHandler; - $this->requestParameterFactory = $requestParameterFactory; } /** @@ -71,7 +61,7 @@ public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $d $paymentTransaction, $requestData, $salesChannelContext, - __CLASS__, + self::class, $authorizationMethod ) ); @@ -83,7 +73,7 @@ public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $d $transaction->getOrderTransaction()->getId(), $exception->getResponse()['error']['CustomerMessage'] ); - } catch (\Throwable $exception) { + } catch (\Throwable) { throw new SyncPaymentProcessException( $transaction->getOrderTransaction()->getId(), $this->translator->trans('PayonePayment.errorMessages.genericError') diff --git a/src/PaymentHandler/PayonePaypalExpressPaymentHandler.php b/src/PaymentHandler/PayonePaypalExpressPaymentHandler.php index 1b3fc2d3a..02e0cb4ac 100644 --- a/src/PaymentHandler/PayonePaypalExpressPaymentHandler.php +++ b/src/PaymentHandler/PayonePaypalExpressPaymentHandler.php @@ -25,33 +25,20 @@ class PayonePaypalExpressPaymentHandler extends AbstractPayonePaymentHandler implements AsynchronousPaymentHandlerInterface { - private PayoneClientInterface $client; - - private TranslatorInterface $translator; - - private TransactionDataHandlerInterface $dataHandler; - - private PaymentStateHandlerInterface $stateHandler; - - private RequestParameterFactory $requestParameterFactory; + private readonly TranslatorInterface $translator; public function __construct( ConfigReaderInterface $configReader, - PayoneClientInterface $client, + private readonly PayoneClientInterface $client, TranslatorInterface $translator, - TransactionDataHandlerInterface $dataHandler, + private readonly TransactionDataHandlerInterface $dataHandler, EntityRepository $lineItemRepository, - PaymentStateHandlerInterface $stateHandler, + private readonly PaymentStateHandlerInterface $stateHandler, RequestStack $requestStack, - RequestParameterFactory $requestParameterFactory + private readonly RequestParameterFactory $requestParameterFactory ) { parent::__construct($configReader, $lineItemRepository, $requestStack); - - $this->client = $client; $this->translator = $translator; - $this->dataHandler = $dataHandler; - $this->stateHandler = $stateHandler; - $this->requestParameterFactory = $requestParameterFactory; } /** @@ -75,7 +62,7 @@ public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $ $paymentTransaction, $requestData, $salesChannelContext, - __CLASS__, + self::class, $authorizationMethod ) ); @@ -87,7 +74,7 @@ public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $ $transaction->getOrderTransaction()->getId(), $exception->getResponse()['error']['CustomerMessage'] ); - } catch (\Throwable $exception) { + } catch (\Throwable) { throw new AsyncPaymentProcessException( $transaction->getOrderTransaction()->getId(), $this->translator->trans('PayonePayment.errorMessages.genericError') @@ -107,7 +94,7 @@ public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $ $this->dataHandler->saveTransactionData($paymentTransaction, $salesChannelContext->getContext(), $data); - if (strtolower($response['status']) === 'redirect') { + if (strtolower((string) $response['status']) === 'redirect') { return new RedirectResponse($response['redirecturl']); } diff --git a/src/PaymentHandler/PayonePaypalPaymentHandler.php b/src/PaymentHandler/PayonePaypalPaymentHandler.php index 23a115840..bc4baf167 100644 --- a/src/PaymentHandler/PayonePaypalPaymentHandler.php +++ b/src/PaymentHandler/PayonePaypalPaymentHandler.php @@ -25,33 +25,20 @@ class PayonePaypalPaymentHandler extends AbstractPayonePaymentHandler implements AsynchronousPaymentHandlerInterface { - private PayoneClientInterface $client; - - private TranslatorInterface $translator; - - private TransactionDataHandlerInterface $dataHandler; - - private PaymentStateHandlerInterface $stateHandler; - - private RequestParameterFactory $requestParameterFactory; + private readonly TranslatorInterface $translator; public function __construct( ConfigReaderInterface $configReader, - PayoneClientInterface $client, + private readonly PayoneClientInterface $client, TranslatorInterface $translator, - TransactionDataHandlerInterface $dataHandler, + private readonly TransactionDataHandlerInterface $dataHandler, EntityRepository $lineItemRepository, - PaymentStateHandlerInterface $stateHandler, + private readonly PaymentStateHandlerInterface $stateHandler, RequestStack $requestStack, - RequestParameterFactory $requestParameterFactory + private readonly RequestParameterFactory $requestParameterFactory ) { parent::__construct($configReader, $lineItemRepository, $requestStack); - - $this->client = $client; $this->translator = $translator; - $this->dataHandler = $dataHandler; - $this->stateHandler = $stateHandler; - $this->requestParameterFactory = $requestParameterFactory; } /** @@ -75,7 +62,7 @@ public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $ $paymentTransaction, $requestData, $salesChannelContext, - __CLASS__, + self::class, $authorizationMethod ) ); @@ -87,7 +74,7 @@ public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $ $transaction->getOrderTransaction()->getId(), $exception->getResponse()['error']['CustomerMessage'] ); - } catch (\Throwable $exception) { + } catch (\Throwable) { throw new AsyncPaymentProcessException( $transaction->getOrderTransaction()->getId(), $this->translator->trans('PayonePayment.errorMessages.genericError') @@ -104,7 +91,7 @@ public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $ $data = $this->preparePayoneOrderTransactionData($request, $response); $this->dataHandler->saveTransactionData($paymentTransaction, $salesChannelContext->getContext(), $data); - if (strtolower($response['status']) === 'redirect') { + if (strtolower((string) $response['status']) === 'redirect') { return new RedirectResponse($response['redirecturl']); } diff --git a/src/PaymentHandler/PayonePrepaymentPaymentHandler.php b/src/PaymentHandler/PayonePrepaymentPaymentHandler.php index 4ba615f24..b78e132ac 100644 --- a/src/PaymentHandler/PayonePrepaymentPaymentHandler.php +++ b/src/PaymentHandler/PayonePrepaymentPaymentHandler.php @@ -24,29 +24,19 @@ class PayonePrepaymentPaymentHandler extends AbstractPayonePaymentHandler implements SynchronousPaymentHandlerInterface { - private RequestParameterFactory $requestParameterFactory; - - private PayoneClientInterface $client; - - private TranslatorInterface $translator; - - private TransactionDataHandlerInterface $dataHandler; + private readonly TranslatorInterface $translator; public function __construct( ConfigReaderInterface $configReader, - RequestParameterFactory $requestParameterFactory, - PayoneClientInterface $client, + private readonly RequestParameterFactory $requestParameterFactory, + private readonly PayoneClientInterface $client, TranslatorInterface $translator, - TransactionDataHandlerInterface $dataHandler, + private readonly TransactionDataHandlerInterface $dataHandler, EntityRepository $lineItemRepository, RequestStack $requestStack ) { parent::__construct($configReader, $lineItemRepository, $requestStack); - - $this->requestParameterFactory = $requestParameterFactory; - $this->client = $client; $this->translator = $translator; - $this->dataHandler = $dataHandler; } /** @@ -63,7 +53,7 @@ public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $d $paymentTransaction, $requestData, $salesChannelContext, - __CLASS__, + self::class, AbstractRequestParameterBuilder::REQUEST_ACTION_PREAUTHORIZE ) ); @@ -75,7 +65,7 @@ public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $d $transaction->getOrderTransaction()->getId(), $exception->getResponse()['error']['CustomerMessage'] ); - } catch (\Throwable $exception) { + } catch (\Throwable) { throw new SyncPaymentProcessException( $transaction->getOrderTransaction()->getId(), $this->translator->trans('PayonePayment.errorMessages.genericError') @@ -115,7 +105,7 @@ public static function isCapturable(array $transactionData, array $payoneTransAc return false; } - $txAction = isset($transactionData['txaction']) ? strtolower($transactionData['txaction']) : null; + $txAction = isset($transactionData['txaction']) ? strtolower((string) $transactionData['txaction']) : null; $isAppointed = static::isTransactionAppointedAndCompleted($transactionData); $isUnderpaid = $txAction === TransactionStatusService::ACTION_UNDERPAID; diff --git a/src/PaymentHandler/PayonePrzelewy24PaymentHandler.php b/src/PaymentHandler/PayonePrzelewy24PaymentHandler.php index aaae60846..d9f0e489f 100644 --- a/src/PaymentHandler/PayonePrzelewy24PaymentHandler.php +++ b/src/PaymentHandler/PayonePrzelewy24PaymentHandler.php @@ -25,33 +25,20 @@ class PayonePrzelewy24PaymentHandler extends AbstractPayonePaymentHandler implements AsynchronousPaymentHandlerInterface { - private PayoneClientInterface $client; - - private TranslatorInterface $translator; - - private TransactionDataHandlerInterface $dataHandler; - - private PaymentStateHandlerInterface $stateHandler; - - private RequestParameterFactory $requestParameterFactory; + private readonly TranslatorInterface $translator; public function __construct( ConfigReaderInterface $configReader, EntityRepository $lineItemRepository, - PayoneClientInterface $client, + private readonly PayoneClientInterface $client, TranslatorInterface $translator, - TransactionDataHandlerInterface $dataHandler, - PaymentStateHandlerInterface $stateHandler, + private readonly TransactionDataHandlerInterface $dataHandler, + private readonly PaymentStateHandlerInterface $stateHandler, RequestStack $requestStack, - RequestParameterFactory $requestParameterFactory + private readonly RequestParameterFactory $requestParameterFactory ) { parent::__construct($configReader, $lineItemRepository, $requestStack); - - $this->client = $client; $this->translator = $translator; - $this->dataHandler = $dataHandler; - $this->stateHandler = $stateHandler; - $this->requestParameterFactory = $requestParameterFactory; } /** @@ -75,7 +62,7 @@ public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $ $paymentTransaction, $requestData, $salesChannelContext, - __CLASS__, + self::class, $authorizationMethod ) ); @@ -87,7 +74,7 @@ public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $ $transaction->getOrderTransaction()->getId(), $exception->getResponse()['error']['CustomerMessage'] ); - } catch (\Throwable $exception) { + } catch (\Throwable) { throw new AsyncPaymentProcessException( $transaction->getOrderTransaction()->getId(), $this->translator->trans('PayonePayment.errorMessages.genericError') diff --git a/src/PaymentHandler/PayoneRatepayDebitPaymentHandler.php b/src/PaymentHandler/PayoneRatepayDebitPaymentHandler.php index 388b667f7..d62eb7b8d 100644 --- a/src/PaymentHandler/PayoneRatepayDebitPaymentHandler.php +++ b/src/PaymentHandler/PayoneRatepayDebitPaymentHandler.php @@ -26,33 +26,20 @@ class PayoneRatepayDebitPaymentHandler extends AbstractPayonePaymentHandler implements SynchronousPaymentHandlerInterface { - protected PayoneClientInterface $client; - protected TranslatorInterface $translator; - private TransactionDataHandlerInterface $dataHandler; - - private RequestParameterFactory $requestParameterFactory; - - private AbstractDeviceFingerprintService $deviceFingerprintService; - public function __construct( ConfigReaderInterface $configReader, - PayoneClientInterface $client, + protected PayoneClientInterface $client, TranslatorInterface $translator, - TransactionDataHandlerInterface $dataHandler, + private readonly TransactionDataHandlerInterface $dataHandler, EntityRepository $lineItemRepository, RequestStack $requestStack, - RequestParameterFactory $requestParameterFactory, - AbstractDeviceFingerprintService $deviceFingerprintService + private readonly RequestParameterFactory $requestParameterFactory, + private readonly AbstractDeviceFingerprintService $deviceFingerprintService ) { parent::__construct($configReader, $lineItemRepository, $requestStack); - - $this->client = $client; $this->translator = $translator; - $this->dataHandler = $dataHandler; - $this->requestParameterFactory = $requestParameterFactory; - $this->deviceFingerprintService = $deviceFingerprintService; } /** @@ -76,7 +63,7 @@ public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $d $paymentTransaction, $requestData, $salesChannelContext, - __CLASS__, + self::class, $authorizationMethod ) ); @@ -90,7 +77,7 @@ public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $d $transaction->getOrderTransaction()->getId(), $exception->getResponse()['error']['CustomerMessage'] ); - } catch (\Throwable $exception) { + } catch (\Throwable) { $this->deviceFingerprintService->deleteDeviceIdentToken(); throw new SyncPaymentProcessException( diff --git a/src/PaymentHandler/PayoneRatepayInstallmentPaymentHandler.php b/src/PaymentHandler/PayoneRatepayInstallmentPaymentHandler.php index b5bd30abf..004a87a62 100644 --- a/src/PaymentHandler/PayoneRatepayInstallmentPaymentHandler.php +++ b/src/PaymentHandler/PayoneRatepayInstallmentPaymentHandler.php @@ -26,33 +26,20 @@ class PayoneRatepayInstallmentPaymentHandler extends AbstractPayonePaymentHandler implements SynchronousPaymentHandlerInterface { - protected PayoneClientInterface $client; - protected TranslatorInterface $translator; - private TransactionDataHandlerInterface $dataHandler; - - private RequestParameterFactory $requestParameterFactory; - - private AbstractDeviceFingerprintService $deviceFingerprintService; - public function __construct( ConfigReaderInterface $configReader, - PayoneClientInterface $client, + protected PayoneClientInterface $client, TranslatorInterface $translator, - TransactionDataHandlerInterface $dataHandler, + private readonly TransactionDataHandlerInterface $dataHandler, EntityRepository $lineItemRepository, RequestStack $requestStack, - RequestParameterFactory $requestParameterFactory, - AbstractDeviceFingerprintService $deviceFingerprintService + private readonly RequestParameterFactory $requestParameterFactory, + private readonly AbstractDeviceFingerprintService $deviceFingerprintService ) { parent::__construct($configReader, $lineItemRepository, $requestStack); - - $this->client = $client; $this->translator = $translator; - $this->dataHandler = $dataHandler; - $this->requestParameterFactory = $requestParameterFactory; - $this->deviceFingerprintService = $deviceFingerprintService; } /** @@ -76,7 +63,7 @@ public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $d $paymentTransaction, $requestData, $salesChannelContext, - __CLASS__, + self::class, $authorizationMethod ) ); @@ -90,7 +77,7 @@ public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $d $transaction->getOrderTransaction()->getId(), $exception->getResponse()['error']['CustomerMessage'] ); - } catch (\Throwable $exception) { + } catch (\Throwable) { $this->deviceFingerprintService->deleteDeviceIdentToken(); throw new SyncPaymentProcessException( diff --git a/src/PaymentHandler/PayoneRatepayInvoicingPaymentHandler.php b/src/PaymentHandler/PayoneRatepayInvoicingPaymentHandler.php index 25e414ce3..0b8a67335 100644 --- a/src/PaymentHandler/PayoneRatepayInvoicingPaymentHandler.php +++ b/src/PaymentHandler/PayoneRatepayInvoicingPaymentHandler.php @@ -25,33 +25,20 @@ class PayoneRatepayInvoicingPaymentHandler extends AbstractPayonePaymentHandler implements SynchronousPaymentHandlerInterface { - private PayoneClientInterface $client; - - private TranslatorInterface $translator; - - private TransactionDataHandlerInterface $dataHandler; - - private RequestParameterFactory $requestParameterFactory; - - private AbstractDeviceFingerprintService $deviceFingerprintService; + private readonly TranslatorInterface $translator; public function __construct( ConfigReaderInterface $configReader, - PayoneClientInterface $client, + private readonly PayoneClientInterface $client, TranslatorInterface $translator, - TransactionDataHandlerInterface $dataHandler, + private readonly TransactionDataHandlerInterface $dataHandler, EntityRepository $lineItemRepository, RequestStack $requestStack, - RequestParameterFactory $requestParameterFactory, - AbstractDeviceFingerprintService $deviceFingerprintService + private readonly RequestParameterFactory $requestParameterFactory, + private readonly AbstractDeviceFingerprintService $deviceFingerprintService ) { parent::__construct($configReader, $lineItemRepository, $requestStack); - - $this->client = $client; $this->translator = $translator; - $this->dataHandler = $dataHandler; - $this->requestParameterFactory = $requestParameterFactory; - $this->deviceFingerprintService = $deviceFingerprintService; } /** @@ -75,7 +62,7 @@ public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $d $paymentTransaction, $requestData, $salesChannelContext, - __CLASS__, + self::class, $authorizationMethod ) ); @@ -89,7 +76,7 @@ public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $d $transaction->getOrderTransaction()->getId(), $exception->getResponse()['error']['CustomerMessage'] ); - } catch (\Throwable $exception) { + } catch (\Throwable) { $this->deviceFingerprintService->deleteDeviceIdentToken(); throw new SyncPaymentProcessException( diff --git a/src/PaymentHandler/PayoneSecureInvoicePaymentHandler.php b/src/PaymentHandler/PayoneSecureInvoicePaymentHandler.php index 4e8ac7d5f..395d6fd54 100644 --- a/src/PaymentHandler/PayoneSecureInvoicePaymentHandler.php +++ b/src/PaymentHandler/PayoneSecureInvoicePaymentHandler.php @@ -58,6 +58,6 @@ protected function getConfigKey(): string */ protected function getPaymentMethod(): string { - return __CLASS__; + return self::class; } } diff --git a/src/PaymentHandler/PayoneSecuredDirectDebitPaymentHandler.php b/src/PaymentHandler/PayoneSecuredDirectDebitPaymentHandler.php index 589139d70..d1b6bfd95 100644 --- a/src/PaymentHandler/PayoneSecuredDirectDebitPaymentHandler.php +++ b/src/PaymentHandler/PayoneSecuredDirectDebitPaymentHandler.php @@ -25,33 +25,20 @@ class PayoneSecuredDirectDebitPaymentHandler extends AbstractPayonePaymentHandler implements SynchronousPaymentHandlerInterface { - private PayoneClientInterface $client; - - private TranslatorInterface $translator; - - private TransactionDataHandlerInterface $dataHandler; - - private RequestParameterFactory $requestParameterFactory; - - private AbstractDeviceFingerprintService $deviceFingerprintService; + private readonly TranslatorInterface $translator; public function __construct( ConfigReaderInterface $configReader, - PayoneClientInterface $client, + private readonly PayoneClientInterface $client, TranslatorInterface $translator, - TransactionDataHandlerInterface $dataHandler, + private readonly TransactionDataHandlerInterface $dataHandler, EntityRepository $lineItemRepository, RequestStack $requestStack, - RequestParameterFactory $requestParameterFactory, - AbstractDeviceFingerprintService $deviceFingerprintService + private readonly RequestParameterFactory $requestParameterFactory, + private readonly AbstractDeviceFingerprintService $deviceFingerprintService ) { parent::__construct($configReader, $lineItemRepository, $requestStack); - - $this->client = $client; $this->translator = $translator; - $this->dataHandler = $dataHandler; - $this->requestParameterFactory = $requestParameterFactory; - $this->deviceFingerprintService = $deviceFingerprintService; } /** @@ -75,7 +62,7 @@ public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $d $paymentTransaction, $requestData, $salesChannelContext, - __CLASS__, + self::class, $authorizationMethod ) ); @@ -89,7 +76,7 @@ public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $d $transaction->getOrderTransaction()->getId(), $exception->getResponse()['error']['CustomerMessage'] ); - } catch (\Throwable $exception) { + } catch (\Throwable) { $this->deviceFingerprintService->deleteDeviceIdentToken(); throw new SyncPaymentProcessException( diff --git a/src/PaymentHandler/PayoneSecuredInstallmentPaymentHandler.php b/src/PaymentHandler/PayoneSecuredInstallmentPaymentHandler.php index afbeafa0e..14a56e7de 100644 --- a/src/PaymentHandler/PayoneSecuredInstallmentPaymentHandler.php +++ b/src/PaymentHandler/PayoneSecuredInstallmentPaymentHandler.php @@ -25,33 +25,20 @@ class PayoneSecuredInstallmentPaymentHandler extends AbstractPayonePaymentHandler implements SynchronousPaymentHandlerInterface { - private PayoneClientInterface $client; - - private TranslatorInterface $translator; - - private TransactionDataHandlerInterface $dataHandler; - - private RequestParameterFactory $requestParameterFactory; - - private AbstractDeviceFingerprintService $deviceFingerprintService; + private readonly TranslatorInterface $translator; public function __construct( ConfigReaderInterface $configReader, - PayoneClientInterface $client, + private readonly PayoneClientInterface $client, TranslatorInterface $translator, - TransactionDataHandlerInterface $dataHandler, + private readonly TransactionDataHandlerInterface $dataHandler, EntityRepository $lineItemRepository, RequestStack $requestStack, - RequestParameterFactory $requestParameterFactory, - AbstractDeviceFingerprintService $deviceFingerprintService + private readonly RequestParameterFactory $requestParameterFactory, + private readonly AbstractDeviceFingerprintService $deviceFingerprintService ) { parent::__construct($configReader, $lineItemRepository, $requestStack); - - $this->client = $client; $this->translator = $translator; - $this->dataHandler = $dataHandler; - $this->requestParameterFactory = $requestParameterFactory; - $this->deviceFingerprintService = $deviceFingerprintService; } /** @@ -75,7 +62,7 @@ public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $d $paymentTransaction, $requestData, $salesChannelContext, - __CLASS__, + self::class, $authorizationMethod ) ); @@ -89,7 +76,7 @@ public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $d $transaction->getOrderTransaction()->getId(), $exception->getResponse()['error']['CustomerMessage'] ); - } catch (\Throwable $exception) { + } catch (\Throwable) { $this->deviceFingerprintService->deleteDeviceIdentToken(); throw new SyncPaymentProcessException( diff --git a/src/PaymentHandler/PayoneSecuredInvoicePaymentHandler.php b/src/PaymentHandler/PayoneSecuredInvoicePaymentHandler.php index 59f575c9a..e92620291 100644 --- a/src/PaymentHandler/PayoneSecuredInvoicePaymentHandler.php +++ b/src/PaymentHandler/PayoneSecuredInvoicePaymentHandler.php @@ -23,33 +23,20 @@ class PayoneSecuredInvoicePaymentHandler extends AbstractPayonePaymentHandler implements SynchronousPaymentHandlerInterface { - private PayoneClientInterface $client; - - private TranslatorInterface $translator; - - private TransactionDataHandlerInterface $dataHandler; - - private RequestParameterFactory $requestParameterFactory; - - private AbstractDeviceFingerprintService $deviceFingerprintService; + private readonly TranslatorInterface $translator; public function __construct( ConfigReaderInterface $configReader, - PayoneClientInterface $client, + private readonly PayoneClientInterface $client, TranslatorInterface $translator, - TransactionDataHandlerInterface $dataHandler, + private readonly TransactionDataHandlerInterface $dataHandler, EntityRepository $lineItemRepository, RequestStack $requestStack, - RequestParameterFactory $requestParameterFactory, - AbstractDeviceFingerprintService $deviceFingerprintService + private readonly RequestParameterFactory $requestParameterFactory, + private readonly AbstractDeviceFingerprintService $deviceFingerprintService ) { parent::__construct($configReader, $lineItemRepository, $requestStack); - - $this->client = $client; $this->translator = $translator; - $this->dataHandler = $dataHandler; - $this->requestParameterFactory = $requestParameterFactory; - $this->deviceFingerprintService = $deviceFingerprintService; } /** @@ -73,7 +60,7 @@ public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $d $paymentTransaction, $requestData, $salesChannelContext, - __CLASS__, + self::class, $authorizationMethod ) ); @@ -87,7 +74,7 @@ public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $d $transaction->getOrderTransaction()->getId(), $exception->getResponse()['error']['CustomerMessage'] ); - } catch (\Throwable $exception) { + } catch (\Throwable) { $this->deviceFingerprintService->deleteDeviceIdentToken(); throw new SyncPaymentProcessException( diff --git a/src/PaymentHandler/PayoneSofortBankingPaymentHandler.php b/src/PaymentHandler/PayoneSofortBankingPaymentHandler.php index 4c1293ffa..675ca9e50 100644 --- a/src/PaymentHandler/PayoneSofortBankingPaymentHandler.php +++ b/src/PaymentHandler/PayoneSofortBankingPaymentHandler.php @@ -26,33 +26,20 @@ class PayoneSofortBankingPaymentHandler extends AbstractPayonePaymentHandler implements AsynchronousPaymentHandlerInterface { - private RequestParameterFactory $requestParameterFactory; - - private PayoneClientInterface $client; - - private TranslatorInterface $translator; - - private TransactionDataHandlerInterface $dataHandler; - - private PaymentStateHandlerInterface $stateHandler; + private readonly TranslatorInterface $translator; public function __construct( ConfigReaderInterface $configReader, - RequestParameterFactory $requestParameterFactory, - PayoneClientInterface $client, + private readonly RequestParameterFactory $requestParameterFactory, + private readonly PayoneClientInterface $client, TranslatorInterface $translator, - TransactionDataHandlerInterface $dataHandler, + private readonly TransactionDataHandlerInterface $dataHandler, EntityRepository $lineItemRepository, - PaymentStateHandlerInterface $stateHandler, + private readonly PaymentStateHandlerInterface $stateHandler, RequestStack $requestStack ) { parent::__construct($configReader, $lineItemRepository, $requestStack); - - $this->requestParameterFactory = $requestParameterFactory; - $this->client = $client; $this->translator = $translator; - $this->dataHandler = $dataHandler; - $this->stateHandler = $stateHandler; } /** @@ -76,7 +63,7 @@ public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $ $paymentTransaction, $requestData, $salesChannelContext, - __CLASS__, + self::class, $authorizationMethod ) ); @@ -88,7 +75,7 @@ public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $ $transaction->getOrderTransaction()->getId(), $exception->getResponse()['error']['CustomerMessage'] ); - } catch (\Throwable $exception) { + } catch (\Throwable) { throw new AsyncPaymentProcessException( $transaction->getOrderTransaction()->getId(), $this->translator->trans('PayonePayment.errorMessages.genericError') @@ -125,7 +112,7 @@ public static function isCapturable(array $transactionData, array $payoneTransAc return false; } - $txAction = isset($transactionData['txaction']) ? strtolower($transactionData['txaction']) : null; + $txAction = isset($transactionData['txaction']) ? strtolower((string) $transactionData['txaction']) : null; if ($txAction === TransactionStatusService::ACTION_PAID) { return true; diff --git a/src/PaymentHandler/PayoneTrustlyPaymentHandler.php b/src/PaymentHandler/PayoneTrustlyPaymentHandler.php index 2ab70e037..d8df38880 100644 --- a/src/PaymentHandler/PayoneTrustlyPaymentHandler.php +++ b/src/PaymentHandler/PayoneTrustlyPaymentHandler.php @@ -26,33 +26,20 @@ class PayoneTrustlyPaymentHandler extends AbstractPayonePaymentHandler implements AsynchronousPaymentHandlerInterface { - private PayoneClientInterface $client; - - private TranslatorInterface $translator; - - private TransactionDataHandlerInterface $dataHandler; - - private PaymentStateHandlerInterface $stateHandler; - - private RequestParameterFactory $requestParameterFactory; + private readonly TranslatorInterface $translator; public function __construct( ConfigReaderInterface $configReader, - PayoneClientInterface $client, + private readonly PayoneClientInterface $client, TranslatorInterface $translator, - TransactionDataHandlerInterface $dataHandler, + private readonly TransactionDataHandlerInterface $dataHandler, EntityRepository $lineItemRepository, - PaymentStateHandlerInterface $stateHandler, + private readonly PaymentStateHandlerInterface $stateHandler, RequestStack $requestStack, - RequestParameterFactory $requestParameterFactory + private readonly RequestParameterFactory $requestParameterFactory ) { parent::__construct($configReader, $lineItemRepository, $requestStack); - - $this->client = $client; $this->translator = $translator; - $this->dataHandler = $dataHandler; - $this->stateHandler = $stateHandler; - $this->requestParameterFactory = $requestParameterFactory; } /** @@ -76,7 +63,7 @@ public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $ $paymentTransaction, $requestData, $salesChannelContext, - __CLASS__, + self::class, $authorizationMethod ) ); @@ -88,7 +75,7 @@ public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $ $transaction->getOrderTransaction()->getId(), $exception->getResponse()['error']['CustomerMessage'] ); - } catch (\Throwable $exception) { + } catch (\Throwable) { throw new AsyncPaymentProcessException( $transaction->getOrderTransaction()->getId(), $this->translator->trans('PayonePayment.errorMessages.genericError') @@ -126,7 +113,7 @@ public static function isCapturable(array $transactionData, array $payoneTransAc return false; } - return strtolower($transactionData['txaction']) === TransactionStatusService::ACTION_PAID; + return strtolower((string) $transactionData['txaction']) === TransactionStatusService::ACTION_PAID; } /** @@ -134,10 +121,10 @@ public static function isCapturable(array $transactionData, array $payoneTransAc */ public static function isRefundable(array $transactionData): bool { - if (strtolower($transactionData['txaction']) === TransactionStatusService::ACTION_CAPTURE && (float) $transactionData['receivable'] !== 0.0) { + if (strtolower((string) $transactionData['txaction']) === TransactionStatusService::ACTION_CAPTURE && (float) $transactionData['receivable'] !== 0.0) { return true; } - return strtolower($transactionData['txaction']) === TransactionStatusService::ACTION_PAID; + return strtolower((string) $transactionData['txaction']) === TransactionStatusService::ACTION_PAID; } } diff --git a/src/PaymentHandler/PayoneWeChatPayPaymentHandler.php b/src/PaymentHandler/PayoneWeChatPayPaymentHandler.php index 01a4778c0..0bdc0666d 100644 --- a/src/PaymentHandler/PayoneWeChatPayPaymentHandler.php +++ b/src/PaymentHandler/PayoneWeChatPayPaymentHandler.php @@ -26,33 +26,20 @@ class PayoneWeChatPayPaymentHandler extends AbstractPayonePaymentHandler implements AsynchronousPaymentHandlerInterface { - private PayoneClientInterface $client; - - private TranslatorInterface $translator; - - private TransactionDataHandlerInterface $dataHandler; - - private PaymentStateHandlerInterface $stateHandler; - - private RequestParameterFactory $requestParameterFactory; + private readonly TranslatorInterface $translator; public function __construct( ConfigReaderInterface $configReader, EntityRepository $lineItemRepository, - PayoneClientInterface $client, + private readonly PayoneClientInterface $client, TranslatorInterface $translator, - TransactionDataHandlerInterface $dataHandler, - PaymentStateHandlerInterface $stateHandler, + private readonly TransactionDataHandlerInterface $dataHandler, + private readonly PaymentStateHandlerInterface $stateHandler, RequestStack $requestStack, - RequestParameterFactory $requestParameterFactory + private readonly RequestParameterFactory $requestParameterFactory ) { parent::__construct($configReader, $lineItemRepository, $requestStack); - - $this->client = $client; $this->translator = $translator; - $this->dataHandler = $dataHandler; - $this->stateHandler = $stateHandler; - $this->requestParameterFactory = $requestParameterFactory; } /** @@ -76,7 +63,7 @@ public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $ $paymentTransaction, $requestData, $salesChannelContext, - __CLASS__, + self::class, $authorizationMethod ) ); @@ -88,7 +75,7 @@ public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $ $transaction->getOrderTransaction()->getId(), $exception->getResponse()['error']['CustomerMessage'] ); - } catch (\Throwable $exception) { + } catch (\Throwable) { throw new AsyncPaymentProcessException( $transaction->getOrderTransaction()->getId(), $this->translator->trans('PayonePayment.errorMessages.genericError') @@ -130,7 +117,7 @@ public static function isCapturable(array $transactionData, array $payoneTransAc return false; } - return strtolower($transactionData['txaction']) === TransactionStatusService::ACTION_PAID; + return strtolower((string) $transactionData['txaction']) === TransactionStatusService::ACTION_PAID; } /** @@ -138,10 +125,10 @@ public static function isCapturable(array $transactionData, array $payoneTransAc */ public static function isRefundable(array $transactionData): bool { - if (strtolower($transactionData['txaction']) === TransactionStatusService::ACTION_CAPTURE && (float) $transactionData['receivable'] !== 0.0) { + if (strtolower((string) $transactionData['txaction']) === TransactionStatusService::ACTION_CAPTURE && (float) $transactionData['receivable'] !== 0.0) { return true; } - return strtolower($transactionData['txaction']) === TransactionStatusService::ACTION_PAID; + return strtolower((string) $transactionData['txaction']) === TransactionStatusService::ACTION_PAID; } } diff --git a/src/PaymentMethod/PayoneAlipay.php b/src/PaymentMethod/PayoneAlipay.php index 68c78c8c6..95a2befc2 100644 --- a/src/PaymentMethod/PayoneAlipay.php +++ b/src/PaymentMethod/PayoneAlipay.php @@ -9,7 +9,7 @@ class PayoneAlipay extends AbstractPaymentMethod { - public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; + final public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; protected string $id = self::UUID; diff --git a/src/PaymentMethod/PayoneApplePay.php b/src/PaymentMethod/PayoneApplePay.php index 68c9f478f..afbc4d519 100644 --- a/src/PaymentMethod/PayoneApplePay.php +++ b/src/PaymentMethod/PayoneApplePay.php @@ -9,7 +9,7 @@ class PayoneApplePay extends AbstractPaymentMethod { - public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; + final public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; protected string $id = self::UUID; diff --git a/src/PaymentMethod/PayoneBancontact.php b/src/PaymentMethod/PayoneBancontact.php index 64c6e4fd3..255eef1d9 100644 --- a/src/PaymentMethod/PayoneBancontact.php +++ b/src/PaymentMethod/PayoneBancontact.php @@ -9,7 +9,7 @@ class PayoneBancontact extends AbstractPaymentMethod { - public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; + final public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; protected string $id = self::UUID; diff --git a/src/PaymentMethod/PayoneCreditCard.php b/src/PaymentMethod/PayoneCreditCard.php index 64a16d59f..3f2600a64 100644 --- a/src/PaymentMethod/PayoneCreditCard.php +++ b/src/PaymentMethod/PayoneCreditCard.php @@ -9,7 +9,7 @@ class PayoneCreditCard extends AbstractPaymentMethod { - public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; + final public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; protected string $id = self::UUID; diff --git a/src/PaymentMethod/PayoneDebit.php b/src/PaymentMethod/PayoneDebit.php index 05e08fc1e..16a9deb0f 100644 --- a/src/PaymentMethod/PayoneDebit.php +++ b/src/PaymentMethod/PayoneDebit.php @@ -9,7 +9,7 @@ class PayoneDebit extends AbstractPaymentMethod { - public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; + final public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; protected string $id = self::UUID; diff --git a/src/PaymentMethod/PayoneEps.php b/src/PaymentMethod/PayoneEps.php index 0654ee1b0..661680816 100644 --- a/src/PaymentMethod/PayoneEps.php +++ b/src/PaymentMethod/PayoneEps.php @@ -9,7 +9,7 @@ class PayoneEps extends AbstractPaymentMethod { - public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; + final public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; protected string $id = self::UUID; diff --git a/src/PaymentMethod/PayoneIDeal.php b/src/PaymentMethod/PayoneIDeal.php index 170817552..fe725c9ea 100644 --- a/src/PaymentMethod/PayoneIDeal.php +++ b/src/PaymentMethod/PayoneIDeal.php @@ -9,7 +9,7 @@ class PayoneIDeal extends AbstractPaymentMethod { - public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; + final public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; protected string $id = self::UUID; diff --git a/src/PaymentMethod/PayoneKlarnaDirectDebit.php b/src/PaymentMethod/PayoneKlarnaDirectDebit.php index 944afc553..9a29893ac 100644 --- a/src/PaymentMethod/PayoneKlarnaDirectDebit.php +++ b/src/PaymentMethod/PayoneKlarnaDirectDebit.php @@ -9,7 +9,7 @@ class PayoneKlarnaDirectDebit extends AbstractPayoneKlarna { - public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; + final public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; protected string $id = self::UUID; diff --git a/src/PaymentMethod/PayoneKlarnaInstallment.php b/src/PaymentMethod/PayoneKlarnaInstallment.php index 411cc7ea8..cdf5cf894 100644 --- a/src/PaymentMethod/PayoneKlarnaInstallment.php +++ b/src/PaymentMethod/PayoneKlarnaInstallment.php @@ -9,7 +9,7 @@ class PayoneKlarnaInstallment extends AbstractPayoneKlarna { - public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; + final public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; protected string $id = self::UUID; diff --git a/src/PaymentMethod/PayoneKlarnaInvoice.php b/src/PaymentMethod/PayoneKlarnaInvoice.php index b7bdf481a..3c5c1286c 100644 --- a/src/PaymentMethod/PayoneKlarnaInvoice.php +++ b/src/PaymentMethod/PayoneKlarnaInvoice.php @@ -9,7 +9,7 @@ class PayoneKlarnaInvoice extends AbstractPayoneKlarna { - public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; + final public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; protected string $id = self::UUID; diff --git a/src/PaymentMethod/PayoneOpenInvoice.php b/src/PaymentMethod/PayoneOpenInvoice.php index 961f2e686..e3c4f956c 100644 --- a/src/PaymentMethod/PayoneOpenInvoice.php +++ b/src/PaymentMethod/PayoneOpenInvoice.php @@ -9,7 +9,7 @@ class PayoneOpenInvoice extends AbstractPaymentMethod { - public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; + final public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; protected string $id = self::UUID; diff --git a/src/PaymentMethod/PayonePaydirekt.php b/src/PaymentMethod/PayonePaydirekt.php index b2154ef27..82ecc7cba 100644 --- a/src/PaymentMethod/PayonePaydirekt.php +++ b/src/PaymentMethod/PayonePaydirekt.php @@ -9,7 +9,7 @@ class PayonePaydirekt extends AbstractPaymentMethod { - public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; + final public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; protected string $id = self::UUID; diff --git a/src/PaymentMethod/PayonePayolutionDebit.php b/src/PaymentMethod/PayonePayolutionDebit.php index d09b8b828..40f2c663a 100644 --- a/src/PaymentMethod/PayonePayolutionDebit.php +++ b/src/PaymentMethod/PayonePayolutionDebit.php @@ -9,7 +9,7 @@ class PayonePayolutionDebit extends AbstractPaymentMethod { - public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; + final public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; protected string $id = self::UUID; diff --git a/src/PaymentMethod/PayonePayolutionInstallment.php b/src/PaymentMethod/PayonePayolutionInstallment.php index ee125b8a6..c57bd9f58 100644 --- a/src/PaymentMethod/PayonePayolutionInstallment.php +++ b/src/PaymentMethod/PayonePayolutionInstallment.php @@ -9,7 +9,7 @@ class PayonePayolutionInstallment extends AbstractPaymentMethod { - public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; + final public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; protected string $id = self::UUID; diff --git a/src/PaymentMethod/PayonePayolutionInvoicing.php b/src/PaymentMethod/PayonePayolutionInvoicing.php index ef92daf80..57f5713f3 100644 --- a/src/PaymentMethod/PayonePayolutionInvoicing.php +++ b/src/PaymentMethod/PayonePayolutionInvoicing.php @@ -9,7 +9,7 @@ class PayonePayolutionInvoicing extends AbstractPaymentMethod { - public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; + final public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; protected string $id = self::UUID; diff --git a/src/PaymentMethod/PayonePaypal.php b/src/PaymentMethod/PayonePaypal.php index d85e16961..be0a70788 100644 --- a/src/PaymentMethod/PayonePaypal.php +++ b/src/PaymentMethod/PayonePaypal.php @@ -9,7 +9,7 @@ class PayonePaypal extends AbstractPaymentMethod { - public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; + final public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; protected string $id = self::UUID; diff --git a/src/PaymentMethod/PayonePaypalExpress.php b/src/PaymentMethod/PayonePaypalExpress.php index d9aa6717f..73188b16d 100644 --- a/src/PaymentMethod/PayonePaypalExpress.php +++ b/src/PaymentMethod/PayonePaypalExpress.php @@ -9,7 +9,7 @@ class PayonePaypalExpress extends AbstractPaymentMethod { - public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; + final public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; protected string $id = self::UUID; diff --git a/src/PaymentMethod/PayonePostfinanceCard.php b/src/PaymentMethod/PayonePostfinanceCard.php index b9f3835a6..0cb0ed7b4 100644 --- a/src/PaymentMethod/PayonePostfinanceCard.php +++ b/src/PaymentMethod/PayonePostfinanceCard.php @@ -9,7 +9,7 @@ class PayonePostfinanceCard extends AbstractPaymentMethod { - public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; + final public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; protected string $id = self::UUID; diff --git a/src/PaymentMethod/PayonePostfinanceWallet.php b/src/PaymentMethod/PayonePostfinanceWallet.php index 05dcd361d..321171cdd 100644 --- a/src/PaymentMethod/PayonePostfinanceWallet.php +++ b/src/PaymentMethod/PayonePostfinanceWallet.php @@ -9,7 +9,7 @@ class PayonePostfinanceWallet extends AbstractPaymentMethod { - public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; + final public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; protected string $id = self::UUID; diff --git a/src/PaymentMethod/PayonePrepayment.php b/src/PaymentMethod/PayonePrepayment.php index e94b34251..2889ecc32 100644 --- a/src/PaymentMethod/PayonePrepayment.php +++ b/src/PaymentMethod/PayonePrepayment.php @@ -9,7 +9,7 @@ class PayonePrepayment extends AbstractPaymentMethod { - public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; + final public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; protected string $id = self::UUID; diff --git a/src/PaymentMethod/PayonePrzelewy24.php b/src/PaymentMethod/PayonePrzelewy24.php index 4355c6b20..1d384aa94 100644 --- a/src/PaymentMethod/PayonePrzelewy24.php +++ b/src/PaymentMethod/PayonePrzelewy24.php @@ -9,7 +9,7 @@ class PayonePrzelewy24 extends AbstractPaymentMethod { - public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; + final public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; protected string $id = self::UUID; diff --git a/src/PaymentMethod/PayoneRatepayDebit.php b/src/PaymentMethod/PayoneRatepayDebit.php index 6790f6646..c1f401e80 100644 --- a/src/PaymentMethod/PayoneRatepayDebit.php +++ b/src/PaymentMethod/PayoneRatepayDebit.php @@ -9,7 +9,7 @@ class PayoneRatepayDebit extends AbstractPaymentMethod { - public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; + final public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; protected string $id = self::UUID; diff --git a/src/PaymentMethod/PayoneRatepayInstallment.php b/src/PaymentMethod/PayoneRatepayInstallment.php index 066ae32c6..a67ce67ff 100644 --- a/src/PaymentMethod/PayoneRatepayInstallment.php +++ b/src/PaymentMethod/PayoneRatepayInstallment.php @@ -9,7 +9,7 @@ class PayoneRatepayInstallment extends AbstractPaymentMethod { - public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; + final public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; protected string $id = self::UUID; diff --git a/src/PaymentMethod/PayoneRatepayInvoicing.php b/src/PaymentMethod/PayoneRatepayInvoicing.php index c30c3af26..8eb063c78 100644 --- a/src/PaymentMethod/PayoneRatepayInvoicing.php +++ b/src/PaymentMethod/PayoneRatepayInvoicing.php @@ -9,7 +9,7 @@ class PayoneRatepayInvoicing extends AbstractPaymentMethod { - public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; + final public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; protected string $id = self::UUID; diff --git a/src/PaymentMethod/PayoneSecureInvoice.php b/src/PaymentMethod/PayoneSecureInvoice.php index 375101fb1..7dbf3eace 100644 --- a/src/PaymentMethod/PayoneSecureInvoice.php +++ b/src/PaymentMethod/PayoneSecureInvoice.php @@ -9,9 +9,9 @@ class PayoneSecureInvoice extends AbstractPaymentMethod { - public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; - public const BUSINESSRELATION_B2B = 'b2b'; - public const BUSINESSRELATION_B2C = 'b2c'; + final public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; + final public const BUSINESSRELATION_B2B = 'b2b'; + final public const BUSINESSRELATION_B2C = 'b2c'; protected string $id = self::UUID; diff --git a/src/PaymentMethod/PayoneSecuredDirectDebit.php b/src/PaymentMethod/PayoneSecuredDirectDebit.php index bd0df784f..4c72fe097 100644 --- a/src/PaymentMethod/PayoneSecuredDirectDebit.php +++ b/src/PaymentMethod/PayoneSecuredDirectDebit.php @@ -9,7 +9,7 @@ class PayoneSecuredDirectDebit extends AbstractPaymentMethod { - public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; + final public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; protected string $id = self::UUID; diff --git a/src/PaymentMethod/PayoneSecuredInstallment.php b/src/PaymentMethod/PayoneSecuredInstallment.php index 7059277b5..beb2265fc 100644 --- a/src/PaymentMethod/PayoneSecuredInstallment.php +++ b/src/PaymentMethod/PayoneSecuredInstallment.php @@ -9,7 +9,7 @@ class PayoneSecuredInstallment extends AbstractPaymentMethod { - public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; + final public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; protected string $id = self::UUID; diff --git a/src/PaymentMethod/PayoneSecuredInvoice.php b/src/PaymentMethod/PayoneSecuredInvoice.php index 9d925f674..297b21b6a 100644 --- a/src/PaymentMethod/PayoneSecuredInvoice.php +++ b/src/PaymentMethod/PayoneSecuredInvoice.php @@ -9,7 +9,7 @@ class PayoneSecuredInvoice extends AbstractPaymentMethod { - public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; + final public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; protected string $id = self::UUID; diff --git a/src/PaymentMethod/PayoneSofortBanking.php b/src/PaymentMethod/PayoneSofortBanking.php index 6c71f2e85..b9918879d 100644 --- a/src/PaymentMethod/PayoneSofortBanking.php +++ b/src/PaymentMethod/PayoneSofortBanking.php @@ -12,7 +12,7 @@ */ class PayoneSofortBanking extends AbstractPaymentMethod { - public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; + final public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; protected string $id = self::UUID; diff --git a/src/PaymentMethod/PayoneTrustly.php b/src/PaymentMethod/PayoneTrustly.php index 009ddec4f..f0648506f 100644 --- a/src/PaymentMethod/PayoneTrustly.php +++ b/src/PaymentMethod/PayoneTrustly.php @@ -9,7 +9,7 @@ class PayoneTrustly extends AbstractPaymentMethod { - public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; + final public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; protected string $id = self::UUID; diff --git a/src/PaymentMethod/PayoneWeChatPay.php b/src/PaymentMethod/PayoneWeChatPay.php index 6d0291598..2eaf9b3e9 100644 --- a/src/PaymentMethod/PayoneWeChatPay.php +++ b/src/PaymentMethod/PayoneWeChatPay.php @@ -9,7 +9,7 @@ class PayoneWeChatPay extends AbstractPaymentMethod { - public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; + final public const UUID = PaymentMethodInstaller::PAYMENT_METHOD_IDS[self::class]; protected string $id = self::UUID; diff --git a/src/Payone/Client/Exception/PayoneRequestException.php b/src/Payone/Client/Exception/PayoneRequestException.php index f84f0bc73..2f8f725b6 100644 --- a/src/Payone/Client/Exception/PayoneRequestException.php +++ b/src/Payone/Client/Exception/PayoneRequestException.php @@ -6,16 +6,9 @@ class PayoneRequestException extends \Exception { - private array $request; - - private array $response; - - public function __construct(string $message, array $request = [], array $response = []) + public function __construct(string $message, private readonly array $request = [], private readonly array $response = []) { parent::__construct($message); - - $this->request = $request; - $this->response = $response; } public function getRequest(): array diff --git a/src/Payone/Client/PayoneClient.php b/src/Payone/Client/PayoneClient.php index 348fea44b..1f0d82e3c 100644 --- a/src/Payone/Client/PayoneClient.php +++ b/src/Payone/Client/PayoneClient.php @@ -9,11 +9,8 @@ class PayoneClient implements PayoneClientInterface { - private LoggerInterface $logger; - - public function __construct(LoggerInterface $logger) + public function __construct(private readonly LoggerInterface $logger) { - $this->logger = $logger; } /** diff --git a/src/Payone/RequestParameter/Builder/AbstractRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/AbstractRequestParameterBuilder.php index e2e8e6ccf..81d0b153b 100644 --- a/src/Payone/RequestParameter/Builder/AbstractRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/AbstractRequestParameterBuilder.php @@ -13,31 +13,31 @@ abstract class AbstractRequestParameterBuilder { - public const REQUEST_ACTION_AUTHORIZE = 'authorization'; - public const REQUEST_ACTION_PREAUTHORIZE = 'preauthorization'; - public const REQUEST_ACTION_CAPTURE = 'capture'; - public const REQUEST_ACTION_REFUND = 'refund'; - public const REQUEST_ACTION_TEST = 'test'; - public const REQUEST_ACTION_GET_EXPRESS_CHECKOUT_DETAILS = 'getexpresscheckoutdetails'; - public const REQUEST_ACTION_SET_EXPRESS_CHECKOUT = 'setexpresscheckout'; - public const REQUEST_ACTION_PAYOLUTION_PRE_CHECK = 'pre-check'; - public const REQUEST_ACTION_PAYOLUTION_CALCULATION = 'calculation'; - public const REQUEST_ACTION_GENERIC_PAYMENT = 'genericpayment'; - public const REQUEST_ACTION_CREDITCARD_CHECK = 'creditcardcheck'; - public const REQUEST_ACTION_GET_FILE = 'getfile'; - public const REQUEST_ACTION_MANAGE_MANDATE = 'managemandate'; - public const REQUEST_ACTION_DEBIT = 'debit'; - public const REQUEST_ACTION_RATEPAY_PROFILE = 'ratepayProfile'; - public const REQUEST_ACTION_RATEPAY_CALCULATION = 'ratepayCalculation'; - public const REQUEST_ACTION_SECURED_INSTALLMENT_OPTIONS = 'securedInstallmentOptions'; - - public const CLEARING_TYPE_DEBIT = 'elv'; - public const CLEARING_TYPE_WALLET = 'wlt'; - public const CLEARING_TYPE_FINANCING = 'fnc'; - public const CLEARING_TYPE_CREDIT_CARD = 'cc'; - public const CLEARING_TYPE_PREPAYMENT = 'vor'; - public const CLEARING_TYPE_ONLINE_BANK_TRANSFER = 'sb'; - public const CLEARING_TYPE_INVOICE = 'rec'; + final public const REQUEST_ACTION_AUTHORIZE = 'authorization'; + final public const REQUEST_ACTION_PREAUTHORIZE = 'preauthorization'; + final public const REQUEST_ACTION_CAPTURE = 'capture'; + final public const REQUEST_ACTION_REFUND = 'refund'; + final public const REQUEST_ACTION_TEST = 'test'; + final public const REQUEST_ACTION_GET_EXPRESS_CHECKOUT_DETAILS = 'getexpresscheckoutdetails'; + final public const REQUEST_ACTION_SET_EXPRESS_CHECKOUT = 'setexpresscheckout'; + final public const REQUEST_ACTION_PAYOLUTION_PRE_CHECK = 'pre-check'; + final public const REQUEST_ACTION_PAYOLUTION_CALCULATION = 'calculation'; + final public const REQUEST_ACTION_GENERIC_PAYMENT = 'genericpayment'; + final public const REQUEST_ACTION_CREDITCARD_CHECK = 'creditcardcheck'; + final public const REQUEST_ACTION_GET_FILE = 'getfile'; + final public const REQUEST_ACTION_MANAGE_MANDATE = 'managemandate'; + final public const REQUEST_ACTION_DEBIT = 'debit'; + final public const REQUEST_ACTION_RATEPAY_PROFILE = 'ratepayProfile'; + final public const REQUEST_ACTION_RATEPAY_CALCULATION = 'ratepayCalculation'; + final public const REQUEST_ACTION_SECURED_INSTALLMENT_OPTIONS = 'securedInstallmentOptions'; + + final public const CLEARING_TYPE_DEBIT = 'elv'; + final public const CLEARING_TYPE_WALLET = 'wlt'; + final public const CLEARING_TYPE_FINANCING = 'fnc'; + final public const CLEARING_TYPE_CREDIT_CARD = 'cc'; + final public const CLEARING_TYPE_PREPAYMENT = 'vor'; + final public const CLEARING_TYPE_ONLINE_BANK_TRANSFER = 'sb'; + final public const CLEARING_TYPE_INVOICE = 'rec'; abstract public function getRequestParameter(AbstractRequestParameterStruct $arguments): array; @@ -81,7 +81,7 @@ protected function validateMethod(object $object, string $method): void { if (!method_exists($object, $method)) { // there is no function to get the salesChannelContext. Without it the builder is not able to get the customer data - throw new \RuntimeException(sprintf('method `%s` does not exist on %s', $method, \get_class($object))); + throw new \RuntimeException(sprintf('method `%s` does not exist on %s', $method, $object::class)); } } diff --git a/src/Payone/RequestParameter/Builder/ApplePay/AuthorizeRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/ApplePay/AuthorizeRequestParameterBuilder.php index be881e00e..954ad3e2d 100644 --- a/src/Payone/RequestParameter/Builder/ApplePay/AuthorizeRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/ApplePay/AuthorizeRequestParameterBuilder.php @@ -28,20 +28,17 @@ class AuthorizeRequestParameterBuilder extends AbstractRequestParameterBuilder { protected CartService $cartService; - protected CurrencyPrecisionInterface $currencyPrecision; - protected NumberRangeValueGeneratorInterface $numberRangeValueGenerator; protected EntityRepository $orderRepository; public function __construct( CartService $cartService, - CurrencyPrecisionInterface $currencyPrecision, + protected CurrencyPrecisionInterface $currencyPrecision, NumberRangeValueGeneratorInterface $numberRangeValueGenerator, EntityRepository $orderRepository ) { $this->cartService = $cartService; - $this->currencyPrecision = $currencyPrecision; $this->numberRangeValueGenerator = $numberRangeValueGenerator; $this->orderRepository = $orderRepository; } @@ -169,7 +166,7 @@ private function getCardType(ParameterBag $requestDataBag): string { $paymentMethod = $requestDataBag->get('paymentMethod', new RequestDataBag()); - return strtoupper(substr($paymentMethod->get('network', '?'), 0, 1)); + return strtoupper(substr((string) $paymentMethod->get('network', '?'), 0, 1)); } private function getReferenceForExistingOrder(?OrderEntity $order): ?string diff --git a/src/Payone/RequestParameter/Builder/Capture/CaptureRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/Capture/CaptureRequestParameterBuilder.php index a17739d88..7bc8b7a1d 100644 --- a/src/Payone/RequestParameter/Builder/Capture/CaptureRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/Capture/CaptureRequestParameterBuilder.php @@ -23,17 +23,14 @@ class CaptureRequestParameterBuilder extends AbstractRequestParameterBuilder { - public const CAPTUREMODE_COMPLETED = 'completed'; - public const CAPTUREMODE_INCOMPLETE = 'notcompleted'; - public const SETTLEACCOUNT_YES = 'yes'; - public const SETTLEACCOUNT_AUTO = 'auto'; - public const SETTLEACCOUNT_NO = 'no'; + final public const CAPTUREMODE_COMPLETED = 'completed'; + final public const CAPTUREMODE_INCOMPLETE = 'notcompleted'; + final public const SETTLEACCOUNT_YES = 'yes'; + final public const SETTLEACCOUNT_AUTO = 'auto'; + final public const SETTLEACCOUNT_NO = 'no'; - private CurrencyPrecisionInterface $currencyPrecision; - - public function __construct(CurrencyPrecisionInterface $currencyPrecision) + public function __construct(private readonly CurrencyPrecisionInterface $currencyPrecision) { - $this->currencyPrecision = $currencyPrecision; } /** diff --git a/src/Payone/RequestParameter/Builder/CustomerInformationRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/CustomerInformationRequestParameterBuilder.php index f0bbbbca9..1f764025d 100644 --- a/src/Payone/RequestParameter/Builder/CustomerInformationRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/CustomerInformationRequestParameterBuilder.php @@ -20,7 +20,7 @@ class CustomerInformationRequestParameterBuilder extends AbstractRequestParameterBuilder { - private EntityRepository $orderAddressRepository; + private readonly EntityRepository $orderAddressRepository; public function __construct(EntityRepository $orderAddressRepository) { @@ -32,6 +32,7 @@ public function __construct(EntityRepository $orderAddressRepository) */ public function getRequestParameter(AbstractRequestParameterStruct $arguments): array { + $parameters = []; $paymentTransaction = $arguments->getPaymentTransaction(); $dataBag = $arguments->getRequestData(); $order = $paymentTransaction->getOrder(); diff --git a/src/Payone/RequestParameter/Builder/CustomerRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/CustomerRequestParameterBuilder.php index ac0a910ac..b936a3bde 100644 --- a/src/Payone/RequestParameter/Builder/CustomerRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/CustomerRequestParameterBuilder.php @@ -48,13 +48,13 @@ class CustomerRequestParameterBuilder extends AbstractRequestParameterBuilder { - private EntityRepository $languageRepository; + private readonly EntityRepository $languageRepository; - private RequestStack $requestStack; + private readonly RequestStack $requestStack; - private EntityRepository $salutationRepository; + private readonly EntityRepository $salutationRepository; - private EntityRepository $countryRepository; + private readonly EntityRepository $countryRepository; public function __construct( EntityRepository $languageRepository, @@ -104,7 +104,7 @@ public function getRequestParameter(AbstractRequestParameterStruct $arguments): 'city' => $billingAddress->getCity(), 'country' => $this->getCustomerCountry($billingAddress, $salesChannelContext->getContext())->getIso(), 'email' => $salesChannelContext->getCustomer()->getEmail(), - 'language' => substr($language->getLocale()->getCode(), 0, 2), + 'language' => substr((string) $language->getLocale()->getCode(), 0, 2), 'ip' => $this->requestStack->getCurrentRequest() !== null ? $this->requestStack->getCurrentRequest()->getClientIp() : null, ]; diff --git a/src/Payone/RequestParameter/Builder/GeneralTransactionRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/GeneralTransactionRequestParameterBuilder.php index 75e3b825e..5d98a316a 100644 --- a/src/Payone/RequestParameter/Builder/GeneralTransactionRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/GeneralTransactionRequestParameterBuilder.php @@ -25,22 +25,13 @@ class GeneralTransactionRequestParameterBuilder extends AbstractRequestParameter { protected EntityRepository $currencyRepository; - protected CurrencyPrecisionInterface $currencyPrecision; - - protected CartHasherInterface $cartHasher; - - protected ConfigReaderInterface $configReader; - public function __construct( - CartHasherInterface $cartHasher, - ConfigReaderInterface $configReader, + protected CartHasherInterface $cartHasher, + protected ConfigReaderInterface $configReader, EntityRepository $currencyRepository, - CurrencyPrecisionInterface $currencyPrecision + protected CurrencyPrecisionInterface $currencyPrecision ) { - $this->cartHasher = $cartHasher; - $this->configReader = $configReader; $this->currencyRepository = $currencyRepository; - $this->currencyPrecision = $currencyPrecision; } public function getRequestParameter(AbstractRequestParameterStruct $arguments): array @@ -147,9 +138,7 @@ private function getLatestReferenceNumber(PaymentTransaction $transaction): ?str return null; } - $transactions->sort(static function (OrderTransactionEntity $a, OrderTransactionEntity $b) { - return $a->getCreatedAt() <=> $b->getCreatedAt(); - }); + $transactions->sort(static fn(OrderTransactionEntity $a, OrderTransactionEntity $b) => $a->getCreatedAt() <=> $b->getCreatedAt()); /** @var OrderTransactionEntity $orderTransaction */ $orderTransaction = $transactions->last(); diff --git a/src/Payone/RequestParameter/Builder/Klarna/AuthorizeRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/Klarna/AuthorizeRequestParameterBuilder.php index 0bbdd7587..c44affd67 100644 --- a/src/Payone/RequestParameter/Builder/Klarna/AuthorizeRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/Klarna/AuthorizeRequestParameterBuilder.php @@ -10,11 +10,8 @@ class AuthorizeRequestParameterBuilder extends AbstractKlarnaParameterBuilder { - private LineItemHydratorInterface $lineItemHydrator; - - public function __construct(LineItemHydratorInterface $lineItemHydrator) + public function __construct(private readonly LineItemHydratorInterface $lineItemHydrator) { - $this->lineItemHydrator = $lineItemHydrator; } /** diff --git a/src/Payone/RequestParameter/Builder/Klarna/CreateSessionRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/Klarna/CreateSessionRequestParameterBuilder.php index 64e27476c..b9487e041 100644 --- a/src/Payone/RequestParameter/Builder/Klarna/CreateSessionRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/Klarna/CreateSessionRequestParameterBuilder.php @@ -15,24 +15,15 @@ class CreateSessionRequestParameterBuilder extends AbstractKlarnaParameterBuilder { - private CartService $cartService; - - private LineItemHydratorInterface $lineItemHydrator; - - private CurrencyPrecisionInterface $currencyPrecision; - - private OrderFetcherInterface $orderFetcher; + private readonly CartService $cartService; public function __construct( CartService $cartService, - LineItemHydratorInterface $lineItemHydrator, - CurrencyPrecisionInterface $currencyPrecision, - OrderFetcherInterface $orderFetcher + private readonly LineItemHydratorInterface $lineItemHydrator, + private readonly CurrencyPrecisionInterface $currencyPrecision, + private readonly OrderFetcherInterface $orderFetcher ) { $this->cartService = $cartService; - $this->lineItemHydrator = $lineItemHydrator; - $this->currencyPrecision = $currencyPrecision; - $this->orderFetcher = $orderFetcher; } /** diff --git a/src/Payone/RequestParameter/Builder/OpenInvoice/AuthorizeRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/OpenInvoice/AuthorizeRequestParameterBuilder.php index 33fe0fef7..c7face1a9 100644 --- a/src/Payone/RequestParameter/Builder/OpenInvoice/AuthorizeRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/OpenInvoice/AuthorizeRequestParameterBuilder.php @@ -13,13 +13,10 @@ class AuthorizeRequestParameterBuilder extends AbstractRequestParameterBuilder { - protected LineItemHydratorInterface $lineItemHydrator; - protected EntityRepository $currencyRepository; - public function __construct(LineItemHydratorInterface $lineItemHydrator, EntityRepository $currencyRepository) + public function __construct(protected LineItemHydratorInterface $lineItemHydrator, EntityRepository $currencyRepository) { - $this->lineItemHydrator = $lineItemHydrator; $this->currencyRepository = $currencyRepository; } diff --git a/src/Payone/RequestParameter/Builder/OrderLinesRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/OrderLinesRequestParameterBuilder.php index efc2f1430..e1bb2ab86 100644 --- a/src/Payone/RequestParameter/Builder/OrderLinesRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/OrderLinesRequestParameterBuilder.php @@ -26,11 +26,8 @@ class OrderLinesRequestParameterBuilder extends AbstractRequestParameterBuilder { - private LineItemHydratorInterface $lineItemHydrator; - - public function __construct(LineItemHydratorInterface $lineItemHydrator) + public function __construct(private readonly LineItemHydratorInterface $lineItemHydrator) { - $this->lineItemHydrator = $lineItemHydrator; } /** @@ -65,7 +62,7 @@ public function getRequestParameter(AbstractRequestParameterStruct $arguments): if ($arguments->getAction() === self::REQUEST_ACTION_REFUND && \in_array($arguments->getPaymentMethod(), $paymentMethodsThatRequireNegativePriceForRefunds, true)) { foreach ($parameters as $key => &$parameter) { - if (strpos($key, 'pr[') === 0) { + if (str_starts_with($key, 'pr[')) { $parameter *= -1; } } diff --git a/src/Payone/RequestParameter/Builder/PayolutionInvoicing/AuthorizeRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/PayolutionInvoicing/AuthorizeRequestParameterBuilder.php index f9d889c7e..effab9a65 100644 --- a/src/Payone/RequestParameter/Builder/PayolutionInvoicing/AuthorizeRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/PayolutionInvoicing/AuthorizeRequestParameterBuilder.php @@ -18,14 +18,8 @@ class AuthorizeRequestParameterBuilder extends PayolutionDebitAuthorizeRequestParameterBuilder { - protected ConfigReaderInterface $configReader; - - protected OrderFetcherInterface $orderFetcher; - - public function __construct(ConfigReaderInterface $configReader, OrderFetcherInterface $orderFetcher) + public function __construct(protected ConfigReaderInterface $configReader, protected OrderFetcherInterface $orderFetcher) { - $this->configReader = $configReader; - $this->orderFetcher = $orderFetcher; } /** @@ -99,7 +93,7 @@ protected function provideCompanyParams(string $orderId, array &$parameters, Con } elseif (method_exists($orderCustomer, 'getVatIds')) { $vatIds = $orderCustomer->getVatIds(); - if ($vatIds !== null && \count($vatIds) > 0) { + if ($vatIds !== null && (is_countable($vatIds) ? \count($vatIds) : 0) > 0) { $parameters['add_paydata[company_uid]'] = $vatIds[0]; } } diff --git a/src/Payone/RequestParameter/Builder/PayolutionInvoicing/PreCheckRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/PayolutionInvoicing/PreCheckRequestParameterBuilder.php index fb6a07461..085f9a733 100644 --- a/src/Payone/RequestParameter/Builder/PayolutionInvoicing/PreCheckRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/PayolutionInvoicing/PreCheckRequestParameterBuilder.php @@ -95,7 +95,7 @@ protected function provideCompanyParams(array &$parameters, SalesChannelContext if (method_exists($customer, 'getVatIds')) { $vatIds = $customer->getVatIds(); - if ($vatIds !== null && \count($vatIds) > 0) { + if ($vatIds !== null && (is_countable($vatIds) ? \count($vatIds) : 0) > 0) { $parameters['add_paydata[company_uid]'] = $vatIds[0]; } } diff --git a/src/Payone/RequestParameter/Builder/Postfinance/AbstractRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/Postfinance/AbstractRequestParameterBuilder.php index b08df23f9..470548e7e 100644 --- a/src/Payone/RequestParameter/Builder/Postfinance/AbstractRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/Postfinance/AbstractRequestParameterBuilder.php @@ -7,8 +7,8 @@ abstract class AbstractRequestParameterBuilder extends \PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder { - public const ONLINEBANK_TRANSFER_TYPE_CARD = 'PFC'; - public const ONLINEBANK_TRANSFER_TYPE_WALLET = 'PFF'; + final public const ONLINEBANK_TRANSFER_TYPE_CARD = 'PFC'; + final public const ONLINEBANK_TRANSFER_TYPE_WALLET = 'PFF'; public function supports(AbstractRequestParameterStruct $arguments): bool { diff --git a/src/Payone/RequestParameter/Builder/RatepayDebit/AuthorizeRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/RatepayDebit/AuthorizeRequestParameterBuilder.php index 8e8a41845..e032a7874 100644 --- a/src/Payone/RequestParameter/Builder/RatepayDebit/AuthorizeRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/RatepayDebit/AuthorizeRequestParameterBuilder.php @@ -21,28 +21,16 @@ class AuthorizeRequestParameterBuilder extends AbstractRequestParameterBuilder { - protected OrderFetcherInterface $orderFetcher; - - protected ProfileServiceInterface $profileService; - - protected AbstractDeviceFingerprintService $deviceFingerprintService; - protected EntityRepository $customerRepository; - protected LineItemHydratorInterface $lineItemHydrator; - public function __construct( - OrderFetcherInterface $orderFetcher, - ProfileServiceInterface $profileService, - AbstractDeviceFingerprintService $deviceFingerprintService, + protected OrderFetcherInterface $orderFetcher, + protected ProfileServiceInterface $profileService, + protected AbstractDeviceFingerprintService $deviceFingerprintService, EntityRepository $customerRepository, - LineItemHydratorInterface $lineItemHydrator + protected LineItemHydratorInterface $lineItemHydrator ) { - $this->orderFetcher = $orderFetcher; - $this->profileService = $profileService; - $this->deviceFingerprintService = $deviceFingerprintService; $this->customerRepository = $customerRepository; - $this->lineItemHydrator = $lineItemHydrator; } /** diff --git a/src/Payone/RequestParameter/Builder/RatepayInstallment/AuthorizeRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/RatepayInstallment/AuthorizeRequestParameterBuilder.php index dfe15d49c..d39267734 100644 --- a/src/Payone/RequestParameter/Builder/RatepayInstallment/AuthorizeRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/RatepayInstallment/AuthorizeRequestParameterBuilder.php @@ -18,15 +18,13 @@ class AuthorizeRequestParameterBuilder extends RatepayDebitAuthorizeRequestParameterBuilder { - protected CurrencyPrecisionInterface $currencyPrecision; - public function __construct( OrderFetcherInterface $orderFetcher, ProfileServiceInterface $profileService, AbstractDeviceFingerprintService $deviceFingerprintService, EntityRepository $customerRepository, LineItemHydratorInterface $lineItemHydrator, - CurrencyPrecisionInterface $currencyPrecision + protected CurrencyPrecisionInterface $currencyPrecision ) { parent::__construct( $orderFetcher, @@ -35,7 +33,6 @@ public function __construct( $customerRepository, $lineItemHydrator ); - $this->currencyPrecision = $currencyPrecision; } /** diff --git a/src/Payone/RequestParameter/Builder/RatepayInstallment/CalculationRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/RatepayInstallment/CalculationRequestParameterBuilder.php index 1183b325c..6494dc6a7 100644 --- a/src/Payone/RequestParameter/Builder/RatepayInstallment/CalculationRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/RatepayInstallment/CalculationRequestParameterBuilder.php @@ -12,8 +12,8 @@ class CalculationRequestParameterBuilder extends GeneralTransactionRequestParameterBuilder { - public const INSTALLMENT_TYPE_RATE = 'rate'; - public const INSTALLMENT_TYPE_TIME = 'time'; + final public const INSTALLMENT_TYPE_RATE = 'rate'; + final public const INSTALLMENT_TYPE_TIME = 'time'; /** * @param RatepayCalculationStruct $arguments diff --git a/src/Payone/RequestParameter/Builder/Refund/RefundRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/Refund/RefundRequestParameterBuilder.php index 57566e4d2..fec4ff4ba 100644 --- a/src/Payone/RequestParameter/Builder/Refund/RefundRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/Refund/RefundRequestParameterBuilder.php @@ -17,11 +17,8 @@ class RefundRequestParameterBuilder extends AbstractRequestParameterBuilder { - private CurrencyPrecisionInterface $currencyPrecision; - - public function __construct(CurrencyPrecisionInterface $currencyPrecision) + public function __construct(private readonly CurrencyPrecisionInterface $currencyPrecision) { - $this->currencyPrecision = $currencyPrecision; } /** diff --git a/src/Payone/RequestParameter/Builder/ReturnUrlRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/ReturnUrlRequestParameterBuilder.php index 4b7551c4b..c6aa1579a 100644 --- a/src/Payone/RequestParameter/Builder/ReturnUrlRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/ReturnUrlRequestParameterBuilder.php @@ -24,12 +24,8 @@ class ReturnUrlRequestParameterBuilder extends AbstractRequestParameterBuilder { - protected RedirectHandler $redirectHandler; - - public function __construct( - RedirectHandler $redirectHandler - ) { - $this->redirectHandler = $redirectHandler; + public function __construct(protected RedirectHandler $redirectHandler) + { } /** diff --git a/src/Payone/RequestParameter/Builder/SecureInvoice/AuthorizeRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/SecureInvoice/AuthorizeRequestParameterBuilder.php index 2edfda37c..d87b0de33 100644 --- a/src/Payone/RequestParameter/Builder/SecureInvoice/AuthorizeRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/SecureInvoice/AuthorizeRequestParameterBuilder.php @@ -13,13 +13,10 @@ class AuthorizeRequestParameterBuilder extends AbstractRequestParameterBuilder { - protected LineItemHydratorInterface $lineItemHydrator; - protected EntityRepository $currencyRepository; - public function __construct(LineItemHydratorInterface $lineItemHydrator, EntityRepository $currencyRepository) + public function __construct(protected LineItemHydratorInterface $lineItemHydrator, EntityRepository $currencyRepository) { - $this->lineItemHydrator = $lineItemHydrator; $this->currencyRepository = $currencyRepository; } diff --git a/src/Payone/RequestParameter/Builder/SecuredDirectDebit/AuthorizeRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/SecuredDirectDebit/AuthorizeRequestParameterBuilder.php index 6874b9a5f..b9d10b40b 100644 --- a/src/Payone/RequestParameter/Builder/SecuredDirectDebit/AuthorizeRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/SecuredDirectDebit/AuthorizeRequestParameterBuilder.php @@ -19,27 +19,15 @@ class AuthorizeRequestParameterBuilder extends AbstractRequestParameterBuilder { - protected OrderFetcherInterface $orderFetcher; - - protected AbstractDeviceFingerprintService $deviceFingerprintService; - - protected CurrencyPrecisionInterface $currencyPrecision; - - protected LineItemHydratorInterface $lineItemHydrator; - protected EntityRepository $customerRepository; public function __construct( - OrderFetcherInterface $orderFetcher, - AbstractDeviceFingerprintService $deviceFingerprintService, - CurrencyPrecisionInterface $currencyPrecision, - LineItemHydratorInterface $lineItemHydrator, + protected OrderFetcherInterface $orderFetcher, + protected AbstractDeviceFingerprintService $deviceFingerprintService, + protected CurrencyPrecisionInterface $currencyPrecision, + protected LineItemHydratorInterface $lineItemHydrator, EntityRepository $customerRepository ) { - $this->orderFetcher = $orderFetcher; - $this->deviceFingerprintService = $deviceFingerprintService; - $this->currencyPrecision = $currencyPrecision; - $this->lineItemHydrator = $lineItemHydrator; $this->customerRepository = $customerRepository; } diff --git a/src/Payone/RequestParameter/Builder/SecuredInstallment/AuthorizeRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/SecuredInstallment/AuthorizeRequestParameterBuilder.php index 7cb5fc406..e591eb9ac 100644 --- a/src/Payone/RequestParameter/Builder/SecuredInstallment/AuthorizeRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/SecuredInstallment/AuthorizeRequestParameterBuilder.php @@ -19,27 +19,15 @@ class AuthorizeRequestParameterBuilder extends AbstractRequestParameterBuilder { - protected OrderFetcherInterface $orderFetcher; - - protected AbstractDeviceFingerprintService $deviceFingerprintService; - - protected CurrencyPrecisionInterface $currencyPrecision; - - protected LineItemHydratorInterface $lineItemHydrator; - protected EntityRepository $customerRepository; public function __construct( - OrderFetcherInterface $orderFetcher, - AbstractDeviceFingerprintService $deviceFingerprintService, - CurrencyPrecisionInterface $currencyPrecision, - LineItemHydratorInterface $lineItemHydrator, + protected OrderFetcherInterface $orderFetcher, + protected AbstractDeviceFingerprintService $deviceFingerprintService, + protected CurrencyPrecisionInterface $currencyPrecision, + protected LineItemHydratorInterface $lineItemHydrator, EntityRepository $customerRepository ) { - $this->orderFetcher = $orderFetcher; - $this->deviceFingerprintService = $deviceFingerprintService; - $this->currencyPrecision = $currencyPrecision; - $this->lineItemHydrator = $lineItemHydrator; $this->customerRepository = $customerRepository; } diff --git a/src/Payone/RequestParameter/Builder/SecuredInvoice/AuthorizeRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/SecuredInvoice/AuthorizeRequestParameterBuilder.php index 2af123dd5..0effbaa7d 100644 --- a/src/Payone/RequestParameter/Builder/SecuredInvoice/AuthorizeRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/SecuredInvoice/AuthorizeRequestParameterBuilder.php @@ -19,27 +19,15 @@ class AuthorizeRequestParameterBuilder extends AbstractRequestParameterBuilder { - protected OrderFetcherInterface $orderFetcher; - - protected AbstractDeviceFingerprintService $deviceFingerprintService; - - protected CurrencyPrecisionInterface $currencyPrecision; - - protected LineItemHydratorInterface $lineItemHydrator; - protected EntityRepository $customerRepository; public function __construct( - OrderFetcherInterface $orderFetcher, - AbstractDeviceFingerprintService $deviceFingerprintService, - CurrencyPrecisionInterface $currencyPrecision, - LineItemHydratorInterface $lineItemHydrator, + protected OrderFetcherInterface $orderFetcher, + protected AbstractDeviceFingerprintService $deviceFingerprintService, + protected CurrencyPrecisionInterface $currencyPrecision, + protected LineItemHydratorInterface $lineItemHydrator, EntityRepository $customerRepository ) { - $this->orderFetcher = $orderFetcher; - $this->deviceFingerprintService = $deviceFingerprintService; - $this->currencyPrecision = $currencyPrecision; - $this->lineItemHydrator = $lineItemHydrator; $this->customerRepository = $customerRepository; } diff --git a/src/Payone/RequestParameter/Builder/SystemRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/SystemRequestParameterBuilder.php index 3bbf628b7..013b1305b 100644 --- a/src/Payone/RequestParameter/Builder/SystemRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/SystemRequestParameterBuilder.php @@ -21,20 +21,14 @@ class SystemRequestParameterBuilder extends AbstractRequestParameterBuilder { - private PluginService $pluginService; - - private string $shopwareVersion; - - private ConfigReaderInterface $configReader; + private readonly PluginService $pluginService; public function __construct( PluginService $pluginService, - string $shopwareVersion, - ConfigReaderInterface $configReader + private readonly string $shopwareVersion, + private readonly ConfigReaderInterface $configReader ) { $this->pluginService = $pluginService; - $this->shopwareVersion = $shopwareVersion; - $this->configReader = $configReader; } /** diff --git a/src/Payone/RequestParameter/RequestParameterFactory.php b/src/Payone/RequestParameter/RequestParameterFactory.php index 348229a17..25f0f60b1 100644 --- a/src/Payone/RequestParameter/RequestParameterFactory.php +++ b/src/Payone/RequestParameter/RequestParameterFactory.php @@ -20,13 +20,10 @@ class RequestParameterFactory ]; /** - * @var iterable + * @param \PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder[] $requestParameterBuilder */ - private iterable $requestParameterBuilder; - - public function __construct(iterable $requestParameterBuilder) + public function __construct(private readonly iterable $requestParameterBuilder) { - $this->requestParameterBuilder = $requestParameterBuilder; } public function getRequestParameter(AbstractRequestParameterStruct $arguments): array @@ -68,11 +65,9 @@ private function createRequest(array $parameters): array } $this->generateParameterHash($parameters); - $parameters['key'] = hash('md5', $parameters['key']); + $parameters['key'] = hash('md5', (string) $parameters['key']); - return array_filter($parameters, static function ($value) { - return $value !== null && $value !== ''; - }); + return array_filter($parameters, static fn($value) => $value !== null && $value !== ''); } private function generateParameterHash(array &$parameters): void @@ -83,6 +78,6 @@ private function generateParameterHash(array &$parameters): void unset($data[$field]); } - $parameters['hash'] = strtolower(hash_hmac('sha384', implode('', $data), $parameters['key'])); + $parameters['hash'] = strtolower(hash_hmac('sha384', implode('', $data), (string) $parameters['key'])); } } diff --git a/src/Payone/RequestParameter/Struct/ApplePayTransactionStruct.php b/src/Payone/RequestParameter/Struct/ApplePayTransactionStruct.php index 7f225f3a8..65bf182c0 100644 --- a/src/Payone/RequestParameter/Struct/ApplePayTransactionStruct.php +++ b/src/Payone/RequestParameter/Struct/ApplePayTransactionStruct.php @@ -14,20 +14,17 @@ class ApplePayTransactionStruct extends AbstractRequestParameterStruct use SalesChannelContextTrait; use RequestDataTrait; - protected ?string $orderId = null; - public function __construct( RequestDataBag $requestData, SalesChannelContext $salesChannelContext, string $paymentMethod, string $action = '', - ?string $orderId = null + protected ?string $orderId = null ) { $this->requestData = $requestData; $this->salesChannelContext = $salesChannelContext; $this->paymentMethod = $paymentMethod; $this->action = $action; - $this->orderId = $orderId; } public function getOrderId(): ?string diff --git a/src/Payone/RequestParameter/Struct/CheckoutDetailsStruct.php b/src/Payone/RequestParameter/Struct/CheckoutDetailsStruct.php index 2434e293a..1277b503f 100644 --- a/src/Payone/RequestParameter/Struct/CheckoutDetailsStruct.php +++ b/src/Payone/RequestParameter/Struct/CheckoutDetailsStruct.php @@ -16,21 +16,18 @@ class CheckoutDetailsStruct extends AbstractRequestParameterStruct use CartTrait; use WorkOrderIdTrait; - protected string $returnUrl; - public function __construct( Cart $cart, SalesChannelContext $salesChannelContext, string $paymentMethod, string $action, - string $returnUrl = '', + protected string $returnUrl = '', string $workorderId = '' ) { $this->cart = $cart; $this->salesChannelContext = $salesChannelContext; $this->paymentMethod = $paymentMethod; $this->action = $action; - $this->returnUrl = $returnUrl; $this->workorderId = $workorderId; } diff --git a/src/Payone/RequestParameter/Struct/GetFileStruct.php b/src/Payone/RequestParameter/Struct/GetFileStruct.php index 4aad97ea3..bfc12cb6e 100644 --- a/src/Payone/RequestParameter/Struct/GetFileStruct.php +++ b/src/Payone/RequestParameter/Struct/GetFileStruct.php @@ -11,16 +11,13 @@ class GetFileStruct extends AbstractRequestParameterStruct { use SalesChannelContextTrait; - protected string $identification; - public function __construct( SalesChannelContext $salesChannelContext, string $paymentMethod, - string $identification + protected string $identification ) { $this->salesChannelContext = $salesChannelContext; $this->paymentMethod = $paymentMethod; - $this->identification = $identification; } public function getIdentification(): string diff --git a/src/Payone/RequestParameter/Struct/KlarnaCreateSessionStruct.php b/src/Payone/RequestParameter/Struct/KlarnaCreateSessionStruct.php index b8d941f8e..e02bed4d6 100644 --- a/src/Payone/RequestParameter/Struct/KlarnaCreateSessionStruct.php +++ b/src/Payone/RequestParameter/Struct/KlarnaCreateSessionStruct.php @@ -13,7 +13,7 @@ class KlarnaCreateSessionStruct extends AbstractRequestParameterStruct { use SalesChannelContextTrait; - private ?OrderEntity $orderEntity; + private readonly ?OrderEntity $orderEntity; public function __construct( SalesChannelContext $salesChannelContext, diff --git a/src/Payone/RequestParameter/Struct/ManageMandateStruct.php b/src/Payone/RequestParameter/Struct/ManageMandateStruct.php index e8beeb732..084fedcc8 100644 --- a/src/Payone/RequestParameter/Struct/ManageMandateStruct.php +++ b/src/Payone/RequestParameter/Struct/ManageMandateStruct.php @@ -11,19 +11,13 @@ class ManageMandateStruct extends AbstractRequestParameterStruct { use SalesChannelContextTrait; - protected string $iban; - - protected string $bic; - public function __construct( SalesChannelContext $salesChannelContext, - string $iban, - string $bic, + protected string $iban, + protected string $bic, string $paymentMethod ) { $this->salesChannelContext = $salesChannelContext; - $this->iban = $iban; - $this->bic = $bic; $this->paymentMethod = $paymentMethod; } diff --git a/src/Payone/RequestParameter/Struct/RatepayCalculationStruct.php b/src/Payone/RequestParameter/Struct/RatepayCalculationStruct.php index ce665022a..05b412042 100644 --- a/src/Payone/RequestParameter/Struct/RatepayCalculationStruct.php +++ b/src/Payone/RequestParameter/Struct/RatepayCalculationStruct.php @@ -18,20 +18,17 @@ class RatepayCalculationStruct extends AbstractRequestParameterStruct use CartTrait; use RequestDataTrait; - protected Profile $profile; - public function __construct( Cart $cart, RequestDataBag $requestData, SalesChannelContext $salesChannelContext, - Profile $profile, + protected Profile $profile, string $paymentMethod, string $action = '' ) { $this->cart = $cart; $this->requestData = $requestData; $this->salesChannelContext = $salesChannelContext; - $this->profile = $profile; $this->paymentMethod = $paymentMethod; $this->action = $action; } diff --git a/src/Payone/RequestParameter/Struct/RatepayProfileStruct.php b/src/Payone/RequestParameter/Struct/RatepayProfileStruct.php index 4c0fc61cf..0301c240e 100644 --- a/src/Payone/RequestParameter/Struct/RatepayProfileStruct.php +++ b/src/Payone/RequestParameter/Struct/RatepayProfileStruct.php @@ -6,22 +6,13 @@ class RatepayProfileStruct extends AbstractRequestParameterStruct { - protected string $shopId; - - protected string $currency; - - protected string $salesChannelId; - public function __construct( - string $shopId, - string $currency, - string $salesChannelId, + protected string $shopId, + protected string $currency, + protected string $salesChannelId, string $paymentMethod, string $action = '' ) { - $this->shopId = $shopId; - $this->currency = $currency; - $this->salesChannelId = $salesChannelId; $this->paymentMethod = $paymentMethod; $this->action = $action; } diff --git a/src/Payone/RequestParameter/Struct/TestCredentialsStruct.php b/src/Payone/RequestParameter/Struct/TestCredentialsStruct.php index 33756ccaf..d1a35fe33 100644 --- a/src/Payone/RequestParameter/Struct/TestCredentialsStruct.php +++ b/src/Payone/RequestParameter/Struct/TestCredentialsStruct.php @@ -6,14 +6,11 @@ class TestCredentialsStruct extends AbstractRequestParameterStruct { - protected array $parameters = []; - public function __construct( - array $parameters, + protected array $parameters, string $action = '', string $paymentMethodClass = '' ) { - $this->parameters = $parameters; $this->action = $action; $this->paymentMethod = $paymentMethodClass; } diff --git a/src/Payone/Webhook/Handler/NotificationForwardHandler.php b/src/Payone/Webhook/Handler/NotificationForwardHandler.php index a5042e82f..0e4b0322e 100644 --- a/src/Payone/Webhook/Handler/NotificationForwardHandler.php +++ b/src/Payone/Webhook/Handler/NotificationForwardHandler.php @@ -18,23 +18,20 @@ class NotificationForwardHandler implements WebhookHandlerInterface { - private EntityRepository $notificationTargetRepository; + private readonly EntityRepository $notificationTargetRepository; - private EntityRepository $notificationForwardRepository; + private readonly EntityRepository $notificationForwardRepository; - private TransactionDataHandlerInterface $transactionDataHandler; - - private MessageBusInterface $messageBus; + private readonly MessageBusInterface $messageBus; public function __construct( EntityRepository $notificationTargetRepository, EntityRepository $notificationForwardRepository, - TransactionDataHandlerInterface $transactionDataHandler, + private readonly TransactionDataHandlerInterface $transactionDataHandler, MessageBusInterface $messageBus ) { $this->notificationTargetRepository = $notificationTargetRepository; $this->notificationForwardRepository = $notificationForwardRepository; - $this->transactionDataHandler = $transactionDataHandler; $this->messageBus = $messageBus; } @@ -83,7 +80,7 @@ private function persistNotificationForwards( foreach ($notificationTargets as $target) { $notificationForwards[] = [ 'id' => Uuid::randomHex(), - 'content' => serialize(mb_convert_encoding($data, 'UTF-8', 'ISO-8859-1')), + 'content' => serialize(mb_convert_encoding((string) $data, 'UTF-8', 'ISO-8859-1')), 'notificationTargetId' => $target->getId(), 'transactionId' => $paymentTransactionId, 'ip' => $request->getClientIp(), @@ -112,7 +109,7 @@ private function getRelevantNotificationTargets(string $txaction, SalesChannelCo $result = $notificationTargets->getEntities(); if (!($result instanceof PayonePaymentNotificationTargetCollection)) { - throw new \LogicException('invalid collection type ' . \get_class($result)); + throw new \LogicException('invalid collection type ' . $result::class); } return $result; diff --git a/src/Payone/Webhook/Handler/TransactionStatusWebhookHandler.php b/src/Payone/Webhook/Handler/TransactionStatusWebhookHandler.php index 7b4b19251..cbeb0f7f4 100644 --- a/src/Payone/Webhook/Handler/TransactionStatusWebhookHandler.php +++ b/src/Payone/Webhook/Handler/TransactionStatusWebhookHandler.php @@ -14,24 +14,8 @@ class TransactionStatusWebhookHandler implements WebhookHandlerInterface { - private TransactionStatusServiceInterface $transactionStatusService; - - private TransactionDataHandlerInterface $transactionDataHandler; - - private LoggerInterface $logger; - - private AutomaticCaptureServiceInterface $automaticCaptureService; - - public function __construct( - TransactionStatusServiceInterface $transactionStatusService, - TransactionDataHandlerInterface $transactionDataHandler, - LoggerInterface $logger, - AutomaticCaptureServiceInterface $automaticCaptureService - ) { - $this->transactionStatusService = $transactionStatusService; - $this->transactionDataHandler = $transactionDataHandler; - $this->logger = $logger; - $this->automaticCaptureService = $automaticCaptureService; + public function __construct(private readonly TransactionStatusServiceInterface $transactionStatusService, private readonly TransactionDataHandlerInterface $transactionDataHandler, private readonly LoggerInterface $logger, private readonly AutomaticCaptureServiceInterface $automaticCaptureService) + { } public function supports(SalesChannelContext $salesChannelContext, array $data): bool @@ -91,7 +75,7 @@ private function utf8EncodeRecursive(array $transactionData): array continue; } - $transactionValue = utf8_encode($transactionValue); + $transactionValue = utf8_encode((string) $transactionValue); } unset($transactionValue); diff --git a/src/Payone/Webhook/MessageBus/Command/NotificationForwardCommand.php b/src/Payone/Webhook/MessageBus/Command/NotificationForwardCommand.php index f94b50ccb..2064fcd6b 100644 --- a/src/Payone/Webhook/MessageBus/Command/NotificationForwardCommand.php +++ b/src/Payone/Webhook/MessageBus/Command/NotificationForwardCommand.php @@ -8,13 +8,10 @@ class NotificationForwardCommand { - private array $notificationTargetIds; - private Context $context; - public function __construct(array $notificationTargetIds, Context $context) + public function __construct(private array $notificationTargetIds, Context $context) { - $this->notificationTargetIds = $notificationTargetIds; $this->context = $context; } diff --git a/src/Payone/Webhook/MessageBus/MessageHandler/NotificationForwardHandler.php b/src/Payone/Webhook/MessageBus/MessageHandler/NotificationForwardHandler.php index 34674d86f..717fb8605 100644 --- a/src/Payone/Webhook/MessageBus/MessageHandler/NotificationForwardHandler.php +++ b/src/Payone/Webhook/MessageBus/MessageHandler/NotificationForwardHandler.php @@ -16,14 +16,11 @@ class NotificationForwardHandler implements MessageSubscriberInterface { - private EntityRepository $notificationForwardRepository; + private readonly EntityRepository $notificationForwardRepository; - private LoggerInterface $logger; - - public function __construct(EntityRepository $notificationForwardRepository, LoggerInterface $logger) + public function __construct(EntityRepository $notificationForwardRepository, private readonly LoggerInterface $logger) { $this->notificationForwardRepository = $notificationForwardRepository; - $this->logger = $logger; } public function __invoke(NotificationForwardCommand $message): void @@ -116,7 +113,7 @@ private function getForwardRequests(\CurlMultiHandle $multiHandle, EntitySearchR $serialize = unserialize($forward->getContent(), []); /** @var array|string|false $content */ - $content = mb_convert_encoding($serialize, 'ISO-8859-1', 'UTF-8'); + $content = mb_convert_encoding((string) $serialize, 'ISO-8859-1', 'UTF-8'); if (!\is_array($content)) { continue; diff --git a/src/Payone/Webhook/Processor/WebhookProcessor.php b/src/Payone/Webhook/Processor/WebhookProcessor.php index 1481b9b8a..961de6da3 100644 --- a/src/Payone/Webhook/Processor/WebhookProcessor.php +++ b/src/Payone/Webhook/Processor/WebhookProcessor.php @@ -14,23 +14,17 @@ class WebhookProcessor implements WebhookProcessorInterface { - private ConfigReaderInterface $configReader; - /** * @var WebhookHandlerInterface[] */ - private array $handlers; - - private LoggerInterface $logger; + private readonly array $handlers; public function __construct( - ConfigReaderInterface $configReader, + private readonly ConfigReaderInterface $configReader, \IteratorAggregate $handlers, - LoggerInterface $logger + private readonly LoggerInterface $logger ) { - $this->configReader = $configReader; $this->handlers = iterator_to_array($handlers); - $this->logger = $logger; } public function process(SalesChannelContext $salesChannelContext, Request $request): Response @@ -60,7 +54,7 @@ public function process(SalesChannelContext $salesChannelContext, Request $reque foreach ($this->handlers as $handler) { if (!$handler->supports($salesChannelContext, $data)) { - $this->logger->debug(sprintf('Skipping webhook handler %s', \get_class($handler)), $data); + $this->logger->debug(sprintf('Skipping webhook handler %s', $handler::class), $data); continue; } @@ -68,9 +62,9 @@ public function process(SalesChannelContext $salesChannelContext, Request $reque try { $handler->process($salesChannelContext, $request); - $this->logger->info(sprintf('Processed webhook handler %s', \get_class($handler)), $data); + $this->logger->info(sprintf('Processed webhook handler %s', $handler::class), $data); } catch (\Exception $exception) { - $this->logger->error(sprintf('Error during processing of webhook handler %s', \get_class($handler)), [ + $this->logger->error(sprintf('Error during processing of webhook handler %s', $handler::class), [ 'message' => $exception->getMessage(), 'file' => $exception->getFile(), 'line' => $exception->getLine(), diff --git a/src/PayonePayment.php b/src/PayonePayment.php index 6c030831d..7ebc8fab3 100644 --- a/src/PayonePayment.php +++ b/src/PayonePayment.php @@ -24,7 +24,7 @@ class PayonePayment extends Plugin { - public const PLUGIN_NAME = 'PayonePayment'; + final public const PLUGIN_NAME = 'PayonePayment'; public function build(ContainerBuilder $container): void { diff --git a/src/ScheduledTask/RedirectCleanUpHandler.php b/src/ScheduledTask/RedirectCleanUpHandler.php index 927d23169..f5ada293d 100644 --- a/src/ScheduledTask/RedirectCleanUpHandler.php +++ b/src/ScheduledTask/RedirectCleanUpHandler.php @@ -11,19 +11,12 @@ class RedirectCleanUpHandler extends ScheduledTaskHandler { - private RedirectHandler $redirectHandler; - - private LoggerInterface $logger; - public function __construct( EntityRepository $scheduledTaskRepository, - RedirectHandler $redirectHandler, - LoggerInterface $logger + private readonly RedirectHandler $redirectHandler, + private readonly LoggerInterface $logger ) { parent::__construct($scheduledTaskRepository); - - $this->redirectHandler = $redirectHandler; - $this->logger = $logger; } public static function getHandledMessages(): iterable diff --git a/src/StoreApi/Route/ApplePayRoute.php b/src/StoreApi/Route/ApplePayRoute.php index 24d44036e..cd4e48f1a 100644 --- a/src/StoreApi/Route/ApplePayRoute.php +++ b/src/StoreApi/Route/ApplePayRoute.php @@ -22,34 +22,19 @@ class ApplePayRoute extends AbstractApplePayRoute { - public const CERT_FOLDER = '/config/apple-pay-cert/'; + final public const CERT_FOLDER = '/config/apple-pay-cert/'; - private Client $httpClient; - - private LoggerInterface $logger; - - private RequestParameterFactory $requestParameterFactory; - - private PayoneClientInterface $client; - - private ConfigReaderInterface $configReader; - - private string $kernelDirectory; + private readonly Client $httpClient; public function __construct( Client $httpClient, - LoggerInterface $logger, - RequestParameterFactory $requestParameterFactory, - PayoneClientInterface $client, - ConfigReaderInterface $configReader, - string $kernelDirectory + private readonly LoggerInterface $logger, + private readonly RequestParameterFactory $requestParameterFactory, + private readonly PayoneClientInterface $client, + private readonly ConfigReaderInterface $configReader, + private readonly string $kernelDirectory ) { $this->httpClient = $httpClient; - $this->logger = $logger; - $this->requestParameterFactory = $requestParameterFactory; - $this->client = $client; - $this->configReader = $configReader; - $this->kernelDirectory = $kernelDirectory; } public function getDecorated(): AbstractApplePayRoute @@ -106,7 +91,7 @@ public function validateMerchant(Request $request, SalesChannelContext $context) } return new JsonResponse( - json_decode($response->getBody()->getContents(), true), + json_decode((string) $response->getBody()->getContents(), true, 512, JSON_THROW_ON_ERROR), $statusCode, $response->getHeaders() ); @@ -135,7 +120,7 @@ public function process(Request $request, SalesChannelContext $context): Respons try { $response = $this->client->request($payoneRequest); - } catch (\Throwable $exception) { + } catch (\Throwable) { return new JsonResponse([], 402); } diff --git a/src/StoreApi/Route/CardRoute.php b/src/StoreApi/Route/CardRoute.php index 20fa38107..0655ce9d8 100644 --- a/src/StoreApi/Route/CardRoute.php +++ b/src/StoreApi/Route/CardRoute.php @@ -17,11 +17,8 @@ class CardRoute extends AbstractCardRoute { - private CardRepositoryInterface $cardRepository; - - public function __construct(CardRepositoryInterface $cardRepository) + public function __construct(private readonly CardRepositoryInterface $cardRepository) { - $this->cardRepository = $cardRepository; } public function getDecorated(): AbstractCardRoute diff --git a/src/StoreApi/Route/MandateRoute.php b/src/StoreApi/Route/MandateRoute.php index 8cb57d679..931dcfeee 100644 --- a/src/StoreApi/Route/MandateRoute.php +++ b/src/StoreApi/Route/MandateRoute.php @@ -17,11 +17,8 @@ class MandateRoute extends AbstractMandateRoute { - private MandateServiceInterface $mandateService; - - public function __construct(MandateServiceInterface $mandateService) + public function __construct(private readonly MandateServiceInterface $mandateService) { - $this->mandateService = $mandateService; } public function getDecorated(): AbstractMandateRoute @@ -58,7 +55,7 @@ public function getFile(string $mandateId, SalesChannelContext $context): Respon try { $content = $this->mandateService->downloadMandate($context->getCustomer(), $mandateId, $context); - } catch (FileNotFoundException $e) { + } catch (FileNotFoundException) { return new Response(null, 404); } diff --git a/src/Storefront/Controller/Account/AccountCardController.php b/src/Storefront/Controller/Account/AccountCardController.php index 0e71edc73..a294b1024 100644 --- a/src/Storefront/Controller/Account/AccountCardController.php +++ b/src/Storefront/Controller/Account/AccountCardController.php @@ -15,14 +15,8 @@ class AccountCardController extends StorefrontController { - private AccountCardPageLoader $accountCardPageLoader; - - private AbstractCardRoute $cardRoute; - - public function __construct(AccountCardPageLoader $accountCardPageLoader, AbstractCardRoute $cardRoute) + public function __construct(private readonly AccountCardPageLoader $accountCardPageLoader, private readonly AbstractCardRoute $cardRoute) { - $this->accountCardPageLoader = $accountCardPageLoader; - $this->cardRoute = $cardRoute; } /** @@ -42,7 +36,7 @@ public function deleteCard(Request $request, SalesChannelContext $context): Resp { try { $this->cardRoute->delete($request->get('pseudoCardPan'), $context); - } catch (\Throwable $exception) { + } catch (\Throwable) { $this->addFlash('danger', $this->trans('PayonePayment.cardPage.error')); return $this->forwardToRoute('frontend.account.payone.card.page'); diff --git a/src/Storefront/Controller/Account/AccountMandateController.php b/src/Storefront/Controller/Account/AccountMandateController.php index 430f67919..e56b3a2a3 100644 --- a/src/Storefront/Controller/Account/AccountMandateController.php +++ b/src/Storefront/Controller/Account/AccountMandateController.php @@ -14,14 +14,8 @@ class AccountMandateController extends StorefrontController { - private AccountMandatePageLoader $accountMandatePageLoader; - - private AbstractMandateRoute $mandateRoute; - - public function __construct(AccountMandatePageLoader $accountMandatePageLoader, AbstractMandateRoute $mandateRoute) + public function __construct(private readonly AccountMandatePageLoader $accountMandatePageLoader, private readonly AbstractMandateRoute $mandateRoute) { - $this->accountMandatePageLoader = $accountMandatePageLoader; - $this->mandateRoute = $mandateRoute; } /** @@ -41,7 +35,7 @@ public function downloadMandate(Request $request, SalesChannelContext $context): { try { $response = $this->mandateRoute->getFile($request->get('mandate'), $context); - } catch (\Throwable $exception) { + } catch (\Throwable) { $this->addFlash('danger', $this->trans('PayonePayment.mandatePage.error')); return $this->forwardToRoute('frontend.account.payone.mandate.page'); diff --git a/src/Storefront/Controller/Debit/ManageMandateController.php b/src/Storefront/Controller/Debit/ManageMandateController.php index 76dcc2553..4e87ca59a 100644 --- a/src/Storefront/Controller/Debit/ManageMandateController.php +++ b/src/Storefront/Controller/Debit/ManageMandateController.php @@ -17,16 +17,8 @@ class ManageMandateController extends StorefrontController { - private RequestParameterFactory $requestFactory; - - private PayoneClientInterface $client; - - public function __construct( - RequestParameterFactory $mandateRequestFactory, - PayoneClientInterface $client - ) { - $this->requestFactory = $mandateRequestFactory; - $this->client = $client; + public function __construct(private readonly RequestParameterFactory $requestFactory, private readonly PayoneClientInterface $client) + { } /** @@ -47,7 +39,7 @@ public function mandateOverview(Request $request, SalesChannelContext $context): $response = $this->client->request($payoneRequest); if (!empty($response['mandate']['HtmlText'])) { - $response['mandate']['HtmlText'] = urldecode($response['mandate']['HtmlText']); + $response['mandate']['HtmlText'] = urldecode((string) $response['mandate']['HtmlText']); $content = $this->renderView('@PayonePayment/storefront/payone/mandate/mandate.html.twig', $response); @@ -57,7 +49,7 @@ public function mandateOverview(Request $request, SalesChannelContext $context): $response = [ 'error' => $exception->getResponse()['error']['CustomerMessage'], ]; - } catch (\Throwable $exception) { + } catch (\Throwable) { $response = [ 'error' => $this->trans('PayonePayment.errorMessages.genericError'), ]; diff --git a/src/Storefront/Controller/Payolution/PayolutionController.php b/src/Storefront/Controller/Payolution/PayolutionController.php index 4d1fc75f1..205a71dd3 100644 --- a/src/Storefront/Controller/Payolution/PayolutionController.php +++ b/src/Storefront/Controller/Payolution/PayolutionController.php @@ -35,32 +35,17 @@ class PayolutionController extends StorefrontController { private const URL = 'https://payment.payolution.com/payolution-payment/infoport/dataprivacydeclaration?mId='; - private ConfigReaderInterface $configReader; - - private CartService $cartService; - - private CartHasherInterface $cartHasher; - - private PayoneClientInterface $client; - - private RequestParameterFactory $requestParameterFactory; - - private LoggerInterface $logger; + private readonly CartService $cartService; public function __construct( - ConfigReaderInterface $configReader, + private readonly ConfigReaderInterface $configReader, CartService $cartService, - CartHasherInterface $cartHasher, - PayoneClientInterface $client, - RequestParameterFactory $requestParameterFactory, - LoggerInterface $logger + private readonly CartHasherInterface $cartHasher, + private readonly PayoneClientInterface $client, + private readonly RequestParameterFactory $requestParameterFactory, + private readonly LoggerInterface $logger ) { - $this->configReader = $configReader; $this->cartService = $cartService; - $this->cartHasher = $cartHasher; - $this->client = $client; - $this->requestParameterFactory = $requestParameterFactory; - $this->logger = $logger; } /** @@ -252,16 +237,12 @@ protected function getCompanyName(SalesChannelContext $salesChannelContext): ?st { $configuration = $this->configReader->read($salesChannelContext->getSalesChannel()->getId()); - switch ($salesChannelContext->getPaymentMethod()->getId()) { - case PayonePayolutionInvoicing::UUID: - return $configuration->getString('payolutionInvoicingCompanyName'); - case PayonePayolutionInstallment::UUID: - return $configuration->getString('payolutionInstallmentCompanyName'); - case PayonePayolutionDebit::UUID: - return $configuration->getString('payolutionDebitCompanyName'); - default: - return null; - } + return match ($salesChannelContext->getPaymentMethod()->getId()) { + PayonePayolutionInvoicing::UUID => $configuration->getString('payolutionInvoicingCompanyName'), + PayonePayolutionInstallment::UUID => $configuration->getString('payolutionInstallmentCompanyName'), + PayonePayolutionDebit::UUID => $configuration->getString('payolutionDebitCompanyName'), + default => null, + }; } private function getCreditInformationUrlFromCart(Cart $cart, int $duration): ?string @@ -289,7 +270,7 @@ private function prepareCalculationOutput(array $response): array $data = []; foreach ($response['addpaydata'] as $key => $value) { - $key = str_replace('PaymentDetails_', '', $key); + $key = str_replace('PaymentDetails_', '', (string) $key); $keys = explode('_', $key); if (\count($keys) === 4) { diff --git a/src/Storefront/Controller/Paypal/PaypalExpressController.php b/src/Storefront/Controller/Paypal/PaypalExpressController.php index beb76a5eb..adad3cf38 100644 --- a/src/Storefront/Controller/Paypal/PaypalExpressController.php +++ b/src/Storefront/Controller/Paypal/PaypalExpressController.php @@ -39,30 +39,24 @@ class PaypalExpressController extends StorefrontController { - private PayoneClientInterface $client; + private readonly CartService $cartService; - private CartService $cartService; + private readonly AbstractRegisterRoute $registerRoute; - private AbstractRegisterRoute $registerRoute; + private readonly AccountService $accountService; - private AccountService $accountService; + private readonly AbstractSalesChannelContextFactory $salesChannelContextFactory; - private AbstractSalesChannelContextFactory $salesChannelContextFactory; + private readonly EntityRepository $salutationRepository; - private EntityRepository $salutationRepository; + private readonly EntityRepository $countryRepository; - private EntityRepository $countryRepository; + private readonly SalesChannelContextSwitcher $salesChannelContextSwitcher; - private SalesChannelContextSwitcher $salesChannelContextSwitcher; - - private CartHasherInterface $cartHasher; - - private RouterInterface $router; - - private RequestParameterFactory $requestParameterFactory; + private readonly RouterInterface $router; public function __construct( - PayoneClientInterface $client, + private readonly PayoneClientInterface $client, CartService $cartService, AbstractRegisterRoute $registerRoute, AccountService $accountService, @@ -70,11 +64,10 @@ public function __construct( EntityRepository $salutationRepository, EntityRepository $countryRepository, SalesChannelContextSwitcher $salesChannelContextSwitcher, - CartHasherInterface $cartHasher, + private readonly CartHasherInterface $cartHasher, RouterInterface $router, - RequestParameterFactory $requestParameterFactory + private readonly RequestParameterFactory $requestParameterFactory ) { - $this->client = $client; $this->cartService = $cartService; $this->registerRoute = $registerRoute; $this->accountService = $accountService; @@ -82,9 +75,7 @@ public function __construct( $this->salutationRepository = $salutationRepository; $this->countryRepository = $countryRepository; $this->salesChannelContextSwitcher = $salesChannelContextSwitcher; - $this->cartHasher = $cartHasher; $this->router = $router; - $this->requestParameterFactory = $requestParameterFactory; } /** @@ -118,7 +109,7 @@ public function express(SalesChannelContext $context): Response try { $response = $this->client->request($setRequest); - } catch (PayoneRequestException $exception) { + } catch (PayoneRequestException) { throw new \RuntimeException($this->trans('PayonePayment.errorMessages.genericError')); } @@ -134,7 +125,7 @@ public function redirectHandler(SalesChannelContext $context, Request $request): { try { $this->handleStateResponse($request->get('state')); - } catch (\Throwable $exception) { + } catch (\Throwable) { return $this->redirectToRoute('frontend.checkout.cart.page'); } @@ -160,7 +151,7 @@ public function redirectHandler(SalesChannelContext $context, Request $request): try { $response = $this->client->request($getRequest); - } catch (PayoneRequestException $exception) { + } catch (PayoneRequestException) { throw new \RuntimeException($this->trans('PayonePayment.errorMessages.genericError')); } diff --git a/src/Storefront/Controller/Ratepay/RatepayController.php b/src/Storefront/Controller/Ratepay/RatepayController.php index 82689de53..561ca1d43 100644 --- a/src/Storefront/Controller/Ratepay/RatepayController.php +++ b/src/Storefront/Controller/Ratepay/RatepayController.php @@ -13,11 +13,8 @@ class RatepayController extends StorefrontController { - private InstallmentServiceInterface $installmentService; - - public function __construct(InstallmentServiceInterface $installmentService) + public function __construct(private readonly InstallmentServiceInterface $installmentService) { - $this->installmentService = $installmentService; } /** @@ -27,7 +24,7 @@ public function calculation(RequestDataBag $dataBag, SalesChannelContext $contex { try { $installmentPlan = $this->installmentService->getInstallmentCalculatorData($context, $dataBag); - } catch (\Throwable $exception) { + } catch (\Throwable) { throw new \RuntimeException($this->trans('PayonePayment.errorMessages.genericError')); } diff --git a/src/Storefront/Page/Card/AccountCardPageLoadedEvent.php b/src/Storefront/Page/Card/AccountCardPageLoadedEvent.php index 0e063810a..afe76e3f8 100644 --- a/src/Storefront/Page/Card/AccountCardPageLoadedEvent.php +++ b/src/Storefront/Page/Card/AccountCardPageLoadedEvent.php @@ -11,20 +11,17 @@ class AccountCardPageLoadedEvent extends NestedEvent { - public const NAME = 'account-payone-card.page.loaded'; - - protected AccountCardPage $page; + final public const NAME = 'account-payone-card.page.loaded'; protected SalesChannelContext $context; protected Request $request; public function __construct( - AccountCardPage $page, + protected AccountCardPage $page, SalesChannelContext $context, Request $request ) { - $this->page = $page; $this->context = $context; $this->request = $request; } diff --git a/src/Storefront/Page/Card/AccountCardPageLoader.php b/src/Storefront/Page/Card/AccountCardPageLoader.php index 548b4a104..b8126b6b3 100644 --- a/src/Storefront/Page/Card/AccountCardPageLoader.php +++ b/src/Storefront/Page/Card/AccountCardPageLoader.php @@ -13,20 +13,14 @@ class AccountCardPageLoader { - private GenericPageLoader $genericLoader; - - private EventDispatcherInterface $eventDispatcher; - - private AbstractCardRoute $cardRoute; + private readonly GenericPageLoader $genericLoader; public function __construct( GenericPageLoader $genericLoader, - EventDispatcherInterface $eventDispatcher, - AbstractCardRoute $cardRoute + private readonly EventDispatcherInterface $eventDispatcher, + private readonly AbstractCardRoute $cardRoute ) { $this->genericLoader = $genericLoader; - $this->eventDispatcher = $eventDispatcher; - $this->cardRoute = $cardRoute; } public function load(Request $request, SalesChannelContext $context): AccountCardPage diff --git a/src/Storefront/Page/Mandate/AccountMandatePageLoadedEvent.php b/src/Storefront/Page/Mandate/AccountMandatePageLoadedEvent.php index c380aa811..5417065c3 100644 --- a/src/Storefront/Page/Mandate/AccountMandatePageLoadedEvent.php +++ b/src/Storefront/Page/Mandate/AccountMandatePageLoadedEvent.php @@ -11,20 +11,17 @@ class AccountMandatePageLoadedEvent extends NestedEvent { - public const NAME = 'account-payone-mandate.page.loaded'; - - protected AccountMandatePage $page; + final public const NAME = 'account-payone-mandate.page.loaded'; protected SalesChannelContext $context; protected Request $request; public function __construct( - AccountMandatePage $page, + protected AccountMandatePage $page, SalesChannelContext $context, Request $request ) { - $this->page = $page; $this->context = $context; $this->request = $request; } diff --git a/src/Storefront/Page/Mandate/AccountMandatePageLoader.php b/src/Storefront/Page/Mandate/AccountMandatePageLoader.php index 29dc824cf..f15af660e 100644 --- a/src/Storefront/Page/Mandate/AccountMandatePageLoader.php +++ b/src/Storefront/Page/Mandate/AccountMandatePageLoader.php @@ -13,20 +13,14 @@ class AccountMandatePageLoader { - private GenericPageLoader $genericLoader; - - private EventDispatcherInterface $eventDispatcher; - - private AbstractMandateRoute $mandateRoute; + private readonly GenericPageLoader $genericLoader; public function __construct( GenericPageLoader $genericLoader, - EventDispatcherInterface $eventDispatcher, - AbstractMandateRoute $mandateRoute + private readonly EventDispatcherInterface $eventDispatcher, + private readonly AbstractMandateRoute $mandateRoute ) { $this->genericLoader = $genericLoader; - $this->eventDispatcher = $eventDispatcher; - $this->mandateRoute = $mandateRoute; } public function load(Request $request, SalesChannelContext $context): AccountMandatePage diff --git a/src/Storefront/Struct/CheckoutCartPaymentData.php b/src/Storefront/Struct/CheckoutCartPaymentData.php index ce3d72b22..6642126c8 100644 --- a/src/Storefront/Struct/CheckoutCartPaymentData.php +++ b/src/Storefront/Struct/CheckoutCartPaymentData.php @@ -8,11 +8,11 @@ class CheckoutCartPaymentData extends Struct { - public const EXTENSION_NAME = 'payone'; + final public const EXTENSION_NAME = 'payone'; - public const DATA_WORK_ORDER_ID = 'workOrderId'; - public const DATA_CART_HASH = 'cartHash'; - public const DATA_CALCULATION_RESPONSE = 'calculationResponse'; + final public const DATA_WORK_ORDER_ID = 'workOrderId'; + final public const DATA_CART_HASH = 'cartHash'; + final public const DATA_CALCULATION_RESPONSE = 'calculationResponse'; protected string $workOrderId = ''; diff --git a/src/Storefront/Struct/CheckoutConfirmPaymentData.php b/src/Storefront/Struct/CheckoutConfirmPaymentData.php index 118489576..a57de67bb 100644 --- a/src/Storefront/Struct/CheckoutConfirmPaymentData.php +++ b/src/Storefront/Struct/CheckoutConfirmPaymentData.php @@ -9,7 +9,7 @@ class CheckoutConfirmPaymentData extends Struct { - public const EXTENSION_NAME = 'payone'; + final public const EXTENSION_NAME = 'payone'; protected array $cardRequest = []; diff --git a/src/Storefront/Struct/CheckoutFinishPaymentData.php b/src/Storefront/Struct/CheckoutFinishPaymentData.php index 7586b5097..f0aa1f09e 100644 --- a/src/Storefront/Struct/CheckoutFinishPaymentData.php +++ b/src/Storefront/Struct/CheckoutFinishPaymentData.php @@ -9,7 +9,7 @@ class CheckoutFinishPaymentData extends Struct { - public const EXTENSION_NAME = 'payone'; + final public const EXTENSION_NAME = 'payone'; protected ?PayonePaymentMandateEntity $mandate = null; diff --git a/src/Storefront/Struct/CheckoutKlarnaSessionData.php b/src/Storefront/Struct/CheckoutKlarnaSessionData.php index 509cf6096..313be95fd 100644 --- a/src/Storefront/Struct/CheckoutKlarnaSessionData.php +++ b/src/Storefront/Struct/CheckoutKlarnaSessionData.php @@ -6,19 +6,13 @@ class CheckoutKlarnaSessionData extends CheckoutCartPaymentData { - private string $clientToken; - - private string $paymentMethodIdentifier; - public function __construct( - string $clientToken, + private readonly string $clientToken, string $workOrderId, - string $paymentMethodIdentifier, + private readonly string $paymentMethodIdentifier, string $cartHash ) { - $this->clientToken = $clientToken; $this->workOrderId = $workOrderId; - $this->paymentMethodIdentifier = $paymentMethodIdentifier; $this->cartHash = $cartHash; } diff --git a/src/Storefront/Struct/DeviceFingerprintData.php b/src/Storefront/Struct/DeviceFingerprintData.php index 894dc9565..8114d0de1 100644 --- a/src/Storefront/Struct/DeviceFingerprintData.php +++ b/src/Storefront/Struct/DeviceFingerprintData.php @@ -8,7 +8,7 @@ class DeviceFingerprintData extends Struct { - public const EXTENSION_NAME = 'payoneDeviceFingerprint'; + final public const EXTENSION_NAME = 'payoneDeviceFingerprint'; protected string $snippet; diff --git a/src/Storefront/Struct/RatepayInstallmentCalculatorData.php b/src/Storefront/Struct/RatepayInstallmentCalculatorData.php index 37b2be909..bc14d7093 100644 --- a/src/Storefront/Struct/RatepayInstallmentCalculatorData.php +++ b/src/Storefront/Struct/RatepayInstallmentCalculatorData.php @@ -8,7 +8,7 @@ class RatepayInstallmentCalculatorData extends Struct { - public const EXTENSION_NAME = 'payoneRatepayInstallmentCalculator'; + final public const EXTENSION_NAME = 'payoneRatepayInstallmentCalculator'; protected float $minimumRate; diff --git a/src/Storefront/Struct/SecuredInstallmentOptionsData.php b/src/Storefront/Struct/SecuredInstallmentOptionsData.php index 1b8778c3f..2fa05cab5 100644 --- a/src/Storefront/Struct/SecuredInstallmentOptionsData.php +++ b/src/Storefront/Struct/SecuredInstallmentOptionsData.php @@ -8,7 +8,7 @@ class SecuredInstallmentOptionsData extends Struct { - public const EXTENSION_NAME = 'payoneSecuredInstallmentOptions'; + final public const EXTENSION_NAME = 'payoneSecuredInstallmentOptions'; /** * @var array diff --git a/src/Struct/Configuration.php b/src/Struct/Configuration.php index edced9918..62d26a61a 100644 --- a/src/Struct/Configuration.php +++ b/src/Struct/Configuration.php @@ -8,29 +8,16 @@ class Configuration extends Struct { - protected array $configuration = []; - - public function __construct(array $configuration) + public function __construct(protected array $configuration) { - $this->configuration = $configuration; } - /** - * @param array|bool|int|string|null $default - * - * @return array|bool|int|string|null - */ - public function getByPrefix(string $key, string $prefix = '', $default = '') + public function getByPrefix(string $key, string $prefix = '', array|bool|int|string|null $default = ''): array|bool|int|string|null { return $this->get(sprintf('%s%s', $prefix, ucfirst($key)), $default); } - /** - * @param array|bool|int|string|null $default - * - * @return array|bool|int|string|null - */ - public function get(string $key, $default = '') + public function get(string $key, array|bool|int|string|null $default = ''): array|bool|int|string|null { if (!\array_key_exists($key, $this->configuration)) { return $default; From 2576ac1f5a98b1e26c19a1217efe6c4dc426979f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20M=C3=BCller?= Date: Mon, 8 May 2023 09:37:35 +0200 Subject: [PATCH 07/41] [PAYONE-184] Add refactoring of payment handler and more improvements --- __COMPOSER_HOME__/.htaccess | 1 + .../AutomaticCaptureService.php | 9 +- .../CardRepository/CardRepository.php | 2 +- src/Components/CartHasher/CartHasher.php | 50 +- .../CartHasher/CartHasherInterface.php | 19 +- .../CartValidator/ZeroAmountCartValidator.php | 2 +- src/Components/Currency/CurrencyPrecision.php | 28 +- .../Transaction/TransactionDataHandler.php | 11 +- .../AbstractDeviceFingerprintService.php | 19 +- .../PayoneBNPLDeviceFingerprintService.php | 2 +- .../RatepayDeviceFingerprintService.php | 4 +- .../LineItemHydrator/LineItemHydrator.php | 33 +- .../KlarnaSessionService.php | 10 +- .../KlarnaSessionServiceInterface.php | 4 - .../MandateService/MandateService.php | 7 +- .../DefaultPaymentFilterService.php | 22 +- .../FilteredPaymentMethodRoute.php | 15 +- .../PaymentFilter/PaymentFilterContext.php | 38 +- .../PaymentFilterContextFactory.php | 4 +- .../PayonePaymentMethodValidator.php | 6 +- .../RedirectHandler/RedirectHandler.php | 8 +- .../AbstractTransactionHandler.php | 2 +- .../Capture/CaptureTransactionHandler.php | 5 +- .../Refund/RefundTransactionHandler.php | 5 +- .../Validator/PaymentMethodValidator.php | 1 - src/Controller/CaptureController.php | 6 +- src/Controller/RedirectController.php | 5 +- src/Controller/RefundController.php | 6 +- src/Controller/SettingsController.php | 42 +- src/Controller/WebhookController.php | 19 +- ...ePaymentOrderTransactionDataCollection.php | 8 +- .../Card/PayonePaymentCardCollection.php | 8 +- .../PayonePaymentMandateCollection.php | 8 +- ...nePaymentNotificationForwardCollection.php | 8 +- ...onePaymentNotificationTargetCollection.php | 8 +- src/DependencyInjection/controllers.xml | 21 + .../handler/payment_handler.xml | 426 ++++++------------ .../CheckoutConfirmApplePayEventListener.php | 8 +- .../CheckoutConfirmCartDataEventListener.php | 26 +- ...CheckoutConfirmCreditCardEventListener.php | 13 +- .../CheckoutConfirmDebitEventListener.php | 3 +- .../CheckoutConfirmEpsEventListener.php | 10 +- .../CheckoutConfirmIDealEventListener.php | 10 +- ...ckoutConfirmKlarnaPaymentEventListener.php | 16 +- .../CheckoutConfirmPaydirektEventListener.php | 8 +- ...CheckoutConfirmPayolutionEventListener.php | 17 +- ...ckoutConfirmPaypalExpressEventListener.php | 9 +- .../CheckoutConfirmRatepayEventListener.php | 51 +-- ...ConfirmSecuredInstallmentEventListener.php | 12 +- .../CheckoutConfirmTemplateEventListener.php | 3 +- .../CheckoutConfirmTrustlyEventListener.php | 10 +- .../CheckoutFinishEventListener.php | 10 +- .../DeviceFingerprintEventListener.php | 5 +- src/EventListener/KernelEventListener.php | 2 +- .../OrderValidationEventListener.php | 12 +- ...lExpressAddressValidationEventListener.php | 14 +- src/EventListener/RemovesPaymentMethod.php | 2 +- .../StorefrontRenderEventListener.php | 10 +- src/Installer/ConfigInstaller.php | 27 +- src/Installer/CustomFieldInstaller.php | 13 +- src/Installer/PaymentMethodInstaller.php | 37 +- .../RuleInstallerSecureInvoice.php | 45 +- ...ion1557926559AddTemporaryRedirectTable.php | 13 +- ...ion1561379069AddPayonePaymentCardTable.php | 13 +- ...1562097986AddPayonePaymentMandateTable.php | 13 +- ...n1580996279AddRedirectTableCreatedDate.php | 13 +- ...n1625137302AddNotificationForwardTable.php | 13 +- ...on1625137302AddNotificationTargetTable.php | 13 +- ...tion1637576753FixForeignKeyConstraints.php | 18 +- ...1638289341AddOrderTransActionDataTable.php | 8 +- ...teOrderTransactionDataFromCustomFields.php | 16 +- ...ration1666770470AddCardTypeToCardTable.php | 13 +- ...stractAsynchronousPayonePaymentHandler.php | 154 +++++++ .../AbstractKlarnaPaymentHandler.php | 112 ++--- .../AbstractPayoneInvoicePaymentHandler.php | 96 +--- .../AbstractPayonePaymentHandler.php | 50 +- .../AbstractPostfinancePaymentHandler.php | 109 +---- ...bstractSynchronousPayonePaymentHandler.php | 135 ++++++ .../PayoneAlipayPaymentHandler.php | 124 +---- .../PayoneApplePayPaymentHandler.php | 58 +-- .../PayoneBancontactPaymentHandler.php | 124 +---- .../PayoneCreditCardPaymentHandler.php | 150 +++--- .../PayoneDebitPaymentHandler.php | 140 +++--- .../PayoneEpsPaymentHandler.php | 118 +---- .../PayoneIDealPaymentHandler.php | 118 +---- .../PayoneKlarnaDirectDebitPaymentHandler.php | 4 +- .../PayoneKlarnaInstallmentPaymentHandler.php | 4 +- .../PayoneOpenInvoicePaymentHandler.php | 22 - .../PayonePaydirektPaymentHandler.php | 107 +---- .../PayonePayolutionDebitPaymentHandler.php | 121 +---- ...onePayolutionInstallmentPaymentHandler.php | 115 ++--- ...ayonePayolutionInvoicingPaymentHandler.php | 111 +---- .../PayonePaypalExpressPaymentHandler.php | 128 ++---- .../PayonePaypalPaymentHandler.php | 123 ++--- .../PayonePrepaymentPaymentHandler.php | 116 +---- .../PayonePrzelewy24PaymentHandler.php | 122 +---- .../PayoneRatepayDebitPaymentHandler.php | 128 +----- ...PayoneRatepayInstallmentPaymentHandler.php | 128 +----- .../PayoneRatepayInvoicingPaymentHandler.php | 128 +----- .../PayoneSecureInvoicePaymentHandler.php | 22 - ...PayoneSecuredDirectDebitPaymentHandler.php | 115 +---- ...PayoneSecuredInstallmentPaymentHandler.php | 114 +---- .../PayoneSecuredInvoicePaymentHandler.php | 127 +----- .../PayoneSofortBankingPaymentHandler.php | 109 +---- .../PayoneTrustlyPaymentHandler.php | 112 +---- .../PayoneWeChatPayPaymentHandler.php | 124 +---- .../Exception/PayoneRequestException.php | 7 +- .../AuthorizeRequestParameterBuilder.php | 15 +- ...omerInformationRequestParameterBuilder.php | 5 +- .../CustomerRequestParameterBuilder.php | 20 +- ...eralTransactionRequestParameterBuilder.php | 7 +- .../CreateSessionRequestParameterBuilder.php | 5 +- .../Klarna/FinancingTypeParameterBuilder.php | 22 +- .../AuthorizeRequestParameterBuilder.php | 9 +- .../OrderLinesRequestParameterBuilder.php | 2 +- .../AuthorizeRequestParameterBuilder.php | 10 +- .../PreCheckRequestParameterBuilder.php | 9 +- .../AuthorizeRequestParameterBuilder.php | 17 +- .../AuthorizeRequestParameterBuilder.php | 5 +- .../AuthorizeRequestParameterBuilder.php | 9 +- .../AuthorizeRequestParameterBuilder.php | 5 +- .../AuthorizeRequestParameterBuilder.php | 5 +- .../AuthorizeRequestParameterBuilder.php | 5 +- ...pingInformationRequestParameterBuilder.php | 4 +- .../Builder/SystemRequestParameterBuilder.php | 5 +- .../RequestParameterFactory.php | 4 +- .../Handler/NotificationForwardHandler.php | 27 +- .../TransactionStatusWebhookHandler.php | 11 +- .../NotificationForwardHandler.php | 9 +- src/PayonePayment.php | 83 ++-- .../filter/payone_currency.filter.js | 5 +- .../src/module/payone-payment/index.js | 3 +- .../payone-payment-management/index.js | 2 +- .../payone-payment-management.html.twig | 2 +- .../view/sw-order-detail-payone/index.js | 6 + .../sw-order-detail-payone.html.twig | 3 +- .../administration/js/payone-payment.js | 2 +- src/StoreApi/Route/AbstractMandateRoute.php | 2 +- src/StoreApi/Route/ApplePayRoute.php | 16 +- src/StoreApi/Route/CardRoute.php | 9 +- src/StoreApi/Route/MandateRoute.php | 12 +- .../Account/AccountCardController.php | 15 +- .../Account/AccountMandateController.php | 15 +- .../AccountOrderControllerDecorator.php | 4 +- .../Debit/ManageMandateController.php | 11 +- .../Payolution/PayolutionController.php | 24 +- .../Paypal/PaypalExpressController.php | 55 +-- .../Controller/Ratepay/RatepayController.php | 5 +- .../Page/Card/AccountCardPageLoadedEvent.php | 10 +- .../Page/Card/AccountCardPageLoader.php | 5 +- .../Mandate/AccountMandatePageLoadedEvent.php | 10 +- .../Page/Mandate/AccountMandatePageLoader.php | 5 +- .../AbstractKlarnaPaymentHandlerTest.php | 6 +- .../AbstractPaymentHandlerTest.php | 9 +- .../AbstractPostfinancePaymentHandlerTest.php | 2 +- .../PayoneAlipayPaymentHandlerTest.php | 2 +- .../PayoneCreditCardPaymentHandlerTest.php | 16 +- .../PayonePaypalPaymentHandlerTest.php | 4 +- .../PayonePrzelewy24PaymentHandlerTest.php | 2 +- .../PayoneRatepayDebitPaymentHandlerTest.php | 4 +- ...neRatepayInstallmentPaymentHandlerTest.php | 4 +- ...yoneRatepayInvoicingPaymentHandlerTest.php | 4 +- ...neSecuredDirectDebitPaymentHandlerTest.php | 4 +- ...neSecuredInstallmentPaymentHandlerTest.php | 4 +- ...PayoneSecuredInvoicePaymentHandlerTest.php | 4 +- .../PayoneWeChatPayPaymentHandlerTest.php | 2 +- .../PaymentHandler/PaymentHandlerMock.php | 6 + 167 files changed, 1523 insertions(+), 4017 deletions(-) create mode 100644 __COMPOSER_HOME__/.htaccess create mode 100644 src/PaymentHandler/AbstractAsynchronousPayonePaymentHandler.php create mode 100644 src/PaymentHandler/AbstractSynchronousPayonePaymentHandler.php diff --git a/__COMPOSER_HOME__/.htaccess b/__COMPOSER_HOME__/.htaccess new file mode 100644 index 000000000..14249c50b --- /dev/null +++ b/__COMPOSER_HOME__/.htaccess @@ -0,0 +1 @@ +Deny from all \ No newline at end of file diff --git a/src/Components/AutomaticCaptureService/AutomaticCaptureService.php b/src/Components/AutomaticCaptureService/AutomaticCaptureService.php index 75ff102d9..c98d2b8a1 100644 --- a/src/Components/AutomaticCaptureService/AutomaticCaptureService.php +++ b/src/Components/AutomaticCaptureService/AutomaticCaptureService.php @@ -17,8 +17,11 @@ class AutomaticCaptureService implements AutomaticCaptureServiceInterface { - public function __construct(protected ConfigReaderInterface $configReader, protected CaptureTransactionHandlerInterface $captureTransactionHandler, protected LoggerInterface $logger) - { + public function __construct( + protected ConfigReaderInterface $configReader, + protected CaptureTransactionHandlerInterface $captureTransactionHandler, + protected LoggerInterface $logger + ) { } public function captureIfPossible(PaymentTransaction $paymentTransaction, SalesChannelContext $salesChannelContext): void @@ -74,7 +77,7 @@ public function captureIfPossible(PaymentTransaction $paymentTransaction, SalesC 'amount' => $order->getAmountTotal(), 'complete' => true, 'includeShippingCosts' => true, - 'orderLines' => $orderLines->map(static fn(OrderLineItemEntity $lineItem) => [ + 'orderLines' => $orderLines->map(static fn (OrderLineItemEntity $lineItem) => [ 'id' => $lineItem->getId(), 'quantity' => $lineItem->getQuantity(), 'unit_price' => $lineItem->getUnitPrice(), diff --git a/src/Components/CardRepository/CardRepository.php b/src/Components/CardRepository/CardRepository.php index 799546a0a..9765ea4a1 100644 --- a/src/Components/CardRepository/CardRepository.php +++ b/src/Components/CardRepository/CardRepository.php @@ -93,7 +93,7 @@ public function removeAllCardsForCustomer(CustomerEntity $customer, Context $con { $cards = $this->getCards($customer, $context); - $ids = array_map(static fn($item) => ['id' => $item], array_values($cards->getIds())); + $ids = array_map(static fn ($item) => ['id' => $item], array_values($cards->getIds())); $this->cardRepository->delete($ids, $context); } diff --git a/src/Components/CartHasher/CartHasher.php b/src/Components/CartHasher/CartHasher.php index 156565e07..d68131c92 100644 --- a/src/Components/CartHasher/CartHasher.php +++ b/src/Components/CartHasher/CartHasher.php @@ -7,60 +7,41 @@ use PayonePayment\Components\Currency\CurrencyPrecisionInterface; use PayonePayment\Components\Exception\InvalidCartHashException; use Shopware\Core\Checkout\Cart\Cart; +use Shopware\Core\Checkout\Cart\LineItem\LineItem; use Shopware\Core\Checkout\Order\OrderEntity; use Shopware\Core\Checkout\Payment\Cart\AsyncPaymentTransactionStruct; use Shopware\Core\Checkout\Payment\Cart\SyncPaymentTransactionStruct; use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; -use Shopware\Core\Framework\Struct\Struct; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Swag\CustomizedProducts\Core\Checkout\CustomizedProductsCartDataCollector; class CartHasher implements CartHasherInterface { - private const VALID_TYPES = [ - Cart::class, - OrderEntity::class, - ]; - - public function __construct(private readonly CurrencyPrecisionInterface $currencyPrecision, private readonly string $appSecret = '') - { + public function __construct( + private readonly CurrencyPrecisionInterface $currencyPrecision, + private readonly string $appSecret = '' + ) { } - /** - * {@inheritdoc} - */ - public function generate(Struct $entity, SalesChannelContext $context): string + public function generate(Cart|OrderEntity $entity, SalesChannelContext $context): string { - if (!\in_array($entity::class, self::VALID_TYPES, true)) { - throw new \LogicException('unsupported struct type during hash creation or validation'); - } - $hashData = $this->getHashData($entity, $context); return $this->generateHash($hashData); } - /** - * {@inheritdoc} - */ - public function validate(Struct $entity, string $cartHash, SalesChannelContext $context): bool + public function validate(Cart|OrderEntity $entity, string $cartHash, SalesChannelContext $context): bool { - if (!\in_array($entity::class, self::VALID_TYPES, true)) { - throw new \LogicException('unsupported struct type during hash creation or validation'); - } $hashData = $this->getHashData($entity, $context); $expected = $this->generateHash($hashData); return hash_equals($expected, $cartHash); } - /** - * @param AsyncPaymentTransactionStruct|SyncPaymentTransactionStruct $paymentTransaction - */ public function validateRequest( RequestDataBag $requestDataBag, - $paymentTransaction, + AsyncPaymentTransactionStruct|SyncPaymentTransactionStruct $paymentTransaction, SalesChannelContext $salesChannelContext, ?string $exceptionClass = null ): void { @@ -87,24 +68,17 @@ public function getCriteriaForOrder(?string $orderId = null): Criteria return $criteria; } - /** - * @param Cart|OrderEntity $entity - */ - private function getHashData(Struct $entity, SalesChannelContext $context): array + private function getHashData(Cart|OrderEntity $entity, SalesChannelContext $context): array { $hashData = []; - if (!method_exists($entity, 'getLineItems')) { - return $hashData; - } - $hashData['items'] = []; if ($entity->getLineItems() !== null) { foreach ($entity->getLineItems() as $lineItem) { try { if (class_exists('Swag\CustomizedProducts\Core\Checkout\CustomizedProductsCartDataCollector') && $lineItem->getType() === CustomizedProductsCartDataCollector::CUSTOMIZED_PRODUCTS_TEMPLATE_LINE_ITEM_TYPE - && (!method_exists($lineItem, 'getParentId') || $lineItem->getParentId() === null)) { + && (($lineItem instanceof LineItem) || $lineItem->getParentId() === null)) { continue; } } catch (\Exception) { @@ -121,7 +95,7 @@ private function getHashData(Struct $entity, SalesChannelContext $context): arra $detail['price'] = $this->currencyPrecision->getRoundedItemAmount($lineItem->getPrice()->getTotalPrice(), $context->getCurrency()); } - $hashData['items'][] = md5((string) json_encode($detail, JSON_THROW_ON_ERROR)); + $hashData['items'][] = md5((string) json_encode($detail, \JSON_THROW_ON_ERROR)); } } @@ -168,7 +142,7 @@ private function getHashData(Struct $entity, SalesChannelContext $context): arra private function generateHash(array $hashData): string { - $json = json_encode($hashData, \JSON_PRESERVE_ZERO_FRACTION); + $json = json_encode($hashData, \JSON_PRESERVE_ZERO_FRACTION | \JSON_THROW_ON_ERROR); if (empty($json)) { throw new \LogicException('could not generate hash'); diff --git a/src/Components/CartHasher/CartHasherInterface.php b/src/Components/CartHasher/CartHasherInterface.php index 52d2d7cb1..2ff695037 100644 --- a/src/Components/CartHasher/CartHasherInterface.php +++ b/src/Components/CartHasher/CartHasherInterface.php @@ -11,28 +11,23 @@ use Shopware\Core\Checkout\Payment\Exception\AsyncPaymentProcessException; use Shopware\Core\Checkout\Payment\Exception\SyncPaymentProcessException; use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; -use Shopware\Core\Framework\Struct\Struct; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; interface CartHasherInterface { - /** - * @param Cart|OrderEntity $entity - */ - public function generate(Struct $entity, SalesChannelContext $context): string; + public function generate(Cart|OrderEntity $entity, SalesChannelContext $context): string; - /** - * @param Cart|OrderEntity $entity - */ - public function validate(Struct $entity, string $cartHash, SalesChannelContext $context): bool; + public function validate(Cart|OrderEntity $entity, string $cartHash, SalesChannelContext $context): bool; /** - * @param AsyncPaymentTransactionStruct|SyncPaymentTransactionStruct $paymentTransaction - * * @throws AsyncPaymentProcessException|SyncPaymentProcessException */ - public function validateRequest(RequestDataBag $requestDataBag, $paymentTransaction, SalesChannelContext $salesChannelContext): void; + public function validateRequest( + RequestDataBag $requestDataBag, + AsyncPaymentTransactionStruct|SyncPaymentTransactionStruct $paymentTransaction, + SalesChannelContext $salesChannelContext + ): void; /** * returns Criteria-Objects with all dependencies which are required to generate the full hash for an order diff --git a/src/Components/CartValidator/ZeroAmountCartValidator.php b/src/Components/CartValidator/ZeroAmountCartValidator.php index c51c6a0b2..603df2f96 100644 --- a/src/Components/CartValidator/ZeroAmountCartValidator.php +++ b/src/Components/CartValidator/ZeroAmountCartValidator.php @@ -28,7 +28,7 @@ public function validate(Cart $cart, ErrorCollection $errors, SalesChannelContex return; } - if (mb_strpos((string) $context->getPaymentMethod()->getHandlerIdentifier(), PaymentMethodInstaller::HANDLER_IDENTIFIER_ROOT_NAMESPACE) === false) { + if (!str_contains($context->getPaymentMethod()->getHandlerIdentifier(), PaymentMethodInstaller::HANDLER_IDENTIFIER_ROOT_NAMESPACE)) { return; } diff --git a/src/Components/Currency/CurrencyPrecision.php b/src/Components/Currency/CurrencyPrecision.php index 22f0194e6..117f49a94 100644 --- a/src/Components/Currency/CurrencyPrecision.php +++ b/src/Components/Currency/CurrencyPrecision.php @@ -8,38 +8,14 @@ class CurrencyPrecision implements CurrencyPrecisionInterface { - final public const DEFAULT_ROUNDING_PRECISION = 2; - public function getItemRoundingPrecision(CurrencyEntity $currency): int { - /** @phpstan-ignore-next-line */ - if (method_exists($currency, 'getItemRounding')) { - return $currency->getItemRounding()->getDecimals(); - } - - /** @phpstan-ignore-next-line */ - if (method_exists($currency, 'getDecimalPrecision')) { - /** @noinspection PhpDeprecationInspection */ - return $currency->getDecimalPrecision(); - } - - return self::DEFAULT_ROUNDING_PRECISION; + return $currency->getItemRounding()->getDecimals(); } public function getTotalRoundingPrecision(CurrencyEntity $currency): int { - /** @phpstan-ignore-next-line */ - if (method_exists($currency, 'getTotalRounding')) { - return $currency->getTotalRounding()->getDecimals(); - } - - /** @phpstan-ignore-next-line */ - if (method_exists($currency, 'getDecimalPrecision')) { - /** @noinspection PhpDeprecationInspection */ - return $currency->getDecimalPrecision(); - } - - return self::DEFAULT_ROUNDING_PRECISION; + return $currency->getTotalRounding()->getDecimals(); } public function getRoundedTotalAmount(float $amount, CurrencyEntity $currency): int diff --git a/src/Components/DataHandler/Transaction/TransactionDataHandler.php b/src/Components/DataHandler/Transaction/TransactionDataHandler.php index 7091b28d9..9011c734f 100644 --- a/src/Components/DataHandler/Transaction/TransactionDataHandler.php +++ b/src/Components/DataHandler/Transaction/TransactionDataHandler.php @@ -17,11 +17,10 @@ class TransactionDataHandler implements TransactionDataHandlerInterface { - private readonly EntityRepository $transactionRepository; - - public function __construct(EntityRepository $transactionRepository, private readonly CurrencyPrecisionInterface $currencyPrecision) - { - $this->transactionRepository = $transactionRepository; + public function __construct( + private readonly EntityRepository $transactionRepository, + private readonly CurrencyPrecisionInterface $currencyPrecision + ) { } public function getPaymentTransactionByPayoneTransactionId(Context $context, int $payoneTransactionId): ?PaymentTransaction @@ -236,7 +235,7 @@ private function getCapturedAmount(PaymentTransaction $paymentTransaction, array return 0; } - if (!empty($payoneTransactionData->getCapturedAmount())) { + if ($payoneTransactionData->getCapturedAmount() !== null) { $currentCapturedAmount = $payoneTransactionData->getCapturedAmount(); } diff --git a/src/Components/DeviceFingerprint/AbstractDeviceFingerprintService.php b/src/Components/DeviceFingerprint/AbstractDeviceFingerprintService.php index 5ea178c27..705f687cb 100644 --- a/src/Components/DeviceFingerprint/AbstractDeviceFingerprintService.php +++ b/src/Components/DeviceFingerprint/AbstractDeviceFingerprintService.php @@ -6,7 +6,9 @@ use PayonePayment\PaymentHandler\AbstractPayonePaymentHandler; use Shopware\Core\System\SalesChannel\SalesChannelContext; +use Symfony\Component\HttpFoundation\Exception\SessionNotFoundException; use Symfony\Component\HttpFoundation\RequestStack; +use Symfony\Component\HttpFoundation\Session\SessionInterface; abstract class AbstractDeviceFingerprintService { @@ -26,13 +28,13 @@ abstract public function getDeviceIdentSnippet(string $deviceIdentToken, SalesCh public function getDeviceIdentToken(SalesChannelContext $salesChannelContext): string { - $sessionValue = $this->requestStack->getSession()->get($this->getSessionVarName()); + $sessionValue = $this->getSession()?->get($this->getSessionVarName()); if ($sessionValue) { $token = $sessionValue; } else { $token = $this->buildDeviceIdentToken($salesChannelContext); - $this->requestStack->getSession()->set($this->getSessionVarName(), $token); + $this->getSession()?->set($this->getSessionVarName(), $token); } return $token; @@ -40,15 +42,24 @@ public function getDeviceIdentToken(SalesChannelContext $salesChannelContext): s public function isDeviceIdentTokenAlreadyGenerated(): bool { - return $this->requestStack->getSession()->get($this->getSessionVarName()) !== null; + return $this->getSession()?->get($this->getSessionVarName()) !== null; } public function deleteDeviceIdentToken(): void { - $this->requestStack->getSession()->remove($this->getSessionVarName()); + $this->getSession()?->remove($this->getSessionVarName()); } abstract protected function getSessionVarName(): string; abstract protected function buildDeviceIdentToken(SalesChannelContext $salesChannelContext): string; + + protected function getSession(): ?SessionInterface + { + try { + return $this->requestStack->getSession(); + } catch (SessionNotFoundException) { + return null; + } + } } diff --git a/src/Components/DeviceFingerprint/PayoneBNPLDeviceFingerprintService.php b/src/Components/DeviceFingerprint/PayoneBNPLDeviceFingerprintService.php index 4de8bcec4..1b49c02ec 100644 --- a/src/Components/DeviceFingerprint/PayoneBNPLDeviceFingerprintService.php +++ b/src/Components/DeviceFingerprint/PayoneBNPLDeviceFingerprintService.php @@ -49,7 +49,7 @@ protected function getSessionVarName(): string protected function buildDeviceIdentToken(SalesChannelContext $salesChannelContext): string { - $sessionId = $this->requestStack->getSession()->get('sessionId'); + $sessionId = $this->getSession()?->get('sessionId') ?? ''; return self::PAYLA_PARTNER_ID . '_' . $this->getPartnerMerchantId($salesChannelContext) . '_' . $sessionId; } diff --git a/src/Components/DeviceFingerprint/RatepayDeviceFingerprintService.php b/src/Components/DeviceFingerprint/RatepayDeviceFingerprintService.php index dafdeb845..3c5996ffe 100644 --- a/src/Components/DeviceFingerprint/RatepayDeviceFingerprintService.php +++ b/src/Components/DeviceFingerprint/RatepayDeviceFingerprintService.php @@ -41,7 +41,7 @@ public function getDeviceIdentSnippet(string $deviceIdentToken, SalesChannelCont 'v' => $snippetId, 't' => $deviceIdentToken, 'l' => $location, - ], JSON_THROW_ON_ERROR) + ], \JSON_THROW_ON_ERROR) ); $snippet .= sprintf( @@ -62,7 +62,7 @@ protected function getSessionVarName(): string protected function buildDeviceIdentToken(SalesChannelContext $salesChannelContext): string { - $sessionId = $this->requestStack->getSession()->get('sessionId'); + $sessionId = $this->getSession()?->get('sessionId') ?? ''; return md5($sessionId . '_' . microtime()); } diff --git a/src/Components/Hydrator/LineItemHydrator/LineItemHydrator.php b/src/Components/Hydrator/LineItemHydrator/LineItemHydrator.php index b449c34f8..2063b36ce 100644 --- a/src/Components/Hydrator/LineItemHydrator/LineItemHydrator.php +++ b/src/Components/Hydrator/LineItemHydrator/LineItemHydrator.php @@ -40,11 +40,10 @@ class LineItemHydrator implements LineItemHydratorInterface final public const PAYONE_ARRAY_KEY_NAME = 'de'; final public const PAYONE_ARRAY_KEY_TAX_RATE = 'va'; - private readonly EntityRepository $shipmentRepository; - - public function __construct(private readonly CurrencyPrecisionInterface $currencyPrecision, EntityRepository $shipmentRepository) - { - $this->shipmentRepository = $shipmentRepository; + public function __construct( + private readonly CurrencyPrecisionInterface $currencyPrecision, + private readonly EntityRepository $shipmentRepository + ) { } public function mapPayoneOrderLinesByRequest( @@ -177,11 +176,8 @@ private function isCustomizedProduct(OrderLineItemEntity $lineItemEntity): bool return false; } - /** - * @param LineItem|OrderLineItemEntity $lineItemEntity - */ private function getLineItemRequest( - $lineItemEntity, + LineItem|OrderLineItemEntity $lineItemEntity, int $quantity ): array { $productNumber = \is_array($lineItemEntity->getPayload()) && \array_key_exists('productNumber', $lineItemEntity->getPayload()) @@ -196,28 +192,31 @@ private function getLineItemRequest( } } - $taxes = $lineItemEntity->getPrice() !== null ? $lineItemEntity->getPrice()->getCalculatedTaxes() : null; + $taxes = $lineItemEntity->getPrice()?->getCalculatedTaxes(); $taxRate = $taxes === null || $taxes->first() === null ? 0.0 : $taxes->first()->getTaxRate(); + $unitPrice = null; + if ($lineItemEntity instanceof LineItem) { + $unitPrice = $lineItemEntity->getPrice()?->getUnitPrice(); + } elseif ($lineItemEntity instanceof OrderLineItemEntity) { + $unitPrice = $lineItemEntity->getUnitPrice(); + } + return $this->getRequestItem( $this->mapItemType($lineItemEntity->getType()), $productNumber, $lineItemEntity->getLabel() ?? '', - /** @phpstan-ignore-next-line */ - $lineItemEntity instanceof LineItem ? $lineItemEntity->getPrice()->getUnitPrice() : $lineItemEntity->getUnitPrice(), + $unitPrice ?? 0.0, $quantity, $taxRate ); } - /** - * @param DeliveryCollection|OrderDeliveryCollection $deliveryCollection - */ private function getShippingItems( - $deliveryCollection, + DeliveryCollection|OrderDeliveryCollection $deliveryCollection, string $languageId, ?Context $context = null ): array { @@ -234,7 +233,7 @@ private function getShippingItems( $shippingCosts = $deliveryEntity->getShippingCosts(); - if ($shippingCosts->getCalculatedTaxes()->count() === 0 || $shippingCosts->getTotalPrice() <= 0) { + if ($shippingCosts->getTotalPrice() <= 0 || $shippingCosts->getCalculatedTaxes()->count() === 0) { return []; } diff --git a/src/Components/KlarnaSessionService/KlarnaSessionService.php b/src/Components/KlarnaSessionService/KlarnaSessionService.php index c2c4aa23a..3b6a8bee6 100644 --- a/src/Components/KlarnaSessionService/KlarnaSessionService.php +++ b/src/Components/KlarnaSessionService/KlarnaSessionService.php @@ -15,19 +15,13 @@ class KlarnaSessionService implements KlarnaSessionServiceInterface { - private readonly CartService $cartService; - - private readonly EntityRepository $orderEntityRepository; - public function __construct( private readonly PayoneClientInterface $payoneClient, private readonly RequestParameterFactory $requestParameterFactory, - CartService $cartService, + private readonly CartService $cartService, private readonly CartHasherInterface $cartHasher, - EntityRepository $orderEntityRepository + private readonly EntityRepository $orderEntityRepository ) { - $this->cartService = $cartService; - $this->orderEntityRepository = $orderEntityRepository; } public function createKlarnaSession(SalesChannelContext $salesChannelContext, ?string $orderId = null): CheckoutKlarnaSessionData diff --git a/src/Components/KlarnaSessionService/KlarnaSessionServiceInterface.php b/src/Components/KlarnaSessionService/KlarnaSessionServiceInterface.php index 733623552..0e3c46147 100644 --- a/src/Components/KlarnaSessionService/KlarnaSessionServiceInterface.php +++ b/src/Components/KlarnaSessionService/KlarnaSessionServiceInterface.php @@ -4,14 +4,10 @@ namespace PayonePayment\Components\KlarnaSessionService; -use PayonePayment\Payone\Client\Exception\PayoneRequestException; use PayonePayment\Storefront\Struct\CheckoutKlarnaSessionData; use Shopware\Core\System\SalesChannel\SalesChannelContext; interface KlarnaSessionServiceInterface { - /** - * @throws PayoneRequestException - */ public function createKlarnaSession(SalesChannelContext $salesChannelContext, ?string $orderId = null): CheckoutKlarnaSessionData; } diff --git a/src/Components/MandateService/MandateService.php b/src/Components/MandateService/MandateService.php index 50f0d9d15..b534e4f9d 100644 --- a/src/Components/MandateService/MandateService.php +++ b/src/Components/MandateService/MandateService.php @@ -21,14 +21,11 @@ class MandateService implements MandateServiceInterface { - private readonly EntityRepository $mandateRepository; - public function __construct( - EntityRepository $mandateRepository, + private readonly EntityRepository $mandateRepository, private readonly PayoneClientInterface $client, private readonly RequestParameterFactory $requestFactory ) { - $this->mandateRepository = $mandateRepository; } public function getMandates(CustomerEntity $customer, SalesChannelContext $context): EntitySearchResult @@ -100,7 +97,7 @@ public function removeAllMandatesForCustomer(CustomerEntity $customer, SalesChan { $mandates = $this->getMandates($customer, $context); - $ids = array_map(static fn($item) => ['id' => $item], array_values($mandates->getIds())); + $ids = array_map(static fn ($item) => ['id' => $item], array_values($mandates->getIds())); $this->mandateRepository->delete($ids, $context->getContext()); } diff --git a/src/Components/PaymentFilter/DefaultPaymentFilterService.php b/src/Components/PaymentFilter/DefaultPaymentFilterService.php index a78d9cf0e..3dc876dfe 100644 --- a/src/Components/PaymentFilter/DefaultPaymentFilterService.php +++ b/src/Components/PaymentFilter/DefaultPaymentFilterService.php @@ -5,6 +5,7 @@ namespace PayonePayment\Components\PaymentFilter; use PayonePayment\Components\PaymentFilter\Exception\PaymentMethodNotAllowedException; +use PayonePayment\PaymentHandler\AbstractPayonePaymentHandler; use Shopware\Core\Checkout\Customer\Aggregate\CustomerAddress\CustomerAddressEntity; use Shopware\Core\Checkout\Order\Aggregate\OrderAddress\OrderAddressEntity; use Shopware\Core\Checkout\Payment\PaymentMethodCollection; @@ -14,10 +15,16 @@ class DefaultPaymentFilterService implements PaymentFilterServiceInterface { /** - * @param class-string<\PayonePayment\PaymentHandler\AbstractPayonePaymentHandler> $paymentHandlerClass + * @param class-string $paymentHandlerClass */ - public function __construct(private readonly string $paymentHandlerClass, private readonly ?array $allowedCountries = null, private readonly ?array $allowedB2bCountries = null, private readonly ?array $allowedCurrencies = null, private readonly float $allowedMinValue = 0.0, private readonly ?float $allowedMaxValue = null) - { + public function __construct( + private readonly string $paymentHandlerClass, + private readonly ?array $allowedCountries = null, + private readonly ?array $allowedB2bCountries = null, + private readonly ?array $allowedCurrencies = null, + private readonly float $allowedMinValue = 0.0, + private readonly ?float $allowedMaxValue = null + ) { } public function filterPaymentMethods( @@ -67,13 +74,10 @@ protected function removePaymentMethod(PaymentMethodCollection $paymentMethodCol { $that = $this; // filter-method needs a closure (forced anonymous function) so we can not use [$this, 'filterMethod'] - return $paymentMethodCollection->filter(static fn(PaymentMethodEntity $entity) => !$that->canMethodRemoved($entity)); + return $paymentMethodCollection->filter(static fn (PaymentMethodEntity $entity) => !$that->canMethodRemoved($entity)); } - /** - * @param CustomerAddressEntity|OrderAddressEntity|null $address - */ - private function validateAddress($address): void + private function validateAddress(CustomerAddressEntity|OrderAddressEntity|null $address): void { if (!$address) { return; @@ -88,7 +92,7 @@ private function validateAddress($address): void throw new PaymentMethodNotAllowedException('Country is not allowed'); } - if ($address->getCompany() && $this->allowedB2bCountries !== null && !\in_array($country->getIso(), $this->allowedB2bCountries, true)) { + if ($this->allowedB2bCountries !== null && $address->getCompany() && !\in_array($country->getIso(), $this->allowedB2bCountries, true)) { throw new PaymentMethodNotAllowedException('Country is not allowed for B2B'); } } diff --git a/src/Components/PaymentFilter/FilteredPaymentMethodRoute.php b/src/Components/PaymentFilter/FilteredPaymentMethodRoute.php index 1a2ef1798..c8b51e039 100644 --- a/src/Components/PaymentFilter/FilteredPaymentMethodRoute.php +++ b/src/Components/PaymentFilter/FilteredPaymentMethodRoute.php @@ -17,23 +17,14 @@ */ class FilteredPaymentMethodRoute extends AbstractPaymentMethodRoute { - private readonly AbstractPaymentMethodRoute $decorated; - - private readonly RequestStack $requestStack; - - private readonly CartService $cartService; - public function __construct( - AbstractPaymentMethodRoute $decorated, + private readonly AbstractPaymentMethodRoute $decorated, private readonly IterablePaymentFilter $iterablePaymentFilter, - RequestStack $requestStack, + private readonly RequestStack $requestStack, private readonly OrderFetcherInterface $orderFetcher, - CartService $cartService, + private readonly CartService $cartService, private readonly PaymentFilterContextFactoryInterface $paymentFilterContextFactory ) { - $this->decorated = $decorated; - $this->requestStack = $requestStack; - $this->cartService = $cartService; } public function getDecorated(): AbstractPaymentMethodRoute diff --git a/src/Components/PaymentFilter/PaymentFilterContext.php b/src/Components/PaymentFilter/PaymentFilterContext.php index 0e0a9e1f7..7c63f4259 100644 --- a/src/Components/PaymentFilter/PaymentFilterContext.php +++ b/src/Components/PaymentFilter/PaymentFilterContext.php @@ -14,30 +14,14 @@ class PaymentFilterContext extends Struct { - private readonly SalesChannelContext $salesChannelContext; - - private ?CurrencyEntity $currency = null; - - private ?OrderEntity $order = null; - - private ?Cart $cart = null; - - /** - * @param CustomerAddressEntity|OrderAddressEntity|null $billingAddress - * @param CustomerAddressEntity|OrderAddressEntity|null $shippingAddress - */ public function __construct( - SalesChannelContext $salesChannelContext, - private readonly \Shopware\Core\Checkout\Customer\Aggregate\CustomerAddress\CustomerAddressEntity|\Shopware\Core\Checkout\Order\Aggregate\OrderAddress\OrderAddressEntity|null $billingAddress = null, - private readonly \Shopware\Core\Checkout\Customer\Aggregate\CustomerAddress\CustomerAddressEntity|\Shopware\Core\Checkout\Order\Aggregate\OrderAddress\OrderAddressEntity|null $shippingAddress = null, - ?CurrencyEntity $currency = null, - ?OrderEntity $order = null, - ?Cart $cart = null + private readonly SalesChannelContext $salesChannelContext, + private readonly CustomerAddressEntity|OrderAddressEntity|null $billingAddress = null, + private readonly CustomerAddressEntity|OrderAddressEntity|null $shippingAddress = null, + private readonly ?CurrencyEntity $currency = null, + private readonly ?OrderEntity $order = null, + private readonly ?Cart $cart = null ) { - $this->salesChannelContext = $salesChannelContext; - $this->currency = $currency; - $this->order = $order; - $this->cart = $cart; } public function getSalesChannelContext(): SalesChannelContext @@ -45,18 +29,12 @@ public function getSalesChannelContext(): SalesChannelContext return $this->salesChannelContext; } - /** - * @return CustomerAddressEntity|OrderAddressEntity|null - */ - public function getBillingAddress() + public function getBillingAddress(): CustomerAddressEntity|OrderAddressEntity|null { return $this->billingAddress; } - /** - * @return CustomerAddressEntity|OrderAddressEntity|null - */ - public function getShippingAddress() + public function getShippingAddress(): CustomerAddressEntity|OrderAddressEntity|null { return $this->shippingAddress; } diff --git a/src/Components/PaymentFilter/PaymentFilterContextFactory.php b/src/Components/PaymentFilter/PaymentFilterContextFactory.php index 115607bdf..718cca564 100644 --- a/src/Components/PaymentFilter/PaymentFilterContextFactory.php +++ b/src/Components/PaymentFilter/PaymentFilterContextFactory.php @@ -33,8 +33,8 @@ public function createContextForCart(Cart $cart, SalesChannelContext $salesChann return new PaymentFilterContext( $salesChannelContext, - $customer ? $customer->getActiveBillingAddress() : null, - $customer ? $customer->getActiveShippingAddress() : null, + $customer?->getActiveBillingAddress(), + $customer?->getActiveShippingAddress(), $salesChannelContext->getCurrency(), null, $cart diff --git a/src/Components/PaymentFilter/PayonePaymentMethodValidator.php b/src/Components/PaymentFilter/PayonePaymentMethodValidator.php index dddd53819..faaf11798 100644 --- a/src/Components/PaymentFilter/PayonePaymentMethodValidator.php +++ b/src/Components/PaymentFilter/PayonePaymentMethodValidator.php @@ -11,8 +11,10 @@ class PayonePaymentMethodValidator implements CartValidatorInterface { - public function __construct(private readonly IterablePaymentFilter $iterablePaymentFilter, private readonly PaymentFilterContextFactoryInterface $paymentFilterContextFactory) - { + public function __construct( + private readonly IterablePaymentFilter $iterablePaymentFilter, + private readonly PaymentFilterContextFactoryInterface $paymentFilterContextFactory + ) { } /** diff --git a/src/Components/RedirectHandler/RedirectHandler.php b/src/Components/RedirectHandler/RedirectHandler.php index f8048f1e9..bef3812a9 100644 --- a/src/Components/RedirectHandler/RedirectHandler.php +++ b/src/Components/RedirectHandler/RedirectHandler.php @@ -49,13 +49,7 @@ public function decode(string $hash): string { $query = 'SELECT url FROM payone_payment_redirect WHERE hash = ?'; - /** @phpstan-ignore-next-line */ - if (method_exists($this->connection, 'fetchOne')) { - $url = $this->connection->fetchOne($query, [$hash]); - } elseif (method_exists($this->connection, 'fetchColumn')) { - /** @noinspection PhpDeprecationInspection */ - $url = $this->connection->fetchColumn($query, [$hash]); - } + $url = $this->connection->fetchOne($query, [$hash]); if (empty($url)) { throw new \RuntimeException('no matching url for hash found'); diff --git a/src/Components/TransactionHandler/AbstractTransactionHandler.php b/src/Components/TransactionHandler/AbstractTransactionHandler.php index a0454440d..061482f30 100644 --- a/src/Components/TransactionHandler/AbstractTransactionHandler.php +++ b/src/Components/TransactionHandler/AbstractTransactionHandler.php @@ -183,7 +183,7 @@ protected function isSuccessResponse(JsonResponse $requestResponse): bool $requestContent = $requestResponse->getContent(); if ($requestContent) { - $decodedResultContent = json_decode($requestContent, true, 512, JSON_THROW_ON_ERROR); + $decodedResultContent = json_decode($requestContent, true, 512, \JSON_THROW_ON_ERROR); } return !empty($decodedResultContent) && $decodedResultContent['status']; diff --git a/src/Components/TransactionHandler/Capture/CaptureTransactionHandler.php b/src/Components/TransactionHandler/Capture/CaptureTransactionHandler.php index 6d5ad2659..8a129ab5b 100644 --- a/src/Components/TransactionHandler/Capture/CaptureTransactionHandler.php +++ b/src/Components/TransactionHandler/Capture/CaptureTransactionHandler.php @@ -40,9 +40,6 @@ public function __construct( $this->currencyPrecision = $currencyPrecision; } - /** - * {@inheritdoc} - */ public function capture(ParameterBag $parameterBag, Context $context): JsonResponse { [$requestResponse, $payoneResponse] = $this->handleRequest($parameterBag, AbstractRequestParameterBuilder::REQUEST_ACTION_CAPTURE, $context); @@ -53,7 +50,7 @@ public function capture(ParameterBag $parameterBag, Context $context): JsonRespo $this->updateTransactionData($parameterBag, (float) $parameterBag->get('amount')); $this->updateClearingBankAccountData($payoneResponse); - $this->saveOrderLineItemData($parameterBag->get('orderLines', []), $context); + $this->saveOrderLineItemData($parameterBag->all('orderLines'), $context); /** @var PayonePaymentOrderTransactionDataEntity $payoneTransactionData */ $payoneTransactionData = $this->paymentTransaction->getOrderTransaction()->getExtension(PayonePaymentOrderTransactionExtension::NAME); diff --git a/src/Components/TransactionHandler/Refund/RefundTransactionHandler.php b/src/Components/TransactionHandler/Refund/RefundTransactionHandler.php index 2aaa18cd3..40c2ab70c 100644 --- a/src/Components/TransactionHandler/Refund/RefundTransactionHandler.php +++ b/src/Components/TransactionHandler/Refund/RefundTransactionHandler.php @@ -40,9 +40,6 @@ public function __construct( $this->currencyPrecision = $currencyPrecision; } - /** - * {@inheritdoc} - */ public function refund(ParameterBag $parameterBag, Context $context): JsonResponse { [$requestResponse,] = $this->handleRequest($parameterBag, AbstractRequestParameterBuilder::REQUEST_ACTION_REFUND, $context); @@ -52,7 +49,7 @@ public function refund(ParameterBag $parameterBag, Context $context): JsonRespon } $this->updateTransactionData($parameterBag, (float) $parameterBag->get('amount')); - $this->saveOrderLineItemData($parameterBag->get('orderLines', []), $context); + $this->saveOrderLineItemData($parameterBag->all('orderLines'), $context); $transitionName = StateMachineTransitionActions::ACTION_REFUND_PARTIALLY; diff --git a/src/Components/Validator/PaymentMethodValidator.php b/src/Components/Validator/PaymentMethodValidator.php index 9eb547703..601fbe631 100644 --- a/src/Components/Validator/PaymentMethodValidator.php +++ b/src/Components/Validator/PaymentMethodValidator.php @@ -9,7 +9,6 @@ class PaymentMethodValidator extends AbstractComparisonValidator { /** - * * @return bool always fails as the check is done inside a subscriber */ protected function compareValues(mixed $value1, mixed $value2): bool diff --git a/src/Controller/CaptureController.php b/src/Controller/CaptureController.php index bba7612ff..38f341477 100644 --- a/src/Controller/CaptureController.php +++ b/src/Controller/CaptureController.php @@ -12,16 +12,14 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; +#[Route(defaults: ['_routeScope' => ['api']])] class CaptureController extends AbstractController { public function __construct(private readonly CaptureTransactionHandlerInterface $captureHandler) { } - /** - * @Route("/api/_action/payone/capture-payment", name="api.action.payone.capture_payment", methods={"POST"}, defaults={"_routeScope"={"api"}}) - * @Route("/api/v{version}/_action/payone/capture-payment", name="api.action.payone.capture_payment.legacy", methods={"POST"}, defaults={"_routeScope"={"api"}}) - */ + #[Route(path: '/api/_action/payone/capture-payment', name: 'api.action.payone.capture_payment', methods: ['POST'])] public function captureAction(Request $request, Context $context): JsonResponse { if (empty($request->get('orderTransactionId'))) { diff --git a/src/Controller/RedirectController.php b/src/Controller/RedirectController.php index a6b0869d2..057583db4 100644 --- a/src/Controller/RedirectController.php +++ b/src/Controller/RedirectController.php @@ -11,15 +11,14 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\Routing\Annotation\Route; +#[Route(defaults: ['_routeScope' => ['storefront']])] class RedirectController { public function __construct(private readonly RedirectHandler $redirectHandler) { } - /** - * @Route("/payone/redirect", name="payment.payone_redirect", defaults={"csrf_protected": false, "_routeScope"={"storefront"}}) - */ + #[Route(path: '/payone/redirect', name: 'payment.payone_redirect')] public function execute(Request $request): Response { $hash = $request->get('hash'); diff --git a/src/Controller/RefundController.php b/src/Controller/RefundController.php index ba5e61682..ee07c36d8 100644 --- a/src/Controller/RefundController.php +++ b/src/Controller/RefundController.php @@ -12,16 +12,14 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; +#[Route(defaults: ['_routeScope' => ['api']])] class RefundController extends AbstractController { public function __construct(private readonly RefundTransactionHandlerInterface $refundHandler) { } - /** - * @Route("/api/_action/payone/refund-payment", name="api.action.payone.refund_payment", methods={"POST"}, defaults={"_routeScope"={"api"}}) - * @Route("/api/v{version}/_action/payone/refund-payment", name="api.action.payone.refund_payment.legacy", methods={"POST"}, defaults={"_routeScope"={"api"}}) - */ + #[Route(path: '/api/_action/payone/refund-payment', name: 'api.action.payone.refund_payment', methods: ['POST'])] public function refundAction(Request $request, Context $context): JsonResponse { if (empty($request->get('orderTransactionId'))) { diff --git a/src/Controller/SettingsController.php b/src/Controller/SettingsController.php index d26b068cb..2dc05073c 100644 --- a/src/Controller/SettingsController.php +++ b/src/Controller/SettingsController.php @@ -25,30 +25,22 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Annotation\Route; +#[Route(defaults: ['_routeScope' => ['api']])] class SettingsController extends AbstractController { private const REFERENCE_PREFIX_TEST = 'TESTPO-'; - private readonly EntityRepository $stateMachineTransitionRepository; - - private readonly EntityRepository $paymentMethodRepository; - public function __construct( private readonly PayoneClientInterface $client, private readonly RequestParameterFactory $requestFactory, - EntityRepository $stateMachineTransitionRepository, + private readonly EntityRepository $stateMachineTransitionRepository, private readonly LoggerInterface $logger, private readonly string $kernelDirectory, - EntityRepository $paymentMethodRepository + private readonly EntityRepository $paymentMethodRepository ) { - $this->stateMachineTransitionRepository = $stateMachineTransitionRepository; - $this->paymentMethodRepository = $paymentMethodRepository; } - /** - * @Route("/api/_action/payone_payment/validate-api-credentials", name="api.action.payone_payment.validate.api.credentials", methods={"POST"}, defaults={"_routeScope"={"api"}}) - * @Route("/api/v{version}/_action/payone_payment/validate-api-credentials", name="api.action.payone_payment.validate.api.credentials.legacy", methods={"POST"}, defaults={"_routeScope"={"api"}}) - */ + #[Route(path: '/api/_action/payone_payment/validate-api-credentials', name: 'api.action.payone_payment.validate.api.credentials', methods: ['POST'])] public function validateApiCredentials(Request $request, Context $context): JsonResponse { $testCount = 0; @@ -89,11 +81,8 @@ public function validateApiCredentials(Request $request, Context $context): Json ]); } - /** - * @Route("/api/_action/payone_payment/get-state-machine-transition-actions", name="api.action.payone_payment.get.state_machine_transition.actions", methods={"GET"}, defaults={"_routeScope"={"api"}}) - * @Route("/api/v{version}/_action/payone_payment/get-state-machine-transition-actions", name="api.action.payone_payment.get.state_machine_transition.actions.legacy", methods={"GET"}, defaults={"_routeScope"={"api"}}) - */ - public function getStateMachineTransitionActions(Request $request, Context $context): JsonResponse + #[Route(path: '/api/_action/payone_payment/get-state-machine-transition-actions', name: 'api.action.payone_payment.get.state_machine_transition.actions', methods: ['GET'])] + public function getStateMachineTransitionActions(Context $context): JsonResponse { $criteria = (new Criteria()) ->addAssociation('stateMachine') @@ -103,23 +92,18 @@ public function getStateMachineTransitionActions(Request $request, Context $cont $searchResult = $this->stateMachineTransitionRepository->search($criteria, $context); $transitionNames = []; - if ((is_countable($searchResult->getElements()) ? \count($searchResult->getElements()) : 0) > 0) { - /** @var StateMachineTransitionEntity $stateMachineAction */ - foreach ($searchResult->getElements() as $stateMachineAction) { - $transitionNames[] = [ - 'label' => $stateMachineAction->getActionName(), - 'value' => $stateMachineAction->getActionName(), - ]; - } + /** @var StateMachineTransitionEntity $stateMachineAction */ + foreach ($searchResult->getElements() as $stateMachineAction) { + $transitionNames[] = [ + 'label' => $stateMachineAction->getActionName(), + 'value' => $stateMachineAction->getActionName(), + ]; } return new JsonResponse(['data' => $transitionNames, 'total' => \count($transitionNames)]); } - /** - * @Route("/api/_action/payone_payment/check-apple-pay-cert", name="api.action.payone_payment.check.apple_pay_cert", methods={"GET"}, defaults={"_routeScope"={"api"}}) - * @Route("/api/v{version}/_action/payone_payment/check-apple-pay-cert", name="api.action.payone_payment.check.apple_pay_cert.legacy", methods={"GET"}, defaults={"_routeScope"={"api"}}) - */ + #[Route(path: '/api/_action/payone_payment/check-apple-pay-cert', name: 'api.action.payone_payment.check.apple_pay_cert', methods: ['GET'])] public function checkApplePayCert(): JsonResponse { if (!file_exists($this->kernelDirectory . ApplePayRoute::CERT_FOLDER . 'merchant_id.key')) { diff --git a/src/Controller/WebhookController.php b/src/Controller/WebhookController.php index ff9e74261..a2f4c881f 100644 --- a/src/Controller/WebhookController.php +++ b/src/Controller/WebhookController.php @@ -18,31 +18,20 @@ class WebhookController extends StorefrontController { - private readonly EntityRepository $notificationForwardRepository; - - private readonly MessageBusInterface $messageBus; - public function __construct( private readonly WebhookProcessorInterface $webhookProcessor, - EntityRepository $notificationForwardRepository, - MessageBusInterface $messageBus + private readonly EntityRepository $notificationForwardRepository, + private readonly MessageBusInterface $messageBus ) { - $this->notificationForwardRepository = $notificationForwardRepository; - $this->messageBus = $messageBus; } - /** - * @Route("/payone/webhook", name="payone_webhook", defaults={"csrf_protected": false, "_routeScope"={"storefront"}}, methods={"POST"}) - */ + #[Route(path: '/payone/webhook', name: 'payone_webhook', defaults: ['_routeScope' => ['storefront']], methods: ['POST'])] public function execute(Request $request, SalesChannelContext $salesChannelContext): Response { return $this->webhookProcessor->process($salesChannelContext, $request); } - /** - * @Route("/api/_action/payone/requeue-forward", name="api.action.payone.requeue.forward", methods={"POST"}, defaults={"_routeScope"={"api"}}) - * @Route("/api/v{version}/_action/payone/requeue-forward", name="api.action.payone.requeue.forward.legacy", methods={"POST"}, defaults={"_routeScope"={"api"}}) - */ + #[Route(path: '/api/_action/payone/requeue-forward', name: 'api.action.payone.requeue.forward', defaults: ['_routeScope' => ['api']], methods: ['POST'])] public function reQueueForward(Request $request, Context $context): Response { $id = $request->get('notificationForwardId'); diff --git a/src/DataAbstractionLayer/Aggregate/PayonePaymentOrderTransactionDataCollection.php b/src/DataAbstractionLayer/Aggregate/PayonePaymentOrderTransactionDataCollection.php index 8796644c1..9759449cb 100644 --- a/src/DataAbstractionLayer/Aggregate/PayonePaymentOrderTransactionDataCollection.php +++ b/src/DataAbstractionLayer/Aggregate/PayonePaymentOrderTransactionDataCollection.php @@ -7,13 +7,7 @@ use Shopware\Core\Framework\DataAbstractionLayer\EntityCollection; /** - * @method void add(PayonePaymentOrderTransactionDataEntity $entity) - * @method void set(string $key, PayonePaymentOrderTransactionDataEntity $entity) - * @method PayonePaymentOrderTransactionDataEntity[] getIterator() - * @method PayonePaymentOrderTransactionDataEntity[] getElements() - * @method PayonePaymentOrderTransactionDataEntity|null get(string $key) - * @method PayonePaymentOrderTransactionDataEntity|null first() - * @method PayonePaymentOrderTransactionDataEntity|null last() + * @extends EntityCollection */ class PayonePaymentOrderTransactionDataCollection extends EntityCollection { diff --git a/src/DataAbstractionLayer/Entity/Card/PayonePaymentCardCollection.php b/src/DataAbstractionLayer/Entity/Card/PayonePaymentCardCollection.php index 5fab3c362..68b22824d 100644 --- a/src/DataAbstractionLayer/Entity/Card/PayonePaymentCardCollection.php +++ b/src/DataAbstractionLayer/Entity/Card/PayonePaymentCardCollection.php @@ -7,13 +7,7 @@ use Shopware\Core\Framework\DataAbstractionLayer\EntityCollection; /** - * @method void add(PayonePaymentCardEntity $entity) - * @method void set(string $key, PayonePaymentCardEntity $entity) - * @method PayonePaymentCardEntity[] getIterator() - * @method PayonePaymentCardEntity[] getElements() - * @method PayonePaymentCardEntity|null get(string $key) - * @method PayonePaymentCardEntity|null first() - * @method PayonePaymentCardEntity|null last() + * @extends EntityCollection */ class PayonePaymentCardCollection extends EntityCollection { diff --git a/src/DataAbstractionLayer/Entity/Mandate/PayonePaymentMandateCollection.php b/src/DataAbstractionLayer/Entity/Mandate/PayonePaymentMandateCollection.php index 3f4d45ed6..401c4e5f1 100644 --- a/src/DataAbstractionLayer/Entity/Mandate/PayonePaymentMandateCollection.php +++ b/src/DataAbstractionLayer/Entity/Mandate/PayonePaymentMandateCollection.php @@ -7,13 +7,7 @@ use Shopware\Core\Framework\DataAbstractionLayer\EntityCollection; /** - * @method void add(PayonePaymentMandateEntity $entity) - * @method void set(string $key, PayonePaymentMandateEntity $entity) - * @method PayonePaymentMandateEntity[] getIterator() - * @method PayonePaymentMandateEntity[] getElements() - * @method PayonePaymentMandateEntity|null get(string $key) - * @method PayonePaymentMandateEntity|null first() - * @method PayonePaymentMandateEntity|null last() + * @extends EntityCollection */ class PayonePaymentMandateCollection extends EntityCollection { diff --git a/src/DataAbstractionLayer/Entity/NotificationForward/PayonePaymentNotificationForwardCollection.php b/src/DataAbstractionLayer/Entity/NotificationForward/PayonePaymentNotificationForwardCollection.php index 1bf041ca9..d1a462a82 100644 --- a/src/DataAbstractionLayer/Entity/NotificationForward/PayonePaymentNotificationForwardCollection.php +++ b/src/DataAbstractionLayer/Entity/NotificationForward/PayonePaymentNotificationForwardCollection.php @@ -7,13 +7,7 @@ use Shopware\Core\Framework\DataAbstractionLayer\EntityCollection; /** - * @method void add(PayonePaymentNotificationForwardEntity $entity) - * @method void set(string $key, PayonePaymentNotificationForwardEntity $entity) - * @method PayonePaymentNotificationForwardEntity[] getIterator() - * @method PayonePaymentNotificationForwardEntity[] getElements() - * @method PayonePaymentNotificationForwardEntity|null get(string $key) - * @method PayonePaymentNotificationForwardEntity|null first() - * @method PayonePaymentNotificationForwardEntity|null last() + * @extends EntityCollection */ class PayonePaymentNotificationForwardCollection extends EntityCollection { diff --git a/src/DataAbstractionLayer/Entity/NotificationTarget/PayonePaymentNotificationTargetCollection.php b/src/DataAbstractionLayer/Entity/NotificationTarget/PayonePaymentNotificationTargetCollection.php index 827213b9f..c499820f6 100644 --- a/src/DataAbstractionLayer/Entity/NotificationTarget/PayonePaymentNotificationTargetCollection.php +++ b/src/DataAbstractionLayer/Entity/NotificationTarget/PayonePaymentNotificationTargetCollection.php @@ -7,13 +7,7 @@ use Shopware\Core\Framework\DataAbstractionLayer\EntityCollection; /** - * @method void add(PayonePaymentNotificationTargetEntity $entity) - * @method void set(string $key, PayonePaymentNotificationTargetEntity $entity) - * @method PayonePaymentNotificationTargetEntity[] getIterator() - * @method PayonePaymentNotificationTargetEntity[] getElements() - * @method PayonePaymentNotificationTargetEntity|null get(string $key) - * @method PayonePaymentNotificationTargetEntity|null first() - * @method PayonePaymentNotificationTargetEntity|null last() + * @extends EntityCollection */ class PayonePaymentNotificationTargetCollection extends EntityCollection { diff --git a/src/DependencyInjection/controllers.xml b/src/DependencyInjection/controllers.xml index 0f52ff922..6b5eb8a79 100644 --- a/src/DependencyInjection/controllers.xml +++ b/src/DependencyInjection/controllers.xml @@ -56,6 +56,9 @@ + + + @@ -65,6 +68,9 @@ + + + + + + @@ -84,6 +93,9 @@ + + + @@ -97,6 +109,9 @@ + + + @@ -115,6 +130,9 @@ + + + @@ -123,6 +141,9 @@ + + + diff --git a/src/DependencyInjection/handler/payment_handler.xml b/src/DependencyInjection/handler/payment_handler.xml index 9a3c4ae1b..08a834571 100644 --- a/src/DependencyInjection/handler/payment_handler.xml +++ b/src/DependencyInjection/handler/payment_handler.xml @@ -3,399 +3,247 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - + - - - - - - - - - + - - - - - - - - - + - - - - - - - - + + - + - - - - - - - - - + + - - - - - - - - + - + - - - - - - - - - + - - - - - - - - - + - - - - - - - - - + - - - - - - - - - + - - - - - - - - + - - - - - - - - - + - - - - - - - - - + - + - - - - - - - - + + - - - - - - - - + - - - - - - - + - + - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - + + + + + + + - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - - - - - - - - + + - + - - - - - - - - - + + - - - - - - - - - + + - - - - - - - - - + - - - - - - - - - + - - - - - - - - - + - - - - - - - - - + - diff --git a/src/EventListener/CheckoutConfirmApplePayEventListener.php b/src/EventListener/CheckoutConfirmApplePayEventListener.php index fd3d74f49..363e4fc07 100644 --- a/src/EventListener/CheckoutConfirmApplePayEventListener.php +++ b/src/EventListener/CheckoutConfirmApplePayEventListener.php @@ -34,11 +34,9 @@ public static function getSubscribedEvents(): array ]; } - /** - * @param AccountPaymentMethodPageLoadedEvent|CheckoutConfirmPageLoadedEvent $event - */ - public function hideApplePayForNonSafariUsers($event): void - { + public function hideApplePayForNonSafariUsers( + AccountPaymentMethodPageLoadedEvent|CheckoutConfirmPageLoadedEvent $event + ): void { $paymentMethods = $event->getPage()->getPaymentMethods(); $request = $event->getRequest(); diff --git a/src/EventListener/CheckoutConfirmCartDataEventListener.php b/src/EventListener/CheckoutConfirmCartDataEventListener.php index d3a9fb115..e0d4db8ce 100644 --- a/src/EventListener/CheckoutConfirmCartDataEventListener.php +++ b/src/EventListener/CheckoutConfirmCartDataEventListener.php @@ -19,21 +19,16 @@ use Shopware\Storefront\Page\Account\Order\AccountEditOrderPageLoadedEvent; use Shopware\Storefront\Page\Checkout\Confirm\CheckoutConfirmPage; use Shopware\Storefront\Page\Checkout\Confirm\CheckoutConfirmPageLoadedEvent; -use Shopware\Storefront\Page\Page; -use Shopware\Storefront\Page\PageLoadedEvent; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\Process\Exception\LogicException; class CheckoutConfirmCartDataEventListener implements EventSubscriberInterface { - private readonly OrderConverter $orderConverter; - public function __construct( - OrderConverter $orderConverter, + private readonly OrderConverter $orderConverter, private readonly OrderFetcherInterface $orderFetcher, private readonly CurrencyPrecisionInterface $currencyPrecision ) { - $this->orderConverter = $orderConverter; } public static function getSubscribedEvents(): array @@ -44,10 +39,7 @@ public static function getSubscribedEvents(): array ]; } - /** - * @param AccountEditOrderPageLoadedEvent|CheckoutConfirmPageLoadedEvent $event - */ - public function addCartData(PageLoadedEvent $event): void + public function addCartData(AccountEditOrderPageLoadedEvent|CheckoutConfirmPageLoadedEvent $event): void { $page = $event->getPage(); @@ -79,11 +71,11 @@ public function addCartData(PageLoadedEvent $event): void } } - /** - * @param AccountEditOrderPage|CheckoutConfirmPage $page - */ - private function hidePayonePaymentMethodsOnZeroAmountCart(Page $page, Cart $cart, SalesChannelContext $salesChannelContext): void - { + private function hidePayonePaymentMethodsOnZeroAmountCart( + AccountEditOrderPage|CheckoutConfirmPage $page, + Cart $cart, + SalesChannelContext $salesChannelContext + ): void { $totalAmount = $this->currencyPrecision->getRoundedItemAmount($cart->getPrice()->getTotalPrice(), $salesChannelContext->getCurrency()); if ($totalAmount > 0) { @@ -91,7 +83,9 @@ private function hidePayonePaymentMethodsOnZeroAmountCart(Page $page, Cart $cart } $page->setPaymentMethods( - $page->getPaymentMethods()->filter(static fn(PaymentMethodEntity $paymentMethod) => mb_strpos((string) $paymentMethod->getHandlerIdentifier(), PaymentMethodInstaller::HANDLER_IDENTIFIER_ROOT_NAMESPACE) === false) + $page->getPaymentMethods()->filter( + static fn (PaymentMethodEntity $paymentMethod) => !str_contains($paymentMethod->getHandlerIdentifier(), PaymentMethodInstaller::HANDLER_IDENTIFIER_ROOT_NAMESPACE) + ) ); $salesChannelContext->assign(['paymentMethods' => $page->getPaymentMethods()]); diff --git a/src/EventListener/CheckoutConfirmCreditCardEventListener.php b/src/EventListener/CheckoutConfirmCreditCardEventListener.php index 9a40c4649..2a5723ef8 100644 --- a/src/EventListener/CheckoutConfirmCreditCardEventListener.php +++ b/src/EventListener/CheckoutConfirmCreditCardEventListener.php @@ -17,19 +17,15 @@ use Shopware\Core\System\Language\LanguageEntity; use Shopware\Storefront\Page\Account\Order\AccountEditOrderPageLoadedEvent; use Shopware\Storefront\Page\Checkout\Confirm\CheckoutConfirmPageLoadedEvent; -use Shopware\Storefront\Page\PageLoadedEvent; use Symfony\Component\EventDispatcher\EventSubscriberInterface; class CheckoutConfirmCreditCardEventListener implements EventSubscriberInterface { - private readonly EntityRepository $languageRepository; - public function __construct( private readonly RequestParameterFactory $requestParameterFactory, - EntityRepository $languageRepository, + private readonly EntityRepository $languageRepository, private readonly AbstractCardRoute $cardRoute ) { - $this->languageRepository = $languageRepository; } public static function getSubscribedEvents(): array @@ -40,7 +36,7 @@ public static function getSubscribedEvents(): array ]; } - public function addPayonePageData(PageLoadedEvent $event): void + public function addPayonePageData(CheckoutConfirmPageLoadedEvent|AccountEditOrderPageLoadedEvent $event): void { $page = $event->getPage(); $context = $event->getSalesChannelContext(); @@ -56,6 +52,7 @@ public function addPayonePageData(PageLoadedEvent $event): void ) ); + $savedCards = null; if ($context->getCustomer() !== null) { $savedCards = $this->cardRoute->load($context)->getSearchResult(); } @@ -72,7 +69,7 @@ public function addPayonePageData(PageLoadedEvent $event): void $payoneData->assign([ 'cardRequest' => $cardRequest, 'language' => $language, - 'savedCards' => !empty($savedCards) ? $savedCards : null, + 'savedCards' => $savedCards, ]); $page->addExtension(CheckoutConfirmPaymentData::EXTENSION_NAME, $payoneData); @@ -92,6 +89,6 @@ private function getCustomerLanguage(Context $context): string return 'en'; } - return substr((string) $language->getLocale()->getCode(), 0, 2); + return substr($language->getLocale()->getCode(), 0, 2); } } diff --git a/src/EventListener/CheckoutConfirmDebitEventListener.php b/src/EventListener/CheckoutConfirmDebitEventListener.php index 8aa7b821f..7635c03d6 100644 --- a/src/EventListener/CheckoutConfirmDebitEventListener.php +++ b/src/EventListener/CheckoutConfirmDebitEventListener.php @@ -10,7 +10,6 @@ use PayonePayment\Storefront\Struct\CheckoutConfirmPaymentData; use Shopware\Storefront\Page\Account\Order\AccountEditOrderPageLoadedEvent; use Shopware\Storefront\Page\Checkout\Confirm\CheckoutConfirmPageLoadedEvent; -use Shopware\Storefront\Page\PageLoadedEvent; use Symfony\Component\EventDispatcher\EventSubscriberInterface; class CheckoutConfirmDebitEventListener implements EventSubscriberInterface @@ -27,7 +26,7 @@ public static function getSubscribedEvents(): array ]; } - public function addPayonePageData(PageLoadedEvent $event): void + public function addPayonePageData(CheckoutConfirmPageLoadedEvent|AccountEditOrderPageLoadedEvent $event): void { $page = $event->getPage(); $context = $event->getSalesChannelContext(); diff --git a/src/EventListener/CheckoutConfirmEpsEventListener.php b/src/EventListener/CheckoutConfirmEpsEventListener.php index 61ff7d1d4..eb8525cad 100644 --- a/src/EventListener/CheckoutConfirmEpsEventListener.php +++ b/src/EventListener/CheckoutConfirmEpsEventListener.php @@ -28,11 +28,9 @@ public static function getSubscribedEvents(): array ]; } - /** - * @param AccountEditOrderPageLoadedEvent|AccountPaymentMethodPageLoadedEvent|CheckoutConfirmPageLoadedEvent $event - */ - public function hideEpsForNonAtCustomers($event): void - { + public function hideEpsForNonAtCustomers( + AccountEditOrderPageLoadedEvent|AccountPaymentMethodPageLoadedEvent|CheckoutConfirmPageLoadedEvent $event + ): void { $paymentMethods = $event->getPage()->getPaymentMethods(); if ( @@ -79,7 +77,7 @@ private function isAtCustomer(SalesChannelContext $context): bool private function removePaymentMethod(PaymentMethodCollection $paymentMethods, string $paymentMethodId): PaymentMethodCollection { return $paymentMethods->filter( - static fn(PaymentMethodEntity $paymentMethod) => $paymentMethod->getId() !== $paymentMethodId + static fn (PaymentMethodEntity $paymentMethod) => $paymentMethod->getId() !== $paymentMethodId ); } } diff --git a/src/EventListener/CheckoutConfirmIDealEventListener.php b/src/EventListener/CheckoutConfirmIDealEventListener.php index 71db4674e..b2e61b59c 100644 --- a/src/EventListener/CheckoutConfirmIDealEventListener.php +++ b/src/EventListener/CheckoutConfirmIDealEventListener.php @@ -28,11 +28,9 @@ public static function getSubscribedEvents(): array ]; } - /** - * @param AccountEditOrderPageLoadedEvent|AccountPaymentMethodPageLoadedEvent|CheckoutConfirmPageLoadedEvent $event - */ - public function hideIDealForNonNlCustomers($event): void - { + public function hideIDealForNonNlCustomers( + AccountEditOrderPageLoadedEvent|AccountPaymentMethodPageLoadedEvent|CheckoutConfirmPageLoadedEvent $event + ): void { $paymentMethods = $event->getPage()->getPaymentMethods(); if ( @@ -79,7 +77,7 @@ private function isNlCustomer(SalesChannelContext $context): bool private function removePaymentMethod(PaymentMethodCollection $paymentMethods, string $paymentMethodId): PaymentMethodCollection { return $paymentMethods->filter( - static fn(PaymentMethodEntity $paymentMethod) => $paymentMethod->getId() !== $paymentMethodId + static fn (PaymentMethodEntity $paymentMethod) => $paymentMethod->getId() !== $paymentMethodId ); } } diff --git a/src/EventListener/CheckoutConfirmKlarnaPaymentEventListener.php b/src/EventListener/CheckoutConfirmKlarnaPaymentEventListener.php index 729c98b9e..5caed219a 100644 --- a/src/EventListener/CheckoutConfirmKlarnaPaymentEventListener.php +++ b/src/EventListener/CheckoutConfirmKlarnaPaymentEventListener.php @@ -13,18 +13,14 @@ use Shopware\Storefront\Page\Account\Order\AccountEditOrderPageLoadedEvent; use Shopware\Storefront\Page\Checkout\Confirm\CheckoutConfirmPageLoadedEvent; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Contracts\Translation\TranslatorInterface; class CheckoutConfirmKlarnaPaymentEventListener implements EventSubscriberInterface { - private readonly TranslatorInterface $translator; - public function __construct( - TranslatorInterface $translator, + private readonly TranslatorInterface $translator, private readonly KlarnaSessionServiceInterface $klarnaSessionService ) { - $this->translator = $translator; } public static function getSubscribedEvents(): array @@ -36,11 +32,9 @@ public static function getSubscribedEvents(): array ]; } - /** - * @param AccountEditOrderPageLoadedEvent|CheckoutConfirmPageLoadedEvent $event - */ - public function initiateSession($event): void - { + public function initiateSession( + AccountEditOrderPageLoadedEvent|CheckoutConfirmPageLoadedEvent $event + ): void { $currentPaymentMethod = $event->getSalesChannelContext()->getPaymentMethod(); if (!$this->isKlarnaPaymentMethod($currentPaymentMethod)) { @@ -68,7 +62,7 @@ public function initiateSession($event): void ]); } catch (PayoneRequestException) { $session = $event->getRequest()->getSession(); - if ($session instanceof Session) { + if (method_exists($session, 'getFlashBag')) { $session->getFlashBag()->add( 'danger', $this->translator->trans('PayonePayment.errorMessages.canNotInitKlarna') diff --git a/src/EventListener/CheckoutConfirmPaydirektEventListener.php b/src/EventListener/CheckoutConfirmPaydirektEventListener.php index 6fbaa9fc1..2b7b4ba67 100644 --- a/src/EventListener/CheckoutConfirmPaydirektEventListener.php +++ b/src/EventListener/CheckoutConfirmPaydirektEventListener.php @@ -27,11 +27,9 @@ public static function getSubscribedEvents(): array ]; } - /** - * @param AccountPaymentMethodPageLoadedEvent|CheckoutConfirmPageLoadedEvent $event - */ - public function hidePaydirektForNonDeCustomers($event): void - { + public function hidePaydirektForNonDeCustomers( + AccountPaymentMethodPageLoadedEvent|CheckoutConfirmPageLoadedEvent $event + ): void { $paymentMethods = $event->getPage()->getPaymentMethods(); if ( diff --git a/src/EventListener/CheckoutConfirmPayolutionEventListener.php b/src/EventListener/CheckoutConfirmPayolutionEventListener.php index 87d42cdea..8c2f0ce9b 100644 --- a/src/EventListener/CheckoutConfirmPayolutionEventListener.php +++ b/src/EventListener/CheckoutConfirmPayolutionEventListener.php @@ -13,7 +13,6 @@ use Shopware\Storefront\Page\Account\Order\AccountEditOrderPageLoadedEvent; use Shopware\Storefront\Page\Account\PaymentMethod\AccountPaymentMethodPageLoadedEvent; use Shopware\Storefront\Page\Checkout\Confirm\CheckoutConfirmPageLoadedEvent; -use Shopware\Storefront\Page\PageLoadedEvent; use Symfony\Component\EventDispatcher\EventSubscriberInterface; class CheckoutConfirmPayolutionEventListener implements EventSubscriberInterface @@ -31,17 +30,11 @@ public static function getSubscribedEvents(): array ]; } - public function hidePaymentMethodsForCompanies(PageLoadedEvent $event): void - { + public function hidePaymentMethodsForCompanies( + CheckoutConfirmPageLoadedEvent|AccountPaymentMethodPageLoadedEvent|AccountEditOrderPageLoadedEvent $event + ): void { $page = $event->getPage(); - if ( - !method_exists($page, 'getPaymentMethods') - || !method_exists($page, 'setPaymentMethods') - ) { - return; - } - if (!$this->customerHasCompanyAddress($event->getSalesChannelContext())) { return; } @@ -60,7 +53,7 @@ public function hidePaymentMethodsForCompanies(PageLoadedEvent $event): void private function removePaymentMethod(PaymentMethodCollection $paymentMethods, string $paymentMethodId): PaymentMethodCollection { return $paymentMethods->filter( - static fn(PaymentMethodEntity $paymentMethod) => $paymentMethod->getId() !== $paymentMethodId + static fn (PaymentMethodEntity $paymentMethod) => $paymentMethod->getId() !== $paymentMethodId ); } @@ -85,6 +78,6 @@ private function companyDataHandlingIsDisabled(SalesChannelContext $context): bo { $configuration = $this->configReader->read($context->getSalesChannel()->getId()); - return !((bool) $configuration->get('payolutionInvoicingTransferCompanyData')); + return !($configuration->get('payolutionInvoicingTransferCompanyData')); } } diff --git a/src/EventListener/CheckoutConfirmPaypalExpressEventListener.php b/src/EventListener/CheckoutConfirmPaypalExpressEventListener.php index bdd6a3495..ff9773092 100644 --- a/src/EventListener/CheckoutConfirmPaypalExpressEventListener.php +++ b/src/EventListener/CheckoutConfirmPaypalExpressEventListener.php @@ -10,7 +10,6 @@ use Shopware\Storefront\Page\Account\Order\AccountEditOrderPageLoadedEvent; use Shopware\Storefront\Page\Account\PaymentMethod\AccountPaymentMethodPageLoadedEvent; use Shopware\Storefront\Page\Checkout\Confirm\CheckoutConfirmPageLoadedEvent; -use Shopware\Storefront\Page\PageLoadedEvent; use Symfony\Component\EventDispatcher\EventSubscriberInterface; class CheckoutConfirmPaypalExpressEventListener implements EventSubscriberInterface @@ -24,11 +23,9 @@ public static function getSubscribedEvents(): array ]; } - /** - * @param AccountEditOrderPageLoadedEvent|AccountPaymentMethodPageLoadedEvent|CheckoutConfirmPageLoadedEvent $event - */ - public function hideInternalPaymentMethods(PageLoadedEvent $event): void - { + public function hideInternalPaymentMethods( + AccountEditOrderPageLoadedEvent|AccountPaymentMethodPageLoadedEvent|CheckoutConfirmPageLoadedEvent $event + ): void { $page = $event->getPage(); if ($event instanceof AccountEditOrderPageLoadedEvent) { diff --git a/src/EventListener/CheckoutConfirmRatepayEventListener.php b/src/EventListener/CheckoutConfirmRatepayEventListener.php index 1b5ab3bbc..3969d2e61 100644 --- a/src/EventListener/CheckoutConfirmRatepayEventListener.php +++ b/src/EventListener/CheckoutConfirmRatepayEventListener.php @@ -14,23 +14,20 @@ use Shopware\Core\Checkout\Payment\PaymentMethodEntity; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Shopware\Core\System\SystemConfig\SystemConfigService; +use Shopware\Storefront\Page\Account\Order\AccountEditOrderPage; use Shopware\Storefront\Page\Account\Order\AccountEditOrderPageLoadedEvent; use Shopware\Storefront\Page\Account\PaymentMethod\AccountPaymentMethodPageLoadedEvent; +use Shopware\Storefront\Page\Checkout\Confirm\CheckoutConfirmPage; use Shopware\Storefront\Page\Checkout\Confirm\CheckoutConfirmPageLoadedEvent; -use Shopware\Storefront\Page\Page; -use Shopware\Storefront\Page\PageLoadedEvent; use Symfony\Component\EventDispatcher\EventSubscriberInterface; class CheckoutConfirmRatepayEventListener implements EventSubscriberInterface { - protected SystemConfigService $systemConfigService; - public function __construct( - SystemConfigService $systemConfigService, + protected SystemConfigService $systemConfigService, protected InstallmentServiceInterface $installmentService, protected ProfileServiceInterface $profileService ) { - $this->systemConfigService = $systemConfigService; } public static function getSubscribedEvents(): array @@ -50,17 +47,11 @@ public static function getSubscribedEvents(): array ]; } - public function hidePaymentMethodsForCompanies(PageLoadedEvent $event): void - { + public function hidePaymentMethodsForCompanies( + CheckoutConfirmPageLoadedEvent|AccountEditOrderPageLoadedEvent|AccountPaymentMethodPageLoadedEvent $event + ): void { $page = $event->getPage(); - if ( - !method_exists($page, 'getPaymentMethods') - || !method_exists($page, 'setPaymentMethods') - ) { - return; - } - if (!$this->customerHasCompanyAddress($event->getSalesChannelContext())) { return; } @@ -70,17 +61,11 @@ public function hidePaymentMethodsForCompanies(PageLoadedEvent $event): void $page->setPaymentMethods($paymentMethods); } - public function hidePaymentMethodsByProfiles(PageLoadedEvent $event): void - { + public function hidePaymentMethodsByProfiles( + CheckoutConfirmPageLoadedEvent|AccountEditOrderPageLoadedEvent $event + ): void { $page = $event->getPage(); - if ( - !method_exists($page, 'getPaymentMethods') - || !method_exists($page, 'setPaymentMethods') - ) { - return; - } - $paymentMethods = $page->getPaymentMethods(); foreach (PaymentHandlerGroups::RATEPAY as $ratepayPaymentHandler) { @@ -97,9 +82,8 @@ public function hidePaymentMethodsByProfiles(PageLoadedEvent $event): void $page->setPaymentMethods($paymentMethods); } - public function addPayonePageData(PageLoadedEvent $event): void + public function addPayonePageData(CheckoutConfirmPageLoadedEvent|AccountEditOrderPageLoadedEvent $event): void { - /** @var Page $page */ $page = $event->getPage(); $context = $event->getSalesChannelContext(); @@ -111,7 +95,7 @@ public function addPayonePageData(PageLoadedEvent $event): void protected function removePaymentMethods(PaymentMethodCollection $paymentMethods, array $paymentHandler): PaymentMethodCollection { return $paymentMethods->filter( - static fn(PaymentMethodEntity $paymentMethod) => !\in_array($paymentMethod->getHandlerIdentifier(), $paymentHandler, true) + static fn (PaymentMethodEntity $paymentMethod) => !\in_array($paymentMethod->getHandlerIdentifier(), $paymentHandler, true) ); } @@ -132,15 +116,10 @@ protected function customerHasCompanyAddress(SalesChannelContext $context): bool return !empty($billingAddress->getCompany()); } - protected function addInstallmentCalculatorData(Page $page, SalesChannelContext $context): void - { - if ( - !method_exists($page, 'getPaymentMethods') - || !method_exists($page, 'setPaymentMethods') - ) { - return; - } - + protected function addInstallmentCalculatorData( + CheckoutConfirmPage|AccountEditOrderPage $page, + SalesChannelContext $context + ): void { $installmentCalculator = $this->installmentService->getInstallmentCalculatorData($context); if ($installmentCalculator === null) { diff --git a/src/EventListener/CheckoutConfirmSecuredInstallmentEventListener.php b/src/EventListener/CheckoutConfirmSecuredInstallmentEventListener.php index 89963fc51..5d4bf90c7 100644 --- a/src/EventListener/CheckoutConfirmSecuredInstallmentEventListener.php +++ b/src/EventListener/CheckoutConfirmSecuredInstallmentEventListener.php @@ -11,9 +11,8 @@ use Shopware\Core\Checkout\Payment\PaymentMethodCollection; use Shopware\Core\Checkout\Payment\PaymentMethodEntity; use Shopware\Core\System\SalesChannel\SalesChannelContext; +use Shopware\Storefront\Page\Checkout\Confirm\CheckoutConfirmPage; use Shopware\Storefront\Page\Checkout\Confirm\CheckoutConfirmPageLoadedEvent; -use Shopware\Storefront\Page\Page; -use Shopware\Storefront\Page\PageLoadedEvent; use Symfony\Component\EventDispatcher\EventSubscriberInterface; class CheckoutConfirmSecuredInstallmentEventListener implements EventSubscriberInterface @@ -31,9 +30,8 @@ public static function getSubscribedEvents(): array ]; } - public function addPayonePageData(PageLoadedEvent $event): void + public function addPayonePageData(CheckoutConfirmPageLoadedEvent $event): void { - /** @var Page $page */ $page = $event->getPage(); $context = $event->getSalesChannelContext(); @@ -42,13 +40,13 @@ public function addPayonePageData(PageLoadedEvent $event): void } } - protected function addInstallmentOptionsData(Page $page, SalesChannelContext $context): void + protected function addInstallmentOptionsData(CheckoutConfirmPage $page, SalesChannelContext $context): void { $installmentOptions = $this->installmentService->getInstallmentOptions($context); if (\count($installmentOptions->getOptions()) > 0) { $page->addExtension(SecuredInstallmentOptionsData::EXTENSION_NAME, $installmentOptions); - } elseif (method_exists($page, 'getPaymentMethods') && method_exists($page, 'setPaymentMethods')) { + } else { $page->setPaymentMethods( $this->removePaymentMethods( $page->getPaymentMethods(), @@ -61,7 +59,7 @@ protected function addInstallmentOptionsData(Page $page, SalesChannelContext $co protected function removePaymentMethods(PaymentMethodCollection $paymentMethods, array $paymentHandler): PaymentMethodCollection { return $paymentMethods->filter( - static fn(PaymentMethodEntity $paymentMethod) => !\in_array($paymentMethod->getHandlerIdentifier(), $paymentHandler, true) + static fn (PaymentMethodEntity $paymentMethod) => !\in_array($paymentMethod->getHandlerIdentifier(), $paymentHandler, true) ); } } diff --git a/src/EventListener/CheckoutConfirmTemplateEventListener.php b/src/EventListener/CheckoutConfirmTemplateEventListener.php index 0bbb5eb53..501da4fac 100644 --- a/src/EventListener/CheckoutConfirmTemplateEventListener.php +++ b/src/EventListener/CheckoutConfirmTemplateEventListener.php @@ -10,7 +10,6 @@ use Shopware\Core\Checkout\Payment\PaymentMethodEntity; use Shopware\Storefront\Page\Account\Order\AccountEditOrderPageLoadedEvent; use Shopware\Storefront\Page\Checkout\Confirm\CheckoutConfirmPageLoadedEvent; -use Shopware\Storefront\Page\PageLoadedEvent; use Symfony\Component\EventDispatcher\EventSubscriberInterface; class CheckoutConfirmTemplateEventListener implements EventSubscriberInterface @@ -23,7 +22,7 @@ public static function getSubscribedEvents(): array ]; } - public function addPayonePageData(PageLoadedEvent $event): void + public function addPayonePageData(CheckoutConfirmPageLoadedEvent|AccountEditOrderPageLoadedEvent $event): void { $page = $event->getPage(); $context = $event->getSalesChannelContext(); diff --git a/src/EventListener/CheckoutConfirmTrustlyEventListener.php b/src/EventListener/CheckoutConfirmTrustlyEventListener.php index d7f3d01bb..42f357cdd 100644 --- a/src/EventListener/CheckoutConfirmTrustlyEventListener.php +++ b/src/EventListener/CheckoutConfirmTrustlyEventListener.php @@ -42,11 +42,9 @@ public static function getSubscribedEvents(): array ]; } - /** - * @param AccountEditOrderPageLoadedEvent|AccountPaymentMethodPageLoadedEvent|CheckoutConfirmPageLoadedEvent $event - */ - public function hideTrustlyForDisallowedCountryCustomers($event): void - { + public function hideTrustlyForDisallowedCountryCustomers( + AccountEditOrderPageLoadedEvent|AccountPaymentMethodPageLoadedEvent|CheckoutConfirmPageLoadedEvent $event + ): void { $paymentMethods = $event->getPage()->getPaymentMethods(); if ( @@ -92,7 +90,7 @@ private function isAllowedCountryCustomer(SalesChannelContext $context): bool private function removePaymentMethod(PaymentMethodCollection $paymentMethods, string $paymentMethodId): PaymentMethodCollection { return $paymentMethods->filter( - static fn(PaymentMethodEntity $paymentMethod) => $paymentMethod->getId() !== $paymentMethodId + static fn (PaymentMethodEntity $paymentMethod) => $paymentMethod->getId() !== $paymentMethodId ); } } diff --git a/src/EventListener/CheckoutFinishEventListener.php b/src/EventListener/CheckoutFinishEventListener.php index 2b0d9f717..e0ee28aac 100644 --- a/src/EventListener/CheckoutFinishEventListener.php +++ b/src/EventListener/CheckoutFinishEventListener.php @@ -21,16 +21,10 @@ class CheckoutFinishEventListener implements EventSubscriberInterface { - private readonly EntityRepository $mandateRepository; - - private readonly EntityRepository $orderTransactionRepository; - public function __construct( - EntityRepository $mandateRepository, - EntityRepository $orderTransactionRepository + private readonly EntityRepository $mandateRepository, + private readonly EntityRepository $orderTransactionRepository ) { - $this->mandateRepository = $mandateRepository; - $this->orderTransactionRepository = $orderTransactionRepository; } public static function getSubscribedEvents(): array diff --git a/src/EventListener/DeviceFingerprintEventListener.php b/src/EventListener/DeviceFingerprintEventListener.php index 4ddf49d8a..a8e4e16a4 100644 --- a/src/EventListener/DeviceFingerprintEventListener.php +++ b/src/EventListener/DeviceFingerprintEventListener.php @@ -8,8 +8,6 @@ use PayonePayment\Storefront\Struct\DeviceFingerprintData; use Shopware\Storefront\Page\Account\Order\AccountEditOrderPageLoadedEvent; use Shopware\Storefront\Page\Checkout\Confirm\CheckoutConfirmPageLoadedEvent; -use Shopware\Storefront\Page\Page; -use Shopware\Storefront\Page\PageLoadedEvent; use Symfony\Component\EventDispatcher\EventSubscriberInterface; class DeviceFingerprintEventListener implements EventSubscriberInterface @@ -30,9 +28,8 @@ public static function getSubscribedEvents(): array ]; } - public function addDeviceFingerprintData(PageLoadedEvent $event): void + public function addDeviceFingerprintData(CheckoutConfirmPageLoadedEvent|AccountEditOrderPageLoadedEvent $event): void { - /** @var Page $page */ $page = $event->getPage(); $salesChannelContext = $event->getSalesChannelContext(); diff --git a/src/EventListener/KernelEventListener.php b/src/EventListener/KernelEventListener.php index cead3f173..5f2a17ff4 100644 --- a/src/EventListener/KernelEventListener.php +++ b/src/EventListener/KernelEventListener.php @@ -59,7 +59,7 @@ protected function setResponseData(JsonResponse $response, array $updateResults) $data = []; if ($response->getContent()) { - $data = json_decode((string) $response->getContent(), true, 512, JSON_THROW_ON_ERROR); + $data = json_decode((string) $response->getContent(), true, 512, \JSON_THROW_ON_ERROR); } $data['payoneRatepayProfilesUpdateResult'] = []; diff --git a/src/EventListener/OrderValidationEventListener.php b/src/EventListener/OrderValidationEventListener.php index 26473a013..31fa20ce2 100644 --- a/src/EventListener/OrderValidationEventListener.php +++ b/src/EventListener/OrderValidationEventListener.php @@ -16,14 +16,10 @@ class OrderValidationEventListener implements EventSubscriberInterface { - private readonly RequestStack $requestStack; - - private readonly PaymentHandlerRegistry $paymentHandlerRegistry; - - public function __construct(RequestStack $requestStack, PaymentHandlerRegistry $paymentHandlerRegistry) - { - $this->requestStack = $requestStack; - $this->paymentHandlerRegistry = $paymentHandlerRegistry; + public function __construct( + private readonly RequestStack $requestStack, + private readonly PaymentHandlerRegistry $paymentHandlerRegistry + ) { } public static function getSubscribedEvents(): array diff --git a/src/EventListener/PaypalExpressAddressValidationEventListener.php b/src/EventListener/PaypalExpressAddressValidationEventListener.php index a0dfe1355..0aafc0c30 100644 --- a/src/EventListener/PaypalExpressAddressValidationEventListener.php +++ b/src/EventListener/PaypalExpressAddressValidationEventListener.php @@ -14,16 +14,10 @@ class PaypalExpressAddressValidationEventListener implements EventSubscriberInterface { - private readonly RequestStack $requestStack; - - public function __construct(RequestStack $requestStack) + public function __construct(private readonly RequestStack $requestStack) { - $this->requestStack = $requestStack; } - /** - * {@inheritdoc} - */ public static function getSubscribedEvents(): array { return [ @@ -49,7 +43,7 @@ public function disableConfirmPageLoaderAddressValidation(BuildValidationEvent $ /** @var SalesChannelContext|null $salesChannelContext */ $salesChannelContext = $request->get('sw-sales-channel-context'); - if ($route === null || $route !== 'frontend.checkout.confirm.page') { + if ($route !== 'frontend.checkout.confirm.page') { return; } @@ -72,7 +66,7 @@ public function disableAdditionalAddressValidation(BuildValidationEvent $event): return; } - if (\mb_strpos((string) $request->getPathInfo(), '/payone/paypal/redirect-handler') === false) { + if (!\str_contains($request->getPathInfo(), '/payone/paypal/redirect-handler')) { return; } @@ -87,7 +81,7 @@ public function disableBirthdayValidation(BuildValidationEvent $event): void return; } - if (\mb_strpos((string) $request->getPathInfo(), '/payone/paypal/redirect-handler') === false) { + if (!\str_contains($request->getPathInfo(), '/payone/paypal/redirect-handler')) { return; } diff --git a/src/EventListener/RemovesPaymentMethod.php b/src/EventListener/RemovesPaymentMethod.php index 447866d01..e24ca6a6c 100644 --- a/src/EventListener/RemovesPaymentMethod.php +++ b/src/EventListener/RemovesPaymentMethod.php @@ -16,7 +16,7 @@ trait RemovesPaymentMethod protected function removePaymentMethod(PaymentMethodCollection $paymentMethods, string $paymentMethodId): PaymentMethodCollection { return $paymentMethods->filter( - static fn(PaymentMethodEntity $paymentMethod) => $paymentMethod->getId() !== $paymentMethodId + static fn (PaymentMethodEntity $paymentMethod) => $paymentMethod->getId() !== $paymentMethodId ); } } diff --git a/src/EventListener/StorefrontRenderEventListener.php b/src/EventListener/StorefrontRenderEventListener.php index acc8ac095..7e46ee298 100644 --- a/src/EventListener/StorefrontRenderEventListener.php +++ b/src/EventListener/StorefrontRenderEventListener.php @@ -21,17 +21,11 @@ class StorefrontRenderEventListener implements EventSubscriberInterface { - private readonly SalesChannelRepository $paymentMethodRepository; - - private readonly EntityRepository $salesChannelRepository; - public function __construct( private readonly CacheItemPoolInterface $cachePool, - SalesChannelRepository $repository, - EntityRepository $salesChannelRepository + private readonly SalesChannelRepository $paymentMethodRepository, + private readonly EntityRepository $salesChannelRepository ) { - $this->paymentMethodRepository = $repository; - $this->salesChannelRepository = $salesChannelRepository; } public static function getSubscribedEvents(): array diff --git a/src/Installer/ConfigInstaller.php b/src/Installer/ConfigInstaller.php index 60475a093..aa9e4b35f 100644 --- a/src/Installer/ConfigInstaller.php +++ b/src/Installer/ConfigInstaller.php @@ -4,7 +4,6 @@ namespace PayonePayment\Installer; -use Shopware\Core\Framework\Context; use Shopware\Core\Framework\Plugin\Context\ActivateContext; use Shopware\Core\Framework\Plugin\Context\DeactivateContext; use Shopware\Core\Framework\Plugin\Context\InstallContext; @@ -68,54 +67,36 @@ class ConfigInstaller implements InstallerInterface 'paymentStatusInvoice' => [self::STATE_MACHINE_TRANSITION_ACTION_PAY => StateMachineTransitionActions::ACTION_PAID], ]; - private readonly SystemConfigService $systemConfigService; - - public function __construct(SystemConfigService $systemConfigService) + public function __construct(private readonly SystemConfigService $systemConfigService) { - $this->systemConfigService = $systemConfigService; } - /** - * {@inheritdoc} - */ public function install(InstallContext $context): void { - $this->setDefaultValues($context->getContext()); + $this->setDefaultValues(); } - /** - * {@inheritdoc} - */ public function update(UpdateContext $context): void { - $this->setDefaultValues($context->getContext()); + $this->setDefaultValues(); } - /** - * {@inheritdoc} - */ public function uninstall(UninstallContext $context): void { // Nothing to do here } - /** - * {@inheritdoc} - */ public function activate(ActivateContext $context): void { // Nothing to do here } - /** - * {@inheritdoc} - */ public function deactivate(DeactivateContext $context): void { // Nothing to do here } - private function setDefaultValues(Context $context): void + private function setDefaultValues(): void { $domain = 'PayonePayment.settings.'; diff --git a/src/Installer/CustomFieldInstaller.php b/src/Installer/CustomFieldInstaller.php index f5a5f3e31..67641a8a0 100644 --- a/src/Installer/CustomFieldInstaller.php +++ b/src/Installer/CustomFieldInstaller.php @@ -25,19 +25,14 @@ class CustomFieldInstaller implements InstallerInterface final public const FIELDSET_ID_PAYMENT_METHOD = 'ed39626e94fd4dfe9d81976fdbcdb06c'; final public const FIELDSET_ID_CUSTOMER = '8e4a0b8f7eb04272ad874f3b22cf4935'; - private readonly EntityRepository $customFieldRepository; - - private readonly EntityRepository $customFieldSetRepository; - private readonly array $customFields; private readonly array $customFieldSets; - public function __construct(EntityRepository $customFieldSetRepository, EntityRepository $customFieldRepository) - { - $this->customFieldSetRepository = $customFieldSetRepository; - $this->customFieldRepository = $customFieldRepository; - + public function __construct( + private readonly EntityRepository $customFieldSetRepository, + private readonly EntityRepository $customFieldRepository + ) { $this->customFieldSets = [ [ 'id' => self::FIELDSET_ID_PAYMENT_METHOD, diff --git a/src/Installer/PaymentMethodInstaller.php b/src/Installer/PaymentMethodInstaller.php index 255079e31..156df8906 100644 --- a/src/Installer/PaymentMethodInstaller.php +++ b/src/Installer/PaymentMethodInstaller.php @@ -146,28 +146,13 @@ class PaymentMethodInstaller implements InstallerInterface PayonePostfinanceWallet::class, ]; - private readonly PluginIdProvider $pluginIdProvider; - - private readonly EntityRepository $paymentMethodRepository; - - private readonly EntityRepository $salesChannelRepository; - - private readonly EntityRepository $paymentMethodSalesChannelRepository; - - private readonly Connection $connection; - public function __construct( - PluginIdProvider $pluginIdProvider, - EntityRepository $paymentMethodRepository, - EntityRepository $salesChannelRepository, - EntityRepository $paymentMethodSalesChannelRepository, - Connection $connection + private readonly PluginIdProvider $pluginIdProvider, + private readonly EntityRepository $paymentMethodRepository, + private readonly EntityRepository $salesChannelRepository, + private readonly EntityRepository $paymentMethodSalesChannelRepository, + private readonly Connection $connection ) { - $this->pluginIdProvider = $pluginIdProvider; - $this->paymentMethodRepository = $paymentMethodRepository; - $this->salesChannelRepository = $salesChannelRepository; - $this->paymentMethodSalesChannelRepository = $paymentMethodSalesChannelRepository; - $this->connection = $connection; } public function install(InstallContext $context): void @@ -189,16 +174,8 @@ public function update(UpdateContext $context): void // before any update procedures take place otherwise we would have a duplicate payment method. // This is also the reason why a migration is not a viable way here. if ($this->findPaymentMethodEntity('0b532088e2da3092f9f7054ec4009d18', $context->getContext())) { - /** @phpstan-ignore-next-line */ - if (method_exists($this->connection, 'executeStatement')) { - $this->connection->executeStatement("UPDATE `payment_method` SET `id` = UNHEX('4e8a9d3d3c6e428887573856b38c9003') WHERE `id` = UNHEX('0b532088e2da3092f9f7054ec4009d18');"); - $this->connection->executeStatement("UPDATE `sales_channel` SET `payment_method_ids` = REPLACE(`payment_method_ids`, '0b532088e2da3092f9f7054ec4009d18', '4e8a9d3d3c6e428887573856b38c9003');"); - } elseif (method_exists($this->connection, 'exec')) { - /** @noinspection PhpDeprecationInspection */ - $this->connection->exec("UPDATE `payment_method` SET `id` = UNHEX('4e8a9d3d3c6e428887573856b38c9003') WHERE `id` = UNHEX('0b532088e2da3092f9f7054ec4009d18');"); - /** @noinspection PhpDeprecationInspection */ - $this->connection->exec("UPDATE `sales_channel` SET `payment_method_ids` = REPLACE(`payment_method_ids`, '0b532088e2da3092f9f7054ec4009d18', '4e8a9d3d3c6e428887573856b38c9003');"); - } + $this->connection->executeStatement("UPDATE `payment_method` SET `id` = UNHEX('4e8a9d3d3c6e428887573856b38c9003') WHERE `id` = UNHEX('0b532088e2da3092f9f7054ec4009d18');"); + $this->connection->executeStatement("UPDATE `sales_channel` SET `payment_method_ids` = REPLACE(`payment_method_ids`, '0b532088e2da3092f9f7054ec4009d18', '4e8a9d3d3c6e428887573856b38c9003');"); } foreach ($this->getPaymentMethods() as $paymentMethod) { diff --git a/src/Installer/RuleInstaller/RuleInstallerSecureInvoice.php b/src/Installer/RuleInstaller/RuleInstallerSecureInvoice.php index 50aa2091d..be1f1c772 100644 --- a/src/Installer/RuleInstaller/RuleInstallerSecureInvoice.php +++ b/src/Installer/RuleInstaller/RuleInstallerSecureInvoice.php @@ -18,6 +18,7 @@ use Shopware\Core\Framework\Plugin\Context\UninstallContext; use Shopware\Core\Framework\Plugin\Context\UpdateContext; use Shopware\Core\Framework\Rule\Container\AndRule; +use Shopware\Core\Framework\Rule\Rule; use Shopware\Core\Framework\Uuid\Uuid; use Shopware\Core\System\Currency\Rule\CurrencyRule; @@ -39,24 +40,12 @@ class RuleInstallerSecureInvoice implements InstallerInterface private const CONDITION_ID_CURRENCY = '6099e1e292f737aa31c126a73339c92e'; private const CONDITION_ID_DIFFERENT_ADDRESSES = 'f1a5251ffcd09b5dc0befc059dfad9c1'; - private readonly EntityRepository $ruleRepository; - - private readonly EntityRepository $countryRepository; - - private readonly EntityRepository $currencyRepository; - - private readonly EntityRepository $paymentMethodRepository; - public function __construct( - EntityRepository $ruleRepository, - EntityRepository $countryRepository, - EntityRepository $currencyRepository, - EntityRepository $paymentMethodRepository + private readonly EntityRepository $ruleRepository, + private readonly EntityRepository $countryRepository, + private readonly EntityRepository $currencyRepository, + private readonly EntityRepository $paymentMethodRepository ) { - $this->ruleRepository = $ruleRepository; - $this->countryRepository = $countryRepository; - $this->currencyRepository = $currencyRepository; - $this->paymentMethodRepository = $paymentMethodRepository; } public function install(InstallContext $context): void @@ -92,27 +81,27 @@ private function upsertAvailabilityRule(Context $context): void 'conditions' => [ [ 'id' => self::CONDITION_ID_AND, - 'type' => (new AndRule())->getName(), + 'type' => AndRule::RULE_NAME, 'children' => [ [ 'id' => self::CONDITION_ID_COUNTRY, - 'type' => (new BillingCountryRule())->getName(), + 'type' => BillingCountryRule::RULE_NAME, 'value' => [ - 'operator' => BillingCountryRule::OPERATOR_EQ, + 'operator' => Rule::OPERATOR_EQ, 'countryIds' => $this->getCountryIds($context), ], ], [ 'id' => self::CONDITION_ID_CURRENCY, - 'type' => (new CurrencyRule())->getName(), + 'type' => CurrencyRule::RULE_NAME, 'value' => [ - 'operator' => CurrencyRule::OPERATOR_EQ, + 'operator' => Rule::OPERATOR_EQ, 'currencyIds' => $this->getCurrencyIds($context), ], ], [ 'id' => self::CONDITION_ID_DIFFERENT_ADDRESSES, - 'type' => (new DifferentAddressesRule())->getName(), + 'type' => DifferentAddressesRule::RULE_NAME, 'value' => [ 'isDifferent' => false, ], @@ -168,14 +157,14 @@ private function getCountryIds(Context $context): array new EqualsAnyFilter('iso', self::VALID_COUNTRIES) ); - $countryIds = $this->countryRepository->searchIds($criteria, $context)->getIds(); + $result = $this->countryRepository->searchIds($criteria, $context); - if ((is_countable($countryIds) ? \count($countryIds) : 0) === 0) { + if ($result->getTotal() === 0) { // if country does not exist, enter invalid uuid so rule always fails. empty is not allowed return [Uuid::randomHex()]; } - return $countryIds; + return $result->getIds(); } private function getCurrencyIds(Context $context): array @@ -185,13 +174,13 @@ private function getCurrencyIds(Context $context): array new EqualsAnyFilter('isoCode', self::CURRENCIES) ); - $currencyIds = $this->currencyRepository->searchIds($criteria, $context)->getIds(); + $result = $this->currencyRepository->searchIds($criteria, $context); - if ((is_countable($currencyIds) ? \count($currencyIds) : 0) === 0) { + if ($result->getTotal() === 0) { // if currency does not exist, enter invalid uuid so rule always fails. empty is not allowed return [Uuid::randomHex()]; } - return $currencyIds; + return $result->getIds(); } } diff --git a/src/Migration/Migration1557926559AddTemporaryRedirectTable.php b/src/Migration/Migration1557926559AddTemporaryRedirectTable.php index 827cbab5b..ded61d992 100644 --- a/src/Migration/Migration1557926559AddTemporaryRedirectTable.php +++ b/src/Migration/Migration1557926559AddTemporaryRedirectTable.php @@ -24,18 +24,7 @@ public function update(Connection $connection): void ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; '; - /** @phpstan-ignore-next-line */ - if (method_exists($connection, 'executeStatement')) { - $connection->executeStatement($sql); - - return; - } - - /** @phpstan-ignore-next-line */ - if (method_exists($connection, 'exec')) { - /** @noinspection PhpDeprecationInspection */ - $connection->exec($sql); - } + $connection->executeStatement($sql); } public function updateDestructive(Connection $connection): void diff --git a/src/Migration/Migration1561379069AddPayonePaymentCardTable.php b/src/Migration/Migration1561379069AddPayonePaymentCardTable.php index aa7dfc15b..75fb1639a 100644 --- a/src/Migration/Migration1561379069AddPayonePaymentCardTable.php +++ b/src/Migration/Migration1561379069AddPayonePaymentCardTable.php @@ -41,18 +41,7 @@ public function update(Connection $connection): void ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci '; - /** @phpstan-ignore-next-line */ - if (method_exists($connection, 'executeStatement')) { - $connection->executeStatement($sql); - - return; - } - - /** @phpstan-ignore-next-line */ - if (method_exists($connection, 'exec')) { - /** @noinspection PhpDeprecationInspection */ - $connection->exec($sql); - } + $connection->executeStatement($sql); } public function updateDestructive(Connection $connection): void diff --git a/src/Migration/Migration1562097986AddPayonePaymentMandateTable.php b/src/Migration/Migration1562097986AddPayonePaymentMandateTable.php index be66d9aae..b5dfa4c91 100644 --- a/src/Migration/Migration1562097986AddPayonePaymentMandateTable.php +++ b/src/Migration/Migration1562097986AddPayonePaymentMandateTable.php @@ -39,18 +39,7 @@ public function update(Connection $connection): void ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci '; - /** @phpstan-ignore-next-line */ - if (method_exists($connection, 'executeStatement')) { - $connection->executeStatement($sql); - - return; - } - - /** @phpstan-ignore-next-line */ - if (method_exists($connection, 'exec')) { - /** @noinspection PhpDeprecationInspection */ - $connection->exec($sql); - } + $connection->executeStatement($sql); } public function updateDestructive(Connection $connection): void diff --git a/src/Migration/Migration1580996279AddRedirectTableCreatedDate.php b/src/Migration/Migration1580996279AddRedirectTableCreatedDate.php index d9f102157..f8d47a1c5 100644 --- a/src/Migration/Migration1580996279AddRedirectTableCreatedDate.php +++ b/src/Migration/Migration1580996279AddRedirectTableCreatedDate.php @@ -18,18 +18,7 @@ public function update(Connection $connection): void { $sql = 'ALTER TABLE `payone_payment_redirect` ADD `created_at` datetime(3) NULL;'; - /** @phpstan-ignore-next-line */ - if (method_exists($connection, 'executeStatement')) { - $connection->executeStatement($sql); - - return; - } - - /** @phpstan-ignore-next-line */ - if (method_exists($connection, 'exec')) { - /** @noinspection PhpDeprecationInspection */ - $connection->exec($sql); - } + $connection->executeStatement($sql); } public function updateDestructive(Connection $connection): void diff --git a/src/Migration/Migration1625137302AddNotificationForwardTable.php b/src/Migration/Migration1625137302AddNotificationForwardTable.php index 06318704f..32f7a811a 100644 --- a/src/Migration/Migration1625137302AddNotificationForwardTable.php +++ b/src/Migration/Migration1625137302AddNotificationForwardTable.php @@ -29,18 +29,7 @@ public function update(Connection $connection): void PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;'; - /** @phpstan-ignore-next-line */ - if (method_exists($connection, 'executeStatement')) { - $connection->executeStatement($sql); - - return; - } - - /** @phpstan-ignore-next-line */ - if (method_exists($connection, 'exec')) { - /** @noinspection PhpDeprecationInspection */ - $connection->exec($sql); - } + $connection->executeStatement($sql); } public function updateDestructive(Connection $connection): void diff --git a/src/Migration/Migration1625137302AddNotificationTargetTable.php b/src/Migration/Migration1625137302AddNotificationTargetTable.php index 6ba4d6a09..61f80d0d4 100644 --- a/src/Migration/Migration1625137302AddNotificationTargetTable.php +++ b/src/Migration/Migration1625137302AddNotificationTargetTable.php @@ -28,18 +28,7 @@ public function update(Connection $connection): void PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;'; - /** @phpstan-ignore-next-line */ - if (method_exists($connection, 'executeStatement')) { - $connection->executeStatement($sql); - - return; - } - - /** @phpstan-ignore-next-line */ - if (method_exists($connection, 'exec')) { - /** @noinspection PhpDeprecationInspection */ - $connection->exec($sql); - } + $connection->executeStatement($sql); } public function updateDestructive(Connection $connection): void diff --git a/src/Migration/Migration1637576753FixForeignKeyConstraints.php b/src/Migration/Migration1637576753FixForeignKeyConstraints.php index eaf94fbfd..94ec5f2e8 100644 --- a/src/Migration/Migration1637576753FixForeignKeyConstraints.php +++ b/src/Migration/Migration1637576753FixForeignKeyConstraints.php @@ -18,26 +18,12 @@ public function update(Connection $connection): void { $sql = 'ALTER TABLE payone_payment_card DROP FOREIGN KEY `fk.payone_payment_card.customer_id`;'; - /** @phpstan-ignore-next-line */ - if (method_exists($connection, 'executeStatement')) { - $connection->executeStatement($sql); - } elseif (method_exists($connection, 'exec')) { - /** method exec() is deprecated and will be removed in future doctrine releases */ - /** @noinspection PhpDeprecationInspection */ - $connection->exec($sql); - } + $connection->executeStatement($sql); $sql = 'ALTER TABLE payone_payment_card ADD CONSTRAINT `fk.payone_payment_card.customer_id` FOREIGN KEY (`customer_id`) REFERENCES `customer` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;'; - /** @phpstan-ignore-next-line */ - if (method_exists($connection, 'executeStatement')) { - $connection->executeStatement($sql); - } elseif (method_exists($connection, 'exec')) { - /** method exec() is deprecated and will be removed in future doctrine releases */ - /** @noinspection PhpDeprecationInspection */ - $connection->exec($sql); - } + $connection->executeStatement($sql); } public function updateDestructive(Connection $connection): void diff --git a/src/Migration/Migration1638289341AddOrderTransActionDataTable.php b/src/Migration/Migration1638289341AddOrderTransActionDataTable.php index 5d162d53d..e70e6e71c 100644 --- a/src/Migration/Migration1638289341AddOrderTransActionDataTable.php +++ b/src/Migration/Migration1638289341AddOrderTransActionDataTable.php @@ -49,13 +49,7 @@ public function update(Connection $connection): void CONSTRAINT `json.payone_payment_order_transaction_data.clearing_bank_account` CHECK (JSON_VALID(`clearing_bank_account`)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;'; - /** @phpstan-ignore-next-line */ - if (method_exists($connection, 'executeStatement')) { - $connection->executeStatement($sql); - } elseif (method_exists($connection, 'exec')) { - /** @noinspection PhpDeprecationInspection */ - $connection->exec($sql); - } + $connection->executeStatement($sql); } public function updateDestructive(Connection $connection): void diff --git a/src/Migration/Migration1639050658MigrateOrderTransactionDataFromCustomFields.php b/src/Migration/Migration1639050658MigrateOrderTransactionDataFromCustomFields.php index 27c321775..05bb38d15 100644 --- a/src/Migration/Migration1639050658MigrateOrderTransactionDataFromCustomFields.php +++ b/src/Migration/Migration1639050658MigrateOrderTransactionDataFromCustomFields.php @@ -59,13 +59,7 @@ public function update(Connection $connection): void try { $connection->beginTransaction(); - /** @phpstan-ignore-next-line */ - if (method_exists($connection, 'executeStatement')) { - $connection->executeStatement($sql); - } elseif (method_exists($connection, 'exec')) { - /** @noinspection PhpDeprecationInspection */ - $connection->exec($sql); - } + $connection->executeStatement($sql); $connection->commit(); } catch (\Throwable) { @@ -101,13 +95,7 @@ public function update(Connection $connection): void try { $connection->beginTransaction(); - /** @phpstan-ignore-next-line */ - if (method_exists($connection, 'executeStatement')) { - $connection->executeStatement($sql); - } elseif (method_exists($connection, 'exec')) { - /** @noinspection PhpDeprecationInspection */ - $connection->exec($sql); - } + $connection->executeStatement($sql); $connection->commit(); } catch (\Throwable) { diff --git a/src/Migration/Migration1666770470AddCardTypeToCardTable.php b/src/Migration/Migration1666770470AddCardTypeToCardTable.php index 4c3ab32da..05b68a3b7 100644 --- a/src/Migration/Migration1666770470AddCardTypeToCardTable.php +++ b/src/Migration/Migration1666770470AddCardTypeToCardTable.php @@ -18,18 +18,7 @@ public function update(Connection $connection): void { $sql = 'ALTER TABLE `payone_payment_card` ADD `card_type` VARCHAR(255) NOT NULL;'; - /** @phpstan-ignore-next-line */ - if (method_exists($connection, 'executeStatement')) { - $connection->executeStatement($sql); - - return; - } - - /** @phpstan-ignore-next-line */ - if (method_exists($connection, 'exec')) { - /** @noinspection PhpDeprecationInspection */ - $connection->exec($sql); - } + $connection->executeStatement($sql); } public function updateDestructive(Connection $connection): void diff --git a/src/PaymentHandler/AbstractAsynchronousPayonePaymentHandler.php b/src/PaymentHandler/AbstractAsynchronousPayonePaymentHandler.php new file mode 100644 index 000000000..a9334fd24 --- /dev/null +++ b/src/PaymentHandler/AbstractAsynchronousPayonePaymentHandler.php @@ -0,0 +1,154 @@ +validateRequestData($dataBag); + } catch (PayoneRequestException) { + $this->beforeException(); + + throw new AsyncPaymentProcessException( + $transaction->getOrderTransaction()->getId(), + $this->translator->trans('PayonePayment.errorMessages.genericError') + ); + } + + $paymentTransaction = PaymentTransaction::fromAsyncPaymentTransactionStruct($transaction, $transaction->getOrder()); + + $authorizationMethod = $this->getAuthorizationMethod( + $transaction->getOrder()->getSalesChannelId(), + $this->getConfigKeyPrefix() . 'AuthorizationMethod', + $this->getDefaultAuthorizationMethod() + ); + + $request = $this->requestParameterFactory->getRequestParameter( + new PaymentTransactionStruct( + $paymentTransaction, + $dataBag, + $salesChannelContext, + static::class, + $authorizationMethod + ) + ); + + try { + $response = $this->client->request($request); + } catch (PayoneRequestException $exception) { + $this->beforeException(); + + throw new AsyncPaymentProcessException( + $transaction->getOrderTransaction()->getId(), + $exception->getResponse()['error']['CustomerMessage'] + ); + } catch (\Throwable) { + $this->beforeException(); + + throw new AsyncPaymentProcessException( + $transaction->getOrderTransaction()->getId(), + $this->translator->trans('PayonePayment.errorMessages.genericError') + ); + } + + $this->handleResponse( + $transaction, + $paymentTransaction, + $dataBag, + $request, + $response, + $salesChannelContext + ); + + if ($this->deviceFingerprintService instanceof AbstractDeviceFingerprintService) { + $this->deviceFingerprintService->deleteDeviceIdentToken(); + } + + return $this->getRedirectResponse($request, $response); + } + + public function finalize( + AsyncPaymentTransactionStruct $transaction, + Request $request, + SalesChannelContext $salesChannelContext + ): void { + $this->stateHandler->handleStateResponse($transaction, (string) $request->query->get('state')); + } + + protected function beforeException(): void + { + if ($this->deviceFingerprintService instanceof AbstractDeviceFingerprintService) { + $this->deviceFingerprintService->deleteDeviceIdentToken(); + } + } + + protected function handleResponse( + AsyncPaymentTransactionStruct $transaction, + PaymentTransaction $paymentTransaction, + RequestDataBag $dataBag, + array $request, + array $response, + SalesChannelContext $salesChannelContext + ): void { + if (empty($response['status']) || $response['status'] !== 'REDIRECT') { + throw new AsyncPaymentProcessException( + $transaction->getOrderTransaction()->getId(), + $this->translator->trans('PayonePayment.errorMessages.genericError') + ); + } + + $data = $this->preparePayoneOrderTransactionData( + $request, + $response, + $this->getAdditionalTransactionData($dataBag, $request, $response) + ); + + $this->dataHandler->saveTransactionData($paymentTransaction, $salesChannelContext->getContext(), $data); + } + + protected function getRedirectResponse(array $request, array $response): RedirectResponse + { + return new RedirectResponse($response['redirecturl']); + } +} diff --git a/src/PaymentHandler/AbstractKlarnaPaymentHandler.php b/src/PaymentHandler/AbstractKlarnaPaymentHandler.php index 8ff3be2c8..f2fbd44f9 100644 --- a/src/PaymentHandler/AbstractKlarnaPaymentHandler.php +++ b/src/PaymentHandler/AbstractKlarnaPaymentHandler.php @@ -8,48 +8,48 @@ use PayonePayment\Components\ConfigReader\ConfigReaderInterface; use PayonePayment\Components\DataHandler\Transaction\TransactionDataHandlerInterface; use PayonePayment\Components\PaymentStateHandler\PaymentStateHandlerInterface; -use PayonePayment\Configuration\ConfigurationPrefixes; -use PayonePayment\Payone\Client\Exception\PayoneRequestException; use PayonePayment\Payone\Client\PayoneClientInterface; use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder; use PayonePayment\Payone\RequestParameter\RequestParameterFactory; -use PayonePayment\Payone\RequestParameter\Struct\PaymentTransactionStruct; -use PayonePayment\Struct\PaymentTransaction; use Shopware\Core\Checkout\Payment\Cart\AsyncPaymentTransactionStruct; -use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\AsynchronousPaymentHandlerInterface; use Shopware\Core\Checkout\Payment\Exception\AsyncPaymentProcessException; use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Symfony\Component\HttpFoundation\RedirectResponse; -use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Contracts\Translation\TranslatorInterface; -abstract class AbstractKlarnaPaymentHandler extends AbstractPayonePaymentHandler implements AsynchronousPaymentHandlerInterface +abstract class AbstractKlarnaPaymentHandler extends AbstractAsynchronousPayonePaymentHandler { - protected TranslatorInterface $translator; - public function __construct( ConfigReaderInterface $configReader, EntityRepository $lineItemRepository, RequestStack $requestStack, + PayoneClientInterface $client, TranslatorInterface $translator, - private readonly RequestParameterFactory $requestParameterFactory, - private readonly PayoneClientInterface $client, - private readonly TransactionDataHandlerInterface $dataHandler, - protected CartHasherInterface $cartHasher, - private readonly PaymentStateHandlerInterface $stateHandler + TransactionDataHandlerInterface $dataHandler, + PaymentStateHandlerInterface $stateHandler, + RequestParameterFactory $requestParameterFactory, + protected CartHasherInterface $cartHasher ) { - $this->configReader = $configReader; - $this->lineItemRepository = $lineItemRepository; - $this->requestStack = $requestStack; - $this->translator = $translator; - parent::__construct($configReader, $lineItemRepository, $requestStack); + parent::__construct( + $configReader, + $lineItemRepository, + $requestStack, + $client, + $translator, + $dataHandler, + $stateHandler, + $requestParameterFactory + ); } - public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $dataBag, SalesChannelContext $salesChannelContext): RedirectResponse - { + public function pay( + AsyncPaymentTransactionStruct $transaction, + RequestDataBag $dataBag, + SalesChannelContext $salesChannelContext + ): RedirectResponse { $this->cartHasher->validateRequest($dataBag, $transaction, $salesChannelContext); $authToken = $dataBag->get('payoneKlarnaAuthorizationToken'); @@ -61,63 +61,9 @@ public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $ ); } - $paymentTransaction = PaymentTransaction::fromAsyncPaymentTransactionStruct($transaction, $transaction->getOrder()); - - $authorizationMethod = $this->getAuthorizationMethod( - $transaction->getOrder()->getSalesChannelId(), - $this->getConfigKeyPrefix() . 'AuthorizationMethod', - AbstractRequestParameterBuilder::REQUEST_ACTION_PREAUTHORIZE - ); - - $request = $this->requestParameterFactory->getRequestParameter( - new PaymentTransactionStruct( - $paymentTransaction, - $this->filterRequestDataBag($dataBag), - $salesChannelContext, - static::class, - $authorizationMethod - ) - ); - - try { - $response = $this->client->request($request); - } catch (PayoneRequestException $exception) { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $exception->getResponse()['error']['CustomerMessage'], - $exception - ); - } catch (\Throwable $exception) { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError'), - $exception - ); - } - - if (empty($response['status']) || $response['status'] !== 'REDIRECT') { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } - - $data = $this->preparePayoneOrderTransactionData($request, $response, [ - 'clearingType' => AbstractPayonePaymentHandler::PAYONE_CLEARING_FNC, - ]); - $this->dataHandler->saveTransactionData($paymentTransaction, $salesChannelContext->getContext(), $data); - - return new RedirectResponse($response['redirecturl']); + return parent::pay($transaction, $this->filterRequestDataBag($dataBag), $salesChannelContext); } - public function finalize(AsyncPaymentTransactionStruct $transaction, Request $request, SalesChannelContext $salesChannelContext): void - { - $this->stateHandler->handleStateResponse($transaction, (string) $request->query->get('state')); - } - - /** - * {@inheritdoc} - */ public static function isCapturable(array $transactionData, array $payoneTransActionData): bool { if (static::isNeverCapturable($payoneTransActionData)) { @@ -127,9 +73,6 @@ public static function isCapturable(array $transactionData, array $payoneTransAc return static::isTransactionAppointedAndCompleted($transactionData) || static::matchesIsCapturableDefaults($transactionData); } - /** - * {@inheritdoc} - */ public static function isRefundable(array $transactionData): bool { if (static::isNeverRefundable($transactionData)) { @@ -139,9 +82,16 @@ public static function isRefundable(array $transactionData): bool return static::matchesIsRefundableDefaults($transactionData); } - protected function getConfigKeyPrefix(): string + protected function getDefaultAuthorizationMethod(): string + { + return AbstractRequestParameterBuilder::REQUEST_ACTION_PREAUTHORIZE; + } + + protected function getAdditionalTransactionData(RequestDataBag $dataBag, array $request, array $response): array { - return ConfigurationPrefixes::CONFIGURATION_PREFIXES[static::class]; + return [ + 'clearingType' => AbstractPayonePaymentHandler::PAYONE_CLEARING_FNC, + ]; } private function filterRequestDataBag(RequestDataBag $dataBag): RequestDataBag diff --git a/src/PaymentHandler/AbstractPayoneInvoicePaymentHandler.php b/src/PaymentHandler/AbstractPayoneInvoicePaymentHandler.php index 41f4372bf..ae8af8a83 100644 --- a/src/PaymentHandler/AbstractPayoneInvoicePaymentHandler.php +++ b/src/PaymentHandler/AbstractPayoneInvoicePaymentHandler.php @@ -4,87 +4,19 @@ namespace PayonePayment\PaymentHandler; -use PayonePayment\Components\ConfigReader\ConfigReaderInterface; -use PayonePayment\Components\DataHandler\Transaction\TransactionDataHandlerInterface; -use PayonePayment\Payone\Client\Exception\PayoneRequestException; -use PayonePayment\Payone\Client\PayoneClientInterface; -use PayonePayment\Payone\RequestParameter\RequestParameterFactory; -use PayonePayment\Payone\RequestParameter\Struct\PaymentTransactionStruct; -use PayonePayment\Struct\PaymentTransaction; -use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\SynchronousPaymentHandlerInterface; -use Shopware\Core\Checkout\Payment\Cart\SyncPaymentTransactionStruct; -use Shopware\Core\Checkout\Payment\Exception\SyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; +use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; -use Shopware\Core\System\SalesChannel\SalesChannelContext; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Contracts\Translation\TranslatorInterface; -abstract class AbstractPayoneInvoicePaymentHandler extends AbstractPayonePaymentHandler implements SynchronousPaymentHandlerInterface +abstract class AbstractPayoneInvoicePaymentHandler extends AbstractSynchronousPayonePaymentHandler { - private readonly TranslatorInterface $translator; - - public function __construct( - ConfigReaderInterface $configReader, - private readonly PayoneClientInterface $client, - TranslatorInterface $translator, - private readonly TransactionDataHandlerInterface $dataHandler, - EntityRepository $lineItemRepository, - RequestStack $requestStack, - private readonly RequestParameterFactory $requestParameterFactory - ) { - parent::__construct($configReader, $lineItemRepository, $requestStack); - $this->translator = $translator; + protected function getDefaultAuthorizationMethod(): string + { + return AbstractRequestParameterBuilder::REQUEST_ACTION_PREAUTHORIZE; } - /** - * {@inheritdoc} - */ - public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $dataBag, SalesChannelContext $salesChannelContext): void + protected function getAdditionalTransactionData(RequestDataBag $dataBag, array $request, array $response): array { - $requestData = $this->fetchRequestData(); - - // Get configured authorization method - $authorizationMethod = $this->getAuthorizationMethod( - $transaction->getOrder()->getSalesChannelId(), - $this->getConfigKey(), - 'preauthorization' - ); - - $paymentTransaction = PaymentTransaction::fromSyncPaymentTransactionStruct($transaction, $transaction->getOrder()); - - $request = $this->requestParameterFactory->getRequestParameter( - new PaymentTransactionStruct( - $paymentTransaction, - $requestData, - $salesChannelContext, - $this->getPaymentMethod(), - $authorizationMethod - ) - ); - - try { - $response = $this->client->request($request); - } catch (PayoneRequestException $exception) { - throw new SyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $exception->getResponse()['error']['CustomerMessage'] - ); - } catch (\Throwable) { - throw new SyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } - - if (empty($response['status']) || $response['status'] === 'ERROR') { - throw new SyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } - - $data = $this->preparePayoneOrderTransactionData($request, $response, [ + return [ 'captureMode' => AbstractPayonePaymentHandler::PAYONE_STATE_COMPLETED, // Set clearing type explicitly @@ -99,18 +31,6 @@ public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $d // as payment reference in context of the prepayment. 'Reference' => (string) $response['txid'], ]), - ]); - - $this->dataHandler->saveTransactionData($paymentTransaction, $salesChannelContext->getContext(), $data); + ]; } - - /** - * Returns the config key for self::getAuthorizationMethod() - */ - abstract protected function getConfigKey(): string; - - /** - * Returns the payment method for the request parameters - */ - abstract protected function getPaymentMethod(): string; } diff --git a/src/PaymentHandler/AbstractPayonePaymentHandler.php b/src/PaymentHandler/AbstractPayonePaymentHandler.php index f01b200d1..b60aed6e5 100644 --- a/src/PaymentHandler/AbstractPayonePaymentHandler.php +++ b/src/PaymentHandler/AbstractPayonePaymentHandler.php @@ -6,6 +6,7 @@ use PayonePayment\Components\ConfigReader\ConfigReaderInterface; use PayonePayment\Components\TransactionStatus\TransactionStatusService; +use PayonePayment\Configuration\ConfigurationPrefixes; use PayonePayment\Installer\CustomFieldInstaller; use Shopware\Core\Checkout\Order\Aggregate\OrderLineItem\OrderLineItemCollection; use Shopware\Core\Framework\Context; @@ -39,17 +40,11 @@ abstract class AbstractPayonePaymentHandler implements PayonePaymentHandlerInter final public const PAYONE_FINANCING_RPS = 'RPS'; final public const PAYONE_FINANCING_RPD = 'RPD'; - protected EntityRepository $lineItemRepository; - - protected RequestStack $requestStack; - public function __construct( protected ConfigReaderInterface $configReader, - EntityRepository $lineItemRepository, - RequestStack $requestStack + protected EntityRepository $lineItemRepository, + protected RequestStack $requestStack ) { - $this->lineItemRepository = $lineItemRepository; - $this->requestStack = $requestStack; } public function getValidationDefinitions(SalesChannelContext $salesChannelContext): array @@ -209,17 +204,6 @@ protected function setLineItemCustomFields(OrderLineItemCollection $lineItem, Co $this->lineItemRepository->update($saveData, $context); } - protected function fetchRequestData(): RequestDataBag - { - $request = $this->requestStack->getCurrentRequest(); - - if ($request === null) { - throw new \LogicException('missing current request'); - } - - return new RequestDataBag($request->request->all()); - } - protected function getMinimumDate(): \DateTimeInterface { return (new \DateTime())->modify('-18 years')->setTime(0, 0); @@ -241,4 +225,32 @@ protected function customerHasCompanyAddress(SalesChannelContext $salesChannelCo return !empty($billingAddress->getCompany()); } + + final protected function getConfigKeyPrefix(): string + { + return ConfigurationPrefixes::CONFIGURATION_PREFIXES[static::class]; + } + + /** + * Define this method to return either AbstractRequestParameterBuilder::REQUEST_ACTION_AUTHORIZE + * or AbstractRequestParameterBuilder::REQUEST_ACTION_PREAUTHORIZE that should be used as default authorization + * method if it is not configured by shop owner. + */ + abstract protected function getDefaultAuthorizationMethod(): string; + + /** + * Override this method to validate the posted data. Throw a PayoneRequestException if validation fails! + */ + protected function validateRequestData(RequestDataBag $dataBag): void + { + } + + /** + * Override this method to define additional transaction data that should be saved to the transaction + * data extension + */ + protected function getAdditionalTransactionData(RequestDataBag $dataBag, array $request, array $response): array + { + return []; + } } diff --git a/src/PaymentHandler/AbstractPostfinancePaymentHandler.php b/src/PaymentHandler/AbstractPostfinancePaymentHandler.php index d01a0c9c8..5dd6abbb4 100644 --- a/src/PaymentHandler/AbstractPostfinancePaymentHandler.php +++ b/src/PaymentHandler/AbstractPostfinancePaymentHandler.php @@ -4,103 +4,12 @@ namespace PayonePayment\PaymentHandler; -use PayonePayment\Components\ConfigReader\ConfigReaderInterface; -use PayonePayment\Components\DataHandler\Transaction\TransactionDataHandlerInterface; -use PayonePayment\Components\PaymentStateHandler\PaymentStateHandlerInterface; use PayonePayment\Components\TransactionStatus\TransactionStatusService; -use PayonePayment\Configuration\ConfigurationPrefixes; -use PayonePayment\Payone\Client\Exception\PayoneRequestException; -use PayonePayment\Payone\Client\PayoneClientInterface; use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder; -use PayonePayment\Payone\RequestParameter\RequestParameterFactory; -use PayonePayment\Payone\RequestParameter\Struct\PaymentTransactionStruct; -use PayonePayment\Struct\PaymentTransaction; -use Shopware\Core\Checkout\Payment\Cart\AsyncPaymentTransactionStruct; -use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\AsynchronousPaymentHandlerInterface; -use Shopware\Core\Checkout\Payment\Exception\AsyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; -use Shopware\Core\System\SalesChannel\SalesChannelContext; -use Symfony\Component\HttpFoundation\RedirectResponse; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Contracts\Translation\TranslatorInterface; -abstract class AbstractPostfinancePaymentHandler extends AbstractPayonePaymentHandler implements AsynchronousPaymentHandlerInterface +abstract class AbstractPostfinancePaymentHandler extends AbstractAsynchronousPayonePaymentHandler { - private readonly TranslatorInterface $translator; - - public function __construct( - ConfigReaderInterface $configReader, - EntityRepository $lineItemRepository, - private readonly PayoneClientInterface $client, - TranslatorInterface $translator, - private readonly TransactionDataHandlerInterface $dataHandler, - private readonly PaymentStateHandlerInterface $stateHandler, - RequestStack $requestStack, - private readonly RequestParameterFactory $requestParameterFactory - ) { - parent::__construct($configReader, $lineItemRepository, $requestStack); - $this->translator = $translator; - } - - public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $dataBag, SalesChannelContext $salesChannelContext): RedirectResponse - { - $paymentTransaction = PaymentTransaction::fromAsyncPaymentTransactionStruct($transaction, $transaction->getOrder()); - - $authorizationMethod = $this->getAuthorizationMethod( - $transaction->getOrder()->getSalesChannelId(), - $this->getConfigKeyPrefix() . 'AuthorizationMethod', - AbstractRequestParameterBuilder::REQUEST_ACTION_PREAUTHORIZE - ); - - $request = $this->requestParameterFactory->getRequestParameter( - new PaymentTransactionStruct( - $paymentTransaction, - $dataBag, - $salesChannelContext, - static::class, - $authorizationMethod - ) - ); - - try { - $response = $this->client->request($request); - } catch (PayoneRequestException $exception) { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $exception->getResponse()['error']['CustomerMessage'] - ); - } catch (\Throwable) { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } - - if (empty($response['status']) || $response['status'] !== 'REDIRECT') { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } - - $data = $this->preparePayoneOrderTransactionData($request, $response, [ - 'clearingType' => AbstractRequestParameterBuilder::CLEARING_TYPE_ONLINE_BANK_TRANSFER, - ]); - $this->dataHandler->saveTransactionData($paymentTransaction, $salesChannelContext->getContext(), $data); - - return new RedirectResponse($response['redirecturl']); - } - - public function finalize(AsyncPaymentTransactionStruct $transaction, Request $request, SalesChannelContext $salesChannelContext): void - { - $this->stateHandler->handleStateResponse($transaction, (string) $request->query->get('state')); - } - - /** - * {@inheritdoc} - */ public static function isCapturable(array $transactionData, array $payoneTransActionData): bool { if ($payoneTransActionData['authorizationType'] !== TransactionStatusService::AUTHORIZATION_TYPE_PREAUTHORIZATION) { @@ -110,20 +19,24 @@ public static function isCapturable(array $transactionData, array $payoneTransAc return strtolower((string) $transactionData['txaction']) === TransactionStatusService::ACTION_PAID; } - /** - * {@inheritdoc} - */ public static function isRefundable(array $transactionData): bool { - if (strtolower((string) $transactionData['txaction']) === TransactionStatusService::ACTION_CAPTURE && (float) $transactionData['receivable'] !== 0.0) { + if ((float) $transactionData['receivable'] !== 0.0 && strtolower((string) $transactionData['txaction']) === TransactionStatusService::ACTION_CAPTURE) { return true; } return strtolower((string) $transactionData['txaction']) === TransactionStatusService::ACTION_PAID; } - protected function getConfigKeyPrefix(): string + protected function getDefaultAuthorizationMethod(): string { - return ConfigurationPrefixes::CONFIGURATION_PREFIXES[static::class]; + return AbstractRequestParameterBuilder::REQUEST_ACTION_PREAUTHORIZE; + } + + protected function getAdditionalTransactionData(RequestDataBag $dataBag, array $request, array $response): array + { + return [ + 'clearingType' => AbstractRequestParameterBuilder::CLEARING_TYPE_ONLINE_BANK_TRANSFER, + ]; } } diff --git a/src/PaymentHandler/AbstractSynchronousPayonePaymentHandler.php b/src/PaymentHandler/AbstractSynchronousPayonePaymentHandler.php new file mode 100644 index 000000000..d1b0cfded --- /dev/null +++ b/src/PaymentHandler/AbstractSynchronousPayonePaymentHandler.php @@ -0,0 +1,135 @@ +validateRequestData($dataBag); + } catch (PayoneRequestException) { + $this->beforeException(); + + throw new SyncPaymentProcessException( + $transaction->getOrderTransaction()->getId(), + $this->translator->trans('PayonePayment.errorMessages.genericError') + ); + } + + $paymentTransaction = PaymentTransaction::fromSyncPaymentTransactionStruct($transaction, $transaction->getOrder()); + + $authorizationMethod = $this->getAuthorizationMethod( + $transaction->getOrder()->getSalesChannelId(), + $this->getConfigKeyPrefix() . 'AuthorizationMethod', + $this->getDefaultAuthorizationMethod() + ); + + $request = $this->requestParameterFactory->getRequestParameter( + new PaymentTransactionStruct( + $paymentTransaction, + $dataBag, + $salesChannelContext, + static::class, + $authorizationMethod + ) + ); + + try { + $response = $this->client->request($request); + } catch (PayoneRequestException $exception) { + $this->beforeException(); + + throw new SyncPaymentProcessException( + $transaction->getOrderTransaction()->getId(), + $exception->getResponse()['error']['CustomerMessage'] + ); + } catch (\Throwable) { + $this->beforeException(); + + throw new SyncPaymentProcessException( + $transaction->getOrderTransaction()->getId(), + $this->translator->trans('PayonePayment.errorMessages.genericError') + ); + } + + $this->handleResponse( + $transaction, + $paymentTransaction, + $dataBag, + $request, + $response, + $salesChannelContext + ); + + if ($this->deviceFingerprintService instanceof AbstractDeviceFingerprintService) { + $this->deviceFingerprintService->deleteDeviceIdentToken(); + } + } + + protected function beforeException(): void + { + if ($this->deviceFingerprintService instanceof AbstractDeviceFingerprintService) { + $this->deviceFingerprintService->deleteDeviceIdentToken(); + } + } + + protected function handleResponse( + SyncPaymentTransactionStruct $transaction, + PaymentTransaction $paymentTransaction, + RequestDataBag $dataBag, + array $request, + array $response, + SalesChannelContext $salesChannelContext + ): void { + if (empty($response['status']) || $response['status'] === 'ERROR') { + throw new SyncPaymentProcessException( + $transaction->getOrderTransaction()->getId(), + $this->translator->trans('PayonePayment.errorMessages.genericError') + ); + } + + $data = $this->preparePayoneOrderTransactionData( + $request, + $response, + $this->getAdditionalTransactionData($dataBag, $request, $response) + ); + + $this->dataHandler->saveTransactionData($paymentTransaction, $salesChannelContext->getContext(), $data); + } +} diff --git a/src/PaymentHandler/PayoneAlipayPaymentHandler.php b/src/PaymentHandler/PayoneAlipayPaymentHandler.php index 74c814dfe..dace790b1 100644 --- a/src/PaymentHandler/PayoneAlipayPaymentHandler.php +++ b/src/PaymentHandler/PayoneAlipayPaymentHandler.php @@ -4,113 +4,12 @@ namespace PayonePayment\PaymentHandler; -use PayonePayment\Components\ConfigReader\ConfigReaderInterface; -use PayonePayment\Components\DataHandler\Transaction\TransactionDataHandlerInterface; -use PayonePayment\Components\PaymentStateHandler\PaymentStateHandlerInterface; use PayonePayment\Components\TransactionStatus\TransactionStatusService; -use PayonePayment\Payone\Client\Exception\PayoneRequestException; -use PayonePayment\Payone\Client\PayoneClientInterface; -use PayonePayment\Payone\RequestParameter\RequestParameterFactory; -use PayonePayment\Payone\RequestParameter\Struct\PaymentTransactionStruct; -use PayonePayment\Struct\PaymentTransaction; -use Shopware\Core\Checkout\Payment\Cart\AsyncPaymentTransactionStruct; -use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\AsynchronousPaymentHandlerInterface; -use Shopware\Core\Checkout\Payment\Exception\AsyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; +use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; -use Shopware\Core\System\SalesChannel\SalesChannelContext; -use Symfony\Component\HttpFoundation\RedirectResponse; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Contracts\Translation\TranslatorInterface; -class PayoneAlipayPaymentHandler extends AbstractPayonePaymentHandler implements AsynchronousPaymentHandlerInterface +class PayoneAlipayPaymentHandler extends AbstractAsynchronousPayonePaymentHandler { - private readonly TranslatorInterface $translator; - - public function __construct( - ConfigReaderInterface $configReader, - EntityRepository $lineItemRepository, - private readonly PayoneClientInterface $client, - TranslatorInterface $translator, - private readonly TransactionDataHandlerInterface $dataHandler, - private readonly PaymentStateHandlerInterface $stateHandler, - RequestStack $requestStack, - private readonly RequestParameterFactory $requestParameterFactory - ) { - parent::__construct($configReader, $lineItemRepository, $requestStack); - $this->translator = $translator; - } - - /** - * {@inheritdoc} - */ - public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $dataBag, SalesChannelContext $salesChannelContext): RedirectResponse - { - $requestData = $this->fetchRequestData(); - - // Get configured authorization method - $authorizationMethod = $this->getAuthorizationMethod( - $transaction->getOrder()->getSalesChannelId(), - 'alipayAuthorizationMethod', - 'authorization' - ); - - $paymentTransaction = PaymentTransaction::fromAsyncPaymentTransactionStruct($transaction, $transaction->getOrder()); - - $request = $this->requestParameterFactory->getRequestParameter( - new PaymentTransactionStruct( - $paymentTransaction, - $requestData, - $salesChannelContext, - self::class, - $authorizationMethod - ) - ); - - try { - $response = $this->client->request($request); - } catch (PayoneRequestException $exception) { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $exception->getResponse()['error']['CustomerMessage'] - ); - } catch (\Throwable) { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } - - if (empty($response['status']) && $response['status'] !== 'REDIRECT') { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } - - $data = $this->preparePayoneOrderTransactionData($request, $response, [ - 'transactionState' => $response['status'], - 'allowCapture' => false, - 'allowRefund' => false, - ]); - - $this->dataHandler->saveTransactionData($paymentTransaction, $salesChannelContext->getContext(), $data); - - return new RedirectResponse($response['redirecturl']); - } - - /** - * {@inheritdoc} - */ - public function finalize(AsyncPaymentTransactionStruct $transaction, Request $request, SalesChannelContext $salesChannelContext): void - { - $this->stateHandler->handleStateResponse($transaction, (string) $request->query->get('state')); - } - - /** - * {@inheritdoc} - */ public static function isCapturable(array $transactionData, array $payoneTransActionData): bool { if ($payoneTransActionData['authorizationType'] !== TransactionStatusService::AUTHORIZATION_TYPE_PREAUTHORIZATION) { @@ -120,15 +19,26 @@ public static function isCapturable(array $transactionData, array $payoneTransAc return strtolower((string) $transactionData['txaction']) === TransactionStatusService::ACTION_PAID; } - /** - * {@inheritdoc} - */ public static function isRefundable(array $transactionData): bool { - if (strtolower((string) $transactionData['txaction']) === TransactionStatusService::ACTION_CAPTURE && (float) $transactionData['receivable'] !== 0.0) { + if ((float) $transactionData['receivable'] !== 0.0 && strtolower((string) $transactionData['txaction']) === TransactionStatusService::ACTION_CAPTURE) { return true; } return strtolower((string) $transactionData['txaction']) === TransactionStatusService::ACTION_PAID; } + + protected function getDefaultAuthorizationMethod(): string + { + return AbstractRequestParameterBuilder::REQUEST_ACTION_AUTHORIZE; + } + + protected function getAdditionalTransactionData(RequestDataBag $dataBag, array $request, array $response): array + { + return [ + 'transactionState' => $response['status'], + 'allowCapture' => false, + 'allowRefund' => false, + ]; + } } diff --git a/src/PaymentHandler/PayoneApplePayPaymentHandler.php b/src/PaymentHandler/PayoneApplePayPaymentHandler.php index 051d16b42..8d2b61b36 100644 --- a/src/PaymentHandler/PayoneApplePayPaymentHandler.php +++ b/src/PaymentHandler/PayoneApplePayPaymentHandler.php @@ -4,44 +4,21 @@ namespace PayonePayment\PaymentHandler; -use PayonePayment\Components\ConfigReader\ConfigReaderInterface; -use PayonePayment\Components\DataHandler\Transaction\TransactionDataHandlerInterface; -use PayonePayment\Payone\Client\PayoneClientInterface; +use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder; use PayonePayment\Struct\PaymentTransaction; -use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\SynchronousPaymentHandlerInterface; use Shopware\Core\Checkout\Payment\Cart\SyncPaymentTransactionStruct; use Shopware\Core\Checkout\Payment\Exception\SyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Contracts\Translation\TranslatorInterface; -class PayoneApplePayPaymentHandler extends AbstractPayonePaymentHandler implements SynchronousPaymentHandlerInterface +class PayoneApplePayPaymentHandler extends AbstractSynchronousPayonePaymentHandler { - protected TranslatorInterface $translator; - - public function __construct( - ConfigReaderInterface $configReader, - protected PayoneClientInterface $client, - TranslatorInterface $translator, - EntityRepository $lineItemRepository, - RequestStack $requestStack, - private readonly TransactionDataHandlerInterface $dataHandler - ) { - parent::__construct($configReader, $lineItemRepository, $requestStack); - $this->translator = $translator; - } - - /** - * {@inheritdoc} - */ - public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $dataBag, SalesChannelContext $salesChannelContext): void - { - $requestData = $this->fetchRequestData(); - - $configuration = $this->configReader->read($salesChannelContext->getSalesChannel()->getId()); - $response = json_decode((string) $requestData->get('response', '{}'), true, 512, JSON_THROW_ON_ERROR); + public function pay( + SyncPaymentTransactionStruct $transaction, + RequestDataBag $dataBag, + SalesChannelContext $salesChannelContext + ): void { + $response = json_decode((string) $dataBag->get('response', '{}'), true, 512, \JSON_THROW_ON_ERROR); if ($response === null || !\array_key_exists('status', $response) || !\array_key_exists('txid', $response)) { throw new SyncPaymentProcessException( @@ -59,17 +36,20 @@ public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $d $paymentTransaction = PaymentTransaction::fromSyncPaymentTransactionStruct($transaction, $transaction->getOrder()); + $authorizationMethod = $this->getAuthorizationMethod( + $transaction->getOrder()->getSalesChannelId(), + $this->getConfigKeyPrefix() . 'AuthorizationMethod', + $this->getDefaultAuthorizationMethod() + ); + $request = [ - 'request' => $configuration->getString('applePayAuthorizationMethod', 'preauthorization'), + 'request' => $authorizationMethod, ]; $data = $this->preparePayoneOrderTransactionData($request, $response); $this->dataHandler->saveTransactionData($paymentTransaction, $salesChannelContext->getContext(), $data); } - /** - * {@inheritdoc} - */ public static function isCapturable(array $transactionData, array $payoneTransActionData): bool { if (static::isNeverCapturable($payoneTransActionData)) { @@ -79,9 +59,6 @@ public static function isCapturable(array $transactionData, array $payoneTransAc return static::isTransactionAppointedAndCompleted($transactionData) || static::matchesIsCapturableDefaults($transactionData); } - /** - * {@inheritdoc} - */ public static function isRefundable(array $transactionData): bool { if (static::isNeverRefundable($transactionData)) { @@ -90,4 +67,9 @@ public static function isRefundable(array $transactionData): bool return static::matchesIsRefundableDefaults($transactionData); } + + protected function getDefaultAuthorizationMethod(): string + { + return AbstractRequestParameterBuilder::REQUEST_ACTION_PREAUTHORIZE; + } } diff --git a/src/PaymentHandler/PayoneBancontactPaymentHandler.php b/src/PaymentHandler/PayoneBancontactPaymentHandler.php index 3b927e25f..5c361400d 100644 --- a/src/PaymentHandler/PayoneBancontactPaymentHandler.php +++ b/src/PaymentHandler/PayoneBancontactPaymentHandler.php @@ -4,113 +4,12 @@ namespace PayonePayment\PaymentHandler; -use PayonePayment\Components\ConfigReader\ConfigReaderInterface; -use PayonePayment\Components\DataHandler\Transaction\TransactionDataHandlerInterface; -use PayonePayment\Components\PaymentStateHandler\PaymentStateHandlerInterface; use PayonePayment\Components\TransactionStatus\TransactionStatusService; -use PayonePayment\Payone\Client\Exception\PayoneRequestException; -use PayonePayment\Payone\Client\PayoneClientInterface; -use PayonePayment\Payone\RequestParameter\RequestParameterFactory; -use PayonePayment\Payone\RequestParameter\Struct\PaymentTransactionStruct; -use PayonePayment\Struct\PaymentTransaction; -use Shopware\Core\Checkout\Payment\Cart\AsyncPaymentTransactionStruct; -use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\AsynchronousPaymentHandlerInterface; -use Shopware\Core\Checkout\Payment\Exception\AsyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; +use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; -use Shopware\Core\System\SalesChannel\SalesChannelContext; -use Symfony\Component\HttpFoundation\RedirectResponse; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Contracts\Translation\TranslatorInterface; -class PayoneBancontactPaymentHandler extends AbstractPayonePaymentHandler implements AsynchronousPaymentHandlerInterface +class PayoneBancontactPaymentHandler extends AbstractAsynchronousPayonePaymentHandler { - private readonly TranslatorInterface $translator; - - public function __construct( - ConfigReaderInterface $configReader, - EntityRepository $lineItemRepository, - private readonly PayoneClientInterface $client, - TranslatorInterface $translator, - private readonly TransactionDataHandlerInterface $dataHandler, - private readonly PaymentStateHandlerInterface $stateHandler, - RequestStack $requestStack, - private readonly RequestParameterFactory $requestParameterFactory - ) { - parent::__construct($configReader, $lineItemRepository, $requestStack); - $this->translator = $translator; - } - - /** - * {@inheritdoc} - */ - public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $dataBag, SalesChannelContext $salesChannelContext): RedirectResponse - { - $requestData = $this->fetchRequestData(); - - // Get configured authorization method - $authorizationMethod = $this->getAuthorizationMethod( - $transaction->getOrder()->getSalesChannelId(), - 'bancontactAuthorizationMethod', - 'authorization' - ); - - $paymentTransaction = PaymentTransaction::fromAsyncPaymentTransactionStruct($transaction, $transaction->getOrder()); - - $request = $this->requestParameterFactory->getRequestParameter( - new PaymentTransactionStruct( - $paymentTransaction, - $requestData, - $salesChannelContext, - self::class, - $authorizationMethod - ) - ); - - try { - $response = $this->client->request($request); - } catch (PayoneRequestException $exception) { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $exception->getResponse()['error']['CustomerMessage'] - ); - } catch (\Throwable) { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } - - if (empty($response['status']) && $response['status'] !== 'REDIRECT') { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } - - $data = $this->preparePayoneOrderTransactionData($request, $response, [ - 'transactionState' => $response['status'], - 'allowCapture' => false, - 'allowRefund' => false, - ]); - - $this->dataHandler->saveTransactionData($paymentTransaction, $salesChannelContext->getContext(), $data); - - return new RedirectResponse($response['redirecturl']); - } - - /** - * {@inheritdoc} - */ - public function finalize(AsyncPaymentTransactionStruct $transaction, Request $request, SalesChannelContext $salesChannelContext): void - { - $this->stateHandler->handleStateResponse($transaction, (string) $request->query->get('state')); - } - - /** - * {@inheritdoc} - */ public static function isCapturable(array $transactionData, array $payoneTransActionData): bool { if ($payoneTransActionData['authorizationType'] !== TransactionStatusService::AUTHORIZATION_TYPE_PREAUTHORIZATION) { @@ -120,15 +19,26 @@ public static function isCapturable(array $transactionData, array $payoneTransAc return strtolower((string) $transactionData['txaction']) === TransactionStatusService::ACTION_PAID; } - /** - * {@inheritdoc} - */ public static function isRefundable(array $transactionData): bool { - if (strtolower((string) $transactionData['txaction']) === TransactionStatusService::ACTION_CAPTURE && (float) $transactionData['receivable'] !== 0.0) { + if ((float) $transactionData['receivable'] !== 0.0 && strtolower((string) $transactionData['txaction']) === TransactionStatusService::ACTION_CAPTURE) { return true; } return strtolower((string) $transactionData['txaction']) === TransactionStatusService::ACTION_PAID; } + + protected function getDefaultAuthorizationMethod(): string + { + return AbstractRequestParameterBuilder::REQUEST_ACTION_AUTHORIZE; + } + + protected function getAdditionalTransactionData(RequestDataBag $dataBag, array $request, array $response): array + { + return [ + 'transactionState' => $response['status'], + 'allowCapture' => false, + 'allowRefund' => false, + ]; + } } diff --git a/src/PaymentHandler/PayoneCreditCardPaymentHandler.php b/src/PaymentHandler/PayoneCreditCardPaymentHandler.php index 5f4385590..175345a1f 100644 --- a/src/PaymentHandler/PayoneCreditCardPaymentHandler.php +++ b/src/PaymentHandler/PayoneCreditCardPaymentHandler.php @@ -9,23 +9,20 @@ use PayonePayment\Components\DataHandler\Transaction\TransactionDataHandlerInterface; use PayonePayment\Components\PaymentStateHandler\PaymentStateHandlerInterface; use PayonePayment\Components\TransactionStatus\TransactionStatusService; -use PayonePayment\Payone\Client\Exception\PayoneRequestException; use PayonePayment\Payone\Client\PayoneClientInterface; +use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder; use PayonePayment\Payone\RequestParameter\RequestParameterFactory; -use PayonePayment\Payone\RequestParameter\Struct\PaymentTransactionStruct; use PayonePayment\Struct\PaymentTransaction; use Shopware\Core\Checkout\Payment\Cart\AsyncPaymentTransactionStruct; -use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\AsynchronousPaymentHandlerInterface; use Shopware\Core\Checkout\Payment\Exception\AsyncPaymentProcessException; use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Symfony\Component\HttpFoundation\RedirectResponse; -use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Contracts\Translation\TranslatorInterface; -class PayoneCreditCardPaymentHandler extends AbstractPayonePaymentHandler implements AsynchronousPaymentHandlerInterface +class PayoneCreditCardPaymentHandler extends AbstractAsynchronousPayonePaymentHandler { final public const REQUEST_PARAM_SAVE_CREDIT_CARD = 'saveCreditCard'; final public const REQUEST_PARAM_PSEUDO_CARD_PAN = 'pseudoCardPan'; @@ -34,57 +31,67 @@ class PayoneCreditCardPaymentHandler extends AbstractPayonePaymentHandler implem final public const REQUEST_PARAM_CARD_TYPE = 'cardType'; final public const REQUEST_PARAM_TRUNCATED_CARD_PAN = 'truncatedCardPan'; - protected TranslatorInterface $translator; - public function __construct( ConfigReaderInterface $configReader, - protected PayoneClientInterface $client, - TranslatorInterface $translator, - private readonly TransactionDataHandlerInterface $dataHandler, EntityRepository $lineItemRepository, - private readonly PaymentStateHandlerInterface $stateHandler, - private readonly CardRepositoryInterface $cardRepository, RequestStack $requestStack, - private readonly RequestParameterFactory $requestParameterFactory + PayoneClientInterface $client, + TranslatorInterface $translator, + TransactionDataHandlerInterface $dataHandler, + PaymentStateHandlerInterface $stateHandler, + RequestParameterFactory $requestParameterFactory, + protected CardRepositoryInterface $cardRepository ) { - parent::__construct($configReader, $lineItemRepository, $requestStack); - $this->translator = $translator; + parent::__construct( + $configReader, + $lineItemRepository, + $requestStack, + $client, + $translator, + $dataHandler, + $stateHandler, + $requestParameterFactory + ); } - /** - * {@inheritdoc} - */ - public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $dataBag, SalesChannelContext $salesChannelContext): RedirectResponse + public static function isCapturable(array $transactionData, array $payoneTransActionData): bool { - $requestData = $this->fetchRequestData(); + if (static::isNeverCapturable($payoneTransActionData)) { + return false; + } - // Get configured authorization method - $authorizationMethod = $this->getAuthorizationMethod( - $transaction->getOrder()->getSalesChannelId(), - 'creditCardAuthorizationMethod', - 'preauthorization' - ); + $txAction = isset($transactionData['txaction']) ? strtolower((string) $transactionData['txaction']) : null; - $paymentTransaction = PaymentTransaction::fromAsyncPaymentTransactionStruct($transaction, $transaction->getOrder()); + if ($txAction === TransactionStatusService::ACTION_APPOINTED) { + return true; + } - $request = $this->requestParameterFactory->getRequestParameter( - new PaymentTransactionStruct( - $paymentTransaction, - $requestData, - $salesChannelContext, - self::class, - $authorizationMethod - ) - ); + return static::matchesIsCapturableDefaults($transactionData); + } - try { - $response = $this->client->request($request); - } catch (PayoneRequestException $exception) { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $exception->getResponse()['error']['CustomerMessage'] - ); - } catch (\Throwable) { + public static function isRefundable(array $transactionData): bool + { + if (static::isNeverRefundable($transactionData)) { + return false; + } + + return static::matchesIsRefundableDefaults($transactionData); + } + + protected function getDefaultAuthorizationMethod(): string + { + return AbstractRequestParameterBuilder::REQUEST_ACTION_PREAUTHORIZE; + } + + protected function handleResponse( + AsyncPaymentTransactionStruct $transaction, + PaymentTransaction $paymentTransaction, + RequestDataBag $dataBag, + array $request, + array $response, + SalesChannelContext $salesChannelContext + ): void { + if (empty($response['status']) || $response['status'] === 'ERROR') { throw new AsyncPaymentProcessException( $transaction->getOrderTransaction()->getId(), $this->translator->trans('PayonePayment.errorMessages.genericError') @@ -92,14 +99,14 @@ public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $ } $customer = $salesChannelContext->getCustomer(); - $savedPseudoCardPan = $requestData->get(self::REQUEST_PARAM_SAVED_PSEUDO_CARD_PAN); + $savedPseudoCardPan = $dataBag->get(self::REQUEST_PARAM_SAVED_PSEUDO_CARD_PAN); if (empty($savedPseudoCardPan)) { - $truncatedCardPan = $requestData->get(self::REQUEST_PARAM_TRUNCATED_CARD_PAN); - $cardExpireDate = $requestData->get(self::REQUEST_PARAM_CARD_EXPIRE_DATE); - $pseudoCardPan = $requestData->get(self::REQUEST_PARAM_PSEUDO_CARD_PAN); - $cardType = $requestData->get(self::REQUEST_PARAM_CARD_TYPE); - $saveCreditCard = $requestData->get(self::REQUEST_PARAM_SAVE_CREDIT_CARD) === 'on'; + $truncatedCardPan = $dataBag->get(self::REQUEST_PARAM_TRUNCATED_CARD_PAN); + $cardExpireDate = $dataBag->get(self::REQUEST_PARAM_CARD_EXPIRE_DATE); + $pseudoCardPan = $dataBag->get(self::REQUEST_PARAM_PSEUDO_CARD_PAN); + $cardType = $dataBag->get(self::REQUEST_PARAM_CARD_TYPE); + $saveCreditCard = $dataBag->get(self::REQUEST_PARAM_SAVE_CREDIT_CARD) === 'on'; $expiresAt = \DateTime::createFromFormat('ym', $cardExpireDate); if (!empty($expiresAt) && $customer !== null && $saveCreditCard) { @@ -136,49 +143,14 @@ public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $ if ($paymentTransaction->getOrder()->getLineItems() !== null) { $this->setLineItemCustomFields($paymentTransaction->getOrder()->getLineItems(), $salesChannelContext->getContext()); } - - if (strtolower((string) $response['status']) === 'redirect') { - return new RedirectResponse($response['redirecturl']); - } - - return new RedirectResponse($request['successurl']); - } - - /** - * {@inheritdoc} - */ - public function finalize(AsyncPaymentTransactionStruct $transaction, Request $request, SalesChannelContext $salesChannelContext): void - { - $this->stateHandler->handleStateResponse($transaction, (string) $request->query->get('state')); - } - - /** - * {@inheritdoc} - */ - public static function isCapturable(array $transactionData, array $payoneTransActionData): bool - { - if (static::isNeverCapturable($payoneTransActionData)) { - return false; - } - - $txAction = isset($transactionData['txaction']) ? strtolower((string) $transactionData['txaction']) : null; - - if ($txAction === TransactionStatusService::ACTION_APPOINTED) { - return true; - } - - return static::matchesIsCapturableDefaults($transactionData); } - /** - * {@inheritdoc} - */ - public static function isRefundable(array $transactionData): bool + protected function getRedirectResponse(array $request, array $response): RedirectResponse { - if (static::isNeverRefundable($transactionData)) { - return false; + if (strtolower($response['status']) === 'redirect') { + return new RedirectResponse($response['redirecturl']); } - return static::matchesIsRefundableDefaults($transactionData); + return new RedirectResponse($request['successurl']); } } diff --git a/src/PaymentHandler/PayoneDebitPaymentHandler.php b/src/PaymentHandler/PayoneDebitPaymentHandler.php index fec3a8f6c..6577e03c7 100644 --- a/src/PaymentHandler/PayoneDebitPaymentHandler.php +++ b/src/PaymentHandler/PayoneDebitPaymentHandler.php @@ -8,90 +8,80 @@ use PayonePayment\Components\DataHandler\Transaction\TransactionDataHandlerInterface; use PayonePayment\Components\MandateService\MandateServiceInterface; use PayonePayment\Components\TransactionStatus\TransactionStatusService; -use PayonePayment\Payone\Client\Exception\PayoneRequestException; use PayonePayment\Payone\Client\PayoneClientInterface; +use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder; use PayonePayment\Payone\RequestParameter\RequestParameterFactory; -use PayonePayment\Payone\RequestParameter\Struct\PaymentTransactionStruct; use PayonePayment\Struct\PaymentTransaction; -use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\SynchronousPaymentHandlerInterface; use Shopware\Core\Checkout\Payment\Cart\SyncPaymentTransactionStruct; -use Shopware\Core\Checkout\Payment\Exception\SyncPaymentProcessException; use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Contracts\Translation\TranslatorInterface; -class PayoneDebitPaymentHandler extends AbstractPayonePaymentHandler implements SynchronousPaymentHandlerInterface +class PayoneDebitPaymentHandler extends AbstractSynchronousPayonePaymentHandler { final public const REQUEST_PARAM_SAVE_MANDATE = 'saveMandate'; - protected TranslatorInterface $translator; - public function __construct( ConfigReaderInterface $configReader, - protected PayoneClientInterface $client, - TranslatorInterface $translator, - private readonly TransactionDataHandlerInterface $dataHandler, EntityRepository $lineItemRepository, - private readonly MandateServiceInterface $mandateService, RequestStack $requestStack, - private readonly RequestParameterFactory $requestParameterFactory + PayoneClientInterface $client, + TranslatorInterface $translator, + TransactionDataHandlerInterface $dataHandler, + RequestParameterFactory $requestParameterFactory, + protected MandateServiceInterface $mandateService ) { - parent::__construct($configReader, $lineItemRepository, $requestStack); - $this->translator = $translator; + parent::__construct( + $configReader, + $lineItemRepository, + $requestStack, + $client, + $translator, + $dataHandler, + $requestParameterFactory + ); } - /** - * {@inheritdoc} - */ - public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $dataBag, SalesChannelContext $salesChannelContext): void + public static function isCapturable(array $transactionData, array $payoneTransActionData): bool { - $requestData = $this->fetchRequestData(); + if (static::isNeverCapturable($payoneTransActionData)) { + return false; + } - // Get configured authorization method - $authorizationMethod = $this->getAuthorizationMethod( - $transaction->getOrder()->getSalesChannelId(), - 'debitAuthorizationMethod', - 'authorization' - ); + $txAction = isset($transactionData['txaction']) ? strtolower((string) $transactionData['txaction']) : null; - $paymentTransaction = PaymentTransaction::fromSyncPaymentTransactionStruct($transaction, $transaction->getOrder()); + if ($txAction === TransactionStatusService::ACTION_APPOINTED) { + return true; + } - $request = $this->requestParameterFactory->getRequestParameter( - new PaymentTransactionStruct( - $paymentTransaction, - $requestData, - $salesChannelContext, - self::class, - $authorizationMethod - ) - ); + return static::matchesIsCapturableDefaults($transactionData); + } - try { - $response = $this->client->request($request); - } catch (PayoneRequestException $exception) { - throw new SyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $exception->getResponse()['error']['CustomerMessage'] - ); - } catch (\Throwable) { - throw new SyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); + public static function isRefundable(array $transactionData): bool + { + if (static::isNeverRefundable($transactionData)) { + return false; } - $data = $this->preparePayoneOrderTransactionData( - $request, - $response, - [ - 'transactionState' => AbstractPayonePaymentHandler::PAYONE_STATE_PENDING, - 'mandateIdentification' => $response['mandate']['Identification'], - ] - ); + return static::matchesIsRefundableDefaults($transactionData); + } - $this->dataHandler->saveTransactionData($paymentTransaction, $salesChannelContext->getContext(), $data); + protected function getDefaultAuthorizationMethod(): string + { + return AbstractRequestParameterBuilder::REQUEST_ACTION_PREAUTHORIZE; + } + + protected function handleResponse( + SyncPaymentTransactionStruct $transaction, + PaymentTransaction $paymentTransaction, + RequestDataBag $dataBag, + array $request, + array $response, + SalesChannelContext $salesChannelContext + ): void { + parent::handleResponse($transaction, $paymentTransaction, $dataBag, $request, $response, $salesChannelContext); $date = \DateTime::createFromFormat('Ymd', $response['mandate']['DateOfSignature']); @@ -99,16 +89,16 @@ public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $d throw new \LogicException('could not parse sepa mandate signature date'); } - $saveMandate = $requestData->get(self::REQUEST_PARAM_SAVE_MANDATE) === 'on'; + $saveMandate = $dataBag->get(self::REQUEST_PARAM_SAVE_MANDATE) === 'on'; - if ($salesChannelContext->getCustomer() !== null && $saveMandate) { + if ($saveMandate && $salesChannelContext->getCustomer() !== null) { $this->mandateService->saveMandate( $salesChannelContext->getCustomer(), $response['mandate']['Identification'], $date, $salesChannelContext ); - } elseif ($salesChannelContext->getCustomer() !== null && !$saveMandate) { + } elseif (!$saveMandate && $salesChannelContext->getCustomer() !== null) { $this->mandateService->removeAllMandatesForCustomer( $salesChannelContext->getCustomer(), $salesChannelContext @@ -116,33 +106,11 @@ public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $d } } - /** - * {@inheritdoc} - */ - public static function isCapturable(array $transactionData, array $payoneTransActionData): bool - { - if (static::isNeverCapturable($payoneTransActionData)) { - return false; - } - - $txAction = isset($transactionData['txaction']) ? strtolower((string) $transactionData['txaction']) : null; - - if ($txAction === TransactionStatusService::ACTION_APPOINTED) { - return true; - } - - return static::matchesIsCapturableDefaults($transactionData); - } - - /** - * {@inheritdoc} - */ - public static function isRefundable(array $transactionData): bool + protected function getAdditionalTransactionData(RequestDataBag $dataBag, array $request, array $response): array { - if (static::isNeverRefundable($transactionData)) { - return false; - } - - return static::matchesIsRefundableDefaults($transactionData); + return [ + 'transactionState' => AbstractPayonePaymentHandler::PAYONE_STATE_PENDING, + 'mandateIdentification' => $response['mandate']['Identification'], + ]; } } diff --git a/src/PaymentHandler/PayoneEpsPaymentHandler.php b/src/PaymentHandler/PayoneEpsPaymentHandler.php index d064337dc..9d14ec188 100644 --- a/src/PaymentHandler/PayoneEpsPaymentHandler.php +++ b/src/PaymentHandler/PayoneEpsPaymentHandler.php @@ -4,27 +4,12 @@ namespace PayonePayment\PaymentHandler; -use PayonePayment\Components\ConfigReader\ConfigReaderInterface; -use PayonePayment\Components\DataHandler\Transaction\TransactionDataHandlerInterface; -use PayonePayment\Components\PaymentStateHandler\PaymentStateHandlerInterface; use PayonePayment\Components\TransactionStatus\TransactionStatusService; use PayonePayment\Payone\Client\Exception\PayoneRequestException; -use PayonePayment\Payone\Client\PayoneClientInterface; -use PayonePayment\Payone\RequestParameter\RequestParameterFactory; -use PayonePayment\Payone\RequestParameter\Struct\PaymentTransactionStruct; -use PayonePayment\Struct\PaymentTransaction; -use Shopware\Core\Checkout\Payment\Cart\AsyncPaymentTransactionStruct; -use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\AsynchronousPaymentHandlerInterface; -use Shopware\Core\Checkout\Payment\Exception\AsyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; +use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; -use Shopware\Core\System\SalesChannel\SalesChannelContext; -use Symfony\Component\HttpFoundation\RedirectResponse; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Contracts\Translation\TranslatorInterface; -class PayoneEpsPaymentHandler extends AbstractPayonePaymentHandler implements AsynchronousPaymentHandlerInterface +class PayoneEpsPaymentHandler extends AbstractAsynchronousPayonePaymentHandler { /** * Valid iDEAL bank groups according to: @@ -62,95 +47,6 @@ class PayoneEpsPaymentHandler extends AbstractPayonePaymentHandler implements As 'EPS_VKB', ]; - private readonly TranslatorInterface $translator; - - public function __construct( - ConfigReaderInterface $configReader, - EntityRepository $lineItemRepository, - private readonly PayoneClientInterface $client, - TranslatorInterface $translator, - private readonly TransactionDataHandlerInterface $dataHandler, - private readonly PaymentStateHandlerInterface $stateHandler, - RequestStack $requestStack, - private readonly RequestParameterFactory $requestParameterFactory - ) { - parent::__construct($configReader, $lineItemRepository, $requestStack); - $this->translator = $translator; - } - - /** - * {@inheritdoc} - */ - public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $dataBag, SalesChannelContext $salesChannelContext): RedirectResponse - { - $requestData = $this->fetchRequestData(); - - // Get configured authorization method - $authorizationMethod = $this->getAuthorizationMethod( - $transaction->getOrder()->getSalesChannelId(), - 'epsAuthorizationMethod', - 'authorization' - ); - - $paymentTransaction = PaymentTransaction::fromAsyncPaymentTransactionStruct($transaction, $transaction->getOrder()); - - try { - $this->validate($requestData); - } catch (PayoneRequestException) { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } - - $request = $this->requestParameterFactory->getRequestParameter( - new PaymentTransactionStruct( - $paymentTransaction, - $requestData, - $salesChannelContext, - self::class, - $authorizationMethod - ) - ); - - try { - $response = $this->client->request($request); - } catch (PayoneRequestException $exception) { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $exception->getResponse()['error']['CustomerMessage'] - ); - } catch (\Throwable) { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } - - if (empty($response['status']) && $response['status'] !== 'REDIRECT') { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } - - $data = $this->preparePayoneOrderTransactionData($request, $response); - $this->dataHandler->saveTransactionData($paymentTransaction, $salesChannelContext->getContext(), $data); - - return new RedirectResponse($response['redirecturl']); - } - - /** - * {@inheritdoc} - */ - public function finalize(AsyncPaymentTransactionStruct $transaction, Request $request, SalesChannelContext $salesChannelContext): void - { - $this->stateHandler->handleStateResponse($transaction, (string) $request->query->get('state')); - } - - /** - * {@inheritdoc} - */ public static function isCapturable(array $transactionData, array $payoneTransActionData): bool { if (static::isNeverCapturable($payoneTransActionData)) { @@ -166,9 +62,6 @@ public static function isCapturable(array $transactionData, array $payoneTransAc return static::matchesIsCapturableDefaults($transactionData); } - /** - * {@inheritdoc} - */ public static function isRefundable(array $transactionData): bool { if (static::isNeverRefundable($transactionData)) { @@ -181,7 +74,7 @@ public static function isRefundable(array $transactionData): bool /** * @throws PayoneRequestException */ - private function validate(RequestDataBag $dataBag): void + protected function validateRequestData(RequestDataBag $dataBag): void { $bankGroup = $dataBag->get('epsBankGroup'); @@ -189,4 +82,9 @@ private function validate(RequestDataBag $dataBag): void throw new PayoneRequestException('No valid EPS bank group'); } } + + protected function getDefaultAuthorizationMethod(): string + { + return AbstractRequestParameterBuilder::REQUEST_ACTION_AUTHORIZE; + } } diff --git a/src/PaymentHandler/PayoneIDealPaymentHandler.php b/src/PaymentHandler/PayoneIDealPaymentHandler.php index c1c5101a8..d5b5dc5e7 100644 --- a/src/PaymentHandler/PayoneIDealPaymentHandler.php +++ b/src/PaymentHandler/PayoneIDealPaymentHandler.php @@ -4,27 +4,12 @@ namespace PayonePayment\PaymentHandler; -use PayonePayment\Components\ConfigReader\ConfigReaderInterface; -use PayonePayment\Components\DataHandler\Transaction\TransactionDataHandlerInterface; -use PayonePayment\Components\PaymentStateHandler\PaymentStateHandlerInterface; use PayonePayment\Components\TransactionStatus\TransactionStatusService; use PayonePayment\Payone\Client\Exception\PayoneRequestException; -use PayonePayment\Payone\Client\PayoneClientInterface; -use PayonePayment\Payone\RequestParameter\RequestParameterFactory; -use PayonePayment\Payone\RequestParameter\Struct\PaymentTransactionStruct; -use PayonePayment\Struct\PaymentTransaction; -use Shopware\Core\Checkout\Payment\Cart\AsyncPaymentTransactionStruct; -use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\AsynchronousPaymentHandlerInterface; -use Shopware\Core\Checkout\Payment\Exception\AsyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; +use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; -use Shopware\Core\System\SalesChannel\SalesChannelContext; -use Symfony\Component\HttpFoundation\RedirectResponse; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Contracts\Translation\TranslatorInterface; -class PayoneIDealPaymentHandler extends AbstractPayonePaymentHandler implements AsynchronousPaymentHandlerInterface +class PayoneIDealPaymentHandler extends AbstractAsynchronousPayonePaymentHandler { /** * Valid iDEAL bank groups according to: @@ -45,95 +30,6 @@ class PayoneIDealPaymentHandler extends AbstractPayonePaymentHandler implements 'YOURSAFE', ]; - private readonly TranslatorInterface $translator; - - public function __construct( - ConfigReaderInterface $configReader, - EntityRepository $lineItemRepository, - private readonly PayoneClientInterface $client, - TranslatorInterface $translator, - private readonly TransactionDataHandlerInterface $dataHandler, - private readonly PaymentStateHandlerInterface $stateHandler, - RequestStack $requestStack, - private readonly RequestParameterFactory $requestParameterFactory - ) { - parent::__construct($configReader, $lineItemRepository, $requestStack); - $this->translator = $translator; - } - - /** - * {@inheritdoc} - */ - public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $dataBag, SalesChannelContext $salesChannelContext): RedirectResponse - { - $requestData = $this->fetchRequestData(); - - // Get configured authorization method - $authorizationMethod = $this->getAuthorizationMethod( - $transaction->getOrder()->getSalesChannelId(), - 'iDealAuthorizationMethod', - 'authorization' - ); - - $paymentTransaction = PaymentTransaction::fromAsyncPaymentTransactionStruct($transaction, $transaction->getOrder()); - - try { - $this->validate($requestData); - } catch (PayoneRequestException) { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } - - $request = $this->requestParameterFactory->getRequestParameter( - new PaymentTransactionStruct( - $paymentTransaction, - $requestData, - $salesChannelContext, - self::class, - $authorizationMethod - ) - ); - - try { - $response = $this->client->request($request); - } catch (PayoneRequestException $exception) { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $exception->getResponse()['error']['CustomerMessage'] - ); - } catch (\Throwable) { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } - - if (empty($response['status']) && $response['status'] !== 'REDIRECT') { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } - - $data = $this->preparePayoneOrderTransactionData($request, $response); - $this->dataHandler->saveTransactionData($paymentTransaction, $salesChannelContext->getContext(), $data); - - return new RedirectResponse($response['redirecturl']); - } - - /** - * {@inheritdoc} - */ - public function finalize(AsyncPaymentTransactionStruct $transaction, Request $request, SalesChannelContext $salesChannelContext): void - { - $this->stateHandler->handleStateResponse($transaction, (string) $request->query->get('state')); - } - - /** - * {@inheritdoc} - */ public static function isCapturable(array $transactionData, array $payoneTransActionData): bool { if (static::isNeverCapturable($payoneTransActionData)) { @@ -149,9 +45,6 @@ public static function isCapturable(array $transactionData, array $payoneTransAc return static::matchesIsCapturableDefaults($transactionData); } - /** - * {@inheritdoc} - */ public static function isRefundable(array $transactionData): bool { if (static::isNeverRefundable($transactionData)) { @@ -164,7 +57,7 @@ public static function isRefundable(array $transactionData): bool /** * @throws PayoneRequestException */ - private function validate(RequestDataBag $dataBag): void + protected function validateRequestData(RequestDataBag $dataBag): void { $bankGroup = $dataBag->get('idealBankGroup'); @@ -172,4 +65,9 @@ private function validate(RequestDataBag $dataBag): void throw new PayoneRequestException('No valid iDEAL bank group'); } } + + protected function getDefaultAuthorizationMethod(): string + { + return AbstractRequestParameterBuilder::REQUEST_ACTION_AUTHORIZE; + } } diff --git a/src/PaymentHandler/PayoneKlarnaDirectDebitPaymentHandler.php b/src/PaymentHandler/PayoneKlarnaDirectDebitPaymentHandler.php index 10f9296c2..a2ca37ae8 100644 --- a/src/PaymentHandler/PayoneKlarnaDirectDebitPaymentHandler.php +++ b/src/PaymentHandler/PayoneKlarnaDirectDebitPaymentHandler.php @@ -4,8 +4,6 @@ namespace PayonePayment\PaymentHandler; -use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\AsynchronousPaymentHandlerInterface; - -class PayoneKlarnaDirectDebitPaymentHandler extends AbstractKlarnaPaymentHandler implements AsynchronousPaymentHandlerInterface +class PayoneKlarnaDirectDebitPaymentHandler extends AbstractKlarnaPaymentHandler { } diff --git a/src/PaymentHandler/PayoneKlarnaInstallmentPaymentHandler.php b/src/PaymentHandler/PayoneKlarnaInstallmentPaymentHandler.php index 1be53fd1b..7a1cbc12a 100644 --- a/src/PaymentHandler/PayoneKlarnaInstallmentPaymentHandler.php +++ b/src/PaymentHandler/PayoneKlarnaInstallmentPaymentHandler.php @@ -4,8 +4,6 @@ namespace PayonePayment\PaymentHandler; -use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\AsynchronousPaymentHandlerInterface; - -class PayoneKlarnaInstallmentPaymentHandler extends AbstractKlarnaPaymentHandler implements AsynchronousPaymentHandlerInterface +class PayoneKlarnaInstallmentPaymentHandler extends AbstractKlarnaPaymentHandler { } diff --git a/src/PaymentHandler/PayoneOpenInvoicePaymentHandler.php b/src/PaymentHandler/PayoneOpenInvoicePaymentHandler.php index 31a38e9fd..e067ebef9 100644 --- a/src/PaymentHandler/PayoneOpenInvoicePaymentHandler.php +++ b/src/PaymentHandler/PayoneOpenInvoicePaymentHandler.php @@ -6,9 +6,6 @@ class PayoneOpenInvoicePaymentHandler extends AbstractPayoneInvoicePaymentHandler { - /** - * {@inheritdoc} - */ public static function isCapturable(array $transactionData, array $payoneTransActionData): bool { if (static::isNeverCapturable($payoneTransActionData)) { @@ -18,9 +15,6 @@ public static function isCapturable(array $transactionData, array $payoneTransAc return static::isTransactionAppointedAndCompleted($transactionData) || static::matchesIsCapturableDefaults($transactionData); } - /** - * {@inheritdoc} - */ public static function isRefundable(array $transactionData): bool { if (static::isNeverRefundable($transactionData)) { @@ -29,20 +23,4 @@ public static function isRefundable(array $transactionData): bool return static::matchesIsRefundableDefaults($transactionData); } - - /** - * {@inheritdoc} - */ - protected function getConfigKey(): string - { - return 'openInvoiceAuthorizationMethod'; - } - - /** - * {@inheritdoc} - */ - protected function getPaymentMethod(): string - { - return self::class; - } } diff --git a/src/PaymentHandler/PayonePaydirektPaymentHandler.php b/src/PaymentHandler/PayonePaydirektPaymentHandler.php index 94264a7e4..0cbfd8e93 100644 --- a/src/PaymentHandler/PayonePaydirektPaymentHandler.php +++ b/src/PaymentHandler/PayonePaydirektPaymentHandler.php @@ -4,106 +4,11 @@ namespace PayonePayment\PaymentHandler; -use PayonePayment\Components\ConfigReader\ConfigReaderInterface; -use PayonePayment\Components\DataHandler\Transaction\TransactionDataHandlerInterface; -use PayonePayment\Components\PaymentStateHandler\PaymentStateHandlerInterface; use PayonePayment\Components\TransactionStatus\TransactionStatusService; -use PayonePayment\Payone\Client\Exception\PayoneRequestException; -use PayonePayment\Payone\Client\PayoneClientInterface; -use PayonePayment\Payone\RequestParameter\RequestParameterFactory; -use PayonePayment\Payone\RequestParameter\Struct\PaymentTransactionStruct; -use PayonePayment\Struct\PaymentTransaction; -use Shopware\Core\Checkout\Payment\Cart\AsyncPaymentTransactionStruct; -use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\AsynchronousPaymentHandlerInterface; -use Shopware\Core\Checkout\Payment\Exception\AsyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; -use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; -use Shopware\Core\System\SalesChannel\SalesChannelContext; -use Symfony\Component\HttpFoundation\RedirectResponse; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Contracts\Translation\TranslatorInterface; +use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder; -class PayonePaydirektPaymentHandler extends AbstractPayonePaymentHandler implements AsynchronousPaymentHandlerInterface +class PayonePaydirektPaymentHandler extends AbstractAsynchronousPayonePaymentHandler { - private readonly TranslatorInterface $translator; - - public function __construct( - ConfigReaderInterface $configReader, - EntityRepository $lineItemRepository, - private readonly PayoneClientInterface $client, - TranslatorInterface $translator, - private readonly TransactionDataHandlerInterface $dataHandler, - private readonly PaymentStateHandlerInterface $stateHandler, - RequestStack $requestStack, - private readonly RequestParameterFactory $requestParameterFactory - ) { - parent::__construct($configReader, $lineItemRepository, $requestStack); - $this->translator = $translator; - } - - /** - * {@inheritdoc} - */ - public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $dataBag, SalesChannelContext $salesChannelContext): RedirectResponse - { - // Get configured authorization method - $authorizationMethod = $this->getAuthorizationMethod( - $transaction->getOrder()->getSalesChannelId(), - 'paydirektAuthorizationMethod', - 'authorization' - ); - - $paymentTransaction = PaymentTransaction::fromAsyncPaymentTransactionStruct($transaction, $transaction->getOrder()); - - $request = $this->requestParameterFactory->getRequestParameter( - new PaymentTransactionStruct( - $paymentTransaction, - $dataBag, - $salesChannelContext, - self::class, - $authorizationMethod - ) - ); - - try { - $response = $this->client->request($request); - } catch (PayoneRequestException $exception) { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $exception->getResponse()['error']['CustomerMessage'] - ); - } catch (\Throwable) { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } - - if (empty($response['status']) && $response['status'] !== 'REDIRECT') { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } - - $data = $this->preparePayoneOrderTransactionData($request, $response); - $this->dataHandler->saveTransactionData($paymentTransaction, $salesChannelContext->getContext(), $data); - - return new RedirectResponse($response['redirecturl']); - } - - /** - * {@inheritdoc} - */ - public function finalize(AsyncPaymentTransactionStruct $transaction, Request $request, SalesChannelContext $salesChannelContext): void - { - $this->stateHandler->handleStateResponse($transaction, (string) $request->query->get('state')); - } - - /** - * {@inheritdoc} - */ public static function isCapturable(array $transactionData, array $payoneTransActionData): bool { if (static::isNeverCapturable($payoneTransActionData)) { @@ -119,9 +24,6 @@ public static function isCapturable(array $transactionData, array $payoneTransAc return static::matchesIsCapturableDefaults($transactionData); } - /** - * {@inheritdoc} - */ public static function isRefundable(array $transactionData): bool { if (static::isNeverRefundable($transactionData)) { @@ -130,4 +32,9 @@ public static function isRefundable(array $transactionData): bool return static::matchesIsRefundableDefaults($transactionData); } + + protected function getDefaultAuthorizationMethod(): string + { + return AbstractRequestParameterBuilder::REQUEST_ACTION_AUTHORIZE; + } } diff --git a/src/PaymentHandler/PayonePayolutionDebitPaymentHandler.php b/src/PaymentHandler/PayonePayolutionDebitPaymentHandler.php index c008be4d8..95198a7ba 100644 --- a/src/PaymentHandler/PayonePayolutionDebitPaymentHandler.php +++ b/src/PaymentHandler/PayonePayolutionDebitPaymentHandler.php @@ -4,42 +4,12 @@ namespace PayonePayment\PaymentHandler; -use PayonePayment\Components\ConfigReader\ConfigReaderInterface; -use PayonePayment\Components\DataHandler\Transaction\TransactionDataHandlerInterface; use PayonePayment\Payone\Client\Exception\PayoneRequestException; -use PayonePayment\Payone\Client\PayoneClientInterface; -use PayonePayment\Payone\RequestParameter\RequestParameterFactory; -use PayonePayment\Payone\RequestParameter\Struct\PaymentTransactionStruct; -use PayonePayment\Struct\PaymentTransaction; -use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\SynchronousPaymentHandlerInterface; -use Shopware\Core\Checkout\Payment\Cart\SyncPaymentTransactionStruct; -use Shopware\Core\Checkout\Payment\Exception\SyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; +use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; -use Shopware\Core\System\SalesChannel\SalesChannelContext; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Contracts\Translation\TranslatorInterface; -class PayonePayolutionDebitPaymentHandler extends AbstractPayonePaymentHandler implements SynchronousPaymentHandlerInterface +class PayonePayolutionDebitPaymentHandler extends AbstractSynchronousPayonePaymentHandler { - protected TranslatorInterface $translator; - - public function __construct( - ConfigReaderInterface $configReader, - protected PayoneClientInterface $client, - TranslatorInterface $translator, - private readonly TransactionDataHandlerInterface $dataHandler, - EntityRepository $lineItemRepository, - RequestStack $requestStack, - private readonly RequestParameterFactory $requestParameterFactory - ) { - parent::__construct($configReader, $lineItemRepository, $requestStack); - $this->translator = $translator; - } - - /** - * {@inheritdoc} - */ public static function isCapturable(array $transactionData, array $payoneTransActionData): bool { if (static::isNeverCapturable($payoneTransActionData)) { @@ -49,9 +19,6 @@ public static function isCapturable(array $transactionData, array $payoneTransAc return static::isTransactionAppointedAndCompleted($transactionData) || static::matchesIsCapturableDefaults($transactionData); } - /** - * {@inheritdoc} - */ public static function isRefundable(array $transactionData): bool { if (static::isNeverRefundable($transactionData)) { @@ -61,84 +28,30 @@ public static function isRefundable(array $transactionData): bool return static::matchesIsRefundableDefaults($transactionData); } - /** - * {@inheritdoc} - */ - public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $dataBag, SalesChannelContext $salesChannelContext): void + protected function validateRequestData(RequestDataBag $dataBag): void { - $requestData = $this->fetchRequestData(); - - // Get configured authorization method - $authorizationMethod = $this->getAuthorizationMethod( - $transaction->getOrder()->getSalesChannelId(), - 'payolutionDebitAuthorizationMethod', - 'preauthorization' - ); - - $paymentTransaction = PaymentTransaction::fromSyncPaymentTransactionStruct($transaction, $transaction->getOrder()); - - try { - $this->validate($requestData); - } catch (PayoneRequestException) { - throw new SyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); + if ($dataBag->get('payolutionConsent') !== 'on') { + throw new PayoneRequestException('No payolutionConsent'); } - $request = $this->requestParameterFactory->getRequestParameter( - new PaymentTransactionStruct( - $paymentTransaction, - $requestData, - $salesChannelContext, - self::class, - $authorizationMethod - ) - ); - - try { - $response = $this->client->request($request); - } catch (PayoneRequestException $exception) { - throw new SyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $exception->getResponse()['error']['CustomerMessage'] - ); - } catch (\Throwable) { - throw new SyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); + if ($dataBag->get('payolutionMandate') !== 'on') { + throw new PayoneRequestException('No payolutionMandate'); } + } - if (empty($response['status']) || $response['status'] === 'ERROR') { - throw new SyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } + protected function getDefaultAuthorizationMethod(): string + { + return AbstractRequestParameterBuilder::REQUEST_ACTION_PREAUTHORIZE; + } - $data = $this->preparePayoneOrderTransactionData($request, $response, [ - 'workOrderId' => $requestData->get('workorder'), + protected function getAdditionalTransactionData(RequestDataBag $dataBag, array $request, array $response): array + { + return [ + 'workOrderId' => $dataBag->get('workorder'), 'clearingReference' => $response['addpaydata']['clearing_reference'], 'captureMode' => AbstractPayonePaymentHandler::PAYONE_STATE_COMPLETED, 'clearingType' => AbstractPayonePaymentHandler::PAYONE_CLEARING_FNC, 'financingType' => AbstractPayonePaymentHandler::PAYONE_FINANCING_PYD, - ]); - - $this->dataHandler->saveTransactionData($paymentTransaction, $salesChannelContext->getContext(), $data); - } - - /** - * @throws PayoneRequestException - */ - private function validate(RequestDataBag $dataBag): void - { - if ($dataBag->get('payolutionConsent') !== 'on') { - throw new PayoneRequestException('No payolutionConsent'); - } - - if ($dataBag->get('payolutionMandate') !== 'on') { - throw new PayoneRequestException('No payolutionMandate'); - } + ]; } } diff --git a/src/PaymentHandler/PayonePayolutionInstallmentPaymentHandler.php b/src/PaymentHandler/PayonePayolutionInstallmentPaymentHandler.php index eb4a41951..da2ee0402 100644 --- a/src/PaymentHandler/PayonePayolutionInstallmentPaymentHandler.php +++ b/src/PaymentHandler/PayonePayolutionInstallmentPaymentHandler.php @@ -9,14 +9,10 @@ use PayonePayment\Components\DataHandler\Transaction\TransactionDataHandlerInterface; use PayonePayment\Components\Validator\Birthday; use PayonePayment\Components\Validator\PaymentMethod; -use PayonePayment\Payone\Client\Exception\PayoneRequestException; use PayonePayment\Payone\Client\PayoneClientInterface; +use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder; use PayonePayment\Payone\RequestParameter\RequestParameterFactory; -use PayonePayment\Payone\RequestParameter\Struct\PaymentTransactionStruct; -use PayonePayment\Struct\PaymentTransaction; -use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\SynchronousPaymentHandlerInterface; use Shopware\Core\Checkout\Payment\Cart\SyncPaymentTransactionStruct; -use Shopware\Core\Checkout\Payment\Exception\SyncPaymentProcessException; use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; @@ -24,82 +20,37 @@ use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Contracts\Translation\TranslatorInterface; -class PayonePayolutionInstallmentPaymentHandler extends AbstractPayonePaymentHandler implements SynchronousPaymentHandlerInterface +class PayonePayolutionInstallmentPaymentHandler extends AbstractSynchronousPayonePaymentHandler { - private readonly TranslatorInterface $translator; - public function __construct( ConfigReaderInterface $configReader, - private readonly PayoneClientInterface $client, - TranslatorInterface $translator, - private readonly TransactionDataHandlerInterface $dataHandler, EntityRepository $lineItemRepository, - protected CartHasherInterface $cartHasher, RequestStack $requestStack, - private readonly RequestParameterFactory $requestParameterFactory + PayoneClientInterface $client, + TranslatorInterface $translator, + TransactionDataHandlerInterface $dataHandler, + RequestParameterFactory $requestParameterFactory, + protected CartHasherInterface $cartHasher ) { - parent::__construct($configReader, $lineItemRepository, $requestStack); - $this->translator = $translator; + parent::__construct( + $configReader, + $lineItemRepository, + $requestStack, + $client, + $translator, + $dataHandler, + $requestParameterFactory + ); } - /** - * {@inheritdoc} - */ - public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $dataBag, SalesChannelContext $salesChannelContext): void - { - $requestData = $this->fetchRequestData(); - + public function pay( + SyncPaymentTransactionStruct $transaction, + RequestDataBag $dataBag, + SalesChannelContext $salesChannelContext + ): void { $this->cartHasher->validateRequest($dataBag, $transaction, $salesChannelContext); - // Get configured authorization method - $authorizationMethod = $this->getAuthorizationMethod( - $transaction->getOrder()->getSalesChannelId(), - 'payolutionInstallmentAuthorizationMethod', - 'authorization' - ); - - $paymentTransaction = PaymentTransaction::fromSyncPaymentTransactionStruct($transaction, $transaction->getOrder()); - - $request = $this->requestParameterFactory->getRequestParameter( - new PaymentTransactionStruct( - $paymentTransaction, - $requestData, - $salesChannelContext, - self::class, - $authorizationMethod - ) - ); - - try { - $response = $this->client->request($request); - } catch (PayoneRequestException $exception) { - throw new SyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $exception->getResponse()['error']['CustomerMessage'] - ); - } catch (\Throwable) { - throw new SyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } - - if (empty($response['status']) || $response['status'] === 'ERROR') { - throw new SyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } - - $data = $this->preparePayoneOrderTransactionData($request, $response, [ - 'workOrderId' => $requestData->get('workorder'), - 'clearingReference' => $response['clearing']['Reference'], - 'captureMode' => AbstractPayonePaymentHandler::PAYONE_STATE_COMPLETED, - 'clearingType' => AbstractPayonePaymentHandler::PAYONE_CLEARING_FNC, - 'financingType' => AbstractPayonePaymentHandler::PAYONE_FINANCING_PYS, - ]); - - $this->dataHandler->saveTransactionData($paymentTransaction, $salesChannelContext->getContext(), $data); + parent::pay($transaction, $dataBag, $salesChannelContext); } public function getValidationDefinitions(SalesChannelContext $salesChannelContext): array @@ -116,9 +67,6 @@ public function getValidationDefinitions(SalesChannelContext $salesChannelContex return $definitions; } - /** - * {@inheritdoc} - */ public static function isCapturable(array $transactionData, array $payoneTransActionData): bool { if (static::isNeverCapturable($payoneTransActionData)) { @@ -128,9 +76,6 @@ public static function isCapturable(array $transactionData, array $payoneTransAc return static::isTransactionAppointedAndCompleted($transactionData) || static::matchesIsCapturableDefaults($transactionData); } - /** - * {@inheritdoc} - */ public static function isRefundable(array $transactionData): bool { if (static::isNeverRefundable($transactionData)) { @@ -139,4 +84,20 @@ public static function isRefundable(array $transactionData): bool return static::matchesIsRefundableDefaults($transactionData); } + + protected function getDefaultAuthorizationMethod(): string + { + return AbstractRequestParameterBuilder::REQUEST_ACTION_AUTHORIZE; + } + + protected function getAdditionalTransactionData(RequestDataBag $dataBag, array $request, array $response): array + { + return [ + 'workOrderId' => $dataBag->get('workorder'), + 'clearingReference' => $response['clearing']['Reference'], + 'captureMode' => AbstractPayonePaymentHandler::PAYONE_STATE_COMPLETED, + 'clearingType' => AbstractPayonePaymentHandler::PAYONE_CLEARING_FNC, + 'financingType' => AbstractPayonePaymentHandler::PAYONE_FINANCING_PYS, + ]; + } } diff --git a/src/PaymentHandler/PayonePayolutionInvoicingPaymentHandler.php b/src/PaymentHandler/PayonePayolutionInvoicingPaymentHandler.php index 26cfa6d8b..021bdadc7 100644 --- a/src/PaymentHandler/PayonePayolutionInvoicingPaymentHandler.php +++ b/src/PaymentHandler/PayonePayolutionInvoicingPaymentHandler.php @@ -4,100 +4,15 @@ namespace PayonePayment\PaymentHandler; -use PayonePayment\Components\ConfigReader\ConfigReaderInterface; -use PayonePayment\Components\DataHandler\Transaction\TransactionDataHandlerInterface; use PayonePayment\Components\Validator\Birthday; use PayonePayment\Components\Validator\PaymentMethod; -use PayonePayment\Payone\Client\Exception\PayoneRequestException; -use PayonePayment\Payone\Client\PayoneClientInterface; -use PayonePayment\Payone\RequestParameter\RequestParameterFactory; -use PayonePayment\Payone\RequestParameter\Struct\PaymentTransactionStruct; -use PayonePayment\Struct\PaymentTransaction; -use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\SynchronousPaymentHandlerInterface; -use Shopware\Core\Checkout\Payment\Cart\SyncPaymentTransactionStruct; -use Shopware\Core\Checkout\Payment\Exception\SyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; +use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; -use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\Validator\Constraints\NotBlank; -use Symfony\Contracts\Translation\TranslatorInterface; -class PayonePayolutionInvoicingPaymentHandler extends AbstractPayonePaymentHandler implements SynchronousPaymentHandlerInterface +class PayonePayolutionInvoicingPaymentHandler extends AbstractSynchronousPayonePaymentHandler { - private readonly TranslatorInterface $translator; - - public function __construct( - ConfigReaderInterface $configReader, - private readonly PayoneClientInterface $client, - TranslatorInterface $translator, - private readonly TransactionDataHandlerInterface $dataHandler, - EntityRepository $lineItemRepository, - RequestStack $requestStack, - private readonly RequestParameterFactory $requestParameterFactory - ) { - parent::__construct($configReader, $lineItemRepository, $requestStack); - $this->translator = $translator; - } - - /** - * {@inheritdoc} - */ - public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $dataBag, SalesChannelContext $salesChannelContext): void - { - $requestData = $this->fetchRequestData(); - - // Get configured authorization method - $authorizationMethod = $this->getAuthorizationMethod( - $transaction->getOrder()->getSalesChannelId(), - 'payolutionInvoicingAuthorizationMethod', - 'preauthorization' - ); - - $paymentTransaction = PaymentTransaction::fromSyncPaymentTransactionStruct($transaction, $transaction->getOrder()); - - $request = $this->requestParameterFactory->getRequestParameter( - new PaymentTransactionStruct( - $paymentTransaction, - $requestData, - $salesChannelContext, - self::class, - $authorizationMethod - ) - ); - - try { - $response = $this->client->request($request); - } catch (PayoneRequestException $exception) { - throw new SyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $exception->getResponse()['error']['CustomerMessage'] - ); - } catch (\Throwable) { - throw new SyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } - - if (empty($response['status']) || $response['status'] === 'ERROR') { - throw new SyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } - - $data = $this->preparePayoneOrderTransactionData($request, $response, [ - 'workOrderId' => $requestData->get('workorder'), - 'clearingReference' => $response['addpaydata']['clearing_reference'], - 'captureMode' => AbstractPayonePaymentHandler::PAYONE_STATE_COMPLETED, - 'clearingType' => AbstractPayonePaymentHandler::PAYONE_CLEARING_FNC, - 'financingType' => AbstractPayonePaymentHandler::PAYONE_FINANCING_PYV, - ]); - - $this->dataHandler->saveTransactionData($paymentTransaction, $salesChannelContext->getContext(), $data); - } - public function getValidationDefinitions(SalesChannelContext $salesChannelContext): array { $definitions = parent::getValidationDefinitions($salesChannelContext); @@ -114,9 +29,6 @@ public function getValidationDefinitions(SalesChannelContext $salesChannelContex return $definitions; } - /** - * {@inheritdoc} - */ public static function isCapturable(array $transactionData, array $payoneTransActionData): bool { if (static::isNeverCapturable($payoneTransActionData)) { @@ -126,9 +38,6 @@ public static function isCapturable(array $transactionData, array $payoneTransAc return static::isTransactionAppointedAndCompleted($transactionData) || static::matchesIsCapturableDefaults($transactionData); } - /** - * {@inheritdoc} - */ public static function isRefundable(array $transactionData): bool { if (static::isNeverRefundable($transactionData)) { @@ -137,4 +46,20 @@ public static function isRefundable(array $transactionData): bool return static::matchesIsRefundableDefaults($transactionData); } + + protected function getDefaultAuthorizationMethod(): string + { + return AbstractRequestParameterBuilder::REQUEST_ACTION_PREAUTHORIZE; + } + + protected function getAdditionalTransactionData(RequestDataBag $dataBag, array $request, array $response): array + { + return [ + 'workOrderId' => $dataBag->get('workorder'), + 'clearingReference' => $response['addpaydata']['clearing_reference'], + 'captureMode' => AbstractPayonePaymentHandler::PAYONE_STATE_COMPLETED, + 'clearingType' => AbstractPayonePaymentHandler::PAYONE_CLEARING_FNC, + 'financingType' => AbstractPayonePaymentHandler::PAYONE_FINANCING_PYV, + ]; + } } diff --git a/src/PaymentHandler/PayonePaypalExpressPaymentHandler.php b/src/PaymentHandler/PayonePaypalExpressPaymentHandler.php index 02e0cb4ac..408644025 100644 --- a/src/PaymentHandler/PayonePaypalExpressPaymentHandler.php +++ b/src/PaymentHandler/PayonePaypalExpressPaymentHandler.php @@ -4,83 +4,47 @@ namespace PayonePayment\PaymentHandler; -use PayonePayment\Components\ConfigReader\ConfigReaderInterface; -use PayonePayment\Components\DataHandler\Transaction\TransactionDataHandlerInterface; -use PayonePayment\Components\PaymentStateHandler\PaymentStateHandlerInterface; -use PayonePayment\Payone\Client\Exception\PayoneRequestException; -use PayonePayment\Payone\Client\PayoneClientInterface; -use PayonePayment\Payone\RequestParameter\RequestParameterFactory; -use PayonePayment\Payone\RequestParameter\Struct\PaymentTransactionStruct; +use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder; use PayonePayment\Struct\PaymentTransaction; use Shopware\Core\Checkout\Payment\Cart\AsyncPaymentTransactionStruct; -use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\AsynchronousPaymentHandlerInterface; use Shopware\Core\Checkout\Payment\Exception\AsyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Symfony\Component\HttpFoundation\RedirectResponse; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Contracts\Translation\TranslatorInterface; -class PayonePaypalExpressPaymentHandler extends AbstractPayonePaymentHandler implements AsynchronousPaymentHandlerInterface +class PayonePaypalExpressPaymentHandler extends AbstractAsynchronousPayonePaymentHandler { - private readonly TranslatorInterface $translator; + public static function isCapturable(array $transactionData, array $payoneTransActionData): bool + { + if (static::isNeverCapturable($payoneTransActionData)) { + return false; + } - public function __construct( - ConfigReaderInterface $configReader, - private readonly PayoneClientInterface $client, - TranslatorInterface $translator, - private readonly TransactionDataHandlerInterface $dataHandler, - EntityRepository $lineItemRepository, - private readonly PaymentStateHandlerInterface $stateHandler, - RequestStack $requestStack, - private readonly RequestParameterFactory $requestParameterFactory - ) { - parent::__construct($configReader, $lineItemRepository, $requestStack); - $this->translator = $translator; + return static::isTransactionAppointedAndCompleted($transactionData) || static::matchesIsCapturableDefaults($transactionData); } - /** - * {@inheritdoc} - */ - public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $dataBag, SalesChannelContext $salesChannelContext): RedirectResponse + public static function isRefundable(array $transactionData): bool { - $requestData = $this->fetchRequestData(); - - // Get configured authorization method - $authorizationMethod = $this->getAuthorizationMethod( - $transaction->getOrder()->getSalesChannelId(), - 'paypalExpressAuthorizationMethod', - 'preauthorization' - ); - - $paymentTransaction = PaymentTransaction::fromAsyncPaymentTransactionStruct($transaction, $transaction->getOrder()); + if (static::isNeverRefundable($transactionData)) { + return false; + } - $request = $this->requestParameterFactory->getRequestParameter( - new PaymentTransactionStruct( - $paymentTransaction, - $requestData, - $salesChannelContext, - self::class, - $authorizationMethod - ) - ); + return static::matchesIsRefundableDefaults($transactionData); + } - try { - $response = $this->client->request($request); - } catch (PayoneRequestException $exception) { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $exception->getResponse()['error']['CustomerMessage'] - ); - } catch (\Throwable) { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } + protected function getDefaultAuthorizationMethod(): string + { + return AbstractRequestParameterBuilder::REQUEST_ACTION_PREAUTHORIZE; + } + protected function handleResponse( + AsyncPaymentTransactionStruct $transaction, + PaymentTransaction $paymentTransaction, + RequestDataBag $dataBag, + array $request, + array $response, + SalesChannelContext $salesChannelContext + ): void { if (empty($response['status']) || $response['status'] === 'ERROR') { throw new AsyncPaymentProcessException( $transaction->getOrderTransaction()->getId(), @@ -89,50 +53,18 @@ public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $ } $data = $this->preparePayoneOrderTransactionData($request, $response, [ - 'workOrderId' => $requestData->get('workorder'), + 'workOrderId' => $dataBag->get('workorder'), ]); $this->dataHandler->saveTransactionData($paymentTransaction, $salesChannelContext->getContext(), $data); + } + protected function getRedirectResponse(array $request, array $response): RedirectResponse + { if (strtolower((string) $response['status']) === 'redirect') { return new RedirectResponse($response['redirecturl']); } return new RedirectResponse($request['successurl']); } - - /** - * {@inheritdoc} - */ - public function finalize( - AsyncPaymentTransactionStruct $transaction, - Request $request, - SalesChannelContext $salesChannelContext - ): void { - $this->stateHandler->handleStateResponse($transaction, (string) $request->query->get('state')); - } - - /** - * {@inheritdoc} - */ - public static function isCapturable(array $transactionData, array $payoneTransActionData): bool - { - if (static::isNeverCapturable($payoneTransActionData)) { - return false; - } - - return static::isTransactionAppointedAndCompleted($transactionData) || static::matchesIsCapturableDefaults($transactionData); - } - - /** - * {@inheritdoc} - */ - public static function isRefundable(array $transactionData): bool - { - if (static::isNeverRefundable($transactionData)) { - return false; - } - - return static::matchesIsRefundableDefaults($transactionData); - } } diff --git a/src/PaymentHandler/PayonePaypalPaymentHandler.php b/src/PaymentHandler/PayonePaypalPaymentHandler.php index bc4baf167..e05f9d5f9 100644 --- a/src/PaymentHandler/PayonePaypalPaymentHandler.php +++ b/src/PaymentHandler/PayonePaypalPaymentHandler.php @@ -4,83 +4,47 @@ namespace PayonePayment\PaymentHandler; -use PayonePayment\Components\ConfigReader\ConfigReaderInterface; -use PayonePayment\Components\DataHandler\Transaction\TransactionDataHandlerInterface; -use PayonePayment\Components\PaymentStateHandler\PaymentStateHandlerInterface; -use PayonePayment\Payone\Client\Exception\PayoneRequestException; -use PayonePayment\Payone\Client\PayoneClientInterface; -use PayonePayment\Payone\RequestParameter\RequestParameterFactory; -use PayonePayment\Payone\RequestParameter\Struct\PaymentTransactionStruct; +use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder; use PayonePayment\Struct\PaymentTransaction; use Shopware\Core\Checkout\Payment\Cart\AsyncPaymentTransactionStruct; -use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\AsynchronousPaymentHandlerInterface; use Shopware\Core\Checkout\Payment\Exception\AsyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; use Symfony\Component\HttpFoundation\RedirectResponse; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Contracts\Translation\TranslatorInterface; -class PayonePaypalPaymentHandler extends AbstractPayonePaymentHandler implements AsynchronousPaymentHandlerInterface +class PayonePaypalPaymentHandler extends AbstractAsynchronousPayonePaymentHandler { - private readonly TranslatorInterface $translator; + public static function isCapturable(array $transactionData, array $payoneTransActionData): bool + { + if (static::isNeverCapturable($payoneTransActionData)) { + return false; + } - public function __construct( - ConfigReaderInterface $configReader, - private readonly PayoneClientInterface $client, - TranslatorInterface $translator, - private readonly TransactionDataHandlerInterface $dataHandler, - EntityRepository $lineItemRepository, - private readonly PaymentStateHandlerInterface $stateHandler, - RequestStack $requestStack, - private readonly RequestParameterFactory $requestParameterFactory - ) { - parent::__construct($configReader, $lineItemRepository, $requestStack); - $this->translator = $translator; + return static::isTransactionAppointedAndCompleted($transactionData) || static::matchesIsCapturableDefaults($transactionData); } - /** - * {@inheritdoc} - */ - public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $dataBag, SalesChannelContext $salesChannelContext): RedirectResponse + public static function isRefundable(array $transactionData): bool { - $requestData = $this->fetchRequestData(); - - // Get configured authorization method - $authorizationMethod = $this->getAuthorizationMethod( - $transaction->getOrder()->getSalesChannelId(), - 'paypalAuthorizationMethod', - 'preauthorization' - ); - - $paymentTransaction = PaymentTransaction::fromAsyncPaymentTransactionStruct($transaction, $transaction->getOrder()); + if (static::isNeverRefundable($transactionData)) { + return false; + } - $request = $this->requestParameterFactory->getRequestParameter( - new PaymentTransactionStruct( - $paymentTransaction, - $requestData, - $salesChannelContext, - self::class, - $authorizationMethod - ) - ); + return static::matchesIsRefundableDefaults($transactionData); + } - try { - $response = $this->client->request($request); - } catch (PayoneRequestException $exception) { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $exception->getResponse()['error']['CustomerMessage'] - ); - } catch (\Throwable) { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } + protected function getDefaultAuthorizationMethod(): string + { + return AbstractRequestParameterBuilder::REQUEST_ACTION_PREAUTHORIZE; + } + protected function handleResponse( + AsyncPaymentTransactionStruct $transaction, + PaymentTransaction $paymentTransaction, + RequestDataBag $dataBag, + array $request, + array $response, + SalesChannelContext $salesChannelContext + ): void { if (empty($response['status']) || $response['status'] === 'ERROR') { throw new AsyncPaymentProcessException( $transaction->getOrderTransaction()->getId(), @@ -90,43 +54,14 @@ public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $ $data = $this->preparePayoneOrderTransactionData($request, $response); $this->dataHandler->saveTransactionData($paymentTransaction, $salesChannelContext->getContext(), $data); + } + protected function getRedirectResponse(array $request, array $response): RedirectResponse + { if (strtolower((string) $response['status']) === 'redirect') { return new RedirectResponse($response['redirecturl']); } return new RedirectResponse($request['successurl']); } - - /** - * {@inheritdoc} - */ - public function finalize(AsyncPaymentTransactionStruct $transaction, Request $request, SalesChannelContext $salesChannelContext): void - { - $this->stateHandler->handleStateResponse($transaction, (string) $request->query->get('state', '')); - } - - /** - * {@inheritdoc} - */ - public static function isCapturable(array $transactionData, array $payoneTransActionData): bool - { - if (static::isNeverCapturable($payoneTransActionData)) { - return false; - } - - return static::isTransactionAppointedAndCompleted($transactionData) || static::matchesIsCapturableDefaults($transactionData); - } - - /** - * {@inheritdoc} - */ - public static function isRefundable(array $transactionData): bool - { - if (static::isNeverRefundable($transactionData)) { - return false; - } - - return static::matchesIsRefundableDefaults($transactionData); - } } diff --git a/src/PaymentHandler/PayonePrepaymentPaymentHandler.php b/src/PaymentHandler/PayonePrepaymentPaymentHandler.php index b78e132ac..64296691c 100644 --- a/src/PaymentHandler/PayonePrepaymentPaymentHandler.php +++ b/src/PaymentHandler/PayonePrepaymentPaymentHandler.php @@ -4,101 +4,12 @@ namespace PayonePayment\PaymentHandler; -use PayonePayment\Components\ConfigReader\ConfigReaderInterface; -use PayonePayment\Components\DataHandler\Transaction\TransactionDataHandlerInterface; use PayonePayment\Components\TransactionStatus\TransactionStatusService; -use PayonePayment\Payone\Client\Exception\PayoneRequestException; -use PayonePayment\Payone\Client\PayoneClientInterface; use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder; -use PayonePayment\Payone\RequestParameter\RequestParameterFactory; -use PayonePayment\Payone\RequestParameter\Struct\PaymentTransactionStruct; -use PayonePayment\Struct\PaymentTransaction; -use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\SynchronousPaymentHandlerInterface; -use Shopware\Core\Checkout\Payment\Cart\SyncPaymentTransactionStruct; -use Shopware\Core\Checkout\Payment\Exception\SyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; -use Shopware\Core\System\SalesChannel\SalesChannelContext; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Contracts\Translation\TranslatorInterface; -class PayonePrepaymentPaymentHandler extends AbstractPayonePaymentHandler implements SynchronousPaymentHandlerInterface +class PayonePrepaymentPaymentHandler extends AbstractSynchronousPayonePaymentHandler { - private readonly TranslatorInterface $translator; - - public function __construct( - ConfigReaderInterface $configReader, - private readonly RequestParameterFactory $requestParameterFactory, - private readonly PayoneClientInterface $client, - TranslatorInterface $translator, - private readonly TransactionDataHandlerInterface $dataHandler, - EntityRepository $lineItemRepository, - RequestStack $requestStack - ) { - parent::__construct($configReader, $lineItemRepository, $requestStack); - $this->translator = $translator; - } - - /** - * {@inheritdoc} - */ - public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $dataBag, SalesChannelContext $salesChannelContext): void - { - $requestData = $this->fetchRequestData(); - - $paymentTransaction = PaymentTransaction::fromSyncPaymentTransactionStruct($transaction, $transaction->getOrder()); - - $request = $this->requestParameterFactory->getRequestParameter( - new PaymentTransactionStruct( - $paymentTransaction, - $requestData, - $salesChannelContext, - self::class, - AbstractRequestParameterBuilder::REQUEST_ACTION_PREAUTHORIZE - ) - ); - - try { - $response = $this->client->request($request); - } catch (PayoneRequestException $exception) { - throw new SyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $exception->getResponse()['error']['CustomerMessage'] - ); - } catch (\Throwable) { - throw new SyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } - - if (empty($response['status']) || $response['status'] === 'ERROR') { - throw new SyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } - - $data = $this->preparePayoneOrderTransactionData($request, $response, [ - 'workOrderId' => $requestData->get('workorder'), - 'clearingType' => self::PAYONE_CLEARING_VOR, - // Store clearing bank account information as custom field of the transaction in order to - // use this data for payment instructions of an invoice or similar. - // See: https://docs.payone.com/display/public/PLATFORM/How+to+use+JSON-Responses#HowtouseJSON-Responses-JSON,Clearing-Data - 'clearingBankAccount' => array_merge(array_filter($response['clearing']['BankAccount'] ?? []), [ - // The PAYONE transaction ID acts as intended purpose of the transfer. - // We add this field explicitly here to make clear that the transaction ID is used - // as payment reference in context of the prepayment. - 'Reference' => (string) $response['txid'], - ]), - ]); - - $this->dataHandler->saveTransactionData($paymentTransaction, $salesChannelContext->getContext(), $data); - } - - /** - * {@inheritdoc} - */ public static function isCapturable(array $transactionData, array $payoneTransActionData): bool { if (static::isNeverCapturable($payoneTransActionData)) { @@ -118,9 +29,6 @@ public static function isCapturable(array $transactionData, array $payoneTransAc return static::matchesIsCapturableDefaults($transactionData); } - /** - * {@inheritdoc} - */ public static function isRefundable(array $transactionData): bool { if (static::isNeverRefundable($transactionData)) { @@ -129,4 +37,26 @@ public static function isRefundable(array $transactionData): bool return static::matchesIsRefundableDefaults($transactionData); } + + protected function getDefaultAuthorizationMethod(): string + { + return AbstractRequestParameterBuilder::REQUEST_ACTION_PREAUTHORIZE; + } + + protected function getAdditionalTransactionData(RequestDataBag $dataBag, array $request, array $response): array + { + return [ + 'workOrderId' => $dataBag->get('workorder'), + 'clearingType' => self::PAYONE_CLEARING_VOR, + // Store clearing bank account information as custom field of the transaction in order to + // use this data for payment instructions of an invoice or similar. + // See: https://docs.payone.com/display/public/PLATFORM/How+to+use+JSON-Responses#HowtouseJSON-Responses-JSON,Clearing-Data + 'clearingBankAccount' => array_merge(array_filter($response['clearing']['BankAccount'] ?? []), [ + // The PAYONE transaction ID acts as intended purpose of the transfer. + // We add this field explicitly here to make clear that the transaction ID is used + // as payment reference in context of the prepayment. + 'Reference' => (string) $response['txid'], + ]), + ]; + } } diff --git a/src/PaymentHandler/PayonePrzelewy24PaymentHandler.php b/src/PaymentHandler/PayonePrzelewy24PaymentHandler.php index d9f0e489f..b31017d13 100644 --- a/src/PaymentHandler/PayonePrzelewy24PaymentHandler.php +++ b/src/PaymentHandler/PayonePrzelewy24PaymentHandler.php @@ -4,112 +4,11 @@ namespace PayonePayment\PaymentHandler; -use PayonePayment\Components\ConfigReader\ConfigReaderInterface; -use PayonePayment\Components\DataHandler\Transaction\TransactionDataHandlerInterface; -use PayonePayment\Components\PaymentStateHandler\PaymentStateHandlerInterface; -use PayonePayment\Payone\Client\Exception\PayoneRequestException; -use PayonePayment\Payone\Client\PayoneClientInterface; -use PayonePayment\Payone\RequestParameter\RequestParameterFactory; -use PayonePayment\Payone\RequestParameter\Struct\PaymentTransactionStruct; -use PayonePayment\Struct\PaymentTransaction; -use Shopware\Core\Checkout\Payment\Cart\AsyncPaymentTransactionStruct; -use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\AsynchronousPaymentHandlerInterface; -use Shopware\Core\Checkout\Payment\Exception\AsyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; +use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; -use Shopware\Core\System\SalesChannel\SalesChannelContext; -use Symfony\Component\HttpFoundation\RedirectResponse; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Contracts\Translation\TranslatorInterface; -class PayonePrzelewy24PaymentHandler extends AbstractPayonePaymentHandler implements AsynchronousPaymentHandlerInterface +class PayonePrzelewy24PaymentHandler extends AbstractAsynchronousPayonePaymentHandler { - private readonly TranslatorInterface $translator; - - public function __construct( - ConfigReaderInterface $configReader, - EntityRepository $lineItemRepository, - private readonly PayoneClientInterface $client, - TranslatorInterface $translator, - private readonly TransactionDataHandlerInterface $dataHandler, - private readonly PaymentStateHandlerInterface $stateHandler, - RequestStack $requestStack, - private readonly RequestParameterFactory $requestParameterFactory - ) { - parent::__construct($configReader, $lineItemRepository, $requestStack); - $this->translator = $translator; - } - - /** - * {@inheritdoc} - */ - public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $dataBag, SalesChannelContext $salesChannelContext): RedirectResponse - { - $requestData = $this->fetchRequestData(); - - // Get configured authorization method - $authorizationMethod = $this->getAuthorizationMethod( - $transaction->getOrder()->getSalesChannelId(), - 'przelewy24AuthorizationMethod', - 'authorization' - ); - - $paymentTransaction = PaymentTransaction::fromAsyncPaymentTransactionStruct($transaction, $transaction->getOrder()); - - $request = $this->requestParameterFactory->getRequestParameter( - new PaymentTransactionStruct( - $paymentTransaction, - $requestData, - $salesChannelContext, - self::class, - $authorizationMethod - ) - ); - - try { - $response = $this->client->request($request); - } catch (PayoneRequestException $exception) { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $exception->getResponse()['error']['CustomerMessage'] - ); - } catch (\Throwable) { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } - - if (empty($response['status']) && $response['status'] !== 'REDIRECT') { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } - - $data = $this->preparePayoneOrderTransactionData($request, $response, [ - 'transactionState' => $response['status'], - 'allowCapture' => false, - 'allowRefund' => false, - ]); - - $this->dataHandler->saveTransactionData($paymentTransaction, $salesChannelContext->getContext(), $data); - - return new RedirectResponse($response['redirecturl']); - } - - /** - * {@inheritdoc} - */ - public function finalize(AsyncPaymentTransactionStruct $transaction, Request $request, SalesChannelContext $salesChannelContext): void - { - $this->stateHandler->handleStateResponse($transaction, (string) $request->query->get('state')); - } - - /** - * {@inheritdoc} - */ public static function isCapturable(array $transactionData, array $payoneTransActionData): bool { if (static::isNeverCapturable($payoneTransActionData)) { @@ -119,9 +18,6 @@ public static function isCapturable(array $transactionData, array $payoneTransAc return static::isTransactionAppointedAndCompleted($transactionData) || static::matchesIsCapturableDefaults($transactionData); } - /** - * {@inheritdoc} - */ public static function isRefundable(array $transactionData): bool { if (static::isNeverRefundable($transactionData)) { @@ -130,4 +26,18 @@ public static function isRefundable(array $transactionData): bool return static::matchesIsRefundableDefaults($transactionData); } + + protected function getDefaultAuthorizationMethod(): string + { + return AbstractRequestParameterBuilder::REQUEST_ACTION_AUTHORIZE; + } + + protected function getAdditionalTransactionData(RequestDataBag $dataBag, array $request, array $response): array + { + return [ + 'transactionState' => $response['status'], + 'allowCapture' => false, + 'allowRefund' => false, + ]; + } } diff --git a/src/PaymentHandler/PayoneRatepayDebitPaymentHandler.php b/src/PaymentHandler/PayoneRatepayDebitPaymentHandler.php index d62eb7b8d..4e4bb64a8 100644 --- a/src/PaymentHandler/PayoneRatepayDebitPaymentHandler.php +++ b/src/PaymentHandler/PayoneRatepayDebitPaymentHandler.php @@ -4,113 +4,15 @@ namespace PayonePayment\PaymentHandler; -use PayonePayment\Components\ConfigReader\ConfigReaderInterface; -use PayonePayment\Components\DataHandler\Transaction\TransactionDataHandlerInterface; -use PayonePayment\Components\DeviceFingerprint\AbstractDeviceFingerprintService; use PayonePayment\Components\Validator\Birthday; use PayonePayment\Components\Validator\Iban; -use PayonePayment\Payone\Client\Exception\PayoneRequestException; -use PayonePayment\Payone\Client\PayoneClientInterface; -use PayonePayment\Payone\RequestParameter\RequestParameterFactory; -use PayonePayment\Payone\RequestParameter\Struct\PaymentTransactionStruct; -use PayonePayment\Struct\PaymentTransaction; -use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\SynchronousPaymentHandlerInterface; -use Shopware\Core\Checkout\Payment\Cart\SyncPaymentTransactionStruct; -use Shopware\Core\Checkout\Payment\Exception\SyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; +use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; -use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\Validator\Constraints\NotBlank; -use Symfony\Contracts\Translation\TranslatorInterface; -class PayoneRatepayDebitPaymentHandler extends AbstractPayonePaymentHandler implements SynchronousPaymentHandlerInterface +class PayoneRatepayDebitPaymentHandler extends AbstractSynchronousPayonePaymentHandler { - protected TranslatorInterface $translator; - - public function __construct( - ConfigReaderInterface $configReader, - protected PayoneClientInterface $client, - TranslatorInterface $translator, - private readonly TransactionDataHandlerInterface $dataHandler, - EntityRepository $lineItemRepository, - RequestStack $requestStack, - private readonly RequestParameterFactory $requestParameterFactory, - private readonly AbstractDeviceFingerprintService $deviceFingerprintService - ) { - parent::__construct($configReader, $lineItemRepository, $requestStack); - $this->translator = $translator; - } - - /** - * {@inheritdoc} - */ - public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $dataBag, SalesChannelContext $salesChannelContext): void - { - $requestData = $this->fetchRequestData(); - - // Get configured authorization method - $authorizationMethod = $this->getAuthorizationMethod( - $transaction->getOrder()->getSalesChannelId(), - 'ratepayDebitAuthorizationMethod', - 'preauthorization' - ); - - $paymentTransaction = PaymentTransaction::fromSyncPaymentTransactionStruct($transaction, $transaction->getOrder()); - - $request = $this->requestParameterFactory->getRequestParameter( - new PaymentTransactionStruct( - $paymentTransaction, - $requestData, - $salesChannelContext, - self::class, - $authorizationMethod - ) - ); - - try { - $response = $this->client->request($request); - } catch (PayoneRequestException $exception) { - $this->deviceFingerprintService->deleteDeviceIdentToken(); - - throw new SyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $exception->getResponse()['error']['CustomerMessage'] - ); - } catch (\Throwable) { - $this->deviceFingerprintService->deleteDeviceIdentToken(); - - throw new SyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } - - if (empty($response['status']) || $response['status'] === 'ERROR') { - $this->deviceFingerprintService->deleteDeviceIdentToken(); - - throw new SyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } - - // It differs depending on the authorization method - $clearingReference = $response['addpaydata']['clearing_reference'] ?? $response['clearing']['Reference']; - - $data = $this->preparePayoneOrderTransactionData($request, $response, [ - 'workOrderId' => $requestData->get('workorder'), - 'clearingReference' => $clearingReference, - 'captureMode' => AbstractPayonePaymentHandler::PAYONE_STATE_COMPLETED, - 'clearingType' => AbstractPayonePaymentHandler::PAYONE_CLEARING_FNC, - 'financingType' => AbstractPayonePaymentHandler::PAYONE_FINANCING_RPD, - 'additionalData' => ['used_ratepay_shop_id' => $request['add_paydata[shop_id]']], - ]); - - $this->dataHandler->saveTransactionData($paymentTransaction, $salesChannelContext->getContext(), $data); - $this->deviceFingerprintService->deleteDeviceIdentToken(); - } - public function getValidationDefinitions(SalesChannelContext $salesChannelContext): array { $definitions = parent::getValidationDefinitions($salesChannelContext); @@ -121,9 +23,6 @@ public function getValidationDefinitions(SalesChannelContext $salesChannelContex return $definitions; } - /** - * {@inheritdoc} - */ public static function isCapturable(array $transactionData, array $payoneTransActionData): bool { if (static::isNeverCapturable($payoneTransActionData)) { @@ -133,9 +32,6 @@ public static function isCapturable(array $transactionData, array $payoneTransAc return static::isTransactionAppointedAndCompleted($transactionData) || static::matchesIsCapturableDefaults($transactionData); } - /** - * {@inheritdoc} - */ public static function isRefundable(array $transactionData): bool { if (static::isNeverRefundable($transactionData)) { @@ -144,4 +40,24 @@ public static function isRefundable(array $transactionData): bool return static::matchesIsRefundableDefaults($transactionData); } + + protected function getDefaultAuthorizationMethod(): string + { + return AbstractRequestParameterBuilder::REQUEST_ACTION_PREAUTHORIZE; + } + + protected function getAdditionalTransactionData(RequestDataBag $dataBag, array $request, array $response): array + { + // It differs depending on the authorization method + $clearingReference = $response['addpaydata']['clearing_reference'] ?? $response['clearing']['Reference']; + + return [ + 'workOrderId' => $dataBag->get('workorder'), + 'clearingReference' => $clearingReference, + 'captureMode' => AbstractPayonePaymentHandler::PAYONE_STATE_COMPLETED, + 'clearingType' => AbstractPayonePaymentHandler::PAYONE_CLEARING_FNC, + 'financingType' => AbstractPayonePaymentHandler::PAYONE_FINANCING_RPD, + 'additionalData' => ['used_ratepay_shop_id' => $request['add_paydata[shop_id]']], + ]; + } } diff --git a/src/PaymentHandler/PayoneRatepayInstallmentPaymentHandler.php b/src/PaymentHandler/PayoneRatepayInstallmentPaymentHandler.php index 004a87a62..7be261430 100644 --- a/src/PaymentHandler/PayoneRatepayInstallmentPaymentHandler.php +++ b/src/PaymentHandler/PayoneRatepayInstallmentPaymentHandler.php @@ -4,113 +4,15 @@ namespace PayonePayment\PaymentHandler; -use PayonePayment\Components\ConfigReader\ConfigReaderInterface; -use PayonePayment\Components\DataHandler\Transaction\TransactionDataHandlerInterface; -use PayonePayment\Components\DeviceFingerprint\AbstractDeviceFingerprintService; use PayonePayment\Components\Validator\Birthday; use PayonePayment\Components\Validator\Iban; -use PayonePayment\Payone\Client\Exception\PayoneRequestException; -use PayonePayment\Payone\Client\PayoneClientInterface; -use PayonePayment\Payone\RequestParameter\RequestParameterFactory; -use PayonePayment\Payone\RequestParameter\Struct\PaymentTransactionStruct; -use PayonePayment\Struct\PaymentTransaction; -use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\SynchronousPaymentHandlerInterface; -use Shopware\Core\Checkout\Payment\Cart\SyncPaymentTransactionStruct; -use Shopware\Core\Checkout\Payment\Exception\SyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; +use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; -use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\Validator\Constraints\NotBlank; -use Symfony\Contracts\Translation\TranslatorInterface; -class PayoneRatepayInstallmentPaymentHandler extends AbstractPayonePaymentHandler implements SynchronousPaymentHandlerInterface +class PayoneRatepayInstallmentPaymentHandler extends AbstractSynchronousPayonePaymentHandler { - protected TranslatorInterface $translator; - - public function __construct( - ConfigReaderInterface $configReader, - protected PayoneClientInterface $client, - TranslatorInterface $translator, - private readonly TransactionDataHandlerInterface $dataHandler, - EntityRepository $lineItemRepository, - RequestStack $requestStack, - private readonly RequestParameterFactory $requestParameterFactory, - private readonly AbstractDeviceFingerprintService $deviceFingerprintService - ) { - parent::__construct($configReader, $lineItemRepository, $requestStack); - $this->translator = $translator; - } - - /** - * {@inheritdoc} - */ - public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $dataBag, SalesChannelContext $salesChannelContext): void - { - $requestData = $this->fetchRequestData(); - - // Get configured authorization method - $authorizationMethod = $this->getAuthorizationMethod( - $transaction->getOrder()->getSalesChannelId(), - 'ratepayInstallmentAuthorizationMethod', - 'preauthorization' - ); - - $paymentTransaction = PaymentTransaction::fromSyncPaymentTransactionStruct($transaction, $transaction->getOrder()); - - $request = $this->requestParameterFactory->getRequestParameter( - new PaymentTransactionStruct( - $paymentTransaction, - $requestData, - $salesChannelContext, - self::class, - $authorizationMethod - ) - ); - - try { - $response = $this->client->request($request); - } catch (PayoneRequestException $exception) { - $this->deviceFingerprintService->deleteDeviceIdentToken(); - - throw new SyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $exception->getResponse()['error']['CustomerMessage'] - ); - } catch (\Throwable) { - $this->deviceFingerprintService->deleteDeviceIdentToken(); - - throw new SyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } - - if (empty($response['status']) || $response['status'] === 'ERROR') { - $this->deviceFingerprintService->deleteDeviceIdentToken(); - - throw new SyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } - - // It differs depending on the authorization method - $clearingReference = $response['addpaydata']['clearing_reference'] ?? $response['clearing']['Reference']; - - $data = $this->preparePayoneOrderTransactionData($request, $response, [ - 'workOrderId' => $requestData->get('workorder'), - 'clearingReference' => $clearingReference, - 'captureMode' => AbstractPayonePaymentHandler::PAYONE_STATE_COMPLETED, - 'clearingType' => AbstractPayonePaymentHandler::PAYONE_CLEARING_FNC, - 'financingType' => AbstractPayonePaymentHandler::PAYONE_FINANCING_RPS, - 'additionalData' => ['used_ratepay_shop_id' => $request['add_paydata[shop_id]']], - ]); - - $this->dataHandler->saveTransactionData($paymentTransaction, $salesChannelContext->getContext(), $data); - $this->deviceFingerprintService->deleteDeviceIdentToken(); - } - public function getValidationDefinitions(SalesChannelContext $salesChannelContext): array { $definitions = parent::getValidationDefinitions($salesChannelContext); @@ -121,9 +23,6 @@ public function getValidationDefinitions(SalesChannelContext $salesChannelContex return $definitions; } - /** - * {@inheritdoc} - */ public static function isCapturable(array $transactionData, array $payoneTransActionData): bool { if (static::isNeverCapturable($payoneTransActionData)) { @@ -133,9 +32,6 @@ public static function isCapturable(array $transactionData, array $payoneTransAc return static::isTransactionAppointedAndCompleted($transactionData) || static::matchesIsCapturableDefaults($transactionData); } - /** - * {@inheritdoc} - */ public static function isRefundable(array $transactionData): bool { if (static::isNeverRefundable($transactionData)) { @@ -144,4 +40,24 @@ public static function isRefundable(array $transactionData): bool return static::matchesIsRefundableDefaults($transactionData); } + + protected function getDefaultAuthorizationMethod(): string + { + return AbstractRequestParameterBuilder::REQUEST_ACTION_PREAUTHORIZE; + } + + protected function getAdditionalTransactionData(RequestDataBag $dataBag, array $request, array $response): array + { + // It differs depending on the authorization method + $clearingReference = $response['addpaydata']['clearing_reference'] ?? $response['clearing']['Reference']; + + return [ + 'workOrderId' => $dataBag->get('workorder'), + 'clearingReference' => $clearingReference, + 'captureMode' => AbstractPayonePaymentHandler::PAYONE_STATE_COMPLETED, + 'clearingType' => AbstractPayonePaymentHandler::PAYONE_CLEARING_FNC, + 'financingType' => AbstractPayonePaymentHandler::PAYONE_FINANCING_RPS, + 'additionalData' => ['used_ratepay_shop_id' => $request['add_paydata[shop_id]']], + ]; + } } diff --git a/src/PaymentHandler/PayoneRatepayInvoicingPaymentHandler.php b/src/PaymentHandler/PayoneRatepayInvoicingPaymentHandler.php index 0b8a67335..1d26696fb 100644 --- a/src/PaymentHandler/PayoneRatepayInvoicingPaymentHandler.php +++ b/src/PaymentHandler/PayoneRatepayInvoicingPaymentHandler.php @@ -4,112 +4,14 @@ namespace PayonePayment\PaymentHandler; -use PayonePayment\Components\ConfigReader\ConfigReaderInterface; -use PayonePayment\Components\DataHandler\Transaction\TransactionDataHandlerInterface; -use PayonePayment\Components\DeviceFingerprint\AbstractDeviceFingerprintService; use PayonePayment\Components\Validator\Birthday; -use PayonePayment\Payone\Client\Exception\PayoneRequestException; -use PayonePayment\Payone\Client\PayoneClientInterface; -use PayonePayment\Payone\RequestParameter\RequestParameterFactory; -use PayonePayment\Payone\RequestParameter\Struct\PaymentTransactionStruct; -use PayonePayment\Struct\PaymentTransaction; -use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\SynchronousPaymentHandlerInterface; -use Shopware\Core\Checkout\Payment\Cart\SyncPaymentTransactionStruct; -use Shopware\Core\Checkout\Payment\Exception\SyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; +use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; -use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\Validator\Constraints\NotBlank; -use Symfony\Contracts\Translation\TranslatorInterface; -class PayoneRatepayInvoicingPaymentHandler extends AbstractPayonePaymentHandler implements SynchronousPaymentHandlerInterface +class PayoneRatepayInvoicingPaymentHandler extends AbstractSynchronousPayonePaymentHandler { - private readonly TranslatorInterface $translator; - - public function __construct( - ConfigReaderInterface $configReader, - private readonly PayoneClientInterface $client, - TranslatorInterface $translator, - private readonly TransactionDataHandlerInterface $dataHandler, - EntityRepository $lineItemRepository, - RequestStack $requestStack, - private readonly RequestParameterFactory $requestParameterFactory, - private readonly AbstractDeviceFingerprintService $deviceFingerprintService - ) { - parent::__construct($configReader, $lineItemRepository, $requestStack); - $this->translator = $translator; - } - - /** - * {@inheritdoc} - */ - public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $dataBag, SalesChannelContext $salesChannelContext): void - { - $requestData = $this->fetchRequestData(); - - // Get configured authorization method - $authorizationMethod = $this->getAuthorizationMethod( - $transaction->getOrder()->getSalesChannelId(), - 'ratepayInvoicingAuthorizationMethod', - 'preauthorization' - ); - - $paymentTransaction = PaymentTransaction::fromSyncPaymentTransactionStruct($transaction, $transaction->getOrder()); - - $request = $this->requestParameterFactory->getRequestParameter( - new PaymentTransactionStruct( - $paymentTransaction, - $requestData, - $salesChannelContext, - self::class, - $authorizationMethod - ) - ); - - try { - $response = $this->client->request($request); - } catch (PayoneRequestException $exception) { - $this->deviceFingerprintService->deleteDeviceIdentToken(); - - throw new SyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $exception->getResponse()['error']['CustomerMessage'] - ); - } catch (\Throwable) { - $this->deviceFingerprintService->deleteDeviceIdentToken(); - - throw new SyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } - - if (empty($response['status']) || $response['status'] === 'ERROR') { - $this->deviceFingerprintService->deleteDeviceIdentToken(); - - throw new SyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } - - // It differs depending on the authorization method - $clearingReference = $response['addpaydata']['clearing_reference'] ?? $response['clearing']['Reference']; - - $data = $this->preparePayoneOrderTransactionData($request, $response, [ - 'workOrderId' => $requestData->get('workorder'), - 'clearingReference' => $clearingReference, - 'captureMode' => AbstractPayonePaymentHandler::PAYONE_STATE_COMPLETED, - 'clearingType' => AbstractPayonePaymentHandler::PAYONE_CLEARING_FNC, - 'financingType' => AbstractPayonePaymentHandler::PAYONE_FINANCING_RPV, - 'additionalData' => ['used_ratepay_shop_id' => $request['add_paydata[shop_id]']], - ]); - - $this->dataHandler->saveTransactionData($paymentTransaction, $salesChannelContext->getContext(), $data); - $this->deviceFingerprintService->deleteDeviceIdentToken(); - } - public function getValidationDefinitions(SalesChannelContext $salesChannelContext): array { $definitions = parent::getValidationDefinitions($salesChannelContext); @@ -119,9 +21,6 @@ public function getValidationDefinitions(SalesChannelContext $salesChannelContex return $definitions; } - /** - * {@inheritdoc} - */ public static function isCapturable(array $transactionData, array $payoneTransActionData): bool { if (static::isNeverCapturable($payoneTransActionData)) { @@ -131,9 +30,6 @@ public static function isCapturable(array $transactionData, array $payoneTransAc return static::isTransactionAppointedAndCompleted($transactionData) || static::matchesIsCapturableDefaults($transactionData); } - /** - * {@inheritdoc} - */ public static function isRefundable(array $transactionData): bool { if (static::isNeverRefundable($transactionData)) { @@ -142,4 +38,24 @@ public static function isRefundable(array $transactionData): bool return static::matchesIsRefundableDefaults($transactionData); } + + protected function getDefaultAuthorizationMethod(): string + { + return AbstractRequestParameterBuilder::REQUEST_ACTION_PREAUTHORIZE; + } + + protected function getAdditionalTransactionData(RequestDataBag $dataBag, array $request, array $response): array + { + // It differs depending on the authorization method + $clearingReference = $response['addpaydata']['clearing_reference'] ?? $response['clearing']['Reference']; + + return [ + 'workOrderId' => $dataBag->get('workorder'), + 'clearingReference' => $clearingReference, + 'captureMode' => AbstractPayonePaymentHandler::PAYONE_STATE_COMPLETED, + 'clearingType' => AbstractPayonePaymentHandler::PAYONE_CLEARING_FNC, + 'financingType' => AbstractPayonePaymentHandler::PAYONE_FINANCING_RPV, + 'additionalData' => ['used_ratepay_shop_id' => $request['add_paydata[shop_id]']], + ]; + } } diff --git a/src/PaymentHandler/PayoneSecureInvoicePaymentHandler.php b/src/PaymentHandler/PayoneSecureInvoicePaymentHandler.php index 395d6fd54..90f2b7313 100644 --- a/src/PaymentHandler/PayoneSecureInvoicePaymentHandler.php +++ b/src/PaymentHandler/PayoneSecureInvoicePaymentHandler.php @@ -21,9 +21,6 @@ public function getValidationDefinitions(SalesChannelContext $salesChannelContex return $definitions; } - /** - * {@inheritdoc} - */ public static function isCapturable(array $transactionData, array $payoneTransActionData): bool { if (static::isNeverCapturable($payoneTransActionData)) { @@ -33,9 +30,6 @@ public static function isCapturable(array $transactionData, array $payoneTransAc return static::isTransactionAppointedAndCompleted($transactionData) || static::matchesIsCapturableDefaults($transactionData); } - /** - * {@inheritdoc} - */ public static function isRefundable(array $transactionData): bool { if (static::isNeverRefundable($transactionData)) { @@ -44,20 +38,4 @@ public static function isRefundable(array $transactionData): bool return static::matchesIsRefundableDefaults($transactionData); } - - /** - * {@inheritdoc} - */ - protected function getConfigKey(): string - { - return 'secureInvoiceAuthorizationMethod'; - } - - /** - * {@inheritdoc} - */ - protected function getPaymentMethod(): string - { - return self::class; - } } diff --git a/src/PaymentHandler/PayoneSecuredDirectDebitPaymentHandler.php b/src/PaymentHandler/PayoneSecuredDirectDebitPaymentHandler.php index d1b6bfd95..2712383f2 100644 --- a/src/PaymentHandler/PayoneSecuredDirectDebitPaymentHandler.php +++ b/src/PaymentHandler/PayoneSecuredDirectDebitPaymentHandler.php @@ -4,108 +4,13 @@ namespace PayonePayment\PaymentHandler; -use PayonePayment\Components\ConfigReader\ConfigReaderInterface; -use PayonePayment\Components\DataHandler\Transaction\TransactionDataHandlerInterface; -use PayonePayment\Components\DeviceFingerprint\AbstractDeviceFingerprintService; use PayonePayment\Components\Validator\Iban; -use PayonePayment\Payone\Client\Exception\PayoneRequestException; -use PayonePayment\Payone\Client\PayoneClientInterface; -use PayonePayment\Payone\RequestParameter\RequestParameterFactory; -use PayonePayment\Payone\RequestParameter\Struct\PaymentTransactionStruct; -use PayonePayment\Struct\PaymentTransaction; -use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\SynchronousPaymentHandlerInterface; -use Shopware\Core\Checkout\Payment\Cart\SyncPaymentTransactionStruct; -use Shopware\Core\Checkout\Payment\Exception\SyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; +use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; -use Shopware\Core\System\SalesChannel\SalesChannelContext; -use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\Validator\Constraints\NotBlank; -use Symfony\Contracts\Translation\TranslatorInterface; -class PayoneSecuredDirectDebitPaymentHandler extends AbstractPayonePaymentHandler implements SynchronousPaymentHandlerInterface +class PayoneSecuredDirectDebitPaymentHandler extends AbstractSynchronousPayonePaymentHandler { - private readonly TranslatorInterface $translator; - - public function __construct( - ConfigReaderInterface $configReader, - private readonly PayoneClientInterface $client, - TranslatorInterface $translator, - private readonly TransactionDataHandlerInterface $dataHandler, - EntityRepository $lineItemRepository, - RequestStack $requestStack, - private readonly RequestParameterFactory $requestParameterFactory, - private readonly AbstractDeviceFingerprintService $deviceFingerprintService - ) { - parent::__construct($configReader, $lineItemRepository, $requestStack); - $this->translator = $translator; - } - - /** - * {@inheritdoc} - */ - public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $dataBag, SalesChannelContext $salesChannelContext): void - { - $requestData = $this->fetchRequestData(); - - // Get configured authorization method - $authorizationMethod = $this->getAuthorizationMethod( - $transaction->getOrder()->getSalesChannelId(), - 'securedDirectDebitAuthorizationMethod', - 'preauthorization' - ); - - $paymentTransaction = PaymentTransaction::fromSyncPaymentTransactionStruct($transaction, $transaction->getOrder()); - - $request = $this->requestParameterFactory->getRequestParameter( - new PaymentTransactionStruct( - $paymentTransaction, - $requestData, - $salesChannelContext, - self::class, - $authorizationMethod - ) - ); - - try { - $response = $this->client->request($request); - } catch (PayoneRequestException $exception) { - $this->deviceFingerprintService->deleteDeviceIdentToken(); - - throw new SyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $exception->getResponse()['error']['CustomerMessage'] - ); - } catch (\Throwable) { - $this->deviceFingerprintService->deleteDeviceIdentToken(); - - throw new SyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } - - if (empty($response['status']) || $response['status'] === 'ERROR') { - $this->deviceFingerprintService->deleteDeviceIdentToken(); - - throw new SyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } - - $data = $this->preparePayoneOrderTransactionData($request, $response, [ - 'clearingType' => AbstractPayonePaymentHandler::PAYONE_CLEARING_FNC, - 'financingType' => AbstractPayonePaymentHandler::PAYONE_FINANCING_PDD, - ]); - - $this->dataHandler->saveTransactionData($paymentTransaction, $salesChannelContext->getContext(), $data); - $this->deviceFingerprintService->deleteDeviceIdentToken(); - } - - /** - * {@inheritdoc} - */ public static function isCapturable(array $transactionData, array $payoneTransActionData): bool { if (static::isNeverCapturable($payoneTransActionData)) { @@ -115,9 +20,6 @@ public static function isCapturable(array $transactionData, array $payoneTransAc return static::isTransactionAppointedAndCompleted($transactionData) || static::matchesIsCapturableDefaults($transactionData); } - /** - * {@inheritdoc} - */ public static function isRefundable(array $transactionData): bool { if (static::isNeverRefundable($transactionData)) { @@ -135,4 +37,17 @@ public function getValidationDefinitions(SalesChannelContext $salesChannelContex return $definitions; } + + protected function getDefaultAuthorizationMethod(): string + { + return AbstractRequestParameterBuilder::REQUEST_ACTION_PREAUTHORIZE; + } + + protected function getAdditionalTransactionData(RequestDataBag $dataBag, array $request, array $response): array + { + return [ + 'clearingType' => AbstractPayonePaymentHandler::PAYONE_CLEARING_FNC, + 'financingType' => AbstractPayonePaymentHandler::PAYONE_FINANCING_PDD, + ]; + } } diff --git a/src/PaymentHandler/PayoneSecuredInstallmentPaymentHandler.php b/src/PaymentHandler/PayoneSecuredInstallmentPaymentHandler.php index 14a56e7de..0dc7ea1ef 100644 --- a/src/PaymentHandler/PayoneSecuredInstallmentPaymentHandler.php +++ b/src/PaymentHandler/PayoneSecuredInstallmentPaymentHandler.php @@ -4,105 +4,14 @@ namespace PayonePayment\PaymentHandler; -use PayonePayment\Components\ConfigReader\ConfigReaderInterface; -use PayonePayment\Components\DataHandler\Transaction\TransactionDataHandlerInterface; -use PayonePayment\Components\DeviceFingerprint\AbstractDeviceFingerprintService; use PayonePayment\Components\Validator\Iban; -use PayonePayment\Payone\Client\Exception\PayoneRequestException; -use PayonePayment\Payone\Client\PayoneClientInterface; -use PayonePayment\Payone\RequestParameter\RequestParameterFactory; -use PayonePayment\Payone\RequestParameter\Struct\PaymentTransactionStruct; -use PayonePayment\Struct\PaymentTransaction; -use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\SynchronousPaymentHandlerInterface; -use Shopware\Core\Checkout\Payment\Cart\SyncPaymentTransactionStruct; -use Shopware\Core\Checkout\Payment\Exception\SyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; +use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; use Shopware\Core\System\SalesChannel\SalesChannelContext; -use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\Validator\Constraints\NotBlank; -use Symfony\Contracts\Translation\TranslatorInterface; -class PayoneSecuredInstallmentPaymentHandler extends AbstractPayonePaymentHandler implements SynchronousPaymentHandlerInterface +class PayoneSecuredInstallmentPaymentHandler extends AbstractSynchronousPayonePaymentHandler { - private readonly TranslatorInterface $translator; - - public function __construct( - ConfigReaderInterface $configReader, - private readonly PayoneClientInterface $client, - TranslatorInterface $translator, - private readonly TransactionDataHandlerInterface $dataHandler, - EntityRepository $lineItemRepository, - RequestStack $requestStack, - private readonly RequestParameterFactory $requestParameterFactory, - private readonly AbstractDeviceFingerprintService $deviceFingerprintService - ) { - parent::__construct($configReader, $lineItemRepository, $requestStack); - $this->translator = $translator; - } - - /** - * {@inheritdoc} - */ - public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $dataBag, SalesChannelContext $salesChannelContext): void - { - $requestData = $this->fetchRequestData(); - - // Get configured authorization method - $authorizationMethod = $this->getAuthorizationMethod( - $transaction->getOrder()->getSalesChannelId(), - 'securedInstallmentAuthorizationMethod', - 'preauthorization' - ); - - $paymentTransaction = PaymentTransaction::fromSyncPaymentTransactionStruct($transaction, $transaction->getOrder()); - - $request = $this->requestParameterFactory->getRequestParameter( - new PaymentTransactionStruct( - $paymentTransaction, - $requestData, - $salesChannelContext, - self::class, - $authorizationMethod - ) - ); - - try { - $response = $this->client->request($request); - } catch (PayoneRequestException $exception) { - $this->deviceFingerprintService->deleteDeviceIdentToken(); - - throw new SyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $exception->getResponse()['error']['CustomerMessage'] - ); - } catch (\Throwable) { - $this->deviceFingerprintService->deleteDeviceIdentToken(); - - throw new SyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } - - if (empty($response['status']) || $response['status'] === 'ERROR') { - $this->deviceFingerprintService->deleteDeviceIdentToken(); - - throw new SyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } - - $data = $this->preparePayoneOrderTransactionData($request, $response, [ - 'clearingType' => AbstractPayonePaymentHandler::PAYONE_CLEARING_FNC, - 'financingType' => AbstractPayonePaymentHandler::PAYONE_FINANCING_PIN, - ]); - - $this->dataHandler->saveTransactionData($paymentTransaction, $salesChannelContext->getContext(), $data); - $this->deviceFingerprintService->deleteDeviceIdentToken(); - } - public function getValidationDefinitions(SalesChannelContext $salesChannelContext): array { $definitions = parent::getValidationDefinitions($salesChannelContext); @@ -112,9 +21,6 @@ public function getValidationDefinitions(SalesChannelContext $salesChannelContex return $definitions; } - /** - * {@inheritdoc} - */ public static function isCapturable(array $transactionData, array $payoneTransActionData): bool { if (static::isNeverCapturable($payoneTransActionData)) { @@ -124,9 +30,6 @@ public static function isCapturable(array $transactionData, array $payoneTransAc return static::isTransactionAppointedAndCompleted($transactionData) || static::matchesIsCapturableDefaults($transactionData); } - /** - * {@inheritdoc} - */ public static function isRefundable(array $transactionData): bool { if (static::isNeverRefundable($transactionData)) { @@ -135,4 +38,17 @@ public static function isRefundable(array $transactionData): bool return static::matchesIsRefundableDefaults($transactionData); } + + protected function getDefaultAuthorizationMethod(): string + { + return AbstractRequestParameterBuilder::REQUEST_ACTION_PREAUTHORIZE; + } + + protected function getAdditionalTransactionData(RequestDataBag $dataBag, array $request, array $response): array + { + return [ + 'clearingType' => AbstractPayonePaymentHandler::PAYONE_CLEARING_FNC, + 'financingType' => AbstractPayonePaymentHandler::PAYONE_FINANCING_PIN, + ]; + } } diff --git a/src/PaymentHandler/PayoneSecuredInvoicePaymentHandler.php b/src/PaymentHandler/PayoneSecuredInvoicePaymentHandler.php index e92620291..1a36821a4 100644 --- a/src/PaymentHandler/PayoneSecuredInvoicePaymentHandler.php +++ b/src/PaymentHandler/PayoneSecuredInvoicePaymentHandler.php @@ -4,95 +4,37 @@ namespace PayonePayment\PaymentHandler; -use PayonePayment\Components\ConfigReader\ConfigReaderInterface; -use PayonePayment\Components\DataHandler\Transaction\TransactionDataHandlerInterface; -use PayonePayment\Components\DeviceFingerprint\AbstractDeviceFingerprintService; -use PayonePayment\Payone\Client\Exception\PayoneRequestException; -use PayonePayment\Payone\Client\PayoneClientInterface; -use PayonePayment\Payone\RequestParameter\RequestParameterFactory; -use PayonePayment\Payone\RequestParameter\Struct\PaymentTransactionStruct; -use PayonePayment\Struct\PaymentTransaction; -use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\SynchronousPaymentHandlerInterface; -use Shopware\Core\Checkout\Payment\Cart\SyncPaymentTransactionStruct; -use Shopware\Core\Checkout\Payment\Exception\SyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; +use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; -use Shopware\Core\System\SalesChannel\SalesChannelContext; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Contracts\Translation\TranslatorInterface; -class PayoneSecuredInvoicePaymentHandler extends AbstractPayonePaymentHandler implements SynchronousPaymentHandlerInterface +class PayoneSecuredInvoicePaymentHandler extends AbstractSynchronousPayonePaymentHandler { - private readonly TranslatorInterface $translator; + public static function isCapturable(array $transactionData, array $payoneTransActionData): bool + { + if (static::isNeverCapturable($payoneTransActionData)) { + return false; + } - public function __construct( - ConfigReaderInterface $configReader, - private readonly PayoneClientInterface $client, - TranslatorInterface $translator, - private readonly TransactionDataHandlerInterface $dataHandler, - EntityRepository $lineItemRepository, - RequestStack $requestStack, - private readonly RequestParameterFactory $requestParameterFactory, - private readonly AbstractDeviceFingerprintService $deviceFingerprintService - ) { - parent::__construct($configReader, $lineItemRepository, $requestStack); - $this->translator = $translator; + return static::isTransactionAppointedAndCompleted($transactionData) || static::matchesIsCapturableDefaults($transactionData); } - /** - * {@inheritdoc} - */ - public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $dataBag, SalesChannelContext $salesChannelContext): void + public static function isRefundable(array $transactionData): bool { - $requestData = $this->fetchRequestData(); - - // Get configured authorization method - $authorizationMethod = $this->getAuthorizationMethod( - $transaction->getOrder()->getSalesChannelId(), - 'securedInvoiceAuthorizationMethod', - 'preauthorization' - ); - - $paymentTransaction = PaymentTransaction::fromSyncPaymentTransactionStruct($transaction, $transaction->getOrder()); - - $request = $this->requestParameterFactory->getRequestParameter( - new PaymentTransactionStruct( - $paymentTransaction, - $requestData, - $salesChannelContext, - self::class, - $authorizationMethod - ) - ); - - try { - $response = $this->client->request($request); - } catch (PayoneRequestException $exception) { - $this->deviceFingerprintService->deleteDeviceIdentToken(); - - throw new SyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $exception->getResponse()['error']['CustomerMessage'] - ); - } catch (\Throwable) { - $this->deviceFingerprintService->deleteDeviceIdentToken(); - - throw new SyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); + if (static::isNeverRefundable($transactionData)) { + return false; } - if (empty($response['status']) || $response['status'] === 'ERROR') { - $this->deviceFingerprintService->deleteDeviceIdentToken(); + return static::matchesIsRefundableDefaults($transactionData); + } - throw new SyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } + protected function getDefaultAuthorizationMethod(): string + { + return AbstractRequestParameterBuilder::REQUEST_ACTION_PREAUTHORIZE; + } - $data = $this->preparePayoneOrderTransactionData($request, $response, [ + protected function getAdditionalTransactionData(RequestDataBag $dataBag, array $request, array $response): array + { + return [ 'clearingType' => AbstractPayonePaymentHandler::PAYONE_CLEARING_FNC, 'financingType' => AbstractPayonePaymentHandler::PAYONE_FINANCING_PIV, @@ -105,33 +47,6 @@ public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $d // as payment reference in context of the prepayment. 'Reference' => (string) $response['txid'], ]), - ]); - - $this->dataHandler->saveTransactionData($paymentTransaction, $salesChannelContext->getContext(), $data); - $this->deviceFingerprintService->deleteDeviceIdentToken(); - } - - /** - * {@inheritdoc} - */ - public static function isCapturable(array $transactionData, array $payoneTransActionData): bool - { - if (static::isNeverCapturable($payoneTransActionData)) { - return false; - } - - return static::isTransactionAppointedAndCompleted($transactionData) || static::matchesIsCapturableDefaults($transactionData); - } - - /** - * {@inheritdoc} - */ - public static function isRefundable(array $transactionData): bool - { - if (static::isNeverRefundable($transactionData)) { - return false; - } - - return static::matchesIsRefundableDefaults($transactionData); + ]; } } diff --git a/src/PaymentHandler/PayoneSofortBankingPaymentHandler.php b/src/PaymentHandler/PayoneSofortBankingPaymentHandler.php index 675ca9e50..6ebc46a9f 100644 --- a/src/PaymentHandler/PayoneSofortBankingPaymentHandler.php +++ b/src/PaymentHandler/PayoneSofortBankingPaymentHandler.php @@ -4,108 +4,11 @@ namespace PayonePayment\PaymentHandler; -use PayonePayment\Components\ConfigReader\ConfigReaderInterface; -use PayonePayment\Components\DataHandler\Transaction\TransactionDataHandlerInterface; -use PayonePayment\Components\PaymentStateHandler\PaymentStateHandlerInterface; use PayonePayment\Components\TransactionStatus\TransactionStatusService; -use PayonePayment\Payone\Client\Exception\PayoneRequestException; -use PayonePayment\Payone\Client\PayoneClientInterface; -use PayonePayment\Payone\RequestParameter\RequestParameterFactory; -use PayonePayment\Payone\RequestParameter\Struct\PaymentTransactionStruct; -use PayonePayment\Struct\PaymentTransaction; -use Shopware\Core\Checkout\Payment\Cart\AsyncPaymentTransactionStruct; -use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\AsynchronousPaymentHandlerInterface; -use Shopware\Core\Checkout\Payment\Exception\AsyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; -use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; -use Shopware\Core\System\SalesChannel\SalesChannelContext; -use Symfony\Component\HttpFoundation\RedirectResponse; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Contracts\Translation\TranslatorInterface; +use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder; -class PayoneSofortBankingPaymentHandler extends AbstractPayonePaymentHandler implements AsynchronousPaymentHandlerInterface +class PayoneSofortBankingPaymentHandler extends AbstractAsynchronousPayonePaymentHandler { - private readonly TranslatorInterface $translator; - - public function __construct( - ConfigReaderInterface $configReader, - private readonly RequestParameterFactory $requestParameterFactory, - private readonly PayoneClientInterface $client, - TranslatorInterface $translator, - private readonly TransactionDataHandlerInterface $dataHandler, - EntityRepository $lineItemRepository, - private readonly PaymentStateHandlerInterface $stateHandler, - RequestStack $requestStack - ) { - parent::__construct($configReader, $lineItemRepository, $requestStack); - $this->translator = $translator; - } - - /** - * {@inheritdoc} - */ - public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $dataBag, SalesChannelContext $salesChannelContext): RedirectResponse - { - $requestData = $this->fetchRequestData(); - - // Get configured authorization method - $authorizationMethod = $this->getAuthorizationMethod( - $transaction->getOrder()->getSalesChannelId(), - 'sofortAuthorizationMethod', - 'authorization' - ); - - $paymentTransaction = PaymentTransaction::fromAsyncPaymentTransactionStruct($transaction, $transaction->getOrder()); - - $request = $this->requestParameterFactory->getRequestParameter( - new PaymentTransactionStruct( - $paymentTransaction, - $requestData, - $salesChannelContext, - self::class, - $authorizationMethod - ) - ); - - try { - $response = $this->client->request($request); - } catch (PayoneRequestException $exception) { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $exception->getResponse()['error']['CustomerMessage'] - ); - } catch (\Throwable) { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } - - if (empty($response['status']) && $response['status'] !== 'REDIRECT') { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } - - $data = $this->preparePayoneOrderTransactionData($request, $response); - $this->dataHandler->saveTransactionData($paymentTransaction, $salesChannelContext->getContext(), $data); - - return new RedirectResponse($response['redirecturl']); - } - - /** - * {@inheritdoc} - */ - public function finalize(AsyncPaymentTransactionStruct $transaction, Request $request, SalesChannelContext $salesChannelContext): void - { - $this->stateHandler->handleStateResponse($transaction, (string) $request->query->get('state')); - } - - /** - * {@inheritdoc} - */ public static function isCapturable(array $transactionData, array $payoneTransActionData): bool { if (static::isNeverCapturable($payoneTransActionData)) { @@ -121,9 +24,6 @@ public static function isCapturable(array $transactionData, array $payoneTransAc return static::matchesIsCapturableDefaults($transactionData); } - /** - * {@inheritdoc} - */ public static function isRefundable(array $transactionData): bool { if (static::isNeverRefundable($transactionData)) { @@ -132,4 +32,9 @@ public static function isRefundable(array $transactionData): bool return static::matchesIsRefundableDefaults($transactionData); } + + protected function getDefaultAuthorizationMethod(): string + { + return AbstractRequestParameterBuilder::REQUEST_ACTION_AUTHORIZE; + } } diff --git a/src/PaymentHandler/PayoneTrustlyPaymentHandler.php b/src/PaymentHandler/PayoneTrustlyPaymentHandler.php index d8df38880..56c8fa067 100644 --- a/src/PaymentHandler/PayoneTrustlyPaymentHandler.php +++ b/src/PaymentHandler/PayoneTrustlyPaymentHandler.php @@ -4,109 +4,11 @@ namespace PayonePayment\PaymentHandler; -use PayonePayment\Components\ConfigReader\ConfigReaderInterface; -use PayonePayment\Components\DataHandler\Transaction\TransactionDataHandlerInterface; -use PayonePayment\Components\PaymentStateHandler\PaymentStateHandlerInterface; use PayonePayment\Components\TransactionStatus\TransactionStatusService; -use PayonePayment\Payone\Client\Exception\PayoneRequestException; -use PayonePayment\Payone\Client\PayoneClientInterface; -use PayonePayment\Payone\RequestParameter\RequestParameterFactory; -use PayonePayment\Payone\RequestParameter\Struct\PaymentTransactionStruct; -use PayonePayment\Struct\PaymentTransaction; -use Shopware\Core\Checkout\Payment\Cart\AsyncPaymentTransactionStruct; -use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\AsynchronousPaymentHandlerInterface; -use Shopware\Core\Checkout\Payment\Exception\AsyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; -use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; -use Shopware\Core\System\SalesChannel\SalesChannelContext; -use Symfony\Component\HttpFoundation\RedirectResponse; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Contracts\Translation\TranslatorInterface; +use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder; -class PayoneTrustlyPaymentHandler extends AbstractPayonePaymentHandler implements AsynchronousPaymentHandlerInterface +class PayoneTrustlyPaymentHandler extends AbstractAsynchronousPayonePaymentHandler { - private readonly TranslatorInterface $translator; - - public function __construct( - ConfigReaderInterface $configReader, - private readonly PayoneClientInterface $client, - TranslatorInterface $translator, - private readonly TransactionDataHandlerInterface $dataHandler, - EntityRepository $lineItemRepository, - private readonly PaymentStateHandlerInterface $stateHandler, - RequestStack $requestStack, - private readonly RequestParameterFactory $requestParameterFactory - ) { - parent::__construct($configReader, $lineItemRepository, $requestStack); - $this->translator = $translator; - } - - /** - * {@inheritdoc} - */ - public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $dataBag, SalesChannelContext $salesChannelContext): RedirectResponse - { - $requestData = $this->fetchRequestData(); - - // Get configured authorization method - $authorizationMethod = $this->getAuthorizationMethod( - $transaction->getOrder()->getSalesChannelId(), - 'trustlyAuthorizationMethod', - 'preauthorization' - ); - - $paymentTransaction = PaymentTransaction::fromAsyncPaymentTransactionStruct($transaction, $transaction->getOrder()); - - $request = $this->requestParameterFactory->getRequestParameter( - new PaymentTransactionStruct( - $paymentTransaction, - $requestData, - $salesChannelContext, - self::class, - $authorizationMethod - ) - ); - - try { - $response = $this->client->request($request); - } catch (PayoneRequestException $exception) { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $exception->getResponse()['error']['CustomerMessage'] - ); - } catch (\Throwable) { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } - - if (empty($response['status']) && $response['status'] !== 'REDIRECT') { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } - - $data = $this->preparePayoneOrderTransactionData($request, $response); - - $this->dataHandler->saveTransactionData($paymentTransaction, $salesChannelContext->getContext(), $data); - - return new RedirectResponse($response['redirecturl']); - } - - /** - * {@inheritdoc} - */ - public function finalize(AsyncPaymentTransactionStruct $transaction, Request $request, SalesChannelContext $salesChannelContext): void - { - $this->stateHandler->handleStateResponse($transaction, (string) $request->query->get('state')); - } - - /** - * {@inheritdoc} - */ public static function isCapturable(array $transactionData, array $payoneTransActionData): bool { if ($payoneTransActionData['authorizationType'] !== TransactionStatusService::AUTHORIZATION_TYPE_PREAUTHORIZATION) { @@ -116,15 +18,17 @@ public static function isCapturable(array $transactionData, array $payoneTransAc return strtolower((string) $transactionData['txaction']) === TransactionStatusService::ACTION_PAID; } - /** - * {@inheritdoc} - */ public static function isRefundable(array $transactionData): bool { - if (strtolower((string) $transactionData['txaction']) === TransactionStatusService::ACTION_CAPTURE && (float) $transactionData['receivable'] !== 0.0) { + if ((float) $transactionData['receivable'] !== 0.0 && strtolower((string) $transactionData['txaction']) === TransactionStatusService::ACTION_CAPTURE) { return true; } return strtolower((string) $transactionData['txaction']) === TransactionStatusService::ACTION_PAID; } + + protected function getDefaultAuthorizationMethod(): string + { + return AbstractRequestParameterBuilder::REQUEST_ACTION_PREAUTHORIZE; + } } diff --git a/src/PaymentHandler/PayoneWeChatPayPaymentHandler.php b/src/PaymentHandler/PayoneWeChatPayPaymentHandler.php index 0bdc0666d..95564c166 100644 --- a/src/PaymentHandler/PayoneWeChatPayPaymentHandler.php +++ b/src/PaymentHandler/PayoneWeChatPayPaymentHandler.php @@ -4,113 +4,12 @@ namespace PayonePayment\PaymentHandler; -use PayonePayment\Components\ConfigReader\ConfigReaderInterface; -use PayonePayment\Components\DataHandler\Transaction\TransactionDataHandlerInterface; -use PayonePayment\Components\PaymentStateHandler\PaymentStateHandlerInterface; use PayonePayment\Components\TransactionStatus\TransactionStatusService; -use PayonePayment\Payone\Client\Exception\PayoneRequestException; -use PayonePayment\Payone\Client\PayoneClientInterface; -use PayonePayment\Payone\RequestParameter\RequestParameterFactory; -use PayonePayment\Payone\RequestParameter\Struct\PaymentTransactionStruct; -use PayonePayment\Struct\PaymentTransaction; -use Shopware\Core\Checkout\Payment\Cart\AsyncPaymentTransactionStruct; -use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\AsynchronousPaymentHandlerInterface; -use Shopware\Core\Checkout\Payment\Exception\AsyncPaymentProcessException; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; +use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; -use Shopware\Core\System\SalesChannel\SalesChannelContext; -use Symfony\Component\HttpFoundation\RedirectResponse; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Contracts\Translation\TranslatorInterface; -class PayoneWeChatPayPaymentHandler extends AbstractPayonePaymentHandler implements AsynchronousPaymentHandlerInterface +class PayoneWeChatPayPaymentHandler extends AbstractAsynchronousPayonePaymentHandler { - private readonly TranslatorInterface $translator; - - public function __construct( - ConfigReaderInterface $configReader, - EntityRepository $lineItemRepository, - private readonly PayoneClientInterface $client, - TranslatorInterface $translator, - private readonly TransactionDataHandlerInterface $dataHandler, - private readonly PaymentStateHandlerInterface $stateHandler, - RequestStack $requestStack, - private readonly RequestParameterFactory $requestParameterFactory - ) { - parent::__construct($configReader, $lineItemRepository, $requestStack); - $this->translator = $translator; - } - - /** - * {@inheritdoc} - */ - public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $dataBag, SalesChannelContext $salesChannelContext): RedirectResponse - { - $requestData = $this->fetchRequestData(); - - // Get configured authorization method - $authorizationMethod = $this->getAuthorizationMethod( - $transaction->getOrder()->getSalesChannelId(), - 'weChatPayAuthorizationMethod', - 'authorization' - ); - - $paymentTransaction = PaymentTransaction::fromAsyncPaymentTransactionStruct($transaction, $transaction->getOrder()); - - $request = $this->requestParameterFactory->getRequestParameter( - new PaymentTransactionStruct( - $paymentTransaction, - $requestData, - $salesChannelContext, - self::class, - $authorizationMethod - ) - ); - - try { - $response = $this->client->request($request); - } catch (PayoneRequestException $exception) { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $exception->getResponse()['error']['CustomerMessage'] - ); - } catch (\Throwable) { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } - - if (empty($response['status']) && $response['status'] !== 'REDIRECT') { - throw new AsyncPaymentProcessException( - $transaction->getOrderTransaction()->getId(), - $this->translator->trans('PayonePayment.errorMessages.genericError') - ); - } - - $data = $this->preparePayoneOrderTransactionData($request, $response, [ - 'transactionState' => $response['status'], - 'allowCapture' => false, - 'allowRefund' => false, - ]); - - $this->dataHandler->saveTransactionData($paymentTransaction, $salesChannelContext->getContext(), $data); - - return new RedirectResponse($response['redirecturl']); - } - - /** - * {@inheritdoc} - */ - public function finalize(AsyncPaymentTransactionStruct $transaction, Request $request, SalesChannelContext $salesChannelContext): void - { - $this->stateHandler->handleStateResponse($transaction, (string) $request->query->get('state')); - } - - /** - * {@inheritdoc} - */ public static function isCapturable(array $transactionData, array $payoneTransActionData): bool { if ($payoneTransActionData['authorizationType'] !== TransactionStatusService::AUTHORIZATION_TYPE_PREAUTHORIZATION) { @@ -120,15 +19,26 @@ public static function isCapturable(array $transactionData, array $payoneTransAc return strtolower((string) $transactionData['txaction']) === TransactionStatusService::ACTION_PAID; } - /** - * {@inheritdoc} - */ public static function isRefundable(array $transactionData): bool { - if (strtolower((string) $transactionData['txaction']) === TransactionStatusService::ACTION_CAPTURE && (float) $transactionData['receivable'] !== 0.0) { + if ((float) $transactionData['receivable'] !== 0.0 && strtolower((string) $transactionData['txaction']) === TransactionStatusService::ACTION_CAPTURE) { return true; } return strtolower((string) $transactionData['txaction']) === TransactionStatusService::ACTION_PAID; } + + protected function getDefaultAuthorizationMethod(): string + { + return AbstractRequestParameterBuilder::REQUEST_ACTION_AUTHORIZE; + } + + protected function getAdditionalTransactionData(RequestDataBag $dataBag, array $request, array $response): array + { + return [ + 'transactionState' => $response['status'], + 'allowCapture' => false, + 'allowRefund' => false, + ]; + } } diff --git a/src/Payone/Client/Exception/PayoneRequestException.php b/src/Payone/Client/Exception/PayoneRequestException.php index 2f8f725b6..6fe0a7db0 100644 --- a/src/Payone/Client/Exception/PayoneRequestException.php +++ b/src/Payone/Client/Exception/PayoneRequestException.php @@ -6,8 +6,11 @@ class PayoneRequestException extends \Exception { - public function __construct(string $message, private readonly array $request = [], private readonly array $response = []) - { + public function __construct( + string $message, + private readonly array $request = [], + private readonly array $response = [] + ) { parent::__construct($message); } diff --git a/src/Payone/RequestParameter/Builder/ApplePay/AuthorizeRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/ApplePay/AuthorizeRequestParameterBuilder.php index 954ad3e2d..6418a6552 100644 --- a/src/Payone/RequestParameter/Builder/ApplePay/AuthorizeRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/ApplePay/AuthorizeRequestParameterBuilder.php @@ -26,21 +26,12 @@ class AuthorizeRequestParameterBuilder extends AbstractRequestParameterBuilder { - protected CartService $cartService; - - protected NumberRangeValueGeneratorInterface $numberRangeValueGenerator; - - protected EntityRepository $orderRepository; - public function __construct( - CartService $cartService, + protected CartService $cartService, protected CurrencyPrecisionInterface $currencyPrecision, - NumberRangeValueGeneratorInterface $numberRangeValueGenerator, - EntityRepository $orderRepository + protected NumberRangeValueGeneratorInterface $numberRangeValueGenerator, + protected EntityRepository $orderRepository ) { - $this->cartService = $cartService; - $this->numberRangeValueGenerator = $numberRangeValueGenerator; - $this->orderRepository = $orderRepository; } /** diff --git a/src/Payone/RequestParameter/Builder/CustomerInformationRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/CustomerInformationRequestParameterBuilder.php index 1f764025d..615feed1b 100644 --- a/src/Payone/RequestParameter/Builder/CustomerInformationRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/CustomerInformationRequestParameterBuilder.php @@ -20,11 +20,8 @@ class CustomerInformationRequestParameterBuilder extends AbstractRequestParameterBuilder { - private readonly EntityRepository $orderAddressRepository; - - public function __construct(EntityRepository $orderAddressRepository) + public function __construct(private readonly EntityRepository $orderAddressRepository) { - $this->orderAddressRepository = $orderAddressRepository; } /** diff --git a/src/Payone/RequestParameter/Builder/CustomerRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/CustomerRequestParameterBuilder.php index b936a3bde..07a04c8b7 100644 --- a/src/Payone/RequestParameter/Builder/CustomerRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/CustomerRequestParameterBuilder.php @@ -48,24 +48,12 @@ class CustomerRequestParameterBuilder extends AbstractRequestParameterBuilder { - private readonly EntityRepository $languageRepository; - - private readonly RequestStack $requestStack; - - private readonly EntityRepository $salutationRepository; - - private readonly EntityRepository $countryRepository; - public function __construct( - EntityRepository $languageRepository, - EntityRepository $salutationRepository, - EntityRepository $countryRepository, - RequestStack $requestStack + private readonly EntityRepository $languageRepository, + private readonly EntityRepository $salutationRepository, + private readonly EntityRepository $countryRepository, + private readonly RequestStack $requestStack ) { - $this->languageRepository = $languageRepository; - $this->salutationRepository = $salutationRepository; - $this->countryRepository = $countryRepository; - $this->requestStack = $requestStack; } /** diff --git a/src/Payone/RequestParameter/Builder/GeneralTransactionRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/GeneralTransactionRequestParameterBuilder.php index 5d98a316a..3c36383ec 100644 --- a/src/Payone/RequestParameter/Builder/GeneralTransactionRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/GeneralTransactionRequestParameterBuilder.php @@ -23,15 +23,12 @@ class GeneralTransactionRequestParameterBuilder extends AbstractRequestParameterBuilder { - protected EntityRepository $currencyRepository; - public function __construct( protected CartHasherInterface $cartHasher, protected ConfigReaderInterface $configReader, - EntityRepository $currencyRepository, + protected EntityRepository $currencyRepository, protected CurrencyPrecisionInterface $currencyPrecision ) { - $this->currencyRepository = $currencyRepository; } public function getRequestParameter(AbstractRequestParameterStruct $arguments): array @@ -138,7 +135,7 @@ private function getLatestReferenceNumber(PaymentTransaction $transaction): ?str return null; } - $transactions->sort(static fn(OrderTransactionEntity $a, OrderTransactionEntity $b) => $a->getCreatedAt() <=> $b->getCreatedAt()); + $transactions->sort(static fn (OrderTransactionEntity $a, OrderTransactionEntity $b) => $a->getCreatedAt() <=> $b->getCreatedAt()); /** @var OrderTransactionEntity $orderTransaction */ $orderTransaction = $transactions->last(); diff --git a/src/Payone/RequestParameter/Builder/Klarna/CreateSessionRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/Klarna/CreateSessionRequestParameterBuilder.php index b9487e041..036cbd1c4 100644 --- a/src/Payone/RequestParameter/Builder/Klarna/CreateSessionRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/Klarna/CreateSessionRequestParameterBuilder.php @@ -15,15 +15,12 @@ class CreateSessionRequestParameterBuilder extends AbstractKlarnaParameterBuilder { - private readonly CartService $cartService; - public function __construct( - CartService $cartService, + private readonly CartService $cartService, private readonly LineItemHydratorInterface $lineItemHydrator, private readonly CurrencyPrecisionInterface $currencyPrecision, private readonly OrderFetcherInterface $orderFetcher ) { - $this->cartService = $cartService; } /** diff --git a/src/Payone/RequestParameter/Builder/Klarna/FinancingTypeParameterBuilder.php b/src/Payone/RequestParameter/Builder/Klarna/FinancingTypeParameterBuilder.php index 9d8bdc460..474be568a 100644 --- a/src/Payone/RequestParameter/Builder/Klarna/FinancingTypeParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/Klarna/FinancingTypeParameterBuilder.php @@ -16,22 +16,12 @@ class FinancingTypeParameterBuilder extends AbstractKlarnaParameterBuilder { public function getRequestParameter(AbstractRequestParameterStruct $arguments): array { - switch ($arguments->getPaymentMethod()) { - case PayoneKlarnaInvoicePaymentHandler::class: - $type = 'KIV'; - - break; - case PayoneKlarnaInstallmentPaymentHandler::class: - $type = 'KIS'; - - break; - case PayoneKlarnaDirectDebitPaymentHandler::class: - $type = 'KDD'; - - break; - default: - throw new \RuntimeException('invalid payment method'); - } + $type = match ($arguments->getPaymentMethod()) { + PayoneKlarnaInvoicePaymentHandler::class => 'KIV', + PayoneKlarnaInstallmentPaymentHandler::class => 'KIS', + PayoneKlarnaDirectDebitPaymentHandler::class => 'KDD', + default => throw new \RuntimeException('invalid payment method'), + }; return [ 'financingtype' => $type, diff --git a/src/Payone/RequestParameter/Builder/OpenInvoice/AuthorizeRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/OpenInvoice/AuthorizeRequestParameterBuilder.php index c7face1a9..6434d0eeb 100644 --- a/src/Payone/RequestParameter/Builder/OpenInvoice/AuthorizeRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/OpenInvoice/AuthorizeRequestParameterBuilder.php @@ -13,11 +13,10 @@ class AuthorizeRequestParameterBuilder extends AbstractRequestParameterBuilder { - protected EntityRepository $currencyRepository; - - public function __construct(protected LineItemHydratorInterface $lineItemHydrator, EntityRepository $currencyRepository) - { - $this->currencyRepository = $currencyRepository; + public function __construct( + protected LineItemHydratorInterface $lineItemHydrator, + protected EntityRepository $currencyRepository + ) { } /** diff --git a/src/Payone/RequestParameter/Builder/OrderLinesRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/OrderLinesRequestParameterBuilder.php index e1bb2ab86..238df3288 100644 --- a/src/Payone/RequestParameter/Builder/OrderLinesRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/OrderLinesRequestParameterBuilder.php @@ -38,7 +38,7 @@ public function getRequestParameter(AbstractRequestParameterStruct $arguments): $paymentTransaction = $arguments->getPaymentTransaction(); $currency = $paymentTransaction->getOrder()->getCurrency(); $requestData = $arguments->getRequestData(); - $orderLines = $requestData->get('orderLines', []); + $orderLines = $requestData->all('orderLines'); $isCompleted = $requestData->get('complete', false); $includeShippingCosts = $requestData->get('includeShippingCosts', false); diff --git a/src/Payone/RequestParameter/Builder/PayolutionInvoicing/AuthorizeRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/PayolutionInvoicing/AuthorizeRequestParameterBuilder.php index effab9a65..024d66eab 100644 --- a/src/Payone/RequestParameter/Builder/PayolutionInvoicing/AuthorizeRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/PayolutionInvoicing/AuthorizeRequestParameterBuilder.php @@ -18,8 +18,10 @@ class AuthorizeRequestParameterBuilder extends PayolutionDebitAuthorizeRequestParameterBuilder { - public function __construct(protected ConfigReaderInterface $configReader, protected OrderFetcherInterface $orderFetcher) - { + public function __construct( + protected ConfigReaderInterface $configReader, + protected OrderFetcherInterface $orderFetcher + ) { } /** @@ -90,10 +92,10 @@ protected function provideCompanyParams(string $orderId, array &$parameters, Con if ($billingAddress->getVatId()) { $parameters['add_paydata[company_uid]'] = $billingAddress->getVatId(); - } elseif (method_exists($orderCustomer, 'getVatIds')) { + } else { $vatIds = $orderCustomer->getVatIds(); - if ($vatIds !== null && (is_countable($vatIds) ? \count($vatIds) : 0) > 0) { + if (\is_array($vatIds) && isset($vatIds[0])) { $parameters['add_paydata[company_uid]'] = $vatIds[0]; } } diff --git a/src/Payone/RequestParameter/Builder/PayolutionInvoicing/PreCheckRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/PayolutionInvoicing/PreCheckRequestParameterBuilder.php index 085f9a733..ca12bba56 100644 --- a/src/Payone/RequestParameter/Builder/PayolutionInvoicing/PreCheckRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/PayolutionInvoicing/PreCheckRequestParameterBuilder.php @@ -91,13 +91,10 @@ protected function provideCompanyParams(array &$parameters, SalesChannelContext if ($billingAddress->getCompany() || $customer->getCompany()) { $parameters['add_paydata[b2b]'] = 'yes'; - /** @phpstan-ignore-next-line */ - if (method_exists($customer, 'getVatIds')) { - $vatIds = $customer->getVatIds(); + $vatIds = $customer->getVatIds(); - if ($vatIds !== null && (is_countable($vatIds) ? \count($vatIds) : 0) > 0) { - $parameters['add_paydata[company_uid]'] = $vatIds[0]; - } + if (\is_array($vatIds) && isset($vatIds[0])) { + $parameters['add_paydata[company_uid]'] = $vatIds[0]; } } } diff --git a/src/Payone/RequestParameter/Builder/Postfinance/AuthorizeRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/Postfinance/AuthorizeRequestParameterBuilder.php index 88787e078..652c0cf3a 100644 --- a/src/Payone/RequestParameter/Builder/Postfinance/AuthorizeRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/Postfinance/AuthorizeRequestParameterBuilder.php @@ -14,18 +14,11 @@ class AuthorizeRequestParameterBuilder extends AbstractRequestParameterBuilder */ public function getRequestParameter(AbstractRequestParameterStruct $arguments): array { - switch ($arguments->getPaymentMethod()) { - case PayonePostfinanceWalletPaymentHandler::class: - $type = self::ONLINEBANK_TRANSFER_TYPE_WALLET; - - break; - case PayonePostfinanceCardPaymentHandler::class: - $type = self::ONLINEBANK_TRANSFER_TYPE_CARD; - - break; - default: - throw new \RuntimeException('Invalid payment method handler'); - } + $type = match ($arguments->getPaymentMethod()) { + PayonePostfinanceWalletPaymentHandler::class => self::ONLINEBANK_TRANSFER_TYPE_WALLET, + PayonePostfinanceCardPaymentHandler::class => self::ONLINEBANK_TRANSFER_TYPE_CARD, + default => throw new \RuntimeException('Invalid payment method handler'), + }; return [ 'request' => $arguments->getAction(), diff --git a/src/Payone/RequestParameter/Builder/RatepayDebit/AuthorizeRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/RatepayDebit/AuthorizeRequestParameterBuilder.php index e032a7874..8a2e89380 100644 --- a/src/Payone/RequestParameter/Builder/RatepayDebit/AuthorizeRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/RatepayDebit/AuthorizeRequestParameterBuilder.php @@ -21,16 +21,13 @@ class AuthorizeRequestParameterBuilder extends AbstractRequestParameterBuilder { - protected EntityRepository $customerRepository; - public function __construct( protected OrderFetcherInterface $orderFetcher, protected ProfileServiceInterface $profileService, protected AbstractDeviceFingerprintService $deviceFingerprintService, - EntityRepository $customerRepository, + protected EntityRepository $customerRepository, protected LineItemHydratorInterface $lineItemHydrator ) { - $this->customerRepository = $customerRepository; } /** diff --git a/src/Payone/RequestParameter/Builder/SecureInvoice/AuthorizeRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/SecureInvoice/AuthorizeRequestParameterBuilder.php index d87b0de33..e7d47828e 100644 --- a/src/Payone/RequestParameter/Builder/SecureInvoice/AuthorizeRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/SecureInvoice/AuthorizeRequestParameterBuilder.php @@ -13,11 +13,10 @@ class AuthorizeRequestParameterBuilder extends AbstractRequestParameterBuilder { - protected EntityRepository $currencyRepository; - - public function __construct(protected LineItemHydratorInterface $lineItemHydrator, EntityRepository $currencyRepository) - { - $this->currencyRepository = $currencyRepository; + public function __construct( + protected LineItemHydratorInterface $lineItemHydrator, + protected EntityRepository $currencyRepository + ) { } /** diff --git a/src/Payone/RequestParameter/Builder/SecuredDirectDebit/AuthorizeRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/SecuredDirectDebit/AuthorizeRequestParameterBuilder.php index b9d10b40b..c591d4e7a 100644 --- a/src/Payone/RequestParameter/Builder/SecuredDirectDebit/AuthorizeRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/SecuredDirectDebit/AuthorizeRequestParameterBuilder.php @@ -19,16 +19,13 @@ class AuthorizeRequestParameterBuilder extends AbstractRequestParameterBuilder { - protected EntityRepository $customerRepository; - public function __construct( protected OrderFetcherInterface $orderFetcher, protected AbstractDeviceFingerprintService $deviceFingerprintService, protected CurrencyPrecisionInterface $currencyPrecision, protected LineItemHydratorInterface $lineItemHydrator, - EntityRepository $customerRepository + protected EntityRepository $customerRepository ) { - $this->customerRepository = $customerRepository; } /** diff --git a/src/Payone/RequestParameter/Builder/SecuredInstallment/AuthorizeRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/SecuredInstallment/AuthorizeRequestParameterBuilder.php index e591eb9ac..236ef0011 100644 --- a/src/Payone/RequestParameter/Builder/SecuredInstallment/AuthorizeRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/SecuredInstallment/AuthorizeRequestParameterBuilder.php @@ -19,16 +19,13 @@ class AuthorizeRequestParameterBuilder extends AbstractRequestParameterBuilder { - protected EntityRepository $customerRepository; - public function __construct( protected OrderFetcherInterface $orderFetcher, protected AbstractDeviceFingerprintService $deviceFingerprintService, protected CurrencyPrecisionInterface $currencyPrecision, protected LineItemHydratorInterface $lineItemHydrator, - EntityRepository $customerRepository + protected EntityRepository $customerRepository ) { - $this->customerRepository = $customerRepository; } /** diff --git a/src/Payone/RequestParameter/Builder/SecuredInvoice/AuthorizeRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/SecuredInvoice/AuthorizeRequestParameterBuilder.php index 0effbaa7d..a8e954d1c 100644 --- a/src/Payone/RequestParameter/Builder/SecuredInvoice/AuthorizeRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/SecuredInvoice/AuthorizeRequestParameterBuilder.php @@ -19,16 +19,13 @@ class AuthorizeRequestParameterBuilder extends AbstractRequestParameterBuilder { - protected EntityRepository $customerRepository; - public function __construct( protected OrderFetcherInterface $orderFetcher, protected AbstractDeviceFingerprintService $deviceFingerprintService, protected CurrencyPrecisionInterface $currencyPrecision, protected LineItemHydratorInterface $lineItemHydrator, - EntityRepository $customerRepository + protected EntityRepository $customerRepository ) { - $this->customerRepository = $customerRepository; } /** diff --git a/src/Payone/RequestParameter/Builder/ShippingInformationRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/ShippingInformationRequestParameterBuilder.php index 0f9d65e63..5a4735de7 100644 --- a/src/Payone/RequestParameter/Builder/ShippingInformationRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/ShippingInformationRequestParameterBuilder.php @@ -24,7 +24,7 @@ class ShippingInformationRequestParameterBuilder extends AbstractRequestParamete public function getRequestParameter(AbstractRequestParameterStruct $arguments): array { $salesChannelContext = $arguments->getSalesChannelContext(); - $shippingAddress = $salesChannelContext->getCustomer() !== null ? $salesChannelContext->getCustomer()->getActiveShippingAddress() : null; + $shippingAddress = $salesChannelContext->getCustomer()?->getActiveShippingAddress(); $parameters = []; @@ -36,7 +36,7 @@ public function getRequestParameter(AbstractRequestParameterStruct $arguments): 'shipping_street' => $shippingAddress->getStreet(), 'shipping_zip' => $shippingAddress->getZipcode(), 'shipping_city' => $shippingAddress->getCity(), - 'shipping_country' => $shippingAddress->getCountry() !== null ? $shippingAddress->getCountry()->getIso() : null, + 'shipping_country' => $shippingAddress->getCountry()?->getIso(), ]); } diff --git a/src/Payone/RequestParameter/Builder/SystemRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/SystemRequestParameterBuilder.php index 013b1305b..64d7515ea 100644 --- a/src/Payone/RequestParameter/Builder/SystemRequestParameterBuilder.php +++ b/src/Payone/RequestParameter/Builder/SystemRequestParameterBuilder.php @@ -21,14 +21,11 @@ class SystemRequestParameterBuilder extends AbstractRequestParameterBuilder { - private readonly PluginService $pluginService; - public function __construct( - PluginService $pluginService, + private readonly PluginService $pluginService, private readonly string $shopwareVersion, private readonly ConfigReaderInterface $configReader ) { - $this->pluginService = $pluginService; } /** diff --git a/src/Payone/RequestParameter/RequestParameterFactory.php b/src/Payone/RequestParameter/RequestParameterFactory.php index 25f0f60b1..9ca9a0dc3 100644 --- a/src/Payone/RequestParameter/RequestParameterFactory.php +++ b/src/Payone/RequestParameter/RequestParameterFactory.php @@ -20,7 +20,7 @@ class RequestParameterFactory ]; /** - * @param \PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder[] $requestParameterBuilder + * @param AbstractRequestParameterBuilder[] $requestParameterBuilder */ public function __construct(private readonly iterable $requestParameterBuilder) { @@ -67,7 +67,7 @@ private function createRequest(array $parameters): array $this->generateParameterHash($parameters); $parameters['key'] = hash('md5', (string) $parameters['key']); - return array_filter($parameters, static fn($value) => $value !== null && $value !== ''); + return array_filter($parameters, static fn ($value) => $value !== null && $value !== ''); } private function generateParameterHash(array &$parameters): void diff --git a/src/Payone/Webhook/Handler/NotificationForwardHandler.php b/src/Payone/Webhook/Handler/NotificationForwardHandler.php index 0e4b0322e..16097de20 100644 --- a/src/Payone/Webhook/Handler/NotificationForwardHandler.php +++ b/src/Payone/Webhook/Handler/NotificationForwardHandler.php @@ -18,21 +18,12 @@ class NotificationForwardHandler implements WebhookHandlerInterface { - private readonly EntityRepository $notificationTargetRepository; - - private readonly EntityRepository $notificationForwardRepository; - - private readonly MessageBusInterface $messageBus; - public function __construct( - EntityRepository $notificationTargetRepository, - EntityRepository $notificationForwardRepository, + private readonly EntityRepository $notificationTargetRepository, + private readonly EntityRepository $notificationForwardRepository, private readonly TransactionDataHandlerInterface $transactionDataHandler, - MessageBusInterface $messageBus + private readonly MessageBusInterface $messageBus ) { - $this->notificationTargetRepository = $notificationTargetRepository; - $this->notificationForwardRepository = $notificationForwardRepository; - $this->messageBus = $messageBus; } public function supports(SalesChannelContext $salesChannelContext, array $data): bool @@ -44,9 +35,6 @@ public function supports(SalesChannelContext $salesChannelContext, array $data): return false; } - /** - * {@inheritdoc} - */ public function process(SalesChannelContext $salesChannelContext, Request $request): void { $data = $request->request->all(); @@ -74,13 +62,14 @@ private function persistNotificationForwards( string $paymentTransactionId, SalesChannelContext $salesChannelContext ): array { + /** @var array $data this annotation is required for rector */ $data = $request->request->all(); $notificationForwards = []; foreach ($notificationTargets as $target) { $notificationForwards[] = [ 'id' => Uuid::randomHex(), - 'content' => serialize(mb_convert_encoding((string) $data, 'UTF-8', 'ISO-8859-1')), + 'content' => serialize(mb_convert_encoding($data, 'UTF-8', 'ISO-8859-1')), 'notificationTargetId' => $target->getId(), 'transactionId' => $paymentTransactionId, 'ip' => $request->getClientIp(), @@ -123,10 +112,6 @@ private function getPaymentTransactionId(int $txid, SalesChannelContext $salesCh $txid ); - if ($paymentTransaction === null) { - return null; - } - - return $paymentTransaction->getOrderTransaction()->getId(); + return $paymentTransaction?->getOrderTransaction()->getId(); } } diff --git a/src/Payone/Webhook/Handler/TransactionStatusWebhookHandler.php b/src/Payone/Webhook/Handler/TransactionStatusWebhookHandler.php index cbeb0f7f4..a7790b960 100644 --- a/src/Payone/Webhook/Handler/TransactionStatusWebhookHandler.php +++ b/src/Payone/Webhook/Handler/TransactionStatusWebhookHandler.php @@ -14,8 +14,12 @@ class TransactionStatusWebhookHandler implements WebhookHandlerInterface { - public function __construct(private readonly TransactionStatusServiceInterface $transactionStatusService, private readonly TransactionDataHandlerInterface $transactionDataHandler, private readonly LoggerInterface $logger, private readonly AutomaticCaptureServiceInterface $automaticCaptureService) - { + public function __construct( + private readonly TransactionStatusServiceInterface $transactionStatusService, + private readonly TransactionDataHandlerInterface $transactionDataHandler, + private readonly LoggerInterface $logger, + private readonly AutomaticCaptureServiceInterface $automaticCaptureService + ) { } public function supports(SalesChannelContext $salesChannelContext, array $data): bool @@ -27,9 +31,6 @@ public function supports(SalesChannelContext $salesChannelContext, array $data): return false; } - /** - * {@inheritdoc} - */ public function process(SalesChannelContext $salesChannelContext, Request $request): void { $data = $request->request->all(); diff --git a/src/Payone/Webhook/MessageBus/MessageHandler/NotificationForwardHandler.php b/src/Payone/Webhook/MessageBus/MessageHandler/NotificationForwardHandler.php index 717fb8605..7d9f6725e 100644 --- a/src/Payone/Webhook/MessageBus/MessageHandler/NotificationForwardHandler.php +++ b/src/Payone/Webhook/MessageBus/MessageHandler/NotificationForwardHandler.php @@ -16,11 +16,10 @@ class NotificationForwardHandler implements MessageSubscriberInterface { - private readonly EntityRepository $notificationForwardRepository; - - public function __construct(EntityRepository $notificationForwardRepository, private readonly LoggerInterface $logger) - { - $this->notificationForwardRepository = $notificationForwardRepository; + public function __construct( + private readonly EntityRepository $notificationForwardRepository, + private readonly LoggerInterface $logger + ) { } public function __invoke(NotificationForwardCommand $message): void diff --git a/src/PayonePayment.php b/src/PayonePayment.php index 7ebc8fab3..f8f537427 100644 --- a/src/PayonePayment.php +++ b/src/PayonePayment.php @@ -34,20 +34,20 @@ public function build(ContainerBuilder $container): void parent::build($container); } - public function install(InstallContext $context): void + public function install(InstallContext $installContext): void { - $this->getConfigInstaller()->install($context); - $this->getCustomFieldInstaller()->install($context); - $this->getPaymentMethodInstaller()->install($context); - $this->getRuleInstallerSecureInvoice()->install($context); + $this->getConfigInstaller()->install($installContext); + $this->getCustomFieldInstaller()->install($installContext); + $this->getPaymentMethodInstaller()->install($installContext); + $this->getRuleInstallerSecureInvoice()->install($installContext); } - public function update(UpdateContext $context): void + public function update(UpdateContext $updateContext): void { - $this->getConfigInstaller()->update($context); - $this->getCustomFieldInstaller()->update($context); - $this->getPaymentMethodInstaller()->update($context); - $this->getRuleInstallerSecureInvoice()->update($context); + $this->getConfigInstaller()->update($updateContext); + $this->getCustomFieldInstaller()->update($updateContext); + $this->getPaymentMethodInstaller()->update($updateContext); + $this->getRuleInstallerSecureInvoice()->update($updateContext); } public function postUpdate(UpdateContext $updateContext): void @@ -55,61 +55,42 @@ public function postUpdate(UpdateContext $updateContext): void $this->getCustomFieldInstaller()->cleanup($updateContext); } - public function activate(ActivateContext $context): void + public function activate(ActivateContext $activateContext): void { - $this->getConfigInstaller()->activate($context); - $this->getCustomFieldInstaller()->activate($context); - $this->getPaymentMethodInstaller()->activate($context); - $this->getRuleInstallerSecureInvoice()->activate($context); + $this->getConfigInstaller()->activate($activateContext); + $this->getCustomFieldInstaller()->activate($activateContext); + $this->getPaymentMethodInstaller()->activate($activateContext); + $this->getRuleInstallerSecureInvoice()->activate($activateContext); } - public function deactivate(DeactivateContext $context): void + public function deactivate(DeactivateContext $deactivateContext): void { - $this->getConfigInstaller()->deactivate($context); - $this->getCustomFieldInstaller()->deactivate($context); - $this->getPaymentMethodInstaller()->deactivate($context); - $this->getRuleInstallerSecureInvoice()->deactivate($context); + $this->getConfigInstaller()->deactivate($deactivateContext); + $this->getCustomFieldInstaller()->deactivate($deactivateContext); + $this->getPaymentMethodInstaller()->deactivate($deactivateContext); + $this->getRuleInstallerSecureInvoice()->deactivate($deactivateContext); } - public function uninstall(UninstallContext $context): void + public function uninstall(UninstallContext $uninstallContext): void { - $this->getConfigInstaller()->uninstall($context); - $this->getCustomFieldInstaller()->uninstall($context); - $this->getPaymentMethodInstaller()->uninstall($context); - $this->getRuleInstallerSecureInvoice()->uninstall($context); + $this->getConfigInstaller()->uninstall($uninstallContext); + $this->getCustomFieldInstaller()->uninstall($uninstallContext); + $this->getPaymentMethodInstaller()->uninstall($uninstallContext); + $this->getRuleInstallerSecureInvoice()->uninstall($uninstallContext); - if ($context->keepUserData()) { + if ($uninstallContext->keepUserData()) { return; } /** @var Connection $connection */ $connection = $this->container->get(Connection::class); - if (method_exists($connection, 'executeStatement')) { - $connection->executeStatement('DROP TABLE payone_payment_card'); - $connection->executeStatement('DROP TABLE payone_payment_redirect'); - $connection->executeStatement('DROP TABLE payone_payment_mandate'); - $connection->executeStatement('DROP TABLE payone_payment_notification_forward'); - $connection->executeStatement('DROP TABLE payone_payment_notification_target'); - $connection->executeStatement('DROP TABLE payone_payment_order_transaction_data'); - - return; - } - - if (method_exists($connection, 'exec')) { - /** @noinspection PhpDeprecationInspection */ - $connection->exec('DROP TABLE payone_payment_card'); - /** @noinspection PhpDeprecationInspection */ - $connection->exec('DROP TABLE payone_payment_redirect'); - /** @noinspection PhpDeprecationInspection */ - $connection->exec('DROP TABLE payone_payment_mandate'); - /** @noinspection PhpDeprecationInspection */ - $connection->exec('DROP TABLE payone_payment_notification_forward'); - /** @noinspection PhpDeprecationInspection */ - $connection->exec('DROP TABLE payone_payment_notification_target'); - /** @noinspection PhpDeprecationInspection */ - $connection->exec('DROP TABLE payone_payment_order_transaction_data'); - } + $connection->executeStatement('DROP TABLE payone_payment_card'); + $connection->executeStatement('DROP TABLE payone_payment_redirect'); + $connection->executeStatement('DROP TABLE payone_payment_mandate'); + $connection->executeStatement('DROP TABLE payone_payment_notification_forward'); + $connection->executeStatement('DROP TABLE payone_payment_notification_target'); + $connection->executeStatement('DROP TABLE payone_payment_order_transaction_data'); } private function getRuleInstallerSecureInvoice(): RuleInstallerSecureInvoice diff --git a/src/Resources/app/administration/src/module/payone-payment/filter/payone_currency.filter.js b/src/Resources/app/administration/src/module/payone-payment/filter/payone_currency.filter.js index 80169a58f..da4f02216 100644 --- a/src/Resources/app/administration/src/module/payone-payment/filter/payone_currency.filter.js +++ b/src/Resources/app/administration/src/module/payone-payment/filter/payone_currency.filter.js @@ -1,6 +1,7 @@ +const { Filter } = Shopware; const { currency } = Shopware.Utils.format; -export default (value, format, decimalPrecision, decimalPlaces) => { +Filter.register('payone_currency', (value, format, decimalPrecision, decimalPlaces) => { if (value === null) { return '-'; } @@ -12,4 +13,4 @@ export default (value, format, decimalPrecision, decimalPlaces) => { value /= (10 ** decimalPrecision); return currency(value, format, decimalPlaces); -}; +}); diff --git a/src/Resources/app/administration/src/module/payone-payment/index.js b/src/Resources/app/administration/src/module/payone-payment/index.js index f0810a73d..8ac68e42b 100644 --- a/src/Resources/app/administration/src/module/payone-payment/index.js +++ b/src/Resources/app/administration/src/module/payone-payment/index.js @@ -1,13 +1,12 @@ import deDE from './snippet/de_DE.json'; import enGB from './snippet/en_GB.json'; +import './filter/payone_currency.filter'; Shopware.Component.register('payone-payment-plugin-icon', () => import('./component/payone-payment-plugin-icon')); Shopware.Component.register('payone-ratepay-profile-configurations', () => import('./component/payone-ratepay-profile-configurations')); Shopware.Component.register('payone-ratepay-profiles', () => import('./component/payone-ratepay-profiles')); Shopware.Component.register('payone-settings', () => import('./page/payone-settings')); -Shopware.Filter.register('payone_currency', () => import('./filter/payone_currency.filter')); - Shopware.Module.register('payone-payment', { type: 'plugin', name: 'PayonePayment', diff --git a/src/Resources/app/administration/src/module/sw-order/component/payone-payment-management/index.js b/src/Resources/app/administration/src/module/sw-order/component/payone-payment-management/index.js index bbacde31c..d19f2c2d5 100644 --- a/src/Resources/app/administration/src/module/sw-order/component/payone-payment-management/index.js +++ b/src/Resources/app/administration/src/module/sw-order/component/payone-payment-management/index.js @@ -122,7 +122,7 @@ export default { } }, reloadEntityData() { - // ToDo 6.5: Reload order after capture/refund? + this.$emit('reload-entity-data'); }, getPayoneCardType(transaction) { let cardType = transaction.extensions.payonePaymentOrderTransactionData?.additionalData?.card_type; diff --git a/src/Resources/app/administration/src/module/sw-order/component/payone-payment-management/payone-payment-management.html.twig b/src/Resources/app/administration/src/module/sw-order/component/payone-payment-management/payone-payment-management.html.twig index c08d3b601..29a4b362a 100644 --- a/src/Resources/app/administration/src/module/sw-order/component/payone-payment-management/payone-payment-management.html.twig +++ b/src/Resources/app/administration/src/module/sw-order/component/payone-payment-management/payone-payment-management.html.twig @@ -1,7 +1,7 @@ {% block payone_payment_management %}