Skip to content

Commit

Permalink
Merge pull request #97 from ratepay/M2-123-B2B-Check
Browse files Browse the repository at this point in the history
M2-123 - Added B2B check to frontend checkout
  • Loading branch information
FatchipRobert authored May 9, 2023
2 parents 3c94c43 + 35ab496 commit 74efba9
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 4 deletions.
3 changes: 3 additions & 0 deletions Model/ResourceModel/ApiLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 .= '*';
Expand Down
1 change: 1 addition & 0 deletions i18n/de_DE.csv
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 13 additions & 1 deletion view/frontend/web/js/view/payment/method-renderer/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 5 additions & 1 deletion view/frontend/web/template/payment/directdebit.html
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,13 @@
</button>
</div>
</div>
<div class="ratepay_ala_warning" data-bind="visible: !isPlaceOrderActionAllowedRatePay()"><br>
<div class="ratepay_ala_warning" data-bind="visible: isDifferentAddressNotAllowed()"><br>
<span style="float:right;"><!-- ko i18n: 'Orders with different billing- and shipping-addresses are not supported for this payment method.'--><!-- /ko --></span>
<div style="clear:both;"></div>
</div>
<div class="ratepay_ala_warning" data-bind="visible: !isDifferentAddressNotAllowed() && isB2BNotAllowed()"><br>
<span style="float:right;"><!-- ko i18n: 'B2B orders are not supported for this payment method.'--><!-- /ko --></span>
<div style="clear:both;"></div>
</div>
</div>
</div>
6 changes: 5 additions & 1 deletion view/frontend/web/template/payment/installment.html
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,13 @@ <h3><!-- ko i18n: 'rp_rate_title'--><!-- /ko --></h3>
</button>
</div>
</div>
<div class="ratepay_ala_warning" data-bind="visible: !isPlaceOrderActionAllowedRatePay()"><br>
<div class="ratepay_ala_warning" data-bind="visible: isDifferentAddressNotAllowed()"><br>
<span style="float:right;"><!-- ko i18n: 'Orders with different billing- and shipping-addresses are not supported for this payment method.'--><!-- /ko --></span>
<div style="clear:both;"></div>
</div>
<div class="ratepay_ala_warning" data-bind="visible: !isDifferentAddressNotAllowed() && isB2BNotAllowed()"><br>
<span style="float:right;"><!-- ko i18n: 'B2B orders are not supported for this payment method.'--><!-- /ko --></span>
<div style="clear:both;"></div>
</div>
</div>
</div>
6 changes: 5 additions & 1 deletion view/frontend/web/template/payment/invoice.html
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,13 @@
</button>
</div>
</div>
<div class="ratepay_ala_warning" data-bind="visible: !isPlaceOrderActionAllowedRatePay()"><br>
<div class="ratepay_ala_warning" data-bind="visible: isDifferentAddressNotAllowed()"><br>
<span style="float:right;"><!-- ko i18n: 'Orders with different billing- and shipping-addresses are not supported for this payment method.'--><!-- /ko --></span>
<div style="clear:both;"></div>
</div>
<div class="ratepay_ala_warning" data-bind="visible: !isDifferentAddressNotAllowed() && isB2BNotAllowed()"><br>
<span style="float:right;"><!-- ko i18n: 'B2B orders are not supported for this payment method.'--><!-- /ko --></span>
<div style="clear:both;"></div>
</div>
</div>
</div>

0 comments on commit 74efba9

Please sign in to comment.