tastyigniter / ti-ext-payregister

Payment system for TastyIgniter. Allows you to accept credit card payments using payment gateway supplied by this extension or others.
MIT License
8 stars 21 forks source link

[Bug]: Square SqPayments SDK Deprecation on 7/15/2022 #28

Closed CupNoodles closed 3 years ago

CupNoodles commented 3 years ago

What happened?

Using payregister extension with sandbox credentials only with Cash on Delivery and Square payment methods enabled, clicking the square payment method shows this in the console:

[Deprecated] On 07/15/2022, SqPaymentForm will be retired and functionality will no longer work. We encourage you to upgrade to the Web Payments SDK https://developer.squareup.com/docs/web-payments/overview

What did you expect to happen?

It seems to be using the sampoyigi/onmipay-square package as opposed to the transportersio/omnipay-square listed on https://github.com/thephpleague/omnipay, but neither seems to have been updated to the new SDK.

Version

3.0.5

What browser are you seeing the problem on?

No response

Relevant log output

No response

CupNoodles commented 3 years ago

FWIW, I've used the new web-payments SDK for https://github.com/CupNoodles/ti-ext-squaregiftcards and can confirm that it works, integrates just fine etc.

@sampoyigi I may be able to make a PR that ports us to the new js SDK, but I'm wondering if you have a preference between creating a new omnipay gateway and folding that into payregister, or dropping omnipay for this and just making payregister compatible with the new SDK.

sampoyigi commented 3 years ago

That would be valuable. Omniway appears to be slowing down as we must wait for the maintainer to merge and tag releases, so we might as well switch to native SDK. So yup let's drop omnipay and simply use the SDK.

CupNoodles commented 3 years ago

As it turns out I was able to update my own https://github.com/CupNoodles/ti-ext-squarebyweight/tree/modal-custom just by switching over the javascript, since the deprecation notice is about the js SDK and not the API. That one isn't a drop-in replacement since our theme uses modal dialogs for payment, but it shouldn't be too difficult for me to make one for payregister that works with orange theme out of the box, while bypassing any conversation about omnipay.

sampoyigi commented 3 years ago

@CupNoodles Any progress?

CupNoodles commented 3 years ago

Yeah sorry, forked it at https://github.com/CupNoodles/ti-ext-payregister/commit/7653c7643a4f50be3432203301a326db295cc326 and it works, but I decided I didn't like the outcome so I haven't PRed it - will make a better one when I get a moment.

Basically the square SDK tutorials are into using only the async/await paradigm and avoiding jQuery callbacks, which I tried to do but then couldn't figure out a way to hook into the submitCheckoutForm event without being in jQuery anyway, so now it's sort of a mishmash of styles that it doesn't need to be. Next crack at it will keep it as similar as possible to the other payregister js files.

CupNoodles commented 3 years ago

I've made a PR for a more minimally invasive version of process.square.js at https://github.com/tastyigniter/ti-ext-payregister/pull/31

It's my first PR into any thing on the TI project so please let me know if I'm missing some testing steps, code standards, etc.

sampoyigi commented 3 years ago

Done!