Jump to content

For negative scenarios not able to handle the PrestaShop refund UI changes, while throwing a custom error.


Recommended Posts

Hi I am making use of PrestaShop default refund UI in order to integrate the refund service for my module. To trigger Standard refund I am using actionProductCancel hook. 

For the negative scenarios for eg. when given an invalid quantity([email protected]#),  throwing my own custom error message.

But in the UI Still quantity and amount refunded gets updated and the no of quantity available to refund also gets reduced by equal amount. Means even though refund was not successful, this scenario affects the no of quantity available to refund, in the subsequent refund that I will be triggering.

I understood the Issue behind this. Actually the hook actionProductCancel is triggered at the end, after PrestaShop has done with it's own validation in AdminOrdersController. So even though I am throwing any custom error for invalid quantity before that only changed in the refunded quantity and the amount is made by PrestaShop. 

So is there any way to stop the execution of hook actionProductCancel in my module when I click on Refund products, instead I want to call a javascript on the click of Refund products, that will validate the quantity/amount entered in the UI, and based on the status of validation, if the validation is successful then only call the hook actionProductCancel from the javascript, So that for any invalid input i can throw custom error message and the quantity/amount available to refund remains consistent.

As shown in the below screenshot even though I have entered an invalid quantity [email protected]#, and if I click on Refund products, in the UI refunded quantity and amount gets updated to 2 ($58.00 refund).70113800_ScreenShot1942-07-10at12_48_15PM.thumb.png.48dc7cfc4193372b3b77f27795f3dbe9.png

I am using PrestaShop version 1.7.6.7

Edited by confusedatma9 (see edit history)

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More