Skip to content

Commit 9e667db

Browse files
author
Anna Bukatar
committed
ACP2E-2841: Payflow creates new transaction each time we click on fetch button on the view transaction screen
1 parent 7e0fc6b commit 9e667db

File tree

2 files changed

+27
-15
lines changed

2 files changed

+27
-15
lines changed

app/code/Magento/Paypal/Model/Payflow/Transparent.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -389,20 +389,6 @@ public function denyPayment(InfoInterface $payment)
389389
return true;
390390
}
391391

392-
/**
393-
* @inheritDoc
394-
*/
395-
public function fetchTransactionInfo(InfoInterface $payment, $transactionId)
396-
{
397-
$result = parent::fetchTransactionInfo($payment, $transactionId);
398-
$this->_canFetchTransactionInfo = false;
399-
if ($payment->getIsTransactionApproved()) {
400-
$this->acceptPayment($payment);
401-
}
402-
403-
return $result;
404-
}
405-
406392
/**
407393
* Marks payment as fraudulent.
408394
*

app/code/Magento/Paypal/Test/Unit/Model/Payflow/TransparentTest.php

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ private function getPaymentConfigInterfaceFactory()
235235
->disableOriginalConstructor()
236236
->getMock();
237237
$this->paymentConfig = $this->getMockBuilder(PaymentConfigInterface::class)
238-
->setMethods(['setStoreId', 'setMethodInstance', 'setMethod', 'getBuildNotationCode'])
238+
->addMethods(['setStoreId', 'setMethodInstance', 'setMethod', 'getBuildNotationCode', 'getPaymentAction'])
239239
->getMockForAbstractClass();
240240

241241
$paymentConfigInterfaceFactory->method('create')->willReturn($this->paymentConfig);
@@ -345,6 +345,23 @@ private function initPayment()
345345
{
346346
$this->payment = $this->getMockBuilder(Payment::class)
347347
->disableOriginalConstructor()
348+
->addMethods(['getIsTransactionApproved'])
349+
->onlyMethods(
350+
[
351+
'setTransactionId',
352+
'setIsTransactionClosed',
353+
'getCcExpYear',
354+
'getCcExpMonth',
355+
'getExtensionAttributes',
356+
'getOrder',
357+
'authorize',
358+
'canFetchTransactionInfo',
359+
'getParentTransactionId',
360+
'setParentTransactionId',
361+
'setAdditionalInformation',
362+
'getAdditionalInformation'
363+
]
364+
)
348365
->getMock();
349366
$this->order = $this->getMockBuilder(Order::class)
350367
->disableOriginalConstructor()
@@ -360,7 +377,16 @@ private function initPayment()
360377
$this->payment->method('getCcExpYear')->willReturn('2019');
361378
$this->payment->method('getCcExpMonth')->willReturn('05');
362379
$this->payment->method('getExtensionAttributes')->willReturn($this->paymentExtensionAttributes);
380+
$this->payment->method('getIsTransactionApproved')->willReturn(true);
363381

364382
return $this->payment;
365383
}
384+
385+
public function testFetchTransactionInfo()
386+
{
387+
$this->payment->method('canFetchTransactionInfo')->willReturn(false);
388+
$this->paymentConfig->method('getPaymentAction')->willReturn('authorize');
389+
$this->payment->expects($this->never())->method('authorize');
390+
$this->subject->fetchTransactionInfo($this->payment, '123');
391+
}
366392
}

0 commit comments

Comments
 (0)