From 615ac88f89a7c98f55d404084a8bc863a4122deb Mon Sep 17 00:00:00 2001 From: Chirag Chhatrala <60499540+chiragchhatrala@users.noreply.github.com> Date: Tue, 2 Apr 2024 16:59:00 +0530 Subject: [PATCH] Integration cleanings (#366) Co-authored-by: Forms Dev --- app/Listeners/FailedWebhookListener.php | 38 ---- .../Forms/FailedWebhookNotification.php | 57 ------ app/Providers/EventServiceProvider.php | 5 - composer.json | 1 - composer.lock | 170 +++++------------- config/webhook-server.php | 71 -------- .../views/mail/form/webhook-error.blade.php | 15 -- 7 files changed, 49 insertions(+), 308 deletions(-) delete mode 100644 app/Listeners/FailedWebhookListener.php delete mode 100644 app/Notifications/Forms/FailedWebhookNotification.php delete mode 100644 config/webhook-server.php delete mode 100644 resources/views/mail/form/webhook-error.blade.php diff --git a/app/Listeners/FailedWebhookListener.php b/app/Listeners/FailedWebhookListener.php deleted file mode 100644 index 0be93332..00000000 --- a/app/Listeners/FailedWebhookListener.php +++ /dev/null @@ -1,38 +0,0 @@ -meta['type'] == 'form_submission') { - $event->meta['form']->creator->notify(new FailedWebhookNotification($event)); - \Log::error('Failed form submission webhook', [ - 'webhook_url' => $event->webhookUrl, - 'exception' => $event->errorType, - 'message' => $event->errorMessage, - 'form_id' => $event->meta['form']->id, - ]); - - return; - } - - \Log::error('Failed webhook', [ - 'webhook_url' => $event->webhookUrl, - 'exception' => $event->errorType, - 'message' => $event->errorMessage, - ]); - } -} diff --git a/app/Notifications/Forms/FailedWebhookNotification.php b/app/Notifications/Forms/FailedWebhookNotification.php deleted file mode 100644 index a022f4ab..00000000 --- a/app/Notifications/Forms/FailedWebhookNotification.php +++ /dev/null @@ -1,57 +0,0 @@ -form = $this->event->meta['form']; - $this->provider = $this->event->meta['provider']; - } - - /** - * Get the notification's delivery channels. - * - * @param mixed $notifiable - * @return array - */ - public function via($notifiable) - { - return ['mail']; - } - - /** - * Get the mail representation of the notification. - * - * @param mixed $notifiable - * @return \Illuminate\Notifications\Messages\MailMessage - */ - public function toMail($notifiable) - { - return (new MailMessage()) - ->subject("Notification issue with your NotionForm: '".$this->form->title."'") - ->markdown('mail.form.webhook-error', [ - 'provider' => $this->provider, - 'error' => $this->event->errorMessage, - 'form' => $this->form, - ]); - } -} diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index c7534816..a894023c 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -5,14 +5,12 @@ namespace App\Providers; use App\Events\Forms\FormSubmitted; use App\Events\Models\FormCreated; use App\Events\Models\FormIntegrationsEventCreated; -use App\Listeners\FailedWebhookListener; use App\Listeners\Forms\FormCreationConfirmation; use App\Listeners\Forms\FormIntegrationsEventListener; use App\Listeners\Forms\NotifyFormSubmission; use Illuminate\Auth\Events\Registered; use Illuminate\Auth\Listeners\SendEmailVerificationNotification; use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider; -use Spatie\WebhookServer\Events\WebhookCallFailedEvent; class EventServiceProvider extends ServiceProvider { @@ -31,9 +29,6 @@ class EventServiceProvider extends ServiceProvider FormSubmitted::class => [ NotifyFormSubmission::class ], - WebhookCallFailedEvent::class => [ - FailedWebhookListener::class, - ], FormIntegrationsEventCreated::class => [ FormIntegrationsEventListener::class, ], diff --git a/composer.json b/composer.json index 80a2819a..3ef3e48b 100644 --- a/composer.json +++ b/composer.json @@ -35,7 +35,6 @@ "sentry/sentry-laravel": "^2.11.0", "spatie/laravel-sitemap": "^6.0", "spatie/laravel-sluggable": "^3.0", - "spatie/laravel-webhook-server": "^3.1.2", "stevebauman/purify": "^v6.2.0", "tymon/jwt-auth": "^1.0.2", "vinkla/hashids": "^10.0" diff --git a/composer.lock b/composer.lock index ceb8c8d1..d68da1dd 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "4650817c0a533e9c119951b658245999", + "content-hash": "6d742b79739f9d1ca839f2b9c52aaa8f", "packages": [ { "name": "aws/aws-crt-php", @@ -62,16 +62,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.301.7", + "version": "3.303.0", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "2fd8cae93e87326f2263c420fa9031ad8903a2f2" + "reference": "34ace61fdffcea032826b0aac61ff3135b24b727" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/2fd8cae93e87326f2263c420fa9031ad8903a2f2", - "reference": "2fd8cae93e87326f2263c420fa9031ad8903a2f2", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/34ace61fdffcea032826b0aac61ff3135b24b727", + "reference": "34ace61fdffcea032826b0aac61ff3135b24b727", "shasum": "" }, "require": { @@ -151,9 +151,9 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.301.7" + "source": "https://github.com/aws/aws-sdk-php/tree/3.303.0" }, - "time": "2024-03-25T18:14:28+00:00" + "time": "2024-04-01T18:48:47+00:00" }, { "name": "brick/math", @@ -2682,16 +2682,16 @@ }, { "name": "laravel/horizon", - "version": "v5.23.1", + "version": "v5.23.2", "source": { "type": "git", "url": "https://github.com/laravel/horizon.git", - "reference": "7475de7eb5b465c2da84218002fe1a62b8175da0" + "reference": "96d154340f1223bcc161ea7cee355c8fc29ff81e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/horizon/zipball/7475de7eb5b465c2da84218002fe1a62b8175da0", - "reference": "7475de7eb5b465c2da84218002fe1a62b8175da0", + "url": "https://api.github.com/repos/laravel/horizon/zipball/96d154340f1223bcc161ea7cee355c8fc29ff81e", + "reference": "96d154340f1223bcc161ea7cee355c8fc29ff81e", "shasum": "" }, "require": { @@ -2704,6 +2704,7 @@ "nesbot/carbon": "^2.17|^3.0", "php": "^8.0", "ramsey/uuid": "^4.0", + "symfony/console": "^6.0|^7.0", "symfony/error-handler": "^6.0|^7.0", "symfony/process": "^6.0|^7.0" }, @@ -2754,9 +2755,9 @@ ], "support": { "issues": "https://github.com/laravel/horizon/issues", - "source": "https://github.com/laravel/horizon/tree/v5.23.1" + "source": "https://github.com/laravel/horizon/tree/v5.23.2" }, - "time": "2024-02-20T15:14:10+00:00" + "time": "2024-03-23T12:11:34+00:00" }, { "name": "laravel/serializable-closure", @@ -3086,16 +3087,16 @@ }, { "name": "laravel/vapor-core", - "version": "v2.37.0", + "version": "v2.37.1", "source": { "type": "git", "url": "https://github.com/laravel/vapor-core.git", - "reference": "03ec602ca43ff780f2924a9be8bb944ed960813f" + "reference": "9fac8cd0f9b6979887253dd676e04ecb868be615" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/vapor-core/zipball/03ec602ca43ff780f2924a9be8bb944ed960813f", - "reference": "03ec602ca43ff780f2924a9be8bb944ed960813f", + "url": "https://api.github.com/repos/laravel/vapor-core/zipball/9fac8cd0f9b6979887253dd676e04ecb868be615", + "reference": "9fac8cd0f9b6979887253dd676e04ecb868be615", "shasum": "" }, "require": { @@ -3159,9 +3160,9 @@ "vapor" ], "support": { - "source": "https://github.com/laravel/vapor-core/tree/v2.37.0" + "source": "https://github.com/laravel/vapor-core/tree/v2.37.1" }, - "time": "2024-02-16T17:41:53+00:00" + "time": "2024-03-26T16:55:06+00:00" }, { "name": "laravel/vapor-ui", @@ -5401,16 +5402,16 @@ }, { "name": "php-http/discovery", - "version": "1.19.2", + "version": "1.19.4", "source": { "type": "git", "url": "https://github.com/php-http/discovery.git", - "reference": "61e1a1eb69c92741f5896d9e05fb8e9d7e8bb0cb" + "reference": "0700efda8d7526335132360167315fdab3aeb599" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/discovery/zipball/61e1a1eb69c92741f5896d9e05fb8e9d7e8bb0cb", - "reference": "61e1a1eb69c92741f5896d9e05fb8e9d7e8bb0cb", + "url": "https://api.github.com/repos/php-http/discovery/zipball/0700efda8d7526335132360167315fdab3aeb599", + "reference": "0700efda8d7526335132360167315fdab3aeb599", "shasum": "" }, "require": { @@ -5434,7 +5435,8 @@ "php-http/httplug": "^1.0 || ^2.0", "php-http/message-factory": "^1.0", "phpspec/phpspec": "^5.1 || ^6.1 || ^7.3", - "symfony/phpunit-bridge": "^6.2" + "sebastian/comparator": "^3.0.5 || ^4.0.8", + "symfony/phpunit-bridge": "^6.4.4 || ^7.0.1" }, "type": "composer-plugin", "extra": { @@ -5473,9 +5475,9 @@ ], "support": { "issues": "https://github.com/php-http/discovery/issues", - "source": "https://github.com/php-http/discovery/tree/1.19.2" + "source": "https://github.com/php-http/discovery/tree/1.19.4" }, - "time": "2023-11-30T16:49:05+00:00" + "time": "2024-03-29T13:00:05+00:00" }, { "name": "php-http/httplug", @@ -7603,80 +7605,6 @@ ], "time": "2024-02-26T08:33:29+00:00" }, - { - "name": "spatie/laravel-webhook-server", - "version": "3.8.1", - "source": { - "type": "git", - "url": "https://github.com/spatie/laravel-webhook-server.git", - "reference": "d4cc24141a4d6a148e110df5f36217cc8f40f07e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-webhook-server/zipball/d4cc24141a4d6a148e110df5f36217cc8f40f07e", - "reference": "d4cc24141a4d6a148e110df5f36217cc8f40f07e", - "shasum": "" - }, - "require": { - "ext-json": "*", - "guzzlehttp/guzzle": "^6.3|^7.3", - "illuminate/bus": "^8.50|^9.0|^10.0|^11.0", - "illuminate/queue": "^8.50|^9.0|^10.0|^11.0", - "illuminate/support": "^8.50|^9.0|^10.0|^11.0", - "php": "^8.0", - "spatie/laravel-package-tools": "^1.11" - }, - "require-dev": { - "mockery/mockery": "^1.4.3", - "orchestra/testbench": "^6.19|^7.0|^8.0", - "pestphp/pest": "^1.22|^2.0", - "pestphp/pest-plugin-laravel": "^1.3|^2.0", - "spatie/test-time": "^1.2.2" - }, - "type": "library", - "extra": { - "laravel": { - "providers": [ - "Spatie\\WebhookServer\\WebhookServerServiceProvider" - ] - } - }, - "autoload": { - "psr-4": { - "Spatie\\WebhookServer\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Freek Van der Herten", - "email": "freek@spatie.be", - "homepage": "https://spatie.be", - "role": "Developer" - } - ], - "description": "Send webhooks in Laravel apps", - "homepage": "https://github.com/spatie/laravel-webhook-server", - "keywords": [ - "laravel-webhook-server", - "server", - "spatie", - "webhook" - ], - "support": { - "source": "https://github.com/spatie/laravel-webhook-server/tree/3.8.1" - }, - "funding": [ - { - "url": "https://spatie.be/open-source/support-us", - "type": "custom" - } - ], - "time": "2024-02-12T08:18:25+00:00" - }, { "name": "spatie/robots-txt", "version": "2.0.3", @@ -11971,16 +11899,16 @@ }, { "name": "laravel/pint", - "version": "v1.14.0", + "version": "v1.15.0", "source": { "type": "git", "url": "https://github.com/laravel/pint.git", - "reference": "6b127276e3f263f7bb17d5077e9e0269e61b2a0e" + "reference": "c52de679b3ac01207016c179d7ce173e4be128c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/pint/zipball/6b127276e3f263f7bb17d5077e9e0269e61b2a0e", - "reference": "6b127276e3f263f7bb17d5077e9e0269e61b2a0e", + "url": "https://api.github.com/repos/laravel/pint/zipball/c52de679b3ac01207016c179d7ce173e4be128c4", + "reference": "c52de679b3ac01207016c179d7ce173e4be128c4", "shasum": "" }, "require": { @@ -12033,7 +11961,7 @@ "issues": "https://github.com/laravel/pint/issues", "source": "https://github.com/laravel/pint" }, - "time": "2024-02-20T17:38:05+00:00" + "time": "2024-03-26T16:40:24+00:00" }, { "name": "laravel/sail", @@ -13072,16 +13000,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.65", + "version": "1.10.66", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "3c657d057a0b7ecae19cb12db446bbc99d8839c6" + "reference": "94779c987e4ebd620025d9e5fdd23323903950bd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/3c657d057a0b7ecae19cb12db446bbc99d8839c6", - "reference": "3c657d057a0b7ecae19cb12db446bbc99d8839c6", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/94779c987e4ebd620025d9e5fdd23323903950bd", + "reference": "94779c987e4ebd620025d9e5fdd23323903950bd", "shasum": "" }, "require": { @@ -13130,7 +13058,7 @@ "type": "tidelift" } ], - "time": "2024-03-23T10:30:26+00:00" + "time": "2024-03-28T16:17:31+00:00" }, { "name": "phpunit/php-code-coverage", @@ -14759,16 +14687,16 @@ }, { "name": "spatie/ignition", - "version": "1.12.0", + "version": "1.13.1", "source": { "type": "git", "url": "https://github.com/spatie/ignition.git", - "reference": "5b6f801c605a593106b623e45ca41496a6e7d56d" + "reference": "889bf1dfa59e161590f677728b47bf4a6893983b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/ignition/zipball/5b6f801c605a593106b623e45ca41496a6e7d56d", - "reference": "5b6f801c605a593106b623e45ca41496a6e7d56d", + "url": "https://api.github.com/repos/spatie/ignition/zipball/889bf1dfa59e161590f677728b47bf4a6893983b", + "reference": "889bf1dfa59e161590f677728b47bf4a6893983b", "shasum": "" }, "require": { @@ -14838,7 +14766,7 @@ "type": "github" } ], - "time": "2024-01-03T15:49:39+00:00" + "time": "2024-03-29T14:03:47+00:00" }, { "name": "spatie/laravel-ignition", @@ -14932,16 +14860,16 @@ }, { "name": "spatie/laravel-ray", - "version": "1.35.1", + "version": "1.36.0", "source": { "type": "git", "url": "https://github.com/spatie/laravel-ray.git", - "reference": "f504d3787d88c7e5de7a4290658f7ad9b1352f22" + "reference": "f15936b5d308ae391ee67370a5628f0712537c34" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-ray/zipball/f504d3787d88c7e5de7a4290658f7ad9b1352f22", - "reference": "f504d3787d88c7e5de7a4290658f7ad9b1352f22", + "url": "https://api.github.com/repos/spatie/laravel-ray/zipball/f15936b5d308ae391ee67370a5628f0712537c34", + "reference": "f15936b5d308ae391ee67370a5628f0712537c34", "shasum": "" }, "require": { @@ -15003,7 +14931,7 @@ ], "support": { "issues": "https://github.com/spatie/laravel-ray/issues", - "source": "https://github.com/spatie/laravel-ray/tree/1.35.1" + "source": "https://github.com/spatie/laravel-ray/tree/1.36.0" }, "funding": [ { @@ -15015,7 +14943,7 @@ "type": "other" } ], - "time": "2024-02-13T14:19:41+00:00" + "time": "2024-03-29T09:10:11+00:00" }, { "name": "spatie/macroable", diff --git a/config/webhook-server.php b/config/webhook-server.php deleted file mode 100644 index cb25c834..00000000 --- a/config/webhook-server.php +++ /dev/null @@ -1,71 +0,0 @@ - env('SQS_QUEUE', 'your-queue-name'), - - /* - * The default queue connection that should be used to send webhook requests. - */ - 'connection' => null, - - /* - * The default http verb to use. - */ - 'http_verb' => 'post', - - /* - * This class is responsible for calculating the signature that will be added to - * the headers of the webhook request. A webhook client can use the signature - * to verify the request hasn't been tampered with. - */ - 'signer' => \Spatie\WebhookServer\Signer\DefaultSigner::class, - - /* - * This is the name of the header where the signature will be added. - */ - 'signature_header_name' => 'Signature', - - /* - * These are the headers that will be added to all webhook requests. - */ - 'headers' => [ - 'Content-Type' => 'application/json', - ], - - /* - * If a call to a webhook takes longer that this amount of seconds - * the attempt will be considered failed. - */ - 'timeout_in_seconds' => 3, - - /* - * The amount of times the webhook should be called before we give up. - */ - 'tries' => 3, - - /* - * This class determines how many seconds there should be between attempts. - */ - 'backoff_strategy' => \Spatie\WebhookServer\BackoffStrategy\ExponentialBackoffStrategy::class, - - /* - * By default we will verify that the ssl certificate of the destination - * of the webhook is valid. - */ - 'verify_ssl' => true, - - /* - * When set to true, an exception will be thrown when the last attempt fails - */ - 'throw_exception_on_failure' => false, - - /* - * When using Laravel Horizon you can specify tags that should be used on the - * underlying job that performs the webhook request. - */ - 'tags' => [], -]; diff --git a/resources/views/mail/form/webhook-error.blade.php b/resources/views/mail/form/webhook-error.blade.php deleted file mode 100644 index 4df9a316..00000000 --- a/resources/views/mail/form/webhook-error.blade.php +++ /dev/null @@ -1,15 +0,0 @@ -@component('mail::message') - -Hello, - -We tried to trigger a **{{$provider}}** notification for your form "{{$form->title}}", but it failed. Here is the error that we got: - -@component('mail::panel') -{{$error}} -@endcomponent - -Click [here to edit your form]({{$form->edit_url}}). - -Contact us via the website live chat if you need any help. - -@endcomponent