2

I am defining placeOrder method in my payment method, here is my code:

placeOrder: function (data, event) {
    var self = this;

    if (event) {
        event.preventDefault();
    }

    if (this.validate() && additionalValidators.validate()) {
        this.isPlaceOrderActionAllowed(false);

        this.getPlaceOrderDeferredObject()
            .fail(
                function () {
                    self.isPlaceOrderActionAllowed(true);
                }
            ).done(
                function () {
                    self.afterPlaceOrder();

                    if (self.redirectAfterPlaceOrder) {
                        redirectOnSuccessAction.execute();
                    }
                }
            );
        return true;
    }

    return false;
}

How can I get order id before/after afterPlaceOrder method is called and redirection to success page is done?

0
 as you see, add response which return orderId to done function(), code sample as below:       
     ).done(
            function (response) {
                self.afterPlaceOrder();

                if (self.redirectAfterPlaceOrder) {
                    redirectOnSuccessAction.execute();
                }
            }
        );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.