From 467603aa923ac92ae8c19dedb99e741795f40593 Mon Sep 17 00:00:00 2001 From: Michael Logvin Date: Thu, 6 Aug 2015 15:12:29 +0300 Subject: [PATCH] MAGETWO-40497: Prepare PR --- app/code/Magento/Sales/Model/Order/Payment/Transaction.php | 2 +- .../Magento/Sales/Service/V1/CreditmemoEmailTest.php | 5 ++--- .../integration/testsuite/Magento/Sales/_files/invoice.php | 3 +-- .../Magento/Sales/_files/invoice_fixture_store_order.php | 3 +-- .../testsuite/Magento/Sales/_files/invoice_payflowpro.php | 3 +-- 5 files changed, 6 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/Sales/Model/Order/Payment/Transaction.php b/app/code/Magento/Sales/Model/Order/Payment/Transaction.php index a9a3bab6fa7ad..187e19ee22aa6 100644 --- a/app/code/Magento/Sales/Model/Order/Payment/Transaction.php +++ b/app/code/Magento/Sales/Model/Order/Payment/Transaction.php @@ -637,7 +637,7 @@ public function beforeSave() if (!$this->getOrderId() && $this->getOrder()) { $this->setOrderId($this->getOrder()->getId()); } - if (!$this->getPaymentId() && $this->getOrder()) { + if (!$this->getPaymentId() && $this->getOrder() && $this->getOrder()->getPayment()) { $this->setPaymentId($this->getOrder()->getPayment()->getId()); } // set parent id diff --git a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/CreditmemoEmailTest.php b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/CreditmemoEmailTest.php index 6c5beb6de91dc..10c64693ecd85 100644 --- a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/CreditmemoEmailTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/CreditmemoEmailTest.php @@ -23,7 +23,6 @@ class CreditmemoEmailTest extends WebapiAbstract */ public function testCreditmemoEmail() { - $this->markTestSkipped('You can not cancel Credit Memo'); $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); /** @var \Magento\Sales\Model\Resource\Order\Creditmemo\Collection $creditmemoCollection */ @@ -31,8 +30,8 @@ public function testCreditmemoEmail() $creditmemo = $creditmemoCollection->getFirstItem(); $serviceInfo = [ 'rest' => [ - 'resourcePath' => '/V1/creditmemo/' . $creditmemo->getId(), - 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_PUT, + 'resourcePath' => '/V1/creditmemo/' . $creditmemo->getId() . '/emails', + 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, ], 'soap' => [ 'service' => self::SERVICE_NAME, diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/invoice.php b/dev/tests/integration/testsuite/Magento/Sales/_files/invoice.php index 0e8de39aa5a5e..c67acd1387924 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/_files/invoice.php +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/invoice.php @@ -11,8 +11,7 @@ /** @var \Magento\Sales\Model\Order $order */ $orderService = \Magento\TestFramework\ObjectManager::getInstance()->create( - 'Magento\Sales\Api\InvoiceManagementInterface', - ['order' => $order] + 'Magento\Sales\Api\InvoiceManagementInterface' ); $invoice = $orderService->prepareInvoice($order->getEntityId()); $invoice->register(); diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/invoice_fixture_store_order.php b/dev/tests/integration/testsuite/Magento/Sales/_files/invoice_fixture_store_order.php index b1bd6f1adbc5f..9825a310bf8f3 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/_files/invoice_fixture_store_order.php +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/invoice_fixture_store_order.php @@ -10,8 +10,7 @@ /** @var \Magento\Sales\Model\Order $order */ $orderService = \Magento\TestFramework\ObjectManager::getInstance()->create( - 'Magento\Sales\Api\InvoiceManagementInterface', - ['order' => $order] + 'Magento\Sales\Api\InvoiceManagementInterface' ); $invoice = $orderService->prepareInvoice($order->getEntityId()); $invoice->register(); diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/invoice_payflowpro.php b/dev/tests/integration/testsuite/Magento/Sales/_files/invoice_payflowpro.php index 62d5ce315446c..649724b9d3f0c 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/_files/invoice_payflowpro.php +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/invoice_payflowpro.php @@ -10,8 +10,7 @@ /** @var \Magento\Sales\Model\Order $order */ $orderService = \Magento\TestFramework\ObjectManager::getInstance()->create( - 'Magento\Sales\Api\InvoiceManagementInterface', - ['order' => $order] + 'Magento\Sales\Api\InvoiceManagementInterface' ); $invoice = $orderService->prepareInvoice($order->getEntityId()); /** To allow invoice cancelling it should be created without capturing. */