From 35ab496cc4091258ee9c2755e5584ab932a429a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Wed, 3 May 2023 19:06:09 +0200 Subject: [PATCH] M2-123 - Added B2B check to frontend checkout --- Model/ResourceModel/ApiLog.php | 3 +++ i18n/de_DE.csv | 1 + .../web/js/view/payment/method-renderer/base.js | 14 +++++++++++++- .../frontend/web/template/payment/directdebit.html | 6 +++++- .../frontend/web/template/payment/installment.html | 6 +++++- view/frontend/web/template/payment/invoice.html | 6 +++++- 6 files changed, 32 insertions(+), 4 deletions(-) diff --git a/Model/ResourceModel/ApiLog.php b/Model/ResourceModel/ApiLog.php index 2cabbad..3d3285b 100644 --- a/Model/ResourceModel/ApiLog.php +++ b/Model/ResourceModel/ApiLog.php @@ -55,6 +55,9 @@ protected function _construct() protected function maskTagValue($xmlString, $tagName) { preg_match('#<'.$tagName.'>(\w*)<\/'.$tagName.'>#', $xmlString, $matches); + if (!is_array($matches) || !isset($matches[1])) { + return $xmlString; + } $masked = ''; for ($i = 0; $i < strlen($matches[1]); $i++) { $masked .= '*'; diff --git a/i18n/de_DE.csv b/i18n/de_DE.csv index 5afb73d..5a6e716 100644 --- a/i18n/de_DE.csv +++ b/i18n/de_DE.csv @@ -45,6 +45,7 @@ ratepay_directdebit_sepa_notice_block_3,"Ich kann innerhalb von acht Wochen, beg "Please enter your Vat ID","Bitte geben Sie Ihre USt-IdNr. an",module,RatePAY_Payment "Phone Number","Telefonnummer",module,RatePAY_Payment "b2b not allowed","Diese Zahlungsart steht für Geschäftskunden nicht zur Verfügung.",module,RatePAY_Payment +"B2B orders are not supported for this payment method.","Diese Zahlungsart steht für Geschäftskunden nicht zur Verfügung.",module,RatePAY_Payment "ala not allowed","Um diese Zahlungsart zu nutzen, muss die Lieferadresse der Rechnungsadresse entsprechen.",module,RatePAY_Payment Ratepay,Ratepay,module,RatePAY_Payment Germany,Deutschland,module,RatePAY_Payment diff --git a/view/frontend/web/js/view/payment/method-renderer/base.js b/view/frontend/web/js/view/payment/method-renderer/base.js index 0715d10..f4ace07 100644 --- a/view/frontend/web/js/view/payment/method-renderer/base.js +++ b/view/frontend/web/js/view/payment/method-renderer/base.js @@ -51,8 +51,20 @@ define( }); }, isPlaceOrderActionAllowedRatePay: function () { + return this.isDifferentAddressNotAllowed() === false && this.isB2BNotAllowed() === false; + }, + isDifferentAddressNotAllowed: function () { var config = this.getPaymentConfig(); - return ((config && config.differentShippingAddressAllowed === true) || (quote.billingAddress() != null && quote.billingAddress().getCacheKey() == quote.shippingAddress().getCacheKey())); + if (config && config.differentShippingAddressAllowed === true) { + return false; + } + return (quote.billingAddress() === null || quote.billingAddress().getCacheKey() !== quote.shippingAddress().getCacheKey()); + }, + isB2BNotAllowed: function () { + if (this.isB2BEnabled() === false && this.isCompanySet() === true) { + return true; + } + return false; }, getCustomerName: function () { if (quote.billingAddress() != null && quote.billingAddress().firstname != undefined) { diff --git a/view/frontend/web/template/payment/directdebit.html b/view/frontend/web/template/payment/directdebit.html index 72d1bb5..04e5713 100644 --- a/view/frontend/web/template/payment/directdebit.html +++ b/view/frontend/web/template/payment/directdebit.html @@ -199,9 +199,13 @@ -

+

+

+ +
+
diff --git a/view/frontend/web/template/payment/installment.html b/view/frontend/web/template/payment/installment.html index d390c16..98b9b21 100644 --- a/view/frontend/web/template/payment/installment.html +++ b/view/frontend/web/template/payment/installment.html @@ -271,9 +271,13 @@

-

+

+

+ +
+
diff --git a/view/frontend/web/template/payment/invoice.html b/view/frontend/web/template/payment/invoice.html index 6dcfa80..0f98be3 100644 --- a/view/frontend/web/template/payment/invoice.html +++ b/view/frontend/web/template/payment/invoice.html @@ -139,9 +139,13 @@ -

+

+

+ +
+