Skip to content
This repository has been archived by the owner on Feb 2, 2022. It is now read-only.

Commit

Permalink
Merge branch 'develop' of github.com:laravel/cashier-mollie into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
sandervanhooft committed Jun 4, 2020
2 parents e7f3428 + b37e1e8 commit a77b211
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
29 changes: 28 additions & 1 deletion README.md
Expand Up @@ -331,6 +331,10 @@ To cancel a subscription, call the `cancel` method on the user's subscription:
```php
$user->subscription('main')->cancel();
```
or
```php
$user->subscription('main')->cancelAt(now());
```

When a subscription is cancelled, Cashier will automatically set the `ends_at` column in your database. This column is used to know when the `subscribed` method should begin returning `false`. For example, if a customer cancels a subscription on March 1st, but the subscription was not scheduled to end until March 5th, the `subscribed` method will continue to return `true` until March 5th.

Expand Down Expand Up @@ -460,6 +464,29 @@ $invoice->download(); // get a download response for the pdf
To list invoices, access the user's orders using: `$user->orders->invoices()`.
This includes invoices for all orders, even unprocessed or failed orders.

For list of invoices

```php
<ul class="list-unstyled">
@foreach(auth()->user()->orders as $order)
<li>

<a href="/download-invoice/{{ $order->id }}">
{{ $order->invoice()->id() }} - {{ $order->invoice()->date() }}
</a>
</li>
@endforeach
</ul>
```
and add this route inside web.php

```php
Route::middleware('auth')->get('/download-invoice/{orderId}', function($orderId){

return (request()->user()->downloadInvoice($orderId));
});
```

### Refunding Charges

Coming soon.
Expand All @@ -478,7 +505,7 @@ __Use these with care:__

```php
$credit = $user->credit('EUR');
$user->addCredit(new Amount(10, 'EUR'); // add €10.00
$user->addCredit(new Amount(10, 'EUR')); // add €10.00
$user->hasCredit('EUR');
```

Expand Down
4 changes: 2 additions & 2 deletions src/Helpers/helpers.php
Expand Up @@ -32,7 +32,7 @@ function object_to_array_recursive($object)
*/
function money(int $value, string $currency)
{
return new Money($value, new \Money\Currency($currency));
return new Money($value, new Currency($currency));
}
}

Expand All @@ -48,7 +48,7 @@ function decimal_to_money(string $value, string $currency)
{
$moneyParser = new DecimalMoneyParser(new ISOCurrencies());

return $moneyParser->parse($value, $currency);
return $moneyParser->parse($value, new Currency($currency));
}
}

Expand Down

0 comments on commit a77b211

Please sign in to comment.