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

Laravel 9 Compatibility #17

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@
}
],
"require": {
"php": ">=7.1.3",
"illuminate/database": "~5.6",
"illuminate/support": "~5.6",
"nesbot/carbon": "^2.0",
"symfony/http-kernel": "~2.7|~3.0|~4.0",
"guzzlehttp/guzzle": "^6.0"
"php": "^8.0",
"illuminate/database": "^9.21|^10.0|^11.0",
"illuminate/support": "^9.21|^10.0|^11.0",
"nesbot/carbon": "^2.0|^3.0",
"symfony/http-kernel": "^6.0|^7.0",
"guzzlehttp/guzzle": "^7.2"
},
"require-dev": {
"illuminate/http": "~5.6",
"illuminate/routing": "~5.6",
"illuminate/http": "^9.21|^10.0|^11.0",
"illuminate/routing": "^9.21|^10.0|^11.0",
"mockery/mockery": "~1.0",
"phpunit/phpunit": "~7.0",
"phpunit/phpunit": "^9.0",
"vlucas/phpdotenv": "^3.3",
"orchestra/testbench": "~3.6"
"orchestra/testbench": "^7.0|^8.0"
},
"autoload": {
"psr-4": {
Expand Down
47 changes: 28 additions & 19 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ After publishing them, you can find migration files in your `database/migrations
Next, add the Billable trait to your model definition. This trait provides various methods to allow you to perform common billing tasks, such as creating and checking subscriptions, getting orders etc.

```php
use Laravel\Cashier\Billable;
use TwentyTwoDigital\CashierFastspring\Billable;

class User extends Authenticatable
{
Expand All @@ -108,7 +108,6 @@ You should add Fastspring configuration to `config/services.php` file.
'model' => App\User::class,
'username' => env('FASTSPRING_USERNAME'),
'password' => env('FASTSPRING_PASSWORD'),
'store_id' => env('FASTSPRING_STORE_ID'),

// strongly recommend to set hmac secret in webhook configuration
// to prevent webhook spoofing
Expand All @@ -121,10 +120,9 @@ You should add Fastspring configuration to `config/services.php` file.
Fastspring can notify your application of a variety of events via webhooks. To handle webhooks, define a route and also set it in Fastspring settings.

```php
Route::post(
'fastspring/webhook',
'\TwentyTwoDigital\CashierFastspring\Http\Controllers\WebhookController@handleWebhook'
)->name('fastspringWebhook');
use TwentyTwoDigital\CashierFastspring\Http\Controllers\WebhookController;

Route::post('/webhook/fastspring', [WebhookController::class, 'handleWebhook'])->name('webhook.fastspring');
```

#### Webhooks & CSRF Protection
Expand All @@ -150,26 +148,37 @@ Remember that you can create and use your listeners and database structure accor
In Cashier Fastspring, every webhook request fires related events. You can register listeners to webhook events in `app/providers/EventServiceProvider.php`. You can see more at [Webhooks](#webhooks).

```php
use TwentyTwoDigital\CashierFastspring\Events\OrderCompleted;
use TwentyTwoDigital\CashierFastspring\Events\SubscriptionActivated;
use TwentyTwoDigital\CashierFastspring\Events\SubscriptionCanceled;
use TwentyTwoDigital\CashierFastspring\Events\SubscriptionChargeCompleted;
use TwentyTwoDigital\CashierFastspring\Events\SubscriptionDeactivated;
use TwentyTwoDigital\CashierFastspring\Events\SubscriptionPaymentOverdue;
use TwentyTwoDigital\CashierFastspring\Listeners\OrderCompleted as OrderCompletedListener;
use TwentyTwoDigital\CashierFastspring\Listeners\SubscriptionChargeCompleted as SubscriptionChargeCompletedListener;
use TwentyTwoDigital\CashierFastspring\Listeners\SubscriptionDeactivated as SubscriptionDeactivatedListener;
use TwentyTwoDigital\CashierFastspring\Listeners\SubscriptionStateChanged;

protected $listen = [
// some others
'TwentyTwoDigital\CashierFastspring\Events\SubscriptionCanceled' => [
'TwentyTwoDigital\CashierFastspring\Listeners\SubscriptionStateChanged'
SubscriptionCanceled::class => [
SubscriptionStateChanged::class,
],
'TwentyTwoDigital\CashierFastspring\Events\SubscriptionDeactivated' => [
'TwentyTwoDigital\CashierFastspring\Listeners\SubscriptionDeactivated'
SubscriptionDeactivated::class => [
SubscriptionDeactivatedListener::class,
],
'TwentyTwoDigital\CashierFastspring\Events\SubscriptionPaymentOverdue' => [
'TwentyTwoDigital\CashierFastspring\Listeners\SubscriptionStateChanged'
SubscriptionPaymentOverdue::class => [
SubscriptionStateChanged::class,
],
'TwentyTwoDigital\CashierFastspring\Events\OrderCompleted' => [
'TwentyTwoDigital\CashierFastspring\Listeners\OrderCompleted'
OrderCompleted::class => [
OrderCompletedListener::class,
],
'TwentyTwoDigital\CashierFastspring\Events\SubscriptionActivated' => [
'TwentyTwoDigital\CashierFastspring\Listeners\SubscriptionActivated'
SubscriptionActivated::class => [
SubscriptionActivatedListener::class,
],
SubscriptionChargeCompleted::class => [
SubscriptionChargeCompletedListener::class,
],
'TwentyTwoDigital\CashierFastspring\Events\SubscriptionChargeCompleted' => [
'TwentyTwoDigital\CashierFastspring\Listeners\SubscriptionChargeCompleted'
]
];
```

Expand Down
7 changes: 7 additions & 0 deletions src/Events/SubscriptionUncanceled.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace TwentyTwoDigital\CashierFastspring\Events;

class SubscriptionUncanceled extends Base
{
}