Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAG2-302 - Fixed a data masking bug #528

Merged
merged 3 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Model/Methods/AmazonPay.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ public function getPaymentSpecificParameters(Order $oOrder)
*/
protected function handleResponse($aResponse, Order $oOrder, $amount)
{
$aResponse = parent::handleResponse($aResponse, $oOrder, $amount);
if ($aResponse['status'] == 'ERROR') {
if (!$this->blIsRetry && $this->checkoutSession->getAmazonRetryAsync() && $aResponse['errorcode'] == 980) {
$aResponse = $this->authorizationRequest->sendRequest($this, $oOrder, $amount);
Expand Down
1 change: 1 addition & 0 deletions Model/Methods/BNPL/BNPLBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ public function assignData(DataObject $data)
*/
protected function handleResponse($aResponse, Order $oOrder, $amount)
{
$aResponse = parent::handleResponse($aResponse, $oOrder, $amount);
if (isset($aResponse['status']) && $aResponse['status'] == 'ERROR' && isset($aResponse['errorcode']) && $aResponse['errorcode'] == '307') {
$aBans = $this->checkoutSession->getPayonePaymentBans();
if (empty($aBans)) {
Expand Down
1 change: 1 addition & 0 deletions Model/Methods/Barzahlen.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public function getAuthorizationMode()
*/
protected function handleResponse($aResponse, Order $oOrder, $amount)
{
$aResponse = parent::handleResponse($aResponse, $oOrder, $amount);
if (isset($aResponse['status']) && $aResponse['status'] == 'APPROVED' && isset($aResponse['add_paydata[instruction_notes]'])) {
$sInstructionNotes = urldecode($aResponse['add_paydata[instruction_notes]']);
$this->checkoutSession->setPayoneInstructionNotes($sInstructionNotes);
Expand Down
1 change: 1 addition & 0 deletions Model/Methods/Ratepay/RatepayBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ public function isAvailable(\Magento\Quote\Api\Data\CartInterface $quote = null)
*/
protected function handleResponse($aResponse, Order $oOrder, $amount)
{
$aResponse = parent::handleResponse($aResponse, $oOrder, $amount);
$this->checkoutSession->unsPayoneRatepayDeviceFingerprintToken();
if (isset($aResponse['status']) && $aResponse['status'] == 'ERROR'
&& isset($aResponse['errorcode']) && $aResponse['errorcode'] == '307'
Expand Down
1 change: 1 addition & 0 deletions Model/Methods/SafeInvoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ public function assignData(DataObject $data)
*/
protected function handleResponse($aResponse, Order $oOrder, $amount)
{
$aResponse = parent::handleResponse($aResponse, $oOrder, $amount);
if (isset($aResponse['status']) && $aResponse['status'] == 'ERROR'
&& isset($aResponse['errorcode']) && $aResponse['errorcode'] == '351'
) {
Expand Down
7 changes: 6 additions & 1 deletion Model/ResourceModel/TransactionStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,12 @@ public function addTransactionLogEntry($aRequest, Order $oOrder = null, $blHasBe
{
$this->setRequest($aRequest);

$sRawStatus = serialize($this->getRequest());
$aRequestForLog = $this->getRequest();
if (!empty($aRequestForLog['customer_iban'])) {
$aRequestForLog['customer_iban'] = $this->toolkitHelper->maskIban($aRequestForLog['customer_iban']);
}

$sRawStatus = serialize($aRequestForLog);
if (!$this->toolkitHelper->isUTF8($sRawStatus)) {
$sRawStatus = mb_convert_encoding($sRawStatus, 'UTF-8'); // needed for serializing the array
}
Expand Down
5 changes: 5 additions & 0 deletions Test/Unit/Model/Methods/AmazonPayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
use Magento\Payment\Model\Info;
use Payone\Core\Model\Api\Request\Authorization;
use Magento\Framework\Exception\LocalizedException;
use Magento\Sales\Model\Order\Payment;

class AmazonPayTest extends BaseTestCase
{
Expand Down Expand Up @@ -156,8 +157,12 @@ public function testAuthorize()
$store = $this->getMockBuilder(Store::class)->disableOriginalConstructor()->getMock();
$store->method('getCode')->willReturn('test');

$payment = $this->getMockBuilder(Payment::class)->disableOriginalConstructor()->getMock();
$payment->method('getAdditionalInformation')->willReturn([]);

$order = $this->getMockBuilder(Order::class)->disableOriginalConstructor()->getMock();
$order->method('getStore')->willReturn($store);
$order->method('getPayment')->willReturn($payment);

$paymentInfo = $this->getMockBuilder(Info::class)->disableOriginalConstructor()->setMethods(['getOrder'])->getMock();
$paymentInfo->method('getOrder')->willReturn($order);
Expand Down
5 changes: 5 additions & 0 deletions Test/Unit/Model/Methods/BarzahlenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
use Magento\Payment\Model\Info;
use Payone\Core\Test\Unit\BaseTestCase;
use Payone\Core\Test\Unit\PayoneObjectManager;
use Magento\Sales\Model\Order\Payment;

class BarzahlenTest extends BaseTestCase
{
Expand Down Expand Up @@ -85,8 +86,12 @@ public function testAuthorize()
$store = $this->getMockBuilder(Store::class)->disableOriginalConstructor()->getMock();
$store->method('getCode')->willReturn('test');

$payment = $this->getMockBuilder(Payment::class)->disableOriginalConstructor()->getMock();
$payment->method('getAdditionalInformation')->willReturn([]);

$order = $this->getMockBuilder(Order::class)->disableOriginalConstructor()->getMock();
$order->method('getStore')->willReturn($store);
$order->method('getPayment')->willReturn($payment);

$paymentInfo = $this->getMockBuilder(Info::class)->disableOriginalConstructor()->setMethods(['getOrder'])->getMock();
$paymentInfo->method('getOrder')->willReturn($order);
Expand Down
9 changes: 9 additions & 0 deletions Test/Unit/Model/Methods/SafeInvoiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
use Magento\Quote\Model\Quote\Address;
use Payone\Core\Model\Api\Request\Authorization;
use Magento\Payment\Model\Info;
use Magento\Sales\Model\Order\Payment;

class SafeInvoiceTest extends BaseTestCase
{
Expand Down Expand Up @@ -102,9 +103,13 @@ public function testAuthorizeRegistered()
$store = $this->getMockBuilder(Store::class)->disableOriginalConstructor()->getMock();
$store->method('getCode')->willReturn('test');

$payment = $this->getMockBuilder(Payment::class)->disableOriginalConstructor()->getMock();
$payment->method('getAdditionalInformation')->willReturn([]);

$order = $this->getMockBuilder(Order::class)->disableOriginalConstructor()->getMock();
$order->method('getCustomerId')->willReturn('5');
$order->method('getStore')->willReturn($store);
$order->method('getPayment')->willReturn($payment);

$paymentInfo = $this->getMockBuilder(Info::class)->disableOriginalConstructor()->setMethods(['getOrder'])->getMock();
$paymentInfo->method('getOrder')->willReturn($order);
Expand All @@ -121,9 +126,13 @@ public function testAuthorizeGuest()
$store = $this->getMockBuilder(Store::class)->disableOriginalConstructor()->getMock();
$store->method('getCode')->willReturn('test');

$payment = $this->getMockBuilder(Payment::class)->disableOriginalConstructor()->getMock();
$payment->method('getAdditionalInformation')->willReturn([]);

$order = $this->getMockBuilder(Order::class)->disableOriginalConstructor()->getMock();
$order->method('getCustomerId')->willReturn(null);
$order->method('getStore')->willReturn($store);
$order->method('getPayment')->willReturn($payment);

$paymentInfo = $this->getMockBuilder(Info::class)->disableOriginalConstructor()->setMethods(['getOrder'])->getMock();
$paymentInfo->method('getOrder')->willReturn($order);
Expand Down
Loading