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

[13.x] Update stripe api version #1001

Merged
merged 3 commits into from
Oct 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Cashier.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Cashier
*
* @var string
*/
const STRIPE_VERSION = '2020-03-02';
const STRIPE_VERSION = '2020-08-27';

/**
* The custom currency formatter.
Expand Down
7 changes: 5 additions & 2 deletions src/Concerns/ManagesCustomer.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,16 @@ public function createOrGetStripeCustomer(array $options = [])
/**
* Get the Stripe customer for the model.
*
* @param array $expand
* @return \Stripe\Customer
*/
public function asStripeCustomer()
public function asStripeCustomer(array $expand = [])
{
$this->assertCustomerExists();

return StripeCustomer::retrieve($this->stripe_id, $this->stripeOptions());
return StripeCustomer::retrieve(
['id' => $this->stripe_id, 'expand' => $expand], $this->stripeOptions()
);
}

/**
Expand Down
11 changes: 0 additions & 11 deletions src/Concerns/ManagesSubscriptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,17 +146,6 @@ public function onPlan($plan)
}));
}

/**
* Get the tax percentage to apply to the subscription.
*
* @return int|float
* @deprecated Please migrate to the new Tax Rates API.
*/
public function taxPercentage()
{
return 0;
}

/**
* Get the tax rates to apply to the subscription.
*
Expand Down
15 changes: 0 additions & 15 deletions src/Subscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -957,21 +957,6 @@ public function latestInvoice()
return new Invoice($this->owner, $stripeSubscription->latest_invoice);
}

/**
* Sync the tax percentage of the user to the subscription.
*
* @return void
* @deprecated Please migrate to the new Tax Rates API.
*/
public function syncTaxPercentage()
{
$subscription = $this->asStripeSubscription();

$subscription->tax_percent = $this->user->taxPercentage();

$subscription->save();
}

/**
* Sync the tax rates of the user to the subscription.
*
Expand Down
15 changes: 0 additions & 15 deletions src/SubscriptionBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,6 @@ protected function buildPayload()

if ($taxRates = $this->getTaxRatesForPayload()) {
$payload['default_tax_rates'] = $taxRates;
} elseif ($taxPercentage = $this->getTaxPercentageForPayload()) {
$payload['tax_percent'] = $taxPercentage;
}

return $payload;
Expand All @@ -351,19 +349,6 @@ protected function getTrialEndForPayload()
}
}

/**
* Get the tax percentage for the Stripe payload.
*
* @return int|float|null
* @deprecated Please migrate to the new Tax Rates API.
*/
protected function getTaxPercentageForPayload()
{
if ($taxPercentage = $this->owner->taxPercentage()) {
return $taxPercentage;
}
}

/**
* Get the tax rates for the Stripe payload.
*
Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/PaymentMethodsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function test_we_can_set_a_default_payment_method()
public function test_legacy_we_can_retrieve_an_old_default_source_as_a_default_payment_method()
{
$user = $this->createCustomer('we_can_retrieve_an_old_default_source_as_a_default_payment_method');
$customer = $user->createAsStripeCustomer();
$customer = $user->createAsStripeCustomer(['expand' => ['sources']]);

$card = $customer->sources->create(['source' => 'tok_visa']);
$customer->default_source = $card->id;
Expand Down