From 66a54953d571047823fce6e4740a43da4aadf91d Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 4 Feb 2025 10:48:29 +1100 Subject: [PATCH 1/5] Add instant bank payment for FR,DE,IE --- .../GoCardless/InstantBankPay.php | 7 -- .../GoCardlessPaymentDriver.php | 2 +- composer.lock | 70 +++++++++---------- 3 files changed, 36 insertions(+), 43 deletions(-) diff --git a/app/PaymentDrivers/GoCardless/InstantBankPay.php b/app/PaymentDrivers/GoCardless/InstantBankPay.php index 32ef3b5bd3..6c8a281a1d 100644 --- a/app/PaymentDrivers/GoCardless/InstantBankPay.php +++ b/app/PaymentDrivers/GoCardless/InstantBankPay.php @@ -207,13 +207,6 @@ class InstantBankPay implements MethodInterface, LivewireMethodInterface { PaymentFailureMailer::dispatch($this->go_cardless->client, $payment->status, $this->go_cardless->client->company, $this->go_cardless->payment_hash->data->amount_with_fee); - // PaymentFailureMailer::dispatch( - // $this->go_cardless->client, - // $payment, - // $this->go_cardless->client->company, - // $payment->amount - // ); - $message = [ 'server_response' => $payment, 'data' => $this->go_cardless->payment_hash->data, diff --git a/app/PaymentDrivers/GoCardlessPaymentDriver.php b/app/PaymentDrivers/GoCardlessPaymentDriver.php index a31ef7e484..5a8609a973 100644 --- a/app/PaymentDrivers/GoCardlessPaymentDriver.php +++ b/app/PaymentDrivers/GoCardlessPaymentDriver.php @@ -88,7 +88,7 @@ class GoCardlessPaymentDriver extends BaseDriver $types[] = GatewayType::SEPA; } - if ($this->client && $this->client->currency()->code === 'GBP') { + if ($this->client && (($this->client->currency()->code === 'GBP' && $this->client->country->iso_3166_2 === 'GB') || ($this->client->currency()->code === 'EUR' && in_array($this->client->country->iso_3166_2, ['IE','FR','DE'])))) { $types[] = GatewayType::INSTANT_BANK_PAY; } diff --git a/composer.lock b/composer.lock index dd9464841a..e87ac0e718 100644 --- a/composer.lock +++ b/composer.lock @@ -3032,16 +3032,16 @@ }, { "name": "google/apiclient-services", - "version": "v0.392.0", + "version": "v0.393.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-api-php-client-services.git", - "reference": "a74c2790865bd1f06c0a49460ef1c0edb0be0e7e" + "reference": "ed24c09584df8ef0cdcfb9d4305abf66fc17e609" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/a74c2790865bd1f06c0a49460ef1c0edb0be0e7e", - "reference": "a74c2790865bd1f06c0a49460ef1c0edb0be0e7e", + "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/ed24c09584df8ef0cdcfb9d4305abf66fc17e609", + "reference": "ed24c09584df8ef0cdcfb9d4305abf66fc17e609", "shasum": "" }, "require": { @@ -3070,9 +3070,9 @@ ], "support": { "issues": "https://github.com/googleapis/google-api-php-client-services/issues", - "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.392.0" + "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.393.0" }, - "time": "2025-01-27T01:10:20+00:00" + "time": "2025-02-03T00:54:21+00:00" }, { "name": "google/auth", @@ -3580,16 +3580,16 @@ }, { "name": "guzzlehttp/uri-template", - "version": "v1.0.3", + "version": "v1.0.4", "source": { "type": "git", "url": "https://github.com/guzzle/uri-template.git", - "reference": "ecea8feef63bd4fef1f037ecb288386999ecc11c" + "reference": "30e286560c137526eccd4ce21b2de477ab0676d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/uri-template/zipball/ecea8feef63bd4fef1f037ecb288386999ecc11c", - "reference": "ecea8feef63bd4fef1f037ecb288386999ecc11c", + "url": "https://api.github.com/repos/guzzle/uri-template/zipball/30e286560c137526eccd4ce21b2de477ab0676d2", + "reference": "30e286560c137526eccd4ce21b2de477ab0676d2", "shasum": "" }, "require": { @@ -3646,7 +3646,7 @@ ], "support": { "issues": "https://github.com/guzzle/uri-template/issues", - "source": "https://github.com/guzzle/uri-template/tree/v1.0.3" + "source": "https://github.com/guzzle/uri-template/tree/v1.0.4" }, "funding": [ { @@ -3662,7 +3662,7 @@ "type": "tidelift" } ], - "time": "2023-12-03T19:50:20+00:00" + "time": "2025-02-03T10:55:03+00:00" }, { "name": "halaxa/json-machine", @@ -4064,16 +4064,16 @@ }, { "name": "horstoeko/zugferd", - "version": "v1.0.104", + "version": "v1.0.106", "source": { "type": "git", "url": "https://github.com/horstoeko/zugferd.git", - "reference": "9c37fbe55e37e3082dc3702867d669fb67ef988e" + "reference": "e575f67aaf08f670e435ba01d188b6faa62655a0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/horstoeko/zugferd/zipball/9c37fbe55e37e3082dc3702867d669fb67ef988e", - "reference": "9c37fbe55e37e3082dc3702867d669fb67ef988e", + "url": "https://api.github.com/repos/horstoeko/zugferd/zipball/e575f67aaf08f670e435ba01d188b6faa62655a0", + "reference": "e575f67aaf08f670e435ba01d188b6faa62655a0", "shasum": "" }, "require": { @@ -4132,9 +4132,9 @@ ], "support": { "issues": "https://github.com/horstoeko/zugferd/issues", - "source": "https://github.com/horstoeko/zugferd/tree/v1.0.104" + "source": "https://github.com/horstoeko/zugferd/tree/v1.0.106" }, - "time": "2025-01-19T09:23:02+00:00" + "time": "2025-02-03T13:26:12+00:00" }, { "name": "horstoeko/zugferdvisualizer", @@ -5158,16 +5158,16 @@ }, { "name": "laravel/framework", - "version": "v11.41.0", + "version": "v11.41.3", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "42d6ae000c868c2abfa946da46702f2358493482" + "reference": "3ef433d5865f30a19b6b1be247586068399b59cc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/42d6ae000c868c2abfa946da46702f2358493482", - "reference": "42d6ae000c868c2abfa946da46702f2358493482", + "url": "https://api.github.com/repos/laravel/framework/zipball/3ef433d5865f30a19b6b1be247586068399b59cc", + "reference": "3ef433d5865f30a19b6b1be247586068399b59cc", "shasum": "" }, "require": { @@ -5369,7 +5369,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2025-01-28T15:22:55+00:00" + "time": "2025-01-30T13:25:22+00:00" }, { "name": "laravel/octane", @@ -17909,16 +17909,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.68.3", + "version": "v3.68.5", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "85fd31cced824749a732e697acdd1a3d657312f0" + "reference": "7bedb718b633355272428c60736dc97fb96daf27" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/85fd31cced824749a732e697acdd1a3d657312f0", - "reference": "85fd31cced824749a732e697acdd1a3d657312f0", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/7bedb718b633355272428c60736dc97fb96daf27", + "reference": "7bedb718b633355272428c60736dc97fb96daf27", "shasum": "" }, "require": { @@ -18000,7 +18000,7 @@ ], "support": { "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", - "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.68.3" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.68.5" }, "funding": [ { @@ -18008,7 +18008,7 @@ "type": "github" } ], - "time": "2025-01-27T16:37:32+00:00" + "time": "2025-01-30T17:00:50+00:00" }, { "name": "hamcrest/hamcrest-php", @@ -19050,16 +19050,16 @@ }, { "name": "phpunit/phpunit", - "version": "11.5.5", + "version": "11.5.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "b9a975972f580c0491f834eb0818ad2b32fd8bba" + "reference": "3c3ae14c90f244cdda95028c3e469028e8d1c02c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b9a975972f580c0491f834eb0818ad2b32fd8bba", - "reference": "b9a975972f580c0491f834eb0818ad2b32fd8bba", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3c3ae14c90f244cdda95028c3e469028e8d1c02c", + "reference": "3c3ae14c90f244cdda95028c3e469028e8d1c02c", "shasum": "" }, "require": { @@ -19131,7 +19131,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.5" + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.6" }, "funding": [ { @@ -19147,7 +19147,7 @@ "type": "tidelift" } ], - "time": "2025-01-29T14:01:11+00:00" + "time": "2025-01-31T07:03:30+00:00" }, { "name": "react/cache", From 26e0e702d6d1ce864b4b4ef76f80fe3af5f17ac4 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 4 Feb 2025 10:55:48 +1100 Subject: [PATCH 2/5] Set default for session timeout if less than zero --- app/Http/Requests/Company/UpdateCompanyRequest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Http/Requests/Company/UpdateCompanyRequest.php b/app/Http/Requests/Company/UpdateCompanyRequest.php index 63fb67815b..17705542cf 100644 --- a/app/Http/Requests/Company/UpdateCompanyRequest.php +++ b/app/Http/Requests/Company/UpdateCompanyRequest.php @@ -170,6 +170,10 @@ class UpdateCompanyRequest extends Request $input['enabled_item_tax_rates'] = 1; } + if(isset($input['session_timeout']) && $input['session_timeout'] < 0) { + $input['session_timeout'] = 0; + } + $this->replace($input); } From fd28457f13dc7c156eb6b47ee794866807b7df59 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 4 Feb 2025 11:40:46 +1100 Subject: [PATCH 3/5] Allow client postmark webhooks --- app/Http/Controllers/PostMarkController.php | 7 ++++++- app/Jobs/PostMark/ProcessPostmarkWebhook.php | 10 +++------- routes/api.php | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/app/Http/Controllers/PostMarkController.php b/app/Http/Controllers/PostMarkController.php index 63af8b0069..552db691be 100644 --- a/app/Http/Controllers/PostMarkController.php +++ b/app/Http/Controllers/PostMarkController.php @@ -65,7 +65,12 @@ class PostMarkController extends BaseController public function webhook(Request $request) { if ($request->header('X-API-SECURITY') && $request->header('X-API-SECURITY') == config('services.postmark.token')) { - ProcessPostmarkWebhook::dispatch($request->all())->delay(15); + ProcessPostmarkWebhook::dispatch($request->all(), $request->header('X-API-SECURITY'))->delay(15); + + return response()->json(['message' => 'Success'], 200); + } + elseif($request->header('X-API-SECURITY') && stripos($request->header('X-API-SECURITY'), \Illuminate\Support\Facades\Cache::get('client_postmark_keys')) !== false){ + ProcessPostmarkWebhook::dispatch($request->all(), $request->header('X-API-SECURITY'))->delay(15); return response()->json(['message' => 'Success'], 200); } diff --git a/app/Jobs/PostMark/ProcessPostmarkWebhook.php b/app/Jobs/PostMark/ProcessPostmarkWebhook.php index 1482017005..fd05275064 100644 --- a/app/Jobs/PostMark/ProcessPostmarkWebhook.php +++ b/app/Jobs/PostMark/ProcessPostmarkWebhook.php @@ -59,7 +59,7 @@ class ProcessPostmarkWebhook implements ShouldQueue * Create a new job instance. * */ - public function __construct(private array $request) + public function __construct(private array $request, private string $security_token) { } @@ -356,9 +356,7 @@ class ProcessPostmarkWebhook implements ShouldQueue public function getRawMessage(string $message_id) { - $postmark_secret = !empty($this->company->settings->postmark_secret) ? $this->company->settings->postmark_secret : config('services.postmark.token'); - - $postmark = new PostmarkClient($postmark_secret); + $postmark = new PostmarkClient($this->security_token); $messageDetail = $postmark->getOutboundMessageDetails($message_id); try { @@ -400,9 +398,7 @@ class ProcessPostmarkWebhook implements ShouldQueue try { - $postmark_secret = !empty($this->company->settings->postmark_secret) ? $this->company->settings->postmark_secret : config('services.postmark.token'); - - $postmark = new PostmarkClient($postmark_secret); + $postmark = new PostmarkClient($this->security_token); try { $messageDetail = $postmark->getOutboundMessageDetails($this->request['MessageID']); diff --git a/routes/api.php b/routes/api.php index 69ce64c8c9..d1bb209638 100644 --- a/routes/api.php +++ b/routes/api.php @@ -465,7 +465,7 @@ Route::match(['get', 'post'], 'payment_notification_webhook/{company_key}/{compa ->name('payment_notification_webhook'); -Route::post('api/v1/postmark_webhook', [PostMarkController::class, 'webhook'])->middleware('throttle:2000,1'); +Route::post('api/v1/postmark_webhook', [PostMarkController::class, 'webhook'])->middleware('throttle:5000,1'); Route::post('api/v1/postmark_inbound_webhook', [PostMarkController::class, 'inboundWebhook'])->middleware('throttle:1000,1'); Route::post('api/v1/mailgun_webhook', [MailgunController::class, 'webhook'])->middleware('throttle:1000,1'); Route::post('api/v1/mailgun_inbound_webhook', [MailgunController::class, 'inboundWebhook'])->middleware('throttle:1000,1'); From 497716a193d99c273bfcc5043ad91f19679ed5f9 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 4 Feb 2025 15:00:01 +1100 Subject: [PATCH 4/5] Adjust for mail server misconfiguration --- app/Listeners/User/UpdateUserLastLogin.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Listeners/User/UpdateUserLastLogin.php b/app/Listeners/User/UpdateUserLastLogin.php index af7e32f277..dbbf9acbd3 100644 --- a/app/Listeners/User/UpdateUserLastLogin.php +++ b/app/Listeners/User/UpdateUserLastLogin.php @@ -69,7 +69,12 @@ class UpdateUserLastLogin implements ShouldQueue $nmo->company = $user->account->companies->first(); $nmo->settings = $user->account->companies->first()->settings; $nmo->to_user = $user; - NinjaMailerJob::dispatch($nmo, true); + + try{ + NinjaMailerJob::dispatch($nmo, true); + } catch (\Exception $e) { + //this will catch for users that don't have their mail server configured correctly. + } $user->ip = $ip; $user->save(); From 7931ae3df2d3d90fce8f4a58bf96cbef88600875 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 4 Feb 2025 21:00:52 +1100 Subject: [PATCH 5/5] v5.11.35 --- VERSION.txt | 2 +- config/ninja.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index acf5019955..d6d5784b00 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -5.11.34 \ No newline at end of file +5.11.35 \ No newline at end of file diff --git a/config/ninja.php b/config/ninja.php index 8f4fea27fb..e81ee5361d 100644 --- a/config/ninja.php +++ b/config/ninja.php @@ -17,8 +17,8 @@ return [ 'require_https' => env('REQUIRE_HTTPS', true), 'app_url' => rtrim(env('APP_URL', ''), '/'), 'app_domain' => env('APP_DOMAIN', 'invoicing.co'), - 'app_version' => env('APP_VERSION', '5.11.34'), - 'app_tag' => env('APP_TAG', '5.11.34'), + 'app_version' => env('APP_VERSION', '5.11.35'), + 'app_tag' => env('APP_TAG', '5.11.35'), 'minimum_client_version' => '5.0.16', 'terms_version' => '1.0.1', 'api_secret' => env('API_SECRET', false),