Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The changes from v6 to v7 seem trivial to me, so I think this can be merged into Casher v10.
Update Stripe SDK to v7
Charge::refund()
toRefund::create()
Customer::invoices()
toInvoice::all()
Fix removing default payment method
After upgrading to the v7 of the Stripe SDK, the
$customer->invoice_settings->default_payment_method
is null.In that case, we don't need to update the Stripe customer, so we will just update the database.
The previous functionality has been kept as is.
Lazy-load the invoice line items
According to #562, the invoice response contains only 10 line items, so we were manually fetching 1000 items.
But Stripe's pagination limit is 100 items, so that doesn't ensure that all the line items will be fetched.
Instead, we can use the
Stripe\Collection::autoPagingIterator()
which automatically fetches all the paginated results with a generator.I was tempted to use a lazy collection here, but since this method will be called by the
Invoice::invoiceItems()
andInvoice::subscriptions()
methods, we don't want to hit the API twice just to filter the results.