diff --git a/Model/Method/Billink.php b/Model/Method/Billink.php index c6df7e1d4..0c774fa60 100644 --- a/Model/Method/Billink.php +++ b/Model/Method/Billink.php @@ -644,6 +644,30 @@ public function getArticleArrayLine( return $article; } + + /** + * @param \Magento\Sales\Api\Data\OrderPaymentInterface|\Magento\Payment\Model\InfoInterface $payment + * + * @return string|null + */ + private function getBirthDate($payment) + { + $birth = $payment->getAdditionalInformation('customer_DoB'); + + if(!is_string($birth) || strlen(trim($birth)) === 0) { + return null; + } + + $birthDayStamp = date( + "d-m-Y", + strtotime(str_replace('/', '-', $birth)) + ); + + if($birthDayStamp === false) { + return null; + } + return $birthDayStamp; + } /** * @param \Magento\Sales\Api\Data\OrderPaymentInterface|\Magento\Payment\Model\InfoInterface $payment @@ -659,10 +683,8 @@ public function getRequestBillingData($payment) $billingAddress = $order->getBillingAddress(); $streetFormat = $this->formatStreet($billingAddress->getStreet()); - $birthDayStamp = date( - "d-m-Y", - strtotime(str_replace('/', '-', $payment->getAdditionalInformation('customer_DoB'))) - ); + $birthDayStamp = $this->getBirthDate($payment); + $chamberOfCommerce = $payment->getAdditionalInformation('customer_chamberOfCommerce'); $VATNumber = $payment->getAdditionalInformation('customer_VATNumber'); $telephone = $payment->getAdditionalInformation('customer_telephone'); diff --git a/view/frontend/web/js/view/payment/method-renderer/billink.js b/view/frontend/web/js/view/payment/method-renderer/billink.js index 89aa4eb98..c2ac10771 100644 --- a/view/frontend/web/js/view/payment/method-renderer/billink.js +++ b/view/frontend/web/js/view/payment/method-renderer/billink.js @@ -173,6 +173,9 @@ define( ); this.billingName = ko.computed( function () { + if(this.isB2B && quote.billingAddress() !== null) { + return quote.billingAddress().company; + } if(quote.billingAddress() !== null) { return quote.billingAddress().firstname + " " + quote.billingAddress().lastname; } @@ -236,8 +239,6 @@ define( getActiveValidationFields() { let fields = [ 'buckaroo_magento2_billink_TermsCondition', - 'buckaroo_magento2_billink_DoB', - 'buckaroo_magento2_bilink_genderSelect' ]; if(this.showPhone()) { fields.push('buckaroo_magento2_billink_Telephone') @@ -245,6 +246,11 @@ define( if(this.isB2B) { fields.push('buckaroo_magento2_billink_chamberOfCommerce') + } else { + fields = fields.concat([ + 'buckaroo_magento2_billink_DoB', + 'buckaroo_magento2_bilink_genderSelect' + ]); } return fields; diff --git a/view/frontend/web/template/payment/buckaroo_magento2_billink.html b/view/frontend/web/template/payment/buckaroo_magento2_billink.html index 84db82dc7..fdf2053a8 100644 --- a/view/frontend/web/template/payment/buckaroo_magento2_billink.html +++ b/view/frontend/web/template/payment/buckaroo_magento2_billink.html @@ -32,6 +32,7 @@ attr: {'data-hasrequired': $t('* Required Fields')}">
+
@@ -45,6 +46,7 @@
+
@@ -77,6 +79,7 @@
+
@@ -104,6 +107,7 @@ name="payment[buckaroo_magento2_billink][customer_DoB]">
+