invoice_payflowpro.php 873 B

12345678910111213141516171819202122
  1. <?php
  2. /**
  3. * Not paid invoice fixture for online payment method.
  4. *
  5. * Copyright © Magento, Inc. All rights reserved.
  6. * See COPYING.txt for license details.
  7. */
  8. require 'order_paid_with_payflowpro.php';
  9. /** @var \Magento\Sales\Model\Order $order */
  10. $orderService = \Magento\TestFramework\ObjectManager::getInstance()->create(
  11. \Magento\Sales\Api\InvoiceManagementInterface::class
  12. );
  13. $invoice = $orderService->prepareInvoice($order);
  14. /** To allow invoice cancelling it should be created without capturing. */
  15. $invoice->setRequestedCaptureCase(\Magento\Sales\Model\Order\Invoice::NOT_CAPTURE)->register();
  16. $order = $invoice->getOrder();
  17. $order->setIsInProcess(true);
  18. $transactionSave = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
  19. ->create(\Magento\Framework\DB\Transaction::class);
  20. $transactionSave->addObject($invoice)->addObject($order)->save();