mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01: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'],
|
||||
'plan_map' => ['sometimes'],
|
||||
'refund_period' => ['sometimes'],
|
||||
'webhook_configuration' => ['sometimes'],
|
||||
'webhook_configuration' => ['array'],
|
||||
'name' => Rule::unique('subscriptions')->where('company_id', auth()->user()->company()->id)
|
||||
];
|
||||
}
|
||||
@ -62,11 +62,11 @@ class StoreSubscriptionRequest extends Request
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
if(array_key_exists('webhook_configuration', $input) && (!is_object(json_decode($input['webhook_configuration']))))
|
||||
$input['webhook_configuration'] = new \stdClass;
|
||||
// if(array_key_exists('webhook_configuration', $input) && (!is_object(json_decode($input['webhook_configuration']))))
|
||||
// $input['webhook_configuration'] = new \stdClass;
|
||||
|
||||
if(!array_key_exists('webhook_configuration', $input))
|
||||
$input['webhook_configuration'] = new \stdClass;
|
||||
// if(!array_key_exists('webhook_configuration', $input))
|
||||
// $input['webhook_configuration'] = new \stdClass;
|
||||
|
||||
$this->replace($input);
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ class Subscription extends BaseModel
|
||||
protected $casts = [
|
||||
'is_deleted' => 'boolean',
|
||||
'plan_map' => 'object',
|
||||
'webhook_configuration' => 'object',
|
||||
'webhook_configuration' => 'array',
|
||||
'updated_at' => 'timestamp',
|
||||
'created_at' => 'timestamp',
|
||||
'deleted_at' => 'timestamp',
|
||||
|
@ -103,8 +103,8 @@ class SubscriptionService
|
||||
//execute any webhooks
|
||||
$this->triggerWebhook();
|
||||
|
||||
if(property_exists($this->subscription->webhook_configuration, 'post_purchase_url') && strlen($this->subscription->webhook_configuration->post_purchase_url) >=1)
|
||||
return redirect($this->subscription->webhook_configuration->post_purchase_url);
|
||||
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('/client/recurring_invoices/'.$recurring_invoice->hashed_id);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user