Support

Home Forums Event Espresso Premium Update Transaction (code)

Update Transaction (code)

Posted: July 14, 2016 at 8:34 am


ARAGATO

July 14, 2016 at 8:34 am

I am coding a simple custom plugin that updates all current transactions from status “not completed” to “completed”.

I would like to know if I can just update the transaction status or do I have to update the complete model relations, e.g. line_item(s).
If updating just the transaction status, would be something like this sufficient? What would be the right key instead of TXN_STS and what are the correct values?

//update transaction status from 'not completed' to 'completed'
EEM_Transaction::instance()->update(
    array(
        'TXN_STS' => 'completed' ),
    array(
        array( 'TXN_STS' => 'not_completed' ) );


ARAGATO

July 14, 2016 at 9:21 am

I think I found the right key fields. The following code should do the trick (change status to complete and set paid amount to the total amount to be paid) with all transactions that are status incomplete.

//update transaction status from 'not completed' to 'completed'
$transactions = EEM_Transaction::instance()->get_all( array( array( 'STS_ID' => 'TIN' ) );
foreach( $transactions as $transaction ) {
	EEM_Transaction::instance()->update(
	    array(
		'STS_ID' => 'TCM',
		'TXN_paid' => $transaction->get('TXN_total') ),
	    array(
		array( 'TXN_ID' => $transaction->get('TXN_ID') ) );
}

I just would like to have a comfirmation that this snipped is ok before I totally ruin my database EE relations. 😀


Tony

  • Support Staff

July 15, 2016 at 3:45 am

Hi there,

Can I ask why you want to update the transaction status and the paid amount for all incomplete transactions?


ARAGATO

July 15, 2016 at 3:58 am

The reason is simple. With every booking/registration the customer accepts that the amount will be withdrawn from his bank account via the payment method “SEPA Direct Debit”.

Since you do not offer some sort of direct debit from a bank account as a payment method, I modified the bank payment method to fit my needs.

All registrations are approved by default. The transaction status, however, keeps beeing incomplete although the money is getting debited from the customers account. Since the payment is almost garantueed and it is going to be a lot of registrations we do not want to handle every registration manually and add the payment and complete the transaction.

That is why I would like to complete all transactions on a daily basis and set the paid amount to the due amount, because that is the amount that is going to be withdrawn from the customer’s bank account.

If there is a more convenient and maybe more safe way to do this, please let me know.


Lorenzo Orlando Caum

  • Support Staff

July 15, 2016 at 12:20 pm

Hello,

Have you taken a look at Mollie payment gateway?

It supports SEPA direct debit: https://www.mollie.com/en/directdebit

Sofort banking sounds like it may be a similar service: https://www.mollie.com/en/sofort


Lorenzo


ARAGATO

July 15, 2016 at 12:36 pm

Hi Lorenzo,

Mollie is no option since it takes a percentage fee from each transaction.
Since this is a kind of government custom development, no third party is allowed to take part in the transaction process.

Sofort banking is totally different and no solution as well.

As I said, each registrant needs to have and account with the registrants banking data provided. With signing up the registrant/student accepts the terms & conditions that with each registration the amount due will be withdrawn from his bankaccount. This withdrawing process is totally not happening on the wordpress end. Ultimately, no transaction at all is going to happend through EE. It is just used for course handling.


Josh

  • Support Staff

July 18, 2016 at 12:17 pm

Hi there,

As far as I can tell, the update() method you’re using in your custom code isn’t used anywhere in Event Espresso core. It might be okay to use, but since it’s not used by Event Espresso core it’s advised that you test your code before going live.

The support post ‘Update Transaction (code)’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  Josh 2 years, 10 months ago ago

Topic Tags

Notifications

This topic is: resolved
Do NOT follow this link or you will be banned from the site!