Skip to content

Commit a959c6b

Browse files
committed
paddle
1 parent d2d7d05 commit a959c6b

6 files changed

Lines changed: 92 additions & 3 deletions

File tree

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?php
2+
3+
namespace App\Console\Commands;
4+
5+
use Illuminate\Console\Command;
6+
use Laravel\Paddle\Cashier;
7+
8+
class CreatePaddleNotificationDestination extends Command
9+
{
10+
protected $signature = 'paddle:create-notification {url}';
11+
12+
protected $description = 'Create a Paddle notification destination for webhooks';
13+
14+
public function handle(): int
15+
{
16+
$url = $this->argument('url');
17+
18+
if (! filter_var($url, FILTER_VALIDATE_URL)) {
19+
$this->error('Invalid URL provided');
20+
21+
return self::FAILURE;
22+
}
23+
24+
$payload = [
25+
'description' => 'Laravel Webhook Handler',
26+
'type' => 'url',
27+
'destination' => $url,
28+
'subscribed_events' => [
29+
'customer.created',
30+
'customer.updated',
31+
'subscription.created',
32+
'subscription.updated',
33+
'subscription.paused',
34+
'subscription.canceled',
35+
'subscription.resumed',
36+
'transaction.completed',
37+
'transaction.updated',
38+
],
39+
'api_version' => 1,
40+
'active' => true,
41+
'traffic_source' => 'all',
42+
];
43+
44+
try {
45+
$this->info('Creating notification destination...');
46+
$this->line('URL: '.$url);
47+
48+
$response = Cashier::api('POST', '/notification-settings', $payload);
49+
50+
$this->info('Notification destination created successfully!');
51+
$this->line(json_encode($response->json(), JSON_PRETTY_PRINT));
52+
53+
return self::SUCCESS;
54+
} catch (\Exception $e) {
55+
$this->error('Error creating notification: '.$e->getMessage());
56+
57+
return self::FAILURE;
58+
}
59+
}
60+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
namespace App\Console\Commands;
4+
5+
use Illuminate\Console\Command;
6+
use Laravel\Paddle\Cashier;
7+
8+
class GetPaddleNotificationSettings extends Command
9+
{
10+
protected $signature = 'paddle:notifications';
11+
12+
protected $description = 'Get Paddle notification settings';
13+
14+
public function handle(): int
15+
{
16+
try {
17+
$response = Cashier::api('GET', '/notification-settings');
18+
$this->info('Notification Settings:');
19+
$this->line(json_encode($response->json(), JSON_PRETTY_PRINT));
20+
21+
return self::SUCCESS;
22+
} catch (\Exception $e) {
23+
$this->error('Error: '.$e->getMessage());
24+
25+
return self::FAILURE;
26+
}
27+
}
28+
}

public/build/assets/app-CHTDWX3h.css

Lines changed: 0 additions & 2 deletions
This file was deleted.

public/build/assets/app-De8KwTEE.css

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/build/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@
188188
"src": "node_modules/@fontsource/bebas-neue/files/bebas-neue-latin-ext-400-normal.woff2"
189189
},
190190
"resources/css/app.css": {
191-
"file": "assets/app-CHTDWX3h.css",
191+
"file": "assets/app-De8KwTEE.css",
192192
"name": "app",
193193
"names": [
194194
"app.css"

routes/web.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
use App\Http\Controllers\Admin\UsersController;
55
use App\Http\Controllers\Auth\SocialiteController;
66
use App\Http\Controllers\Billing\BillingController;
7+
use App\Http\Controllers\Billing\SubscriptionController;
78
use App\Http\Controllers\Dashboard\DashboardIndexController;
89
use App\Http\Controllers\Docs\Animations\AnimationsIndexController;
910
use App\Http\Controllers\Docs\DocumentationIndexController;

0 commit comments

Comments
 (0)