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
\Adyen\Payment\Model\RecurringType $recurringType,
\Magento\Checkout\Model\Session $_checkoutSession,
array $data = []
) {
)
{
$this->_encryptor = $encryptor;
$this->_adyenHelper = $adyenHelper;
$this->_adyenLogger = $adyenLogger;
......@@ -107,6 +108,28 @@ class AdyenInitiateTerminalApi implements AdyenInitiateTerminalApiInterface
$serviceID = date("dHis");
$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 = '{
"SaleToPOIRequest": {
"MessageHeader": {
......@@ -120,6 +143,8 @@ class AdyenInitiateTerminalApi implements AdyenInitiateTerminalApiInterface
},
"PaymentRequest": {
"SaleData": {
' . $newStructureValue . '
"TokenRequestedType":"Customer",
"SaleTransactionID": {
"TransactionID": "' . $reference . '",
"TimeStamp": "' . $timeStamper . '"
......
......@@ -70,6 +70,12 @@
<source_model>Adyen\Payment\Model\Config\Source\CaptureMode</source_model>
<config_path>payment/adyen_pos_cloud/capture_mode_pos</config_path>
</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">
<label>Country Specific Settings</label>
<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