1

We are getting problems with Authorize.net 'timing out' but then creating the order in Magento and then creating the transaction on Authorize.net.

To resolve, I have to go to Authorize.net and capture funds there. However, this leaves the invoice in Magento as unpaid.

Is there a place in the DB where I can change this status or is there some code to make the Authorize.net/Magento 2.2 connection more reliable? It doesn't happen often, but it happens enough to be annoying.

2

In DB you can change 'state' Column value to 2 in 'sales_invoice' table.

Gel all invoice state : vendor/magento/module-sales/Model/Order/Invoice.php

const STATE_OPEN = 1;

const STATE_PAID = 2;

const STATE_CANCELED = 3;

For changing the state by coding, looks this model : vendor/magento/module-sales/Model/InvoiceOrder.php

  $connection->beginTransaction();
        try {
            $order = $this->paymentAdapter->pay($order, $invoice, $capture);
            $order->setState(
                $this->orderStateResolver->getStateForOrder($order, [OrderStateResolverInterface::IN_PROGRESS])
            );
            $order->setStatus($this->config->getStateDefaultStatus($order->getState()));
            $invoice->setState(\Magento\Sales\Model\Order\Invoice::STATE_PAID);
            $this->invoiceRepository->save($invoice);
            $this->orderRepository->save($order);
            $connection->commit();
        } catch (\Exception $e) {
            $this->logger->critical($e);
            $connection->rollBack();
            throw new \Magento\Sales\Exception\CouldNotInvoiceException(
                __('Could not save an invoice, see error log for details')
            );
        }
  • I edited the DB via phpMyAdmin, and reindexed, but the orders I changed are still 'Pending' in Sales > Invoices I'll keep digging, but this gets me closer for sure! – dawhoo Dec 12 '17 at 17:42
  • 1
    You have to update state column in 'sales_invoice_grid' table also. – D Singh Dec 13 '17 at 5:22
  • That was it! "sales_invoice_table" and "sales_invoice_grid" - all invoices are correctly marked - thank you thank you! – dawhoo Dec 13 '17 at 17:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.