@magentoAppArea frontend
Definition at line 16 of file IpnTest.php.
◆ _assertOrder()
_assertOrder |
( |
|
$order, |
|
|
|
$currencyCode |
|
) |
| |
|
protected |
Perform order state and status assertions depending on currency code
- Parameters
-
\Magento\Sales\Model\Order | $order | |
string | $currencyCode | |
Definition at line 188 of file IpnTest.php.
190 if ($currencyCode ==
'USD') {
191 $this->assertEquals(
'complete',
$order->getState());
192 $this->assertEquals(
'complete',
$order->getStatus());
194 $this->assertEquals(
'payment_review',
$order->getState());
195 $this->assertEquals(
'fraud',
$order->getStatus());
◆ _createMockedHttpAdapter()
_createMockedHttpAdapter |
( |
| ) |
|
|
protected |
Mocked HTTP adapter to get VERIFIED PayPal IPN postback result
- Returns
- \Magento\Framework\HTTP\Adapter\Curl
Definition at line 215 of file IpnTest.php.
217 $factory = $this->createPartialMock(\
Magento\Framework\HTTP\Adapter\CurlFactory::class, [
'create']);
218 $adapter = $this->createPartialMock(\
Magento\Framework\HTTP\Adapter\Curl::class, [
'read',
'write']);
220 $adapter->expects($this->once())->method(
'read')->with()->will($this->returnValue(
"\nVERIFIED"));
222 $adapter->expects($this->once())->method(
'write');
224 $factory->expects($this->once())->method(
'create')->with()->will($this->returnValue(
$adapter));
◆ currencyProvider()
static currencyProvider |
( |
| ) |
|
|
static |
Data provider for currency check tests
- Returns
- array
Definition at line 205 of file IpnTest.php.
207 return [[
'USD'], [
'EUR']];
◆ setUp()
Definition at line 23 of file IpnTest.php.
static getObjectManager()
◆ testProcessIpnRequestExpressCurrency()
testProcessIpnRequestExpressCurrency |
( |
|
$currencyCode | ) |
|
- Parameters
-
string | $currencyCode | @dataProvider currencyProvider @magentoDataFixture Magento/Paypal/_files/order_express.php @magentoConfigFixture current_store payment/paypal_direct/active 1 @magentoConfigFixture current_store payment/paypal_express/active 1 @magentoConfigFixture current_store paypal/general/merchant_country US |
Definition at line 36 of file IpnTest.php.
38 $this->_processIpnRequestCurrency($currencyCode);
◆ testProcessIpnRequestFullRefund()
testProcessIpnRequestFullRefund |
( |
| ) |
|
Refund full order amount by Paypal Express IPN message service.
@magentoDataFixture Magento/Paypal/_files/order_express_with_invoice_and_shipping.php @magentoConfigFixture current_store payment/paypal_express/active 1 @magentoConfigFixture current_store paypal/general/merchant_country US
Definition at line 48 of file IpnTest.php.
50 $ipnData = require
__DIR__ .
'/../_files/ipn_refund.php';
51 $ipnFactory = $this->_objectManager->create(IpnFactory::class);
52 $ipnModel = $ipnFactory->create(
59 $ipnModel->processIpnRequest();
61 $order = $this->_objectManager->create(Order::class);
62 $order->loadByIncrementId(
'100000001');
64 $creditmemoItems =
$order->getCreditmemosCollection()->getItems();
68 $this->assertEquals(1, count($creditmemoItems));
70 $this->assertEquals(10,
$order->getSubtotalRefunded());
71 $this->assertEquals(10,
$order->getBaseSubtotalRefunded());
72 $this->assertEquals(20,
$order->getShippingRefunded());
73 $this->assertEquals(20,
$order->getBaseShippingRefunded());
74 $this->assertEquals(30,
$order->getTotalRefunded());
75 $this->assertEquals(30,
$order->getBaseTotalRefunded());
76 $this->assertEquals(30,
$order->getTotalOnlineRefunded());
77 $this->assertEmpty(
$order->getTotalOfflineRefunded());
_createMockedHttpAdapter()
defined('TESTS_BP')||define('TESTS_BP' __DIR__
◆ testProcessIpnRequestPartialRefund()
testProcessIpnRequestPartialRefund |
( |
| ) |
|
Partial refund of order amount by Paypal Express IPN message service.
@magentoDataFixture Magento/Paypal/_files/order_express_with_invoice_and_shipping.php @magentoConfigFixture current_store payment/paypal_express/active 1 @magentoConfigFixture current_store paypal/general/merchant_country US
Definition at line 87 of file IpnTest.php.
89 $ipnData = require
__DIR__ .
'/../_files/ipn_refund.php';
92 $ipnData[
'mc_gross'] = $refundAmount;
94 $ipnFactory = $this->_objectManager->create(IpnFactory::class);
95 $ipnModel = $ipnFactory->create(
102 $ipnModel->processIpnRequest();
104 $order = $this->_objectManager->create(Order::class);
105 $order->loadByIncrementId(
'100000001');
107 $creditmemoItems =
$order->getCreditmemosCollection()->getItems();
110 $commentOrigin = sprintf(
111 'IPN "Refunded". Refund issued by merchant. Registered notification about refunded amount of $%d.00. '.
112 'Transaction ID: "%s". Credit Memo has not been created. Please create offline Credit Memo.',
118 $this->assertEmpty(count($creditmemoItems));
119 $this->assertEquals(1, count(
$comments));
120 $this->assertEquals($commentOrigin, $commentData->getComment());
_createMockedHttpAdapter()
defined('TESTS_BP')||define('TESTS_BP' __DIR__
◆ testProcessIpnRequestRestRefund()
testProcessIpnRequestRestRefund |
( |
| ) |
|
Refund rest of order amount by Paypal Express IPN message service.
@magentoDataFixture Magento/Paypal/_files/order_express_with_invoice_and_shipping.php @magentoConfigFixture current_store payment/paypal_express/active 1 @magentoConfigFixture current_store paypal/general/merchant_country US
Definition at line 130 of file IpnTest.php.
132 $ipnData = require
__DIR__ .
'/../_files/ipn_refund.php';
134 $ipnFactory = $this->_objectManager->create(IpnFactory::class);
135 $ipnModel = $ipnFactory->create(
142 $ipnModel->processIpnRequest();
144 $order = $this->_objectManager->create(Order::class);
145 $order->loadByIncrementId(
'100000001');
147 $creditmemoItems =
$order->getCreditmemosCollection()->getItems();
150 $this->assertEquals(1, count($creditmemoItems));
151 $this->assertEquals(10,
$order->getSubtotalRefunded());
152 $this->assertEquals(10,
$order->getBaseSubtotalRefunded());
153 $this->assertEquals(20,
$order->getShippingRefunded());
154 $this->assertEquals(20,
$order->getBaseShippingRefunded());
155 $this->assertEquals(30,
$order->getTotalRefunded());
156 $this->assertEquals(30,
$order->getBaseTotalRefunded());
157 $this->assertEquals(30,
$order->getTotalOnlineRefunded());
158 $this->assertEmpty(
$order->getTotalOfflineRefunded());
_createMockedHttpAdapter()
defined('TESTS_BP')||define('TESTS_BP' __DIR__
◆ $_objectManager
The documentation for this class was generated from the following file:
- vendor/magento/magento2-base/dev/tests/integration/testsuite/Magento/Paypal/Model/IpnTest.php