Skip to content

Commit 84cbcd5

Browse files
committed
getUpcomingInvoice: subscription_items support
1 parent dd6fced commit 84cbcd5

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "Mock of Stripe's HttpClient which can be used in testing purposes in order to test your code and not to perform actual HTTP requests",
44
"type": "library",
55
"license": "MIT",
6-
"version": "1.2.1",
6+
"version": "1.2.2",
77
"php": ">=7.4",
88
"autoload": {
99
"psr-4": {

src/Entity/Invoice.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,9 @@ public function getUpcomingInvoice(array $params): Invoice
203203
$invoice = self::create('', ['customer' => $params['customer']]);
204204
$lines = new Collection();
205205

206-
foreach ($params['invoice_items'] ?? [] as $invoiceItemData) {
206+
$items = $params['invoice_items'] ?? $params['subscription_items'] ?? [];
207+
208+
foreach ($items as $invoiceItemData) {
207209
if (array_key_exists('price', $invoiceItemData)) {
208210
$invoiceItemData['price'] = EntityManager::retrieveEntity('price', $invoiceItemData['price']);
209211
}

0 commit comments

Comments
 (0)