objectManager->get('AuthorizenetAcceptjsCommandPool'); $command = $commandPool->get('refund_settled'); $order = $this->getOrderWithIncrementId('100000001'); $payment = $order->getPayment(); $paymentDO = $this->paymentFactory->create($payment); $expectedRequest = include __DIR__ . '/../../_files/expected_request/refund.php'; $response = include __DIR__ . '/../../_files/response/refund.php'; $this->clientMock->method('setRawData') ->with(json_encode($expectedRequest), 'application/json'); $this->responseMock->method('getBody') ->willReturn(json_encode($response)); $command->execute([ 'payment' => $paymentDO, 'amount' => 100.00 ]); /** @var Payment $payment */ $this->assertTrue($payment->getIsTransactionClosed()); $this->assertSame('5678', $payment->getTransactionId()); } }