From ebaa1b40712c5d509dd15631f0057e0d9b9027bd Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 2 Nov 2022 17:30:55 +1100 Subject: [PATCH 01/31] Allow individual SMTP per company --- app/Jobs/Mail/NinjaMailerJob.php | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/app/Jobs/Mail/NinjaMailerJob.php b/app/Jobs/Mail/NinjaMailerJob.php index 4eef633829..071e4106a4 100644 --- a/app/Jobs/Mail/NinjaMailerJob.php +++ b/app/Jobs/Mail/NinjaMailerJob.php @@ -133,10 +133,7 @@ class NinjaMailerJob implements ShouldQueue $this->nmo = null; $this->company = null; - - $mem_usage = memory_get_usage(); - - nlog('The script is now using: ' . round($mem_usage / 1024) . 'KBof memory.'); + app('queue.worker')->shouldQuit = 1; } catch (\Exception | \RuntimeException | \Google\Service\Exception $e) { @@ -179,7 +176,6 @@ class NinjaMailerJob implements ShouldQueue $message = null; $this->nmo = null; $this->company = null; - app('queue.worker')->shouldQuit = 1; } @@ -232,8 +228,34 @@ class NinjaMailerJob implements ShouldQueue break; } + + if(Ninja::isSelfHost()) + $this->setSelfHostMultiMailer(); + + } + private function setSelfHostMultiMailer() + { + + if (env($this->company->id . '_MAIL_HOST')) + { + + config([ + 'mail.mailers.smtp' => [ + 'transport' => 'smtp', + 'host' => env($this->company->id . '_MAIL_HOST'), + 'port' => env($this->company->id . '_MAIL_PORT'), + 'username' => env($this->company->id . '_MAIL_USERNAME'), + 'password' => env($this->company->id . '_MAIL_PASSWORD'), + ], + ]); + + } + + } + + private function setOfficeMailer() { $sending_user = $this->nmo->settings->gmail_sending_user_id; From 0019d8b99a6261831da862d5b599c076eb39ecf0 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 2 Nov 2022 17:36:17 +1100 Subject: [PATCH 02/31] Updated lock file --- app/Http/Controllers/TwilioController.php | 5 + composer.lock | 263 +++++++++++----------- 2 files changed, 136 insertions(+), 132 deletions(-) diff --git a/app/Http/Controllers/TwilioController.php b/app/Http/Controllers/TwilioController.php index 1348eec072..94ed0e0138 100644 --- a/app/Http/Controllers/TwilioController.php +++ b/app/Http/Controllers/TwilioController.php @@ -97,6 +97,11 @@ class TwilioController extends BaseController $account->account_sms_verified = true; $account->save(); + //on confirmation we set the users phone number. + $user = auth()->user(); + $user->phone = $account->account_sms_verification_number; + $user->save(); + return response()->json(['message' => 'SMS verified'], 200); } diff --git a/composer.lock b/composer.lock index 084795dde6..f11cf2e3a4 100644 --- a/composer.lock +++ b/composer.lock @@ -378,16 +378,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.240.4", + "version": "3.240.7", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "69c7fa97862694d8c0c03f2e905c7fe05683bee9" + "reference": "afad16e102229de8da15f07cc48436955811ef7f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/69c7fa97862694d8c0c03f2e905c7fe05683bee9", - "reference": "69c7fa97862694d8c0c03f2e905c7fe05683bee9", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/afad16e102229de8da15f07cc48436955811ef7f", + "reference": "afad16e102229de8da15f07cc48436955811ef7f", "shasum": "" }, "require": { @@ -466,9 +466,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.240.4" + "source": "https://github.com/aws/aws-sdk-php/tree/3.240.7" }, - "time": "2022-10-27T19:19:40+00:00" + "time": "2022-11-01T18:23:34+00:00" }, { "name": "bacon/bacon-qr-code", @@ -1906,16 +1906,16 @@ }, { "name": "firebase/php-jwt", - "version": "v6.3.0", + "version": "v6.3.1", "source": { "type": "git", "url": "https://github.com/firebase/php-jwt.git", - "reference": "018dfc4e1da92ad8a1b90adc4893f476a3b41cb8" + "reference": "ddfaddcb520488b42bca3a75e17e9dd53c3667da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/firebase/php-jwt/zipball/018dfc4e1da92ad8a1b90adc4893f476a3b41cb8", - "reference": "018dfc4e1da92ad8a1b90adc4893f476a3b41cb8", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/ddfaddcb520488b42bca3a75e17e9dd53c3667da", + "reference": "ddfaddcb520488b42bca3a75e17e9dd53c3667da", "shasum": "" }, "require": { @@ -1962,9 +1962,9 @@ ], "support": { "issues": "https://github.com/firebase/php-jwt/issues", - "source": "https://github.com/firebase/php-jwt/tree/v6.3.0" + "source": "https://github.com/firebase/php-jwt/tree/v6.3.1" }, - "time": "2022-07-15T16:48:45+00:00" + "time": "2022-11-01T21:20:08+00:00" }, { "name": "fruitcake/php-cors", @@ -2164,16 +2164,16 @@ }, { "name": "google/apiclient-services", - "version": "v0.272.0", + "version": "v0.272.1", "source": { "type": "git", "url": "https://github.com/googleapis/google-api-php-client-services.git", - "reference": "52b494231f6b531983d12aefac057d0eeec2861c" + "reference": "436943c42277545c2310fe5852835d7e3628a35a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/52b494231f6b531983d12aefac057d0eeec2861c", - "reference": "52b494231f6b531983d12aefac057d0eeec2861c", + "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/436943c42277545c2310fe5852835d7e3628a35a", + "reference": "436943c42277545c2310fe5852835d7e3628a35a", "shasum": "" }, "require": { @@ -2202,9 +2202,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.272.0" + "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.272.1" }, - "time": "2022-10-21T01:18:13+00:00" + "time": "2022-10-31T01:22:13+00:00" }, { "name": "google/auth", @@ -3483,16 +3483,16 @@ }, { "name": "laravel/framework", - "version": "v9.37.0", + "version": "v9.38.0", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "0c9675abf6d966e834b2ebeca3319f524e07a330" + "reference": "abf198e443e06696af3f356b44de67c0fa516107" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/0c9675abf6d966e834b2ebeca3319f524e07a330", - "reference": "0c9675abf6d966e834b2ebeca3319f524e07a330", + "url": "https://api.github.com/repos/laravel/framework/zipball/abf198e443e06696af3f356b44de67c0fa516107", + "reference": "abf198e443e06696af3f356b44de67c0fa516107", "shasum": "" }, "require": { @@ -3665,7 +3665,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2022-10-25T15:43:46+00:00" + "time": "2022-11-01T14:05:55+00:00" }, { "name": "laravel/serializable-closure", @@ -4123,16 +4123,16 @@ }, { "name": "league/commonmark", - "version": "2.3.5", + "version": "2.3.6", "source": { "type": "git", "url": "https://github.com/thephpleague/commonmark.git", - "reference": "84d74485fdb7074f4f9dd6f02ab957b1de513257" + "reference": "857afc47ce113454bd629037213378ba3219dd40" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/84d74485fdb7074f4f9dd6f02ab957b1de513257", - "reference": "84d74485fdb7074f4f9dd6f02ab957b1de513257", + "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/857afc47ce113454bd629037213378ba3219dd40", + "reference": "857afc47ce113454bd629037213378ba3219dd40", "shasum": "" }, "require": { @@ -4152,7 +4152,7 @@ "erusev/parsedown": "^1.0", "ext-json": "*", "github/gfm": "0.29.0", - "michelf/php-markdown": "^1.4", + "michelf/php-markdown": "^1.4 || ^2.0", "nyholm/psr7": "^1.5", "phpstan/phpstan": "^1.8.2", "phpunit/phpunit": "^9.5.21", @@ -4225,7 +4225,7 @@ "type": "tidelift" } ], - "time": "2022-07-29T10:59:45+00:00" + "time": "2022-10-30T16:45:38+00:00" }, { "name": "league/config", @@ -5727,16 +5727,16 @@ }, { "name": "nunomaduro/termwind", - "version": "v1.14.1", + "version": "v1.14.2", "source": { "type": "git", "url": "https://github.com/nunomaduro/termwind.git", - "reference": "86fc30eace93b9b6d4c844ba6de76db84184e01b" + "reference": "9a8218511eb1a0965629ff820dda25985440aefc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nunomaduro/termwind/zipball/86fc30eace93b9b6d4c844ba6de76db84184e01b", - "reference": "86fc30eace93b9b6d4c844ba6de76db84184e01b", + "url": "https://api.github.com/repos/nunomaduro/termwind/zipball/9a8218511eb1a0965629ff820dda25985440aefc", + "reference": "9a8218511eb1a0965629ff820dda25985440aefc", "shasum": "" }, "require": { @@ -5793,7 +5793,7 @@ ], "support": { "issues": "https://github.com/nunomaduro/termwind/issues", - "source": "https://github.com/nunomaduro/termwind/tree/v1.14.1" + "source": "https://github.com/nunomaduro/termwind/tree/v1.14.2" }, "funding": [ { @@ -5809,7 +5809,7 @@ "type": "github" } ], - "time": "2022-10-17T15:20:29+00:00" + "time": "2022-10-28T22:51:32+00:00" }, { "name": "nwidart/laravel-modules", @@ -8746,16 +8746,16 @@ }, { "name": "symfony/console", - "version": "v6.1.6", + "version": "v6.1.7", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "7fa3b9cf17363468795e539231a5c91b02b608fc" + "reference": "a1282bd0c096e0bdb8800b104177e2ce404d8815" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/7fa3b9cf17363468795e539231a5c91b02b608fc", - "reference": "7fa3b9cf17363468795e539231a5c91b02b608fc", + "url": "https://api.github.com/repos/symfony/console/zipball/a1282bd0c096e0bdb8800b104177e2ce404d8815", + "reference": "a1282bd0c096e0bdb8800b104177e2ce404d8815", "shasum": "" }, "require": { @@ -8822,7 +8822,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.1.6" + "source": "https://github.com/symfony/console/tree/v6.1.7" }, "funding": [ { @@ -8838,7 +8838,7 @@ "type": "tidelift" } ], - "time": "2022-10-07T08:04:03+00:00" + "time": "2022-10-26T21:42:49+00:00" }, { "name": "symfony/css-selector", @@ -8974,16 +8974,16 @@ }, { "name": "symfony/error-handler", - "version": "v6.1.6", + "version": "v6.1.7", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", - "reference": "49f718e41f1b6f0fd5730895ca5b1c37defd828d" + "reference": "699a26ce5ec656c198bf6e26398b0f0818c7e504" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/49f718e41f1b6f0fd5730895ca5b1c37defd828d", - "reference": "49f718e41f1b6f0fd5730895ca5b1c37defd828d", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/699a26ce5ec656c198bf6e26398b0f0818c7e504", + "reference": "699a26ce5ec656c198bf6e26398b0f0818c7e504", "shasum": "" }, "require": { @@ -9025,7 +9025,7 @@ "description": "Provides tools to manage errors and ease debugging PHP code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/error-handler/tree/v6.1.6" + "source": "https://github.com/symfony/error-handler/tree/v6.1.7" }, "funding": [ { @@ -9041,7 +9041,7 @@ "type": "tidelift" } ], - "time": "2022-10-07T08:04:03+00:00" + "time": "2022-10-28T16:23:08+00:00" }, { "name": "symfony/event-dispatcher", @@ -9334,16 +9334,16 @@ }, { "name": "symfony/http-client", - "version": "v6.1.6", + "version": "v6.1.7", "source": { "type": "git", "url": "https://github.com/symfony/http-client.git", - "reference": "c8c887f4813370550147afd27d9eb8a8523e53b2" + "reference": "f515d066728774efb34347a87580621416ca8968" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client/zipball/c8c887f4813370550147afd27d9eb8a8523e53b2", - "reference": "c8c887f4813370550147afd27d9eb8a8523e53b2", + "url": "https://api.github.com/repos/symfony/http-client/zipball/f515d066728774efb34347a87580621416ca8968", + "reference": "f515d066728774efb34347a87580621416ca8968", "shasum": "" }, "require": { @@ -9398,7 +9398,7 @@ "description": "Provides powerful methods to fetch HTTP resources synchronously or asynchronously", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-client/tree/v6.1.6" + "source": "https://github.com/symfony/http-client/tree/v6.1.7" }, "funding": [ { @@ -9414,7 +9414,7 @@ "type": "tidelift" } ], - "time": "2022-10-12T05:10:31+00:00" + "time": "2022-10-28T16:23:08+00:00" }, { "name": "symfony/http-client-contracts", @@ -9499,16 +9499,16 @@ }, { "name": "symfony/http-foundation", - "version": "v6.1.6", + "version": "v6.1.7", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "3ae8e9c57155fc48930493a629da293b32efbde0" + "reference": "792a1856d2b95273f0e1c3435785f1d01a60ecc6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/3ae8e9c57155fc48930493a629da293b32efbde0", - "reference": "3ae8e9c57155fc48930493a629da293b32efbde0", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/792a1856d2b95273f0e1c3435785f1d01a60ecc6", + "reference": "792a1856d2b95273f0e1c3435785f1d01a60ecc6", "shasum": "" }, "require": { @@ -9554,7 +9554,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v6.1.6" + "source": "https://github.com/symfony/http-foundation/tree/v6.1.7" }, "funding": [ { @@ -9570,20 +9570,20 @@ "type": "tidelift" } ], - "time": "2022-10-02T08:30:52+00:00" + "time": "2022-10-12T09:44:59+00:00" }, { "name": "symfony/http-kernel", - "version": "v6.1.6", + "version": "v6.1.7", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "102f99bf81799e93f61b9a73b2f38b309c587a94" + "reference": "8fc1ffe753948c47a103a809cdd6a4a8458b3254" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/102f99bf81799e93f61b9a73b2f38b309c587a94", - "reference": "102f99bf81799e93f61b9a73b2f38b309c587a94", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/8fc1ffe753948c47a103a809cdd6a4a8458b3254", + "reference": "8fc1ffe753948c47a103a809cdd6a4a8458b3254", "shasum": "" }, "require": { @@ -9664,7 +9664,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v6.1.6" + "source": "https://github.com/symfony/http-kernel/tree/v6.1.7" }, "funding": [ { @@ -9680,20 +9680,20 @@ "type": "tidelift" } ], - "time": "2022-10-12T07:48:47+00:00" + "time": "2022-10-28T18:06:36+00:00" }, { "name": "symfony/intl", - "version": "v6.1.6", + "version": "v6.1.7", "source": { "type": "git", "url": "https://github.com/symfony/intl.git", - "reference": "9ab546d9054b34feb2cb728349f6b8e8f18d4c43" + "reference": "8025e5b651512b21d3e768321d45a2e5e32e8c66" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/intl/zipball/9ab546d9054b34feb2cb728349f6b8e8f18d4c43", - "reference": "9ab546d9054b34feb2cb728349f6b8e8f18d4c43", + "url": "https://api.github.com/repos/symfony/intl/zipball/8025e5b651512b21d3e768321d45a2e5e32e8c66", + "reference": "8025e5b651512b21d3e768321d45a2e5e32e8c66", "shasum": "" }, "require": { @@ -9744,7 +9744,7 @@ "localization" ], "support": { - "source": "https://github.com/symfony/intl/tree/v6.1.6" + "source": "https://github.com/symfony/intl/tree/v6.1.7" }, "funding": [ { @@ -9760,20 +9760,20 @@ "type": "tidelift" } ], - "time": "2022-10-07T08:04:03+00:00" + "time": "2022-10-23T10:33:34+00:00" }, { "name": "symfony/mailer", - "version": "v6.1.5", + "version": "v6.1.7", "source": { "type": "git", "url": "https://github.com/symfony/mailer.git", - "reference": "e1b32deb9efc48def0c76b876860ad36f2123e89" + "reference": "7e19813c0b43387c55665780c4caea505cc48391" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mailer/zipball/e1b32deb9efc48def0c76b876860ad36f2123e89", - "reference": "e1b32deb9efc48def0c76b876860ad36f2123e89", + "url": "https://api.github.com/repos/symfony/mailer/zipball/7e19813c0b43387c55665780c4caea505cc48391", + "reference": "7e19813c0b43387c55665780c4caea505cc48391", "shasum": "" }, "require": { @@ -9818,7 +9818,7 @@ "description": "Helps sending emails", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/mailer/tree/v6.1.5" + "source": "https://github.com/symfony/mailer/tree/v6.1.7" }, "funding": [ { @@ -9834,7 +9834,7 @@ "type": "tidelift" } ], - "time": "2022-08-29T06:58:39+00:00" + "time": "2022-10-28T16:23:08+00:00" }, { "name": "symfony/mailgun-mailer", @@ -9903,16 +9903,16 @@ }, { "name": "symfony/mime", - "version": "v6.1.6", + "version": "v6.1.7", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "5ae192b9a39730435cfec025a499f79d05ac68a3" + "reference": "f440f066d57691088d998d6e437ce98771144618" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/5ae192b9a39730435cfec025a499f79d05ac68a3", - "reference": "5ae192b9a39730435cfec025a499f79d05ac68a3", + "url": "https://api.github.com/repos/symfony/mime/zipball/f440f066d57691088d998d6e437ce98771144618", + "reference": "f440f066d57691088d998d6e437ce98771144618", "shasum": "" }, "require": { @@ -9924,8 +9924,7 @@ "egulias/email-validator": "~3.0.0", "phpdocumentor/reflection-docblock": "<3.2.2", "phpdocumentor/type-resolver": "<1.4.0", - "symfony/mailer": "<5.4", - "symfony/serializer": "<5.4.14|>=6.0,<6.0.14|>=6.1,<6.1.6" + "symfony/mailer": "<5.4" }, "require-dev": { "egulias/email-validator": "^2.1.10|^3.1", @@ -9933,7 +9932,7 @@ "symfony/dependency-injection": "^5.4|^6.0", "symfony/property-access": "^5.4|^6.0", "symfony/property-info": "^5.4|^6.0", - "symfony/serializer": "^5.4.14|~6.0.14|^6.1.6" + "symfony/serializer": "^5.2|^6.0" }, "type": "library", "autoload": { @@ -9965,7 +9964,7 @@ "mime-type" ], "support": { - "source": "https://github.com/symfony/mime/tree/v6.1.6" + "source": "https://github.com/symfony/mime/tree/v6.1.7" }, "funding": [ { @@ -9981,7 +9980,7 @@ "type": "tidelift" } ], - "time": "2022-10-07T08:04:03+00:00" + "time": "2022-10-19T08:10:53+00:00" }, { "name": "symfony/options-resolver", @@ -11083,16 +11082,16 @@ }, { "name": "symfony/property-access", - "version": "v5.4.11", + "version": "v5.4.15", "source": { "type": "git", "url": "https://github.com/symfony/property-access.git", - "reference": "c641d63e943ed31981bad4b4dcf29fe7da2ffa8c" + "reference": "0f3e8f40a1d3da90f674b3dd772e4777ccde4273" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/property-access/zipball/c641d63e943ed31981bad4b4dcf29fe7da2ffa8c", - "reference": "c641d63e943ed31981bad4b4dcf29fe7da2ffa8c", + "url": "https://api.github.com/repos/symfony/property-access/zipball/0f3e8f40a1d3da90f674b3dd772e4777ccde4273", + "reference": "0f3e8f40a1d3da90f674b3dd772e4777ccde4273", "shasum": "" }, "require": { @@ -11144,7 +11143,7 @@ "reflection" ], "support": { - "source": "https://github.com/symfony/property-access/tree/v5.4.11" + "source": "https://github.com/symfony/property-access/tree/v5.4.15" }, "funding": [ { @@ -11160,20 +11159,20 @@ "type": "tidelift" } ], - "time": "2022-06-27T16:58:25+00:00" + "time": "2022-10-27T07:55:40+00:00" }, { "name": "symfony/property-info", - "version": "v6.1.6", + "version": "v6.1.7", "source": { "type": "git", "url": "https://github.com/symfony/property-info.git", - "reference": "f28d0db9d2687f81d68d0dc6b2e42817647f5d64" + "reference": "b5a46ec66a4b77d4bd39d58c22710be888e55b68" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/property-info/zipball/f28d0db9d2687f81d68d0dc6b2e42817647f5d64", - "reference": "f28d0db9d2687f81d68d0dc6b2e42817647f5d64", + "url": "https://api.github.com/repos/symfony/property-info/zipball/b5a46ec66a4b77d4bd39d58c22710be888e55b68", + "reference": "b5a46ec66a4b77d4bd39d58c22710be888e55b68", "shasum": "" }, "require": { @@ -11233,7 +11232,7 @@ "validator" ], "support": { - "source": "https://github.com/symfony/property-info/tree/v6.1.6" + "source": "https://github.com/symfony/property-info/tree/v6.1.7" }, "funding": [ { @@ -11249,7 +11248,7 @@ "type": "tidelift" } ], - "time": "2022-10-07T08:04:03+00:00" + "time": "2022-10-28T16:23:08+00:00" }, { "name": "symfony/psr-http-message-bridge", @@ -11341,16 +11340,16 @@ }, { "name": "symfony/routing", - "version": "v6.1.5", + "version": "v6.1.7", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "f8c1ebb43d0f39e5ecd12a732ba1952a3dd8455c" + "reference": "95effeb9d6e2cec861cee06bf5bbf82d09aea7f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/f8c1ebb43d0f39e5ecd12a732ba1952a3dd8455c", - "reference": "f8c1ebb43d0f39e5ecd12a732ba1952a3dd8455c", + "url": "https://api.github.com/repos/symfony/routing/zipball/95effeb9d6e2cec861cee06bf5bbf82d09aea7f5", + "reference": "95effeb9d6e2cec861cee06bf5bbf82d09aea7f5", "shasum": "" }, "require": { @@ -11409,7 +11408,7 @@ "url" ], "support": { - "source": "https://github.com/symfony/routing/tree/v6.1.5" + "source": "https://github.com/symfony/routing/tree/v6.1.7" }, "funding": [ { @@ -11425,7 +11424,7 @@ "type": "tidelift" } ], - "time": "2022-09-09T09:26:14+00:00" + "time": "2022-10-18T13:12:43+00:00" }, { "name": "symfony/service-contracts", @@ -11514,16 +11513,16 @@ }, { "name": "symfony/string", - "version": "v6.1.6", + "version": "v6.1.7", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "7e7e0ff180d4c5a6636eaad57b65092014b61864" + "reference": "823f143370880efcbdfa2dbca946b3358c4707e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/7e7e0ff180d4c5a6636eaad57b65092014b61864", - "reference": "7e7e0ff180d4c5a6636eaad57b65092014b61864", + "url": "https://api.github.com/repos/symfony/string/zipball/823f143370880efcbdfa2dbca946b3358c4707e5", + "reference": "823f143370880efcbdfa2dbca946b3358c4707e5", "shasum": "" }, "require": { @@ -11579,7 +11578,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.1.6" + "source": "https://github.com/symfony/string/tree/v6.1.7" }, "funding": [ { @@ -11850,16 +11849,16 @@ }, { "name": "symfony/validator", - "version": "v6.1.6", + "version": "v6.1.7", "source": { "type": "git", "url": "https://github.com/symfony/validator.git", - "reference": "e5589882403e1e19774d7c5ffb65d9c6466d216c" + "reference": "0cc147f2e4a0d78221db85545751cd8764bbc156" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/validator/zipball/e5589882403e1e19774d7c5ffb65d9c6466d216c", - "reference": "e5589882403e1e19774d7c5ffb65d9c6466d216c", + "url": "https://api.github.com/repos/symfony/validator/zipball/0cc147f2e4a0d78221db85545751cd8764bbc156", + "reference": "0cc147f2e4a0d78221db85545751cd8764bbc156", "shasum": "" }, "require": { @@ -11938,7 +11937,7 @@ "description": "Provides tools to validate values", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/validator/tree/v6.1.6" + "source": "https://github.com/symfony/validator/tree/v6.1.7" }, "funding": [ { @@ -11954,7 +11953,7 @@ "type": "tidelift" } ], - "time": "2022-10-02T08:30:52+00:00" + "time": "2022-10-28T16:23:08+00:00" }, { "name": "symfony/var-dumper", @@ -12227,16 +12226,16 @@ }, { "name": "twilio/sdk", - "version": "6.43.0", + "version": "6.43.1", "source": { "type": "git", "url": "git@github.com:twilio/twilio-php.git", - "reference": "687245ed07dc807eec94389f715323cf13c1e316" + "reference": "040e989adccc39437371b14da5f20f068e586509" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twilio/twilio-php/zipball/687245ed07dc807eec94389f715323cf13c1e316", - "reference": "687245ed07dc807eec94389f715323cf13c1e316", + "url": "https://api.github.com/repos/twilio/twilio-php/zipball/040e989adccc39437371b14da5f20f068e586509", + "reference": "040e989adccc39437371b14da5f20f068e586509", "shasum": "" }, "require": { @@ -12272,7 +12271,7 @@ "sms", "twilio" ], - "time": "2022-10-19T19:27:21+00:00" + "time": "2022-10-31T19:29:12+00:00" }, { "name": "vlucas/phpdotenv", @@ -12922,16 +12921,16 @@ }, { "name": "brianium/paratest", - "version": "v6.6.4", + "version": "v6.6.5", "source": { "type": "git", "url": "https://github.com/paratestphp/paratest.git", - "reference": "4ce800dc32fd0292a4f05c00f347142dce1ecdda" + "reference": "31fd5d69b41725f383c9a083831eefcc7ecd9061" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paratestphp/paratest/zipball/4ce800dc32fd0292a4f05c00f347142dce1ecdda", - "reference": "4ce800dc32fd0292a4f05c00f347142dce1ecdda", + "url": "https://api.github.com/repos/paratestphp/paratest/zipball/31fd5d69b41725f383c9a083831eefcc7ecd9061", + "reference": "31fd5d69b41725f383c9a083831eefcc7ecd9061", "shasum": "" }, "require": { @@ -12998,7 +12997,7 @@ ], "support": { "issues": "https://github.com/paratestphp/paratest/issues", - "source": "https://github.com/paratestphp/paratest/tree/v6.6.4" + "source": "https://github.com/paratestphp/paratest/tree/v6.6.5" }, "funding": [ { @@ -13010,7 +13009,7 @@ "type": "paypal" } ], - "time": "2022-09-13T10:47:01+00:00" + "time": "2022-10-28T12:22:26+00:00" }, { "name": "composer/package-versions-deprecated", @@ -14908,16 +14907,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.25", + "version": "9.5.26", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "3e6f90ca7e3d02025b1d147bd8d4a89fd4ca8a1d" + "reference": "851867efcbb6a1b992ec515c71cdcf20d895e9d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3e6f90ca7e3d02025b1d147bd8d4a89fd4ca8a1d", - "reference": "3e6f90ca7e3d02025b1d147bd8d4a89fd4ca8a1d", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/851867efcbb6a1b992ec515c71cdcf20d895e9d2", + "reference": "851867efcbb6a1b992ec515c71cdcf20d895e9d2", "shasum": "" }, "require": { @@ -14990,7 +14989,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.25" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.26" }, "funding": [ { @@ -15006,7 +15005,7 @@ "type": "tidelift" } ], - "time": "2022-09-25T03:44:45+00:00" + "time": "2022-10-28T06:00:21+00:00" }, { "name": "sebastian/cli-parser", From eecdab00e708798f1d186a84e007b2bb3827ffcd Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 2 Nov 2022 17:39:13 +1100 Subject: [PATCH 03/31] Add verified phone number flag --- ...dd_verified_number_flag_to_users_table.php | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 database/migrations/2022_11_02_063742_add_verified_number_flag_to_users_table.php diff --git a/database/migrations/2022_11_02_063742_add_verified_number_flag_to_users_table.php b/database/migrations/2022_11_02_063742_add_verified_number_flag_to_users_table.php new file mode 100644 index 0000000000..432a13c197 --- /dev/null +++ b/database/migrations/2022_11_02_063742_add_verified_number_flag_to_users_table.php @@ -0,0 +1,29 @@ +boolean('verified_phone_number')->default(false); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + } +}; From e3b37edb4da31a405d8c64565225044f0bf471ff Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 2 Nov 2022 17:45:19 +1100 Subject: [PATCH 04/31] Check users number for validity for SMS verifications --- app/Observers/UserObserver.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/Observers/UserObserver.php b/app/Observers/UserObserver.php index 9f1f008668..c54bf0b1f2 100644 --- a/app/Observers/UserObserver.php +++ b/app/Observers/UserObserver.php @@ -12,6 +12,7 @@ namespace App\Observers; use App\Models\User; +use App\Utils\Ninja; class UserObserver { @@ -23,7 +24,9 @@ class UserObserver */ public function created(User $user) { + if (Ninja::isHosted() && isset($user->phone)) { + } } /** @@ -34,7 +37,9 @@ class UserObserver */ public function updated(User $user) { + if (Ninja::isHosted() && $user->isDirty('phone')) { + } } /** From 3387651d7a49c7fc16b47d7782050a1de8086c91 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 2 Nov 2022 18:30:34 +1100 Subject: [PATCH 05/31] User Twilio API to verify phone numbers --- app/Observers/UserObserver.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Observers/UserObserver.php b/app/Observers/UserObserver.php index c54bf0b1f2..ce9fe4b35f 100644 --- a/app/Observers/UserObserver.php +++ b/app/Observers/UserObserver.php @@ -11,6 +11,7 @@ namespace App\Observers; +use App\Jobs\User\VerifyPhone; use App\Models\User; use App\Utils\Ninja; @@ -25,7 +26,7 @@ class UserObserver public function created(User $user) { if (Ninja::isHosted() && isset($user->phone)) { - + VerifyPhone::dispatch($user); } } @@ -38,7 +39,7 @@ class UserObserver public function updated(User $user) { if (Ninja::isHosted() && $user->isDirty('phone')) { - + VerifyPhone::dispatch($user); } } From ab5b709f9de5b6b91fdd59b872304d73ecab7353 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 2 Nov 2022 18:31:46 +1100 Subject: [PATCH 06/31] User Twilio API to verify phone numbers --- app/Jobs/User/VerifyPhone.php | 84 +++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 app/Jobs/User/VerifyPhone.php diff --git a/app/Jobs/User/VerifyPhone.php b/app/Jobs/User/VerifyPhone.php new file mode 100644 index 0000000000..592e965d85 --- /dev/null +++ b/app/Jobs/User/VerifyPhone.php @@ -0,0 +1,84 @@ +email); + + $sid = config('ninja.twilio_account_sid'); + $token = config('ninja.twilio_auth_token'); + + if(!$sid) + return; // no twilio api credentials provided, bail. + + $twilio = new Twilio\Rest\Client($sid, $token); + + $country = $user->account?->companies()?->first()?->country(); + + if(!$country || strlen($user->phone) < 2) + return; + + $countryCode = $country->iso_3166_2; + + try{ + + $phone_number = $twilio->lookups->v1->phoneNumbers($user->phone) + ->fetch(["countryCode" => $countryCode]); + } + catch(\Exception $e) { + $user->verified_phone_number = false; + $user->save(); + } + + if($phone_number && strlen($phone_number->phoneNumber) > 1) + { + $user->phone = $phone_number->phoneNumber; + $user->verified_phone_number = true; + $user->save(); + } + } + +} \ No newline at end of file From cececa90a7140fec70557686b133092982c6f1b0 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 2 Nov 2022 21:07:32 +1100 Subject: [PATCH 07/31] Update phpunit spec for github actions --- .github/workflows/phpunit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index ad1109a26b..b4599c3da2 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: operating-system: ['ubuntu-20.04', 'ubuntu-22.04'] - php-versions: ['8.1'] + php-versions: ['8.1.12'] phpunit-versions: ['latest'] env: From 270b0106fcbe8a40910863862595c6d6745c55f9 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 2 Nov 2022 21:30:25 +1100 Subject: [PATCH 08/31] Validate phone numbers --- app/Http/Requests/User/StoreUserRequest.php | 2 + app/Http/Requests/User/UpdateUserRequest.php | 11 +++ .../User/HasValidPhoneNumber.php | 77 +++++++++++++++++++ app/Jobs/User/VerifyPhone.php | 1 - lang/en/texts.php | 2 +- 5 files changed, 91 insertions(+), 2 deletions(-) create mode 100644 app/Http/ValidationRules/User/HasValidPhoneNumber.php diff --git a/app/Http/Requests/User/StoreUserRequest.php b/app/Http/Requests/User/StoreUserRequest.php index 57d8baf4b4..09b4e149aa 100644 --- a/app/Http/Requests/User/StoreUserRequest.php +++ b/app/Http/Requests/User/StoreUserRequest.php @@ -16,6 +16,7 @@ use App\Factory\UserFactory; use App\Http\Requests\Request; use App\Http\ValidationRules\Ninja\CanAddUserRule; use App\Http\ValidationRules\User\AttachableUser; +use App\Http\ValidationRules\User\HasValidPhoneNumber; use App\Http\ValidationRules\ValidUserForCompany; use App\Libraries\MultiDB; use App\Models\User; @@ -49,6 +50,7 @@ class StoreUserRequest extends Request if (Ninja::isHosted()) { $rules['id'] = new CanAddUserRule(); + $rules['phone'] = ['sometimes', new HasValidPhoneNumber()]; } return $rules; diff --git a/app/Http/Requests/User/UpdateUserRequest.php b/app/Http/Requests/User/UpdateUserRequest.php index 2e2a95bb7f..2e98774d1d 100644 --- a/app/Http/Requests/User/UpdateUserRequest.php +++ b/app/Http/Requests/User/UpdateUserRequest.php @@ -13,9 +13,13 @@ namespace App\Http\Requests\User; use App\Http\Requests\Request; use App\Http\ValidationRules\UniqueUserRule; +use App\Http\ValidationRules\User\HasValidPhoneNumber; class UpdateUserRequest extends Request { + + private bool $phone_has_changed = false; + /** * Determine if the user is authorized to make this request. * @@ -38,6 +42,9 @@ class UpdateUserRequest extends Request $rules['email'] = ['email', 'sometimes', new UniqueUserRule($this->user, $input['email'])]; } + if(Ninja::isHosted() && $this->phone_has_changed) + $rules['phone'] = ['sometimes', new HasValidPhoneNumber()]; + return $rules; } @@ -57,6 +64,10 @@ class UpdateUserRequest extends Request $input['last_name'] = strip_tags($input['last_name']); } + if(strlen($input['phone']) > 1 && ($this->user->phone != $input['phone'])) + $this->phone_has_changed = true; + $this->replace($input); } + } diff --git a/app/Http/ValidationRules/User/HasValidPhoneNumber.php b/app/Http/ValidationRules/User/HasValidPhoneNumber.php new file mode 100644 index 0000000000..556bce5bf3 --- /dev/null +++ b/app/Http/ValidationRules/User/HasValidPhoneNumber.php @@ -0,0 +1,77 @@ +user()->account?->companies()?->first()?->country(); + + if(!$country || strlen($user->phone) < 2) + return true; + + $countryCode = $country->iso_3166_2; + + try{ + + $phone_number = $twilio->lookups->v1->phoneNumbers($value) + ->fetch(["countryCode" => $countryCode]); + + $user = auth()->user(); + $user->phone = $phone_number->phoneNumber; + $user->verified_phone_number = true; + $user->save(); + + return true; + + } + catch(\Exception $e) { + return false; + } + + } + + public function messages() + { + return [ + 'phone' => ctrans('texts.phone_validation_error'), + ]; + } +} diff --git a/app/Jobs/User/VerifyPhone.php b/app/Jobs/User/VerifyPhone.php index 592e965d85..6aa0823b0f 100644 --- a/app/Jobs/User/VerifyPhone.php +++ b/app/Jobs/User/VerifyPhone.php @@ -22,7 +22,6 @@ use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Http\Request; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; -use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; diff --git a/lang/en/texts.php b/lang/en/texts.php index e8d3de5448..27f7c06267 100644 --- a/lang/en/texts.php +++ b/lang/en/texts.php @@ -4777,7 +4777,7 @@ $LANG = array( 'invoice_task_project' => 'Invoice Task Project', 'invoice_task_project_help' => 'Add the project to the invoice line items', 'bulk_action' => 'Bulk Action', - + 'phone_validation_error' => 'This phone number is not valid, please enter in E.164 format', ); return $LANG; From aa206cb406b8d4f0062351d7ea8f3853b58fc0ba Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 2 Nov 2022 21:36:57 +1100 Subject: [PATCH 09/31] Fixes for verifyphone --- .github/workflows/phpunit.yml | 2 +- .../User/HasValidPhoneNumber.php | 2 +- app/Jobs/User/VerifyPhone.php | 22 ++++++++++--------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index b4599c3da2..d662e4d2da 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: operating-system: ['ubuntu-20.04', 'ubuntu-22.04'] - php-versions: ['8.1.12'] + php-versions: ['8.1.11'] phpunit-versions: ['latest'] env: diff --git a/app/Http/ValidationRules/User/HasValidPhoneNumber.php b/app/Http/ValidationRules/User/HasValidPhoneNumber.php index 556bce5bf3..86e7b20a7a 100644 --- a/app/Http/ValidationRules/User/HasValidPhoneNumber.php +++ b/app/Http/ValidationRules/User/HasValidPhoneNumber.php @@ -38,7 +38,7 @@ class HasValidPhoneNumber implements Rule $token = config('ninja.twilio_auth_token'); if(!$sid) - return true; // no twilio api credentials provided, bail. + return true; $twilio = new Twilio\Rest\Client($sid, $token); diff --git a/app/Jobs/User/VerifyPhone.php b/app/Jobs/User/VerifyPhone.php index 6aa0823b0f..6bd17c7541 100644 --- a/app/Jobs/User/VerifyPhone.php +++ b/app/Jobs/User/VerifyPhone.php @@ -35,7 +35,7 @@ class VerifyPhone implements ShouldQueue * * @param User $user */ - public function __construct(public User $user){} + public function __construct(private User $user){} /** * Execute the job. @@ -45,7 +45,9 @@ class VerifyPhone implements ShouldQueue public function handle() : void { - MultiDB::checkUserEmailExists($user->email); + MultiDB::checkUserEmailExists($this->user->email); + + $this->user = User::find($this->user); $sid = config('ninja.twilio_account_sid'); $token = config('ninja.twilio_auth_token'); @@ -55,28 +57,28 @@ class VerifyPhone implements ShouldQueue $twilio = new Twilio\Rest\Client($sid, $token); - $country = $user->account?->companies()?->first()?->country(); + $country = $this->user->account?->companies()?->first()?->country(); - if(!$country || strlen($user->phone) < 2) + if(!$country || strlen($this->user->phone) < 2) return; $countryCode = $country->iso_3166_2; try{ - $phone_number = $twilio->lookups->v1->phoneNumbers($user->phone) + $phone_number = $twilio->lookups->v1->phoneNumbers($this->user->phone) ->fetch(["countryCode" => $countryCode]); } catch(\Exception $e) { - $user->verified_phone_number = false; - $user->save(); + $this->user->verified_phone_number = false; + $this->user->save(); } if($phone_number && strlen($phone_number->phoneNumber) > 1) { - $user->phone = $phone_number->phoneNumber; - $user->verified_phone_number = true; - $user->save(); + $this->user->phone = $phone_number->phoneNumber; + $this->user->verified_phone_number = true; + $this->user->save(); } } From 15a1c6fab90ef72e0bd8f835eb6472be764e74c5 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 3 Nov 2022 07:54:34 +1100 Subject: [PATCH 10/31] Fixes for importsa --- app/Http/Controllers/ImportController.php | 2 +- app/Http/Requests/User/UpdateUserRequest.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/ImportController.php b/app/Http/Controllers/ImportController.php index f7ec7670d2..25cc858e75 100644 --- a/app/Http/Controllers/ImportController.php +++ b/app/Http/Controllers/ImportController.php @@ -126,7 +126,7 @@ class ImportController extends Controller private function getEntityMap($entity_type) { - return sprintf('App\\Import\\Definitions\%sMap', ucfirst($entity_type)); + return sprintf('App\\Import\\Definitions\%sMap', ucfirst(Str::camel($entity_type))); } private function getCsvData($csvfile) diff --git a/app/Http/Requests/User/UpdateUserRequest.php b/app/Http/Requests/User/UpdateUserRequest.php index 2e98774d1d..b08824ac6a 100644 --- a/app/Http/Requests/User/UpdateUserRequest.php +++ b/app/Http/Requests/User/UpdateUserRequest.php @@ -14,6 +14,7 @@ namespace App\Http\Requests\User; use App\Http\Requests\Request; use App\Http\ValidationRules\UniqueUserRule; use App\Http\ValidationRules\User\HasValidPhoneNumber; +use App\Utils\Ninja; class UpdateUserRequest extends Request { @@ -64,7 +65,7 @@ class UpdateUserRequest extends Request $input['last_name'] = strip_tags($input['last_name']); } - if(strlen($input['phone']) > 1 && ($this->user->phone != $input['phone'])) + if(array_key_exists('phone', $input) && strlen($input['phone']) > 1 && ($this->user->phone != $input['phone'])) $this->phone_has_changed = true; $this->replace($input); From 297dc19d048e5b7bb1d586cc4a0875904b3418cc Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 3 Nov 2022 08:04:07 +1100 Subject: [PATCH 11/31] Fixes for tests --- app/Jobs/User/VerifyPhone.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/Jobs/User/VerifyPhone.php b/app/Jobs/User/VerifyPhone.php index 6bd17c7541..ca639b2d8c 100644 --- a/app/Jobs/User/VerifyPhone.php +++ b/app/Jobs/User/VerifyPhone.php @@ -47,8 +47,6 @@ class VerifyPhone implements ShouldQueue MultiDB::checkUserEmailExists($this->user->email); - $this->user = User::find($this->user); - $sid = config('ninja.twilio_account_sid'); $token = config('ninja.twilio_auth_token'); From 65a5f0d34857efb9ce6fc558d32d0d3e0d7138d9 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 3 Nov 2022 09:06:14 +1100 Subject: [PATCH 12/31] minor fixes --- .../ValidationRules/User/HasValidPhoneNumber.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/Http/ValidationRules/User/HasValidPhoneNumber.php b/app/Http/ValidationRules/User/HasValidPhoneNumber.php index 86e7b20a7a..3ec45657ae 100644 --- a/app/Http/ValidationRules/User/HasValidPhoneNumber.php +++ b/app/Http/ValidationRules/User/HasValidPhoneNumber.php @@ -26,6 +26,13 @@ class HasValidPhoneNumber implements Rule { } + public function message() + { + return [ + 'phone' => ctrans('texts.phone_validation_error'), + ]; + } + /** * @param string $attribute * @param mixed $value @@ -68,10 +75,4 @@ class HasValidPhoneNumber implements Rule } - public function messages() - { - return [ - 'phone' => ctrans('texts.phone_validation_error'), - ]; - } } From 9e91d7579d55d4b39541c55bad9a13482f554b8e Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 3 Nov 2022 10:13:36 +1100 Subject: [PATCH 13/31] Datamapper classes --- app/DataMapper/Analytics/AccountSignup.php | 80 ++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 app/DataMapper/Analytics/AccountSignup.php diff --git a/app/DataMapper/Analytics/AccountSignup.php b/app/DataMapper/Analytics/AccountSignup.php new file mode 100644 index 0000000000..04eda7bc3a --- /dev/null +++ b/app/DataMapper/Analytics/AccountSignup.php @@ -0,0 +1,80 @@ +string_metric5 = $string_metric5 ?: 'free'; + $this->string_metric6 = $string_metric6 ?: 'year'; + $this->string_metric7 = $string_metric7; + } +} From ce5dfa27176ca03ec77bc06491d275c4dff5c64a Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 3 Nov 2022 13:33:26 +1100 Subject: [PATCH 14/31] Return early in some hosted jobs --- app/Jobs/Util/SchedulerCheck.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/Jobs/Util/SchedulerCheck.php b/app/Jobs/Util/SchedulerCheck.php index fa918b9002..d7df900598 100644 --- a/app/Jobs/Util/SchedulerCheck.php +++ b/app/Jobs/Util/SchedulerCheck.php @@ -12,6 +12,7 @@ namespace App\Jobs\Util; use App\Models\Account; +use App\Utils\Ninja; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; @@ -38,6 +39,10 @@ class SchedulerCheck implements ShouldQueue { set_time_limit(0); + + if(Ninja::isHosted()) + return; + if (config('ninja.app_version') != base_path('VERSION.txt')) { try { Artisan::call('migrate', ['--force' => true]); From c0870afded2f18cac6bdb11d9bff781a095c2b95 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 3 Nov 2022 16:45:56 +1100 Subject: [PATCH 15/31] Fixes for verifyphone --- .../ValidationRules/User/HasValidPhoneNumber.php | 4 ++-- artisan | 0 bootstrap/app.php | 0 bootstrap/cache/.gitignore | 0 dusk.sh | 0 public/.htaccess | 0 public/assets/AssetManifest.json | 0 public/assets/FontManifest.json | 0 public/assets/LICENSE | 0 public/assets/NOTICES | 0 public/assets/assets/images/google-icon.png | Bin public/assets/assets/images/logo.png | Bin public/assets/assets/images/payment_types/ach.png | Bin public/assets/assets/images/payment_types/amex.png | Bin .../assets/images/payment_types/carteblanche.png | Bin .../assets/images/payment_types/dinerscard.png | Bin .../assets/assets/images/payment_types/discover.png | Bin public/assets/assets/images/payment_types/jcb.png | Bin public/assets/assets/images/payment_types/laser.png | Bin .../assets/assets/images/payment_types/maestro.png | Bin .../assets/images/payment_types/mastercard.png | Bin public/assets/assets/images/payment_types/other.png | Bin .../assets/assets/images/payment_types/paypal.png | Bin public/assets/assets/images/payment_types/solo.png | Bin .../assets/assets/images/payment_types/switch.png | Bin .../assets/assets/images/payment_types/unionpay.png | Bin public/assets/assets/images/payment_types/visa.png | Bin public/assets/fonts/MaterialIcons-Regular.otf | Bin public/assets/fonts/MaterialIcons-Regular.ttf | Bin public/assets/fonts/Roboto-Regular.ttf | Bin .../flutter_auth_buttons/fonts/Roboto-Medium.ttf | Bin .../flutter_auth_buttons/fonts/SF-Pro-Medium.ttf | Bin .../graphics/Twitter_Logo_Blue.png | Bin .../graphics/apple_logo_black.png | Bin .../graphics/apple_logo_white.png | Bin .../graphics/flogo-HexRBG-Wht-100.png | Bin .../flutter_auth_buttons/graphics/google-logo.png | Bin .../graphics/ms-symbollockup_mssymbol_19.png | Bin .../lib/fonts/fa-brands-400.ttf | Bin .../lib/fonts/fa-regular-400.ttf | Bin .../font_awesome_flutter/lib/fonts/fa-solid-900.ttf | Bin public/assets/web/assets/fonts/Roboto-Regular.ttf | Bin public/css/app.css | 0 public/css/ninja.css | 0 public/css/ninja.min.css | 0 public/favicon.ico | Bin public/favicon.png | Bin public/flutter_service_worker.js | 0 public/icons/Icon-192.png | Bin public/icons/Icon-512.png | Bin public/images/american-express.png | Bin public/images/created-by-invoiceninja-new.png | Bin public/images/created-by-invoiceninja.jpg | Bin public/images/diners-club.png | Bin public/images/discover.png | Bin public/images/invoiceninja-black-logo-2.png | Bin public/images/invoiceninja-white-logo.png | Bin public/images/logo.png | Bin public/images/mastercard.png | Bin public/images/paypal.png | Bin public/images/svg/activity.svg | 0 public/images/svg/align-left.svg | 0 public/images/svg/clock.svg | 0 public/images/svg/credit-card.svg | 0 public/images/svg/dark/activity.svg | 0 public/images/svg/dark/align-left.svg | 0 public/images/svg/dark/clock.svg | 0 public/images/svg/dark/credit-card.svg | 0 public/images/svg/dark/download.svg | 0 public/images/svg/dark/file-text.svg | 0 public/images/svg/dark/file.svg | 0 public/images/svg/dark/shield.svg | 0 public/images/svg/dark/user.svg | 0 public/images/svg/download.svg | 0 public/images/svg/file-text.svg | 0 public/images/svg/file.svg | 0 public/images/svg/shield.svg | 0 public/images/svg/user.svg | 0 public/images/visa.png | Bin public/index.php | 0 public/js/app.js | 0 public/js/client_create.js | 0 public/js/client_create.min.js | 0 public/js/client_edit.js | 0 public/js/client_edit.min.js | 0 public/js/client_list.js | 0 public/js/client_list.min.js | 0 public/js/client_settings.js | 0 public/js/client_settings.min.js | 0 public/js/client_show.js | 0 public/js/client_show.min.js | 0 public/js/clients/invoices/action-selectors.js | 0 .../invoices/action-selectors.js.LICENSE.txt | 0 public/js/clients/invoices/payment.js | 0 public/js/clients/invoices/payment.js.LICENSE.txt | 0 public/js/clients/payment_methods/authorize-ach.js | 0 .../payment_methods/authorize-ach.js.LICENSE.txt | 0 .../payment_methods/authorize-authorize-card.js | 0 .../authorize-authorize-card.js.LICENSE.txt | 0 .../payment_methods/authorize-stripe-card.js | 0 .../authorize-stripe-card.js.LICENSE.txt | 0 public/js/clients/payment_methods/stripe-ach.js | 0 public/js/clients/payments/alipay.js | 0 public/js/clients/payments/alipay.js.LICENSE.txt | 0 .../payments/authorize-credit-card-payment.js | 0 .../authorize-credit-card-payment.js.LICENSE.txt | 0 public/js/clients/payments/card-js.min.js | 0 public/js/clients/payments/checkout.com.js | 0 public/js/clients/payments/process.js | 0 public/js/clients/payments/process.js.LICENSE.txt | 0 public/js/clients/payments/sofort.js | 0 public/js/clients/payments/sofort.js.LICENSE.txt | 0 public/js/clients/payments/stripe-ach.js | 0 .../js/clients/payments/stripe-ach.js.LICENSE.txt | 0 public/js/clients/payments/stripe-alipay.js | 0 .../clients/payments/stripe-alipay.js.LICENSE.txt | 0 public/js/clients/payments/stripe-credit-card.js | 0 .../payments/stripe-credit-card.js.LICENSE.txt | 0 public/js/clients/payments/stripe-sofort.js | 0 .../clients/payments/stripe-sofort.js.LICENSE.txt | 0 public/js/clients/quotes/action-selectors.js | 0 .../clients/quotes/action-selectors.js.LICENSE.txt | 0 public/js/clients/quotes/approve.js | 0 public/js/clients/quotes/approve.js.LICENSE.txt | 0 public/js/clients/shared/multiple-downloads.js | 0 public/js/clients/shared/pdf.js | 0 public/js/clients/shared/pdf.js.LICENSE.txt | 0 public/js/coreui.js | 0 public/js/coreui.min.js | 0 public/js/localization.js | 0 public/js/localization.min.js | 0 public/js/ninja.js | 0 public/js/ninja.min.js | 0 public/js/setup/setup.js | 0 public/js/setup/setup.js.LICENSE.txt | 0 public/js/vendor/app.js | 0 public/js/vendor/datatables/datatables.min.css | 0 public/js/vendor/datatables/datatables.min.js | 0 public/js/vendor/jquery-3.3.1/jquery-3.3.1.js | 0 public/js/vendor/jquery-3.3.1/jquery-3.3.1.min.js | 0 public/js/vendor/pdf.js/pdf.min.js | 0 public/js/vendor/pdf.js/pdf.worker.min.js | 0 public/main.dart.js | 0 public/main.dart.js.map | 0 public/manifest.json | 0 public/mix-manifest.json | 0 public/robots.txt | 0 public/svg/403.svg | 0 public/svg/404.svg | 0 public/svg/500.svg | 0 public/svg/503.svg | 0 public/vendor/dropzone-5.7.0/.gitignore | 0 public/vendor/dropzone-5.7.0/CONTRIBUTING.md | 0 public/vendor/dropzone-5.7.0/LICENSE | 0 public/vendor/dropzone-5.7.0/README.md | 0 public/vendor/dropzone-5.7.0/component.json | 0 public/vendor/dropzone-5.7.0/composer.json | 0 public/vendor/dropzone-5.7.0/dist/basic.css | 0 .../dropzone-5.7.0/dist/dropzone-amd-module.js | 0 public/vendor/dropzone-5.7.0/dist/dropzone.css | 0 public/vendor/dropzone-5.7.0/dist/dropzone.js | 0 public/vendor/dropzone-5.7.0/dist/dropzone.js.map | 0 public/vendor/dropzone-5.7.0/dist/min/basic.min.css | 0 .../dist/min/dropzone-amd-module.min.js | 0 .../vendor/dropzone-5.7.0/dist/min/dropzone.min.css | 0 .../vendor/dropzone-5.7.0/dist/min/dropzone.min.js | 0 public/vendor/dropzone-5.7.0/index.js | 0 public/vendor/dropzone-5.7.0/package.json | 0 public/vendor/livewire/livewire.js | 0 public/vendor/livewire/livewire.js.map | 0 public/vendor/livewire/manifest.json | 0 public/version.json | 0 storage/app/.gitignore | 0 storage/app/public/.gitignore | 0 storage/framework/.gitignore | 0 storage/framework/cache/.gitignore | 0 storage/framework/sessions/.gitignore | 0 storage/framework/testing/.gitignore | 0 storage/framework/views/.gitignore | 0 storage/logs/.gitignore | 0 tests/Feature/Import/ImportCompanyTest.php | 5 +++-- tests/Feature/PdfCreatorTest.php | 6 +++--- 182 files changed, 8 insertions(+), 7 deletions(-) mode change 100755 => 100644 artisan mode change 100755 => 100644 bootstrap/app.php mode change 100755 => 100644 bootstrap/cache/.gitignore mode change 100755 => 100644 dusk.sh mode change 100755 => 100644 public/.htaccess mode change 100755 => 100644 public/assets/AssetManifest.json mode change 100755 => 100644 public/assets/FontManifest.json mode change 100755 => 100644 public/assets/LICENSE mode change 100755 => 100644 public/assets/NOTICES mode change 100755 => 100644 public/assets/assets/images/google-icon.png mode change 100755 => 100644 public/assets/assets/images/logo.png mode change 100755 => 100644 public/assets/assets/images/payment_types/ach.png mode change 100755 => 100644 public/assets/assets/images/payment_types/amex.png mode change 100755 => 100644 public/assets/assets/images/payment_types/carteblanche.png mode change 100755 => 100644 public/assets/assets/images/payment_types/dinerscard.png mode change 100755 => 100644 public/assets/assets/images/payment_types/discover.png mode change 100755 => 100644 public/assets/assets/images/payment_types/jcb.png mode change 100755 => 100644 public/assets/assets/images/payment_types/laser.png mode change 100755 => 100644 public/assets/assets/images/payment_types/maestro.png mode change 100755 => 100644 public/assets/assets/images/payment_types/mastercard.png mode change 100755 => 100644 public/assets/assets/images/payment_types/other.png mode change 100755 => 100644 public/assets/assets/images/payment_types/paypal.png mode change 100755 => 100644 public/assets/assets/images/payment_types/solo.png mode change 100755 => 100644 public/assets/assets/images/payment_types/switch.png mode change 100755 => 100644 public/assets/assets/images/payment_types/unionpay.png mode change 100755 => 100644 public/assets/assets/images/payment_types/visa.png mode change 100755 => 100644 public/assets/fonts/MaterialIcons-Regular.otf mode change 100755 => 100644 public/assets/fonts/MaterialIcons-Regular.ttf mode change 100755 => 100644 public/assets/fonts/Roboto-Regular.ttf mode change 100755 => 100644 public/assets/packages/flutter_auth_buttons/fonts/Roboto-Medium.ttf mode change 100755 => 100644 public/assets/packages/flutter_auth_buttons/fonts/SF-Pro-Medium.ttf mode change 100755 => 100644 public/assets/packages/flutter_auth_buttons/graphics/Twitter_Logo_Blue.png mode change 100755 => 100644 public/assets/packages/flutter_auth_buttons/graphics/apple_logo_black.png mode change 100755 => 100644 public/assets/packages/flutter_auth_buttons/graphics/apple_logo_white.png mode change 100755 => 100644 public/assets/packages/flutter_auth_buttons/graphics/flogo-HexRBG-Wht-100.png mode change 100755 => 100644 public/assets/packages/flutter_auth_buttons/graphics/google-logo.png mode change 100755 => 100644 public/assets/packages/flutter_auth_buttons/graphics/ms-symbollockup_mssymbol_19.png mode change 100755 => 100644 public/assets/packages/font_awesome_flutter/lib/fonts/fa-brands-400.ttf mode change 100755 => 100644 public/assets/packages/font_awesome_flutter/lib/fonts/fa-regular-400.ttf mode change 100755 => 100644 public/assets/packages/font_awesome_flutter/lib/fonts/fa-solid-900.ttf mode change 100755 => 100644 public/assets/web/assets/fonts/Roboto-Regular.ttf mode change 100755 => 100644 public/css/app.css mode change 100755 => 100644 public/css/ninja.css mode change 100755 => 100644 public/css/ninja.min.css mode change 100755 => 100644 public/favicon.ico mode change 100755 => 100644 public/favicon.png mode change 100755 => 100644 public/flutter_service_worker.js mode change 100755 => 100644 public/icons/Icon-192.png mode change 100755 => 100644 public/icons/Icon-512.png mode change 100755 => 100644 public/images/american-express.png mode change 100755 => 100644 public/images/created-by-invoiceninja-new.png mode change 100755 => 100644 public/images/created-by-invoiceninja.jpg mode change 100755 => 100644 public/images/diners-club.png mode change 100755 => 100644 public/images/discover.png mode change 100755 => 100644 public/images/invoiceninja-black-logo-2.png mode change 100755 => 100644 public/images/invoiceninja-white-logo.png mode change 100755 => 100644 public/images/logo.png mode change 100755 => 100644 public/images/mastercard.png mode change 100755 => 100644 public/images/paypal.png mode change 100755 => 100644 public/images/svg/activity.svg mode change 100755 => 100644 public/images/svg/align-left.svg mode change 100755 => 100644 public/images/svg/clock.svg mode change 100755 => 100644 public/images/svg/credit-card.svg mode change 100755 => 100644 public/images/svg/dark/activity.svg mode change 100755 => 100644 public/images/svg/dark/align-left.svg mode change 100755 => 100644 public/images/svg/dark/clock.svg mode change 100755 => 100644 public/images/svg/dark/credit-card.svg mode change 100755 => 100644 public/images/svg/dark/download.svg mode change 100755 => 100644 public/images/svg/dark/file-text.svg mode change 100755 => 100644 public/images/svg/dark/file.svg mode change 100755 => 100644 public/images/svg/dark/shield.svg mode change 100755 => 100644 public/images/svg/dark/user.svg mode change 100755 => 100644 public/images/svg/download.svg mode change 100755 => 100644 public/images/svg/file-text.svg mode change 100755 => 100644 public/images/svg/file.svg mode change 100755 => 100644 public/images/svg/shield.svg mode change 100755 => 100644 public/images/svg/user.svg mode change 100755 => 100644 public/images/visa.png mode change 100755 => 100644 public/index.php mode change 100755 => 100644 public/js/app.js mode change 100755 => 100644 public/js/client_create.js mode change 100755 => 100644 public/js/client_create.min.js mode change 100755 => 100644 public/js/client_edit.js mode change 100755 => 100644 public/js/client_edit.min.js mode change 100755 => 100644 public/js/client_list.js mode change 100755 => 100644 public/js/client_list.min.js mode change 100755 => 100644 public/js/client_settings.js mode change 100755 => 100644 public/js/client_settings.min.js mode change 100755 => 100644 public/js/client_show.js mode change 100755 => 100644 public/js/client_show.min.js mode change 100755 => 100644 public/js/clients/invoices/action-selectors.js mode change 100755 => 100644 public/js/clients/invoices/action-selectors.js.LICENSE.txt mode change 100755 => 100644 public/js/clients/invoices/payment.js mode change 100755 => 100644 public/js/clients/invoices/payment.js.LICENSE.txt mode change 100755 => 100644 public/js/clients/payment_methods/authorize-ach.js mode change 100755 => 100644 public/js/clients/payment_methods/authorize-ach.js.LICENSE.txt mode change 100755 => 100644 public/js/clients/payment_methods/authorize-authorize-card.js mode change 100755 => 100644 public/js/clients/payment_methods/authorize-authorize-card.js.LICENSE.txt mode change 100755 => 100644 public/js/clients/payment_methods/authorize-stripe-card.js mode change 100755 => 100644 public/js/clients/payment_methods/authorize-stripe-card.js.LICENSE.txt mode change 100755 => 100644 public/js/clients/payment_methods/stripe-ach.js mode change 100755 => 100644 public/js/clients/payments/alipay.js mode change 100755 => 100644 public/js/clients/payments/alipay.js.LICENSE.txt mode change 100755 => 100644 public/js/clients/payments/authorize-credit-card-payment.js mode change 100755 => 100644 public/js/clients/payments/authorize-credit-card-payment.js.LICENSE.txt mode change 100755 => 100644 public/js/clients/payments/card-js.min.js mode change 100755 => 100644 public/js/clients/payments/checkout.com.js mode change 100755 => 100644 public/js/clients/payments/process.js mode change 100755 => 100644 public/js/clients/payments/process.js.LICENSE.txt mode change 100755 => 100644 public/js/clients/payments/sofort.js mode change 100755 => 100644 public/js/clients/payments/sofort.js.LICENSE.txt mode change 100755 => 100644 public/js/clients/payments/stripe-ach.js mode change 100755 => 100644 public/js/clients/payments/stripe-ach.js.LICENSE.txt mode change 100755 => 100644 public/js/clients/payments/stripe-alipay.js mode change 100755 => 100644 public/js/clients/payments/stripe-alipay.js.LICENSE.txt mode change 100755 => 100644 public/js/clients/payments/stripe-credit-card.js mode change 100755 => 100644 public/js/clients/payments/stripe-credit-card.js.LICENSE.txt mode change 100755 => 100644 public/js/clients/payments/stripe-sofort.js mode change 100755 => 100644 public/js/clients/payments/stripe-sofort.js.LICENSE.txt mode change 100755 => 100644 public/js/clients/quotes/action-selectors.js mode change 100755 => 100644 public/js/clients/quotes/action-selectors.js.LICENSE.txt mode change 100755 => 100644 public/js/clients/quotes/approve.js mode change 100755 => 100644 public/js/clients/quotes/approve.js.LICENSE.txt mode change 100755 => 100644 public/js/clients/shared/multiple-downloads.js mode change 100755 => 100644 public/js/clients/shared/pdf.js mode change 100755 => 100644 public/js/clients/shared/pdf.js.LICENSE.txt mode change 100755 => 100644 public/js/coreui.js mode change 100755 => 100644 public/js/coreui.min.js mode change 100755 => 100644 public/js/localization.js mode change 100755 => 100644 public/js/localization.min.js mode change 100755 => 100644 public/js/ninja.js mode change 100755 => 100644 public/js/ninja.min.js mode change 100755 => 100644 public/js/setup/setup.js mode change 100755 => 100644 public/js/setup/setup.js.LICENSE.txt mode change 100755 => 100644 public/js/vendor/app.js mode change 100755 => 100644 public/js/vendor/datatables/datatables.min.css mode change 100755 => 100644 public/js/vendor/datatables/datatables.min.js mode change 100755 => 100644 public/js/vendor/jquery-3.3.1/jquery-3.3.1.js mode change 100755 => 100644 public/js/vendor/jquery-3.3.1/jquery-3.3.1.min.js mode change 100755 => 100644 public/js/vendor/pdf.js/pdf.min.js mode change 100755 => 100644 public/js/vendor/pdf.js/pdf.worker.min.js mode change 100755 => 100644 public/main.dart.js mode change 100755 => 100644 public/main.dart.js.map mode change 100755 => 100644 public/manifest.json mode change 100755 => 100644 public/mix-manifest.json mode change 100755 => 100644 public/robots.txt mode change 100755 => 100644 public/svg/403.svg mode change 100755 => 100644 public/svg/404.svg mode change 100755 => 100644 public/svg/500.svg mode change 100755 => 100644 public/svg/503.svg mode change 100755 => 100644 public/vendor/dropzone-5.7.0/.gitignore mode change 100755 => 100644 public/vendor/dropzone-5.7.0/CONTRIBUTING.md mode change 100755 => 100644 public/vendor/dropzone-5.7.0/LICENSE mode change 100755 => 100644 public/vendor/dropzone-5.7.0/README.md mode change 100755 => 100644 public/vendor/dropzone-5.7.0/component.json mode change 100755 => 100644 public/vendor/dropzone-5.7.0/composer.json mode change 100755 => 100644 public/vendor/dropzone-5.7.0/dist/basic.css mode change 100755 => 100644 public/vendor/dropzone-5.7.0/dist/dropzone-amd-module.js mode change 100755 => 100644 public/vendor/dropzone-5.7.0/dist/dropzone.css mode change 100755 => 100644 public/vendor/dropzone-5.7.0/dist/dropzone.js mode change 100755 => 100644 public/vendor/dropzone-5.7.0/dist/dropzone.js.map mode change 100755 => 100644 public/vendor/dropzone-5.7.0/dist/min/basic.min.css mode change 100755 => 100644 public/vendor/dropzone-5.7.0/dist/min/dropzone-amd-module.min.js mode change 100755 => 100644 public/vendor/dropzone-5.7.0/dist/min/dropzone.min.css mode change 100755 => 100644 public/vendor/dropzone-5.7.0/dist/min/dropzone.min.js mode change 100755 => 100644 public/vendor/dropzone-5.7.0/index.js mode change 100755 => 100644 public/vendor/dropzone-5.7.0/package.json mode change 100755 => 100644 public/vendor/livewire/livewire.js mode change 100755 => 100644 public/vendor/livewire/livewire.js.map mode change 100755 => 100644 public/vendor/livewire/manifest.json mode change 100755 => 100644 public/version.json mode change 100755 => 100644 storage/app/.gitignore mode change 100755 => 100644 storage/app/public/.gitignore mode change 100755 => 100644 storage/framework/.gitignore mode change 100755 => 100644 storage/framework/cache/.gitignore mode change 100755 => 100644 storage/framework/sessions/.gitignore mode change 100755 => 100644 storage/framework/testing/.gitignore mode change 100755 => 100644 storage/framework/views/.gitignore mode change 100755 => 100644 storage/logs/.gitignore diff --git a/app/Http/ValidationRules/User/HasValidPhoneNumber.php b/app/Http/ValidationRules/User/HasValidPhoneNumber.php index 3ec45657ae..ce599f8c76 100644 --- a/app/Http/ValidationRules/User/HasValidPhoneNumber.php +++ b/app/Http/ValidationRules/User/HasValidPhoneNumber.php @@ -47,11 +47,11 @@ class HasValidPhoneNumber implements Rule if(!$sid) return true; - $twilio = new Twilio\Rest\Client($sid, $token); + $twilio = new \Twilio\Rest\Client($sid, $token); $country = auth()->user()->account?->companies()?->first()?->country(); - if(!$country || strlen($user->phone) < 2) + if(!$country || strlen(auth()->user()->phone) < 2) return true; $countryCode = $country->iso_3166_2; diff --git a/artisan b/artisan old mode 100755 new mode 100644 diff --git a/bootstrap/app.php b/bootstrap/app.php old mode 100755 new mode 100644 diff --git a/bootstrap/cache/.gitignore b/bootstrap/cache/.gitignore old mode 100755 new mode 100644 diff --git a/dusk.sh b/dusk.sh old mode 100755 new mode 100644 diff --git a/public/.htaccess b/public/.htaccess old mode 100755 new mode 100644 diff --git a/public/assets/AssetManifest.json b/public/assets/AssetManifest.json old mode 100755 new mode 100644 diff --git a/public/assets/FontManifest.json b/public/assets/FontManifest.json old mode 100755 new mode 100644 diff --git a/public/assets/LICENSE b/public/assets/LICENSE old mode 100755 new mode 100644 diff --git a/public/assets/NOTICES b/public/assets/NOTICES old mode 100755 new mode 100644 diff --git a/public/assets/assets/images/google-icon.png b/public/assets/assets/images/google-icon.png old mode 100755 new mode 100644 diff --git a/public/assets/assets/images/logo.png b/public/assets/assets/images/logo.png old mode 100755 new mode 100644 diff --git a/public/assets/assets/images/payment_types/ach.png b/public/assets/assets/images/payment_types/ach.png old mode 100755 new mode 100644 diff --git a/public/assets/assets/images/payment_types/amex.png b/public/assets/assets/images/payment_types/amex.png old mode 100755 new mode 100644 diff --git a/public/assets/assets/images/payment_types/carteblanche.png b/public/assets/assets/images/payment_types/carteblanche.png old mode 100755 new mode 100644 diff --git a/public/assets/assets/images/payment_types/dinerscard.png b/public/assets/assets/images/payment_types/dinerscard.png old mode 100755 new mode 100644 diff --git a/public/assets/assets/images/payment_types/discover.png b/public/assets/assets/images/payment_types/discover.png old mode 100755 new mode 100644 diff --git a/public/assets/assets/images/payment_types/jcb.png b/public/assets/assets/images/payment_types/jcb.png old mode 100755 new mode 100644 diff --git a/public/assets/assets/images/payment_types/laser.png b/public/assets/assets/images/payment_types/laser.png old mode 100755 new mode 100644 diff --git a/public/assets/assets/images/payment_types/maestro.png b/public/assets/assets/images/payment_types/maestro.png old mode 100755 new mode 100644 diff --git a/public/assets/assets/images/payment_types/mastercard.png b/public/assets/assets/images/payment_types/mastercard.png old mode 100755 new mode 100644 diff --git a/public/assets/assets/images/payment_types/other.png b/public/assets/assets/images/payment_types/other.png old mode 100755 new mode 100644 diff --git a/public/assets/assets/images/payment_types/paypal.png b/public/assets/assets/images/payment_types/paypal.png old mode 100755 new mode 100644 diff --git a/public/assets/assets/images/payment_types/solo.png b/public/assets/assets/images/payment_types/solo.png old mode 100755 new mode 100644 diff --git a/public/assets/assets/images/payment_types/switch.png b/public/assets/assets/images/payment_types/switch.png old mode 100755 new mode 100644 diff --git a/public/assets/assets/images/payment_types/unionpay.png b/public/assets/assets/images/payment_types/unionpay.png old mode 100755 new mode 100644 diff --git a/public/assets/assets/images/payment_types/visa.png b/public/assets/assets/images/payment_types/visa.png old mode 100755 new mode 100644 diff --git a/public/assets/fonts/MaterialIcons-Regular.otf b/public/assets/fonts/MaterialIcons-Regular.otf old mode 100755 new mode 100644 diff --git a/public/assets/fonts/MaterialIcons-Regular.ttf b/public/assets/fonts/MaterialIcons-Regular.ttf old mode 100755 new mode 100644 diff --git a/public/assets/fonts/Roboto-Regular.ttf b/public/assets/fonts/Roboto-Regular.ttf old mode 100755 new mode 100644 diff --git a/public/assets/packages/flutter_auth_buttons/fonts/Roboto-Medium.ttf b/public/assets/packages/flutter_auth_buttons/fonts/Roboto-Medium.ttf old mode 100755 new mode 100644 diff --git a/public/assets/packages/flutter_auth_buttons/fonts/SF-Pro-Medium.ttf b/public/assets/packages/flutter_auth_buttons/fonts/SF-Pro-Medium.ttf old mode 100755 new mode 100644 diff --git a/public/assets/packages/flutter_auth_buttons/graphics/Twitter_Logo_Blue.png b/public/assets/packages/flutter_auth_buttons/graphics/Twitter_Logo_Blue.png old mode 100755 new mode 100644 diff --git a/public/assets/packages/flutter_auth_buttons/graphics/apple_logo_black.png b/public/assets/packages/flutter_auth_buttons/graphics/apple_logo_black.png old mode 100755 new mode 100644 diff --git a/public/assets/packages/flutter_auth_buttons/graphics/apple_logo_white.png b/public/assets/packages/flutter_auth_buttons/graphics/apple_logo_white.png old mode 100755 new mode 100644 diff --git a/public/assets/packages/flutter_auth_buttons/graphics/flogo-HexRBG-Wht-100.png b/public/assets/packages/flutter_auth_buttons/graphics/flogo-HexRBG-Wht-100.png old mode 100755 new mode 100644 diff --git a/public/assets/packages/flutter_auth_buttons/graphics/google-logo.png b/public/assets/packages/flutter_auth_buttons/graphics/google-logo.png old mode 100755 new mode 100644 diff --git a/public/assets/packages/flutter_auth_buttons/graphics/ms-symbollockup_mssymbol_19.png b/public/assets/packages/flutter_auth_buttons/graphics/ms-symbollockup_mssymbol_19.png old mode 100755 new mode 100644 diff --git a/public/assets/packages/font_awesome_flutter/lib/fonts/fa-brands-400.ttf b/public/assets/packages/font_awesome_flutter/lib/fonts/fa-brands-400.ttf old mode 100755 new mode 100644 diff --git a/public/assets/packages/font_awesome_flutter/lib/fonts/fa-regular-400.ttf b/public/assets/packages/font_awesome_flutter/lib/fonts/fa-regular-400.ttf old mode 100755 new mode 100644 diff --git a/public/assets/packages/font_awesome_flutter/lib/fonts/fa-solid-900.ttf b/public/assets/packages/font_awesome_flutter/lib/fonts/fa-solid-900.ttf old mode 100755 new mode 100644 diff --git a/public/assets/web/assets/fonts/Roboto-Regular.ttf b/public/assets/web/assets/fonts/Roboto-Regular.ttf old mode 100755 new mode 100644 diff --git a/public/css/app.css b/public/css/app.css old mode 100755 new mode 100644 diff --git a/public/css/ninja.css b/public/css/ninja.css old mode 100755 new mode 100644 diff --git a/public/css/ninja.min.css b/public/css/ninja.min.css old mode 100755 new mode 100644 diff --git a/public/favicon.ico b/public/favicon.ico old mode 100755 new mode 100644 diff --git a/public/favicon.png b/public/favicon.png old mode 100755 new mode 100644 diff --git a/public/flutter_service_worker.js b/public/flutter_service_worker.js old mode 100755 new mode 100644 diff --git a/public/icons/Icon-192.png b/public/icons/Icon-192.png old mode 100755 new mode 100644 diff --git a/public/icons/Icon-512.png b/public/icons/Icon-512.png old mode 100755 new mode 100644 diff --git a/public/images/american-express.png b/public/images/american-express.png old mode 100755 new mode 100644 diff --git a/public/images/created-by-invoiceninja-new.png b/public/images/created-by-invoiceninja-new.png old mode 100755 new mode 100644 diff --git a/public/images/created-by-invoiceninja.jpg b/public/images/created-by-invoiceninja.jpg old mode 100755 new mode 100644 diff --git a/public/images/diners-club.png b/public/images/diners-club.png old mode 100755 new mode 100644 diff --git a/public/images/discover.png b/public/images/discover.png old mode 100755 new mode 100644 diff --git a/public/images/invoiceninja-black-logo-2.png b/public/images/invoiceninja-black-logo-2.png old mode 100755 new mode 100644 diff --git a/public/images/invoiceninja-white-logo.png b/public/images/invoiceninja-white-logo.png old mode 100755 new mode 100644 diff --git a/public/images/logo.png b/public/images/logo.png old mode 100755 new mode 100644 diff --git a/public/images/mastercard.png b/public/images/mastercard.png old mode 100755 new mode 100644 diff --git a/public/images/paypal.png b/public/images/paypal.png old mode 100755 new mode 100644 diff --git a/public/images/svg/activity.svg b/public/images/svg/activity.svg old mode 100755 new mode 100644 diff --git a/public/images/svg/align-left.svg b/public/images/svg/align-left.svg old mode 100755 new mode 100644 diff --git a/public/images/svg/clock.svg b/public/images/svg/clock.svg old mode 100755 new mode 100644 diff --git a/public/images/svg/credit-card.svg b/public/images/svg/credit-card.svg old mode 100755 new mode 100644 diff --git a/public/images/svg/dark/activity.svg b/public/images/svg/dark/activity.svg old mode 100755 new mode 100644 diff --git a/public/images/svg/dark/align-left.svg b/public/images/svg/dark/align-left.svg old mode 100755 new mode 100644 diff --git a/public/images/svg/dark/clock.svg b/public/images/svg/dark/clock.svg old mode 100755 new mode 100644 diff --git a/public/images/svg/dark/credit-card.svg b/public/images/svg/dark/credit-card.svg old mode 100755 new mode 100644 diff --git a/public/images/svg/dark/download.svg b/public/images/svg/dark/download.svg old mode 100755 new mode 100644 diff --git a/public/images/svg/dark/file-text.svg b/public/images/svg/dark/file-text.svg old mode 100755 new mode 100644 diff --git a/public/images/svg/dark/file.svg b/public/images/svg/dark/file.svg old mode 100755 new mode 100644 diff --git a/public/images/svg/dark/shield.svg b/public/images/svg/dark/shield.svg old mode 100755 new mode 100644 diff --git a/public/images/svg/dark/user.svg b/public/images/svg/dark/user.svg old mode 100755 new mode 100644 diff --git a/public/images/svg/download.svg b/public/images/svg/download.svg old mode 100755 new mode 100644 diff --git a/public/images/svg/file-text.svg b/public/images/svg/file-text.svg old mode 100755 new mode 100644 diff --git a/public/images/svg/file.svg b/public/images/svg/file.svg old mode 100755 new mode 100644 diff --git a/public/images/svg/shield.svg b/public/images/svg/shield.svg old mode 100755 new mode 100644 diff --git a/public/images/svg/user.svg b/public/images/svg/user.svg old mode 100755 new mode 100644 diff --git a/public/images/visa.png b/public/images/visa.png old mode 100755 new mode 100644 diff --git a/public/index.php b/public/index.php old mode 100755 new mode 100644 diff --git a/public/js/app.js b/public/js/app.js old mode 100755 new mode 100644 diff --git a/public/js/client_create.js b/public/js/client_create.js old mode 100755 new mode 100644 diff --git a/public/js/client_create.min.js b/public/js/client_create.min.js old mode 100755 new mode 100644 diff --git a/public/js/client_edit.js b/public/js/client_edit.js old mode 100755 new mode 100644 diff --git a/public/js/client_edit.min.js b/public/js/client_edit.min.js old mode 100755 new mode 100644 diff --git a/public/js/client_list.js b/public/js/client_list.js old mode 100755 new mode 100644 diff --git a/public/js/client_list.min.js b/public/js/client_list.min.js old mode 100755 new mode 100644 diff --git a/public/js/client_settings.js b/public/js/client_settings.js old mode 100755 new mode 100644 diff --git a/public/js/client_settings.min.js b/public/js/client_settings.min.js old mode 100755 new mode 100644 diff --git a/public/js/client_show.js b/public/js/client_show.js old mode 100755 new mode 100644 diff --git a/public/js/client_show.min.js b/public/js/client_show.min.js old mode 100755 new mode 100644 diff --git a/public/js/clients/invoices/action-selectors.js b/public/js/clients/invoices/action-selectors.js old mode 100755 new mode 100644 diff --git a/public/js/clients/invoices/action-selectors.js.LICENSE.txt b/public/js/clients/invoices/action-selectors.js.LICENSE.txt old mode 100755 new mode 100644 diff --git a/public/js/clients/invoices/payment.js b/public/js/clients/invoices/payment.js old mode 100755 new mode 100644 diff --git a/public/js/clients/invoices/payment.js.LICENSE.txt b/public/js/clients/invoices/payment.js.LICENSE.txt old mode 100755 new mode 100644 diff --git a/public/js/clients/payment_methods/authorize-ach.js b/public/js/clients/payment_methods/authorize-ach.js old mode 100755 new mode 100644 diff --git a/public/js/clients/payment_methods/authorize-ach.js.LICENSE.txt b/public/js/clients/payment_methods/authorize-ach.js.LICENSE.txt old mode 100755 new mode 100644 diff --git a/public/js/clients/payment_methods/authorize-authorize-card.js b/public/js/clients/payment_methods/authorize-authorize-card.js old mode 100755 new mode 100644 diff --git a/public/js/clients/payment_methods/authorize-authorize-card.js.LICENSE.txt b/public/js/clients/payment_methods/authorize-authorize-card.js.LICENSE.txt old mode 100755 new mode 100644 diff --git a/public/js/clients/payment_methods/authorize-stripe-card.js b/public/js/clients/payment_methods/authorize-stripe-card.js old mode 100755 new mode 100644 diff --git a/public/js/clients/payment_methods/authorize-stripe-card.js.LICENSE.txt b/public/js/clients/payment_methods/authorize-stripe-card.js.LICENSE.txt old mode 100755 new mode 100644 diff --git a/public/js/clients/payment_methods/stripe-ach.js b/public/js/clients/payment_methods/stripe-ach.js old mode 100755 new mode 100644 diff --git a/public/js/clients/payments/alipay.js b/public/js/clients/payments/alipay.js old mode 100755 new mode 100644 diff --git a/public/js/clients/payments/alipay.js.LICENSE.txt b/public/js/clients/payments/alipay.js.LICENSE.txt old mode 100755 new mode 100644 diff --git a/public/js/clients/payments/authorize-credit-card-payment.js b/public/js/clients/payments/authorize-credit-card-payment.js old mode 100755 new mode 100644 diff --git a/public/js/clients/payments/authorize-credit-card-payment.js.LICENSE.txt b/public/js/clients/payments/authorize-credit-card-payment.js.LICENSE.txt old mode 100755 new mode 100644 diff --git a/public/js/clients/payments/card-js.min.js b/public/js/clients/payments/card-js.min.js old mode 100755 new mode 100644 diff --git a/public/js/clients/payments/checkout.com.js b/public/js/clients/payments/checkout.com.js old mode 100755 new mode 100644 diff --git a/public/js/clients/payments/process.js b/public/js/clients/payments/process.js old mode 100755 new mode 100644 diff --git a/public/js/clients/payments/process.js.LICENSE.txt b/public/js/clients/payments/process.js.LICENSE.txt old mode 100755 new mode 100644 diff --git a/public/js/clients/payments/sofort.js b/public/js/clients/payments/sofort.js old mode 100755 new mode 100644 diff --git a/public/js/clients/payments/sofort.js.LICENSE.txt b/public/js/clients/payments/sofort.js.LICENSE.txt old mode 100755 new mode 100644 diff --git a/public/js/clients/payments/stripe-ach.js b/public/js/clients/payments/stripe-ach.js old mode 100755 new mode 100644 diff --git a/public/js/clients/payments/stripe-ach.js.LICENSE.txt b/public/js/clients/payments/stripe-ach.js.LICENSE.txt old mode 100755 new mode 100644 diff --git a/public/js/clients/payments/stripe-alipay.js b/public/js/clients/payments/stripe-alipay.js old mode 100755 new mode 100644 diff --git a/public/js/clients/payments/stripe-alipay.js.LICENSE.txt b/public/js/clients/payments/stripe-alipay.js.LICENSE.txt old mode 100755 new mode 100644 diff --git a/public/js/clients/payments/stripe-credit-card.js b/public/js/clients/payments/stripe-credit-card.js old mode 100755 new mode 100644 diff --git a/public/js/clients/payments/stripe-credit-card.js.LICENSE.txt b/public/js/clients/payments/stripe-credit-card.js.LICENSE.txt old mode 100755 new mode 100644 diff --git a/public/js/clients/payments/stripe-sofort.js b/public/js/clients/payments/stripe-sofort.js old mode 100755 new mode 100644 diff --git a/public/js/clients/payments/stripe-sofort.js.LICENSE.txt b/public/js/clients/payments/stripe-sofort.js.LICENSE.txt old mode 100755 new mode 100644 diff --git a/public/js/clients/quotes/action-selectors.js b/public/js/clients/quotes/action-selectors.js old mode 100755 new mode 100644 diff --git a/public/js/clients/quotes/action-selectors.js.LICENSE.txt b/public/js/clients/quotes/action-selectors.js.LICENSE.txt old mode 100755 new mode 100644 diff --git a/public/js/clients/quotes/approve.js b/public/js/clients/quotes/approve.js old mode 100755 new mode 100644 diff --git a/public/js/clients/quotes/approve.js.LICENSE.txt b/public/js/clients/quotes/approve.js.LICENSE.txt old mode 100755 new mode 100644 diff --git a/public/js/clients/shared/multiple-downloads.js b/public/js/clients/shared/multiple-downloads.js old mode 100755 new mode 100644 diff --git a/public/js/clients/shared/pdf.js b/public/js/clients/shared/pdf.js old mode 100755 new mode 100644 diff --git a/public/js/clients/shared/pdf.js.LICENSE.txt b/public/js/clients/shared/pdf.js.LICENSE.txt old mode 100755 new mode 100644 diff --git a/public/js/coreui.js b/public/js/coreui.js old mode 100755 new mode 100644 diff --git a/public/js/coreui.min.js b/public/js/coreui.min.js old mode 100755 new mode 100644 diff --git a/public/js/localization.js b/public/js/localization.js old mode 100755 new mode 100644 diff --git a/public/js/localization.min.js b/public/js/localization.min.js old mode 100755 new mode 100644 diff --git a/public/js/ninja.js b/public/js/ninja.js old mode 100755 new mode 100644 diff --git a/public/js/ninja.min.js b/public/js/ninja.min.js old mode 100755 new mode 100644 diff --git a/public/js/setup/setup.js b/public/js/setup/setup.js old mode 100755 new mode 100644 diff --git a/public/js/setup/setup.js.LICENSE.txt b/public/js/setup/setup.js.LICENSE.txt old mode 100755 new mode 100644 diff --git a/public/js/vendor/app.js b/public/js/vendor/app.js old mode 100755 new mode 100644 diff --git a/public/js/vendor/datatables/datatables.min.css b/public/js/vendor/datatables/datatables.min.css old mode 100755 new mode 100644 diff --git a/public/js/vendor/datatables/datatables.min.js b/public/js/vendor/datatables/datatables.min.js old mode 100755 new mode 100644 diff --git a/public/js/vendor/jquery-3.3.1/jquery-3.3.1.js b/public/js/vendor/jquery-3.3.1/jquery-3.3.1.js old mode 100755 new mode 100644 diff --git a/public/js/vendor/jquery-3.3.1/jquery-3.3.1.min.js b/public/js/vendor/jquery-3.3.1/jquery-3.3.1.min.js old mode 100755 new mode 100644 diff --git a/public/js/vendor/pdf.js/pdf.min.js b/public/js/vendor/pdf.js/pdf.min.js old mode 100755 new mode 100644 diff --git a/public/js/vendor/pdf.js/pdf.worker.min.js b/public/js/vendor/pdf.js/pdf.worker.min.js old mode 100755 new mode 100644 diff --git a/public/main.dart.js b/public/main.dart.js old mode 100755 new mode 100644 diff --git a/public/main.dart.js.map b/public/main.dart.js.map old mode 100755 new mode 100644 diff --git a/public/manifest.json b/public/manifest.json old mode 100755 new mode 100644 diff --git a/public/mix-manifest.json b/public/mix-manifest.json old mode 100755 new mode 100644 diff --git a/public/robots.txt b/public/robots.txt old mode 100755 new mode 100644 diff --git a/public/svg/403.svg b/public/svg/403.svg old mode 100755 new mode 100644 diff --git a/public/svg/404.svg b/public/svg/404.svg old mode 100755 new mode 100644 diff --git a/public/svg/500.svg b/public/svg/500.svg old mode 100755 new mode 100644 diff --git a/public/svg/503.svg b/public/svg/503.svg old mode 100755 new mode 100644 diff --git a/public/vendor/dropzone-5.7.0/.gitignore b/public/vendor/dropzone-5.7.0/.gitignore old mode 100755 new mode 100644 diff --git a/public/vendor/dropzone-5.7.0/CONTRIBUTING.md b/public/vendor/dropzone-5.7.0/CONTRIBUTING.md old mode 100755 new mode 100644 diff --git a/public/vendor/dropzone-5.7.0/LICENSE b/public/vendor/dropzone-5.7.0/LICENSE old mode 100755 new mode 100644 diff --git a/public/vendor/dropzone-5.7.0/README.md b/public/vendor/dropzone-5.7.0/README.md old mode 100755 new mode 100644 diff --git a/public/vendor/dropzone-5.7.0/component.json b/public/vendor/dropzone-5.7.0/component.json old mode 100755 new mode 100644 diff --git a/public/vendor/dropzone-5.7.0/composer.json b/public/vendor/dropzone-5.7.0/composer.json old mode 100755 new mode 100644 diff --git a/public/vendor/dropzone-5.7.0/dist/basic.css b/public/vendor/dropzone-5.7.0/dist/basic.css old mode 100755 new mode 100644 diff --git a/public/vendor/dropzone-5.7.0/dist/dropzone-amd-module.js b/public/vendor/dropzone-5.7.0/dist/dropzone-amd-module.js old mode 100755 new mode 100644 diff --git a/public/vendor/dropzone-5.7.0/dist/dropzone.css b/public/vendor/dropzone-5.7.0/dist/dropzone.css old mode 100755 new mode 100644 diff --git a/public/vendor/dropzone-5.7.0/dist/dropzone.js b/public/vendor/dropzone-5.7.0/dist/dropzone.js old mode 100755 new mode 100644 diff --git a/public/vendor/dropzone-5.7.0/dist/dropzone.js.map b/public/vendor/dropzone-5.7.0/dist/dropzone.js.map old mode 100755 new mode 100644 diff --git a/public/vendor/dropzone-5.7.0/dist/min/basic.min.css b/public/vendor/dropzone-5.7.0/dist/min/basic.min.css old mode 100755 new mode 100644 diff --git a/public/vendor/dropzone-5.7.0/dist/min/dropzone-amd-module.min.js b/public/vendor/dropzone-5.7.0/dist/min/dropzone-amd-module.min.js old mode 100755 new mode 100644 diff --git a/public/vendor/dropzone-5.7.0/dist/min/dropzone.min.css b/public/vendor/dropzone-5.7.0/dist/min/dropzone.min.css old mode 100755 new mode 100644 diff --git a/public/vendor/dropzone-5.7.0/dist/min/dropzone.min.js b/public/vendor/dropzone-5.7.0/dist/min/dropzone.min.js old mode 100755 new mode 100644 diff --git a/public/vendor/dropzone-5.7.0/index.js b/public/vendor/dropzone-5.7.0/index.js old mode 100755 new mode 100644 diff --git a/public/vendor/dropzone-5.7.0/package.json b/public/vendor/dropzone-5.7.0/package.json old mode 100755 new mode 100644 diff --git a/public/vendor/livewire/livewire.js b/public/vendor/livewire/livewire.js old mode 100755 new mode 100644 diff --git a/public/vendor/livewire/livewire.js.map b/public/vendor/livewire/livewire.js.map old mode 100755 new mode 100644 diff --git a/public/vendor/livewire/manifest.json b/public/vendor/livewire/manifest.json old mode 100755 new mode 100644 diff --git a/public/version.json b/public/version.json old mode 100755 new mode 100644 diff --git a/storage/app/.gitignore b/storage/app/.gitignore old mode 100755 new mode 100644 diff --git a/storage/app/public/.gitignore b/storage/app/public/.gitignore old mode 100755 new mode 100644 diff --git a/storage/framework/.gitignore b/storage/framework/.gitignore old mode 100755 new mode 100644 diff --git a/storage/framework/cache/.gitignore b/storage/framework/cache/.gitignore old mode 100755 new mode 100644 diff --git a/storage/framework/sessions/.gitignore b/storage/framework/sessions/.gitignore old mode 100755 new mode 100644 diff --git a/storage/framework/testing/.gitignore b/storage/framework/testing/.gitignore old mode 100755 new mode 100644 diff --git a/storage/framework/views/.gitignore b/storage/framework/views/.gitignore old mode 100755 new mode 100644 diff --git a/storage/logs/.gitignore b/storage/logs/.gitignore old mode 100755 new mode 100644 diff --git a/tests/Feature/Import/ImportCompanyTest.php b/tests/Feature/Import/ImportCompanyTest.php index 30f66317a5..ee4ea43954 100644 --- a/tests/Feature/Import/ImportCompanyTest.php +++ b/tests/Feature/Import/ImportCompanyTest.php @@ -51,6 +51,7 @@ use App\Models\VendorContact; use App\Utils\Traits\MakesHash; use Illuminate\Foundation\Testing\DatabaseTransactions; use Illuminate\Routing\Middleware\ThrottleRequests; +use Illuminate\Support\Facades\Artisan; use Illuminate\Support\Facades\Cache; use Illuminate\Support\Str; use League\Csv\Reader; @@ -78,8 +79,8 @@ class ImportCompanyTest extends TestCase { parent::setUp(); - // $this->artisan('db:seed'); - + Artisan::call('db:seed'); + $this->withoutMiddleware( ThrottleRequests::class ); diff --git a/tests/Feature/PdfCreatorTest.php b/tests/Feature/PdfCreatorTest.php index 6d42a20e35..cb8c023ec0 100644 --- a/tests/Feature/PdfCreatorTest.php +++ b/tests/Feature/PdfCreatorTest.php @@ -41,20 +41,20 @@ class PdfCreatorTest extends TestCase { $credit_path = (new CreateEntityPdf($this->credit->invitations->first()))->handle(); - $this->assertTrue(Storage::disk('public')->exists($credit_path)); + $this->assertTrue(Storage::exists($credit_path)); } public function testInvoicePdfCreated() { $invoice_path = (new CreateEntityPdf($this->invoice->invitations->first()))->handle(); - $this->assertTrue(Storage::disk('public')->exists($invoice_path)); + $this->assertTrue(Storage::exists($invoice_path)); } public function testQuotePdfCreated() { $quote_path = (new CreateEntityPdf($this->quote->invitations->first()))->handle(); - $this->assertTrue(Storage::disk('public')->exists($quote_path)); + $this->assertTrue(Storage::exists($quote_path)); } } From 97e65570fcc926b4c0eac4862e0e0003f9e2aa70 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 3 Nov 2022 17:01:58 +1100 Subject: [PATCH 16/31] Fixes for verify phone --- app/Import/Transformer/BaseTransformer.php | 5 +++++ app/Import/Transformers/Bank/BankTransformer.php | 4 ++-- app/Jobs/User/VerifyPhone.php | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/Import/Transformer/BaseTransformer.php b/app/Import/Transformer/BaseTransformer.php index 46775ac070..3aa0e1769c 100644 --- a/app/Import/Transformer/BaseTransformer.php +++ b/app/Import/Transformer/BaseTransformer.php @@ -68,6 +68,11 @@ class BaseTransformer } + public function getNumber($data, $field) + { + return (isset($data->$field) && $data->$field) ? (int)$data->$field : 0; + } + public function getString($data, $field) { return isset($data[$field]) && $data[$field] ? trim($data[$field]) : ''; diff --git a/app/Import/Transformers/Bank/BankTransformer.php b/app/Import/Transformers/Bank/BankTransformer.php index 071ac77110..4233a9be4d 100644 --- a/app/Import/Transformers/Bank/BankTransformer.php +++ b/app/Import/Transformers/Bank/BankTransformer.php @@ -12,7 +12,7 @@ namespace App\Import\Transformers\Bank; use App\Import\ImportException; -use App\Import\Transformers\BaseTransformer; +use App\Import\Transformer\BaseTransformer; use App\Models\BankTransaction; use App\Utils\Number; @@ -38,7 +38,7 @@ class BankTransformer extends BaseTransformer 'account_type' => strlen($this->getString($transaction, 'bank.account_type')) > 1 ? $this->getString($transaction, 'bank.account_type') : 'bank', 'category_id' => $this->getNumber($transaction, 'bank.category_id') > 0 ? $this->getNumber($transaction, 'bank.category_id') : null, 'category_type' => $this->getString($transaction, 'category_type'), - 'date' => array_key_exists('date', $transaction) ? date('Y-m-d', strtotime(str_replace("/","-",$transaction['date']))) + 'date' => array_key_exists('date', $transaction) ? $this->parseDate($transaction['date']) : now()->format('Y-m-d'), 'bank_account_id' => array_key_exists('bank_account_id', $transaction) ? $transaction['bank_account_id'] : 0, 'description' => array_key_exists('description', $transaction)? $transaction['description'] : '', diff --git a/app/Jobs/User/VerifyPhone.php b/app/Jobs/User/VerifyPhone.php index ca639b2d8c..a1fb8b1687 100644 --- a/app/Jobs/User/VerifyPhone.php +++ b/app/Jobs/User/VerifyPhone.php @@ -53,7 +53,7 @@ class VerifyPhone implements ShouldQueue if(!$sid) return; // no twilio api credentials provided, bail. - $twilio = new Twilio\Rest\Client($sid, $token); + $twilio = new \Twilio\Rest\Client($sid, $token); $country = $this->user->account?->companies()?->first()?->country(); From e59cd019968de433e57da457afcfc2cd8ad29c0f Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 3 Nov 2022 17:12:13 +1100 Subject: [PATCH 17/31] Override phone number with international format --- app/Http/ValidationRules/User/HasValidPhoneNumber.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Http/ValidationRules/User/HasValidPhoneNumber.php b/app/Http/ValidationRules/User/HasValidPhoneNumber.php index ce599f8c76..1280596a97 100644 --- a/app/Http/ValidationRules/User/HasValidPhoneNumber.php +++ b/app/Http/ValidationRules/User/HasValidPhoneNumber.php @@ -62,7 +62,11 @@ class HasValidPhoneNumber implements Rule ->fetch(["countryCode" => $countryCode]); $user = auth()->user(); - $user->phone = $phone_number->phoneNumber; + + request()->merge([ + 'phone' => $phone_number->phoneNumber, + ]); + $user->verified_phone_number = true; $user->save(); From 1368da0c9023310b04cba72313731e86f73a1fe5 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 3 Nov 2022 17:14:02 +1100 Subject: [PATCH 18/31] Override phone number with international format --- app/Http/ValidationRules/User/HasValidPhoneNumber.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Http/ValidationRules/User/HasValidPhoneNumber.php b/app/Http/ValidationRules/User/HasValidPhoneNumber.php index 1280596a97..966e847800 100644 --- a/app/Http/ValidationRules/User/HasValidPhoneNumber.php +++ b/app/Http/ValidationRules/User/HasValidPhoneNumber.php @@ -40,7 +40,8 @@ class HasValidPhoneNumber implements Rule */ public function passes($attribute, $value) { - + nlog("hitting twilio"); + $sid = config('ninja.twilio_account_sid'); $token = config('ninja.twilio_auth_token'); @@ -56,6 +57,8 @@ class HasValidPhoneNumber implements Rule $countryCode = $country->iso_3166_2; + nlog("hitting twilio try"); + try{ $phone_number = $twilio->lookups->v1->phoneNumbers($value) From 27954d1ee22d92e9a1340f4b072afb48f6f5704a Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 3 Nov 2022 17:16:06 +1100 Subject: [PATCH 19/31] Override phone number with international format --- app/Http/ValidationRules/User/HasValidPhoneNumber.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Http/ValidationRules/User/HasValidPhoneNumber.php b/app/Http/ValidationRules/User/HasValidPhoneNumber.php index 966e847800..580afae52a 100644 --- a/app/Http/ValidationRules/User/HasValidPhoneNumber.php +++ b/app/Http/ValidationRules/User/HasValidPhoneNumber.php @@ -66,9 +66,9 @@ class HasValidPhoneNumber implements Rule $user = auth()->user(); - request()->merge([ - 'phone' => $phone_number->phoneNumber, - ]); + $json = request()->json()->all(); + $json['phone'] = $phone_number->phoneNumber; + request()->json()->replace($json); $user->verified_phone_number = true; $user->save(); From 7c6e5843d35dbb731aec6bc4adc9f5afbc5d6da2 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 3 Nov 2022 17:20:57 +1100 Subject: [PATCH 20/31] Override phone number with international format --- app/Http/ValidationRules/User/HasValidPhoneNumber.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/app/Http/ValidationRules/User/HasValidPhoneNumber.php b/app/Http/ValidationRules/User/HasValidPhoneNumber.php index 580afae52a..59f22d0746 100644 --- a/app/Http/ValidationRules/User/HasValidPhoneNumber.php +++ b/app/Http/ValidationRules/User/HasValidPhoneNumber.php @@ -40,7 +40,6 @@ class HasValidPhoneNumber implements Rule */ public function passes($attribute, $value) { - nlog("hitting twilio"); $sid = config('ninja.twilio_account_sid'); $token = config('ninja.twilio_auth_token'); @@ -56,8 +55,6 @@ class HasValidPhoneNumber implements Rule return true; $countryCode = $country->iso_3166_2; - - nlog("hitting twilio try"); try{ @@ -66,9 +63,7 @@ class HasValidPhoneNumber implements Rule $user = auth()->user(); - $json = request()->json()->all(); - $json['phone'] = $phone_number->phoneNumber; - request()->json()->replace($json); + request()->merge([ 'phone' => $phone_number->phoneNumber ]); $user->verified_phone_number = true; $user->save(); From 1e249e87fe3b31e59f4d71a3f320d11c8438563b Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 3 Nov 2022 17:22:41 +1100 Subject: [PATCH 21/31] Override phone number with international format --- app/Http/ValidationRules/User/HasValidPhoneNumber.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/ValidationRules/User/HasValidPhoneNumber.php b/app/Http/ValidationRules/User/HasValidPhoneNumber.php index 59f22d0746..f2e85e4f10 100644 --- a/app/Http/ValidationRules/User/HasValidPhoneNumber.php +++ b/app/Http/ValidationRules/User/HasValidPhoneNumber.php @@ -63,7 +63,7 @@ class HasValidPhoneNumber implements Rule $user = auth()->user(); - request()->merge([ 'phone' => $phone_number->phoneNumber ]); + request()->request->set('phone', $phone_number->phoneNumber); $user->verified_phone_number = true; $user->save(); From e06563c00f5be6f99e1a064db39591d7bbbca75e Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 3 Nov 2022 17:26:52 +1100 Subject: [PATCH 22/31] Override phone number with international format --- app/Http/ValidationRules/User/HasValidPhoneNumber.php | 3 +++ app/Repositories/UserRepository.php | 8 +------- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/app/Http/ValidationRules/User/HasValidPhoneNumber.php b/app/Http/ValidationRules/User/HasValidPhoneNumber.php index f2e85e4f10..dea4bd897b 100644 --- a/app/Http/ValidationRules/User/HasValidPhoneNumber.php +++ b/app/Http/ValidationRules/User/HasValidPhoneNumber.php @@ -64,6 +64,9 @@ class HasValidPhoneNumber implements Rule $user = auth()->user(); request()->request->set('phone', $phone_number->phoneNumber); + request()->merge(['phone' => $phone_number->phoneNumber ]); + + nlog($phone_number->phoneNumber); $user->verified_phone_number = true; $user->save(); diff --git a/app/Repositories/UserRepository.php b/app/Repositories/UserRepository.php index 52bf31033c..dafabf6dcf 100644 --- a/app/Repositories/UserRepository.php +++ b/app/Repositories/UserRepository.php @@ -56,12 +56,6 @@ class UserRepository extends BaseRepository $company = auth()->user()->company(); $account = $company->account; - /* If hosted and Enterprise we need to increment the num_users field on the accounts table*/ - // 05-08-2022 This is an error, the num_users should _never_ increment - // if (! $user->id && $account->isEnterpriseClient()) { - // $account->num_users++; - // $account->save(); - // } if(array_key_exists('oauth_provider_id', $details)) unset($details['oauth_provider_id']); @@ -140,7 +134,7 @@ class UserRepository extends BaseRepository $cu->forceDelete(); } - event(new UserWasDeleted($user, $company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null))); + event(new UserWasDeleted($user, auth()->user(), $company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null))); $user->delete(); From b3e02c8a70cf624dd77eceddf9c0b33c981e97c4 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 3 Nov 2022 17:31:46 +1100 Subject: [PATCH 23/31] Override phone number with international format --- app/Http/ValidationRules/User/HasValidPhoneNumber.php | 5 +---- app/Repositories/UserRepository.php | 3 +++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Http/ValidationRules/User/HasValidPhoneNumber.php b/app/Http/ValidationRules/User/HasValidPhoneNumber.php index dea4bd897b..b9e16bf706 100644 --- a/app/Http/ValidationRules/User/HasValidPhoneNumber.php +++ b/app/Http/ValidationRules/User/HasValidPhoneNumber.php @@ -63,10 +63,7 @@ class HasValidPhoneNumber implements Rule $user = auth()->user(); - request()->request->set('phone', $phone_number->phoneNumber); - request()->merge(['phone' => $phone_number->phoneNumber ]); - - nlog($phone_number->phoneNumber); + request()->merge(['validated_phone' => $phone_number->phoneNumber ]); $user->verified_phone_number = true; $user->save(); diff --git a/app/Repositories/UserRepository.php b/app/Repositories/UserRepository.php index dafabf6dcf..cecc25522b 100644 --- a/app/Repositories/UserRepository.php +++ b/app/Repositories/UserRepository.php @@ -59,6 +59,9 @@ class UserRepository extends BaseRepository if(array_key_exists('oauth_provider_id', $details)) unset($details['oauth_provider_id']); + if (request()->has('validated_phone')) + $details['phone'] = request()->input('validated_phone'); + $user->fill($details); //allow users to change only their passwords - not others! From f40360e1fe8f9549e32c2c0f6dbbbfb7b7a3d5a1 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 3 Nov 2022 19:44:38 +1100 Subject: [PATCH 24/31] Fixes for bank transaction imports --- app/Import/Providers/Csv.php | 21 +++++++++--------- .../Transformers/Bank/BankTransformer.php | 22 +++++++++---------- app/Observers/UserObserver.php | 6 ++--- 3 files changed, 25 insertions(+), 24 deletions(-) diff --git a/app/Import/Providers/Csv.php b/app/Import/Providers/Csv.php index 5dd23683c4..fdf70ca691 100644 --- a/app/Import/Providers/Csv.php +++ b/app/Import/Providers/Csv.php @@ -46,11 +46,14 @@ use App\Repositories\PaymentRepository; use App\Repositories\ProductRepository; use App\Repositories\QuoteRepository; use App\Repositories\VendorRepository; +use App\Utils\Traits\MakesHash; use Illuminate\Support\Facades\Validator; use Symfony\Component\HttpFoundation\ParameterBag; class Csv extends BaseImport implements ImportInterface { + use MakesHash; + public array $entity_count = []; public function import(string $entity) @@ -77,24 +80,20 @@ class Csv extends BaseImport implements ImportInterface $data = $this->getCsvData($entity_type); - if (is_array($data)) { + if (is_array($data)) + { + $data = $this->preTransformCsv($data, $entity_type); - - if(array_key_exists('bank_integration_id', $this->request)){ - - foreach($data as $key => $value) - { - $data['bank_integration_id'][$key] = $this->request['bank_integration_id']; - } - + foreach($data as $key => $value) + { + $data[$key]['bank.bank_integration_id'] = $this->decodePrimaryKey($this->request['bank_integration_id']); } } if (empty($data)) { $this->entity_count['bank_transactions'] = 0; - return; } @@ -102,6 +101,8 @@ class Csv extends BaseImport implements ImportInterface $this->repository_name = BankTransactionRepository::class; $this->factory_name = BankTransactionFactory::class; + $this->repository = app()->make($this->repository_name); + $this->transformer = new BankTransformer($this->company); $bank_transaction_count = $this->ingest($data, $entity_type); $this->entity_count['bank_transactions'] = $bank_transaction_count; diff --git a/app/Import/Transformers/Bank/BankTransformer.php b/app/Import/Transformers/Bank/BankTransformer.php index 4233a9be4d..80086111bc 100644 --- a/app/Import/Transformers/Bank/BankTransformer.php +++ b/app/Import/Transformers/Bank/BankTransformer.php @@ -31,17 +31,17 @@ class BankTransformer extends BaseTransformer $now = now(); $transformed = [ - // 'bank_integration_id' => $this->bank_integration->id, + 'bank_integration_id' => $transaction['bank.bank_integration_id'], 'transaction_id' => $this->getNumber($transaction,'bank.transaction_id'), 'amount' => abs($this->getFloat($transaction, 'bank.amount')), 'currency_id' => $this->getCurrencyByCode($transaction, 'bank.currency'), 'account_type' => strlen($this->getString($transaction, 'bank.account_type')) > 1 ? $this->getString($transaction, 'bank.account_type') : 'bank', 'category_id' => $this->getNumber($transaction, 'bank.category_id') > 0 ? $this->getNumber($transaction, 'bank.category_id') : null, - 'category_type' => $this->getString($transaction, 'category_type'), - 'date' => array_key_exists('date', $transaction) ? $this->parseDate($transaction['date']) + 'category_type' => $this->getString($transaction, 'bank.category_type'), + 'date' => array_key_exists('bank.date', $transaction) ? $this->parseDate($transaction['bank.date']) : now()->format('Y-m-d'), - 'bank_account_id' => array_key_exists('bank_account_id', $transaction) ? $transaction['bank_account_id'] : 0, - 'description' => array_key_exists('description', $transaction)? $transaction['description'] : '', + 'bank_account_id' => array_key_exists('bank.bank_account_id', $transaction) ? $transaction['bank.bank_account_id'] : 0, + 'description' => array_key_exists('bank.description', $transaction) ? $transaction['bank.description'] : '', 'base_type' => $this->calculateType($transaction), 'created_at' => $now, 'updated_at' => $now, @@ -56,22 +56,22 @@ class BankTransformer extends BaseTransformer private function calculateType($transaction) { - if(array_key_exists('base_type', $transaction) && $transaction['base_type'] == 'CREDIT') + if(array_key_exists('bank.base_type', $transaction) && $transaction['bank.base_type'] == 'CREDIT') return 'CREDIT'; - if(array_key_exists('base_type', $transaction) && $transaction['base_type'] == 'DEBIT') + if(array_key_exists('bank.base_type', $transaction) && $transaction['bank.base_type'] == 'DEBIT') return 'DEBIT'; - if(array_key_exists('category_id',$transaction)) + if(array_key_exists('bank.category_id', $transaction)) return 'DEBIT'; - if(array_key_exists('category_type', $transaction) && $transaction['category_type'] == 'Income') + if(array_key_exists('bank.category_type', $transaction) && $transaction['bank.category_type'] == 'Income') return 'CREDIT'; - if(array_key_exists('category_type', $transaction)) + if(array_key_exists('bank.category_type', $transaction)) return 'DEBIT'; - if(array_key_exists('amount', $transaction) && is_numeric($transaction['amount']) && $transaction['amount'] > 0) + if(array_key_exists('bank.amount', $transaction) && is_numeric($transaction['bank.amount']) && $transaction['bank.amount'] > 0) return 'CREDIT'; return 'DEBIT'; diff --git a/app/Observers/UserObserver.php b/app/Observers/UserObserver.php index ce9fe4b35f..44444572b1 100644 --- a/app/Observers/UserObserver.php +++ b/app/Observers/UserObserver.php @@ -38,9 +38,9 @@ class UserObserver */ public function updated(User $user) { - if (Ninja::isHosted() && $user->isDirty('phone')) { - VerifyPhone::dispatch($user); - } + // if (Ninja::isHosted() && $user->isDirty('phone')) { + // VerifyPhone::dispatch($user); + // } } /** From 27a721af05d6c04da70a272ba2ffff8b787c0596 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 3 Nov 2022 19:58:36 +1100 Subject: [PATCH 25/31] Minor fixes for tests --- tests/Feature/Inventory/InventoryManagementTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Feature/Inventory/InventoryManagementTest.php b/tests/Feature/Inventory/InventoryManagementTest.php index eb62e19c88..8b12761a97 100644 --- a/tests/Feature/Inventory/InventoryManagementTest.php +++ b/tests/Feature/Inventory/InventoryManagementTest.php @@ -80,7 +80,7 @@ class InventoryManagementTest extends TestCase ])->post('/api/v1/invoices/', $invoice_array) ->assertStatus(200); - $product = $product->refresh(); + $product = $product->fresh(); $this->assertEquals(90, $product->in_stock_quantity); From d2013cb86a8e8ee6c1f7cf266fc1978fe628b4a1 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 3 Nov 2022 21:56:04 +1100 Subject: [PATCH 26/31] minor fixes for validation --- .../Requests/BankTransaction/MatchBankTransactionRequest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Requests/BankTransaction/MatchBankTransactionRequest.php b/app/Http/Requests/BankTransaction/MatchBankTransactionRequest.php index 9c5869fabc..76dc1e349c 100644 --- a/app/Http/Requests/BankTransaction/MatchBankTransactionRequest.php +++ b/app/Http/Requests/BankTransaction/MatchBankTransactionRequest.php @@ -33,9 +33,9 @@ class MatchBankTransactionRequest extends Request 'transactions' => 'bail|array', 'transactions.*.id' => 'bail|required', 'transactions.*.invoice_ids' => 'nullable|string|sometimes', - 'transactions.*.ninja_category_id' => 'nullable|string|sometimes' ]; + $rules['transactions.*.ninja_category_id'] = 'bail|nullable|sometimes|exists:expense_categories,id,company_id,'.auth()->user()->company()->id.',is_deleted,0'; $rules['transactions.*.vendor_id'] = 'bail|sometimes|exists:vendors,id,company_id,'.auth()->user()->company()->id.',is_deleted,0'; return $rules; From 0fc0ff25bd9414bccbda90bd153114e30351daab Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 4 Nov 2022 12:55:17 +1100 Subject: [PATCH 27/31] Minor fixes for Bank Transactions / Integratiosn --- app/Helpers/Bank/Yodlee/Yodlee.php | 14 ++++++++ .../Controllers/Bank/YodleeController.php | 2 ++ app/Http/Controllers/OpenAPI/QuoteSchema.php | 2 +- app/Jobs/Bank/ProcessBankTransactions.php | 22 ++++++++++--- app/Jobs/Ninja/BankTransactionSync.php | 6 ++-- .../BankIntegrationTransformer.php | 1 + ...abled_upstream_bank_integrations_table.php | 32 +++++++++++++++++++ resources/views/bank/yodlee/auth.blade.php | 6 ++-- 8 files changed, 74 insertions(+), 11 deletions(-) create mode 100644 database/migrations/2022_11_04_013539_disabled_upstream_bank_integrations_table.php diff --git a/app/Helpers/Bank/Yodlee/Yodlee.php b/app/Helpers/Bank/Yodlee/Yodlee.php index 6a84fd850d..f021f5ec7e 100644 --- a/app/Helpers/Bank/Yodlee/Yodlee.php +++ b/app/Helpers/Bank/Yodlee/Yodlee.php @@ -174,6 +174,20 @@ class Yodlee } + public function getAccount($account_id) + { + + $token = $this->getAccessToken(); + + $response = Http::withHeaders($this->getHeaders(["Authorization" => "Bearer {$token}"]))->get($this->getEndpoint(). "/accounts/{$account_id}", []); + + if($response->successful()) + return true; + + if($response->failed()) + return false; + } + public function deleteAccount($account_id) { diff --git a/app/Http/Controllers/Bank/YodleeController.php b/app/Http/Controllers/Bank/YodleeController.php index ddf8b2100d..b743822c0a 100644 --- a/app/Http/Controllers/Bank/YodleeController.php +++ b/app/Http/Controllers/Bank/YodleeController.php @@ -33,6 +33,8 @@ class YodleeController extends BaseController $company = $request->getCompany(); + //ensure user is enterprise!! + if($company->account->bank_integration_account_id){ $flow = 'edit'; diff --git a/app/Http/Controllers/OpenAPI/QuoteSchema.php b/app/Http/Controllers/OpenAPI/QuoteSchema.php index d05264bd44..b33eddafcb 100644 --- a/app/Http/Controllers/OpenAPI/QuoteSchema.php +++ b/app/Http/Controllers/OpenAPI/QuoteSchema.php @@ -26,7 +26,7 @@ * @OA\Property(property="tax_name3", type="string", example="", description="The tax name"), * @OA\Property(property="tax_rate3", type="number", format="float", example="10.00", description="The tax rate"), * @OA\Property(property="total_taxes", type="number", format="float", example="10.00", description="The total taxes for the quote"), - * @OA\Property(property="line_items", type="object", example="[{"product_key":"test", "unit_cost":10},{"product_key":"test", "unit_cost":10}]", description="An array of line items of the quote"), + * @OA\Property(property="line_items", type="object", example="", description="An array of line items of the quote"), * @OA\Property(property="amount", type="number", format="float", example="10.00", description="The total amount of the quote"), * @OA\Property(property="balance", type="number", format="float", example="10.00", description="The balance due of the quote"), * @OA\Property(property="paid_to_date", type="number", format="float", example="10.00", description="The amount that has been paid to date on the quote"), diff --git a/app/Jobs/Bank/ProcessBankTransactions.php b/app/Jobs/Bank/ProcessBankTransactions.php index 7e7c85083e..d213be664a 100644 --- a/app/Jobs/Bank/ProcessBankTransactions.php +++ b/app/Jobs/Bank/ProcessBankTransactions.php @@ -68,7 +68,13 @@ class ProcessBankTransactions implements ShouldQueue do{ - $this->processTransactions(); + try { + $this->processTransactions(); + } + catch(\Exception $e) { + nlog("{$this->bank_integration_account_id} - exited abnormally => ". $e->getMessage()); + return; + } } while($this->stop_loop); @@ -83,6 +89,14 @@ class ProcessBankTransactions implements ShouldQueue $yodlee = new Yodlee($this->bank_integration_account_id); + if(!$yodlee->getAccount($this->bank_integration->bank_account_id)) + { + $this->bank_integration->disabled_upstream = true; + $this->bank_integration->save(); + $this->stop_loop = false; + return; + } + $data = [ 'top' => 500, 'fromDate' => $this->from_date, @@ -102,7 +116,8 @@ class ProcessBankTransactions implements ShouldQueue //if no transactions, update the from_date and move on if(count($transactions) == 0){ - $this->bank_integration->from_date = now(); + $this->bank_integration->from_date = now()->subDays(2); + $this->bank_integration->disabled_upstream = false; $this->bank_integration->save(); $this->stop_loop = false; return; @@ -144,8 +159,7 @@ class ProcessBankTransactions implements ShouldQueue if($count < 500){ $this->stop_loop = false; - - $this->bank_integration->from_date = now(); + $this->bank_integration->from_date = now()->subDays(2); $this->bank_integration->save(); } diff --git a/app/Jobs/Ninja/BankTransactionSync.php b/app/Jobs/Ninja/BankTransactionSync.php index d657f4c668..227f8ec8d9 100644 --- a/app/Jobs/Ninja/BankTransactionSync.php +++ b/app/Jobs/Ninja/BankTransactionSync.php @@ -64,8 +64,8 @@ class BankTransactionSync implements ShouldQueue // $queue = Ninja::isHosted() ? 'bank' : 'default'; - // if($account->isPaid()) - // { + if($account->isPaid() && $account->plan == 'enterprise') + { $account->bank_integrations->each(function ($bank_integration) use ($account){ @@ -73,7 +73,7 @@ class BankTransactionSync implements ShouldQueue }); - // } + } }); } diff --git a/app/Transformers/BankIntegrationTransformer.php b/app/Transformers/BankIntegrationTransformer.php index 131259f498..cae21bbf43 100644 --- a/app/Transformers/BankIntegrationTransformer.php +++ b/app/Transformers/BankIntegrationTransformer.php @@ -60,6 +60,7 @@ class BankIntegrationTransformer extends EntityTransformer 'nickname' => (string)$bank_integration->nickname ?: '', 'from_date' => (string)$bank_integration->from_date ?: '', 'is_deleted' => (bool) $bank_integration->is_deleted, + 'disabled_upstream' => (bool) $bank_integration->disabled_upstream, 'created_at' => (int) $bank_integration->created_at, 'updated_at' => (int) $bank_integration->updated_at, 'archived_at' => (int) $bank_integration->deleted_at, diff --git a/database/migrations/2022_11_04_013539_disabled_upstream_bank_integrations_table.php b/database/migrations/2022_11_04_013539_disabled_upstream_bank_integrations_table.php new file mode 100644 index 0000000000..736de04274 --- /dev/null +++ b/database/migrations/2022_11_04_013539_disabled_upstream_bank_integrations_table.php @@ -0,0 +1,32 @@ +boolean('disabled_upstream')->default(false); + }); + + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + } +}; diff --git a/resources/views/bank/yodlee/auth.blade.php b/resources/views/bank/yodlee/auth.blade.php index 81b2ab9fe7..906e0e6c17 100644 --- a/resources/views/bank/yodlee/auth.blade.php +++ b/resources/views/bank/yodlee/auth.blade.php @@ -43,14 +43,14 @@