mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 21:22:58 +01:00
Fixes for trials in subscriptions
This commit is contained in:
parent
9db0159b06
commit
373690789e
@ -234,6 +234,9 @@ class SubscriptionService
|
|||||||
// Redirects from here work just fine. Livewire will respect it.
|
// Redirects from here work just fine. Livewire will respect it.
|
||||||
$client_contact = ClientContact::find($this->decodePrimaryKey($data['contact_id']));
|
$client_contact = ClientContact::find($this->decodePrimaryKey($data['contact_id']));
|
||||||
|
|
||||||
|
if(is_string($data['client_id']))
|
||||||
|
$data['client_id'] = $this->decodePrimaryKey($data['client_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");
|
||||||
}
|
}
|
||||||
@ -256,7 +259,7 @@ class SubscriptionService
|
|||||||
if (array_key_exists('coupon', $data) && ($data['coupon'] == $this->subscription->promo_code) && $this->subscription->promo_discount > 0) {
|
if (array_key_exists('coupon', $data) && ($data['coupon'] == $this->subscription->promo_code) && $this->subscription->promo_discount > 0) {
|
||||||
$recurring_invoice->discount = $this->subscription->promo_discount;
|
$recurring_invoice->discount = $this->subscription->promo_discount;
|
||||||
$recurring_invoice->is_amount_discount = $this->subscription->is_amount_discount;
|
$recurring_invoice->is_amount_discount = $this->subscription->is_amount_discount;
|
||||||
} elseif (strlen($this->subscription->promo_code) == 0 && $this->subscription->promo_discount > 0) {
|
} elseif (strlen($this->subscription->promo_code ?? '') == 0 && $this->subscription->promo_discount > 0) {
|
||||||
$recurring_invoice->discount = $this->subscription->promo_discount;
|
$recurring_invoice->discount = $this->subscription->promo_discount;
|
||||||
$recurring_invoice->is_amount_discount = $this->subscription->is_amount_discount;
|
$recurring_invoice->is_amount_discount = $this->subscription->is_amount_discount;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user