gutterboy Posted September 20, 2014 Report Posted September 20, 2014 I'm just wondering when the "Transactions.add" event is triggered, I am currently doing something like this: public function getEvents() { return array( array( 'event' => "Transactions.add", 'callback' => array("this", "notify") ), array( 'event' => "Transactions.edit", 'callback' => array("this", "notify_edit") ) ); } public function notify($event) { // Get params $params = $event->getParams(); // Set transaction id $transaction_id = $params['transaction_id']; if (!isset($this->Transactions)) { Loader::loadModels($this, array("Transactions")); } // Now get transaction details $transaction_details = $this->Transactions->get($transaction_id); ......... } Now, I'm wondering if there is anyway at all for me to get their amount due at the time they made this transaction (meaning their debits not including their current credits)? I know of the amountDue method which can be used via the API, but obviously if I run this it will get the amount due AFTER their payment from this transaction has been applied correct? ..... also, does their amount due only go down once a payment has been APPLIED? Last question....... are there any events that get triggered when a payment is APPLIED to an account? So that you don't get notifications for loose credits until they are actually applied? Thanks! Quote
Tyson Posted September 22, 2014 Report Posted September 22, 2014 I'm just wondering when the "Transactions.add" event is triggered, The event is triggered after the transaction is created. Now, I'm wondering if there is anyway at all for me to get their amount due at the time they made this transaction (meaning their debits not including their current credits)? I know of the amountDue method which can be used via the API, but obviously if I run this it will get the amount due AFTER their payment from this transaction has been applied correct? No payments are applied (to invoices) when a transaction is added. That would happen afterward. also, does their amount due only go down once a payment has been APPLIED? The amount due is the unpaid amount for invoices, so yes, not applying transactions to invoices would be considered unapplied (credits). Last question....... are there any events that get triggered when a payment is APPLIED to an account? So that you don't get notifications for loose credits until they are actually applied? A payment received for an account is a transaction. But there is currently no event for when a transaction is applied to an invoice. Quote
gutterboy Posted September 22, 2014 Author Report Posted September 22, 2014 Ok thanks for that. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.