Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Usage Charge "ID on Null" Fix #1210

Merged
merged 8 commits into from
Oct 4, 2022
Merged

Usage Charge "ID on Null" Fix #1210

merged 8 commits into from
Oct 4, 2022

Conversation

Kyon147
Copy link
Collaborator

@Kyon147 Kyon147 commented Sep 11, 2022

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.

…as this stops the need for the session to have the user which is unrelable and it matches how the other two billing methods work.
…validation on the usage charge and over complicates the code as an exception will be thrown if it is missing in the req params.
@Kyon147
Copy link
Collaborator Author

Kyon147 commented Sep 11, 2022

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

@Kyon147 Kyon147 marked this pull request as ready for review September 11, 2022 10:58
@Kyon147 Kyon147 requested a review from gnikyt September 13, 2022 14:55
Copy link
Owner

@gnikyt gnikyt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One comment there.. up to you if you think its a better method or not.

src/Traits/BillingController.php Show resolved Hide resolved
@nahid
Copy link
Contributor

nahid commented Sep 27, 2022

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

@Kyon147
Copy link
Collaborator Author

Kyon147 commented Oct 1, 2022

@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.

Copy link
Owner

@gnikyt gnikyt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good by me.

Edit: Merging #1222 will fix PHP8.0 run

@Kyon147
Copy link
Collaborator Author

Kyon147 commented Oct 4, 2022

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

@gnikyt
Copy link
Owner

gnikyt commented Oct 4, 2022

@Kyon147 Go ahead :)

@Kyon147 Kyon147 merged commit 7d27600 into master Oct 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants