diff --git a/src/Components/Document/InvoiceGenerator.php b/src/Components/Document/InvoiceGenerator.php index 04ce796..2bc8203 100644 --- a/src/Components/Document/InvoiceGenerator.php +++ b/src/Components/Document/InvoiceGenerator.php @@ -1,5 +1,7 @@ clientFactory->createClient(); + $client = $this->clientFactory->createClient(); $payment = $client->getResourceService()->fetchResourceByUrl($webhook->getRetrieveUrl()); if (!$payment instanceof Payment) { @@ -63,7 +63,7 @@ public function execute(Webhook $webhook, SalesChannelContext $context): void $transaction = $this->getOrderTransaction($payment, $context->getContext()); - if (null === $transaction) { + if ($transaction === null) { return; } diff --git a/src/EventListeners/Checkout/FinishPageEventListener.php b/src/EventListeners/Checkout/FinishPageEventListener.php index 2e576fa..385a381 100644 --- a/src/EventListeners/Checkout/FinishPageEventListener.php +++ b/src/EventListeners/Checkout/FinishPageEventListener.php @@ -72,7 +72,7 @@ public function onCheckoutFinish(CheckoutFinishPageLoadedEvent $event): void private function getInvoiceTransactions(OrderTransactionCollection $transactionCollection) { return $transactionCollection->filter( - function (OrderTransactionEntity $orderTransaction) { + static function (OrderTransactionEntity $orderTransaction) { return in_array($orderTransaction->getPaymentMethodId(), InvoiceGenerator::SUPPORTED_PAYMENT_METHODS); } ); diff --git a/src/HeidelPayment.php b/src/HeidelPayment.php index 8b65685..35aba4a 100755 --- a/src/HeidelPayment.php +++ b/src/HeidelPayment.php @@ -108,15 +108,13 @@ public function uninstall(UninstallContext $uninstallContext): void public function getViewPaths(): array { - return array_merge(parent::getViewPaths(), [ - 'Resources/views/storefront', - 'Resources/views/administration', - 'Resources/views/framework', - ]); - } - - public function getStorefrontScriptPath(): string - { - return 'Resources/dist/storefront/js'; + return array_merge( + parent::getViewPaths(), + [ + 'Resources/views/storefront', + 'Resources/views/administration', + 'Resources/views/framework', + ] + ); } } diff --git a/src/Resources/dist/storefront/js/heidel-payment.js b/src/Resources/dist/storefront/js/heidel-payment.js index 89ce3a8..bd576e1 100644 --- a/src/Resources/dist/storefront/js/heidel-payment.js +++ b/src/Resources/dist/storefront/js/heidel-payment.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([["heidel-payment"],{PVBn:function(e,t,n){"use strict";n.r(t);var r=n("FGIj");function i(e){return(i="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 o(e,t){for(var n=0;n1&&void 0!==arguments[1]&&arguments[1],n=document.getElementsByClassName(this.options.errorWrapperClass).item(0),r=document.querySelectorAll(this.options.errorContentSelector)[0];t&&""!==r.innerText?r.innerText="".concat(r.innerText,"\n").concat(e.message):r.innerText=e.message,n.hidden=!1,n.scrollIntoView({block:"end",behavior:"smooth"}),this.setSubmitButtonActive(!0)}},{key:"_registerEvents",value:function(){this.submitButton.addEventListener("click",this._onSubmitButtonClick.bind(this))}},{key:"_onSubmitButtonClick",value:function(e){e.preventDefault(),this._validateForm()&&(this.setSubmitButtonActive(!1),this.$emitter.publish("heidelpayBase_createResource"))}},{key:"_validateForm",value:function(){var e=!0,t=document.forms[this.options.confirmFormId].elements;this._clearErrorMessage();for(var n=0;n0&&this.showError({message:this.options.errorShouldNotBeEmpty.replace(/%field%/,r.labels[0].innerText)},!0),e=!1):r.classList.remove("is-invalid")}return e}},{key:"_clearErrorMessage",value:function(){var e=document.getElementsByClassName(this.options.errorWrapperClass).item(0);document.querySelectorAll(this.options.errorContentSelector)[0].innerText="",e.hidden=!0}}])&&o(n.prototype,i),s&&o(n,s),t}();s(l,"options",{publicKey:null,locale:null,submitButtonId:"confirmFormSubmit",disabledClass:"disabled",resourceIdElementId:"heidelpayResourceId",confirmFormId:"confirmOrderForm",errorWrapperClass:"heidelpay-error-wrapper",errorContentSelector:".heidelpay-error-wrapper .alert-content",errorShouldNotBeEmpty:"%field% should not be empty"}),s(l,"heidelpayInstance",null);var p=n("gHbT");function y(e){return(y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function d(e,t){for(var n=0;n1&&void 0!==arguments[1]&&arguments[1],n=document.getElementsByClassName(this.options.errorWrapperClass).item(0),r=document.querySelectorAll(this.options.errorContentSelector)[0];t&&""!==r.innerText?r.innerText="".concat(r.innerText,"\n").concat(e.message):r.innerText=e.message,n.hidden=!1,n.scrollIntoView({block:"end",behavior:"smooth"}),this.setSubmitButtonActive(!0)}},{key:"_registerEvents",value:function(){this.submitButton.addEventListener("click",this._onSubmitButtonClick.bind(this))}},{key:"_onSubmitButtonClick",value:function(e){e.preventDefault(),this._validateForm()&&(this.setSubmitButtonActive(!1),this.$emitter.publish("heidelpayBase_createResource"))}},{key:"_validateForm",value:function(){var e=!0,t=document.forms[this.options.confirmFormId].elements;this._clearErrorMessage();for(var n=0;n0&&this.showError({message:this.options.errorShouldNotBeEmpty.replace(/%field%/,r.labels[0].innerText)},!0),e=!1):r.classList.remove("is-invalid")}return e}},{key:"_clearErrorMessage",value:function(){var e=document.getElementsByClassName(this.options.errorWrapperClass).item(0);document.querySelectorAll(this.options.errorContentSelector)[0].innerText="",e.hidden=!0}}])&&o(n.prototype,i),s&&o(n,s),t}();s(l,"options",{publicKey:null,locale:null,submitButtonId:"confirmFormSubmit",disabledClass:"disabled",resourceIdElementId:"heidelpayResourceId",confirmFormId:"confirmOrderForm",errorWrapperClass:"heidelpay-error-wrapper",errorContentSelector:".heidelpay-error-wrapper .alert-content",errorShouldNotBeEmpty:"%field% should not be empty"}),s(l,"heidelpayInstance",null);var p=n("gHbT");function y(e){return(y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function d(e,t){for(var n=0;n this._onCreateResource(), { scope: this, diff --git a/src/Resources/views/storefront/component/heidelpay/frames/invoice-factoring.html.twig b/src/Resources/views/storefront/component/heidelpay/frames/invoice-factoring.html.twig index d77f998..10bc696 100644 --- a/src/Resources/views/storefront/component/heidelpay/frames/invoice-factoring.html.twig +++ b/src/Resources/views/storefront/component/heidelpay/frames/invoice-factoring.html.twig @@ -15,6 +15,12 @@ form="confirmOrderForm" required="required" {% if context.customer.birthday is not empty %}value="{{ context.customer.birthday|date('Y-m-d') }}"{% endif %}/> + + {% if context.customer.activeBillingAddress.company %} +
+ +
+ {% endif %} {% endblock %}