Fixes for trials in subscriptions

This commit is contained in:
David Bomba 2023-10-14 08:34:34 +11:00
parent e682017cf4
commit 9db0159b06
2 changed files with 4 additions and 4 deletions

View File

@ -425,8 +425,8 @@ class BillingPortalPurchase extends Component
return $this->subscription->service()->startTrial([ return $this->subscription->service()->startTrial([
'email' => $this->email ?? $this->contact->email, 'email' => $this->email ?? $this->contact->email,
'quantity' => $this->quantity, 'quantity' => $this->quantity,
'contact_id' => $this->contact->id, 'contact_id' => $this->contact->hashed_id,
'client_id' => $this->contact->client->id, 'client_id' => $this->contact->client->hashed_id,
]); ]);
} }

View File

@ -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. - 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) public function startTrial(array $data)
{nlog($data); {
// Redirects from here work just fine. Livewire will respect it. // 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) { if (!$this->subscription->trial_enabled) {
return new \Exception("Trials are disabled for this product"); return new \Exception("Trials are disabled for this product");