Skip to content

Commit 104a474

Browse files
committed
Merge branch 'ACP2E-2841' of https://github.com/adobe-commerce-tier-4/magento2ce into 2.4-develop
2 parents 8529979 + 296e9d1 commit 104a474

File tree

2 files changed

+36
-18
lines changed

2 files changed

+36
-18
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: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,21 @@ public function testCaptureCorrectId(string $parentTransactionId)
125125
$gatewayToken = 'gateway_token';
126126
$this->payment->expects($this->once())->method('getParentTransactionId')->willReturn($parentTransactionId);
127127
$this->payment->expects($this->exactly($setParentTransactionIdCalls))->method('setParentTransactionId');
128-
$this->payment->expects($this->exactly($setAdditionalInformationCalls))->method('setAdditionalInformation')->with(Payflowpro::PNREF, $gatewayToken);
128+
$this->payment->expects($this->exactly($setAdditionalInformationCalls))
129+
->method('setAdditionalInformation')
130+
->with(Payflowpro::PNREF, $gatewayToken);
129131
$this->payment->expects($this->exactly(4))->method('getAdditionalInformation')->withConsecutive(
130132
['result_code'],
131133
[Payflowpro::PNREF],
132134
[Payflowpro::PNREF],
133135
[Payflowpro::PNREF],
134136
)->willReturn(0, '', Payflowpro::PNREF, Payflowpro::PNREF);
135-
$this->paymentExtensionAttributes->expects($this->once())->method('getVaultPaymentToken')->willReturn($this->paymentToken);
136-
$this->paymentToken->expects($this->exactly($getGatewayTokenCalls))->method('getGatewayToken')->willReturn($gatewayToken);
137+
$this->paymentExtensionAttributes->expects($this->once())
138+
->method('getVaultPaymentToken')
139+
->willReturn($this->paymentToken);
140+
$this->paymentToken->expects($this->exactly($getGatewayTokenCalls))
141+
->method('getGatewayToken')
142+
->willReturn($gatewayToken);
137143

138144
$this->subject->capture($this->payment, 100);
139145
}
@@ -235,7 +241,7 @@ private function getPaymentConfigInterfaceFactory()
235241
->disableOriginalConstructor()
236242
->getMock();
237243
$this->paymentConfig = $this->getMockBuilder(PaymentConfigInterface::class)
238-
->setMethods(['setStoreId', 'setMethodInstance', 'setMethod', 'getBuildNotationCode'])
244+
->addMethods(['setStoreId', 'setMethodInstance', 'setMethod', 'getBuildNotationCode', 'getPaymentAction'])
239245
->getMockForAbstractClass();
240246

241247
$paymentConfigInterfaceFactory->method('create')->willReturn($this->paymentConfig);
@@ -345,6 +351,23 @@ private function initPayment()
345351
{
346352
$this->payment = $this->getMockBuilder(Payment::class)
347353
->disableOriginalConstructor()
354+
->addMethods(['getIsTransactionApproved'])
355+
->onlyMethods(
356+
[
357+
'setTransactionId',
358+
'setIsTransactionClosed',
359+
'getCcExpYear',
360+
'getCcExpMonth',
361+
'getExtensionAttributes',
362+
'getOrder',
363+
'authorize',
364+
'canFetchTransactionInfo',
365+
'getParentTransactionId',
366+
'setParentTransactionId',
367+
'setAdditionalInformation',
368+
'getAdditionalInformation'
369+
]
370+
)
348371
->getMock();
349372
$this->order = $this->getMockBuilder(Order::class)
350373
->disableOriginalConstructor()
@@ -360,7 +383,16 @@ private function initPayment()
360383
$this->payment->method('getCcExpYear')->willReturn('2019');
361384
$this->payment->method('getCcExpMonth')->willReturn('05');
362385
$this->payment->method('getExtensionAttributes')->willReturn($this->paymentExtensionAttributes);
386+
$this->payment->method('getIsTransactionApproved')->willReturn(true);
363387

364388
return $this->payment;
365389
}
390+
391+
public function testFetchTransactionInfo()
392+
{
393+
$this->payment->method('canFetchTransactionInfo')->willReturn(false);
394+
$this->paymentConfig->method('getPaymentAction')->willReturn('authorize');
395+
$this->payment->expects($this->never())->method('authorize');
396+
$this->subject->fetchTransactionInfo($this->payment, '123');
397+
}
366398
}

0 commit comments

Comments
 (0)