Magento2: Invoice cannot be captured manually

Created on 9 Dec 2015  路  5Comments  路  Source: magento/magento2

A manual capture of an invoice is not stored in the database.

In /vendor/magento/module-sales/Controller/Adminhtml/Order/Invoice/Capture.php in the execute() method the capturing of the invoice is delegated to the InvoiceManagement class. The invoice to capture is given to the manager via entity id.

$invoiceManagement = $this->_objectManager->get('Magento\Sales\Api\InvoiceManagementInterface');
$invoiceManagement->setCapture($invoice->getEntityId());

After that call, the invoice is saved.

The problem is, that the invoice being saved is not the same object being captured. Therefore, the invoice stays open.

$invoiceManagement = $this->_objectManager->get('Magento\Sales\Api\InvoiceManagementInterface');
$invoiceManagement->setCapture($invoice->getEntityId());
$invoice->getOrder()->setIsInProcess(true);
$this->_objectManager->create(
    'Magento\Framework\DB\Transaction'
)->addObject(
    $invoice
)->addObject(
    $invoice->getOrder()
)->save();

All 5 comments

encountered the same bug, any news on this?

HI,

this looks like a critical bug to me, as a consequence credit memos are not possible, because the invoice is in the wrong state.

I'm currently implementing a payment module, but this breaks the whole payment backend functionality.

cheers

hi, I am facing the same issue, any progress?

Hi, Any update on this? This seems to be a serious bug and is a blocker for me.

Hi,
thanks for reporting this issue and we are sorry for delay.
It is already being tracked by MAGETWO-52552 ticket and fix will be merged to develop branch in a few days.
This issue will be closed as duplicate of #4385.

Was this page helpful?
0 / 5 - 0 ratings