mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Handle trials
This commit is contained in:
parent
1b7bbdfb87
commit
b950c805be
@ -26,6 +26,7 @@ use App\Models\Invoice;
|
||||
use App\Models\RecurringInvoice;
|
||||
use App\Models\Subscription;
|
||||
use App\Notifications\Ninja\NewAccountNotification;
|
||||
use App\Repositories\RecurringInvoiceRepository;
|
||||
use App\Repositories\SubscriptionRepository;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
@ -178,6 +179,15 @@ class NinjaPlanController extends Controller
|
||||
->increment()
|
||||
->queue();
|
||||
|
||||
|
||||
$old_recurring = RecurringInvoice::where('company_id', config('ninja.ninja_default_company_id'))->where('client_id', $client->id)->first();
|
||||
|
||||
if($old_recurring) {
|
||||
$old_recurring->service()->stop()->save();
|
||||
$old_recurring_repo = new RecurringInvoiceRepository();
|
||||
$old_recurring_repo->archive($old_recurring);
|
||||
}
|
||||
|
||||
$ninja_company = Company::on('db-ninja-01')->find(config('ninja.ninja_default_company_id'));
|
||||
$ninja_company->notification(new NewAccountNotification($subscription->company->account, $client))->ninja();
|
||||
|
||||
|
@ -631,7 +631,6 @@ class StripePaymentDriver extends BaseDriver
|
||||
// if($request->type === 'payment_intent.requires_action')
|
||||
// nlog($request->all());
|
||||
|
||||
//payment_intent.succeeded - this will confirm or cancel the payment
|
||||
if($request->type === 'customer.source.updated') {
|
||||
$ach = new ACH($this);
|
||||
$ach->updateBankAccount($request->all());
|
||||
@ -639,10 +638,10 @@ class StripePaymentDriver extends BaseDriver
|
||||
|
||||
if($request->type === 'payment_intent.processing') {
|
||||
PaymentIntentProcessingWebhook::dispatch($request->data, $request->company_key, $this->company_gateway->id)->delay(now()->addSeconds(2));
|
||||
|
||||
return response()->json([], 200);
|
||||
}
|
||||
|
||||
//payment_intent.succeeded - this will confirm or cancel the payment
|
||||
if ($request->type === 'payment_intent.succeeded') {
|
||||
PaymentIntentWebhook::dispatch($request->data, $request->company_key, $this->company_gateway->id)->delay(now()->addSeconds(rand(5, 10)));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user