Merge pull request #10998 from turbo124/v5-develop

v5.11.79
This commit is contained in:
David Bomba 2025-05-25 09:10:54 +10:00 committed by GitHub
commit 7e583022ac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
31 changed files with 1037 additions and 124 deletions

View File

@ -1 +1 @@
5.11.78
5.11.79

View File

@ -0,0 +1,52 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2025. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Events\Account;
use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
/**
* Class AccountDeleted.
*/
class AccountDeleted
{
use Dispatchable;
use InteractsWithSockets;
use SerializesModels;
/**
* Create a new event instance.
*
* @param $user
* @param $company
* @param $event_vars
*/
public function __construct(public string $account_key, public string $email, public string $ip)
{
}
// /**
// * Get the channels the event should broadcast on.
// *
// * @return Channel|array
// */
public function broadcastOn()
{
return [];
// return new PrivateChannel('channel-name');
}
}

View File

@ -16,8 +16,6 @@ use App\Libraries\MultiDB;
use App\Models\Activity;
use App\Models\Company;
use App\Models\DateFormat;
use App\Models\Task;
use App\Transformers\ActivityTransformer;
use App\Utils\Ninja;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
@ -36,6 +34,7 @@ class ActivityExport extends BaseExport
'date' => 'date',
'activity' => 'activity',
'address' => 'address',
'notes' => 'notes',
];
public function __construct(Company $company, array $input)
@ -72,7 +71,7 @@ class ActivityExport extends BaseExport
Carbon::parse($activity->created_at)->format($this->date_format),
ctrans("texts.activity_{$activity->activity_type_id}", [
'payment_amount' => $activity->payment ? $activity->payment->amount : '',
'adjustment' => $activity->payment ? $activity->payment->refunded : '',
'adjustment' => $activity->getPaymentAdjustment($activity->payment),
'client' => $activity->client ? $activity->client->present()->name() : '',
'contact' => $activity->contact ? $activity->contact->present()->name() : '',
'quote' => $activity->quote ? $activity->quote->number : '',
@ -90,6 +89,7 @@ class ActivityExport extends BaseExport
'recurring_expense' => $activity->recurring_expense ? $activity->recurring_expense->number : '',
]),
$activity->ip,
$activity->notes,
];
}
@ -116,6 +116,10 @@ class ActivityExport extends BaseExport
$query = $this->addDateRange($query, 'activities');
if ($this->input['activity_type_id'] ?? false) {
$query->where('activity_type_id', $this->input['activity_type_id']);
}
return $query;
}

View File

@ -560,6 +560,10 @@ class CompanyController extends BaseController
if (Ninja::isHosted()) {
\Modules\Admin\Jobs\Account\NinjaDeletedAccount::dispatch($account_key, $request->all(), auth()->user()->email);
$ip = $request->ip();
$email = auth()->user()->email;
nlog("AccountDeleted:: {$account_key} - {$email} - {$ip}");
}
LightLogs::create(new AccountDeleted())

View File

@ -422,7 +422,9 @@ class RecurringInvoiceController extends BaseController
$percentage_increase = request()->has('percentage_increase') ? request()->input('percentage_increase') : 0;
if (in_array($request->action, ['increase_prices', 'update_prices'])) {
UpdateRecurring::dispatch($request->ids, $user->company(), $user, $request->action, $percentage_increase);
if($user->isAdmin())
UpdateRecurring::dispatch($request->ids, $user->company(), $user, $request->action, $percentage_increase);
return response()->json(['message' => 'Update in progress.'], 200);
}

View File

@ -53,6 +53,7 @@ class RefundPaymentRequest extends Request
if (isset($input['invoices'])) {
foreach ($input['invoices'] as $key => $invoice) {
$input['invoices'][$key]['invoice_id'] = $this->decodePrimaryKey($invoice['invoice_id']);
$input['invoices'][$key]['date'] = now()->format('Y-m-d');
}
}

View File

