1

I have stackoverflowed, googled etc but couldn't find the answer. I want to understand the logic behind the bank transfer payment method and invoice.

When we create invoices for orders that have payment method as Bank Transfer, invoice goes to PAID status by default.

Problem

In most cases, customer has yet not made full payment but have to send them invoice to ask for payment, which is why it must not marked as PAID in my case.

The function $this->canCapture() returning false for bank transfer orders.

Question

I would like to know how invoices are handled for bank transfer payment and is there a way to create invoice without marking it as PAID?

1 Answer 1

0

The status on the invoice is set in the method Mage_Sales_Model_Order_Invoice::pay() :

$invoiceState = self::STATE_PAID;
if ($this->getOrder()->getPayment()->hasForcedState()) {
   $invoiceState = $this->getOrder()->getPayment()->getForcedState();
}

So by default is set to paid if there is no "forced state" on the payment method.

you can use the event sales_order_invoice_pay dispatched in the same method to check if payment was done via bank transfer and set a different state to your invoice.

4
  • Will it also keep due amount? I will need to set status to paid and due 0 after creating invoice. Commented Feb 17, 2016 at 7:42
  • I don't know. You can try it and see what happens
    – Marius
    Commented Feb 17, 2016 at 8:41
  • I tried from observer as you suggested and can confirm observer method is called, but still invoice status is not changed, still it's PAID. I had done $invoiceState = 1;//self::STATE_OPEN; Commented Feb 18, 2016 at 0:11
  • but maybe the state is changed later by the line $invoiceState = $this->getOrder()->getPayment()->getForcedState();
    – Marius
    Commented Feb 18, 2016 at 7:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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