From d22c9a3bd9acd004768a07e3ad61c43ced075e7d Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 11 Jul 2024 15:53:18 +1000 Subject: [PATCH 1/9] Static analysis --- app/Export/CSV/ActivityExport.php | 4 ++++ app/Export/CSV/ClientExport.php | 4 ++++ app/Export/CSV/TaskExport.php | 4 ++-- app/Export/Decorators/TaskDecorator.php | 4 ++-- app/Factory/RecurringExpenseToExpenseFactory.php | 2 +- app/Helpers/Generic.php | 4 ++-- app/Http/Controllers/MigrationController.php | 4 ++-- app/Http/Controllers/PreviewController.php | 2 +- app/Http/Requests/Task/StoreTaskRequest.php | 2 +- app/Http/Requests/Task/UpdateTaskRequest.php | 2 +- app/Import/Transformer/Csv/ExpenseTransformer.php | 2 +- app/Jobs/Product/UpdateOrCreateProduct.php | 2 +- app/Jobs/RecurringInvoice/SendRecurring.php | 2 +- app/Jobs/Util/Import.php | 9 ++++----- app/Jobs/Util/StartMigration.php | 2 +- app/Jobs/Vendor/CreatePurchaseOrderPdf.php | 2 +- .../Migration/PaymentMigrationRepository.php | 2 +- app/Repositories/SubscriptionRepository.php | 2 +- app/Services/Pdf/PdfConfiguration.php | 2 +- app/Services/Pdf/PdfService.php | 2 +- app/Utils/Helpers.php | 2 +- app/Utils/Number.php | 2 +- app/Utils/Traits/Pdf/PdfMaker.php | 4 ++-- phpstan.neon | 2 +- 24 files changed, 38 insertions(+), 31 deletions(-) diff --git a/app/Export/CSV/ActivityExport.php b/app/Export/CSV/ActivityExport.php index fea9ba8722cd..b148c9806daf 100644 --- a/app/Export/CSV/ActivityExport.php +++ b/app/Export/CSV/ActivityExport.php @@ -57,6 +57,7 @@ class ActivityExport extends BaseExport $report = $query->cursor() ->map(function ($resource) { + /** @var \App\Models\Activity $resource */ $row = $this->buildActivityRow($resource); return $this->processMetaData($row, $resource); })->toArray(); @@ -128,6 +129,9 @@ class ActivityExport extends BaseExport $query->cursor() ->each(function ($entity) { + + /** @var \App\Models\Activity $entity */ + $this->buildRow($entity); }); diff --git a/app/Export/CSV/ClientExport.php b/app/Export/CSV/ClientExport.php index f0a5314f76e6..ec4374948cd8 100644 --- a/app/Export/CSV/ClientExport.php +++ b/app/Export/CSV/ClientExport.php @@ -102,6 +102,8 @@ class ClientExport extends BaseExport $report = $query->cursor() ->map(function ($client) { + + /** @var \App\Models\Client $client */ $row = $this->buildRow($client); return $this->processMetaData($row, $client); })->toArray(); @@ -154,6 +156,8 @@ class ClientExport extends BaseExport $query->cursor() ->each(function ($client) { + + /** @var \App\Models\Client $client */ $this->csv->insertOne($this->buildRow($client)); }); diff --git a/app/Export/CSV/TaskExport.php b/app/Export/CSV/TaskExport.php index f630517a2c81..98da6fda1750 100644 --- a/app/Export/CSV/TaskExport.php +++ b/app/Export/CSV/TaskExport.php @@ -161,7 +161,7 @@ class TaskExport extends BaseExport } - if (is_null($task->time_log) || (is_array(json_decode($task->time_log, 1)) && count(json_decode($task->time_log, 1)) == 0)) { + if (is_null($task->time_log) || (is_array(json_decode($task->time_log, true)) && count(json_decode($task->time_log, true)) == 0)) { $this->storage_array[] = $entity; } else { $this->iterateLogs($task, $entity); @@ -178,7 +178,7 @@ class TaskExport extends BaseExport $timezone_name = $timezone->name; } - $logs = json_decode($task->time_log, 1); + $logs = json_decode($task->time_log, true); $date_format_default = $this->date_format; diff --git a/app/Export/Decorators/TaskDecorator.php b/app/Export/Decorators/TaskDecorator.php index 0b48e1cdc613..05f7c2e69690 100644 --- a/app/Export/Decorators/TaskDecorator.php +++ b/app/Export/Decorators/TaskDecorator.php @@ -48,7 +48,7 @@ class TaskDecorator extends Decorator implements DecoratorInterface $timezone_name = $timezone->name; } - $logs = json_decode($task->time_log, 1); + $logs = json_decode($task->time_log, true); $date_format_default = 'Y-m-d'; @@ -77,7 +77,7 @@ class TaskDecorator extends Decorator implements DecoratorInterface $timezone_name = $timezone->name; } - $logs = json_decode($task->time_log, 1); + $logs = json_decode($task->time_log, true); $date_format_default = 'Y-m-d'; diff --git a/app/Factory/RecurringExpenseToExpenseFactory.php b/app/Factory/RecurringExpenseToExpenseFactory.php index d1903408409b..e6699e1fb77c 100644 --- a/app/Factory/RecurringExpenseToExpenseFactory.php +++ b/app/Factory/RecurringExpenseToExpenseFactory.php @@ -175,7 +175,7 @@ class RecurringExpenseToExpenseFactory $_value = explode($_operation, $right); // [MONTHYEAR, 4] - $_right = Carbon::createFromDate(now()->year, now()->month)->addMonths($_value[1])->translatedFormat('F Y'); + $_right = Carbon::createFromDate(now()->year, now()->month)->addMonths($_value[1])->translatedFormat('F Y'); //@phpstan-ignore-line } $replacement = sprintf('%s to %s', $_left, $_right); diff --git a/app/Helpers/Generic.php b/app/Helpers/Generic.php index 33c5b4ba801f..65846b786792 100644 --- a/app/Helpers/Generic.php +++ b/app/Helpers/Generic.php @@ -27,7 +27,7 @@ function nlog($output, $context = []): void } if (gettype($output) == 'object') { - $output = print_r($output, 1); + $output = print_r($output, true); } // $trace = debug_backtrace(); @@ -53,7 +53,7 @@ function nrlog($output, $context = []): void } if (gettype($output) == 'object') { - $output = print_r($output, 1); + $output = print_r($output, true); } // $trace = debug_backtrace(); diff --git a/app/Http/Controllers/MigrationController.php b/app/Http/Controllers/MigrationController.php index 11123bf830d7..d51eb417fb6a 100644 --- a/app/Http/Controllers/MigrationController.php +++ b/app/Http/Controllers/MigrationController.php @@ -267,7 +267,7 @@ class MigrationController extends BaseController if ($request->companies) { //handle Laravel 5.5 UniHTTP - $companies = json_decode($request->companies, 1); + $companies = json_decode($request->companies, true); } else { //handle Laravel 6 Guzzle $companies = []; @@ -275,7 +275,7 @@ class MigrationController extends BaseController foreach ($request->all() as $input) { if ($input instanceof UploadedFile) { } else { - $companies[] = json_decode($input, 1); + $companies[] = json_decode($input, true); } } } diff --git a/app/Http/Controllers/PreviewController.php b/app/Http/Controllers/PreviewController.php index bbfa9b150368..e1db201eab31 100644 --- a/app/Http/Controllers/PreviewController.php +++ b/app/Http/Controllers/PreviewController.php @@ -288,7 +288,7 @@ class PreviewController extends BaseController /** @var \App\Models\Company $company */ $company = $user->company(); - $design_object = json_decode(json_encode(request()->input('design')), 1); + $design_object = json_decode(json_encode(request()->input('design')), true); $ts = (new TemplateService()); diff --git a/app/Http/Requests/Task/StoreTaskRequest.php b/app/Http/Requests/Task/StoreTaskRequest.php index f61bc4267a23..9c5462add8c9 100644 --- a/app/Http/Requests/Task/StoreTaskRequest.php +++ b/app/Http/Requests/Task/StoreTaskRequest.php @@ -69,7 +69,7 @@ class StoreTaskRequest extends Request foreach ($values as $k) { if (!is_int($k[0]) || !is_int($k[1])) { - return $fail('The '.$attribute.' - '.print_r($k, 1).' is invalid. Unix timestamps only.'); + return $fail('The '.$attribute.' - '.print_r($k, true).' is invalid. Unix timestamps only.'); } } diff --git a/app/Http/Requests/Task/UpdateTaskRequest.php b/app/Http/Requests/Task/UpdateTaskRequest.php index 85b2c4de955b..0944fb4eee1e 100644 --- a/app/Http/Requests/Task/UpdateTaskRequest.php +++ b/app/Http/Requests/Task/UpdateTaskRequest.php @@ -75,7 +75,7 @@ class UpdateTaskRequest extends Request foreach ($values as $k) { if (!is_int($k[0]) || !is_int($k[1])) { - return $fail('The '.$attribute.' - '.print_r($k, 1).' is invalid. Unix timestamps only.'); + return $fail('The '.$attribute.' - '.print_r($k, true).' is invalid. Unix timestamps only.'); } } diff --git a/app/Import/Transformer/Csv/ExpenseTransformer.php b/app/Import/Transformer/Csv/ExpenseTransformer.php index c641662b41f8..d69fa4ca68d1 100644 --- a/app/Import/Transformer/Csv/ExpenseTransformer.php +++ b/app/Import/Transformer/Csv/ExpenseTransformer.php @@ -42,7 +42,7 @@ class ExpenseTransformer extends BaseTransformer 'client_id' => isset($data['expense.client']) ? $this->getClientId($data['expense.client']) : null, - 'date' => strlen($this->getString($data, 'expense.date') > 1) ? $this->parseDate($data['expense.date']) : now()->format('Y-m-d'), + 'date' => strlen($this->getString($data, 'expense.date')) > 1 ? $this->parseDate($data['expense.date']) : now()->format('Y-m-d'), 'public_notes' => $this->getString($data, 'expense.public_notes'), 'private_notes' => $this->getString($data, 'expense.private_notes'), 'category_id' => isset($data['expense.category']) diff --git a/app/Jobs/Product/UpdateOrCreateProduct.php b/app/Jobs/Product/UpdateOrCreateProduct.php index fbfc1e8853cb..82fc0c06dda4 100644 --- a/app/Jobs/Product/UpdateOrCreateProduct.php +++ b/app/Jobs/Product/UpdateOrCreateProduct.php @@ -140,6 +140,6 @@ class UpdateOrCreateProduct implements ShouldQueue public function failed($exception = null) { info('update create failed with = '); - info(print_r($exception->getMessage(), 1)); + nlog($exception->getMessage()); } } diff --git a/app/Jobs/RecurringInvoice/SendRecurring.php b/app/Jobs/RecurringInvoice/SendRecurring.php index 6a57330f1eca..a856539a642a 100644 --- a/app/Jobs/RecurringInvoice/SendRecurring.php +++ b/app/Jobs/RecurringInvoice/SendRecurring.php @@ -202,6 +202,6 @@ class SendRecurring implements ShouldQueue LightLogs::create($job_failure) ->send(); - nlog(print_r($exception->getMessage(), 1)); + nlog($exception->getMessage()); } } diff --git a/app/Jobs/Util/Import.php b/app/Jobs/Util/Import.php index 696b37bee891..01775fee78f4 100644 --- a/app/Jobs/Util/Import.php +++ b/app/Jobs/Util/Import.php @@ -212,7 +212,7 @@ class Import implements ShouldQueue $user->setCompany($this->company); - $array = json_decode(file_get_contents($this->file_path), 1); + $array = json_decode(file_get_contents($this->file_path), true); $data = $array['data']; foreach ($this->available_imports as $import) { @@ -2010,7 +2010,7 @@ class Import implements ShouldQueue public function transformId($resource, string $old): int { if (! array_key_exists($resource, $this->ids)) { - info(print_r($resource, 1)); + nlog($resource); throw new Exception("Resource {$resource} not available."); } @@ -2067,11 +2067,10 @@ class Import implements ShouldQueue LightLogs::create($job_failure) ->queue(); - nlog(print_r($exception->getMessage(), 1)); + nlog($exception->getMessage()); - // if (Ninja::isHosted()) { app('sentry')->captureException($exception); - // } + } diff --git a/app/Jobs/Util/StartMigration.php b/app/Jobs/Util/StartMigration.php index 3d28465d2c30..77b9ed9f7abd 100644 --- a/app/Jobs/Util/StartMigration.php +++ b/app/Jobs/Util/StartMigration.php @@ -168,6 +168,6 @@ class StartMigration implements ShouldQueue public function failed($exception = null) { - info(print_r($exception->getMessage(), 1)); + nlog($exception->getMessage()); } } diff --git a/app/Jobs/Vendor/CreatePurchaseOrderPdf.php b/app/Jobs/Vendor/CreatePurchaseOrderPdf.php index 824ac6424f5b..d40765b560d9 100644 --- a/app/Jobs/Vendor/CreatePurchaseOrderPdf.php +++ b/app/Jobs/Vendor/CreatePurchaseOrderPdf.php @@ -199,7 +199,7 @@ class CreatePurchaseOrderPdf implements ShouldQueue } } } catch (\Exception $e) { - nlog(print_r($e->getMessage(), 1)); + nlog($e->getMessage()); } if (config('ninja.log_pdf_html')) { diff --git a/app/Repositories/Migration/PaymentMigrationRepository.php b/app/Repositories/Migration/PaymentMigrationRepository.php index 51bcdb51b826..0ece566f2e08 100644 --- a/app/Repositories/Migration/PaymentMigrationRepository.php +++ b/app/Repositories/Migration/PaymentMigrationRepository.php @@ -87,7 +87,7 @@ class PaymentMigrationRepository extends BaseRepository if (! array_key_exists('status_id', $data)) { info('payment with no status id?'); - info(print_r($data, 1)); + info(print_r($data, true)); } $payment->status_id = $data['status_id']; diff --git a/app/Repositories/SubscriptionRepository.php b/app/Repositories/SubscriptionRepository.php index e340b0e78d51..e7d971f0d379 100644 --- a/app/Repositories/SubscriptionRepository.php +++ b/app/Repositories/SubscriptionRepository.php @@ -130,7 +130,7 @@ class SubscriptionRepository extends BaseRepository private function convertV3Bundle($bundle): array { if(is_object($bundle)) { - $bundle = json_decode(json_encode($bundle), 1); + $bundle = json_decode(json_encode($bundle), true); } $items = []; diff --git a/app/Services/Pdf/PdfConfiguration.php b/app/Services/Pdf/PdfConfiguration.php index fddbc0766ae2..4c9548bdb92e 100644 --- a/app/Services/Pdf/PdfConfiguration.php +++ b/app/Services/Pdf/PdfConfiguration.php @@ -386,7 +386,7 @@ class PdfConfiguration $decimal = $this->country->decimal_separator; } - if (isset($this->country->swap_currency_symbol) && strlen($this->country->swap_currency_symbol) >= 1) { + if (isset($this->country->swap_currency_symbol) && $this->country->swap_currency_symbol == 1) { $swapSymbol = $this->country->swap_currency_symbol; } diff --git a/app/Services/Pdf/PdfService.php b/app/Services/Pdf/PdfService.php index 4a579db80c52..85d115e8a476 100644 --- a/app/Services/Pdf/PdfService.php +++ b/app/Services/Pdf/PdfService.php @@ -102,7 +102,7 @@ class PdfService } } catch (\Exception $e) { - nlog(print_r($e->getMessage(), 1)); + nlog($e->getMessage()); throw new \Exception($e->getMessage(), $e->getCode()); } diff --git a/app/Utils/Helpers.php b/app/Utils/Helpers.php index 4d5fd38d486d..e0e7d9e64e21 100644 --- a/app/Utils/Helpers.php +++ b/app/Utils/Helpers.php @@ -279,7 +279,7 @@ class Helpers $_value = explode($_operation, $right); // [MONTHYEAR, 4] - $_right = Carbon::createFromDate($currentDateTime->year, $currentDateTime->month)->addMonths($_value[1])->translatedFormat('F Y'); + $_right = Carbon::createFromDate($currentDateTime->year, $currentDateTime->month)->addMonths($_value[1])->translatedFormat('F Y'); //@phpstan-ignore-line } $replacement = sprintf('%s to %s', $_left, $_right); diff --git a/app/Utils/Number.php b/app/Utils/Number.php index 2a8b592a6a99..c1d601a80e61 100644 --- a/app/Utils/Number.php +++ b/app/Utils/Number.php @@ -255,7 +255,7 @@ class Number $decimal = $country->decimal_separator; } - if (isset($country->swap_currency_symbol) && strlen($country->swap_currency_symbol) >= 1) { + if (isset($country->swap_currency_symbol) && $country->swap_currency_symbol == 1) { $swapSymbol = $country->swap_currency_symbol; } diff --git a/app/Utils/Traits/Pdf/PdfMaker.php b/app/Utils/Traits/Pdf/PdfMaker.php index 112570272f4a..fa3c70f6b872 100644 --- a/app/Utils/Traits/Pdf/PdfMaker.php +++ b/app/Utils/Traits/Pdf/PdfMaker.php @@ -20,8 +20,8 @@ trait PdfMaker /** * Returns a PDF stream. * - * @param string $header Header to be included in PDF - * @param string $footer Footer to be included in PDF + * @param string|null $header Header to be included in PDF + * @param string|null $footer Footer to be included in PDF * @param string $html The HTML object to be converted into PDF * * @return string The PDF string diff --git a/phpstan.neon b/phpstan.neon index df2082796c5b..1811c3080b13 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -3,7 +3,7 @@ includes: - ./vendor/spaze/phpstan-stripe/extension.neon - phpstan-baseline.neon parameters: - level: 4 + level: 5 paths: - app excludePaths: From d53f3062cf79d853852ea6a2649c5d44c5b72740 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 14 Jul 2024 08:16:29 +1000 Subject: [PATCH 2/9] add stock quantity to imports --- app/Exceptions/Handler.php | 5 - app/Filters/CreditFilters.php | 3 +- app/Filters/InvoiceFilters.php | 3 +- app/Filters/QuoteFilters.php | 3 +- app/Filters/RecurringInvoiceFilters.php | 3 +- app/Http/Controllers/SetupController.php | 2 - app/Import/Definitions/ProductMap.php | 4 +- app/Models/Client.php | 14 + app/Services/Client/ClientService.php | 6 +- .../Validation/Peppol/CompanyLevel.php | 6 +- app/Transformers/AccountTransformer.php | 2 +- app/Transformers/CompanyTransformer.php | 2 +- app/Utils/HtmlEngine.php | 2 + composer.lock | 573 +++++++++--------- 14 files changed, 323 insertions(+), 305 deletions(-) diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index a6f286c78d3b..243383eeb34d 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -97,11 +97,6 @@ class Handler extends ExceptionHandler { if (Ninja::isHosted()) { - // if($exception instanceof ThrottleRequestsException && class_exists(\Modules\Admin\Events\ThrottledExceptionRaised::class)) { - // $uri = urldecode(request()->getRequestUri()); - // event(new \Modules\Admin\Events\ThrottledExceptionRaised(auth()->user()?->account?->key, $uri, request()->ip())); - // } - Integration::configureScope(function (Scope $scope): void { $name = 'hosted@invoiceninja.com'; diff --git a/app/Filters/CreditFilters.php b/app/Filters/CreditFilters.php index 2306139c13d5..54ba0fb05c21 100644 --- a/app/Filters/CreditFilters.php +++ b/app/Filters/CreditFilters.php @@ -97,7 +97,8 @@ class CreditFilters extends QueryFilters $q->where('first_name', 'like', '%'.$filter.'%') ->orWhere('last_name', 'like', '%'.$filter.'%') ->orWhere('email', 'like', '%'.$filter.'%'); - }); + }) + ->orWhereRaw("JSON_UNQUOTE(JSON_EXTRACT(line_items, '$[*].notes')) LIKE ?", ['%'.$filter.'%']); }); } diff --git a/app/Filters/InvoiceFilters.php b/app/Filters/InvoiceFilters.php index 6d76a1352de4..2d2ef7cd06b8 100644 --- a/app/Filters/InvoiceFilters.php +++ b/app/Filters/InvoiceFilters.php @@ -124,7 +124,8 @@ class InvoiceFilters extends QueryFilters $q->where('first_name', 'like', '%'.$filter.'%') ->orWhere('last_name', 'like', '%'.$filter.'%') ->orWhere('email', 'like', '%'.$filter.'%'); - }); + }) + ->orWhereRaw("JSON_UNQUOTE(JSON_EXTRACT(line_items, '$[*].notes')) LIKE ?", ['%'.$filter.'%']); }); } diff --git a/app/Filters/QuoteFilters.php b/app/Filters/QuoteFilters.php index 60cc597bb365..048669db927a 100644 --- a/app/Filters/QuoteFilters.php +++ b/app/Filters/QuoteFilters.php @@ -45,7 +45,8 @@ class QuoteFilters extends QueryFilters $q->where('first_name', 'like', '%'.$filter.'%') ->orWhere('last_name', 'like', '%'.$filter.'%') ->orWhere('email', 'like', '%'.$filter.'%'); - }); + }) + ->orWhereRaw("JSON_UNQUOTE(JSON_EXTRACT(line_items, '$[*].notes')) LIKE ?", ['%'.$filter.'%']); }); } diff --git a/app/Filters/RecurringInvoiceFilters.php b/app/Filters/RecurringInvoiceFilters.php index ef7f78c5c029..983582cb9a4e 100644 --- a/app/Filters/RecurringInvoiceFilters.php +++ b/app/Filters/RecurringInvoiceFilters.php @@ -48,7 +48,8 @@ class RecurringInvoiceFilters extends QueryFilters $q->where('first_name', 'like', '%'.$filter.'%') ->orWhere('last_name', 'like', '%'.$filter.'%') ->orWhere('email', 'like', '%'.$filter.'%'); - }); + }) + ->orWhereRaw("JSON_UNQUOTE(JSON_EXTRACT(line_items, '$[*].notes')) LIKE ?", ['%'.$filter.'%']); }); } diff --git a/app/Http/Controllers/SetupController.php b/app/Http/Controllers/SetupController.php index fe0fad23a324..942b9607c727 100644 --- a/app/Http/Controllers/SetupController.php +++ b/app/Http/Controllers/SetupController.php @@ -144,8 +144,6 @@ class SetupController extends Controller define('STDIN', fopen('php://stdin', 'r')); Artisan::call('config:clear'); - - Artisan::call('migrate', ['--force' => true]); Artisan::call('db:seed', ['--force' => true]); Artisan::call('config:clear'); diff --git a/app/Import/Definitions/ProductMap.php b/app/Import/Definitions/ProductMap.php index 5f4e636ad12c..b6f38a550418 100644 --- a/app/Import/Definitions/ProductMap.php +++ b/app/Import/Definitions/ProductMap.php @@ -31,7 +31,8 @@ class ProductMap 12 => 'product.custom_value2', 13 => 'product.custom_value3', 14 => 'product.custom_value4', - 15 => 'product.image_url' + 15 => 'product.image_url', + 16 => 'product.in_stock_quantity', ]; } @@ -54,6 +55,7 @@ class ProductMap 13 => 'texts.custom_value', 14 => 'texts.custom_value', 15 => 'texts.image_url', + 16 => 'texts.in_stock_quantity', ]; } } diff --git a/app/Models/Client.php b/app/Models/Client.php index f9a68fbe8ffc..171fbd97ec15 100644 --- a/app/Models/Client.php +++ b/app/Models/Client.php @@ -822,6 +822,20 @@ class Client extends BaseModel implements HasLocalePreference } + public function utc_offset(): int + { + + $offset = 0; + $timezone = $this->timezone(); + + date_default_timezone_set('GMT'); + $date = new \DateTime("now", new \DateTimeZone($timezone->name)); + $offset = $date->getOffset(); + + return $offset; + + } + public function timezone_offset(): int { $offset = 0; diff --git a/app/Services/Client/ClientService.php b/app/Services/Client/ClientService.php index e2a4eddfa44a..b7ba322a2b3c 100644 --- a/app/Services/Client/ClientService.php +++ b/app/Services/Client/ClientService.php @@ -180,10 +180,12 @@ class ClientService public function updatePaymentBalance() { - $amount = Payment::query()->where('client_id', $this->client->id) + $amount = Payment::query() + ->withTrashed() + ->where('client_id', $this->client->id) ->where('is_deleted', 0) ->whereIn('status_id', [Payment::STATUS_COMPLETED, Payment::STATUS_PENDING, Payment::STATUS_PARTIALLY_REFUNDED, Payment::STATUS_REFUNDED]) - ->selectRaw('SUM(payments.amount - payments.applied) as amount')->first()->amount ?? 0; + ->selectRaw('SUM(payments.amount - payments.applied - payments.refunded) as amount')->first()->amount ?? 0; DB::connection(config('database.default'))->transaction(function () use ($amount) { $this->client = Client::withTrashed()->where('id', $this->client->id)->lockForUpdate()->first(); diff --git a/app/Services/EDocument/Standards/Validation/Peppol/CompanyLevel.php b/app/Services/EDocument/Standards/Validation/Peppol/CompanyLevel.php index 9de7f548e714..04624c51b8f0 100644 --- a/app/Services/EDocument/Standards/Validation/Peppol/CompanyLevel.php +++ b/app/Services/EDocument/Standards/Validation/Peppol/CompanyLevel.php @@ -153,9 +153,9 @@ class CompanyLevel // #[SerializedName('cbc:AccountingCostCode')] // public $AccountingCostCode; - // /** @var string */ - // #[SerializedName('cbc:AccountingCost')] - // public string $AccountingCost; + /** @var string */ + #[SerializedName('cbc:AccountingCost')] + public string $AccountingCost; // /** @var LineCountNumeric */ // #[SerializedName('cbc:LineCountNumeric')] diff --git a/app/Transformers/AccountTransformer.php b/app/Transformers/AccountTransformer.php index bd813cf71d21..4ad93a2598bc 100644 --- a/app/Transformers/AccountTransformer.php +++ b/app/Transformers/AccountTransformer.php @@ -93,7 +93,7 @@ class AccountTransformer extends EntityTransformer 'has_iap_plan' => (bool)$account->inapp_transaction_id, 'tax_api_enabled' => (bool) config('services.tax.zip_tax.key') ? true : false, 'nordigen_enabled' => (bool) (config('ninja.nordigen.secret_id') && config('ninja.nordigen.secret_key')) ? true : false, - 'upload_extensions' => (string) config('ninja.upload_extensions'), + 'upload_extensions' => (string) "png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx,webp,xml,zip,csv,ods,odt,odp,".config('ninja.upload_extensions'), ]; } diff --git a/app/Transformers/CompanyTransformer.php b/app/Transformers/CompanyTransformer.php index 97710a2b92a5..f13090bb63de 100644 --- a/app/Transformers/CompanyTransformer.php +++ b/app/Transformers/CompanyTransformer.php @@ -211,7 +211,7 @@ class CompanyTransformer extends EntityTransformer 'smtp_password' => $company->smtp_password ? '********' : '', 'smtp_local_domain' => (string)$company->smtp_local_domain ?? '', 'smtp_verify_peer' => (bool)$company->smtp_verify_peer, - // 'e_invoice' => $company->e_invoice ?: new \stdClass(), + 'e_invoice' => $company->e_invoice ?: new \stdClass(), ]; } diff --git a/app/Utils/HtmlEngine.php b/app/Utils/HtmlEngine.php index c0aa8f563fbb..69a782ea02a3 100644 --- a/app/Utils/HtmlEngine.php +++ b/app/Utils/HtmlEngine.php @@ -130,6 +130,8 @@ class HtmlEngine $data = []; + $data['$date_client_now'] = ['value' => now()->setTimezone($this->client->timezone()->name)->addSeconds($this->client->utc_offset())->format($this->client->date_format()), 'label' => '']; + $data['$date_company_now'] = ['value' => now()->setTimezone($this->company->timezone()->name)->addSeconds($this->company->utc_offset())->format($this->company->date_format()), 'label' => '']; $data['$global_margin'] = ['value' => '6.35mm', 'label' => '']; $data['$company_logo_size'] = ['value' => $this->resolveCompanyLogoSize(), 'label' => '']; $data['$show_shipping_address'] = ['value' => $this->settings->show_shipping_address ? 'flex' : 'none', 'label' => '']; diff --git a/composer.lock b/composer.lock index 3a62ab2f9a94..86e7b62c01a9 100644 --- a/composer.lock +++ b/composer.lock @@ -100,16 +100,16 @@ }, { "name": "apimatic/core", - "version": "0.3.10", + "version": "0.3.11", "source": { "type": "git", "url": "https://github.com/apimatic/core-lib-php.git", - "reference": "8c111790b8d6f67812ba651ebb9513b5233863d0" + "reference": "2274f103f9f210664f546f504e4559d772a81fee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/apimatic/core-lib-php/zipball/8c111790b8d6f67812ba651ebb9513b5233863d0", - "reference": "8c111790b8d6f67812ba651ebb9513b5233863d0", + "url": "https://api.github.com/repos/apimatic/core-lib-php/zipball/2274f103f9f210664f546f504e4559d772a81fee", + "reference": "2274f103f9f210664f546f504e4559d772a81fee", "shasum": "" }, "require": { @@ -148,9 +148,9 @@ ], "support": { "issues": "https://github.com/apimatic/core-lib-php/issues", - "source": "https://github.com/apimatic/core-lib-php/tree/0.3.10" + "source": "https://github.com/apimatic/core-lib-php/tree/0.3.11" }, - "time": "2024-05-30T06:32:24+00:00" + "time": "2024-07-08T11:50:08+00:00" }, { "name": "apimatic/core-interfaces", @@ -535,16 +535,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.315.1", + "version": "3.316.2", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "13871330833e167d098240dab74b8b069b9b07e3" + "reference": "4d8caae512c3be4d59ee6d583b3f82872dde5071" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/13871330833e167d098240dab74b8b069b9b07e3", - "reference": "13871330833e167d098240dab74b8b069b9b07e3", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/4d8caae512c3be4d59ee6d583b3f82872dde5071", + "reference": "4d8caae512c3be4d59ee6d583b3f82872dde5071", "shasum": "" }, "require": { @@ -624,9 +624,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.315.1" + "source": "https://github.com/aws/aws-sdk-php/tree/3.316.2" }, - "time": "2024-06-27T18:03:53+00:00" + "time": "2024-07-10T19:16:28+00:00" }, { "name": "bacon/bacon-qr-code", @@ -968,16 +968,16 @@ }, { "name": "checkout/checkout-sdk-php", - "version": "3.2.0", + "version": "3.2.1", "source": { "type": "git", "url": "https://github.com/checkout/checkout-sdk-php.git", - "reference": "99a01786fa44c3e0b1d6d2b207ab0c1ba4f742d3" + "reference": "91797beb18fd9b1581b1cfe5b96a551c0009417c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/checkout/checkout-sdk-php/zipball/99a01786fa44c3e0b1d6d2b207ab0c1ba4f742d3", - "reference": "99a01786fa44c3e0b1d6d2b207ab0c1ba4f742d3", + "url": "https://api.github.com/repos/checkout/checkout-sdk-php/zipball/91797beb18fd9b1581b1cfe5b96a551c0009417c", + "reference": "91797beb18fd9b1581b1cfe5b96a551c0009417c", "shasum": "" }, "require": { @@ -1030,9 +1030,9 @@ ], "support": { "issues": "https://github.com/checkout/checkout-sdk-php/issues", - "source": "https://github.com/checkout/checkout-sdk-php/tree/3.2.0" + "source": "https://github.com/checkout/checkout-sdk-php/tree/3.2.1" }, - "time": "2024-05-09T10:39:29+00:00" + "time": "2024-07-09T16:07:18+00:00" }, { "name": "clue/stream-filter", @@ -1102,16 +1102,16 @@ }, { "name": "composer/ca-bundle", - "version": "1.5.0", + "version": "1.5.1", "source": { "type": "git", "url": "https://github.com/composer/ca-bundle.git", - "reference": "0c5ccfcfea312b5c5a190a21ac5cef93f74baf99" + "reference": "063d9aa8696582f5a41dffbbaf3c81024f0a604a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/ca-bundle/zipball/0c5ccfcfea312b5c5a190a21ac5cef93f74baf99", - "reference": "0c5ccfcfea312b5c5a190a21ac5cef93f74baf99", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/063d9aa8696582f5a41dffbbaf3c81024f0a604a", + "reference": "063d9aa8696582f5a41dffbbaf3c81024f0a604a", "shasum": "" }, "require": { @@ -1121,7 +1121,7 @@ }, "require-dev": { "phpstan/phpstan": "^1.10", - "psr/log": "^1.0", + "psr/log": "^1.0 || ^2.0 || ^3.0", "symfony/phpunit-bridge": "^4.2 || ^5", "symfony/process": "^4.0 || ^5.0 || ^6.0 || ^7.0" }, @@ -1158,7 +1158,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/ca-bundle/issues", - "source": "https://github.com/composer/ca-bundle/tree/1.5.0" + "source": "https://github.com/composer/ca-bundle/tree/1.5.1" }, "funding": [ { @@ -1174,7 +1174,7 @@ "type": "tidelift" } ], - "time": "2024-03-15T14:00:32+00:00" + "time": "2024-07-08T15:28:20+00:00" }, { "name": "dasprid/enum", @@ -1287,16 +1287,16 @@ }, { "name": "dflydev/dot-access-data", - "version": "v3.0.2", + "version": "v3.0.3", "source": { "type": "git", "url": "https://github.com/dflydev/dflydev-dot-access-data.git", - "reference": "f41715465d65213d644d3141a6a93081be5d3549" + "reference": "a23a2bf4f31d3518f3ecb38660c95715dfead60f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/dflydev/dflydev-dot-access-data/zipball/f41715465d65213d644d3141a6a93081be5d3549", - "reference": "f41715465d65213d644d3141a6a93081be5d3549", + "url": "https://api.github.com/repos/dflydev/dflydev-dot-access-data/zipball/a23a2bf4f31d3518f3ecb38660c95715dfead60f", + "reference": "a23a2bf4f31d3518f3ecb38660c95715dfead60f", "shasum": "" }, "require": { @@ -1356,9 +1356,9 @@ ], "support": { "issues": "https://github.com/dflydev/dflydev-dot-access-data/issues", - "source": "https://github.com/dflydev/dflydev-dot-access-data/tree/v3.0.2" + "source": "https://github.com/dflydev/dflydev-dot-access-data/tree/v3.0.3" }, - "time": "2022-10-27T11:44:00+00:00" + "time": "2024-07-08T12:26:09+00:00" }, { "name": "doctrine/dbal", @@ -2512,34 +2512,34 @@ }, { "name": "google/apiclient", - "version": "v2.16.0", + "version": "v2.17.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-api-php-client.git", - "reference": "017400f609c1fb71ab5ad824c50eabd4c3eaf779" + "reference": "b1f63d72c44307ec8ef7bf18f1012de35d8944ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-api-php-client/zipball/017400f609c1fb71ab5ad824c50eabd4c3eaf779", - "reference": "017400f609c1fb71ab5ad824c50eabd4c3eaf779", + "url": "https://api.github.com/repos/googleapis/google-api-php-client/zipball/b1f63d72c44307ec8ef7bf18f1012de35d8944ed", + "reference": "b1f63d72c44307ec8ef7bf18f1012de35d8944ed", "shasum": "" }, "require": { - "firebase/php-jwt": "~6.0", + "firebase/php-jwt": "^6.0", "google/apiclient-services": "~0.350", "google/auth": "^1.37", - "guzzlehttp/guzzle": "^6.5.8||^7.4.5", - "guzzlehttp/psr7": "^1.9.1||^2.2.1", + "guzzlehttp/guzzle": "^7.4.5", + "guzzlehttp/psr7": "^2.6", "monolog/monolog": "^2.9||^3.0", - "php": "^7.4|^8.0", + "php": "^8.0", "phpseclib/phpseclib": "^3.0.36" }, "require-dev": { "cache/filesystem-adapter": "^1.1", "composer/composer": "^1.10.23", "phpcompatibility/php-compatibility": "^9.2", - "phpspec/prophecy-phpunit": "^2.0", - "phpunit/phpunit": "^9.5", + "phpspec/prophecy-phpunit": "^2.1", + "phpunit/phpunit": "^9.6", "squizlabs/php_codesniffer": "^3.8", "symfony/css-selector": "~2.1", "symfony/dom-crawler": "~2.1" @@ -2575,22 +2575,22 @@ ], "support": { "issues": "https://github.com/googleapis/google-api-php-client/issues", - "source": "https://github.com/googleapis/google-api-php-client/tree/v2.16.0" + "source": "https://github.com/googleapis/google-api-php-client/tree/v2.17.0" }, - "time": "2024-04-24T00:59:47+00:00" + "time": "2024-07-10T14:57:54+00:00" }, { "name": "google/apiclient-services", - "version": "v0.361.0", + "version": "v0.363.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-api-php-client-services.git", - "reference": "f90e9a059ce5a6076b4fc8571a4fac6564012782" + "reference": "5a0943e498e98e23dccdd98c5a3f74bc1b442053" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/f90e9a059ce5a6076b4fc8571a4fac6564012782", - "reference": "f90e9a059ce5a6076b4fc8571a4fac6564012782", + "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/5a0943e498e98e23dccdd98c5a3f74bc1b442053", + "reference": "5a0943e498e98e23dccdd98c5a3f74bc1b442053", "shasum": "" }, "require": { @@ -2619,22 +2619,22 @@ ], "support": { "issues": "https://github.com/googleapis/google-api-php-client-services/issues", - "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.361.0" + "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.363.0" }, - "time": "2024-06-23T01:02:19+00:00" + "time": "2024-07-02T01:04:18+00:00" }, { "name": "google/auth", - "version": "v1.40.0", + "version": "v1.41.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-auth-library-php.git", - "reference": "bff9f2d01677e71a98394b5ac981b99523df5178" + "reference": "1043ea18fe7f5dfbf5b208ce3ee6d6b6ab8cb038" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/bff9f2d01677e71a98394b5ac981b99523df5178", - "reference": "bff9f2d01677e71a98394b5ac981b99523df5178", + "url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/1043ea18fe7f5dfbf5b208ce3ee6d6b6ab8cb038", + "reference": "1043ea18fe7f5dfbf5b208ce3ee6d6b6ab8cb038", "shasum": "" }, "require": { @@ -2679,9 +2679,9 @@ "support": { "docs": "https://googleapis.github.io/google-auth-library-php/main/", "issues": "https://github.com/googleapis/google-auth-library-php/issues", - "source": "https://github.com/googleapis/google-auth-library-php/tree/v1.40.0" + "source": "https://github.com/googleapis/google-auth-library-php/tree/v1.41.0" }, - "time": "2024-05-31T19:16:15+00:00" + "time": "2024-07-10T15:21:07+00:00" }, { "name": "graham-campbell/result-type", @@ -3609,16 +3609,16 @@ }, { "name": "horstoeko/zugferd", - "version": "v1.0.56", + "version": "v1.0.57", "source": { "type": "git", "url": "https://github.com/horstoeko/zugferd.git", - "reference": "ae34e6450d125850c5c001100b459d46e9b37150" + "reference": "272e9baf94156496e0d7119616a9449b71f329d6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/horstoeko/zugferd/zipball/ae34e6450d125850c5c001100b459d46e9b37150", - "reference": "ae34e6450d125850c5c001100b459d46e9b37150", + "url": "https://api.github.com/repos/horstoeko/zugferd/zipball/272e9baf94156496e0d7119616a9449b71f329d6", + "reference": "272e9baf94156496e0d7119616a9449b71f329d6", "shasum": "" }, "require": { @@ -3678,9 +3678,9 @@ ], "support": { "issues": "https://github.com/horstoeko/zugferd/issues", - "source": "https://github.com/horstoeko/zugferd/tree/v1.0.56" + "source": "https://github.com/horstoeko/zugferd/tree/v1.0.57" }, - "time": "2024-06-15T05:49:47+00:00" + "time": "2024-07-10T03:39:20+00:00" }, { "name": "horstoeko/zugferdvisualizer", @@ -3788,16 +3788,16 @@ }, { "name": "imdhemy/appstore-iap", - "version": "1.6.1", + "version": "1.7.0", "source": { "type": "git", "url": "https://github.com/imdhemy/appstore-iap.git", - "reference": "025d176a097b864f306dad7dc3506598aa6e5990" + "reference": "c82aa2ad083c8029121ca4062c0bd494c09746c1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/imdhemy/appstore-iap/zipball/025d176a097b864f306dad7dc3506598aa6e5990", - "reference": "025d176a097b864f306dad7dc3506598aa6e5990", + "url": "https://api.github.com/repos/imdhemy/appstore-iap/zipball/c82aa2ad083c8029121ca4062c0bd494c09746c1", + "reference": "c82aa2ad083c8029121ca4062c0bd494c09746c1", "shasum": "" }, "require": { @@ -3805,9 +3805,10 @@ "ext-openssl": "*", "ext-sodium": "*", "guzzlehttp/guzzle": "^7.6.0", - "lcobucci/jwt": "^4.3", + "lcobucci/clock": "^3.0", + "lcobucci/jwt": "^5.3", "nesbot/carbon": "^2.66|^3.1", - "php": ">=8.0" + "php": ">=8.1" }, "require-dev": { "fakerphp/faker": "^1.22", @@ -3835,9 +3836,9 @@ "description": "PHP Appstore In-App Purchase implementation", "support": { "issues": "https://github.com/imdhemy/appstore-iap/issues", - "source": "https://github.com/imdhemy/appstore-iap/tree/1.6.1" + "source": "https://github.com/imdhemy/appstore-iap/tree/1.7.0" }, - "time": "2024-03-27T09:17:17+00:00" + "time": "2024-06-30T18:08:57+00:00" }, { "name": "imdhemy/google-play-billing", @@ -3892,16 +3893,16 @@ }, { "name": "imdhemy/laravel-purchases", - "version": "1.12.1", + "version": "1.13.0", "source": { "type": "git", "url": "https://github.com/imdhemy/laravel-in-app-purchases.git", - "reference": "487cc34363a598f18a6db89b3b3eebb97974e337" + "reference": "ec62ab94727b22b262f79e05ece0bd92a919e9d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/imdhemy/laravel-in-app-purchases/zipball/487cc34363a598f18a6db89b3b3eebb97974e337", - "reference": "487cc34363a598f18a6db89b3b3eebb97974e337", + "url": "https://api.github.com/repos/imdhemy/laravel-in-app-purchases/zipball/ec62ab94727b22b262f79e05ece0bd92a919e9d4", + "reference": "ec62ab94727b22b262f79e05ece0bd92a919e9d4", "shasum": "" }, "require": { @@ -3910,7 +3911,7 @@ "imdhemy/appstore-iap": "^1.6", "imdhemy/google-play-billing": "^1.5", "laravel/framework": ">=8.0", - "php": ">=8.0" + "php": ">=8.1" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.14", @@ -3957,7 +3958,7 @@ ], "support": { "issues": "https://github.com/imdhemy/laravel-in-app-purchases/issues", - "source": "https://github.com/imdhemy/laravel-in-app-purchases/tree/1.12.1" + "source": "https://github.com/imdhemy/laravel-in-app-purchases/tree/1.13.0" }, "funding": [ { @@ -3965,7 +3966,7 @@ "type": "github" } ], - "time": "2024-06-11T12:40:12+00:00" + "time": "2024-06-30T11:32:33+00:00" }, { "name": "intervention/image", @@ -4057,12 +4058,12 @@ "source": { "type": "git", "url": "https://github.com/invoiceninja/einvoice.git", - "reference": "468a2a3696e76b1216a129e79177eb7c16ea9bdb" + "reference": "29736fb1a007f5fa52aee811397e1ef6611b1b8d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/invoiceninja/einvoice/zipball/468a2a3696e76b1216a129e79177eb7c16ea9bdb", - "reference": "468a2a3696e76b1216a129e79177eb7c16ea9bdb", + "url": "https://api.github.com/repos/invoiceninja/einvoice/zipball/29736fb1a007f5fa52aee811397e1ef6611b1b8d", + "reference": "29736fb1a007f5fa52aee811397e1ef6611b1b8d", "shasum": "" }, "require": { @@ -4104,7 +4105,7 @@ "source": "https://github.com/invoiceninja/einvoice/tree/main", "issues": "https://github.com/invoiceninja/einvoice/issues" }, - "time": "2024-06-19T00:29:39+00:00" + "time": "2024-07-11T06:34:33+00:00" }, { "name": "invoiceninja/inspector", @@ -4609,16 +4610,16 @@ }, { "name": "laravel/framework", - "version": "v11.13.0", + "version": "v11.15.0", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "92deaa4f037ff100e36809443811301819a8cf84" + "reference": "ba85f1c019bed59b3c736c9c4502805efd0ba84b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/92deaa4f037ff100e36809443811301819a8cf84", - "reference": "92deaa4f037ff100e36809443811301819a8cf84", + "url": "https://api.github.com/repos/laravel/framework/zipball/ba85f1c019bed59b3c736c9c4502805efd0ba84b", + "reference": "ba85f1c019bed59b3c736c9c4502805efd0ba84b", "shasum": "" }, "require": { @@ -4671,6 +4672,7 @@ }, "provide": { "psr/container-implementation": "1.1|2.0", + "psr/log-implementation": "1.0|2.0|3.0", "psr/simple-cache-implementation": "1.0|2.0|3.0" }, "replace": { @@ -4723,7 +4725,7 @@ "nyholm/psr7": "^1.2", "orchestra/testbench-core": "^9.1.5", "pda/pheanstalk": "^5.0", - "phpstan/phpstan": "^1.4.7", + "phpstan/phpstan": "^1.11.5", "phpunit/phpunit": "^10.5|^11.0", "predis/predis": "^2.0.2", "resend/resend-php": "^0.10.0", @@ -4810,20 +4812,20 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2024-06-27T09:04:50+00:00" + "time": "2024-07-09T15:38:12+00:00" }, { "name": "laravel/pint", - "version": "v1.16.1", + "version": "v1.16.2", "source": { "type": "git", "url": "https://github.com/laravel/pint.git", - "reference": "9266a47f1b9231b83e0cfd849009547329d871b1" + "reference": "51f1ba679a6afe0315621ad143d788bd7ded0eca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/pint/zipball/9266a47f1b9231b83e0cfd849009547329d871b1", - "reference": "9266a47f1b9231b83e0cfd849009547329d871b1", + "url": "https://api.github.com/repos/laravel/pint/zipball/51f1ba679a6afe0315621ad143d788bd7ded0eca", + "reference": "51f1ba679a6afe0315621ad143d788bd7ded0eca", "shasum": "" }, "require": { @@ -4876,7 +4878,7 @@ "issues": "https://github.com/laravel/pint/issues", "source": "https://github.com/laravel/pint" }, - "time": "2024-06-18T16:50:05+00:00" + "time": "2024-07-09T15:58:08+00:00" }, { "name": "laravel/prompts", @@ -5063,16 +5065,16 @@ }, { "name": "laravel/socialite", - "version": "v5.15.0", + "version": "v5.15.1", "source": { "type": "git", "url": "https://github.com/laravel/socialite.git", - "reference": "c8234bfb286a8210df8d62f94562c71bfda4a446" + "reference": "cc02625f0bd1f95dc3688eb041cce0f1e709d029" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/socialite/zipball/c8234bfb286a8210df8d62f94562c71bfda4a446", - "reference": "c8234bfb286a8210df8d62f94562c71bfda4a446", + "url": "https://api.github.com/repos/laravel/socialite/zipball/cc02625f0bd1f95dc3688eb041cce0f1e709d029", + "reference": "cc02625f0bd1f95dc3688eb041cce0f1e709d029", "shasum": "" }, "require": { @@ -5131,7 +5133,7 @@ "issues": "https://github.com/laravel/socialite/issues", "source": "https://github.com/laravel/socialite" }, - "time": "2024-06-11T13:33:20+00:00" + "time": "2024-06-28T20:09:34+00:00" }, { "name": "laravel/tinker", @@ -5328,39 +5330,38 @@ }, { "name": "lcobucci/jwt", - "version": "4.3.0", + "version": "5.3.0", "source": { "type": "git", "url": "https://github.com/lcobucci/jwt.git", - "reference": "4d7de2fe0d51a96418c0d04004986e410e87f6b4" + "reference": "08071d8d2c7f4b00222cc4b1fb6aa46990a80f83" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/lcobucci/jwt/zipball/4d7de2fe0d51a96418c0d04004986e410e87f6b4", - "reference": "4d7de2fe0d51a96418c0d04004986e410e87f6b4", + "url": "https://api.github.com/repos/lcobucci/jwt/zipball/08071d8d2c7f4b00222cc4b1fb6aa46990a80f83", + "reference": "08071d8d2c7f4b00222cc4b1fb6aa46990a80f83", "shasum": "" }, "require": { - "ext-hash": "*", - "ext-json": "*", - "ext-mbstring": "*", "ext-openssl": "*", "ext-sodium": "*", - "lcobucci/clock": "^2.0 || ^3.0", - "php": "^7.4 || ^8.0" + "php": "~8.1.0 || ~8.2.0 || ~8.3.0", + "psr/clock": "^1.0" }, "require-dev": { - "infection/infection": "^0.21", - "lcobucci/coding-standard": "^6.0", - "mikey179/vfsstream": "^1.6.7", - "phpbench/phpbench": "^1.2", - "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^1.4", - "phpstan/phpstan-deprecation-rules": "^1.0", - "phpstan/phpstan-phpunit": "^1.0", - "phpstan/phpstan-strict-rules": "^1.0", - "phpunit/php-invoker": "^3.1", - "phpunit/phpunit": "^9.5" + "infection/infection": "^0.27.0", + "lcobucci/clock": "^3.0", + "lcobucci/coding-standard": "^11.0", + "phpbench/phpbench": "^1.2.9", + "phpstan/extension-installer": "^1.2", + "phpstan/phpstan": "^1.10.7", + "phpstan/phpstan-deprecation-rules": "^1.1.3", + "phpstan/phpstan-phpunit": "^1.3.10", + "phpstan/phpstan-strict-rules": "^1.5.0", + "phpunit/phpunit": "^10.2.6" + }, + "suggest": { + "lcobucci/clock": ">= 3.0" }, "type": "library", "autoload": { @@ -5386,7 +5387,7 @@ ], "support": { "issues": "https://github.com/lcobucci/jwt/issues", - "source": "https://github.com/lcobucci/jwt/tree/4.3.0" + "source": "https://github.com/lcobucci/jwt/tree/5.3.0" }, "funding": [ { @@ -5398,7 +5399,7 @@ "type": "patreon" } ], - "time": "2023-01-02T13:28:00+00:00" + "time": "2024-04-11T23:07:54+00:00" }, { "name": "league/commonmark", @@ -6130,16 +6131,16 @@ }, { "name": "livewire/livewire", - "version": "v3.5.1", + "version": "v3.5.2", "source": { "type": "git", "url": "https://github.com/livewire/livewire.git", - "reference": "da044261bb5c5449397f18fda3409f14acf47c0a" + "reference": "636725c1f87bc7844dd80277488268db27eec1aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/livewire/livewire/zipball/da044261bb5c5449397f18fda3409f14acf47c0a", - "reference": "da044261bb5c5449397f18fda3409f14acf47c0a", + "url": "https://api.github.com/repos/livewire/livewire/zipball/636725c1f87bc7844dd80277488268db27eec1aa", + "reference": "636725c1f87bc7844dd80277488268db27eec1aa", "shasum": "" }, "require": { @@ -6194,7 +6195,7 @@ "description": "A front-end framework for Laravel.", "support": { "issues": "https://github.com/livewire/livewire/issues", - "source": "https://github.com/livewire/livewire/tree/v3.5.1" + "source": "https://github.com/livewire/livewire/tree/v3.5.2" }, "funding": [ { @@ -6202,7 +6203,7 @@ "type": "github" } ], - "time": "2024-06-18T11:10:42+00:00" + "time": "2024-07-03T17:22:45+00:00" }, { "name": "maennchen/zipstream-php", @@ -6513,16 +6514,16 @@ }, { "name": "mollie/mollie-api-php", - "version": "v2.69.0", + "version": "v2.70.0", "source": { "type": "git", "url": "https://github.com/mollie/mollie-api-php.git", - "reference": "9a53f8bd6c89ae3e62982921a2f9d8ed68f9900d" + "reference": "a825578aba98605db3f6b6bc5b86c196276dc3f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mollie/mollie-api-php/zipball/9a53f8bd6c89ae3e62982921a2f9d8ed68f9900d", - "reference": "9a53f8bd6c89ae3e62982921a2f9d8ed68f9900d", + "url": "https://api.github.com/repos/mollie/mollie-api-php/zipball/a825578aba98605db3f6b6bc5b86c196276dc3f9", + "reference": "a825578aba98605db3f6b6bc5b86c196276dc3f9", "shasum": "" }, "require": { @@ -6599,9 +6600,9 @@ ], "support": { "issues": "https://github.com/mollie/mollie-api-php/issues", - "source": "https://github.com/mollie/mollie-api-php/tree/v2.69.0" + "source": "https://github.com/mollie/mollie-api-php/tree/v2.70.0" }, - "time": "2024-06-24T11:52:46+00:00" + "time": "2024-07-03T19:11:11+00:00" }, { "name": "moneyphp/money", @@ -6693,16 +6694,16 @@ }, { "name": "monolog/monolog", - "version": "3.6.0", + "version": "3.7.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "4b18b21a5527a3d5ffdac2fd35d3ab25a9597654" + "reference": "f4393b648b78a5408747de94fca38beb5f7e9ef8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/4b18b21a5527a3d5ffdac2fd35d3ab25a9597654", - "reference": "4b18b21a5527a3d5ffdac2fd35d3ab25a9597654", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/f4393b648b78a5408747de94fca38beb5f7e9ef8", + "reference": "f4393b648b78a5408747de94fca38beb5f7e9ef8", "shasum": "" }, "require": { @@ -6778,7 +6779,7 @@ ], "support": { "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/3.6.0" + "source": "https://github.com/Seldaek/monolog/tree/3.7.0" }, "funding": [ { @@ -6790,7 +6791,7 @@ "type": "tidelift" } ], - "time": "2024-04-12T21:02:21+00:00" + "time": "2024-06-28T09:40:51+00:00" }, { "name": "mpdf/mpdf", @@ -7420,16 +7421,16 @@ }, { "name": "nikic/php-parser", - "version": "v5.0.2", + "version": "v5.1.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13" + "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/139676794dc1e9231bf7bcd123cfc0c99182cb13", - "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/683130c2ff8c2739f4822ff7ac5c873ec529abd1", + "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1", "shasum": "" }, "require": { @@ -7440,7 +7441,7 @@ }, "require-dev": { "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^9.0" }, "bin": [ "bin/php-parse" @@ -7472,9 +7473,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.0.2" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.1.0" }, - "time": "2024-03-05T20:51:40+00:00" + "time": "2024-07-01T20:03:41+00:00" }, { "name": "nordigen/nordigen-php", @@ -10183,16 +10184,16 @@ }, { "name": "rmccue/requests", - "version": "v2.0.11", + "version": "v2.0.12", "source": { "type": "git", "url": "https://github.com/WordPress/Requests.git", - "reference": "31435a468e2357e68df743f2527bda32556a0818" + "reference": "fb67e3d392ff6b89a90e96f19745662f4ecd62b1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/WordPress/Requests/zipball/31435a468e2357e68df743f2527bda32556a0818", - "reference": "31435a468e2357e68df743f2527bda32556a0818", + "url": "https://api.github.com/repos/WordPress/Requests/zipball/fb67e3d392ff6b89a90e96f19745662f4ecd62b1", + "reference": "fb67e3d392ff6b89a90e96f19745662f4ecd62b1", "shasum": "" }, "require": { @@ -10266,20 +10267,20 @@ "issues": "https://github.com/WordPress/Requests/issues", "source": "https://github.com/WordPress/Requests" }, - "time": "2024-03-25T10:48:46+00:00" + "time": "2024-07-08T08:10:42+00:00" }, { "name": "sabberworm/php-css-parser", - "version": "v8.5.1", + "version": "v8.6.0", "source": { "type": "git", "url": "https://github.com/MyIntervals/PHP-CSS-Parser.git", - "reference": "4a3d572b0f8b28bb6fd016ae8bbfc445facef152" + "reference": "d2fb94a9641be84d79c7548c6d39bbebba6e9a70" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/MyIntervals/PHP-CSS-Parser/zipball/4a3d572b0f8b28bb6fd016ae8bbfc445facef152", - "reference": "4a3d572b0f8b28bb6fd016ae8bbfc445facef152", + "url": "https://api.github.com/repos/MyIntervals/PHP-CSS-Parser/zipball/d2fb94a9641be84d79c7548c6d39bbebba6e9a70", + "reference": "d2fb94a9641be84d79c7548c6d39bbebba6e9a70", "shasum": "" }, "require": { @@ -10329,9 +10330,9 @@ ], "support": { "issues": "https://github.com/MyIntervals/PHP-CSS-Parser/issues", - "source": "https://github.com/MyIntervals/PHP-CSS-Parser/tree/v8.5.1" + "source": "https://github.com/MyIntervals/PHP-CSS-Parser/tree/v8.6.0" }, - "time": "2024-02-15T16:41:13+00:00" + "time": "2024-07-01T07:33:21+00:00" }, { "name": "sabre/uri", @@ -10960,16 +10961,16 @@ }, { "name": "socialiteproviders/microsoft", - "version": "4.3.0", + "version": "4.5.0", "source": { "type": "git", "url": "https://github.com/SocialiteProviders/Microsoft.git", - "reference": "9cda621d75b8681b9c0a015a766f05aa5d29d1d0" + "reference": "1a9928cb3091698c5c5ad108f5ff3b8a594e84fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/SocialiteProviders/Microsoft/zipball/9cda621d75b8681b9c0a015a766f05aa5d29d1d0", - "reference": "9cda621d75b8681b9c0a015a766f05aa5d29d1d0", + "url": "https://api.github.com/repos/SocialiteProviders/Microsoft/zipball/1a9928cb3091698c5c5ad108f5ff3b8a594e84fc", + "reference": "1a9928cb3091698c5c5ad108f5ff3b8a594e84fc", "shasum": "" }, "require": { @@ -11006,7 +11007,7 @@ "issues": "https://github.com/socialiteproviders/providers/issues", "source": "https://github.com/socialiteproviders/providers" }, - "time": "2024-05-13T22:57:35+00:00" + "time": "2024-07-09T22:42:09+00:00" }, { "name": "sprain/swiss-qr-bill", @@ -11337,16 +11338,16 @@ }, { "name": "symfony/console", - "version": "v7.1.1", + "version": "v7.1.2", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "9b008f2d7b21c74ef4d0c3de6077a642bc55ece3" + "reference": "0aa29ca177f432ab68533432db0de059f39c92ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/9b008f2d7b21c74ef4d0c3de6077a642bc55ece3", - "reference": "9b008f2d7b21c74ef4d0c3de6077a642bc55ece3", + "url": "https://api.github.com/repos/symfony/console/zipball/0aa29ca177f432ab68533432db0de059f39c92ae", + "reference": "0aa29ca177f432ab68533432db0de059f39c92ae", "shasum": "" }, "require": { @@ -11410,7 +11411,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v7.1.1" + "source": "https://github.com/symfony/console/tree/v7.1.2" }, "funding": [ { @@ -11426,7 +11427,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:57:53+00:00" + "time": "2024-06-28T10:03:55+00:00" }, { "name": "symfony/css-selector", @@ -11562,16 +11563,16 @@ }, { "name": "symfony/error-handler", - "version": "v7.1.1", + "version": "v7.1.2", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", - "reference": "e9b8bbce0b4f322939332ab7b6b81d8c11da27dd" + "reference": "2412d3dddb5c9ea51a39cfbff1c565fc9844ca32" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/e9b8bbce0b4f322939332ab7b6b81d8c11da27dd", - "reference": "e9b8bbce0b4f322939332ab7b6b81d8c11da27dd", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/2412d3dddb5c9ea51a39cfbff1c565fc9844ca32", + "reference": "2412d3dddb5c9ea51a39cfbff1c565fc9844ca32", "shasum": "" }, "require": { @@ -11617,7 +11618,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/v7.1.1" + "source": "https://github.com/symfony/error-handler/tree/v7.1.2" }, "funding": [ { @@ -11633,7 +11634,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:57:53+00:00" + "time": "2024-06-25T19:55:06+00:00" }, { "name": "symfony/event-dispatcher", @@ -11793,16 +11794,16 @@ }, { "name": "symfony/filesystem", - "version": "v7.1.1", + "version": "v7.1.2", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "802e87002f919296c9f606457d9fa327a0b3d6b2" + "reference": "92a91985250c251de9b947a14bb2c9390b1a562c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/802e87002f919296c9f606457d9fa327a0b3d6b2", - "reference": "802e87002f919296c9f606457d9fa327a0b3d6b2", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/92a91985250c251de9b947a14bb2c9390b1a562c", + "reference": "92a91985250c251de9b947a14bb2c9390b1a562c", "shasum": "" }, "require": { @@ -11839,7 +11840,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v7.1.1" + "source": "https://github.com/symfony/filesystem/tree/v7.1.2" }, "funding": [ { @@ -11855,7 +11856,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:57:53+00:00" + "time": "2024-06-28T10:03:55+00:00" }, { "name": "symfony/finder", @@ -11923,16 +11924,16 @@ }, { "name": "symfony/http-client", - "version": "v6.4.8", + "version": "v6.4.9", "source": { "type": "git", "url": "https://github.com/symfony/http-client.git", - "reference": "61faba993e620fc22d4f0ab3b6bcf8fbb0d44b05" + "reference": "6e9db0025db565bcf8f1d46ed734b549e51e6045" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client/zipball/61faba993e620fc22d4f0ab3b6bcf8fbb0d44b05", - "reference": "61faba993e620fc22d4f0ab3b6bcf8fbb0d44b05", + "url": "https://api.github.com/repos/symfony/http-client/zipball/6e9db0025db565bcf8f1d46ed734b549e51e6045", + "reference": "6e9db0025db565bcf8f1d46ed734b549e51e6045", "shasum": "" }, "require": { @@ -11996,7 +11997,7 @@ "http" ], "support": { - "source": "https://github.com/symfony/http-client/tree/v6.4.8" + "source": "https://github.com/symfony/http-client/tree/v6.4.9" }, "funding": [ { @@ -12012,7 +12013,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-06-28T07:59:05+00:00" }, { "name": "symfony/http-client-contracts", @@ -12171,16 +12172,16 @@ }, { "name": "symfony/http-kernel", - "version": "v7.1.1", + "version": "v7.1.2", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "fa8d1c75b5f33b1302afccf81811f93976c6e26f" + "reference": "ae3fa717db4d41a55d14c2bd92399e37cf5bc0f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/fa8d1c75b5f33b1302afccf81811f93976c6e26f", - "reference": "fa8d1c75b5f33b1302afccf81811f93976c6e26f", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/ae3fa717db4d41a55d14c2bd92399e37cf5bc0f6", + "reference": "ae3fa717db4d41a55d14c2bd92399e37cf5bc0f6", "shasum": "" }, "require": { @@ -12265,7 +12266,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/v7.1.1" + "source": "https://github.com/symfony/http-kernel/tree/v7.1.2" }, "funding": [ { @@ -12281,7 +12282,7 @@ "type": "tidelift" } ], - "time": "2024-06-04T06:52:15+00:00" + "time": "2024-06-28T13:13:31+00:00" }, { "name": "symfony/intl", @@ -12371,16 +12372,16 @@ }, { "name": "symfony/mailer", - "version": "v7.1.1", + "version": "v7.1.2", "source": { "type": "git", "url": "https://github.com/symfony/mailer.git", - "reference": "2eaad2e167cae930f25a3d731fec8b2ded5e751e" + "reference": "8fcff0af9043c8f8a8e229437cea363e282f9aee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mailer/zipball/2eaad2e167cae930f25a3d731fec8b2ded5e751e", - "reference": "2eaad2e167cae930f25a3d731fec8b2ded5e751e", + "url": "https://api.github.com/repos/symfony/mailer/zipball/8fcff0af9043c8f8a8e229437cea363e282f9aee", + "reference": "8fcff0af9043c8f8a8e229437cea363e282f9aee", "shasum": "" }, "require": { @@ -12431,7 +12432,7 @@ "description": "Helps sending emails", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/mailer/tree/v7.1.1" + "source": "https://github.com/symfony/mailer/tree/v7.1.2" }, "funding": [ { @@ -12447,20 +12448,20 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:57:53+00:00" + "time": "2024-06-28T08:00:31+00:00" }, { "name": "symfony/mailgun-mailer", - "version": "v6.4.8", + "version": "v6.4.9", "source": { "type": "git", "url": "https://github.com/symfony/mailgun-mailer.git", - "reference": "748e534d760f9a9318319cbd2adec7c05055ee3c" + "reference": "c4917eb14f31fb5c21442375c6baf7f51bd924e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mailgun-mailer/zipball/748e534d760f9a9318319cbd2adec7c05055ee3c", - "reference": "748e534d760f9a9318319cbd2adec7c05055ee3c", + "url": "https://api.github.com/repos/symfony/mailgun-mailer/zipball/c4917eb14f31fb5c21442375c6baf7f51bd924e8", + "reference": "c4917eb14f31fb5c21442375c6baf7f51bd924e8", "shasum": "" }, "require": { @@ -12500,7 +12501,7 @@ "description": "Symfony Mailgun Mailer Bridge", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/mailgun-mailer/tree/v6.4.8" + "source": "https://github.com/symfony/mailgun-mailer/tree/v6.4.9" }, "funding": [ { @@ -12516,20 +12517,20 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-06-28T07:59:05+00:00" }, { "name": "symfony/mime", - "version": "v7.1.1", + "version": "v7.1.2", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "21027eaacc1a8a20f5e616c25c3580f5dd3a15df" + "reference": "26a00b85477e69a4bab63b66c5dce64f18b0cbfc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/21027eaacc1a8a20f5e616c25c3580f5dd3a15df", - "reference": "21027eaacc1a8a20f5e616c25c3580f5dd3a15df", + "url": "https://api.github.com/repos/symfony/mime/zipball/26a00b85477e69a4bab63b66c5dce64f18b0cbfc", + "reference": "26a00b85477e69a4bab63b66c5dce64f18b0cbfc", "shasum": "" }, "require": { @@ -12584,7 +12585,7 @@ "mime-type" ], "support": { - "source": "https://github.com/symfony/mime/tree/v7.1.1" + "source": "https://github.com/symfony/mime/tree/v7.1.2" }, "funding": [ { @@ -12600,7 +12601,7 @@ "type": "tidelift" } ], - "time": "2024-06-04T06:40:14+00:00" + "time": "2024-06-28T10:03:55+00:00" }, { "name": "symfony/options-resolver", @@ -13672,16 +13673,16 @@ }, { "name": "symfony/property-info", - "version": "v7.1.1", + "version": "v7.1.2", "source": { "type": "git", "url": "https://github.com/symfony/property-info.git", - "reference": "0f80f818c6728f15de30a4f89866d68e4912ae84" + "reference": "d7b91e4aa07e822a9b935fc29a7254c12d502f16" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/property-info/zipball/0f80f818c6728f15de30a4f89866d68e4912ae84", - "reference": "0f80f818c6728f15de30a4f89866d68e4912ae84", + "url": "https://api.github.com/repos/symfony/property-info/zipball/d7b91e4aa07e822a9b935fc29a7254c12d502f16", + "reference": "d7b91e4aa07e822a9b935fc29a7254c12d502f16", "shasum": "" }, "require": { @@ -13736,7 +13737,7 @@ "validator" ], "support": { - "source": "https://github.com/symfony/property-info/tree/v7.1.1" + "source": "https://github.com/symfony/property-info/tree/v7.1.2" }, "funding": [ { @@ -13752,7 +13753,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:57:53+00:00" + "time": "2024-06-26T07:21:35+00:00" }, { "name": "symfony/psr-http-message-bridge", @@ -13920,16 +13921,16 @@ }, { "name": "symfony/serializer", - "version": "v7.1.1", + "version": "v7.1.2", "source": { "type": "git", "url": "https://github.com/symfony/serializer.git", - "reference": "74817ee48e37cce1a1b33c66ffdb750e7e048c3c" + "reference": "d2077674aaaff02a95f290de512aa358947e6bbe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/serializer/zipball/74817ee48e37cce1a1b33c66ffdb750e7e048c3c", - "reference": "74817ee48e37cce1a1b33c66ffdb750e7e048c3c", + "url": "https://api.github.com/repos/symfony/serializer/zipball/d2077674aaaff02a95f290de512aa358947e6bbe", + "reference": "d2077674aaaff02a95f290de512aa358947e6bbe", "shasum": "" }, "require": { @@ -13997,7 +13998,7 @@ "description": "Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON.", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/serializer/tree/v7.1.1" + "source": "https://github.com/symfony/serializer/tree/v7.1.2" }, "funding": [ { @@ -14013,7 +14014,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:57:53+00:00" + "time": "2024-06-28T07:42:43+00:00" }, { "name": "symfony/service-contracts", @@ -14100,16 +14101,16 @@ }, { "name": "symfony/string", - "version": "v7.1.1", + "version": "v7.1.2", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "60bc311c74e0af215101235aa6f471bcbc032df2" + "reference": "14221089ac66cf82e3cf3d1c1da65de305587ff8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/60bc311c74e0af215101235aa6f471bcbc032df2", - "reference": "60bc311c74e0af215101235aa6f471bcbc032df2", + "url": "https://api.github.com/repos/symfony/string/zipball/14221089ac66cf82e3cf3d1c1da65de305587ff8", + "reference": "14221089ac66cf82e3cf3d1c1da65de305587ff8", "shasum": "" }, "require": { @@ -14167,7 +14168,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v7.1.1" + "source": "https://github.com/symfony/string/tree/v7.1.2" }, "funding": [ { @@ -14183,7 +14184,7 @@ "type": "tidelift" } ], - "time": "2024-06-04T06:40:14+00:00" + "time": "2024-06-28T09:27:18+00:00" }, { "name": "symfony/translation", @@ -14515,16 +14516,16 @@ }, { "name": "symfony/validator", - "version": "v7.1.1", + "version": "v7.1.2", "source": { "type": "git", "url": "https://github.com/symfony/validator.git", - "reference": "fcab7598968b21c361becc930fcae8846638c4c0" + "reference": "bed12b7d5bd4dac452db5fa6203331c876b489e7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/validator/zipball/fcab7598968b21c361becc930fcae8846638c4c0", - "reference": "fcab7598968b21c361becc930fcae8846638c4c0", + "url": "https://api.github.com/repos/symfony/validator/zipball/bed12b7d5bd4dac452db5fa6203331c876b489e7", + "reference": "bed12b7d5bd4dac452db5fa6203331c876b489e7", "shasum": "" }, "require": { @@ -14592,7 +14593,7 @@ "description": "Provides tools to validate values", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/validator/tree/v7.1.1" + "source": "https://github.com/symfony/validator/tree/v7.1.2" }, "funding": [ { @@ -14608,20 +14609,20 @@ "type": "tidelift" } ], - "time": "2024-06-04T05:58:56+00:00" + "time": "2024-06-25T19:55:06+00:00" }, { "name": "symfony/var-dumper", - "version": "v7.1.1", + "version": "v7.1.2", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "deb2c2b506ff6fdbb340e00b34e9901e1605f293" + "reference": "5857c57c6b4b86524c08cf4f4bc95327270a816d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/deb2c2b506ff6fdbb340e00b34e9901e1605f293", - "reference": "deb2c2b506ff6fdbb340e00b34e9901e1605f293", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/5857c57c6b4b86524c08cf4f4bc95327270a816d", + "reference": "5857c57c6b4b86524c08cf4f4bc95327270a816d", "shasum": "" }, "require": { @@ -14675,7 +14676,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v7.1.1" + "source": "https://github.com/symfony/var-dumper/tree/v7.1.2" }, "funding": [ { @@ -14691,7 +14692,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:57:53+00:00" + "time": "2024-06-28T08:00:31+00:00" }, { "name": "symfony/yaml", @@ -16461,16 +16462,16 @@ }, { "name": "larastan/larastan", - "version": "v2.9.7", + "version": "v2.9.8", "source": { "type": "git", "url": "https://github.com/larastan/larastan.git", - "reference": "5c805f636095cc2e0b659e3954775cf8f1dad1bb" + "reference": "340badd89b0eb5bddbc503a4829c08cf9a2819d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/larastan/larastan/zipball/5c805f636095cc2e0b659e3954775cf8f1dad1bb", - "reference": "5c805f636095cc2e0b659e3954775cf8f1dad1bb", + "url": "https://api.github.com/repos/larastan/larastan/zipball/340badd89b0eb5bddbc503a4829c08cf9a2819d7", + "reference": "340badd89b0eb5bddbc503a4829c08cf9a2819d7", "shasum": "" }, "require": { @@ -16484,7 +16485,7 @@ "illuminate/support": "^9.52.16 || ^10.28.0 || ^11.0", "php": "^8.0.2", "phpmyadmin/sql-parser": "^5.9.0", - "phpstan/phpstan": "^1.11.1" + "phpstan/phpstan": "^1.11.2" }, "require-dev": { "doctrine/coding-standard": "^12.0", @@ -16539,7 +16540,7 @@ ], "support": { "issues": "https://github.com/larastan/larastan/issues", - "source": "https://github.com/larastan/larastan/tree/v2.9.7" + "source": "https://github.com/larastan/larastan/tree/v2.9.8" }, "funding": [ { @@ -16559,7 +16560,7 @@ "type": "patreon" } ], - "time": "2024-05-27T18:33:26+00:00" + "time": "2024-07-06T17:46:02+00:00" }, { "name": "maximebf/debugbar", @@ -17017,16 +17018,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.11.5", + "version": "1.11.7", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "490f0ae1c92b082f154681d7849aee776a7c1443" + "reference": "52d2bbfdcae7f895915629e4694e9497d0f8e28d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/490f0ae1c92b082f154681d7849aee776a7c1443", - "reference": "490f0ae1c92b082f154681d7849aee776a7c1443", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/52d2bbfdcae7f895915629e4694e9497d0f8e28d", + "reference": "52d2bbfdcae7f895915629e4694e9497d0f8e28d", "shasum": "" }, "require": { @@ -17071,20 +17072,20 @@ "type": "github" } ], - "time": "2024-06-17T15:10:54+00:00" + "time": "2024-07-06T11:17:41+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "10.1.14", + "version": "10.1.15", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "e3f51450ebffe8e0efdf7346ae966a656f7d5e5b" + "reference": "5da8b1728acd1e6ffdf2ff32ffbdfd04307f26ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/e3f51450ebffe8e0efdf7346ae966a656f7d5e5b", - "reference": "e3f51450ebffe8e0efdf7346ae966a656f7d5e5b", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/5da8b1728acd1e6ffdf2ff32ffbdfd04307f26ae", + "reference": "5da8b1728acd1e6ffdf2ff32ffbdfd04307f26ae", "shasum": "" }, "require": { @@ -17141,7 +17142,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.14" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.15" }, "funding": [ { @@ -17149,7 +17150,7 @@ "type": "github" } ], - "time": "2024-03-12T15:33:41+00:00" + "time": "2024-06-29T08:25:15+00:00" }, { "name": "phpunit/php-file-iterator", @@ -17396,16 +17397,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.5.24", + "version": "10.5.27", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "5f124e3e3e561006047b532fd0431bf5bb6b9015" + "reference": "2425f713b2a5350568ccb1a2d3984841a23e83c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/5f124e3e3e561006047b532fd0431bf5bb6b9015", - "reference": "5f124e3e3e561006047b532fd0431bf5bb6b9015", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2425f713b2a5350568ccb1a2d3984841a23e83c5", + "reference": "2425f713b2a5350568ccb1a2d3984841a23e83c5", "shasum": "" }, "require": { @@ -17415,26 +17416,26 @@ "ext-mbstring": "*", "ext-xml": "*", "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.10.1", - "phar-io/manifest": "^2.0.3", - "phar-io/version": "^3.0.2", + "myclabs/deep-copy": "^1.12.0", + "phar-io/manifest": "^2.0.4", + "phar-io/version": "^3.2.1", "php": ">=8.1", - "phpunit/php-code-coverage": "^10.1.5", - "phpunit/php-file-iterator": "^4.0", - "phpunit/php-invoker": "^4.0", - "phpunit/php-text-template": "^3.0", - "phpunit/php-timer": "^6.0", - "sebastian/cli-parser": "^2.0", - "sebastian/code-unit": "^2.0", - "sebastian/comparator": "^5.0", - "sebastian/diff": "^5.0", - "sebastian/environment": "^6.0", - "sebastian/exporter": "^5.1", - "sebastian/global-state": "^6.0.1", - "sebastian/object-enumerator": "^5.0", - "sebastian/recursion-context": "^5.0", - "sebastian/type": "^4.0", - "sebastian/version": "^4.0" + "phpunit/php-code-coverage": "^10.1.15", + "phpunit/php-file-iterator": "^4.1.0", + "phpunit/php-invoker": "^4.0.0", + "phpunit/php-text-template": "^3.0.1", + "phpunit/php-timer": "^6.0.0", + "sebastian/cli-parser": "^2.0.1", + "sebastian/code-unit": "^2.0.0", + "sebastian/comparator": "^5.0.1", + "sebastian/diff": "^5.1.1", + "sebastian/environment": "^6.1.0", + "sebastian/exporter": "^5.1.2", + "sebastian/global-state": "^6.0.2", + "sebastian/object-enumerator": "^5.0.0", + "sebastian/recursion-context": "^5.0.0", + "sebastian/type": "^4.0.0", + "sebastian/version": "^4.0.1" }, "suggest": { "ext-soap": "To be able to generate mocks based on WSDL files" @@ -17477,7 +17478,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.24" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.27" }, "funding": [ { @@ -17493,7 +17494,7 @@ "type": "tidelift" } ], - "time": "2024-06-20T13:09:54+00:00" + "time": "2024-07-10T11:48:06+00:00" }, { "name": "react/cache", @@ -19006,16 +19007,16 @@ }, { "name": "spatie/error-solutions", - "version": "1.0.3", + "version": "1.0.5", "source": { "type": "git", "url": "https://github.com/spatie/error-solutions.git", - "reference": "55ea4117e0fde89d520883734ab9b71064c48876" + "reference": "4bb6c734dc992b2db3e26df1ef021c75d2218b13" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/error-solutions/zipball/55ea4117e0fde89d520883734ab9b71064c48876", - "reference": "55ea4117e0fde89d520883734ab9b71064c48876", + "url": "https://api.github.com/repos/spatie/error-solutions/zipball/4bb6c734dc992b2db3e26df1ef021c75d2218b13", + "reference": "4bb6c734dc992b2db3e26df1ef021c75d2218b13", "shasum": "" }, "require": { @@ -19068,7 +19069,7 @@ ], "support": { "issues": "https://github.com/spatie/error-solutions/issues", - "source": "https://github.com/spatie/error-solutions/tree/1.0.3" + "source": "https://github.com/spatie/error-solutions/tree/1.0.5" }, "funding": [ { @@ -19076,7 +19077,7 @@ "type": "github" } ], - "time": "2024-06-27T12:22:48+00:00" + "time": "2024-07-09T12:13:32+00:00" }, { "name": "spatie/flare-client-php", From 273fe4d6ebab4fce84754756642fe50e1f40152d Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 14 Jul 2024 08:50:29 +1000 Subject: [PATCH 3/9] Add product fields to import map --- app/Import/Definitions/ProductMap.php | 4 ++++ app/Import/Transformer/Csv/ProductTransformer.php | 1 + 2 files changed, 5 insertions(+) diff --git a/app/Import/Definitions/ProductMap.php b/app/Import/Definitions/ProductMap.php index b6f38a550418..199434642be5 100644 --- a/app/Import/Definitions/ProductMap.php +++ b/app/Import/Definitions/ProductMap.php @@ -33,6 +33,8 @@ class ProductMap 14 => 'product.custom_value4', 15 => 'product.image_url', 16 => 'product.in_stock_quantity', + 17 => 'product.tax_category', + 18 => 'product.max_quantity', ]; } @@ -56,6 +58,8 @@ class ProductMap 14 => 'texts.custom_value', 15 => 'texts.image_url', 16 => 'texts.in_stock_quantity', + 17 => 'texts.tax_category', + 18 => 'texts.max_quantity', ]; } } diff --git a/app/Import/Transformer/Csv/ProductTransformer.php b/app/Import/Transformer/Csv/ProductTransformer.php index a1829df41912..da871c0d9ae6 100644 --- a/app/Import/Transformer/Csv/ProductTransformer.php +++ b/app/Import/Transformer/Csv/ProductTransformer.php @@ -43,6 +43,7 @@ class ProductTransformer extends BaseTransformer 'custom_value3' => $this->getString($data, 'product.custom_value3'), 'custom_value4' => $this->getString($data, 'product.custom_value4'), 'product_image' => $this->getString($data, 'product.image_url'), + 'in_stock_quantity' => $this->getFloat($data, 'product.in_stock_quantity'), ]; } } From d818520c7344d9a887cfe08188030be74dcf0d8c Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 14 Jul 2024 21:28:54 +1000 Subject: [PATCH 4/9] Static analysis --- app/Export/CSV/ContactExport.php | 2 ++ app/Export/CSV/CreditExport.php | 3 +++ app/Export/CSV/DocumentExport.php | 3 +++ app/Export/CSV/ExpenseExport.php | 4 ++++ app/Export/CSV/InvoiceExport.php | 4 ++++ app/Export/CSV/InvoiceItemExport.php | 4 ++++ app/Export/CSV/PaymentExport.php | 4 ++++ app/Export/CSV/ProductExport.php | 6 +++++- app/Export/CSV/PurchaseOrderExport.php | 6 +++++- app/Export/CSV/PurchaseOrderItemExport.php | 16 ++++++++++------ app/Export/CSV/QuoteExport.php | 4 ++++ app/Export/CSV/QuoteItemExport.php | 4 ++++ app/Export/CSV/RecurringInvoiceExport.php | 4 ++++ app/Export/CSV/TaskExport.php | 5 ++++- app/Export/CSV/VendorExport.php | 6 +++++- app/Helpers/Mail/GmailTransport.php | 2 +- app/Helpers/Mail/Office365MailTransport.php | 3 ++- app/Http/Controllers/Auth/LoginController.php | 12 +++++------- app/Http/Controllers/Bank/YodleeController.php | 2 +- .../Controllers/BankIntegrationController.php | 9 ++++++--- app/Http/Controllers/BaseController.php | 8 ++------ .../ClientPortal/PaymentController.php | 2 +- app/Http/Controllers/DocumentController.php | 2 +- .../PaymentNotificationWebhookController.php | 3 ++- app/Http/Controllers/PreviewController.php | 2 +- app/Http/Requests/Client/UpdateClientRequest.php | 11 +++++++---- .../PaymentMethod/CreatePaymentMethodRequest.php | 2 +- .../StoreCompanyGatewayRequest.php | 2 +- .../UpdateCompanyGatewayRequest.php | 2 +- .../BulkRecurringExpenseRequest.php | 5 ++++- app/Http/Requests/Vendor/BulkVendorRequest.php | 6 +++++- app/Jobs/Bank/MatchBankTransactions.php | 2 +- app/Jobs/Bank/ProcessBankTransactionsYodlee.php | 8 +------- app/Jobs/Brevo/ProcessBrevoWebhook.php | 3 +-- app/Jobs/Client/CheckVat.php | 2 +- app/Jobs/Company/CompanyExport.php | 3 ++- app/Jobs/Company/CompanyTaxRate.php | 2 +- app/Jobs/Cron/AutoBillCron.php | 4 ++-- app/Jobs/Document/CopyDocs.php | 4 +++- app/Jobs/Invoice/CreateUbl.php | 2 +- app/Jobs/Ledger/ClientLedgerBalanceUpdate.php | 2 +- app/Jobs/Mailgun/ProcessMailgunWebhook.php | 2 +- app/Jobs/PostMark/ProcessPostmarkWebhook.php | 2 +- app/Jobs/Util/Import.php | 2 +- app/Jobs/Util/UploadAvatar.php | 2 +- app/Jobs/Util/VersionCheck.php | 4 ++-- app/Libraries/InApp/StoreKit/Apple.php | 2 +- app/Models/Backup.php | 2 +- app/Models/BankTransaction.php | 2 +- app/Models/Client.php | 6 +++--- app/Models/DateFormat.php | 2 +- app/Models/DatetimeFormat.php | 2 +- app/Models/Gateway.php | 2 +- app/PaymentDrivers/BaseDriver.php | 1 + app/PaymentDrivers/Braintree/CreditCard.php | 4 ++-- app/PaymentDrivers/BraintreePaymentDriver.php | 2 +- app/PaymentDrivers/CheckoutComPaymentDriver.php | 2 +- app/PaymentDrivers/PayPal/PayPalWebhook.php | 1 - app/PaymentDrivers/SquarePaymentDriver.php | 2 +- app/PaymentDrivers/Stripe/ACSS.php | 1 + app/PaymentDrivers/Stripe/ImportCustomers.php | 2 +- app/Repositories/ActivityRepository.php | 2 +- app/Repositories/SubscriptionRepository.php | 2 +- app/Services/Client/PaymentMethod.php | 2 +- app/Services/Client/Statement.php | 3 +-- .../Standards/Validation/Peppol/CompanyLevel.php | 6 +++--- app/Services/Invoice/AutoBillInvoice.php | 2 +- app/Services/Pdf/PdfConfiguration.php | 2 +- app/Utils/SystemHealth.php | 2 +- app/Utils/Traits/CompanySettingsSaver.php | 2 +- app/Utils/Traits/GeneratesCounter.php | 2 +- 71 files changed, 155 insertions(+), 95 deletions(-) diff --git a/app/Export/CSV/ContactExport.php b/app/Export/CSV/ContactExport.php index 21c673b49d96..74d0b00bdce8 100644 --- a/app/Export/CSV/ContactExport.php +++ b/app/Export/CSV/ContactExport.php @@ -82,6 +82,7 @@ class ContactExport extends BaseExport $this->csv->insertOne($this->buildHeader()); $query->cursor()->each(function ($contact) { + /** @var \App\Models\ClientContact $contact */ $this->csv->insertOne($this->buildRow($contact)); }); @@ -101,6 +102,7 @@ class ContactExport extends BaseExport $report = $query->cursor() ->map(function ($contact) { + /** @var \App\Models\ClientContact $contact */ $row = $this->buildRow($contact); return $this->processMetaData($row, $contact); })->toArray(); diff --git a/app/Export/CSV/CreditExport.php b/app/Export/CSV/CreditExport.php index 5f1e8b56d19d..7450b4114611 100644 --- a/app/Export/CSV/CreditExport.php +++ b/app/Export/CSV/CreditExport.php @@ -52,6 +52,8 @@ class CreditExport extends BaseExport $report = $query->cursor() ->map(function ($credit) { + + /** @var \App\Models\Credit $credit */ $row = $this->buildRow($credit); return $this->processMetaData($row, $credit); })->toArray(); @@ -139,6 +141,7 @@ class CreditExport extends BaseExport $query->cursor() ->each(function ($credit) { + /** @var \App\Models\Credit $credit */ $this->csv->insertOne($this->buildRow($credit)); }); diff --git a/app/Export/CSV/DocumentExport.php b/app/Export/CSV/DocumentExport.php index 8adfe57a0525..cfcebbc062a6 100644 --- a/app/Export/CSV/DocumentExport.php +++ b/app/Export/CSV/DocumentExport.php @@ -54,6 +54,8 @@ class DocumentExport extends BaseExport $report = $query->cursor() ->map(function ($document) { + + /** @var \App\Models\Document $document */ $row = $this->buildRow($document); return $this->processMetaData($row, $document); })->toArray(); @@ -99,6 +101,7 @@ class DocumentExport extends BaseExport $query->cursor() ->each(function ($entity) { + /** @var mixed $entity */ $this->csv->insertOne($this->buildRow($entity)); }); diff --git a/app/Export/CSV/ExpenseExport.php b/app/Export/CSV/ExpenseExport.php index 0af4d3faf74d..67894954638b 100644 --- a/app/Export/CSV/ExpenseExport.php +++ b/app/Export/CSV/ExpenseExport.php @@ -52,6 +52,8 @@ class ExpenseExport extends BaseExport $report = $query->cursor() ->map(function ($resource) { + + /** @var \App\Models\Expense $resource */ $row = $this->buildRow($resource); return $this->processMetaData($row, $resource); })->toArray(); @@ -132,6 +134,8 @@ class ExpenseExport extends BaseExport $query->cursor() ->each(function ($expense) { + + /** @var \App\Models\Expense $expense */ $this->csv->insertOne($this->buildRow($expense)); }); diff --git a/app/Export/CSV/InvoiceExport.php b/app/Export/CSV/InvoiceExport.php index d0839d03d6fb..d87c49ff943c 100644 --- a/app/Export/CSV/InvoiceExport.php +++ b/app/Export/CSV/InvoiceExport.php @@ -99,6 +99,8 @@ class InvoiceExport extends BaseExport $report = $query->cursor() ->map(function ($resource) { + + /** @var \App\Models\Invoice $resource */ $row = $this->buildRow($resource); return $this->processMetaData($row, $resource); })->toArray(); @@ -119,6 +121,8 @@ class InvoiceExport extends BaseExport $query->cursor() ->each(function ($invoice) { + + /** @var \App\Models\Invoice $invoice */ $this->csv->insertOne($this->buildRow($invoice)); }); diff --git a/app/Export/CSV/InvoiceItemExport.php b/app/Export/CSV/InvoiceItemExport.php index 0e5efcac0b6d..14a38aebee27 100644 --- a/app/Export/CSV/InvoiceItemExport.php +++ b/app/Export/CSV/InvoiceItemExport.php @@ -113,6 +113,8 @@ class InvoiceItemExport extends BaseExport $query->cursor() ->each(function ($resource) { + + /** @var \App\Models\Invoice $resource */ $this->iterateItems($resource); foreach($this->storage_array as $row) { @@ -141,6 +143,8 @@ class InvoiceItemExport extends BaseExport $query->cursor() ->each(function ($invoice) { + + /** @var \App\Models\Invoice $invoice */ $this->iterateItems($invoice); }); diff --git a/app/Export/CSV/PaymentExport.php b/app/Export/CSV/PaymentExport.php index d427b3ebe1d6..167514781277 100644 --- a/app/Export/CSV/PaymentExport.php +++ b/app/Export/CSV/PaymentExport.php @@ -92,6 +92,8 @@ class PaymentExport extends BaseExport $report = $query->cursor() ->map(function ($resource) { + + /** @var \App\Models\Payment $resource */ $row = $this->buildRow($resource); return $this->processMetaData($row, $resource); })->toArray(); @@ -112,6 +114,8 @@ class PaymentExport extends BaseExport $query->cursor() ->each(function ($entity) { + + /** @var \App\Models\Payment $entity */ $this->csv->insertOne($this->buildRow($entity)); }); diff --git a/app/Export/CSV/ProductExport.php b/app/Export/CSV/ProductExport.php index 69bdca55cffb..dba1b8622833 100644 --- a/app/Export/CSV/ProductExport.php +++ b/app/Export/CSV/ProductExport.php @@ -51,6 +51,8 @@ class ProductExport extends BaseExport $report = $query->cursor() ->map(function ($resource) { + + /** @var \App\Models\Product $resource */ $row = $this->buildRow($resource); return $this->processMetaData($row, $resource); })->toArray(); @@ -103,7 +105,9 @@ class ProductExport extends BaseExport $query->cursor() ->each(function ($entity) { - $this->csv->insertOne($this->buildRow($entity)); + + /** @var \App\Models\Product $entity */ + $this->csv->insertOne($this->buildRow($entity)); }); return $this->csv->toString(); diff --git a/app/Export/CSV/PurchaseOrderExport.php b/app/Export/CSV/PurchaseOrderExport.php index e1091dd6672f..1e60e26424c6 100644 --- a/app/Export/CSV/PurchaseOrderExport.php +++ b/app/Export/CSV/PurchaseOrderExport.php @@ -98,6 +98,8 @@ class PurchaseOrderExport extends BaseExport $report = $query->cursor() ->map(function ($resource) { + + /** @var \App\Models\PurchaseOrder $resource */ $row = $this->buildRow($resource); return $this->processMetaData($row, $resource); })->toArray(); @@ -119,7 +121,9 @@ class PurchaseOrderExport extends BaseExport $query->cursor() ->each(function ($purchase_order) { - $this->csv->insertOne($this->buildRow($purchase_order)); + + /** @var \App\Models\PurchaseOrder $purchase_order */ + $this->csv->insertOne($this->buildRow($purchase_order)); }); return $this->csv->toString(); diff --git a/app/Export/CSV/PurchaseOrderItemExport.php b/app/Export/CSV/PurchaseOrderItemExport.php index bf39cc26efe7..4892436a6015 100644 --- a/app/Export/CSV/PurchaseOrderItemExport.php +++ b/app/Export/CSV/PurchaseOrderItemExport.php @@ -101,13 +101,15 @@ class PurchaseOrderItemExport extends BaseExport $query->cursor() ->each(function ($resource) { - $this->iterateItems($resource); + + /** @var \App\Models\PurchaseOrder $resource */ + $this->iterateItems($resource); - foreach($this->storage_array as $row) { - $this->storage_item_array[] = $this->processItemMetaData($row, $resource); - } + foreach($this->storage_array as $row) { + $this->storage_item_array[] = $this->processItemMetaData($row, $resource); + } - $this->storage_array = []; + $this->storage_array = []; }); @@ -127,7 +129,9 @@ class PurchaseOrderItemExport extends BaseExport $query->cursor() ->each(function ($purchase_order) { - $this->iterateItems($purchase_order); + + /** @var \App\Models\PurchaseOrder $purchase_order */ + $this->iterateItems($purchase_order); }); $this->csv->insertAll($this->storage_array); diff --git a/app/Export/CSV/QuoteExport.php b/app/Export/CSV/QuoteExport.php index 7c77fd990595..4d404d4ca3e8 100644 --- a/app/Export/CSV/QuoteExport.php +++ b/app/Export/CSV/QuoteExport.php @@ -103,6 +103,8 @@ class QuoteExport extends BaseExport $report = $query->cursor() ->map(function ($resource) { + + /** @var \App\Models\Quote $resource */ $row = $this->buildRow($resource); return $this->processMetaData($row, $resource); })->toArray(); @@ -125,6 +127,8 @@ class QuoteExport extends BaseExport $query->cursor() ->each(function ($quote) { + + /** @var \App\Models\Quote $quote */ $this->csv->insertOne($this->buildRow($quote)); }); diff --git a/app/Export/CSV/QuoteItemExport.php b/app/Export/CSV/QuoteItemExport.php index ddc7279605f9..2e8e5a008939 100644 --- a/app/Export/CSV/QuoteItemExport.php +++ b/app/Export/CSV/QuoteItemExport.php @@ -104,6 +104,8 @@ class QuoteItemExport extends BaseExport $query->cursor() ->each(function ($resource) { + + /** @var \App\Models\Quote $resource */ $this->iterateItems($resource); foreach($this->storage_array as $row) { @@ -134,6 +136,8 @@ class QuoteItemExport extends BaseExport $query->cursor() ->each(function ($quote) { + + /** @var \App\Models\Quote $quote */ $this->iterateItems($quote); }); diff --git a/app/Export/CSV/RecurringInvoiceExport.php b/app/Export/CSV/RecurringInvoiceExport.php index d6d26e283422..62a2c78364ca 100644 --- a/app/Export/CSV/RecurringInvoiceExport.php +++ b/app/Export/CSV/RecurringInvoiceExport.php @@ -93,6 +93,8 @@ class RecurringInvoiceExport extends BaseExport $query->cursor() ->each(function ($invoice) { + + /** @var \App\Models\RecurringInvoice $invoice */ $this->csv->insertOne($this->buildRow($invoice)); }); @@ -112,6 +114,8 @@ class RecurringInvoiceExport extends BaseExport $report = $query->cursor() ->map(function ($resource) { + + /** @var \App\Models\RecurringInvoice $resource */ $row = $this->buildRow($resource); return $this->processMetaData($row, $resource); })->toArray(); diff --git a/app/Export/CSV/TaskExport.php b/app/Export/CSV/TaskExport.php index 98da6fda1750..2acd8faa64cc 100644 --- a/app/Export/CSV/TaskExport.php +++ b/app/Export/CSV/TaskExport.php @@ -106,7 +106,9 @@ class TaskExport extends BaseExport $query->cursor() ->each(function ($entity) { - $this->buildRow($entity); + + /** @var \App\Models\Task $entity*/ + $this->buildRow($entity); }); $this->csv->insertAll($this->storage_array); @@ -128,6 +130,7 @@ class TaskExport extends BaseExport $query->cursor() ->each(function ($resource) { + /** @var \App\Models\Task $resource*/ $this->buildRow($resource); foreach($this->storage_array as $row) { diff --git a/app/Export/CSV/VendorExport.php b/app/Export/CSV/VendorExport.php index abb682f655eb..799fca7a075f 100644 --- a/app/Export/CSV/VendorExport.php +++ b/app/Export/CSV/VendorExport.php @@ -90,6 +90,8 @@ class VendorExport extends BaseExport $report = $query->cursor() ->map(function ($resource) { + + /** @var \App\Models\Vendor $resource */ $row = $this->buildRow($resource); return $this->processMetaData($row, $resource); })->toArray(); @@ -107,7 +109,9 @@ class VendorExport extends BaseExport $query->cursor() ->each(function ($vendor) { - $this->csv->insertOne($this->buildRow($vendor)); + + /** @var \App\Models\Vendor $vendor */ + $this->csv->insertOne($this->buildRow($vendor)); }); return $this->csv->toString(); diff --git a/app/Helpers/Mail/GmailTransport.php b/app/Helpers/Mail/GmailTransport.php index 1be44af73641..5dd8492191b2 100644 --- a/app/Helpers/Mail/GmailTransport.php +++ b/app/Helpers/Mail/GmailTransport.php @@ -31,7 +31,7 @@ class GmailTransport extends AbstractTransport protected function doSend(SentMessage $message): void { nlog("In Do Send"); - $message = MessageConverter::toEmail($message->getOriginalMessage()); + $message = MessageConverter::toEmail($message->getOriginalMessage()); //@phpstan-ignore-line /** @phpstan-ignore-next-line **/ $token = $message->getHeaders()->get('gmailtoken')->getValue(); // @phpstan-ignore-line diff --git a/app/Helpers/Mail/Office365MailTransport.php b/app/Helpers/Mail/Office365MailTransport.php index c5cf6fa91235..4a6f49a70b65 100644 --- a/app/Helpers/Mail/Office365MailTransport.php +++ b/app/Helpers/Mail/Office365MailTransport.php @@ -25,7 +25,8 @@ class Office365MailTransport extends AbstractTransport protected function doSend(SentMessage $message): void { - $symfony_message = MessageConverter::toEmail($message->getOriginalMessage()); + $symfony_message = MessageConverter::toEmail($message->getOriginalMessage()); //@phpstan-ignore-line + $graph = new Graph(); diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index fdad07677017..3f8201c75a6c 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -376,6 +376,7 @@ class LoginController extends BaseController /** @var \App\Models\User $user */ $user = auth()->user(); + /** @var Builder $cu */ $cu = CompanyUser::query()->where('user_id', $user->id); if ($cu->count() == 0) { @@ -398,18 +399,15 @@ class LoginController extends BaseController $truth->setCompany($set_company); //21-03-2024 + + $cu->each(function ($cu) { - if(CompanyToken::where('company_id', $cu->company_id)->where('user_id', $cu->user_id)->where('is_system', true)->doesntExist()) { + /** @var \App\Models\CompanyUser $cu */ + if(CompanyToken::query()->where('company_id', $cu->company_id)->where('user_id', $cu->user_id)->where('is_system', true)->doesntExist()) { (new CreateCompanyToken($cu->company, $cu->user, request()->server('HTTP_USER_AGENT')))->handle(); } }); - // $user->account->companies->each(function ($company) use ($user) { - // if ($company->tokens()->where('user_id',$user->id)->where('is_system', true)->count() == 0) { - // (new CreateCompanyToken($company, $user, request()->server('HTTP_USER_AGENT')))->handle(); - // } - // }); - $truth->setCompanyToken(CompanyToken::where('user_id', $user->id)->where('company_id', $set_company->id)->where('is_system', true)->first()); return CompanyUser::query()->where('user_id', $user->id); diff --git a/app/Http/Controllers/Bank/YodleeController.php b/app/Http/Controllers/Bank/YodleeController.php index 84dae2618aff..d7057848eb1f 100644 --- a/app/Http/Controllers/Bank/YodleeController.php +++ b/app/Http/Controllers/Bank/YodleeController.php @@ -97,7 +97,7 @@ class YodleeController extends BaseController } $company->account->bank_integrations->where("integration_type", BankIntegration::INTEGRATION_TYPE_YODLEE)->where('auto_sync', true)->each(function ($bank_integration) use ($company) { // TODO: filter to yodlee only - ProcessBankTransactionsYodlee::dispatch($company->account->id, $bank_integration); + ProcessBankTransactionsYodlee::dispatch($company->account->bank_integration_account_id, $bank_integration); }); } diff --git a/app/Http/Controllers/BankIntegrationController.php b/app/Http/Controllers/BankIntegrationController.php index 1cc7e3a21916..6701f1e65fd9 100644 --- a/app/Http/Controllers/BankIntegrationController.php +++ b/app/Http/Controllers/BankIntegrationController.php @@ -197,6 +197,7 @@ class BankIntegrationController extends BaseController /** @var \App\Models\User $user */ $user = auth()->user(); + /** @var \App\Models\Account $user_account */ $user_account = $user->account; $this->refreshAccountsYodlee($user); @@ -210,12 +211,14 @@ class BankIntegrationController extends BaseController // Processing transactions for each bank account if (Ninja::isHosted() && $user->account->bank_integration_account_id) { $user_account->bank_integrations->where("integration_type", BankIntegration::INTEGRATION_TYPE_YODLEE)->each(function ($bank_integration) use ($user_account) { - ProcessBankTransactionsYodlee::dispatch($user_account->id, $bank_integration); + /** @var \App\Models\BankIntegration $bank_integration */ + ProcessBankTransactionsYodlee::dispatch($user_account->bank_integration_account_id, $bank_integration); }); } if (config('ninja.nordigen.secret_id') && config('ninja.nordigen.secret_key') && (Ninja::isSelfHost() || (Ninja::isHosted() && $user_account->isEnterprisePaidClient()))) { - $user_account->bank_integrations->where("integration_type", BankIntegration::INTEGRATION_TYPE_NORDIGEN)->each(function ($bank_integration) { + $user_account->bank_integrations->where("integration_type", BankIntegration::INTEGRATION_TYPE_NORDIGEN)->each(function ($bank_integration) { + /** @var \App\Models\BankIntegration $bank_integration */ ProcessBankTransactionsNordigen::dispatch($bank_integration); }); } @@ -345,7 +348,7 @@ class BankIntegrationController extends BaseController if (Ninja::isHosted() && $account->isPaid() && $account->plan == 'enterprise') { $account->bank_integrations()->where('integration_type', BankIntegration::INTEGRATION_TYPE_YODLEE)->where('auto_sync', true)->cursor()->each(function ($bank_integration) use ($account) { - (new ProcessBankTransactionsYodlee($account->id, $bank_integration))->handle(); + (new ProcessBankTransactionsYodlee($account->bank_integration_account_id, $bank_integration))->handle(); }); } diff --git a/app/Http/Controllers/BaseController.php b/app/Http/Controllers/BaseController.php index 74934925da28..55c82d0aebe4 100644 --- a/app/Http/Controllers/BaseController.php +++ b/app/Http/Controllers/BaseController.php @@ -653,7 +653,7 @@ class BaseController extends Controller /** * Passes back the miniloaded data response * - * @param Builder $query + * @param mixed $query * */ protected function timeConstrainedResponse($query) @@ -894,11 +894,7 @@ class BaseController extends Controller $resource->setPaginator(new IlluminatePaginatorAdapter($paginator)); } - // else { - // $resource = new Collection($query, $transformer, $this->entity_type); - // } - - return $this->response($this->manager->createData($resource)->toArray()); + return $this->response($this->manager->createData($resource)->toArray()); //@phpstan-ignore-line } /** diff --git a/app/Http/Controllers/ClientPortal/PaymentController.php b/app/Http/Controllers/ClientPortal/PaymentController.php index 7efd13510a56..728df5eb1de1 100644 --- a/app/Http/Controllers/ClientPortal/PaymentController.php +++ b/app/Http/Controllers/ClientPortal/PaymentController.php @@ -209,7 +209,7 @@ class PaymentController extends Controller if (property_exists($payment_hash->data, 'billing_context')) { $billing_subscription = \App\Models\Subscription::find($this->decodePrimaryKey($payment_hash->data->billing_context->subscription_id)); - + /** @var \App\Models\Subscription $billing_subscription */ return (new SubscriptionService($billing_subscription))->completePurchase($payment_hash); } diff --git a/app/Http/Controllers/DocumentController.php b/app/Http/Controllers/DocumentController.php index 2a66c150f3d7..776390a4016a 100644 --- a/app/Http/Controllers/DocumentController.php +++ b/app/Http/Controllers/DocumentController.php @@ -183,7 +183,7 @@ class DocumentController extends BaseController } if ($action == 'download') { - ZipDocuments::dispatch($documents->pluck('id'), $user->company(), auth()->user()); + ZipDocuments::dispatch($documents->pluck('id'), $user->company(), auth()->user()); //@phpstan-ignore-line return response()->json(['message' => ctrans('texts.sent_message')], 200); } diff --git a/app/Http/Controllers/PaymentNotificationWebhookController.php b/app/Http/Controllers/PaymentNotificationWebhookController.php index 2eb637d5e1ee..a7ab8b0c3cba 100644 --- a/app/Http/Controllers/PaymentNotificationWebhookController.php +++ b/app/Http/Controllers/PaymentNotificationWebhookController.php @@ -24,8 +24,9 @@ class PaymentNotificationWebhookController extends Controller public function __invoke(PaymentNotificationWebhookRequest $request, string $company_key, string $company_gateway_id, string $client_hash) { /** @var \App\Models\CompanyGateway $company_gateway */ - $company_gateway = CompanyGateway::find($this->decodePrimaryKey($company_gateway_id)); + + /** @var \App\Models\Client $client */ $client = Client::find($this->decodePrimaryKey($client_hash)); return $company_gateway diff --git a/app/Http/Controllers/PreviewController.php b/app/Http/Controllers/PreviewController.php index e1db201eab31..db7b705898f3 100644 --- a/app/Http/Controllers/PreviewController.php +++ b/app/Http/Controllers/PreviewController.php @@ -125,7 +125,7 @@ class PreviewController extends BaseController $response = Response::make($pdf, 200); $response->header('Content-Type', 'application/pdf'); - $response->header('Server-Timing', microtime(true) - $start); + $response->header('Server-Timing', (string) (microtime(true) - $start)); return $response; } diff --git a/app/Http/Requests/Client/UpdateClientRequest.php b/app/Http/Requests/Client/UpdateClientRequest.php index 81da5af205f0..ad8944c2dfbd 100644 --- a/app/Http/Requests/Client/UpdateClientRequest.php +++ b/app/Http/Requests/Client/UpdateClientRequest.php @@ -11,13 +11,14 @@ namespace App\Http\Requests\Client; -use App\DataMapper\CompanySettings; use App\Http\Requests\Request; -use App\Http\ValidationRules\ValidClientGroupSettingsRule; -use App\Utils\Traits\ChecksEntityStatus; use App\Utils\Traits\MakesHash; -use Illuminate\Support\Facades\Cache; use Illuminate\Validation\Rule; +use App\DataMapper\CompanySettings; +use Illuminate\Support\Facades\Cache; +use App\Utils\Traits\ChecksEntityStatus; +use App\Http\ValidationRules\EInvoice\ValidClientScheme; +use App\Http\ValidationRules\ValidClientGroupSettingsRule; class UpdateClientRequest extends Request { @@ -66,6 +67,8 @@ class UpdateClientRequest extends Request $rules['id_number'] = ['sometimes', 'bail', 'nullable', Rule::unique('clients')->where('company_id', $user->company()->id)->ignore($this->client->id)]; $rules['number'] = ['sometimes', 'bail', Rule::unique('clients')->where('company_id', $user->company()->id)->ignore($this->client->id)]; + $rules['e_invoice'] = ['sometimes','nullable', new ValidClientScheme()]; + $rules['settings'] = new ValidClientGroupSettingsRule(); $rules['contacts'] = 'array'; $rules['contacts.*.email'] = 'bail|nullable|distinct|sometimes|email'; diff --git a/app/Http/Requests/ClientPortal/PaymentMethod/CreatePaymentMethodRequest.php b/app/Http/Requests/ClientPortal/PaymentMethod/CreatePaymentMethodRequest.php index 272e8e1bf2e2..a50352b9b05d 100644 --- a/app/Http/Requests/ClientPortal/PaymentMethod/CreatePaymentMethodRequest.php +++ b/app/Http/Requests/ClientPortal/PaymentMethod/CreatePaymentMethodRequest.php @@ -29,7 +29,7 @@ class CreatePaymentMethodRequest extends FormRequest $available_methods = []; collect($client->service()->getPaymentMethods(-1)) - ->filter(function ($method) use (&$available_methods) { + ->filter(function ($method) use (&$available_methods) { //@phpstan-ignore-line $available_methods[] = $method['gateway_type_id']; }); diff --git a/app/Http/Requests/CompanyGateway/StoreCompanyGatewayRequest.php b/app/Http/Requests/CompanyGateway/StoreCompanyGatewayRequest.php index d182cb52b3fd..c010614953c9 100644 --- a/app/Http/Requests/CompanyGateway/StoreCompanyGatewayRequest.php +++ b/app/Http/Requests/CompanyGateway/StoreCompanyGatewayRequest.php @@ -48,7 +48,7 @@ class StoreCompanyGatewayRequest extends Request { $input = $this->all(); - if ($gateway = Gateway::where('key', $input['gateway_key'])->first()) { + if ($gateway = Gateway::query()->where('key', $input['gateway_key'])->first()) { $default_gateway_fields = json_decode($gateway->fields); /*Force gateway properties */ diff --git a/app/Http/Requests/CompanyGateway/UpdateCompanyGatewayRequest.php b/app/Http/Requests/CompanyGateway/UpdateCompanyGatewayRequest.php index 61feb38b7dbb..1aafecd7099c 100644 --- a/app/Http/Requests/CompanyGateway/UpdateCompanyGatewayRequest.php +++ b/app/Http/Requests/CompanyGateway/UpdateCompanyGatewayRequest.php @@ -48,7 +48,7 @@ class UpdateCompanyGatewayRequest extends Request /*Force gateway properties */ if (isset($input['config']) && is_object(json_decode($input['config'])) && array_key_exists('gateway_key', $input)) { - $gateway = Gateway::where('key', $input['gateway_key'])->first(); + $gateway = Gateway::query()->where('key', $input['gateway_key'])->first(); $default_gateway_fields = json_decode($gateway->fields); foreach (json_decode($input['config']) as $key => $value) { diff --git a/app/Http/Requests/RecurringExpense/BulkRecurringExpenseRequest.php b/app/Http/Requests/RecurringExpense/BulkRecurringExpenseRequest.php index 9dffb4f4373e..2c2cdc9e7d0e 100644 --- a/app/Http/Requests/RecurringExpense/BulkRecurringExpenseRequest.php +++ b/app/Http/Requests/RecurringExpense/BulkRecurringExpenseRequest.php @@ -34,7 +34,10 @@ class BulkRecurringExpenseRequest extends Request return false; } - return auth()->user()->can(auth()->user()->isAdmin(), RecurringExpense::class); + /** @var \App\Models\User $user */ + $user = auth()->user(); + + return $user->can('edit', RecurringExpense::class); } /** diff --git a/app/Http/Requests/Vendor/BulkVendorRequest.php b/app/Http/Requests/Vendor/BulkVendorRequest.php index fb0dd93ef9b9..5f9d01e56a3e 100644 --- a/app/Http/Requests/Vendor/BulkVendorRequest.php +++ b/app/Http/Requests/Vendor/BulkVendorRequest.php @@ -34,7 +34,11 @@ class BulkVendorRequest extends Request return false; } - return auth()->user()->can(auth()->user()->isAdmin(), Vendor::class); + /** @var \App\Models\User $user */ + $user = auth()->user(); + + return $user->can('edit', Vendor::class); + } /** diff --git a/app/Jobs/Bank/MatchBankTransactions.php b/app/Jobs/Bank/MatchBankTransactions.php index c377a9c05dce..326d9952583d 100644 --- a/app/Jobs/Bank/MatchBankTransactions.php +++ b/app/Jobs/Bank/MatchBankTransactions.php @@ -448,6 +448,6 @@ class MatchBankTransactions implements ShouldQueue public function middleware() { - return [new WithoutOverlapping($this->company_id)]; + return [new WithoutOverlapping($this->company->account->bank_integration_account_id)]; } } diff --git a/app/Jobs/Bank/ProcessBankTransactionsYodlee.php b/app/Jobs/Bank/ProcessBankTransactionsYodlee.php index 3b651fc9a0d4..7ffb7791fa9c 100644 --- a/app/Jobs/Bank/ProcessBankTransactionsYodlee.php +++ b/app/Jobs/Bank/ProcessBankTransactionsYodlee.php @@ -35,10 +35,6 @@ class ProcessBankTransactionsYodlee implements ShouldQueue use Queueable; use SerializesModels; - private string $bank_integration_account_id; - - private BankIntegration $bank_integration; - private ?string $from_date; private bool $stop_loop = true; @@ -50,10 +46,8 @@ class ProcessBankTransactionsYodlee implements ShouldQueue /** * Create a new job instance. */ - public function __construct(string $bank_integration_account_id, BankIntegration $bank_integration) + public function __construct(private string $bank_integration_account_id, private BankIntegration $bank_integration) { - $this->bank_integration_account_id = $bank_integration_account_id; - $this->bank_integration = $bank_integration; $this->from_date = $bank_integration->from_date; $this->company = $this->bank_integration->company; } diff --git a/app/Jobs/Brevo/ProcessBrevoWebhook.php b/app/Jobs/Brevo/ProcessBrevoWebhook.php index e6ef60a7522d..b81772fd2c0a 100644 --- a/app/Jobs/Brevo/ProcessBrevoWebhook.php +++ b/app/Jobs/Brevo/ProcessBrevoWebhook.php @@ -93,8 +93,7 @@ class ProcessBrevoWebhook implements ShouldQueue { MultiDB::findAndSetDbByCompanyKey($this->request['tags'][0]); - /** @phpstan-ignore-next-line */ - $this->company = Company::where('company_key', $this->request['tags'][0])->first(); + $this->company = Company::query()->where('company_key', $this->request['tags'][0])->first(); $this->invitation = $this->discoverInvitation($this->request['message-id']); diff --git a/app/Jobs/Client/CheckVat.php b/app/Jobs/Client/CheckVat.php index d8637b9f6ab9..ed35f1eaf25c 100644 --- a/app/Jobs/Client/CheckVat.php +++ b/app/Jobs/Client/CheckVat.php @@ -58,7 +58,7 @@ class CheckVat implements ShouldQueue public function middleware() { - return [new WithoutOverlapping($this->client->id)]; + return [new WithoutOverlapping($this->client->client_hash)]; } } diff --git a/app/Jobs/Company/CompanyExport.php b/app/Jobs/Company/CompanyExport.php index 4f7c571ec4ed..3885c05e7df3 100644 --- a/app/Jobs/Company/CompanyExport.php +++ b/app/Jobs/Company/CompanyExport.php @@ -108,7 +108,8 @@ class CompanyExport implements ShouldQueue $this->export_data['users'] = $this->company->users()->withTrashed()->cursor()->map(function ($user) { - $user->account_id = $this->encodePrimaryKey($user->account_id); + /** @var \App\Models\User $user */ + $user->account_id = $this->encodePrimaryKey($user->account_id); //@phpstan-ignore-line return $user; })->all(); diff --git a/app/Jobs/Company/CompanyTaxRate.php b/app/Jobs/Company/CompanyTaxRate.php index ec659ed05288..684065952a5e 100644 --- a/app/Jobs/Company/CompanyTaxRate.php +++ b/app/Jobs/Company/CompanyTaxRate.php @@ -94,7 +94,7 @@ class CompanyTaxRate implements ShouldQueue public function middleware() { - return [new WithoutOverlapping($this->company->id)]; + return [new WithoutOverlapping($this->company->company_key)]; } public function failed($e) diff --git a/app/Jobs/Cron/AutoBillCron.php b/app/Jobs/Cron/AutoBillCron.php index ddd8e6ca2bb8..9f708d95c7cd 100644 --- a/app/Jobs/Cron/AutoBillCron.php +++ b/app/Jobs/Cron/AutoBillCron.php @@ -65,7 +65,7 @@ class AutoBillCron $auto_bill_partial_invoices->chunk(400, function ($invoices) { foreach ($invoices as $invoice) { - AutoBill::dispatch($invoice->id, false); + AutoBill::dispatch($invoice->id, null); } sleep(2); @@ -87,7 +87,7 @@ class AutoBillCron $auto_bill_invoices->chunk(400, function ($invoices) { foreach ($invoices as $invoice) { - AutoBill::dispatch($invoice->id, false); + AutoBill::dispatch($invoice->id, null); } sleep(2); diff --git a/app/Jobs/Document/CopyDocs.php b/app/Jobs/Document/CopyDocs.php index e0f091b3012c..5cbe9e6d6179 100644 --- a/app/Jobs/Document/CopyDocs.php +++ b/app/Jobs/Document/CopyDocs.php @@ -47,10 +47,12 @@ class CopyDocs implements ShouldQueue { MultiDB::setDb($this->db); - Document::whereIn('id', $this->document_ids) + Document::query() + ->whereIn('id', $this->document_ids) ->where('company_id', $this->entity->company_id) ->each(function ($document) { + /** @var \App\Models\Document $document */ $file = $document->getFile(); $extension = pathinfo($document->name, PATHINFO_EXTENSION); diff --git a/app/Jobs/Invoice/CreateUbl.php b/app/Jobs/Invoice/CreateUbl.php index cd018b4ed965..b98c3e91ab7a 100644 --- a/app/Jobs/Invoice/CreateUbl.php +++ b/app/Jobs/Invoice/CreateUbl.php @@ -63,7 +63,7 @@ class CreateUbl implements ShouldQueue // invoice $ubl_invoice->setId($invoice->number); $ubl_invoice->setIssueDate(date_create($invoice->date)); - $ubl_invoice->setInvoiceTypeCode($invoice->amount < 0 ? self::INVOICE_TYPE_CREDIT : self::INVOICE_TYPE_STANDARD); + $ubl_invoice->setInvoiceTypeCode($invoice->amount < 0 ? (string)self::INVOICE_TYPE_CREDIT : (string)self::INVOICE_TYPE_STANDARD); $supplier_party = $this->createParty($company, $invoice->user); $ubl_invoice->setAccountingSupplierParty($supplier_party); diff --git a/app/Jobs/Ledger/ClientLedgerBalanceUpdate.php b/app/Jobs/Ledger/ClientLedgerBalanceUpdate.php index a8171e517e5f..628344fe16a7 100644 --- a/app/Jobs/Ledger/ClientLedgerBalanceUpdate.php +++ b/app/Jobs/Ledger/ClientLedgerBalanceUpdate.php @@ -75,6 +75,6 @@ class ClientLedgerBalanceUpdate implements ShouldQueue public function middleware() { - return [(new WithoutOverlapping($this->client->id))->dontRelease()]; + return [(new WithoutOverlapping($this->client->client_hash))->dontRelease()]; } } diff --git a/app/Jobs/Mailgun/ProcessMailgunWebhook.php b/app/Jobs/Mailgun/ProcessMailgunWebhook.php index 62f400a2bf04..73d32f39e9f7 100644 --- a/app/Jobs/Mailgun/ProcessMailgunWebhook.php +++ b/app/Jobs/Mailgun/ProcessMailgunWebhook.php @@ -94,7 +94,7 @@ class ProcessMailgunWebhook implements ShouldQueue } MultiDB::findAndSetDbByCompanyKey($this->request['event-data']['tags'][0]); - $company = Company::where('company_key', $this->request['event-data']['tags'][0])->first(); + $company = Company::query()->where('company_key', $this->request['event-data']['tags'][0])->first(); if ($company && $this->request['event-data']['event'] == 'complained' && config('ninja.notification.slack')) { $company->notification(new EmailSpamNotification($company))->ninja(); diff --git a/app/Jobs/PostMark/ProcessPostmarkWebhook.php b/app/Jobs/PostMark/ProcessPostmarkWebhook.php index 5f56945a2dbd..9e489bb6b6d2 100644 --- a/app/Jobs/PostMark/ProcessPostmarkWebhook.php +++ b/app/Jobs/PostMark/ProcessPostmarkWebhook.php @@ -87,7 +87,7 @@ class ProcessPostmarkWebhook implements ShouldQueue public function handle() { MultiDB::findAndSetDbByCompanyKey($this->request['Tag']); - $this->company = Company::where('company_key', $this->request['Tag'])->first(); /** @phpstan-ignore-line */ + $this->company = Company::query()->where('company_key', $this->request['Tag'])->first(); /** @phpstan-ignore-line */ $this->invitation = $this->discoverInvitation($this->request['MessageID']); diff --git a/app/Jobs/Util/Import.php b/app/Jobs/Util/Import.php index 01775fee78f4..f422c4014c02 100644 --- a/app/Jobs/Util/Import.php +++ b/app/Jobs/Util/Import.php @@ -253,7 +253,7 @@ class Import implements ShouldQueue $this->setInitialCompanyLedgerBalances(); // $this->fixClientBalances(); - $check_data = (new CheckCompanyData($this->company, md5(time())))->handle(); + $check_data = (new CheckCompanyData($this->company, md5(time())))->handle(); //@phpstan-ignore-line // if(Ninja::isHosted() && array_key_exists('ninja_tokens', $data)) $this->processNinjaTokens($data['ninja_tokens']); diff --git a/app/Jobs/Util/UploadAvatar.php b/app/Jobs/Util/UploadAvatar.php index d010eebef926..e4bd904373f6 100644 --- a/app/Jobs/Util/UploadAvatar.php +++ b/app/Jobs/Util/UploadAvatar.php @@ -38,7 +38,7 @@ class UploadAvatar implements ShouldQueue public function handle(): ?string { - $tmp_file = sha1(time()).'.png'; + $tmp_file = sha1(time()).'.png'; //@phpstan-ignore-line $im = imagecreatefromstring(file_get_contents($this->file)); imagealphablending($im, false); diff --git a/app/Jobs/Util/VersionCheck.php b/app/Jobs/Util/VersionCheck.php index 9e604ab030de..e829c41f5518 100644 --- a/app/Jobs/Util/VersionCheck.php +++ b/app/Jobs/Util/VersionCheck.php @@ -94,7 +94,7 @@ class VersionCheck implements ShouldQueue Client::doesntHave('contacts') ->cursor() - ->each(function (Client $client) { + ->each(function (Client $client) { //@phpstan-ignore-line $new_contact = ClientContactFactory::create($client->company_id, $client->user_id); $new_contact->client_id = $client->id; @@ -107,7 +107,7 @@ class VersionCheck implements ShouldQueue Vendor::doesntHave('contacts') ->cursor() - ->each(function (Vendor $vendor) { + ->each(function (Vendor $vendor) { //@phpstan-ignore-line $new_contact = VendorContactFactory::create($vendor->company_id, $vendor->user_id); $new_contact->vendor_id = $vendor->id; diff --git a/app/Libraries/InApp/StoreKit/Apple.php b/app/Libraries/InApp/StoreKit/Apple.php index 7416c8aa171e..72a280b44d88 100644 --- a/app/Libraries/InApp/StoreKit/Apple.php +++ b/app/Libraries/InApp/StoreKit/Apple.php @@ -58,7 +58,7 @@ class Apple 'bid' => $this->bundle_id, ]; - $jwt = JWT::encode($payload, $this->private_key, $this->alg, $header); + $jwt = JWT::encode($payload, $this->private_key, $this->alg, null, $header); $decoded = JWT::decode($jwt, new Key($this->private_key, $this->alg)); diff --git a/app/Models/Backup.php b/app/Models/Backup.php index 409399ce916d..62a393d7cfe8 100644 --- a/app/Models/Backup.php +++ b/app/Models/Backup.php @@ -61,7 +61,7 @@ class Backup extends BaseModel } $path = $client_or_vendor->backup_path().'/'; - $filename = now()->format('Y_m_d').'_'.md5(time()).'.html'; + $filename = now()->format('Y_m_d').'_'.md5(time()).'.html'; //@phpstan-ignore-line $file_path = $path.$filename; Storage::disk(config('filesystems.default'))->put($file_path, $html); diff --git a/app/Models/BankTransaction.php b/app/Models/BankTransaction.php index 77f2219f9067..8dd87d8834fd 100644 --- a/app/Models/BankTransaction.php +++ b/app/Models/BankTransaction.php @@ -38,7 +38,7 @@ use Illuminate\Database\Eloquent\SoftDeletes; * @property string|null $participant * @property string|null $participant_name * @property string $invoice_ids - * @property int|null $expense_id + * @property string|null $expense_id * @property int|null $vendor_id * @property int $status_id * @property bool $is_deleted diff --git a/app/Models/Client.php b/app/Models/Client.php index 171fbd97ec15..3aa29455c3ac 100644 --- a/app/Models/Client.php +++ b/app/Models/Client.php @@ -573,7 +573,7 @@ class Client extends BaseModel implements HasLocalePreference if ($pm['gateway_type_id'] == GatewayType::BACS) { $cg = CompanyGateway::query()->find($pm['company_gateway_id']); - if ($cg && ! property_exists($cg->fees_and_limits, GatewayType::BACS)) { + if ($cg && ! property_exists($cg->fees_and_limits, GatewayType::BACS)) { //@phpstan-ignore-line $fees_and_limits = $cg->fees_and_limits; $fees_and_limits->{GatewayType::BACS} = new FeesAndLimits(); $cg->fees_and_limits = $fees_and_limits; @@ -597,7 +597,7 @@ class Client extends BaseModel implements HasLocalePreference if ($pm['gateway_type_id'] == GatewayType::ACSS) { $cg = CompanyGateway::query()->find($pm['company_gateway_id']); - if ($cg && ! property_exists($cg->fees_and_limits, GatewayType::ACSS)) { + if ($cg && ! property_exists($cg->fees_and_limits, GatewayType::ACSS)) { //@phpstan-ignore-line $fees_and_limits = $cg->fees_and_limits; $fees_and_limits->{GatewayType::ACSS} = new FeesAndLimits(); $cg->fees_and_limits = $fees_and_limits; @@ -624,7 +624,7 @@ class Client extends BaseModel implements HasLocalePreference if ($pm['gateway_type_id'] == GatewayType::BANK_TRANSFER) { $cg = CompanyGateway::query()->find($pm['company_gateway_id']); - if ($cg && ! property_exists($cg->fees_and_limits, GatewayType::BANK_TRANSFER)) { + if ($cg && ! property_exists($cg->fees_and_limits, GatewayType::BANK_TRANSFER)) { //@phpstan-ignore-line $fees_and_limits = $cg->fees_and_limits; $fees_and_limits->{GatewayType::BANK_TRANSFER} = new FeesAndLimits(); $cg->fees_and_limits = $fees_and_limits; diff --git a/app/Models/DateFormat.php b/app/Models/DateFormat.php index 3801e1146a97..3df85c65010d 100644 --- a/app/Models/DateFormat.php +++ b/app/Models/DateFormat.php @@ -59,7 +59,7 @@ class DateFormat extends StaticModel */ public function __toString() { - $date = mktime(0, 0, 0, 12, 31, date('Y')); + $date = mktime(0, 0, 0, 12, 31, date('Y')); //@phpstan-ignore-line return date($this->format, $date); } diff --git a/app/Models/DatetimeFormat.php b/app/Models/DatetimeFormat.php index 0c9e88c2238a..7c031b00d4d3 100644 --- a/app/Models/DatetimeFormat.php +++ b/app/Models/DatetimeFormat.php @@ -32,7 +32,7 @@ class DatetimeFormat extends StaticModel */ public function __toString() { - $date = mktime(0, 0, 0, 12, 31, date('Y')); + $date = mktime(0, 0, 0, 12, 31, date('Y')); //@phpstan-ignore-line return date($this->format, $date); } diff --git a/app/Models/Gateway.php b/app/Models/Gateway.php index 5d8c20d7c439..46ae2abc56f6 100644 --- a/app/Models/Gateway.php +++ b/app/Models/Gateway.php @@ -24,7 +24,7 @@ namespace App\Models; * @property string|null $site_url * @property bool $is_offsite * @property bool $is_secure - * @property object|null $fields + * @property object|null|string $fields * @property string $default_gateway_type_id * @property int|null $created_at * @property int|null $updated_at diff --git a/app/PaymentDrivers/BaseDriver.php b/app/PaymentDrivers/BaseDriver.php index e3720e0a3db7..3b134ba355d3 100644 --- a/app/PaymentDrivers/BaseDriver.php +++ b/app/PaymentDrivers/BaseDriver.php @@ -375,6 +375,7 @@ class BaseDriver extends AbstractPaymentDriver // To access campaign data => Cache::get(CAMPAIGN_HASH) // To access utm data => session()->get('utm-' . CAMPAIGN_HASH); + /** @var \App\Models\Subscription $billing_subscription */ (new SubscriptionService($billing_subscription))->completePurchase($this->payment_hash); } diff --git a/app/PaymentDrivers/Braintree/CreditCard.php b/app/PaymentDrivers/Braintree/CreditCard.php index 8ba6e0154f58..3ab0fdbe3de7 100644 --- a/app/PaymentDrivers/Braintree/CreditCard.php +++ b/app/PaymentDrivers/Braintree/CreditCard.php @@ -83,7 +83,7 @@ class CreditCard if ($this->braintree->company_gateway->getConfigField('merchantAccountId')) { /** https://developer.paypal.com/braintree/docs/reference/request/client-token/generate#merchant_account_id */ - $data['client_token'] = $this->braintree->gateway->clientToken()->generate([ + $data['client_token'] = $this->braintree->gateway->clientToken()->generate([ //@phpstan-ignore-line 'merchantAccountId' => $this->braintree->company_gateway->getConfigField('merchantAccountId'), ]); } @@ -118,7 +118,7 @@ class CreditCard $token = $this->getPaymentToken($request->all(), $customer->id); $data = [ - 'amount' => $this->braintree->payment_hash->data->amount_with_fee, + 'amount' => $this->braintree->payment_hash->data->amount_with_fee, //@phpstan-ignore-line 'paymentMethodToken' => $token, 'deviceData' => $state['client-data'], 'options' => [ diff --git a/app/PaymentDrivers/BraintreePaymentDriver.php b/app/PaymentDrivers/BraintreePaymentDriver.php index 74a7e7813e64..2e95394fe56e 100644 --- a/app/PaymentDrivers/BraintreePaymentDriver.php +++ b/app/PaymentDrivers/BraintreePaymentDriver.php @@ -387,7 +387,7 @@ class BraintreePaymentDriver extends BaseDriver foreach($cards as $card) { - if($this->getToken($card->token, $card->customerId) || Carbon::createFromDate($card->expirationYear, $card->expirationMonth, '1')->lt(now())) { + if($this->getToken($card->token, $card->customerId) || Carbon::createFromDate($card->expirationYear, $card->expirationMonth, '1')->lt(now())) { //@phpstan-ignore-line continue; } diff --git a/app/PaymentDrivers/CheckoutComPaymentDriver.php b/app/PaymentDrivers/CheckoutComPaymentDriver.php index 03b161d076af..b90ce372264d 100644 --- a/app/PaymentDrivers/CheckoutComPaymentDriver.php +++ b/app/PaymentDrivers/CheckoutComPaymentDriver.php @@ -592,7 +592,7 @@ class CheckoutComPaymentDriver extends BaseDriver foreach($customer['instruments'] as $card) { if( $card['type'] != 'card' || - Carbon::createFromDate($card['expiry_year'], $card['expiry_month'], '1')->lt(now()) || + Carbon::createFromDate($card['expiry_year'], $card['expiry_month'], '1')->lt(now()) || //@phpstan-ignore-line $this->getToken($card['id'], $customer['id']) ) { continue; diff --git a/app/PaymentDrivers/PayPal/PayPalWebhook.php b/app/PaymentDrivers/PayPal/PayPalWebhook.php index 701f2817c315..744230dee6c5 100644 --- a/app/PaymentDrivers/PayPal/PayPalWebhook.php +++ b/app/PaymentDrivers/PayPal/PayPalWebhook.php @@ -297,7 +297,6 @@ class PayPalWebhook implements ShouldQueue $gateway = CompanyGateway::query() ->where('company_id', $company->id) ->where('gateway_key', $this->gateway_key) - ->cursor() ->first(function ($cg) use ($merchant_id) { $config = $cg->getConfig(); diff --git a/app/PaymentDrivers/SquarePaymentDriver.php b/app/PaymentDrivers/SquarePaymentDriver.php index 8e590059e515..456d69586e72 100644 --- a/app/PaymentDrivers/SquarePaymentDriver.php +++ b/app/PaymentDrivers/SquarePaymentDriver.php @@ -188,7 +188,7 @@ class SquarePaymentDriver extends BaseDriver } else { /** @var \Square\Models\Error $error */ - $error = end($apiResponse->getErrors()); + $error = end($apiResponse->getErrors()); //@phpstan-ignore-line $data = [ 'transaction_reference' => $payment->transaction_reference, diff --git a/app/PaymentDrivers/Stripe/ACSS.php b/app/PaymentDrivers/Stripe/ACSS.php index 38e3a8162c9e..7ef4fa2dde2b 100644 --- a/app/PaymentDrivers/Stripe/ACSS.php +++ b/app/PaymentDrivers/Stripe/ACSS.php @@ -267,6 +267,7 @@ class ACSS $gateway_response = json_decode($request->gateway_response); + /** @var \App\Models\ClientGatewayToken $cgt */ $cgt = ClientGatewayToken::find($this->decodePrimaryKey($request->token)); /** @var \Stripe\PaymentIntent $intent */ diff --git a/app/PaymentDrivers/Stripe/ImportCustomers.php b/app/PaymentDrivers/Stripe/ImportCustomers.php index 3f96dd97d9aa..7eef0391e652 100644 --- a/app/PaymentDrivers/Stripe/ImportCustomers.php +++ b/app/PaymentDrivers/Stripe/ImportCustomers.php @@ -208,7 +208,7 @@ class ImportCustomers if (! $cgt) { nlog('customer '.$searchResults->data[0]->id.' does not exist.'); - $this->update_payment_methods->updateMethods($searchResults->data[0], $client); + $this->update_payment_methods->updateMethods($searchResults->data[0], $client); //@phpstan-ignore-line } } } diff --git a/app/Repositories/ActivityRepository.php b/app/Repositories/ActivityRepository.php index 035faa5efa6a..81874524b1d2 100644 --- a/app/Repositories/ActivityRepository.php +++ b/app/Repositories/ActivityRepository.php @@ -41,7 +41,7 @@ class ActivityRepository extends BaseRepository * Save the Activity. * * @param \stdClass $fields The fields - * @param \App\Models\Invoice | \App\Models\Quote | \App\Models\Credit | \App\Models\PurchaseOrder | \App\Models\Expense $entity + * @param \App\Models\Invoice | \App\Models\Quote | \App\Models\Credit | \App\Models\PurchaseOrder | \App\Models\Expense | \App\Models\Payment $entity * @param array $event_vars */ public function save($fields, $entity, $event_vars) diff --git a/app/Repositories/SubscriptionRepository.php b/app/Repositories/SubscriptionRepository.php index e7d971f0d379..eb53fc6e03be 100644 --- a/app/Repositories/SubscriptionRepository.php +++ b/app/Repositories/SubscriptionRepository.php @@ -124,7 +124,7 @@ class SubscriptionRepository extends BaseRepository * * Removing the nested keys of the items array * - * @param array $bundle + * @param mixed $bundle * @return array */ private function convertV3Bundle($bundle): array diff --git a/app/Services/Client/PaymentMethod.php b/app/Services/Client/PaymentMethod.php index 492f907e13b9..8a27f3183144 100644 --- a/app/Services/Client/PaymentMethod.php +++ b/app/Services/Client/PaymentMethod.php @@ -166,7 +166,7 @@ class PaymentMethod //note we have to use GatewayType::CREDIT_CARD as alias for CUSTOM foreach ($this->gateways as $gateway) { foreach ($gateway->driver($this->client)->gatewayTypes() as $type) { - if (isset($gateway->fees_and_limits) && is_object($gateway->fees_and_limits) && property_exists($gateway->fees_and_limits, GatewayType::CREDIT_CARD)) { + if (isset($gateway->fees_and_limits) && is_object($gateway->fees_and_limits) && property_exists($gateway->fees_and_limits, GatewayType::CREDIT_CARD)) { //@phpstan-ignore-line if ($this->validGatewayForAmount($gateway->fees_and_limits->{GatewayType::CREDIT_CARD}, $this->amount)) { // $this->payment_methods[] = [$gateway->id => $type]; //@15-06-2024 diff --git a/app/Services/Client/Statement.php b/app/Services/Client/Statement.php index 9b574e0674dd..d001103885e7 100644 --- a/app/Services/Client/Statement.php +++ b/app/Services/Client/Statement.php @@ -187,7 +187,7 @@ class Statement $pdf = $this->makePdf(null, null, $html); } } catch (\Exception $e) { - nlog(print_r($e->getMessage(), 1)); + nlog(print_r($e->getMessage(), true)); } @@ -385,7 +385,6 @@ class Statement /** * Get correct invitation ID. * - * @return int|bool */ protected function getInvitation() { diff --git a/app/Services/EDocument/Standards/Validation/Peppol/CompanyLevel.php b/app/Services/EDocument/Standards/Validation/Peppol/CompanyLevel.php index 04624c51b8f0..d78d526b1ab1 100644 --- a/app/Services/EDocument/Standards/Validation/Peppol/CompanyLevel.php +++ b/app/Services/EDocument/Standards/Validation/Peppol/CompanyLevel.php @@ -231,9 +231,9 @@ class CompanyLevel // #[SerializedName('cac:BuyerCustomerParty')] // public $BuyerCustomerParty; - // /** @var SellerSupplierParty */ - // #[SerializedName('cac:SellerSupplierParty')] - // public $SellerSupplierParty; + /** @var SellerSupplierParty */ + #[SerializedName('cac:SellerSupplierParty')] + public $SellerSupplierParty; /** @var TaxRepresentativeParty */ #[SerializedName('cac:TaxRepresentativeParty')] diff --git a/app/Services/Invoice/AutoBillInvoice.php b/app/Services/Invoice/AutoBillInvoice.php index 782b0fac9a76..5e6844fffaad 100644 --- a/app/Services/Invoice/AutoBillInvoice.php +++ b/app/Services/Invoice/AutoBillInvoice.php @@ -433,7 +433,7 @@ class AutoBillInvoice extends AbstractService $company_gateway = $gateway_token->gateway; //check if fees and limits are set - if (isset($company_gateway->fees_and_limits) && ! is_array($company_gateway->fees_and_limits) && property_exists($company_gateway->fees_and_limits, $gateway_token->gateway_type_id)) { + if (isset($company_gateway->fees_and_limits) && ! is_array($company_gateway->fees_and_limits) && property_exists($company_gateway->fees_and_limits, $gateway_token->gateway_type_id)) { //@phpstan-ignore-line //if valid we keep this gateway_token if ($this->invoice->client->validGatewayForAmount($company_gateway->fees_and_limits->{$gateway_token->gateway_type_id}, $amount)) { return true; diff --git a/app/Services/Pdf/PdfConfiguration.php b/app/Services/Pdf/PdfConfiguration.php index 4c9548bdb92e..f639a018922c 100644 --- a/app/Services/Pdf/PdfConfiguration.php +++ b/app/Services/Pdf/PdfConfiguration.php @@ -306,7 +306,7 @@ class PdfConfiguration $decimal = $this->country->decimal_separator; } - if (isset($this->country->swap_currency_symbol) && strlen($this->country->swap_currency_symbol) >= 1) { + if (isset($this->country->swap_currency_symbol) && $this->country->swap_currency_symbol) { $swapSymbol = $this->country->swap_currency_symbol; } diff --git a/app/Utils/SystemHealth.php b/app/Utils/SystemHealth.php index 96522a0427c5..34f06d597b6c 100644 --- a/app/Utils/SystemHealth.php +++ b/app/Utils/SystemHealth.php @@ -175,7 +175,7 @@ class SystemHealth public static function checkOpenBaseDir() { - if (strlen(ini_get('open_basedir') == 0)) { + if (strlen(ini_get('open_basedir')) == 0) { return true; } diff --git a/app/Utils/Traits/CompanySettingsSaver.php b/app/Utils/Traits/CompanySettingsSaver.php index e9fd86e49289..1b3c304071d4 100644 --- a/app/Utils/Traits/CompanySettingsSaver.php +++ b/app/Utils/Traits/CompanySettingsSaver.php @@ -39,7 +39,7 @@ trait CompanySettingsSaver * Saves a setting object. * * Works for groups|clients|companies - * @param array $settings The request input settings array + * @param mixed $settings The request input settings array * @param object $entity The entity which the settings belongs to * @return void */ diff --git a/app/Utils/Traits/GeneratesCounter.php b/app/Utils/Traits/GeneratesCounter.php index f67288de6734..82e93c6afd08 100644 --- a/app/Utils/Traits/GeneratesCounter.php +++ b/app/Utils/Traits/GeneratesCounter.php @@ -441,7 +441,7 @@ trait GeneratesCounter /** * Formats the entity number according to pattern, prefix and padding. * - * @param Collection $entity The entity ie App\Models\Client, Invoice, Quote etc + * @param mixed $entity The entity ie App\Models\Client, Invoice, Quote etc * @param int $counter The counter * @param int $padding The padding * @param string $pattern From 7b0b5216a8887fbf533b673a6a9120ef82d77370 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 14 Jul 2024 21:32:46 +1000 Subject: [PATCH 5/9] Add client level validation settings --- .../EInvoice/ValidClientScheme.php | 61 ++++ .../Validation/Peppol/ClientLevel.php | 303 ++++++++++++++++++ 2 files changed, 364 insertions(+) create mode 100644 app/Http/ValidationRules/EInvoice/ValidClientScheme.php create mode 100644 app/Services/EDocument/Standards/Validation/Peppol/ClientLevel.php diff --git a/app/Http/ValidationRules/EInvoice/ValidClientScheme.php b/app/Http/ValidationRules/EInvoice/ValidClientScheme.php new file mode 100644 index 000000000000..ff38a0aad27c --- /dev/null +++ b/app/Http/ValidationRules/EInvoice/ValidClientScheme.php @@ -0,0 +1,61 @@ +validateRequest($value['Invoice'], ClientLevel::class); + + foreach ($errors as $key => $msg) { + + $this->validator->errors()->add( + "e_invoice.{$key}", + "{$key} - {$msg}" + ); + + } + + } + + /** + * Set the current validator. + */ + public function setValidator(Validator $validator): static + { + $this->validator = $validator; + return $this; + } + + +} diff --git a/app/Services/EDocument/Standards/Validation/Peppol/ClientLevel.php b/app/Services/EDocument/Standards/Validation/Peppol/ClientLevel.php new file mode 100644 index 000000000000..e83383388afc --- /dev/null +++ b/app/Services/EDocument/Standards/Validation/Peppol/ClientLevel.php @@ -0,0 +1,303 @@ + 'Y-m-d'])] + // #[SerializedName('cbc:IssueDate')] + // public ?DateTime $IssueDate; + + // /** @var ?\DateTime */ + // #[Context([DateTimeNormalizer::FORMAT_KEY => 'Y-m-d\TH:i:s.uP'])] + // #[SerializedName('cbc:IssueTime')] + // public ?DateTime $IssueTime; + + // /** @var ?\DateTime */ + // #[Context([DateTimeNormalizer::FORMAT_KEY => 'Y-m-d'])] + // #[SerializedName('cbc:DueDate')] + // public ?DateTime $DueDate; + + /** @var InvoiceTypeCode */ + #[SerializedName('cbc:InvoiceTypeCode')] + public $InvoiceTypeCode; + + /** @var string */ + #[SerializedName('cbc:Note')] + public string $Note; + + /** @var ?\DateTime */ + #[Context([DateTimeNormalizer::FORMAT_KEY => 'Y-m-d'])] + #[SerializedName('cbc:TaxPointDate')] + public ?DateTime $TaxPointDate; + + /** @var DocumentCurrencyCode */ + #[SerializedName('cbc:DocumentCurrencyCode')] + public $DocumentCurrencyCode; + + /** @var TaxCurrencyCode */ + #[SerializedName('cbc:TaxCurrencyCode')] + public $TaxCurrencyCode; + + /** @var PricingCurrencyCode */ + #[SerializedName('cbc:PricingCurrencyCode')] + public $PricingCurrencyCode; + + /** @var PaymentCurrencyCode */ + #[SerializedName('cbc:PaymentCurrencyCode')] + public $PaymentCurrencyCode; + + /** @var PaymentAlternativeCurrencyCode */ + #[SerializedName('cbc:PaymentAlternativeCurrencyCode')] + public $PaymentAlternativeCurrencyCode; + + // /** @var AccountingCostCode */ + // #[SerializedName('cbc:AccountingCostCode')] + // public $AccountingCostCode; + + /** @var string */ + #[SerializedName('cbc:AccountingCost')] + public string $AccountingCost; + + // /** @var LineCountNumeric */ + // #[SerializedName('cbc:LineCountNumeric')] + // public $LineCountNumeric; + + // /** @var string */ + // #[SerializedName('cbc:BuyerReference')] + // public string $BuyerReference; + + // /** @var InvoicePeriod[] */ + // #[SerializedName('cac:InvoicePeriod')] + // public array $InvoicePeriod; + + // /** @var OrderReference */ + // #[SerializedName('cac:OrderReference')] + // public $OrderReference; + + // /** @var BillingReference[] */ + // #[SerializedName('cac:BillingReference')] + // public array $BillingReference; + + /** @var DespatchDocumentReference[] */ + #[SerializedName('cac:DespatchDocumentReference')] + public array $DespatchDocumentReference; + + /** @var ReceiptDocumentReference[] */ + #[SerializedName('cac:ReceiptDocumentReference')] + public array $ReceiptDocumentReference; + + /** @var StatementDocumentReference[] */ + #[SerializedName('cac:StatementDocumentReference')] + public array $StatementDocumentReference; + + /** @var OriginatorDocumentReference[] */ + #[SerializedName('cac:OriginatorDocumentReference')] + public array $OriginatorDocumentReference; + + /** @var ContractDocumentReference[] */ + #[SerializedName('cac:ContractDocumentReference')] + public array $ContractDocumentReference; + + /** @var AdditionalDocumentReference[] */ + #[SerializedName('cac:AdditionalDocumentReference')] + public array $AdditionalDocumentReference; + + /** @var ProjectReference[] */ + #[SerializedName('cac:ProjectReference')] + public array $ProjectReference; + + // /** @var Signature[] */ + // #[SerializedName('cac:Signature')] + // public array $Signature; + + // /** @var AccountingSupplierParty */ + // #[NotNull] + // #[NotBlank] + // #[Valid] + // #[SerializedName('cac:AccountingSupplierParty')] + // public $AccountingSupplierParty; + + // /** @var AccountingCustomerParty */ + // #[NotNull] + // #[NotBlank] + // #[Valid] + // #[SerializedName('cac:AccountingCustomerParty')] + // public $AccountingCustomerParty; + + /** @var PayeeParty */ + #[SerializedName('cac:PayeeParty')] + public $PayeeParty; + + /** @var BuyerCustomerParty */ + #[SerializedName('cac:BuyerCustomerParty')] + public $BuyerCustomerParty; + + // /** @var SellerSupplierParty */ + // #[SerializedName('cac:SellerSupplierParty')] + // public $SellerSupplierParty; + + /** @var TaxRepresentativeParty */ + #[SerializedName('cac:TaxRepresentativeParty')] + public $TaxRepresentativeParty; + + /** @var Delivery[] */ + #[SerializedName('cac:Delivery')] + public array $Delivery; + + /** @var DeliveryTerms */ + #[SerializedName('cac:DeliveryTerms')] + public $DeliveryTerms; + + /** @var PaymentMeans[] */ + #[SerializedName('cac:PaymentMeans')] + public array $PaymentMeans; + + /** @var PaymentTerms[] */ + #[SerializedName('cac:PaymentTerms')] + public array $PaymentTerms; + + // /** @var PrepaidPayment[] */ + // #[SerializedName('cac:PrepaidPayment')] + // public array $PrepaidPayment; + + // /** @var AllowanceCharge[] */ + // #[SerializedName('cac:AllowanceCharge')] + // public array $AllowanceCharge; + + // /** @var TaxExchangeRate */ + // #[SerializedName('cac:TaxExchangeRate')] + // public $TaxExchangeRate; + + // /** @var PricingExchangeRate */ + // #[SerializedName('cac:PricingExchangeRate')] + // public $PricingExchangeRate; + + // /** @var PaymentExchangeRate */ + // #[SerializedName('cac:PaymentExchangeRate')] + // public $PaymentExchangeRate; + + // /** @var PaymentAlternativeExchangeRate */ + // #[SerializedName('cac:PaymentAlternativeExchangeRate')] + // public $PaymentAlternativeExchangeRate; + + // /** @var TaxTotal[] */ + // #[SerializedName('cac:TaxTotal')] + // public array $TaxTotal; + + // /** @var WithholdingTaxTotal[] */ + // #[SerializedName('cac:WithholdingTaxTotal')] + // public array $WithholdingTaxTotal; + + // /** @var LegalMonetaryTotal */ + // #[NotNull] + // #[NotBlank] + // #[Valid] + // #[SerializedName('cac:LegalMonetaryTotal')] + // public $LegalMonetaryTotal; + + // /** @var InvoiceLine[] */ + // #[NotNull] + // #[NotBlank] + // #[Valid] + // #[SerializedName('cac:InvoiceLine')] + // public array $InvoiceLine; +} From 745c594f3b908e50baab27ec981e77d737df5022 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 15 Jul 2024 13:35:21 +1000 Subject: [PATCH 6/9] Static analysis --- app/Jobs/Util/Import.php | 1 - app/Listeners/Mail/MailSentListener.php | 2 +- app/Mail/Ninja/StripeConnectFailed.php | 2 +- app/Models/Document.php | 4 ++-- app/PaymentDrivers/PayPal/PayPalWebhook.php | 2 +- app/Services/EDocument/Standards/RoEInvoice.php | 2 +- app/Services/Pdf/PdfConfiguration.php | 4 ++-- app/Services/PdfMaker/Designs/Utilities/DesignHelpers.php | 2 +- app/Services/Subscription/SubscriptionService.php | 2 +- app/Services/Template/TemplateService.php | 2 +- app/Utils/Number.php | 6 +++--- app/Utils/TempFile.php | 2 +- 12 files changed, 15 insertions(+), 16 deletions(-) diff --git a/app/Jobs/Util/Import.php b/app/Jobs/Util/Import.php index f422c4014c02..f4961b19fc43 100644 --- a/app/Jobs/Util/Import.php +++ b/app/Jobs/Util/Import.php @@ -1545,7 +1545,6 @@ class Import implements ShouldQueue $file_path, $file_name, $file_info, - filesize($file_path), 0, false ); diff --git a/app/Listeners/Mail/MailSentListener.php b/app/Listeners/Mail/MailSentListener.php index 3db2aba09b5c..18a01585b834 100644 --- a/app/Listeners/Mail/MailSentListener.php +++ b/app/Listeners/Mail/MailSentListener.php @@ -46,7 +46,7 @@ class MailSentListener implements ShouldQueue try { $message_id = $event->sent->getMessageId(); - $message = MessageConverter::toEmail($event->sent->getOriginalMessage()); + $message = MessageConverter::toEmail($event->sent->getOriginalMessage()); //@phpstan-ignore-line if (!$message->getHeaders()->get('x-invitation')) { return; diff --git a/app/Mail/Ninja/StripeConnectFailed.php b/app/Mail/Ninja/StripeConnectFailed.php index 3508fbc9edbd..bee93bd114fb 100644 --- a/app/Mail/Ninja/StripeConnectFailed.php +++ b/app/Mail/Ninja/StripeConnectFailed.php @@ -39,7 +39,7 @@ class StripeConnectFailed extends Mailable return new Envelope( subject: "Stripe Connect not configured, please login and connect.", from: config('ninja.contact.email'), - to: $this->user->email, + to: $this->user->email, //@phpstan-ignore-line ); } diff --git a/app/Models/Document.php b/app/Models/Document.php index 73e5a22ca5d3..140c98cdf656 100644 --- a/app/Models/Document.php +++ b/app/Models/Document.php @@ -245,9 +245,9 @@ class Document extends BaseModel try { $file = base64_encode($image); - $img = new \Imagick(); + $img = new \Imagick(); //@phpstan-ignore-line $img->readImageBlob($file); - $img->setImageCompression(true); + $img->setImageCompression(true); //@phpstan-ignore-line $img->setImageCompressionQuality(40); return $img->getImageBlob(); diff --git a/app/PaymentDrivers/PayPal/PayPalWebhook.php b/app/PaymentDrivers/PayPal/PayPalWebhook.php index 744230dee6c5..3a42bdf97c09 100644 --- a/app/PaymentDrivers/PayPal/PayPalWebhook.php +++ b/app/PaymentDrivers/PayPal/PayPalWebhook.php @@ -297,7 +297,7 @@ class PayPalWebhook implements ShouldQueue $gateway = CompanyGateway::query() ->where('company_id', $company->id) ->where('gateway_key', $this->gateway_key) - ->first(function ($cg) use ($merchant_id) { + ->first(function ($cg) use ($merchant_id) { //@phpstan-ignore-line $config = $cg->getConfig(); if($config->merchantId == $merchant_id) { diff --git a/app/Services/EDocument/Standards/RoEInvoice.php b/app/Services/EDocument/Standards/RoEInvoice.php index 016f810d4e9c..a82f45224a0f 100644 --- a/app/Services/EDocument/Standards/RoEInvoice.php +++ b/app/Services/EDocument/Standards/RoEInvoice.php @@ -188,7 +188,7 @@ class RoEInvoice extends AbstractService $ubl_invoice->setCustomizationID("urn:cen.eu:en16931:2017#compliant#urn:efactura.mfinante.ro:CIUS-RO:1.0.1"); // invoice - $ubl_invoice->setId($invoice->number); + $ubl_invoice->setId($invoice->number); //@phpstan-ignore-line $ubl_invoice->setIssueDate(date_create($invoice->date)); $ubl_invoice->setDueDate(date_create($invoice->due_date)); $ubl_invoice->setInvoiceTypeCode("380"); diff --git a/app/Services/Pdf/PdfConfiguration.php b/app/Services/Pdf/PdfConfiguration.php index f639a018922c..2adc2d1105d4 100644 --- a/app/Services/Pdf/PdfConfiguration.php +++ b/app/Services/Pdf/PdfConfiguration.php @@ -410,7 +410,7 @@ class PdfConfiguration $precision = 0; } - $value = number_format($v, $precision, $decimal, $thousand); + $value = number_format($v, $precision, $decimal, $thousand); //@phpstan-ignore-line $symbol = $this->currency->symbol; if ($this->settings->show_currency_code === true && $this->currency->code == 'CHF') { @@ -427,7 +427,7 @@ class PdfConfiguration return "{$symbol}{$value}"; } else { - return $this->formatValue($value); + return $this->formatValue($value); // @phpstan-ignore-line } } diff --git a/app/Services/PdfMaker/Designs/Utilities/DesignHelpers.php b/app/Services/PdfMaker/Designs/Utilities/DesignHelpers.php index 7c00cfb1871e..9a8fece5de4a 100644 --- a/app/Services/PdfMaker/Designs/Utilities/DesignHelpers.php +++ b/app/Services/PdfMaker/Designs/Utilities/DesignHelpers.php @@ -174,7 +174,7 @@ trait DesignHelpers // evaluating the variable. if (in_array(sprintf('%s%s.tax', '$', $type), (array) $this->context['pdf_variables']["{$column_type}_columns"])) { - $line_items = collect($this->entity->line_items)->filter(function ($item) use ($type_id) { + $line_items = collect($this->entity->line_items)->filter(function ($item) use ($type_id) { //@phpstan-ignore-line return $item->type_id = $type_id; }); diff --git a/app/Services/Subscription/SubscriptionService.php b/app/Services/Subscription/SubscriptionService.php index 9e97aee3c990..da88156c8d70 100644 --- a/app/Services/Subscription/SubscriptionService.php +++ b/app/Services/Subscription/SubscriptionService.php @@ -428,7 +428,7 @@ class SubscriptionService /** * We refund unused days left. * - * @param Invoice $invoice + * @param \App\Models\Invoice | \App\Models\Credit $invoice * @return float */ private function calculateProRataRefund($invoice, $subscription = null): float diff --git a/app/Services/Template/TemplateService.php b/app/Services/Template/TemplateService.php index a286d05bbb9b..196e3c5f2cdc 100644 --- a/app/Services/Template/TemplateService.php +++ b/app/Services/Template/TemplateService.php @@ -654,7 +654,7 @@ class TemplateService 'updated_at' => $this->translateDate($invoice->pivot->updated_at, $payment->client->date_format(), $payment->client->locale()), 'timestamp' => $invoice->pivot->created_at->timestamp, ]; - })->merge($credits)->sortBy('timestamp')->toArray(); + })->concat($credits)->sortBy('timestamp')->toArray(); return [ 'status' => $payment->stringStatus($payment->status_id), diff --git a/app/Utils/Number.php b/app/Utils/Number.php index c1d601a80e61..84394be04ea4 100644 --- a/app/Utils/Number.php +++ b/app/Utils/Number.php @@ -277,7 +277,7 @@ class Number return "{$symbol}{$value}"; } else { - return self::formatValue($value, $currency); + return self::formatValue($value, $currency); //@phpstan-ignore-line } } @@ -339,7 +339,7 @@ class Number $precision = 0; } - $value = number_format($v, $precision, $decimal, $thousand); + $value = number_format($v, $precision, $decimal, $thousand);//@phpstan-ignore-line $symbol = $currency->symbol; if ($entity->getSetting('show_currency_code') === true && $currency->code == 'CHF') { @@ -356,7 +356,7 @@ class Number return "{$symbol}{$value}"; } else { - return self::formatValue($value, $currency); + return self::formatValue($value, $currency); //@phpstan-ignore-line } } } diff --git a/app/Utils/TempFile.php b/app/Utils/TempFile.php index 16b1dc1a932a..58cd8a942c17 100644 --- a/app/Utils/TempFile.php +++ b/app/Utils/TempFile.php @@ -17,7 +17,7 @@ class TempFile { public static function path($url): string { - $temp_path = @tempnam(sys_get_temp_dir().'/'.sha1(time()), basename($url)); + $temp_path = @tempnam(sys_get_temp_dir().'/'.sha1((string)time()), basename($url)); copy($url, $temp_path); return $temp_path; From 19465985c60451c58313ee1c03f35d23b2583f46 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 15 Jul 2024 14:27:12 +1000 Subject: [PATCH 7/9] Storecove API --- .../EDocument/Gateway/Storecove/Storecove.php | 99 +++++++++++++++++++ config/ninja.php | 2 +- 2 files changed, 100 insertions(+), 1 deletion(-) create mode 100644 app/Services/EDocument/Gateway/Storecove/Storecove.php diff --git a/app/Services/EDocument/Gateway/Storecove/Storecove.php b/app/Services/EDocument/Gateway/Storecove/Storecove.php new file mode 100644 index 000000000000..e5d4a479f495 --- /dev/null +++ b/app/Services/EDocument/Gateway/Storecove/Storecove.php @@ -0,0 +1,99 @@ + ["invoice"], + "network" => "peppol", + "metaScheme" => "iso6523-actorid-upis", + "scheme" => "de:lwid", + "identifier" => "10101010-STO-10" + ]; + + private array $dbn_discovery = [ + "documentTypes" => ["invoice"], + "network" => "dbnalliance", + "metaScheme" => "iso6523-actorid-upis", + "scheme" => "gln", + "identifier" => "1200109963131" + ]; + + + public function __construct(){} + + //config('ninja.storecove_api_key'); + + + //https://app.storecove.com/en/docs#_test_identifiers + //check if identifier is able to send on the network. + + + + public function discovery($identifier, $scheme, $network = 'peppol') + { + $network_data = []; + + match ($network) { + 'peppol' => $network_data = array_merge($this->peppol_discovery, ['scheme' => $scheme, 'identifier' => $identifier]), + 'dbn' => $network_data = array_merge($this->dbn_discovery, ['scheme' => $scheme, 'identifier' => $identifier]), + default => $network_data = array_merge($this->peppol_discovery, ['scheme' => $scheme, 'identifier' => $identifier]), + }; + + $uri = "https://api.storecove.com/api/v2/discovery/receives"; + + $r = $this->httpClient($uri, (HttpVerb::POST)->value, $network_data, $this->getHeaders()); + + return ($r->successful() && $r->json()['code'] == 'OK') ? true : false; + + } + + private function getHeaders(array $headers = []) + { + + return array_merge([ + 'Accept' => 'application/json', + 'Content-type' => 'application/json', + ], $headers); + + } + + public function httpClient(string $uri, string $verb, array $data, ?array $headers = []) + { + + $r = Http::withToken($this->access_token) + ->withHeaders($this->getHeaders($headers)) + ->{$verb}("{$this->api_endpoint_url}{$uri}", $data); + + return $r; + } + +// curl \ +// -X POST \ +// -H "Accept: application/json" \ +// -H "Authorization: Bearer API_KEY_HERE" \ +// -H "Content-Type: application/json" \ +// --data @discovery.json +} \ No newline at end of file diff --git a/config/ninja.php b/config/ninja.php index e6bd9d75ae72..13c37af3e35c 100644 --- a/config/ninja.php +++ b/config/ninja.php @@ -240,5 +240,5 @@ return [ 'private_key' => env('NINJA_PRIVATE_KEY', false), ], 'upload_extensions' => env('ADDITIONAL_UPLOAD_EXTENSIONS', ''), - + 'storecove_api_key' => env('STORECOVE_API_KEY', false), ]; From f9e631d37d568b05b7ba06775ae0f2c8d9de2a0a Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 15 Jul 2024 17:09:58 +1000 Subject: [PATCH 8/9] Storecove API --- .../EDocument/Gateway/Storecove/Storecove.php | 44 +++++++++++++++++-- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/app/Services/EDocument/Gateway/Storecove/Storecove.php b/app/Services/EDocument/Gateway/Storecove/Storecove.php index e5d4a479f495..f913e466d107 100644 --- a/app/Services/EDocument/Gateway/Storecove/Storecove.php +++ b/app/Services/EDocument/Gateway/Storecove/Storecove.php @@ -51,7 +51,7 @@ class Storecove { //check if identifier is able to send on the network. - + //response = { "code": "OK", "email": false} public function discovery($identifier, $scheme, $network = 'peppol') { $network_data = []; @@ -70,6 +70,44 @@ class Storecove { } + //response = "guid" : "xx", + + /** + * If the receiver cannot be found, then an + * email is sent to that user if a appropriate + * email is included in the document payload + * + * { + "routing": { + "emails": [ + "test@example.com" + ], + "eIdentifiers": [] + } + } + * + */ + public function sendDocument($document) + { + $uri = "https://api.storecove.com/api/v2/document_submissions"; + + $r = $this->httpClient($uri, (HttpVerb::POST)->value, $document, $this->getHeaders()); + + if($r->successful()) + return $r->json()['guid']; + + return false; + + } + + //document submission sending evidence + public function sendingEvidence(string $guid) + { + $uri = "https://api.storecove.com/api/v2/document_submissions/{$guid}"; + $r = $this->httpClient($uri, (HttpVerb::GET)->value, [], $this->getHeaders()); + + } + private function getHeaders(array $headers = []) { @@ -83,9 +121,9 @@ class Storecove { public function httpClient(string $uri, string $verb, array $data, ?array $headers = []) { - $r = Http::withToken($this->access_token) + $r = Http::withToken(config('ninja.storecove_api_key')) ->withHeaders($this->getHeaders($headers)) - ->{$verb}("{$this->api_endpoint_url}{$uri}", $data); + ->{$verb}($uri, $data); return $r; } From 90c700a81aa1a9fc5bf28526d8de5971b70c87c7 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 16 Jul 2024 08:31:56 +1000 Subject: [PATCH 9/9] v5.10.9 --- VERSION.txt | 2 +- .../Requests/Company/UpdateCompanyRequest.php | 2 +- .../EDocument/Gateway/Storecove/Storecove.php | 29 +++++++++++++------ config/ninja.php | 4 +-- 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index e5cce47b3049..44e4813bf4a8 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -5.10.8 \ No newline at end of file +5.10.9 \ No newline at end of file diff --git a/app/Http/Requests/Company/UpdateCompanyRequest.php b/app/Http/Requests/Company/UpdateCompanyRequest.php index c48ee397ee0e..c51419393171 100644 --- a/app/Http/Requests/Company/UpdateCompanyRequest.php +++ b/app/Http/Requests/Company/UpdateCompanyRequest.php @@ -65,7 +65,7 @@ class UpdateCompanyRequest extends Request $rules['smtp_local_domain'] = 'sometimes|string|nullable'; // $rules['smtp_verify_peer'] = 'sometimes|string'; - $rules['e_invoice'] = ['sometimes','nullable', new ValidCompanyScheme()]; + // $rules['e_invoice'] = ['sometimes','nullable', new ValidCompanyScheme()]; if (isset($input['portal_mode']) && ($input['portal_mode'] == 'domain' || $input['portal_mode'] == 'iframe')) { $rules['portal_domain'] = 'bail|nullable|sometimes|url'; diff --git a/app/Services/EDocument/Gateway/Storecove/Storecove.php b/app/Services/EDocument/Gateway/Storecove/Storecove.php index f913e466d107..7c991aabc621 100644 --- a/app/Services/EDocument/Gateway/Storecove/Storecove.php +++ b/app/Services/EDocument/Gateway/Storecove/Storecove.php @@ -86,12 +86,28 @@ class Storecove { } } * + * + * + // documentType : invoice/invoice_response/order + // rawDocumentData : { + // document: base64_encode($ubl) + // parse: true + // parseStrategy: ubl + // } */ public function sendDocument($document) { + + $payload = [ + 'documentType' => 'invoice', + 'rawDocumentData' => base64_encode($document), + 'parse' => true, + 'parseStrategy', 'ubl' + ]; + $uri = "https://api.storecove.com/api/v2/document_submissions"; - $r = $this->httpClient($uri, (HttpVerb::POST)->value, $document, $this->getHeaders()); + $r = $this->httpClient($uri, (HttpVerb::POST)->value, $payload, $this->getHeaders()); if($r->successful()) return $r->json()['guid']; @@ -101,7 +117,7 @@ class Storecove { } //document submission sending evidence - public function sendingEvidence(string $guid) + public function getSendingEvidence(string $guid) { $uri = "https://api.storecove.com/api/v2/document_submissions/{$guid}"; $r = $this->httpClient($uri, (HttpVerb::GET)->value, [], $this->getHeaders()); @@ -118,7 +134,7 @@ class Storecove { } - public function httpClient(string $uri, string $verb, array $data, ?array $headers = []) + private function httpClient(string $uri, string $verb, array $data, ?array $headers = []) { $r = Http::withToken(config('ninja.storecove_api_key')) @@ -128,10 +144,5 @@ class Storecove { return $r; } -// curl \ -// -X POST \ -// -H "Accept: application/json" \ -// -H "Authorization: Bearer API_KEY_HERE" \ -// -H "Content-Type: application/json" \ -// --data @discovery.json + } \ No newline at end of file diff --git a/config/ninja.php b/config/ninja.php index 13c37af3e35c..7680a6d74eb2 100644 --- a/config/ninja.php +++ b/config/ninja.php @@ -17,8 +17,8 @@ return [ 'require_https' => env('REQUIRE_HTTPS', true), 'app_url' => rtrim(env('APP_URL', ''), '/'), 'app_domain' => env('APP_DOMAIN', 'invoicing.co'), - 'app_version' => env('APP_VERSION', '5.10.8'), - 'app_tag' => env('APP_TAG', '5.10.8'), + 'app_version' => env('APP_VERSION', '5.10.9'), + 'app_tag' => env('APP_TAG', '5.10.9'), 'minimum_client_version' => '5.0.16', 'terms_version' => '1.0.1', 'api_secret' => env('API_SECRET', false),