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 58740370 authored by alessio's avatar alessio

use Magento\Framework\Serialize\Serializer\Serialize, fix typo on...

use Magento\Framework\Serialize\Serializer\Serialize, fix typo on setAdditionalData, add !empty checks for serialization, change algorithm from md5 to sha256, send deviceFingerprint for Ratepay
parent 7f6ae398
......@@ -255,7 +255,7 @@ interface NotificationInterface
* @param string $additionalData
* @return $this
*/
public function setAddtionalData($additionalData);
public function setAdditionalData($additionalData);
/**
* Gets the Done for the notification.
......
......@@ -222,7 +222,7 @@ class Json extends \Magento\Framework\App\Action\Action
$notification->setLive($notificationMode);
if (isset($response['additionalData'])) {
$notification->setAddtionalData($this->serializer->serialize($response['additionalData']));
$notification->setAdditionalData($this->serializer->serialize($response['additionalData']));
}
if (isset($response['done'])) {
$notification->setDone($response['done']);
......
......@@ -140,6 +140,13 @@ class CheckoutDataBuilder implements BuilderInterface
$request = array_merge($request, $openInvoiceFields);
}
// Ratepay specific Fingerprint
if ($payment->getAdditionalInformation("df_value") && $this->adyenHelper->isPaymentMethodRatepayMethod(
$payment->getAdditionalInformation(AdyenHppDataAssignObserver::BRAND_CODE)
)) {
$request['deviceFingerprint'] = $payment->getAdditionalInformation("df_value");
}
//Boleto data
if ($payment->getAdditionalInformation("social_security_number")) {
$request['socialSecurityNumber'] = $payment->getAdditionalInformation("social_security_number");
......
......@@ -1010,6 +1010,19 @@ class Data extends AbstractHelper
return false;
}
/**
* @param $paymentMethod
* @return bool
*/
public function isPaymentMethodRatepayMethod($paymentMethod)
{
if (strpos($paymentMethod, 'ratepay') !== false) {
return true;
}
return false;
}
/**
* @param $paymentMethod
* @return bool
......
......@@ -106,11 +106,12 @@ class InstallmentsPosCloud extends \Magento\Framework\App\Config\Value
protected function _afterLoad()
{
$value = $this->getValue();
$value = $this->serializer->unserialize($value);
if (is_array($value)) {
$value = $this->encodeArrayFieldValue($value);
$this->setValue($value);
if(!empty($value)) {
$value = $this->serializer->unserialize($value);
if (is_array($value)) {
$value = $this->encodeArrayFieldValue($value);
$this->setValue($value);
}
}
return $this;
}
......
......@@ -219,6 +219,11 @@ class Cron
*/
private $transactionBuilder;
/**
* @var \Magento\Framework\Serialize\SerializerInterface
*/
private $serializer;
/**
* Cron constructor.
*
......@@ -263,7 +268,8 @@ class Cron
SearchCriteriaBuilder $searchCriteriaBuilder,
OrderRepository $orderRepository,
\Adyen\Payment\Model\ResourceModel\Billing\Agreement $agreementResourceModel,
\Magento\Sales\Model\Order\Payment\Transaction\Builder $transactionBuilder
\Magento\Sales\Model\Order\Payment\Transaction\Builder $transactionBuilder,
\Magento\Framework\Serialize\SerializerInterface $serializer
) {
$this->_scopeConfig = $scopeConfig;
$this->_adyenLogger = $adyenLogger;
......@@ -285,6 +291,7 @@ class Cron
$this->orderRepository = $orderRepository;
$this->agreementResourceModel = $agreementResourceModel;
$this->transactionBuilder = $transactionBuilder;
$this->serializer = $serializer;
}
/**
......@@ -501,8 +508,7 @@ class Cron
$this->_reason = $notification->getPaymentMethod();
$this->_value = $notification->getAmountValue();
$additionalData = unserialize($notification->getAdditionalData());
$additionalData = !empty($notification->getAdditionalData()) ? $this->serializer->unserialize($notification->getAdditionalData()) : "";
// boleto data
if ($this->_paymentMethodCode() == "adyen_boleto") {
......@@ -672,7 +678,8 @@ class Cron
{
$this->_adyenLogger->addAdyenNotificationCronjob('Updating the Adyen attributes of the order');
$additionalData = unserialize($notification->getAdditionalData());
$additionalData = !empty($notification->getAdditionalData()) ? $this->serializer->unserialize($notification->getAdditionalData()) : "";
$_paymentCode = $this->_paymentMethodCode();
if ($this->_eventCode == Notification::AUTHORISATION
......
......@@ -333,7 +333,7 @@ class Notification extends \Magento\Framework\Model\AbstractModel implements Not
* @param string $additionalData
* @return $this
*/
public function setAddtionalData($additionalData)
public function setAdditionalData($additionalData)
{
return $this->setData(self::ADDITIONAL_DATA, $additionalData);
}
......
......@@ -145,7 +145,7 @@ class AdyenHppConfigProvider implements ConfigProviderInterface
$config['payment'] ['adyenHpp']['ratePayId'] = $this->adyenHelper->getRatePayId();
// TODO: change the algorithm
$config['payment'] ['adyenHpp']['deviceIdentToken'] = md5($this->session->getQuoteId() . date('c'));
$config['payment'] ['adyenHpp']['deviceIdentToken'] = hash("sha256",$this->session->getQuoteId() . date('c'));
$config['payment'] ['adyenHpp']['nordicCountries'] = ['SE', 'NO', 'DK', 'FI'];
return $config;
......
......@@ -980,6 +980,22 @@
<argument name="serializer" xsi:type="object">Magento\Framework\Serialize\Serializer\Serialize</argument>
</arguments>
</type>
<type name="Adyen\Payment\Model\Ui\AdyenCcConfigProvider">
<arguments>
<argument name="serializer" xsi:type="object">Magento\Framework\Serialize\Serializer\Serialize</argument>
</arguments>
</type>
<type name="Adyen\Payment\Model\Cron">
<arguments>
<argument name="serializer" xsi:type="object">Magento\Framework\Serialize\Serializer\Serialize</argument>
</arguments>
</type>
<type name="Adyen\Payment\Controller\Process\Json">
<arguments>
<argument name="serializer" xsi:type="object">Magento\Framework\Serialize\Serializer\Serialize</argument>
</arguments>
</type>
<preference for="Adyen\Payment\Api\GuestAdyenPaymentMethodManagementInterface"
type="Adyen\Payment\Model\GuestAdyenPaymentMethodManagement"/>
<preference for="Adyen\Payment\Api\AdyenPaymentMethodManagementInterface"
......
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