mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 09:54:34 -04:00
Minor fixes for subscription types
This commit is contained in:
parent
32fd16dfb7
commit
f5c6847a36
@ -53,7 +53,7 @@ class StoreSubscriptionRequest extends Request
|
|||||||
'allow_plan_changes' => ['sometimes'],
|
'allow_plan_changes' => ['sometimes'],
|
||||||
'plan_map' => ['sometimes'],
|
'plan_map' => ['sometimes'],
|
||||||
'refund_period' => ['sometimes'],
|
'refund_period' => ['sometimes'],
|
||||||
'webhook_configuration' => ['sometimes'],
|
'webhook_configuration' => ['array'],
|
||||||
'name' => Rule::unique('subscriptions')->where('company_id', auth()->user()->company()->id)
|
'name' => Rule::unique('subscriptions')->where('company_id', auth()->user()->company()->id)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -62,11 +62,11 @@ class StoreSubscriptionRequest extends Request
|
|||||||
{
|
{
|
||||||
$input = $this->all();
|
$input = $this->all();
|
||||||
|
|
||||||
if(array_key_exists('webhook_configuration', $input) && (!is_object(json_decode($input['webhook_configuration']))))
|
// if(array_key_exists('webhook_configuration', $input) && (!is_object(json_decode($input['webhook_configuration']))))
|
||||||
$input['webhook_configuration'] = new \stdClass;
|
// $input['webhook_configuration'] = new \stdClass;
|
||||||
|
|
||||||
if(!array_key_exists('webhook_configuration', $input))
|
// if(!array_key_exists('webhook_configuration', $input))
|
||||||
$input['webhook_configuration'] = new \stdClass;
|
// $input['webhook_configuration'] = new \stdClass;
|
||||||
|
|
||||||
$this->replace($input);
|
$this->replace($input);
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ class Subscription extends BaseModel
|
|||||||
protected $casts = [
|
protected $casts = [
|
||||||
'is_deleted' => 'boolean',
|
'is_deleted' => 'boolean',
|
||||||
'plan_map' => 'object',
|
'plan_map' => 'object',
|
||||||
'webhook_configuration' => 'object',
|
'webhook_configuration' => 'array',
|
||||||
'updated_at' => 'timestamp',
|
'updated_at' => 'timestamp',
|
||||||
'created_at' => 'timestamp',
|
'created_at' => 'timestamp',
|
||||||
'deleted_at' => 'timestamp',
|
'deleted_at' => 'timestamp',
|
||||||
|
@ -103,8 +103,8 @@ class SubscriptionService
|
|||||||
//execute any webhooks
|
//execute any webhooks
|
||||||
$this->triggerWebhook();
|
$this->triggerWebhook();
|
||||||
|
|
||||||
if(property_exists($this->subscription->webhook_configuration, 'post_purchase_url') && strlen($this->subscription->webhook_configuration->post_purchase_url) >=1)
|
if(array_key_exists('post_purchase_url', $this->subscription->webhook_configuration) && strlen($this->subscription->webhook_configuration['post_purchase_url']) >=1)
|
||||||
return redirect($this->subscription->webhook_configuration->post_purchase_url);
|
return redirect($this->subscription->webhook_configuration['post_purchase_url']);
|
||||||
|
|
||||||
return redirect('/client/recurring_invoices/'.$recurring_invoice->hashed_id);
|
return redirect('/client/recurring_invoices/'.$recurring_invoice->hashed_id);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user