all!
I'm trying to compare prices, in Order, such as GrandTotal and TotalPaid, after submit invoice. i'm try listen "sales_order_invoice_save_after" event.
config.xml
...
<events>
<sales_order_invoice_save_after>
<observers>
<orderapi>
<class>orderapi/observer</class>
<method>checkInvoiceSubmit</method>
</orderapi>
</observers>
</sales_order_invoice_save_after>
</event>
...
and next step:
Observer.php
public function checkInvoiceSubmit(Varien_Event_Observer $observer)
{
$event = $observer->getEvent()->getInvoice();
$paid = $event->getState();
if($paid == 2) {
echo $paid."<br/>";
}
var_dump("Grand ".$event->getGrandTotal());
var_dump("Paid ".$event->getTotalPaid());
var_dump("Due ".$event->getTotalDue());
var_dump("Refunden "$event->getTotalRefunden());
die;
}
and see: Grand 89.97, Paid NULL, DUE NULL, Refunden NULL.
input: Grand Total £89.97, Total Paid £0.00, Total Refunded £0.00, Total Due £89.97.
How do I properly compare the two prices(Grand and Total) after confirmation of payment?
Solution is:
Enjoy!