Skip to content

Commit 654afb4

Browse files
Merge pull request #16 from ciungulete/compatible-to-use-uuid
2 parents 0f9a19b + ddb93f0 commit 654afb4

File tree

5 files changed

+17
-16
lines changed

5 files changed

+17
-16
lines changed

docs/12-faq.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ $table->unsignedInteger('owner_id');
3333
// By this:
3434
$table->uuid('owner_id');
3535
```
36-
36+
And in your `Billable` model add
37+
```php
38+
protected $keyType = 'string';
39+
```
3740
## How is prorating handled?
3841

3942
Cashier Mollie applies prorating by default. With prorating, customers are billed at the start of each billing cycle.

src/Order/Order.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ class Order extends Model
6464
'amount_refunded' => 'int',
6565
'amount_charged_back' => 'int',
6666
'tax' => 'int',
67-
'owner_id' => 'int',
6867
'subtotal' => 'int',
6968
'total' => 'int',
7069
'balance_before' => 'int',

src/Order/OrderItem.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ class OrderItem extends Model implements InvoicableItem
3939
'unit_price' => 'int',
4040
'tax_percentage' => 'float',
4141
'orderable_id' => 'int',
42-
'owner_id' => 'int',
4342
];
4443

4544
/**

tests/Order/OrderTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public function creatingANewOrderSchedulesNextOrderItems()
160160
$this->assertCarbon(now()->addMonth(), $subscription->cycle_ends_at);
161161
$this->assertCarbon(now()->addMonth(), $scheduled_item->process_at);
162162

163-
$this->assertSame(2, $scheduled_item->owner_id);
163+
$this->assertEquals(2, $scheduled_item->owner_id);
164164
$this->assertSame(User::class, $scheduled_item->owner_type);
165165
$this->assertSame('EUR', $scheduled_item->currency);
166166
$this->assertSame(1, $scheduled_item->quantity);
@@ -199,7 +199,7 @@ public function handlesOwnerBalance()
199199

200200
$order = Order::createFromItems(new OrderItemCollection([$scheduled_item]))->fresh();
201201

202-
$this->assertSame(2, $order->owner_id);
202+
$this->assertEquals(2, $order->owner_id);
203203
$this->assertSame(User::class, $order->owner_type);
204204
$this->assertSame("EUR", $order->currency);
205205
$this->assertSame(0, $order->tax);
@@ -234,7 +234,7 @@ public function handlesOwnerBalance()
234234
$this->assertMoneyEURCents(500, $user->credit('EUR')->money());
235235

236236

237-
$this->assertSame(2, $order->owner_id);
237+
$this->assertEquals(2, $order->owner_id);
238238
$this->assertSame(User::class, $order->owner_type);
239239
$this->assertSame("EUR", $order->currency);
240240
$this->assertSame(0, $order->tax);

tests/SubscriptionTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public function yieldsOrderItemsAtSetIntervals()
168168
$this->assertSame("Laravel\Cashier\Subscription", $item_1->orderable_type);
169169
$this->assertSame("Laravel\Cashier\Tests\Fixtures\User", $item_1->owner_type);
170170
$this->assertSame(1, $item_1->orderable_id);
171-
$this->assertSame(1, $item_1->owner_id);
171+
$this->assertEquals(1, $item_1->owner_id);
172172
$this->assertSame("Monthly payment", $item_1->description);
173173
$this->assertSame(null, $item_1->description_extra_lines);
174174
$this->assertSame("EUR", $item_1->currency);
@@ -193,7 +193,7 @@ public function yieldsOrderItemsAtSetIntervals()
193193
$this->assertSame("Laravel\Cashier\Subscription", $item_2->orderable_type);
194194
$this->assertSame("Laravel\Cashier\Tests\Fixtures\User", $item_2->owner_type);
195195
$this->assertSame(1, $item_2->orderable_id);
196-
$this->assertSame(1, $item_2->owner_id);
196+
$this->assertEquals(1, $item_2->owner_id);
197197
$this->assertSame("Monthly payment", $item_2->description);
198198
$this->assertSame(null, $item_2->description_extra_lines);
199199
$this->assertSame("EUR", $item_2->currency);
@@ -219,7 +219,7 @@ public function yieldsOrderItemsAtSetIntervals()
219219
$this->assertSame("Laravel\Cashier\Subscription", $item_3->orderable_type);
220220
$this->assertSame("Laravel\Cashier\Tests\Fixtures\User", $item_3->owner_type);
221221
$this->assertSame(1, $item_3->orderable_id);
222-
$this->assertSame(1, $item_3->owner_id);
222+
$this->assertEquals(1, $item_3->owner_id);
223223
$this->assertSame("Monthly payment", $item_3->description);
224224
$this->assertSame(null, $item_3->description_extra_lines);
225225
$this->assertSame("EUR", $item_3->currency);
@@ -252,7 +252,7 @@ public function yieldsOrderItemsAtSetIntervalsWithIntervalGenerator()
252252
$this->assertSame("Laravel\Cashier\Subscription", $item_1->orderable_type);
253253
$this->assertSame("Laravel\Cashier\Tests\Fixtures\User", $item_1->owner_type);
254254
$this->assertSame(1, $item_1->orderable_id);
255-
$this->assertSame(1, $item_1->owner_id);
255+
$this->assertEquals(1, $item_1->owner_id);
256256
$this->assertSame("Monthly payment", $item_1->description);
257257
$this->assertSame(null, $item_1->description_extra_lines);
258258
$this->assertSame("EUR", $item_1->currency);
@@ -277,7 +277,7 @@ public function yieldsOrderItemsAtSetIntervalsWithIntervalGenerator()
277277
$this->assertSame("Laravel\Cashier\Subscription", $item_2->orderable_type);
278278
$this->assertSame("Laravel\Cashier\Tests\Fixtures\User", $item_2->owner_type);
279279
$this->assertSame(1, $item_2->orderable_id);
280-
$this->assertSame(1, $item_2->owner_id);
280+
$this->assertEquals(1, $item_2->owner_id);
281281
$this->assertSame("Monthly payment", $item_2->description);
282282
$this->assertSame(null, $item_2->description_extra_lines);
283283
$this->assertSame("EUR", $item_2->currency);
@@ -303,7 +303,7 @@ public function yieldsOrderItemsAtSetIntervalsWithIntervalGenerator()
303303
$this->assertSame("Laravel\Cashier\Subscription", $item_3->orderable_type);
304304
$this->assertSame("Laravel\Cashier\Tests\Fixtures\User", $item_3->owner_type);
305305
$this->assertSame(1, $item_3->orderable_id);
306-
$this->assertSame(1, $item_3->owner_id);
306+
$this->assertEquals(1, $item_3->owner_id);
307307
$this->assertSame("Monthly payment", $item_3->description);
308308
$this->assertSame(null, $item_3->description_extra_lines);
309309
$this->assertSame("EUR", $item_3->currency);
@@ -336,7 +336,7 @@ public function yieldsOrderItemsAtSetIntervalsWithIntervalGeneratorLastDayOfTheM
336336
$this->assertSame("Laravel\Cashier\Subscription", $item_1->orderable_type);
337337
$this->assertSame("Laravel\Cashier\Tests\Fixtures\User", $item_1->owner_type);
338338
$this->assertSame(1, $item_1->orderable_id);
339-
$this->assertSame(1, $item_1->owner_id);
339+
$this->assertEquals(1, $item_1->owner_id);
340340
$this->assertSame("Monthly payment", $item_1->description);
341341
$this->assertSame(null, $item_1->description_extra_lines);
342342
$this->assertSame("EUR", $item_1->currency);
@@ -361,7 +361,7 @@ public function yieldsOrderItemsAtSetIntervalsWithIntervalGeneratorLastDayOfTheM
361361
$this->assertSame("Laravel\Cashier\Subscription", $item_2->orderable_type);
362362
$this->assertSame("Laravel\Cashier\Tests\Fixtures\User", $item_2->owner_type);
363363
$this->assertSame(1, $item_2->orderable_id);
364-
$this->assertSame(1, $item_2->owner_id);
364+
$this->assertEquals(1, $item_2->owner_id);
365365
$this->assertSame("Monthly payment", $item_2->description);
366366
$this->assertSame(null, $item_2->description_extra_lines);
367367
$this->assertSame("EUR", $item_2->currency);
@@ -387,7 +387,7 @@ public function yieldsOrderItemsAtSetIntervalsWithIntervalGeneratorLastDayOfTheM
387387
$this->assertSame("Laravel\Cashier\Subscription", $item_3->orderable_type);
388388
$this->assertSame("Laravel\Cashier\Tests\Fixtures\User", $item_3->owner_type);
389389
$this->assertSame(1, $item_3->orderable_id);
390-
$this->assertSame(1, $item_3->owner_id);
390+
$this->assertEquals(1, $item_3->owner_id);
391391
$this->assertSame("Monthly payment", $item_3->description);
392392
$this->assertSame(null, $item_3->description_extra_lines);
393393
$this->assertSame("EUR", $item_3->currency);
@@ -412,7 +412,7 @@ public function yieldsOrderItemsAtSetIntervalsWithIntervalGeneratorLastDayOfTheM
412412
$this->assertSame("Laravel\Cashier\Subscription", $item_4->orderable_type);
413413
$this->assertSame("Laravel\Cashier\Tests\Fixtures\User", $item_4->owner_type);
414414
$this->assertSame(1, $item_4->orderable_id);
415-
$this->assertSame(1, $item_4->owner_id);
415+
$this->assertEquals(1, $item_4->owner_id);
416416
$this->assertSame("Monthly payment", $item_4->description);
417417
$this->assertSame(null, $item_4->description_extra_lines);
418418
$this->assertSame("EUR", $item_4->currency);

0 commit comments

Comments
 (0)