Prevent duplicate billing
This commit is contained in:
parent
6a648ad2c9
commit
403b784e17
2 changed files with 9 additions and 0 deletions
|
|
@ -8,6 +8,7 @@ use App\Ninja\Mailers\ContactMailer as Mailer;
|
|||
use App\Ninja\Repositories\AccountRepository;
|
||||
use App\Services\PaymentService;
|
||||
use Illuminate\Console\Command;
|
||||
use Carbon;
|
||||
|
||||
/**
|
||||
* Class ChargeRenewalInvoices.
|
||||
|
|
@ -83,6 +84,11 @@ class ChargeRenewalInvoices extends Command
|
|||
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}");
|
||||
if (! $this->paymentService->autoBillInvoice($invoice)) {
|
||||
$this->info('Failed to auto-bill, emailing invoice');
|
||||
|
|
|
|||
|
|
@ -356,6 +356,9 @@ class AccountRepository
|
|||
$account->company_id = $company->id;
|
||||
$account->save();
|
||||
|
||||
$emailSettings = new AccountEmailSettings();
|
||||
$account->account_email_settings()->save($emailSettings);
|
||||
|
||||
$random = strtolower(str_random(RANDOM_KEY_LENGTH));
|
||||
$user = new User();
|
||||
$user->registered = true;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue