tastyigniter / ti-ext-cart

A TastyIgniter extension that allows you to easily add a shopping cart to your site.
MIT License
8 stars 32 forks source link

Pre-check user fields before payment attempted. #66

Closed ryanmitchell closed 3 years ago

ryanmitchell commented 3 years ago

Looping back round to the payment button on stripe support and off the back of a discussion on discord.

We should look to do a pre-validation of fields such as email, name etc (anything not payment related) before we attempt payment. It may mean inserting an extra checkout step. This would allow us to support validation without taking payment - currently you can take payment and then find the email is already taken for example.

So either we add an extra step in the checkout or we validate each field on input. Either way it would be a good improvement.

JamesThanna commented 3 years ago

I did take a quick look into this myself as I'm having quite a lot of issue swith orders failing to be processed through due to the validation failure for timeslot, email etc also causing payments to be processed when the validation fails as it uses Iframed JS injection for the payment processing.

Is there any recommendation on maybe where to look into to try and find a solution? I'm happy to put time into this if i've given some direction into where to start or how I can help speed the process up in anyway :)

ryanmitchell commented 3 years ago

There is no consensus on an approach yet. @sampoyigi needs to make a call on how he sees it working.

JamesThanna commented 3 years ago

When using Mobile when you select the bottom "My Order" button. This takes you to the /cart to confirm your order before going to /checkout. This would seem to be the best place to validate the user data before going to payment page so this would be /location => /cart => /checkout for both mobile and PC and validate the data there before going to /checkout for payment only? @sampoyigi thoughts?

sampoyigi commented 3 years ago

Let's send an AJAX request right before the payment request instead of an extra checkout step (for user experience sake). This technique should be limited to payment gateways that use client SDK. Pointless for gateways such as PayPal and Mollie.

ryanmitchell commented 3 years ago

I'll spend some time on an initial version of this in the coming week and we can go from there.

JamesThanna commented 3 years ago

@ryanmitchell let me know if I can help in anyway! This will solve a massive problem I've got with our payment gateway integration.

sampoyigi commented 3 years ago

@JamesThanna You can certainly start if you can, I'm sure Ryan would gladly join in.