diff --git a/Model/Config/Source/showDobOptions.php b/Model/Config/Source/showDobOptions.php
new file mode 100644
index 00000000..278c4adf
--- /dev/null
+++ b/Model/Config/Source/showDobOptions.php
@@ -0,0 +1,43 @@
+toArray();
+
+ $arrResult = [];
+ foreach ($arrOptions as $value => $label) {
+ $arrResult[] = ['value' => $value, 'label' => $label];
+ }
+ return $arrResult;
+ }
+
+ /**
+ * Get options in "key-value" format
+ *
+ * @return array
+ */
+ public function toArray()
+ {
+ return [
+ '0' => __('No'),
+ '1' => __('Yes, as optional'),
+ '2' => __('Yes, as required'),
+ ];
+ }
+
+}
diff --git a/Model/ConfigProvider.php b/Model/ConfigProvider.php
index 3841baa4..5817008a 100644
--- a/Model/ConfigProvider.php
+++ b/Model/ConfigProvider.php
@@ -1,6 +1,6 @@
getBanks($code);
$config['payment']['icon'][$code] = $this->getIcon($code);
$config['payment']['showkvk'][$code] = $this->getKVK($code);
+ $config['payment']['showdob'][$code] = $this->getDOB($code);
}
}
@@ -139,6 +140,11 @@ protected function getKVK($code)
return $this->methods[$code]->getKVK();
}
+ protected function getDOB($code)
+ {
+ return $this->methods[$code]->getDOB();
+ }
+
/**
* Get payment method icon
*
diff --git a/Model/Paymentmethod/Billink.php b/Model/Paymentmethod/Billink.php
index 04a03e96..a0ffe8c6 100644
--- a/Model/Paymentmethod/Billink.php
+++ b/Model/Paymentmethod/Billink.php
@@ -1,6 +1,6 @@
_scopeConfig->getValue('payment/paynl_payment_billink/showkvk', 'store');
}
+ public function getDOB()
+ {
+ return $this->_scopeConfig->getValue('payment/paynl_payment_billink/showdob', 'store');
+ }
+
public function assignData(\Magento\Framework\DataObject $data)
{
parent::assignData($data);
@@ -33,6 +38,7 @@ public function assignData(\Magento\Framework\DataObject $data)
if (is_array($data))
{
$this->getInfoInstance()->setAdditionalInformation('kvknummer', $data['kvknummer']);
+ $this->getInfoInstance()->setAdditionalInformation('dob', $data['dob']);
} elseif ($data instanceof \Magento\Framework\DataObject)
{
@@ -46,6 +52,10 @@ public function assignData(\Magento\Framework\DataObject $data)
$this->getInfoInstance()->setAdditionalInformation('billink_agree', $additional_data['billink_agree']);
}
+ if (isset($additional_data['dob'])) {
+ $this->getInfoInstance()->setAdditionalInformation('dob', $additional_data['dob']);
+ }
+
}
return $this;
}
diff --git a/Model/Paymentmethod/PaymentMethod.php b/Model/Paymentmethod/PaymentMethod.php
index 1f13030c..f7720f61 100644
--- a/Model/Paymentmethod/PaymentMethod.php
+++ b/Model/Paymentmethod/PaymentMethod.php
@@ -1,6 +1,6 @@
getConfigData('order_status');
@@ -194,6 +199,7 @@ protected function doStartTransaction(Order $order)
$additionalData = $order->getPayment()->getAdditionalInformation();
$bankId = null;
$expireDate = null;
+
if (isset($additionalData['kvknummer']) && is_numeric($additionalData['kvknummer'])) {
$kvknummer = $additionalData['kvknummer'];
}
@@ -244,6 +250,9 @@ protected function doStartTransaction(Order $order)
'phoneNumber' => $arrBillingAddress['telephone'],
'emailAddress' => $arrBillingAddress['email'],
);
+ if (isset($additionalData['dob'])) {
+ $enduser['dob'] = $additionalData['dob'];
+ }
if (isset($arrBillingAddress['company']) && !empty($arrBillingAddress['company'])) {
$enduser['company']['name'] = $arrBillingAddress['company'];
@@ -423,6 +432,8 @@ protected function doStartTransaction(Order $order)
}
$data['ipaddress'] = $ipAddress;
+
+
$transaction = \Paynl\Transaction::start($data);
return $transaction;
diff --git a/etc/adminhtml/paymentmethods/billink.xml b/etc/adminhtml/paymentmethods/billink.xml
index ec8b71fc..e5caea46 100644
--- a/etc/adminhtml/paymentmethods/billink.xml
+++ b/etc/adminhtml/paymentmethods/billink.xml
@@ -18,6 +18,15 @@
payment/paynl_payment_billink/showkvk
+
+
+ Paynl\Payment\Model\Config\Source\showDobOptions
+
+ 1
+
+ payment/paynl_payment_billink/showdob
+
+
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 57d97ff9..7a73b652 100644
--- a/view/frontend/web/js/view/payment/method-renderer/billink.js
+++ b/view/frontend/web/js/view/payment/method-renderer/billink.js
@@ -14,22 +14,51 @@ define(
template: 'Paynl_Payment/payment/billink'
},
kvknummer: null,
+ dateofbirth: null,
billink_agree: null,
- showKVK: function () {
+ showKVK: function () {
return this.getKVK() > 0;
},
getKVK: function () {
return window.checkoutConfig.payment.showkvk[this.item.method];
},
+ showDOB: function () {
+ return this.getDOB() > 0;
+ },
+ getDOB: function () {
+ return window.checkoutConfig.payment.showdob[this.item.method];
+ },
+ showKVKDOB: function () {
+ return this.getDOB() > 0;
+ },
+ getKVKDOB: function () {
+ return (this.getDOB() > 0 && this.getKVK() > 0);
+ },
/**
* Get payment method data
*/
getData: function () {
+
+ var dob = new Date(this.dateofbirth);
+
+ var dd = dob.getDate();
+ var mm = dob.getMonth() + 1;
+
+ var yyyy = dob.getFullYear();
+ if (dd < 10) {
+ dd = '0' + dd;
+ }
+ if (mm < 10) {
+ mm = '0' + mm;
+ }
+ var dob_format = dd + '-' + mm + '-' + yyyy;
+
return {
'method': this.item.method,
'po_number': null,
'additional_data': {
"kvknummer": this.kvknummer,
+ "dob": dob_format,
"billink_agree": this.billink_agree
}
};
@@ -43,7 +72,7 @@ define(
placeOrder: function (data, event) {
var placeOrder;
var showingKVK = this.getKVK() == 2;
-
+ var showingDOB = this.getDOB() == 2;
if (showingKVK) {
if (this.billink_agree != true) {
alert('U dient eerst akkoord te gaan met de betalingsvoorwaarden van Billink.');
@@ -54,6 +83,12 @@ define(
return false;
}
}
+ if (showingDOB) {
+ if (this.dateofbirth == null || this.dateofbirth.length < 1) {
+ alert('Voer een geldig geboortedatum in.');
+ return false;
+ }
+ }
if (event) {
event.preventDefault();
diff --git a/view/frontend/web/template/payment/billink.html b/view/frontend/web/template/payment/billink.html
index bf984bdd..095e12c3 100644
--- a/view/frontend/web/template/payment/billink.html
+++ b/view/frontend/web/template/payment/billink.html
@@ -21,15 +21,22 @@
+
+
+
+
+
+
+