31 $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
32 $proFactory = $this->getMockBuilder(
33 \
Magento\Paypal\Model\ProFactory::class
34 )->disableOriginalConstructor()->setMethods([
'create'])->getMock();
35 $api = $this->createMock(\
Magento\Paypal\Model\Api\Nvp::class);
36 $paypalPro = $this->getMockBuilder(
37 \
Magento\Paypal\Model\Pro::class
38 )->disableOriginalConstructor()->setMethods([])->getMock();
39 $this->transactionRepository = $this->getMockBuilder(\
Magento\Sales\Api\TransactionRepositoryInterface::class)
40 ->disableOriginalConstructor()
41 ->setMethods([
'getByTransactionType'])
42 ->getMockForAbstractClass();
43 $paypalPro->expects($this->any())->method(
'getApi')->will($this->returnValue($api));
45 $proFactory->expects($this->once())->method(
'create')->will($this->returnValue($paypalPro));
48 \
Magento\Paypal\Model\PayflowExpress::class,
49 [
'proFactory' => $proFactory,
'transactionRepository' => $this->transactionRepository]
56 $paymentInfo->expects($this->once())->method(
'getOrder')->willReturnSelf();
57 $this->transactionRepository->expects($this->once())
58 ->method(
'getByTransactionType')
61 $this->assertFalse($this->_model->canRefund());
68 $captureTransaction->expects($this->once())->method(
'getAdditionalInformation')->with(
70 )->will($this->returnValue(
null));
71 $paymentInfo->expects($this->once())->method(
'getOrder')->willReturnSelf();
72 $this->transactionRepository->expects($this->once())
73 ->method(
'getByTransactionType')
75 ->willReturn($captureTransaction);
76 $this->assertFalse($this->_model->canRefund());
83 $captureTransaction->expects($this->once())->method(
'getAdditionalInformation')->with(
85 )->will($this->returnValue(self::TRANSPORT_PAYFLOW_TXN_ID));
86 $paymentInfo->expects($this->once())->method(
'getOrder')->willReturnSelf();
87 $this->transactionRepository->expects($this->once())
88 ->method(
'getByTransactionType')
90 ->willReturn($captureTransaction);
91 $this->assertTrue($this->_model->canRefund());
103 )->disableOriginalConstructor()->setMethods([])->getMock();
115 return $this->getMockBuilder(
117 )->disableOriginalConstructor()->setMethods([])->getMock();
122 $this->assertEquals(
false, $this->_model->canFetchTransactionInfo());
127 $this->assertEquals(
false, $this->_model->canReviewPayment());
testCanRefundCaptureExistValid()
const TRANSPORT_PAYFLOW_TXN_ID
testCanFetchTransactionInfo()
const TRANSPORT_PAYFLOW_TXN_ID
_getPreparedPaymentInfo()
testCanRefundCaptureNotExist()
testCanRefundCaptureExistNoAdditionalInfo()