Jump to content

Getting Users Past Due Before Applying Transaction?


gutterboy

Recommended Posts

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...