Merge pull request #6212 from turbo124/v5-develop

Minor fixes for subscription activities
This commit is contained in:
David Bomba 2021-07-06 07:58:37 +10:00 committed by GitHub
commit 2c76b248f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 12 additions and 9 deletions

View File

@ -64,7 +64,7 @@ class Kernel extends ConsoleKernel
$schedule->job(new AutoBillCron)->dailyAt('00:30')->withoutOverlapping(); $schedule->job(new AutoBillCron)->dailyAt('00:30')->withoutOverlapping();
$schedule->job(new SchedulerCheck)->everyFiveMinutes(); $schedule->job(new SchedulerCheck)->daily()->withoutOverlapping();
/* Run hosted specific jobs */ /* Run hosted specific jobs */
if (Ninja::isHosted()) { if (Ninja::isHosted()) {

View File

@ -28,6 +28,7 @@ use App\Models\Account;
use App\Models\Timezone; use App\Models\Timezone;
use App\Notifications\Ninja\NewAccountCreated; use App\Notifications\Ninja\NewAccountCreated;
use App\Utils\Ninja; use App\Utils\Ninja;
use App\Utils\Traits\User\LoginCache;
use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
@ -39,6 +40,7 @@ use Turbo124\Beacon\Facades\LightLogs;
class CreateAccount class CreateAccount
{ {
use Dispatchable; use Dispatchable;
use LoginCache;
protected $request; protected $request;
@ -77,9 +79,6 @@ class CreateAccount
$sp794f3f->save(); $sp794f3f->save();
if(Ninja::isHosted())
$sp794f3f->startTrial('pro');
$sp035a66 = CreateCompany::dispatchNow($this->request, $sp794f3f); $sp035a66 = CreateCompany::dispatchNow($this->request, $sp794f3f);
$sp035a66->load('account'); $sp035a66->load('account');
$sp794f3f->default_company_id = $sp035a66->id; $sp794f3f->default_company_id = $sp035a66->id;
@ -95,6 +94,8 @@ class CreateAccount
} }
$spaa9f78->setCompany($sp035a66); $spaa9f78->setCompany($sp035a66);
$this->setLoginCache($spaa9f78);
$spafe62e = isset($this->request['token_name']) ? $this->request['token_name'] : request()->server('HTTP_USER_AGENT'); $spafe62e = isset($this->request['token_name']) ? $this->request['token_name'] : request()->server('HTTP_USER_AGENT');
$sp2d97e8 = CreateCompanyToken::dispatchNow($sp035a66, $spaa9f78, $spafe62e); $sp2d97e8 = CreateCompanyToken::dispatchNow($sp035a66, $spaa9f78, $spafe62e);

View File

@ -221,8 +221,8 @@ class CompanyImport implements ShouldQueue
private function unzipFile() private function unzipFile()
{ {
if(mime_content_type(Storage::path($this->file_location)) == 'text/plain') // if(mime_content_type(Storage::path($this->file_location)) == 'text/plain')
return Storage::path($this->file_location); // return Storage::path($this->file_location);
$path = TempFile::filePath(Storage::get($this->file_location), basename($this->file_location)); $path = TempFile::filePath(Storage::get($this->file_location), basename($this->file_location));

View File

@ -50,7 +50,7 @@ $user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars[
$fields->subscription_id = $subscription->id; $fields->subscription_id = $subscription->id;
$fields->user_id = $user_id; $fields->user_id = $user_id;
$fields->company_id = $subscription->company_id; $fields->company_id = $subscription->company_id;
$fields->activity_type_id = Activity::ARCHIVE_SUBSCRIPTIOn; $fields->activity_type_id = Activity::ARCHIVE_SUBSCRIPTION;
$this->activity_repo->save($fields, $subscription, $event->event_vars); $this->activity_repo->save($fields, $subscription, $event->event_vars);
} }

View File

@ -161,6 +161,8 @@ class User extends Authenticatable implements MustVerifyEmail
public function setCompany($company) public function setCompany($company)
{ {
$this->company = $company; $this->company = $company;
return $this;
} }
/** /**

View File

@ -114,7 +114,7 @@ class StripePaymentDriver extends BaseDriver
public function gatewayTypes(): array public function gatewayTypes(): array
{ {
$types = [ $types = [
GatewayType::CRYPTO, // GatewayType::CRYPTO,
GatewayType::CREDIT_CARD GatewayType::CREDIT_CARD
]; ];

View File

@ -60,7 +60,7 @@ class ClientService
return Number::roundValue($credits->sum('balance'), $this->client->currency()->precision); return Number::roundValue($credits->sum('balance'), $this->client->currency()->precision);
} }
public function getCredits() :Collection public function getCredits()
{ {
return $this->client->credits() return $this->client->credits()
->where('is_deleted', false) ->where('is_deleted', false)