@ -41,13 +41,13 @@ class StoreUserRequest extends Request
{
$rules = [];
$rules['first_name'] = 'required|string|max:100';
$rules['last_name'] = 'required|string|max:100';
$rules['first_name'] = 'required|bail|string|max:100';
$rules['last_name'] = 'required|bail|string|max:100';
if (config('ninja.db.multi_db_enabled')) {
$rules['email'] = ['email', new ValidUserForCompany(), new AttachableUser()];
$rules['email'] = ['required', 'bail', 'email', new ValidUserForCompany(), new AttachableUser()];
} else {
$rules['email'] = ['email', new AttachableUser()];
$rules['email'] = ['required', 'bail', 'email', new AttachableUser()];
}
if (Ninja::isHosted()) {

View File

@ -39,7 +39,7 @@ class UpdateUserRequest extends Request
'password' => 'nullable|string|min:6',
];
$rules['email'] = ['email', 'sometimes', new UniqueUserRule($this->user, $input['email'])];
$rules['email'] = ['email', 'bail', 'sometimes', new UniqueUserRule($this->user, $input['email'])];
if (Ninja::isHosted() && $this->phone_has_changed && $this->phone && isset($this->phone)) {
$rules['phone'] = ['sometimes', 'bail', 'string', new HasValidPhoneNumber()];

View File

@ -27,7 +27,7 @@ class ContactComponent extends Component
$contact = collect($contact->client->contacts->firstWhere('is_primary', 1)->toArray())->merge([
'home_phone' => $contact->client->phone,
'custom_identifier' => $contact->client->client_hash,
'custom_identifier' => $contact->client->number . 'X' . rand(1000, 9999),
'name' => $contact->client->name,
'id' => null,
])->all();

View File

@ -51,13 +51,13 @@ class UpdateRecurring implements ShouldQueue
->whereIn('id', $this->ids)
->chunk(100, function ($recurring_invoices) {
foreach ($recurring_invoices as $recurring_invoice) {
if ($this->user->can('edit', $recurring_invoice)) {
if ($this->action == 'update_prices') {
$recurring_invoice->service()->updatePrice();
} elseif ($this->action == 'increase_prices') {
$recurring_invoice->service()->increasePrice($this->percentage);
}
}
}
});

View File

@ -0,0 +1,52 @@
<?php
namespace App\Listeners\Account;
use App\Utils\Ninja;
use App\Models\Company;
use App\Models\Activity;
use App\Libraries\MultiDB;
use App\Jobs\Mail\NinjaMailerJob;
use App\Jobs\Mail\NinjaMailerObject;
use Illuminate\Contracts\Queue\ShouldQueue;
class AccountDeletedListener implements ShouldQueue
{
/**
* Create the event listener.
*
*/
public function __construct()
{
}
/**
* Handle the event.
*
* @param object $event
* @return void
*/
public function handle($event)
{
if (Ninja::isHosted()) {
MultiDB::setDB('db-ninja-01');
$company = Company::find(config('ninja.ninja_default_company_id'));
$activity = new Activity();
$activity->user_id = null;
$activity->company_id = $company->id;
$activity->account_id = $company->account_id;
$activity->activity_type_id = Activity::ACCOUNT_DELETED;
$activity->notes = "Account {$event->account_key} deleted by {$event->email} from {$event->ip}";
$activity->ip = $event->ip;
$activity->is_system = false;
$activity->save();
}
}
}

View File

@ -36,7 +36,9 @@ class VerifyUserObject
/* Set customized translations _NOW_ */
$t->replace(Ninja::transformTranslations($this->company->settings));
$this->user->confirmation_code = $this->createDbHash($this->company->db);
//@phpstan-ignore-next-line
$this->user->confirmation_code = $this->createDbHash($this->user->companies()->first()->db);
// $this->user->confirmation_code = $this->createDbHash($this->company->db);
$this->user->save();
$react_redirect = '';

View File

@ -280,6 +280,8 @@ class Activity extends StaticModel
public const EMAIL_CREDIT = 149;
public const ACCOUNT_DELETED = 150;
protected $casts = [
'is_system' => 'boolean',
'updated_at' => 'timestamp',
@ -528,7 +530,7 @@ class Activity extends StaticModel
return $translation;
}
private function getPaymentAdjustment(?\App\Models\Payment $payment): string
public function getPaymentAdjustment(?\App\Models\Payment $payment): string
{
if(!$payment)
return '';

View File

@ -712,14 +712,14 @@ class Client extends BaseModel implements HasLocalePreference
}
}
if (in_array($this->currency()->code, ['USD']) && in_array(GatewayType::ACSS, array_column($pms, 'gateway_type_id'))) {
// if (in_array($this->currency()->code, ['CAD','USD']) && in_array(GatewayType::ACSS, array_column($pms, 'gateway_type_id'))) {
// if (in_array($this->currency()->code, ['USD']) && in_array(GatewayType::ACSS, array_column($pms, 'gateway_type_id'))) {
if (in_array($this->currency()->code, ['CAD','USD']) && in_array(GatewayType::ACSS, array_column($pms, 'gateway_type_id'))) {
// if ($this->currency()->code == 'CAD' && in_array(GatewayType::ACSS, array_column($pms, 'gateway_type_id'))) {
foreach ($pms as $pm) {
if ($pm['gateway_type_id'] == GatewayType::ACSS) {
$cg = CompanyGateway::query()->find($pm['company_gateway_id']);
if ($cg && $cg->fees_and_limits->{GatewayType::ACSS}->is_enabled) {
if ($cg && $cg->gateway_key != '91be24c7b792230bced33e930ac61676' && $cg->fees_and_limits->{GatewayType::ACSS}->is_enabled) {
return $cg;
}
}
@ -801,6 +801,7 @@ class Client extends BaseModel implements HasLocalePreference
foreach ($pms as $pm) {
if ($pm['gateway_type_id'] == GatewayType::ACSS) {
$cg = CompanyGateway::query()->find($pm['company_gateway_id']);
// $cg = CompanyGateway::query()->where('id', $pm['company_gateway_id'])->where('gateway_key', '!=', '91be24c7b792230bced33e930ac61676')->first();
if ($cg && $cg->fees_and_limits->{GatewayType::ACSS}->is_enabled) {
return GatewayType::ACSS;

View File

@ -39,7 +39,7 @@ class RotessaPaymentDriver extends BaseDriver
public $payment_method;
public static $methods = [
GatewayType::BANK_TRANSFER => BankTransfer::class,
// GatewayType::BANK_TRANSFER => BankTransfer::class,
GatewayType::ACSS => Acss::class,
];
@ -205,8 +205,11 @@ class RotessaPaymentDriver extends BaseDriver
public function findOrCreateCustomer(array $data)
{
nlog($data);
$result = null;
try {
$existing = ClientGatewayToken::query()

View File

@ -65,6 +65,7 @@ use App\Events\Quote\QuoteWasDeleted;
use App\Events\Quote\QuoteWasEmailed;
use App\Events\Quote\QuoteWasUpdated;
use App\Events\Account\AccountCreated;
use App\Events\Account\AccountDeleted;
use App\Events\Credit\CreditWasViewed;
use App\Events\Invoice\InvoiceWasPaid;
use App\Events\Quote\QuoteWasApproved;
@ -174,6 +175,7 @@ use App\Listeners\Invoice\InvoiceViewedActivity;
use App\Listeners\Invoice\UpdateInvoiceActivity;
use App\Listeners\Misc\InvitationViewedListener;
use App\Events\Invoice\InvoiceReminderWasEmailed;
use App\Listeners\Account\AccountDeletedListener;
use App\Listeners\Activity\ClientUpdatedActivity;
use App\Listeners\Activity\CreatedClientActivity;
use App\Listeners\Activity\CreatedCreditActivity;
@ -301,6 +303,9 @@ class EventServiceProvider extends ServiceProvider
// ResponseReceived::class => [
// LogResponseReceived::class,
// ],
AccountDeleted::class => [
AccountDeletedListener::class,
],
AccountCreated::class => [
],
MessageSending::class => [

View File

@ -0,0 +1,155 @@
<?php
namespace App\Services\Report;
use Carbon\Carbon;
use App\Utils\Ninja;
use App\Utils\Number;
use League\Csv\Writer;
use App\Models\Company;
use App\Models\Expense;
use App\Models\Invoice;
use App\Models\Activity;
use App\Utils\Translator;
use App\Libraries\MultiDB;
use App\Export\CSV\BaseExport;
use App\Utils\Traits\MakesDates;
use Illuminate\Support\Facades\App;
use Illuminate\Database\Query\Builder;
class EInvoiceReport extends BaseExport
{
use MakesDates;
public Writer $csv;
public string $date_key = 'date';
private string $template = '/views/templates/reports/einvoice_report.html';
public array $report_keys = [
'invoice_number',
'client_name',
'client_number',
'invoice_date',
'invoice_amount',
'einvoice_status',
'expense_number',
'expense_date',
'expense_amount',
];
/**
* @param array $input
* [
* 'date_range',
* 'start_date',
* 'end_date',
* 'clients',
* 'client_id',
* ]
*/
public function __construct(public Company $company, public array $input)
{
}
public function run()
{
MultiDB::setDb($this->company->db);
App::forgetInstance('translator');
App::setLocale($this->company->locale());
$t = app('translator');
$t->replace(Ninja::transformTranslations($this->company->settings));
$this->csv = Writer::createFromString();
\League\Csv\CharsetConverter::addTo($this->csv, 'UTF-8', 'UTF-8');
$this->csv->insertOne([]);
$this->csv->insertOne([]);
$this->csv->insertOne([]);
$this->csv->insertOne([]);
$this->csv->insertOne([ctrans('texts.einvoice_report')]);
$this->csv->insertOne([ctrans('texts.created_on'), ' ', $this->translateDate(now()->format('Y-m-d'), $this->company->date_format(), $this->company->locale())]);
if (count($this->input['report_keys']) == 0) {
$this->input['report_keys'] = $this->report_keys;
}
$this->csv->insertOne($this->buildHeader());
// Get all invoices with e-invoice status
$query = Invoice::query()
->where('company_id', $this->company->id)
->where('is_deleted', 0)
->with(['client']);
$query = $this->addDateRange($query, 'invoices');
$invoices = $query->cursor();
// Process invoices
foreach ($invoices as $invoice) {
/** @var Invoice $invoice */
$einvoiceStatus = $invoice->backup?->guid ? 'Sent via e-invoicing' : 'Not sent via e-invoicing';
$this->csv->insertOne([
$invoice->number,
$invoice->client->present()->name(),
$invoice->client->number,
$this->translateDate($invoice->date, $this->company->date_format(), $this->company->locale()),
Number::formatMoney($invoice->amount, $this->company),
$einvoiceStatus,
'', // Empty for expenses
'', // Empty for expenses
'', // Empty for expenses
]);
}
$this->date_key = 'created_at';
// Get all expenses received via e-invoicing
$query = Activity::query()
->where('company_id', $this->company->id)
->where('activity_type_id', 148) // Received via e-invoicing
->with('expense');
$query = $this->addDateRange($query, 'activities');
$expenseActivityIds = $query->pluck('expense_id')
->toArray();
$expenses = Expense::query()
->where('company_id', $this->company->id)
->where('is_deleted', 0)
->whereIn('id', $expenseActivityIds)
->cursor();
// Process expenses
foreach ($expenses as $expense) {
$this->csv->insertOne([
'', // Empty for invoices
'', // Empty for invoices
'', // Empty for invoices
'', // Empty for invoices
'', // Empty for invoices
'', // Empty for invoices
$expense->number,
$this->translateDate($expense->date, $this->company->date_format(), $this->company->locale()),
Number::formatMoney($expense->amount, $this->company),
]);
}
return $this->csv->toString();
}
public function buildHeader(): array
{
$header = [];
foreach ($this->input['report_keys'] as $value) {
$header[] = ctrans("texts.{$value}");
}
return $header;
}
}

View File

@ -0,0 +1,156 @@
<?php
namespace App\Services\Report;
use Carbon\Carbon;
use App\Utils\Ninja;
use App\Utils\Number;
use League\Csv\Writer;
use App\Models\Company;
use App\Models\Invoice;
use App\Models\Payment;
use App\Models\Activity;
use App\Utils\Translator;
use App\Libraries\MultiDB;
use Illuminate\Support\Str;
use App\Export\CSV\BaseExport;
use App\Utils\Traits\MakesDates;
use League\Csv\CharsetConverter;
use Illuminate\Support\Facades\App;
use Illuminate\Database\Query\Builder;
class RefundReport extends BaseExport
{
use MakesDates;
public Writer $csv;
private string $template = '/views/templates/reports/refund_report.html';
public array $report_keys = [
'refund_date',
'refund_amount',
'payment_number',
'invoice_number',
'invoice_amount',
'gateway_refund',
];
/**
* @param array $input
* [
* 'date_range',
* 'start_date',
* 'end_date',
* 'clients',
* 'client_id',
* ]
*/
public function __construct(public Company $company, public array $input)
{
}
public function run()
{
MultiDB::setDb($this->company->db);
App::forgetInstance('translator');
App::setLocale($this->company->locale());
$t = app('translator');
$t->replace(Ninja::transformTranslations($this->company->settings));
$this->csv = Writer::createFromString();
\League\Csv\CharsetConverter::addTo($this->csv, 'UTF-8', 'UTF-8');
$this->csv->insertOne([]);
$this->csv->insertOne([]);
$this->csv->insertOne([]);
$this->csv->insertOne([]);
$this->csv->insertOne([ctrans('texts.refund_report')]);
$this->csv->insertOne([ctrans('texts.created_on'), ' ', $this->translateDate(now()->format('Y-m-d'), $this->company->date_format(), $this->company->locale())]);
if (count($this->input['report_keys']) == 0) {
$this->input['report_keys'] = $this->report_keys;
}
$this->csv->insertOne($this->buildHeader());
// Get all refund activities
$query = Activity::query()
->where('company_id', $this->company->id)
->where('activity_type_id', 40) // Refund activity type
->with(['payment', 'payment.client']);
$query = $this->addDateRange($query, 'activities');
$refundActivities = $query->cursor();
foreach ($refundActivities as $activity) {
/** @var Activity $activity */
// Extract refund amount from notes using regex
preg_match('/Refunded : (\d+) -/', $activity->notes, $matches);
$refundAmount = $matches[1] ?? 0;
// Get payment details
$payment = $activity->payment;
// Get gateway refund status from refund_meta
$gatewayRefund = false;
if ($payment && $payment->refund_meta) {
foreach ($payment->refund_meta as $refund) {
if (isset($refund['gateway_refund']) && $refund['gateway_refund']) {
$gatewayRefund = true;
break;
}
}
}
// Get invoice details from refund_meta
$invoices = [];
if ($payment && $payment->refund_meta) {
foreach ($payment->refund_meta as $refund) {
if (isset($refund['invoices'])) {
foreach ($refund['invoices'] as $invoiceRefund) {
$invoice = Invoice::query()
->where('company_id', $this->company->id)
->where('id', $invoiceRefund['invoice_id'])
->first();
if ($invoice) {
$invoices[] = [
'number' => $invoice->number,
'amount' => $invoiceRefund['amount']
];
}
}
}
}
}
// Create a row for each refunded invoice
foreach ($invoices as $invoice) {
$this->csv->insertOne([
$this->translateDate(\Carbon\Carbon::parse($activity->created_at)->format('Y-m-d'), $this->company->date_format(), $this->company->locale()),
Number::formatMoney($refundAmount, $this->company),
$payment ? $payment->number : '',
$invoice['number'],
Number::formatMoney($invoice['amount'], $this->company),
$gatewayRefund ? 'Yes' : 'No',
]);
}
}
return $this->csv->toString();
}
public function buildHeader(): array
{
$header = [];
foreach ($this->input['report_keys'] as $value) {
$header[] = ctrans("texts.{$value}");
}
return $header;
}
}

View File

@ -116,7 +116,8 @@
"twig/twig": "^3.14",
"twilio/sdk": "^6.40",
"wikimedia/composer-merge-plugin": "^2.1",
"wildbit/postmark-php": "^4.0"
"wildbit/postmark-php": "^4.0",
"invoiceninja/admin-api": "dev-main"
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.6",

141
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "4361272676d998d08fb1926198065b39",
"content-hash": "f6635e28eff8ba2e1ba889d1ef9dd2d6",
"packages": [
{
"name": "adrienrn/php-mimetyper",
@ -4401,16 +4401,16 @@
},
{
"name": "imdhemy/appstore-iap",
"version": "1.7.0",
"version": "1.7.1",
"source": {
"type": "git",
"url": "https://github.com/imdhemy/appstore-iap.git",
"reference": "c82aa2ad083c8029121ca4062c0bd494c09746c1"
"reference": "4ee9f863989ff8241c5cbcb86ab6d7aa4640aa81"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/imdhemy/appstore-iap/zipball/c82aa2ad083c8029121ca4062c0bd494c09746c1",
"reference": "c82aa2ad083c8029121ca4062c0bd494c09746c1",
"url": "https://api.github.com/repos/imdhemy/appstore-iap/zipball/4ee9f863989ff8241c5cbcb86ab6d7aa4640aa81",
"reference": "4ee9f863989ff8241c5cbcb86ab6d7aa4640aa81",
"shasum": ""
},
"require": {
@ -4427,6 +4427,7 @@
"fakerphp/faker": "^1.22",
"friendsofphp/php-cs-fixer": "^3.16",
"phpunit/phpunit": "^9.6",
"psalm/plugin-phpunit": "^0.19.0",
"roave/security-advisories": "dev-latest",
"vimeo/psalm": "^5.11"
},
@ -4449,9 +4450,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.7.0"
"source": "https://github.com/imdhemy/appstore-iap/tree/1.7.1"
},
"time": "2024-06-30T18:08:57+00:00"
"time": "2025-05-18T07:56:17+00:00"
},
{
"name": "imdhemy/google-play-billing",
@ -4666,6 +4667,65 @@
],
"time": "2022-05-21T17:30:32+00:00"
},
{
"name": "invoiceninja/admin-api",
"version": "dev-main",
"dist": {
"type": "path",
"url": "../admin-api",
"reference": "2814d6ca88633aca435ade8048f78c58b9ed0fde"
},
"require": {
"afosto/yaac": "^1.5",
"asm/php-ansible": "dev-main",
"ext-curl": "*",
"ext-dom": "*",
"ext-json": "*",
"ext-libxml": "*",
"ext-simplexml": "*",
"illuminate/database": "^11",
"illuminate/support": "^11",
"imdhemy/laravel-purchases": "^1.7",
"php": "^8.2|^8.3|^8.4"
},
"require-dev": {
"larastan/larastan": "^3.0",
"orchestra/testbench": "^9.0",
"phpstan/phpstan": "^2.0",
"phpunit/phpunit": "^11.0"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"InvoiceNinja\\AdminApi\\Providers\\AdminApiServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"InvoiceNinja\\AdminApi\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"InvoiceNinja\\AdminApi\\Tests\\": "tests/"
}
},
"license": [
"Elastic"
],
"authors": [
{
"name": "David Bomba",
"email": "turbo124@gmail.com"
}
],
"description": "API endpoints for the admin interface",
"transport-options": {
"relative": true
}
},
{
"name": "invoiceninja/einvoice",
"version": "dev-main",
@ -5318,16 +5378,16 @@
},
{
"name": "laravel/framework",
"version": "v11.44.7",
"version": "v11.45.0",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
"reference": "00bc6ac91a6d577bf051c18ddaa638c0d221e1c7"
"reference": "d0730deb427632004d24801be7ca1ed2c10fbc4e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/00bc6ac91a6d577bf051c18ddaa638c0d221e1c7",
"reference": "00bc6ac91a6d577bf051c18ddaa638c0d221e1c7",
"url": "https://api.github.com/repos/laravel/framework/zipball/d0730deb427632004d24801be7ca1ed2c10fbc4e",
"reference": "d0730deb427632004d24801be7ca1ed2c10fbc4e",
"shasum": ""
},
"require": {
@ -5348,7 +5408,7 @@
"guzzlehttp/uri-template": "^1.0",
"laravel/prompts": "^0.1.18|^0.2.0|^0.3.0",
"laravel/serializable-closure": "^1.3|^2.0",
"league/commonmark": "^2.6",
"league/commonmark": "^2.7",
"league/flysystem": "^3.25.1",
"league/flysystem-local": "^3.25.1",
"league/uri": "^7.5.1",
@ -5435,7 +5495,7 @@
"league/flysystem-read-only": "^3.25.1",
"league/flysystem-sftp-v3": "^3.25.1",
"mockery/mockery": "^1.6.10",
"orchestra/testbench-core": "^9.11.2",
"orchestra/testbench-core": "^9.13.2",
"pda/pheanstalk": "^5.0.6",
"php-http/discovery": "^1.15",
"phpstan/phpstan": "^2.0",
@ -5529,7 +5589,7 @@
"issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework"
},
"time": "2025-04-25T12:40:47+00:00"
"time": "2025-05-20T15:15:58+00:00"
},
{
"name": "laravel/octane",
@ -18750,16 +18810,16 @@
},
{
"name": "phpstan/phpstan",
"version": "1.12.26",
"version": "1.12.27",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
"reference": "84cbf8f018e01834b9b1ac3dacf3b9780e209e53"
"reference": "3a6e423c076ab39dfedc307e2ac627ef579db162"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/84cbf8f018e01834b9b1ac3dacf3b9780e209e53",
"reference": "84cbf8f018e01834b9b1ac3dacf3b9780e209e53",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/3a6e423c076ab39dfedc307e2ac627ef579db162",
"reference": "3a6e423c076ab39dfedc307e2ac627ef579db162",
"shasum": ""
},
"require": {
@ -18804,7 +18864,7 @@
"type": "github"
}
],
"time": "2025-05-14T11:08:32+00:00"
"time": "2025-05-21T20:51:45+00:00"
},
{
"name": "phpunit/php-code-coverage",
@ -19131,16 +19191,16 @@
},
{
"name": "phpunit/phpunit",
"version": "11.5.20",
"version": "11.5.21",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "e6bdea63ecb7a8287d2cdab25bdde3126e0cfe6f"
"reference": "d565e2cdc21a7db9dc6c399c1fc2083b8010f289"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/e6bdea63ecb7a8287d2cdab25bdde3126e0cfe6f",
"reference": "e6bdea63ecb7a8287d2cdab25bdde3126e0cfe6f",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d565e2cdc21a7db9dc6c399c1fc2083b8010f289",
"reference": "d565e2cdc21a7db9dc6c399c1fc2083b8010f289",
"shasum": ""
},
"require": {
@ -19163,7 +19223,7 @@
"sebastian/code-unit": "^3.0.3",
"sebastian/comparator": "^6.3.1",
"sebastian/diff": "^6.0.2",
"sebastian/environment": "^7.2.0",
"sebastian/environment": "^7.2.1",
"sebastian/exporter": "^6.3.0",
"sebastian/global-state": "^7.0.2",
"sebastian/object-enumerator": "^6.0.1",
@ -19212,7 +19272,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
"source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.20"
"source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.21"
},
"funding": [
{
@ -19236,7 +19296,7 @@
"type": "tidelift"
}
],
"time": "2025-05-11T06:39:52+00:00"
"time": "2025-05-21T12:35:00+00:00"
},
{
"name": "react/cache",
@ -20141,23 +20201,23 @@
},
{
"name": "sebastian/environment",
"version": "7.2.0",
"version": "7.2.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/environment.git",
"reference": "855f3ae0ab316bbafe1ba4e16e9f3c078d24a0c5"
"reference": "a5c75038693ad2e8d4b6c15ba2403532647830c4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/855f3ae0ab316bbafe1ba4e16e9f3c078d24a0c5",
"reference": "855f3ae0ab316bbafe1ba4e16e9f3c078d24a0c5",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/a5c75038693ad2e8d4b6c15ba2403532647830c4",
"reference": "a5c75038693ad2e8d4b6c15ba2403532647830c4",
"shasum": ""
},
"require": {
"php": ">=8.2"
},
"require-dev": {
"phpunit/phpunit": "^11.0"
"phpunit/phpunit": "^11.3"
},
"suggest": {
"ext-posix": "*"
@ -20193,15 +20253,27 @@
"support": {
"issues": "https://github.com/sebastianbergmann/environment/issues",
"security": "https://github.com/sebastianbergmann/environment/security/policy",
"source": "https://github.com/sebastianbergmann/environment/tree/7.2.0"
"source": "https://github.com/sebastianbergmann/environment/tree/7.2.1"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
},
{
"url": "https://liberapay.com/sebastianbergmann",
"type": "liberapay"
},
{
"url": "https://thanks.dev/u/gh/sebastianbergmann",
"type": "thanks_dev"
},
{
"url": "https://tidelift.com/funding/github/packagist/sebastian/environment",
"type": "tidelift"
}
],
"time": "2024-07-03T04:54:44+00:00"
"time": "2025-05-21T11:55:47+00:00"
},
{
"name": "sebastian/exporter",
@ -21380,7 +21452,8 @@
"beganovich/snappdf": 20,
"horstoeko/orderx": 20,
"invoiceninja/einvoice": 20,
"socialiteproviders/apple": 20
"socialiteproviders/apple": 20,
"invoiceninja/admin-api": 20
},
"prefer-stable": true,
"prefer-lowest": false,

View File

@ -17,8 +17,8 @@ return [
'require_https' => env('REQUIRE_HTTPS', true),
'app_url' => rtrim(env('APP_URL', ''), '/'),
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
'app_version' => env('APP_VERSION', '5.11.78'),
'app_tag' => env('APP_TAG', '5.11.78'),
'app_version' => env('APP_VERSION', '5.11.79'),
'app_tag' => env('APP_TAG', '5.11.79'),
'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', false),

View File

@ -5582,6 +5582,8 @@ $lang = array(
'cancel_trial' => 'Cancel Trial',
'cancel_trial_description' => 'This will cancel your trial and remove all paid features from your account.',
'existing_gateway' => 'Gateway already exists',
'activity_150' => 'Account deleted :notes',
'docuninja' => 'DocuNinja',
);
return $lang;

View File

@ -1,3 +1,4 @@
{
"Admin": true
"Admin": true,
"Accounting": true
}

View File

@ -116,7 +116,6 @@ paths:
items:
$ref: '#/components/schemas/Activity'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -381,7 +380,6 @@ paths:
items:
$ref: '#/components/schemas/BankIntegration'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -837,7 +835,6 @@ paths:
items:
$ref: '#/components/schemas/BankTransaction'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -1244,7 +1241,6 @@ paths:
items:
$ref: '#/components/schemas/BankTransactionRule'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -1620,7 +1616,6 @@ paths:
items:
$ref: '#/components/schemas/ClientGatewayToken'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -1913,7 +1908,6 @@ paths:
items:
$ref: '#/components/schemas/Company'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -2349,7 +2343,6 @@ paths:
items:
$ref: '#/components/schemas/CompanyGateway'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -2671,7 +2664,6 @@ paths:
items:
$ref: '#/components/schemas/CompanyLedger'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -2783,7 +2775,6 @@ paths:
items:
$ref: '#/components/schemas/Design'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -3099,7 +3090,6 @@ paths:
items:
$ref: '#/components/schemas/Document'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -3216,7 +3206,6 @@ paths:
items:
$ref: '#/components/schemas/ExpenseCategory'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -3520,7 +3509,6 @@ paths:
items:
$ref: '#/components/schemas/Expense'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -3913,7 +3901,6 @@ paths:
items:
$ref: '#/components/schemas/GroupSetting'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -4609,7 +4596,6 @@ paths:
items:
$ref: '#/components/schemas/PaymentTerm'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -5051,7 +5037,6 @@ paths:
items:
$ref: '#/components/schemas/RecurringExpense'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -5418,7 +5403,6 @@ paths:
items:
$ref: '#/components/schemas/RecurringQuote'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -6322,7 +6306,6 @@ paths:
items:
$ref: '#/components/schemas/Subscription'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -6671,7 +6654,6 @@ paths:
items:
$ref: '#/components/schemas/SystemLog'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -6984,7 +6966,6 @@ paths:
items:
$ref: '#/components/schemas/TaskStatus'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -7297,7 +7278,6 @@ paths:
items:
$ref: '#/components/schemas/TaxRate'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -7614,7 +7594,6 @@ paths:
items:
$ref: '#/components/schemas/CompanyToken'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -7922,7 +7901,6 @@ paths:
items:
$ref: '#/components/schemas/User'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -8378,7 +8356,6 @@ paths:
items:
$ref: '#/components/schemas/Webhook'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -17981,12 +17958,6 @@ components:
example: 1.00
description: 'The total amount of tax applied to the product offered for this line item'
readOnly: true
date:
type: string
format: date-time
example: '2023-03-19T00:00:00Z'
description: 'Deprecated'
deprecated: true
custom_value1:
type: string
example: 'Custom value 1'

View File

@ -82,12 +82,6 @@
example: 1.00
description: 'The total amount of tax applied to the product offered for this line item'
readOnly: true
date:
type: string
format: date-time
example: '2023-03-19T00:00:00Z'
description: 'Deprecated'
deprecated: true
custom_value1:
type: string
example: 'Custom value 1'

View File

@ -33,7 +33,6 @@ paths:
items:
$ref: '#/components/schemas/Activity'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -298,7 +297,6 @@ paths:
items:
$ref: '#/components/schemas/BankIntegration'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -754,7 +752,6 @@ paths:
items:
$ref: '#/components/schemas/BankTransaction'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -1161,7 +1158,6 @@ paths:
items:
$ref: '#/components/schemas/BankTransactionRule'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -1537,7 +1533,6 @@ paths:
items:
$ref: '#/components/schemas/ClientGatewayToken'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -1830,7 +1825,6 @@ paths:
items:
$ref: '#/components/schemas/Company'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -2266,7 +2260,6 @@ paths:
items:
$ref: '#/components/schemas/CompanyGateway'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -2588,7 +2581,6 @@ paths:
items:
$ref: '#/components/schemas/CompanyLedger'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -2700,7 +2692,6 @@ paths:
items:
$ref: '#/components/schemas/Design'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -3016,7 +3007,6 @@ paths:
items:
$ref: '#/components/schemas/Document'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -3133,7 +3123,6 @@ paths:
items:
$ref: '#/components/schemas/ExpenseCategory'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -3437,7 +3426,6 @@ paths:
items:
$ref: '#/components/schemas/Expense'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -3830,7 +3818,6 @@ paths:
items:
$ref: '#/components/schemas/GroupSetting'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -4526,7 +4513,6 @@ paths:
items:
$ref: '#/components/schemas/PaymentTerm'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -4968,7 +4954,6 @@ paths:
items:
$ref: '#/components/schemas/RecurringExpense'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -5335,7 +5320,6 @@ paths:
items:
$ref: '#/components/schemas/RecurringQuote'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -6239,7 +6223,6 @@ paths:
items:
$ref: '#/components/schemas/Subscription'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -6588,7 +6571,6 @@ paths:
items:
$ref: '#/components/schemas/SystemLog'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -6901,7 +6883,6 @@ paths:
items:
$ref: '#/components/schemas/TaskStatus'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -7214,7 +7195,6 @@ paths:
items:
$ref: '#/components/schemas/TaxRate'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -7531,7 +7511,6 @@ paths:
items:
$ref: '#/components/schemas/CompanyToken'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -7839,7 +7818,6 @@ paths:
items:
$ref: '#/components/schemas/User'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
@ -8295,7 +8273,6 @@ paths:
items:
$ref: '#/components/schemas/Webhook'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"

224
package-lock.json generated
View File

@ -6,6 +6,7 @@
"": {
"name": "@invoiceninja/invoiceninja",
"dependencies": {
"@apidevtools/swagger-parser": "^10.1.1",
"axios": "^0.25",
"card-js": "^1.0.13",
"card-validator": "^8.1.1",
@ -65,6 +66,92 @@
"node": ">=6.0.0"
}
},
"node_modules/@apidevtools/json-schema-ref-parser": {
"version": "11.7.2",
"resolved": "https://registry.npmjs.org/@apidevtools/json-schema-ref-parser/-/json-schema-ref-parser-11.7.2.tgz",
"integrity": "sha512-4gY54eEGEstClvEkGnwVkTkrx0sqwemEFG5OSRRn3tD91XH0+Q8XIkYIfo7IwEWPpJZwILb9GUXeShtplRc/eA==",
"license": "MIT",
"dependencies": {
"@jsdevtools/ono": "^7.1.3",
"@types/json-schema": "^7.0.15",
"js-yaml": "^4.1.0"
},
"engines": {
"node": ">= 16"
},
"funding": {
"url": "https://github.com/sponsors/philsturgeon"
}
},
"node_modules/@apidevtools/openapi-schemas": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/@apidevtools/openapi-schemas/-/openapi-schemas-2.1.0.tgz",
"integrity": "sha512-Zc1AlqrJlX3SlpupFGpiLi2EbteyP7fXmUOGup6/DnkRgjP9bgMM/ag+n91rsv0U1Gpz0H3VILA/o3bW7Ua6BQ==",
"license": "MIT",
"engines": {
"node": ">=10"
}
},
"node_modules/@apidevtools/swagger-methods": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/@apidevtools/swagger-methods/-/swagger-methods-3.0.2.tgz",
"integrity": "sha512-QAkD5kK2b1WfjDS/UQn/qQkbwF31uqRjPTrsCs5ZG9BQGAkjwvqGFjjPqAuzac/IYzpPtRzjCP1WrTuAIjMrXg==",
"license": "MIT"
},
"node_modules/@apidevtools/swagger-parser": {
"version": "10.1.1",
"resolved": "https://registry.npmjs.org/@apidevtools/swagger-parser/-/swagger-parser-10.1.1.tgz",
"integrity": "sha512-u/kozRnsPO/x8QtKYJOqoGtC4kH6yg1lfYkB9Au0WhYB0FNLpyFusttQtvhlwjtG3rOwiRz4D8DnnXa8iEpIKA==",
"license": "MIT",
"dependencies": {
"@apidevtools/json-schema-ref-parser": "11.7.2",
"@apidevtools/openapi-schemas": "^2.1.0",
"@apidevtools/swagger-methods": "^3.0.2",
"@jsdevtools/ono": "^7.1.3",
"ajv": "^8.17.1",
"ajv-draft-04": "^1.0.0",
"call-me-maybe": "^1.0.2"
},
"peerDependencies": {
"openapi-types": ">=7"
}
},
"node_modules/@apidevtools/swagger-parser/node_modules/ajv": {
"version": "8.17.1",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz",
"integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==",
"license": "MIT",
"dependencies": {
"fast-deep-equal": "^3.1.3",
"fast-uri": "^3.0.1",
"json-schema-traverse": "^1.0.0",
"require-from-string": "^2.0.2"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/epoberezkin"
}
},
"node_modules/@apidevtools/swagger-parser/node_modules/ajv-draft-04": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/ajv-draft-04/-/ajv-draft-04-1.0.0.tgz",
"integrity": "sha512-mv00Te6nmYbRp5DCwclxtt7yV/joXJPGS7nM+97GdxvuttCOfgI3K4U25zboyeX0O+myI8ERluxQe5wljMmVIw==",
"license": "MIT",
"peerDependencies": {
"ajv": "^8.5.0"
},
"peerDependenciesMeta": {
"ajv": {
"optional": true
}
}
},
"node_modules/@apidevtools/swagger-parser/node_modules/json-schema-traverse": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
"integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==",
"license": "MIT"
},
"node_modules/@babel/code-frame": {
"version": "7.24.7",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.7.tgz",
@ -2188,6 +2275,12 @@
"@jridgewell/sourcemap-codec": "^1.4.14"
}
},
"node_modules/@jsdevtools/ono": {
"version": "7.1.3",
"resolved": "https://registry.npmjs.org/@jsdevtools/ono/-/ono-7.1.3.tgz",
"integrity": "sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==",
"license": "MIT"
},
"node_modules/@kurkle/color": {
"version": "0.3.4",
"resolved": "https://registry.npmjs.org/@kurkle/color/-/color-0.3.4.tgz",
@ -2490,9 +2583,10 @@
}
},
"node_modules/@types/json-schema": {
"version": "7.0.11",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz",
"integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ=="
"version": "7.0.15",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
"integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==",
"license": "MIT"
},
"node_modules/@types/mime": {
"version": "3.0.1",
@ -2969,6 +3063,12 @@
"integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==",
"dev": true
},
"node_modules/argparse": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
"license": "Python-2.0"
},
"node_modules/array-flatten": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-2.1.2.tgz",
@ -3541,6 +3641,12 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/call-me-maybe": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.2.tgz",
"integrity": "sha512-HpX65o1Hnr9HH25ojC1YGs7HCQLq0GCOibSaWER0eNpgJ/Z1MZv2mTc7+xh6WOPxbRVcmgbv4hGU+uSQ/2xFZQ==",
"license": "MIT"
},
"node_modules/callsites": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
@ -6568,6 +6674,18 @@
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
"integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="
},
"node_modules/js-yaml": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
"integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
"license": "MIT",
"dependencies": {
"argparse": "^2.0.1"
},
"bin": {
"js-yaml": "bin/js-yaml.js"
}
},
"node_modules/jsbn": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
@ -7726,6 +7844,13 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/openapi-types": {
"version": "12.1.3",
"resolved": "https://registry.npmjs.org/openapi-types/-/openapi-types-12.1.3.tgz",
"integrity": "sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw==",
"license": "MIT",
"peer": true
},
"node_modules/os-browserify": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz",
@ -11483,6 +11608,64 @@
"@jridgewell/trace-mapping": "^0.3.9"
}
},
"@apidevtools/json-schema-ref-parser": {
"version": "11.7.2",
"resolved": "https://registry.npmjs.org/@apidevtools/json-schema-ref-parser/-/json-schema-ref-parser-11.7.2.tgz",
"integrity": "sha512-4gY54eEGEstClvEkGnwVkTkrx0sqwemEFG5OSRRn3tD91XH0+Q8XIkYIfo7IwEWPpJZwILb9GUXeShtplRc/eA==",
"requires": {
"@jsdevtools/ono": "^7.1.3",
"@types/json-schema": "^7.0.15",
"js-yaml": "^4.1.0"
}
},
"@apidevtools/openapi-schemas": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/@apidevtools/openapi-schemas/-/openapi-schemas-2.1.0.tgz",
"integrity": "sha512-Zc1AlqrJlX3SlpupFGpiLi2EbteyP7fXmUOGup6/DnkRgjP9bgMM/ag+n91rsv0U1Gpz0H3VILA/o3bW7Ua6BQ=="
},
"@apidevtools/swagger-methods": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/@apidevtools/swagger-methods/-/swagger-methods-3.0.2.tgz",
"integrity": "sha512-QAkD5kK2b1WfjDS/UQn/qQkbwF31uqRjPTrsCs5ZG9BQGAkjwvqGFjjPqAuzac/IYzpPtRzjCP1WrTuAIjMrXg=="
},
"@apidevtools/swagger-parser": {
"version": "10.1.1",
"resolved": "https://registry.npmjs.org/@apidevtools/swagger-parser/-/swagger-parser-10.1.1.tgz",
"integrity": "sha512-u/kozRnsPO/x8QtKYJOqoGtC4kH6yg1lfYkB9Au0WhYB0FNLpyFusttQtvhlwjtG3rOwiRz4D8DnnXa8iEpIKA==",
"requires": {
"@apidevtools/json-schema-ref-parser": "11.7.2",
"@apidevtools/openapi-schemas": "^2.1.0",
"@apidevtools/swagger-methods": "^3.0.2",
"@jsdevtools/ono": "^7.1.3",
"ajv": "^8.17.1",
"ajv-draft-04": "^1.0.0",
"call-me-maybe": "^1.0.2"
},
"dependencies": {
"ajv": {
"version": "8.17.1",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz",
"integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==",
"requires": {
"fast-deep-equal": "^3.1.3",
"fast-uri": "^3.0.1",
"json-schema-traverse": "^1.0.0",
"require-from-string": "^2.0.2"
}
},
"ajv-draft-04": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/ajv-draft-04/-/ajv-draft-04-1.0.0.tgz",
"integrity": "sha512-mv00Te6nmYbRp5DCwclxtt7yV/joXJPGS7nM+97GdxvuttCOfgI3K4U25zboyeX0O+myI8ERluxQe5wljMmVIw==",
"requires": {}
},
"json-schema-traverse": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
"integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="
}
}
},
"@babel/code-frame": {
"version": "7.24.7",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.7.tgz",
@ -12866,6 +13049,11 @@
"@jridgewell/sourcemap-codec": "^1.4.14"
}
},
"@jsdevtools/ono": {
"version": "7.1.3",
"resolved": "https://registry.npmjs.org/@jsdevtools/ono/-/ono-7.1.3.tgz",
"integrity": "sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg=="
},
"@kurkle/color": {
"version": "0.3.4",
"resolved": "https://registry.npmjs.org/@kurkle/color/-/color-0.3.4.tgz",
@ -13142,9 +13330,9 @@
}
},
"@types/json-schema": {
"version": "7.0.11",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz",
"integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ=="
"version": "7.0.15",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
"integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA=="
},
"@types/mime": {
"version": "3.0.1",
@ -13541,6 +13729,11 @@
"integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==",
"dev": true
},
"argparse": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="
},
"array-flatten": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-2.1.2.tgz",
@ -13981,6 +14174,11 @@
"get-intrinsic": "^1.0.2"
}
},
"call-me-maybe": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.2.tgz",
"integrity": "sha512-HpX65o1Hnr9HH25ojC1YGs7HCQLq0GCOibSaWER0eNpgJ/Z1MZv2mTc7+xh6WOPxbRVcmgbv4hGU+uSQ/2xFZQ=="
},
"callsites": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
@ -16224,6 +16422,14 @@
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
"integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="
},
"js-yaml": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
"integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
"requires": {
"argparse": "^2.0.1"
}
},
"jsbn": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
@ -17085,6 +17291,12 @@
"is-wsl": "^2.2.0"
}
},
"openapi-types": {
"version": "12.1.3",
"resolved": "https://registry.npmjs.org/openapi-types/-/openapi-types-12.1.3.tgz",
"integrity": "sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw==",
"peer": true
},
"os-browserify": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz",

