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

Add precheckout validation #67

Closed ryanmitchell closed 3 years ago

ryanmitchell commented 3 years ago

See also https://github.com/tastyigniter/ti-ext-payregister/pull/26 and https://github.com/tastyigniter/TastyIgniter/pull/844

@JamesThanna this is completely untested and probably buggy, but should give you a start in the right direction. Do you want to give it a test and see how it works for you? I can pick up any issues over the coming week and work with you to resolve them.

Still to do:

JamesThanna commented 3 years ago

That's perfect my boss has gave me dedicated time to spent working on this issue due to the scale it's causing with payments. Will be looking Tuesday! Thanks for the prompt action!

JamesThanna commented 3 years ago

Hey,

I've got all the commits added. checkout.js Was seeing an syntax error which I changed on checkout.js Line 34

$checkoutBtn = $('.checkout-btn'),
$checkoutBtn = $('.checkout-btn');

When submitting the the data by filling in and then pressing confirm.

We see the following console error.


checkout.js:119 Uncaught TypeError: $selectedPaymentMethod.data is not a function
    at Checkout.onSubmitCheckoutForm (checkout.js:119)
    at HTMLFormElement.i (app.js:2)
    at HTMLDocument.dispatch (app.js:2)
    at HTMLDocument.v.handle (app.js:2)
    at Object.trigger (app.js:2)
    at HTMLFormElement.<anonymous> (app.js:2)
    at Function.each (app.js:2)
    at S.fn.init.each (app.js:2)
    at S.fn.init.trigger (app.js:2)
    at S.fn.init.S.fn.<computed> [as submit] (app.js:2)
JamesThanna commented 3 years ago

Seeing but not sure why as it's defined on there

$checkoutBtn = $('.checkout-btn');

Could we add an ID to the button and target that way?

Uncaught ReferenceError: $checkoutBtn is not defined at Checkout.completeCheckout (checkout.js:32) at Checkout.onSubmitCheckoutForm (checkout.js:124) at HTMLFormElement.i (app.js:2) at HTMLDocument.dispatch (app.js:2) at HTMLDocument.v.handle (app.js:2) at Object.trigger (app.js:2) at HTMLFormElement. (app.js:2) at Function.each (app.js:2) at S.fn.init.each (app.js:2) at S.fn.init.trigger (app.js:2)

ryanmitchell commented 3 years ago

@sampoyigi This is good for you to run you eye over at this point. Its working on Stripe and can be easily applied to others as needed.

JamesThanna commented 3 years ago

I've just tested this. It looks like when you leave user data blank it still processes the payment and doesn't return any alert/warning. It allows you to process through the checkout and completed the order