We will be off from 27/1 (Monday) to 31/1 (Friday) (GMT +7) for our Tet Holiday (Lunar New Year) in our country

Commit f4c67f1f authored by Rik ter Beek's avatar Rik ter Beek Committed by Aleffio

store card on adyen side for pos payments

parent 1c9b2899
...@@ -59,7 +59,8 @@ class AdyenInitiateTerminalApi implements AdyenInitiateTerminalApiInterface ...@@ -59,7 +59,8 @@ class AdyenInitiateTerminalApi implements AdyenInitiateTerminalApiInterface
\Adyen\Payment\Model\RecurringType $recurringType, \Adyen\Payment\Model\RecurringType $recurringType,
\Magento\Checkout\Model\Session $_checkoutSession, \Magento\Checkout\Model\Session $_checkoutSession,
array $data = [] array $data = []
) { )
{
$this->_encryptor = $encryptor; $this->_encryptor = $encryptor;
$this->_adyenHelper = $adyenHelper; $this->_adyenHelper = $adyenHelper;
$this->_adyenLogger = $adyenLogger; $this->_adyenLogger = $adyenLogger;
...@@ -107,6 +108,28 @@ class AdyenInitiateTerminalApi implements AdyenInitiateTerminalApiInterface ...@@ -107,6 +108,28 @@ class AdyenInitiateTerminalApi implements AdyenInitiateTerminalApiInterface
$serviceID = date("dHis"); $serviceID = date("dHis");
$timeStamper = date("Y-m-d") . "T" . date("H:i:s+00:00"); $timeStamper = date("Y-m-d") . "T" . date("H:i:s+00:00");
// if custom is logged in send data accross
$customerId = $quote->getCustomerId();
$newStructureValue = "";
// $oldValueStructure = "";
if (!empty($customerId)) {
$shopperEmail = $quote->getCustomerEmail();
$recurringContract = $this->_adyenHelper->getAdyenPosCloudConfigData('recurring_type');
$jsonValue = '{
"shopperEmail": "' . $shopperEmail . '",
"shopperReference": "' . $customerId . '",
"recurringContract": "' . $recurringContract . '"
}';
$jsonValueBase64 = base64_encode($jsonValue);
$newStructureValue = '"SaleToAcquirerData":"' . $jsonValueBase64 . '",';
// $oldValueStructure = '"SaleToAcquirerData":"shopperEmail=' . $shopperEmail . '&shopperReference=' . $customerId . '&recurringContract=' . $recurringContract . '",';
}
$json = '{ $json = '{
"SaleToPOIRequest": { "SaleToPOIRequest": {
"MessageHeader": { "MessageHeader": {
...@@ -120,6 +143,8 @@ class AdyenInitiateTerminalApi implements AdyenInitiateTerminalApiInterface ...@@ -120,6 +143,8 @@ class AdyenInitiateTerminalApi implements AdyenInitiateTerminalApiInterface
}, },
"PaymentRequest": { "PaymentRequest": {
"SaleData": { "SaleData": {
' . $newStructureValue . '
"TokenRequestedType":"Customer",
"SaleTransactionID": { "SaleTransactionID": {
"TransactionID": "' . $reference . '", "TransactionID": "' . $reference . '",
"TimeStamp": "' . $timeStamper . '" "TimeStamp": "' . $timeStamper . '"
......
...@@ -70,6 +70,12 @@ ...@@ -70,6 +70,12 @@
<source_model>Adyen\Payment\Model\Config\Source\CaptureMode</source_model> <source_model>Adyen\Payment\Model\Config\Source\CaptureMode</source_model>
<config_path>payment/adyen_pos_cloud/capture_mode_pos</config_path> <config_path>payment/adyen_pos_cloud/capture_mode_pos</config_path>
</field> </field>
<field id="recurring_type" translate="label" type="select" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Agreement Type</label>
<tooltip>You can set different value for POS because you have to have the permission of the customer</tooltip>
<source_model>Adyen\Payment\Model\Config\Source\RecurringType</source_model>
<config_path>payment/adyen_pos_cloud/recurring_type</config_path>
</field>
<group id="adyen_pos_country_specific" translate="label" showInDefault="1" showInWebsite="1" sortOrder="210"> <group id="adyen_pos_country_specific" translate="label" showInDefault="1" showInWebsite="1" sortOrder="210">
<label>Country Specific Settings</label> <label>Country Specific Settings</label>
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model> <frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment