From d6f1caef737d5911863203172cba519298a90ced Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 4 Jun 2021 07:30:11 +1000 Subject: [PATCH 1/2] Fixes for passing variables to artisan commands --- app/Jobs/Util/SchedulerCheck.php | 2 +- app/Listeners/User/UpdateUserLastLogin.php | 6 +++--- app/Models/Company.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Jobs/Util/SchedulerCheck.php b/app/Jobs/Util/SchedulerCheck.php index 52cde6782b..adeb4e0160 100644 --- a/app/Jobs/Util/SchedulerCheck.php +++ b/app/Jobs/Util/SchedulerCheck.php @@ -44,7 +44,7 @@ class SchedulerCheck implements ShouldQueue { try { - Artisan::call('migrate', ['--force' => 'true']); + Artisan::call('migrate', ['--force' => true]); } catch (\Exception $e) { nlog("I wasn't able to migrate the data."); nlog($e->getMessage()); diff --git a/app/Listeners/User/UpdateUserLastLogin.php b/app/Listeners/User/UpdateUserLastLogin.php index c8d33cdd01..908d37fb9d 100644 --- a/app/Listeners/User/UpdateUserLastLogin.php +++ b/app/Listeners/User/UpdateUserLastLogin.php @@ -57,9 +57,9 @@ class UpdateUserLastLogin implements ShouldQueue if($user->ip != $ip) { $nmo = new NinjaMailerObject; - $nmo->mailable = new UserLoggedIn($user, $user->account->companies()->first(), $ip); - $nmo->company = $user->account->companies()->first(); - $nmo->settings = $user->account->companies()->first()->settings; + $nmo->mailable = new UserLoggedIn($user, $user->account->companies->first(), $ip); + $nmo->company = $user->account->companies->first(); + $nmo->settings = $user->account->companies->first()->settings; $nmo->to_user = $user; NinjaMailerJob::dispatch($nmo); diff --git a/app/Models/Company.php b/app/Models/Company.php index 50096c00ab..8f6feae301 100644 --- a/app/Models/Company.php +++ b/app/Models/Company.php @@ -133,7 +133,7 @@ class Company extends BaseModel public function all_documents() { - return $this->HasMany(Document::class); + return $this->hasMany(Document::class); } public function getEntityType() From fd3993d84edd376209e611ca911bd949c6b3ae9f Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 4 Jun 2021 07:43:22 +1000 Subject: [PATCH 2/2] Fixes for subscriptions --- app/Http/Livewire/BillingPortalPurchase.php | 7 ++----- app/Services/Subscription/SubscriptionService.php | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/app/Http/Livewire/BillingPortalPurchase.php b/app/Http/Livewire/BillingPortalPurchase.php index 4d433b88b3..fde9a8a163 100644 --- a/app/Http/Livewire/BillingPortalPurchase.php +++ b/app/Http/Livewire/BillingPortalPurchase.php @@ -389,12 +389,9 @@ class BillingPortalPurchase extends Component $is_eligible = $this->subscription->service()->isEligible($this->contact); - if($is_eligible){ - - } - elseif ($is_eligible['status_code'] != 200) { + if ($is_eligible['status_code'] != 200) { $this->steps['not_eligible'] = true; - $this->steps['not_eligible_message'] = $is_eligible['exception']['message']; + $this->steps['not_eligible_message'] = $is_eligible['message']; $this->steps['show_loading_bar'] = false; return; diff --git a/app/Services/Subscription/SubscriptionService.php b/app/Services/Subscription/SubscriptionService.php index ec3be1051d..db3048a2f5 100644 --- a/app/Services/Subscription/SubscriptionService.php +++ b/app/Services/Subscription/SubscriptionService.php @@ -631,7 +631,7 @@ class SubscriptionService public function triggerWebhook($context) { if (empty($this->subscription->webhook_configuration['post_purchase_url']) || empty($this->subscription->webhook_configuration['post_purchase_rest_method'])) { - return ['status_code' => 200]; + return ["message" => "Success", "status_code" => 200]; } $response = false; @@ -652,10 +652,7 @@ class SubscriptionService } else { - $status = $response->getStatusCode(); - - //$response_body = $response->getReasonPhrase(); - //$body = array_merge($body, ['status' => $status, 'response_body' => $response_body]); + $body = $response->getStatusCode(); }