Payment Plugin_Redirect method_Error handling on PostProcessPayment function.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
4 years ago
Hi everyone!

Im developing a Redirect payment method on Nop4. I wanna do some validation before redirect to the payment 3rd page.

Is there any existing method for handling error or validation in PostProcessPayment function or I have to create a ViewPaymentError for my payment method and redirect to this view whenever having error ?

Thanks a lot.
4 years ago
hi,
ProcessPayment is called in selected payment method before order be placed in store.
and it show the error if exist in confirm order page.
4 years ago
The ProcessPayment is not for redirect payment method I think.


For example on the code of PayPal Standard in PostProcessPayment function, if the redirectUrl.Length > 2048, then how I handle this case (I mean what Nop behavior for this case, or I have to create custom error view for this).
//ensure redirect URL doesn't exceed 2K chars to avoid "too long URL" exception
                var redirectUrl = QueryHelpers.AddQueryString(GetPaypalUrl(), parameters);
                if (redirectUrl.Length <= 2048)
                {
                    _httpContextAccessor.HttpContext.Response.Redirect(redirectUrl);
                    return;
                }

Thanks.
4 years ago
PostProcessPayment is the routine that sends the Response to the Payment Gateway

I don’t think any errors that appear here are going to be for the Customer so not sure you need a view page
Any errors in the customer data should have been picked up before you get here
So you can just use the throw method for debugging messages or alternatively log a message for the system operator

     _logger.InsertLog(LogLevel.Error,
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.