Jump to content

Help with hookActionOrderStatusUpdate and hookActionPaymentConfirmation actions


joseoyarzun

Recommended Posts

Hello!

I'm making a module and am using hookActionOrderStatusUpdate and hookActionPaymentConfirmation actions. I have an external system that receives payment information, processes, saves and returns false if the submission fails or if the action fails for another reason.

I need the module interrupts the action of "Payment accepted" if the external system fails. I used return false, but action "Payment accepted" runs anyway.

How to program the module to interrupt the action or to change $ params information?

 

Thanks!!

public function hookActionOrderStatusUpdate($params){
        global $smary, $cookie;

        if(!ExternSystem::ProccessInformation($params)){
                $params['newOrderStatus'] = new OrderState(8, Context::getContext()->cookie->id_lang);
                return false;
        }
        else{
            return true;
        }
    }
Edited by joseoyarzun (see edit history)
Link to comment
Share on other sites

In front office, you should use validation controller for your payment module to validate the payment.

To validate order, you should use validateOrder() function

 

actionOrderStatusUpdate is a Back Office Hook, called when an order's status is changed, right before it is actually changed.

actionPaymentConfirmation also a Back Office Hook, called when an order's status becomes "Payment accepted".

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...