From fd3993d84edd376209e611ca911bd949c6b3ae9f Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 4 Jun 2021 07:43:22 +1000 Subject: [PATCH] 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 4d433b88b34d..fde9a8a163c8 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 ec3be1051d2e..db3048a2f5fe 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(); }