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

[10.x] Update Stripe SDK to v7 #784

Merged
merged 4 commits into from
Sep 26, 2019
Merged

Commits on Sep 15, 2019

  1. Update Stripe SDK to v7

    - Replace `Charge::refund()` to `Refund::create()`
    - Replace `Customer::invoices()` to `Invoice::all()`
    - Replace renamed exception classes
    sebdesign committed Sep 15, 2019
    Configuration menu
    Copy the full SHA
    3926abc View commit details
    Browse the repository at this point in the history
  2. 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.
    sebdesign committed Sep 15, 2019
    Configuration menu
    Copy the full SHA
    e024829 View commit details
    Browse the repository at this point in the history
  3. Lazy-load the invoice line items

    According to laravel#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()` and `Invoice::subscriptions()` methods, we don't want to hit the API twice just to filter the results.
    sebdesign committed Sep 15, 2019
    Configuration menu
    Copy the full SHA
    e7408c1 View commit details
    Browse the repository at this point in the history

Commits on Sep 26, 2019

  1. Fix payment methods

    driesvints committed Sep 26, 2019
    Configuration menu
    Copy the full SHA
    7642575 View commit details
    Browse the repository at this point in the history