Skip to content

Commit eb71e35

Browse files
committed
Merge remote-tracking branch 'remotes/origin/MAGETWO-63239' into MPI-PR-Bugfixes
2 parents 82fa36f + f794070 commit eb71e35

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

app/code/Magento/Payment/Model/Method/Adapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ public function validate()
419419
*/
420420
public function fetchTransactionInfo(InfoInterface $payment, $transactionId)
421421
{
422-
$this->executeCommand(
422+
return $this->executeCommand(
423423
'fetch_transaction_information',
424424
['payment' => $payment, 'transactionId' => $transactionId]
425425
);

app/code/Magento/Payment/Test/Unit/Model/Method/AdapterTest.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,45 @@ protected function setUp()
105105
);
106106
}
107107

108+
public function testFetchTransactionInfo()
109+
{
110+
$transactionId = 10555;
111+
$transactionInfo = ['test_key' => 'test_value'];
112+
113+
$valueHandler = $this->getMockForAbstractClass(ValueHandlerInterface::class);
114+
$command = $this->getMockForAbstractClass(CommandInterface::class);
115+
116+
/** @var InfoInterface|MockObject $paymentInfo */
117+
$paymentInfo = $this->getMockForAbstractClass(InfoInterface::class);
118+
$paymentDO = $this->getMockForAbstractClass(PaymentDataObjectInterface::class);
119+
120+
$this->valueHandlerPool->method('get')
121+
->with('can_fetch_transaction_information')
122+
->willReturn($valueHandler);
123+
$valueHandler->expects($this->atLeastOnce())
124+
->method('handle')
125+
->with(['field' => 'can_fetch_transaction_information'])
126+
->willReturn(true);
127+
128+
$this->paymentDataObjectFactory->method('create')
129+
->with($paymentInfo)
130+
->willReturn($paymentDO);
131+
132+
$this->commandPool->method('get')
133+
->with('fetch_transaction_information')
134+
->willReturn($command);
135+
$command->expects($this->atLeastOnce())
136+
->method('execute')
137+
->with(['transactionId' => $transactionId, 'payment' => $paymentDO])
138+
->willReturn($transactionInfo);
139+
140+
$this->assertEquals(
141+
$transactionInfo,
142+
$this->adapter->fetchTransactionInfo($paymentInfo, $transactionId)
143+
);
144+
145+
}
146+
108147
/**
109148
* @covers \Magento\Payment\Model\Method\Adapter::isAvailable
110149
*/

0 commit comments

Comments
 (0)