mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 23:57:33 -05:00 
			
		
		
		
	Merge pull request #5285 from turbo124/v5-develop
Minor fixes for subscription types
This commit is contained in:
		
						commit
						1d48f55354
					
				@ -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…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user