Reject purchase/checkout if licence generate fails

  • Posts: 51
  • Thank you received: 2
6 years 6 months ago #231882

-- HikaShop version -- : 2.6.1
-- HikaSerial version -- : 1.9.0

Hi,

I'm creating serials at the point of checkout as they are composed of a hash of meta data about the order (product type, custom fields, etc.).

I've created a custom generator plugin for this - and that's all fine.

Is it possible to have the generate() method fail in a way that can abort the purchase? For example, if I validation of the custom fields fails, I'd like to abort the checkout rather than go on to take payment.

Is this possible?
Thanks,
Oliver

Please Log in or Create an account to join the conversation.

  • Posts: 25435
  • Thank you received: 3946
  • MODERATOR
6 years 6 months ago #231884

Hi,

It is not possible during the generation of the serials because the order already exist and should be already confirmed.

The best would be to have an HikaShop plugin and perform that check during the "onBeforeOrderCreate" trigger.
www.hikashop.com/support/documentation/6...#onBeforeOrderCreate
In that trigger you will be able to check the custom fields and cancel the order creation.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 51
  • Thank you received: 2
6 years 6 months ago #231973

Thanks Jerome,

I've added some fairly tight validation regex to the custom fields, so hopefully, the generator shouldn't fail. If it becomes a problem, I'll take a look at the onBeforeOrderCreate, though I'd like to avoid too much customisation if I can! I only change the config of HikaShop once in a blue moon, so I very quickly forget where things are!!

Cheers,
Oliver

Please Log in or Create an account to join the conversation.

Moderators: Obsidev
Time to create page: 0.056 seconds
Powered by Kunena Forum