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] Implement new calculateTaxes call #1198

Merged
merged 4 commits into from
Jun 17, 2021
Merged

Conversation

driesvints
Copy link
Member

@driesvints driesvints commented Jun 17, 2021

This implements a new Cashier::calculateTaxes() static method that'll allow you enable automatic tax calculation on all relevant Stripe calls. By default it follows Stripe's behavior and is set to false. Additionally, the previous withTax method is now deprecated as it is not needed anymore. You can now use your code as regularly without the need of using extra methods. This method call goes into the boot method of your ApServiceProvider.

Also, the tax_id_collection is now enabled by default when the calculation of taxes is enabled. This PR also fixes a typo for an forgotten rename of collectsTaxIds.

I'll send in a PR to the docs when this one is accepted.

@driesvints driesvints changed the title [13.x] Implement new taxes config setting [13.x] Implement new calculateTaxes call Jun 17, 2021
@driesvints driesvints marked this pull request as ready for review June 17, 2021 12:50
@@ -23,7 +24,6 @@ trait PerformsCharges
public function charge($amount, $paymentMethod, array $options = [])
{
$options = array_merge([
'automatic_tax' => $this->automaticTaxPayload(),
Copy link
Member Author

Choose a reason for hiding this comment

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

I removed this because it's not possible to use automatic tax with payment intents atm it seems.

@@ -791,7 +789,6 @@ protected function mergeItemsThatShouldBeDeletedDuringSwap(Collection $items)
protected function getSwapOptions(Collection $items, array $options = [])
{
$payload = [
'automatic_tax' => $this->automaticTaxPayload(),
Copy link
Member Author

Choose a reason for hiding this comment

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

I removed this because disabling automatic taxes during a swap is unlikely to happen. People can still do this by passing options explicitly if they want.

@@ -1132,7 +1129,6 @@ public function latestInvoice()
public function upcomingInvoice(array $options = [])
{
return $this->owner->upcomingInvoice(array_merge([
'automatic_tax' => $this->automaticTaxPayload(),
Copy link
Member Author

Choose a reason for hiding this comment

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

I removed this because the underlying upcomingInvoice already adds this.

@taylorotwell taylorotwell merged commit cc00c35 into 13.x Jun 17, 2021
@taylorotwell taylorotwell deleted the move-taxes-to-config-item branch June 17, 2021 13:22
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.

2 participants