mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Prevent duplicate billing
This commit is contained in:
parent
6a648ad2c9
commit
403b784e17
@ -8,6 +8,7 @@ use App\Ninja\Mailers\ContactMailer as Mailer;
|
|||||||
use App\Ninja\Repositories\AccountRepository;
|
use App\Ninja\Repositories\AccountRepository;
|
||||||
use App\Services\PaymentService;
|
use App\Services\PaymentService;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
|
use Carbon;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ChargeRenewalInvoices.
|
* Class ChargeRenewalInvoices.
|
||||||
@ -83,6 +84,11 @@ class ChargeRenewalInvoices extends Command
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Carbon::parse($company->plan_expires)->isFuture()) {
|
||||||
|
$this->info('Skipping invoice ' . $invoice->invoice_number . ' [plan not expired]');
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$this->info("Charging invoice {$invoice->invoice_number}");
|
$this->info("Charging invoice {$invoice->invoice_number}");
|
||||||
if (! $this->paymentService->autoBillInvoice($invoice)) {
|
if (! $this->paymentService->autoBillInvoice($invoice)) {
|
||||||
$this->info('Failed to auto-bill, emailing invoice');
|
$this->info('Failed to auto-bill, emailing invoice');
|
||||||
|
@ -356,6 +356,9 @@ class AccountRepository
|
|||||||
$account->company_id = $company->id;
|
$account->company_id = $company->id;
|
||||||
$account->save();
|
$account->save();
|
||||||
|
|
||||||
|
$emailSettings = new AccountEmailSettings();
|
||||||
|
$account->account_email_settings()->save($emailSettings);
|
||||||
|
|
||||||
$random = strtolower(str_random(RANDOM_KEY_LENGTH));
|
$random = strtolower(str_random(RANDOM_KEY_LENGTH));
|
||||||
$user = new User();
|
$user = new User();
|
||||||
$user->registered = true;
|
$user->registered = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user