Skip to content

Commit 99e262d

Browse files
committed
MAGETWO-63239: [GITHUB] No possibility to save payment transaction details
1 parent ec99590 commit 99e262d

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-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: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,48 @@ 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->expects(static::once())
121+
->method('get')
122+
->with('can_fetch_transaction_information')
123+
->willReturn($valueHandler);
124+
$valueHandler->expects(static::once())
125+
->method('handle')
126+
->with(['field' => 'can_fetch_transaction_information'])
127+
->willReturn(true);
128+
129+
$this->paymentDataObjectFactory->expects(static::once())
130+
->method('create')
131+
->with($paymentInfo)
132+
->willReturn($paymentDO);
133+
134+
$this->commandPool->expects(static::once())
135+
->method('get')
136+
->with('fetch_transaction_information')
137+
->willReturn($command);
138+
$command->expects(static::once())
139+
->method('execute')
140+
->with(['transactionId' => $transactionId, 'payment' => $paymentDO])
141+
->willReturn($transactionInfo);
142+
143+
$this->assertEquals(
144+
$transactionInfo,
145+
$this->adapter->fetchTransactionInfo($paymentInfo, $transactionId)
146+
);
147+
148+
}
149+
108150
/**
109151
* @covers \Magento\Payment\Model\Method\Adapter::isAvailable
110152
*/

0 commit comments

Comments
 (0)