gnikyt / laravel-shopify

A full-featured Laravel package for aiding in Shopify App development
MIT License
1.24k stars 374 forks source link

Usage Charge "ID on Null" Fix #1210

Closed Kyon147 closed 2 years ago

Kyon147 commented 2 years ago

Currently, the usage Charge method is trying to get the user from the session but it is not available.

This updates the route to expect the shop domain to be passed in like the other functions.

Kyon147 commented 2 years ago

Hey @osiset

I've updated the usage charge wiki as it was not passing over the signature as a string but as it is breaking Call to a member function getId() on null after some digging, the user is never in the session.

As the other methods, just pass in the shop domain, it made sense to just keep it consistent.

When merged I'll update the wiki to pass in the shop domain also.

Issues relate:

1166

1044

1002

Here's the charge in the DB successfully

image

nahid commented 2 years ago

Is there any need to add verify.shopify middleware to the usage_charge route when we pass the shop param with the URL?

Kyon147 commented 2 years ago

@nahid no need to pass the verify middleware, that is why the shop param is passed along. It also follows how the plan billing routes work, so it keeps the logic consistent with other parts of the app.

Kyon147 commented 2 years ago

@osiset merged in #1222 now so if you are happy, will merge this into master and do a small patch release

gnikyt commented 2 years ago

@Kyon147 Go ahead :)