Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.x] Add fallback for null value in unitAmountExcludingTax method #1447

Merged
merged 1 commit into from
Sep 27, 2022
Merged

[14.x] Add fallback for null value in unitAmountExcludingTax method #1447

merged 1 commit into from
Sep 27, 2022

Conversation

jayan-blutui
Copy link
Contributor

Why

I updated my installation of Cashier to v14.2.0 and noticed that my invoices can't be downloaded. Did some digging around and found that the newly added unitAmountExcludingTax method in the InvoiceLineItem class doesn't handle null values coming through from the Stripe PHP library. This pull request aims to fix the issue by setting null values to 0 (int), this will ensure that values passed to Cashier::formatAmount() is always a int or string type.

Context

For some context around why I am likely to get a null value. My application charges a fixed price per website and a fixed price per user (team members). This means that a team in my application can possibly have 0 websites but always have 1 or more users, this would mean their subscription would still be active but have a $0 charge on the website line item for a given month. This situation usually only happens when a team is new or rarely has published websites.

@taylorotwell taylorotwell merged commit e0d5998 into laravel:14.x Sep 27, 2022
@driesvints
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants