It looks like the only data passed in to the sales_order_invoice_pay
event is $this
, which will be the sales/order_invoice
model. I found this by searching through the Magneto core code, it's fired off in Invoice.php like so:
Mage::dispatchEvent('sales_order_invoice_pay', array($this->_eventObject=>$this));
Looking at a similar event (sales_order_invoice_register
) which has an observer in the core (of Enterprise, at least - increaseOrderGiftCardInvoicedAmount()
in GiftCardAccount) you can access the Invoice object like this in your Observer method:
$invoice = $observer->getEvent()->getInvoice();
The invoice is all you will be able to get though, since it's the only thing passed to the Observers by dispatchEvent()
. You cannot directly access the order, like you are trying to do.
Looking at the Invoice model, however, it appears to have a nice getOrder
method, which should do the trick. I haven't tested it, but try this:
$observer->getEvent()->getInvoice()->getOrder()->getPayment->getMethodInstance();
Cheers and good luck!