Skip to content

Invoice cannot be captured manually #2655

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
schurter-wallee opened this issue Dec 9, 2015 · 5 comments
Closed

Invoice cannot be captured manually #2655

schurter-wallee opened this issue Dec 9, 2015 · 5 comments
Assignees

Comments

@schurter-wallee
Copy link

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();
@mbretter
Copy link

mbretter commented Feb 4, 2016

encountered the same bug, any news on this?

@mbretter
Copy link

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

@chrisss404
Copy link

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

@karanbhomiagit
Copy link

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

@NadiyaS
Copy link
Contributor

NadiyaS commented Jun 1, 2016

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.

@NadiyaS NadiyaS closed this as completed Jun 1, 2016
magento-engcom-team pushed a commit that referenced this issue Jun 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants