From 9db0159b06b551f803ef684e8de40f65a03a59d5 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sat, 14 Oct 2023 08:34:34 +1100 Subject: [PATCH] Fixes for trials in subscriptions --- app/Http/Livewire/BillingPortalPurchase.php | 4 ++-- app/Services/Subscription/SubscriptionService.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Http/Livewire/BillingPortalPurchase.php b/app/Http/Livewire/BillingPortalPurchase.php index 74e693faa459..f8e625e03cf8 100644 --- a/app/Http/Livewire/BillingPortalPurchase.php +++ b/app/Http/Livewire/BillingPortalPurchase.php @@ -425,8 +425,8 @@ class BillingPortalPurchase extends Component return $this->subscription->service()->startTrial([ 'email' => $this->email ?? $this->contact->email, 'quantity' => $this->quantity, - 'contact_id' => $this->contact->id, - 'client_id' => $this->contact->client->id, + 'contact_id' => $this->contact->hashed_id, + 'client_id' => $this->contact->client->hashed_id, ]); } diff --git a/app/Services/Subscription/SubscriptionService.php b/app/Services/Subscription/SubscriptionService.php index 901b970f0bfb..64b13fa38db3 100644 --- a/app/Services/Subscription/SubscriptionService.php +++ b/app/Services/Subscription/SubscriptionService.php @@ -230,9 +230,9 @@ class SubscriptionService - we then return the user to either a predefined user endpoint, OR we return the user to the recurring invoice page. */ public function startTrial(array $data) - {nlog($data); + { // Redirects from here work just fine. Livewire will respect it. - $client_contact = ClientContact::find($data['contact_id']); + $client_contact = ClientContact::find($this->decodePrimaryKey($data['contact_id'])); if (!$this->subscription->trial_enabled) { return new \Exception("Trials are disabled for this product");