fixes for subscriptions

This commit is contained in:
David Bomba 2021-04-02 09:09:01 +11:00
parent 277885879c
commit c3eb46d0b7
4 changed files with 2 additions and 8 deletions

View File

@ -17,13 +17,11 @@
* @OA\Property(property="allow_cancellation", type="boolean", example="true", description="______"),
* @OA\Property(property="per_seat_enabled", type="boolean", example="true", description="______"),
* @OA\Property(property="currency_id", type="integer", example="1", description="______"),
* @OA\Property(property="min_seats_limit", type="integer", example="1", description="______"),
* @OA\Property(property="max_seats_limit", type="integer", example="100", description="______"),
* @OA\Property(property="trial_enabled", type="boolean", example="true", description="______"),
* @OA\Property(property="trial_duration", type="integer", example="2", description="______"),
* @OA\Property(property="allow_query_overrides", type="boolean", example="true", description="______"),
* @OA\Property(property="allow_plan_changes", type="boolean", example="true", description="______"),
* @OA\Property(property="plan_map", type="string", example="1", description="map describing the available upgrade/downgrade plans for this subscription"),
* @OA\Property(property="refund_period", type="integer", example="2", description="______"),
* @OA\Property(property="webhook_configuration", type="string", example="2", description="______"),
* @OA\Property(property="is_deleted", type="boolean", example="true", description="______"),

View File

@ -51,7 +51,6 @@ class StoreSubscriptionRequest extends Request
'trial_duration' => ['sometimes'],
'allow_query_overrides' => ['sometimes'],
'allow_plan_changes' => ['sometimes'],
'plan_map' => ['sometimes'],
'refund_period' => ['sometimes'],
'webhook_configuration' => ['array'],
'name' => ['required', Rule::unique('subscriptions')->where('company_id', auth()->user()->company()->id)]

View File

@ -31,24 +31,22 @@ class Subscription extends BaseModel
'is_amount_discount',
'allow_cancellation',
'per_seat_enabled',
'min_seats_limit',
'max_seats_limit',
'trial_enabled',
'trial_duration',
'allow_query_overrides',
'allow_plan_changes',
'plan_map',
'refund_period',
'webhook_configuration',
'currency_id',
'group_id',
'price',
'name',
'currency_id',
];
protected $casts = [
'is_deleted' => 'boolean',
'plan_map' => 'object',
'webhook_configuration' => 'array',
'updated_at' => 'timestamp',
'created_at' => 'timestamp',

View File

@ -52,16 +52,15 @@ class SubscriptionTransformer extends EntityTransformer
'is_amount_discount' => (bool)$subscription->is_amount_discount,
'allow_cancellation' => (bool)$subscription->allow_cancellation,
'per_seat_enabled' => (bool)$subscription->per_seat_enabled,
'min_seats_limit' => (int)$subscription->min_seats_limit,
'max_seats_limit' => (int)$subscription->max_seats_limit,
'trial_enabled' => (bool)$subscription->trial_enabled,
'trial_duration' => (int)$subscription->trial_duration,
'allow_query_overrides' => (bool)$subscription->allow_query_overrides,
'allow_plan_changes' => (bool)$subscription->allow_plan_changes,
'plan_map' => (string)$subscription->plan_map,
'refund_period' => (int)$subscription->refund_period,
'webhook_configuration' => $subscription->webhook_configuration ?: [],
'purchase_page' => (string)route('client.subscription.purchase', $subscription->hashed_id),
'currency_id' => (string) $subscription->currency_id,
'is_deleted' => (bool)$subscription->is_deleted,
'created_at' => (int)$subscription->created_at,
'updated_at' => (int)$subscription->updated_at,