Reject purchase/checkout if licence generate fails

  • Posts: 51
  • Thank you received: 2
  • Hikashop Business
8 years 8 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: 26158
  • Thank you received: 4028
  • MODERATOR
8 years 8 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
  • Hikashop Business
8 years 8 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.052 seconds
Powered by Kunena Forum