mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Scaffolds for billing_subscriptions
This commit is contained in:
parent
097d9ac1b8
commit
93493116ed
@ -35,25 +35,34 @@ class BillingSubscriptionCron
|
|||||||
*/
|
*/
|
||||||
public function handle() : void
|
public function handle() : void
|
||||||
{
|
{
|
||||||
/* Get all invoices where the send date is less than NOW + 30 minutes() */
|
|
||||||
|
|
||||||
if (! config('ninja.db.multi_db_enabled')) {
|
if (! config('ninja.db.multi_db_enabled')) {
|
||||||
|
$this->loopSubscriptions();
|
||||||
} else {
|
} else {
|
||||||
//multiDB environment, need to
|
//multiDB environment, need to
|
||||||
foreach (MultiDB::$dbs as $db) {
|
foreach (MultiDB::$dbs as $db) {
|
||||||
|
|
||||||
MultiDB::setDB($db);
|
MultiDB::setDB($db);
|
||||||
|
$this->loopSubscriptions();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function loopSubscriptions()
|
||||||
|
{
|
||||||
|
$client_subs = ClientSubscription::whereNull('deleted_at')
|
||||||
|
->cursor()
|
||||||
|
->each(function ($cs){
|
||||||
|
$this->processSubscription($cs);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/* Our daily cron should check
|
/* Our daily cron should check
|
||||||
|
|
||||||
1. Is the subscription still in trial phase?
|
1. Is the subscription still in trial phase?
|
||||||
2. Check the recurring invoice and its remaining_cycles to see whether we need to cancel or perform any other function.
|
2. Check the recurring invoice and its remaining_cycles to see whether we need to cancel or perform any other function.
|
||||||
|
3. Any notifications that need to fire?
|
||||||
*/
|
*/
|
||||||
private function processSubscription($client_subscription)
|
private function processSubscription($client_subscription)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user