View File

@ -24,6 +24,7 @@
"vue-template-compiler": "^2.6.14"
},
"dependencies": {
"@apidevtools/swagger-parser": "^10.1.1",
"axios": "^0.25",
"card-js": "^1.0.13",
"card-validator": "^8.1.1",

View File

@ -130,7 +130,7 @@ use App\Http\Controllers\Reports\RecurringInvoiceReportController;
use App\Http\Controllers\Reports\PurchaseOrderItemReportController;
Route::group(['middleware' => ['throttle:api', 'api_secret_check']], function () {
Route::post('api/v1/signup', [AccountController::class, 'store'])->name('signup.submit')->middleware('throttle:1,10');
Route::post('api/v1/signup', [AccountController::class, 'store'])->name('signup.submit')->middleware('throttle:1,1');
Route::post('api/v1/oauth_login', [LoginController::class, 'oauthApiLogin']);
});

View File

@ -0,0 +1,242 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace Tests\Feature\Export;
use Tests\TestCase;
use App\Models\User;
use App\Models\Client;
use App\Models\Account;
use App\Models\Company;
use App\Models\Expense;
use App\Models\Invoice;
use App\Models\Activity;
use App\Utils\Traits\AppSetup;
use App\Utils\Traits\MakesHash;
use App\DataMapper\CompanySettings;
use App\Factory\InvoiceItemFactory;
use App\Services\Report\EInvoiceReport;
use Illuminate\Routing\Middleware\ThrottleRequests;
/**
*
*/
class EInvoiceReportTest extends TestCase
{
use MakesHash;
use AppSetup;
public $faker;
protected function setUp(): void
{
parent::setUp();
$this->faker = \Faker\Factory::create();
$this->withoutMiddleware(
ThrottleRequests::class
);
$this->withoutExceptionHandling();
}
public $company;
public $user;
public $payload;
public $account;
public $client;
/**
* start_date - Y-m-d
end_date - Y-m-d
date_range -
all
last7
last30
this_month
last_month
this_quarter
last_quarter
this_year
custom
is_income_billed - true = Invoiced || false = Payments
expense_billed - true = Expensed || false = Expenses marked as paid
include_tax - true tax_included || false - tax_excluded
*/
private function buildData()
{
$this->account = Account::factory()->create([
'hosted_client_count' => 1000,
'hosted_company_count' => 1000,
]);
$this->account->num_users = 3;
$this->account->save();
$this->user = User::factory()->create([
'account_id' => $this->account->id,
'confirmation_code' => 'xyz123',
'email' => $this->faker->unique()->safeEmail(),
]);
$settings = CompanySettings::defaults();
$settings->client_online_payment_notification = false;
$settings->client_manual_payment_notification = false;
$settings->currency_id = '1';
$this->company = Company::factory()->create([
'account_id' => $this->account->id,
'settings' => $settings,
]);
$this->company->settings = $settings;
$this->company->save();
$this->payload = [
'start_date' => '2000-01-01',
'end_date' => '2030-01-11',
'date_range' => 'custom',
];
$this->client = Client::factory()->create([
'user_id' => $this->user->id,
'company_id' => $this->company->id,
'is_deleted' => 0,
]);
}
public function testUserSalesInstance()
{
$this->buildData();
$pl = new EInvoiceReport($this->company, $this->payload);
$this->assertInstanceOf(EInvoiceReport::class, $pl);
$this->account->delete();
}
public function testSimpleReport()
{
$this->buildData();
$this->payload = [
'start_date' => '2000-01-01',
'end_date' => '2030-01-11',
'date_range' => 'custom',
'report_keys' => []
];
$guid = new \stdClass;
$guid->guid = '1234567890';
$i = Invoice::factory()->create([
'client_id' => $this->client->id,
'user_id' => $this->user->id,
'company_id' => $this->company->id,
'backup' => $guid,
'amount' => 0,
'balance' => 0,
'status_id' => 2,
'total_taxes' => 1,
'date' => now()->format('Y-m-d'),
'terms' => 'nada',
'discount' => 0,
'tax_rate1' => 0,
'tax_rate2' => 0,
'tax_rate3' => 0,
'tax_name1' => '',
'tax_name2' => '',
'tax_name3' => '',
'uses_inclusive_taxes' => false,
'line_items' => $this->buildLineItems(),
]);
$i = $i->calc()->getInvoice();
$pl = new EInvoiceReport($this->company, $this->payload);
$response = $pl->run();
$this->assertIsString($response);
$this->account->delete();
}
public function testExpenseEInvoiceComponent()
{
$this->buildData();
$this->payload = [
'start_date' => '2000-01-01',
'end_date' => '2030-01-11',
'date_range' => 'custom',
'report_keys' => []
];
$e = Expense::factory()->create([
'user_id' => $this->user->id,
'company_id' => $this->company->id,
'amount' => 100,
'public_notes' => 'Expensive Business!!',
'should_be_invoiced' => true,
]);
$a = new Activity();
$a->expense_id = $e->id;
$a->company_id = $this->company->id;
$a->user_id = $this->user->id;
$a->activity_type_id = 148;
$a->save();
$pl = new EInvoiceReport($this->company, $this->payload);
$response = $pl->run();
$this->assertIsString($response);
$this->account->delete();
}
private function buildLineItems()
{
$line_items = [];
$item = InvoiceItemFactory::create();
$item->quantity = 1;
$item->cost = 10;
$item->product_key = 'test';
$item->notes = 'test_product';
// $item->task_id = $this->encodePrimaryKey($this->task->id);
// $item->expense_id = $this->encodePrimaryKey($this->expense->id);
$line_items[] = $item;
$item = InvoiceItemFactory::create();
$item->quantity = 1;
$item->cost = 10;
$item->product_key = 'pumpkin';
$item->notes = 'test_pumpkin';
// $item->task_id = $this->encodePrimaryKey($this->task->id);
// $item->expense_id = $this->encodePrimaryKey($this->expense->id);
$line_items[] = $item;
return $line_items;
}
}