Support

Home Forums Event Espresso Premium Payment Gateway duplicate calls

Payment Gateway duplicate calls

Posted: February 22, 2017 at 12:50 pm


Scratch Digital

February 22, 2017 at 12:50 pm

Hi

I have built and payment gateway plugin for payment express using your skelton payment gateway plugin.

The problem i’m having is that once payment has been made on payment expresses hosted payment page it triggers a success url response every few seconds while still on their page, until they redirect back to the EE site, this is to make sure the response gets through. so this means the handle_payment_update() function is running multiple times which then triggers multiple copies of the emails to be sent.

I am trying to add an if statement around the handle_payment_update() function to make sure the current payment status different to the payment status returned from the payment gateway

this is the if statement i am trying but with no success

if( $payment->status() != $update_info[ 'status' ] ){

the full function

public function handle_payment_update($update_info, $transaction) {
if( ! isset( $update_info[ 'uts' ] ) ){
return NULL;
}
$payment = $this->_pay_model->get_payment_by_txn_id_chq_nmbr($update_info[ 'uts' ] );
if($payment instanceof EEI_Payment && isset( $update_info[ 'status' ] && $payment->status() != $update_info[ 'status' ]) ){
if( && $update_info[ 'status' ] == $this->_pay_model->approved_status() ){
$payment->set_status( $this->_pay_model->approved_status() );
$payment->set_gateway_response( __( 'Payment Approved', 'event_espresso' ));
}elseif( $update_info[ 'status' ] == $this->_pay_model->pending_status() ){
$payment->set_status( $this->_pay_model->pending_status() );
$payment->set_gateway_response( __( 'Payment Pending', 'event_espresso' ));
}elseif( $update_info[ 'status' ] == $this->_pay_model->declined_status() ){
$payment->set_status( $this->_pay_model->declined_status() );
$payment->set_gateway_response( __( 'Payment Declined', 'event_espresso' ) );
}else{
$payment->set_status( $this->_pay_model->failed_status() );
$payment->set_gateway_response( __( 'Payment Failed', 'event_espresso' ) );
}
}
return $payment;
}

any help to only trigger this function on change of status would be great thank you.

Jonathan


Josh

  • Support Staff

February 22, 2017 at 1:14 pm

Hi there,

You can open an issue on the Github repository and one of the developers will answer your question. When you post the issue, please include a link to your custom gateway add-on so they can review if need be.

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

The support post ‘Payment Gateway duplicate calls’ 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, 3 months ago ago

Topic Tags

Notifications

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