Skip to content

Commit

Permalink
Merge branch '12.x'
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
#	src/Cashier.php
  • Loading branch information
driesvints committed Jun 4, 2021
2 parents ea0bda3 + 5936a17 commit c57b384
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Release Notes

## [Unreleased](https://github.com/laravel/cashier/compare/v12.14.0...master)
## [Unreleased](https://github.com/laravel/cashier/compare/v12.14.1...master)

### Added
- Support more payment method types ([#1074](https://github.com/laravel/cashier-stripe/pull/1074))
Expand Down Expand Up @@ -32,6 +32,12 @@
- Remove legacy sources support ([#1077](https://github.com/laravel/cashier-stripe/pull/1077))


## [v12.14.1 (2021-06-01)](https://github.com/laravel/cashier/compare/v12.14.0...v12.14.1)

### Fixed
- Fix broken `unit_amount` with `tab` ([9246063](https://github.com/laravel/cashier-stripe/commit/9246063882a09c29521e61a86e84f34cb86098c1))


## [v12.14.0 (2021-05-25)](https://github.com/laravel/cashier/compare/v12.13.1...v12.14.0)

### Added
Expand Down
2 changes: 1 addition & 1 deletion src/Concerns/ManagesInvoices.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function tab($description, $amount, array $options = [])
], $options);

if (array_key_exists('quantity', $options)) {
$options['unit_amount'] = $amount;
$options['unit_amount'] = $options['unit_amount'] ?? $amount;
} else {
$options['amount'] = $amount;
}
Expand Down
10 changes: 10 additions & 0 deletions tests/Feature/InvoicesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Laravel\Cashier\Exceptions\InvalidCustomer;
use Laravel\Cashier\Exceptions\InvalidInvoice;
use Laravel\Cashier\Invoice;
use Stripe\InvoiceItem as StripeInvoiceItem;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;

class InvoicesTest extends FeatureTestCase
Expand Down Expand Up @@ -95,5 +96,14 @@ public function test_customer_can_be_invoiced_with_quantity()

$this->assertInstanceOf(Invoice::class, $response);
$this->assertEquals(5000, $response->total);

$response = $user->tab('Laracon', null, [
'unit_amount' => 1000,
'quantity' => 2,
]);

$this->assertInstanceOf(StripeInvoiceItem::class, $response);
$this->assertEquals(1000, $response->unit_amount);
$this->assertEquals(2, $response->quantity);
}
}

0 comments on commit c57b384

Please sign in to comment.