Jump to content

Getting Users Past Due Before Applying Transaction?


Recommended Posts

Posted

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!

Posted
  On 9/20/2014 at 3:41 PM, gutterboy said:

I'm just wondering when the "Transactions.add" event is triggered,

 

The event is triggered after the transaction is created.

 

 

  On 9/20/2014 at 3:41 PM, gutterboy said:

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.

 

 

  On 9/20/2014 at 3:41 PM, gutterboy said:

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).

 

 

  On 9/20/2014 at 3:41 PM, gutterboy said:

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.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...