Support

Home Forums Event Espresso Premium Payment Gateway : handle_payment_update different behavior

Payment Gateway : handle_payment_update different behavior

Posted: July 17, 2015 at 5:56 am

Viewing 5 reply threads


Biznetaucoeur

July 17, 2015 at 5:56 am

Hello,
I have a trouble with my Payment Gateway : while I do have the same infos in the arguments in the handle_payment_update of the offsite gateway class, the behavior is different in the ipn treatment and in the treatment done when coming back to the website.
Here is the content of the function :

public function handle_payment_update($update_info, $transaction) {
$message = 'message='. $update_info['DATA'];
$pathfile = 'pathfile='.__DIR__.'/../../param/pathfile';
$path_bin = __DIR__ . '/../../../../../scgi-bin/response';
$result = exec("$path_bin $pathfile $message");
$tableau = explode ('!', $result);

$payment = $transaction->last_payment();
// some treatment to check if payment is valid ...
$payment->set_status( $this->_pay_model->approved_status() );
}

What I get is that when proceeded by the ipn, the treatment goes to the approved_status line, but the only mail I get is the confirmed payment and the registration is still pending.
When I get back to the site, I get once more the confirmed payment mail, as well as the registration informations, and the registration is finally approved.

After checking, the only difference after having approved the payment in data is the STS_ID field : TFL in the first case and TCM in the second.

What could I do so the payment would be approved at first in the ipn and the email with informations sent at once, given some people don’t make it through to website ?

Thank you already !


Josh

  • Support Staff

July 21, 2015 at 12:44 pm

Hi there,

This can be tricky because you may also find that in some cases the IPN hits the site after people return to your site as well.

You can examine how the Event Espresso 4 PayPal Standard handles these scenarios. For example, the handle_payment_update() method in the EEG_Paypal_Standard class has some code that checks to see if the payment/transaction status was already updated (from the IPN or from when the return page is loaded) before it processes the transaction.


Biznetaucoeur

July 22, 2015 at 3:11 am

Hi !
Thank you for your answer !

My main problem is not that I may have 2 message confirmation, that would come later (though there is indeed a great source of inspiration in the Paypal gateway),
but more that a customer which leave gateway without coming back to the website will have a pending registration, in spite of the system sending him a “payment accepted” email and him having paid for that subscription.

After looking at the DB before and after returning to the website, the only difference I saw in tables transaction, payment and registration_payment is that in transaction I have no txn_session_data before the returning to the shop.
May it prevent the system from approving the whole registration, making the transaction accepted but useless for it’s registration, which stay pending (I can’t see those registration in the registration DB, those aren’t listed in any status) ?

If so, would there be a way I could “forge” the session data to set it at the same time the IPN does trigger to validate to transaction in regards of the registration please ?

Thank you for your time !


Josh

  • Support Staff

July 27, 2015 at 8:29 am

Hi there,

As far as I can tell, the EE_Payment_Processor::update_txn_based_on_payment method should handle the IPN and use that to update the payment status. If that’s not working for you, you can open up an issue on the Github project and one of the developers can weigh in:

https://github.com/eventespresso/event-espresso-core/issues


Biznetaucoeur

July 29, 2015 at 6:27 am

Hi !

Ok, I will do that as soon as I will have my plugin perfectly packaged ! As a tomporary fix, I forced the gateway to bring back customer to the website …

Thank you


Josh

  • Support Staff

July 29, 2015 at 9:01 am

You’re welcome.

Viewing 5 reply threads

The support post ‘Payment Gateway : handle_payment_update different behavior’ 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.

Event Espresso