Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
20 / 20 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| UpsertPlanHubspotConfigRequest | |
100.00% |
20 / 20 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| rules | |
100.00% |
16 / 16 |
|
100.00% |
1 / 1 |
1 | |||
| messages | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Http\Requests\v2\PlanHubspotConfig; |
| 4 | |
| 5 | use App\Http\Requests\v2\Parameter\Concerns\AuthorizesVengresoAdmin; |
| 6 | use Illuminate\Foundation\Http\FormRequest; |
| 7 | |
| 8 | /** |
| 9 | * Request for creating or updating a plan's HubSpot config (admin). |
| 10 | * |
| 11 | * Creates a new config if one doesn't exist, or updates the existing one. |
| 12 | * |
| 13 | * @property string|null $name Display name in HubSpot (e.g., "Freemium", "Sales Pro") |
| 14 | * @property string|null $last_product Last product name in HubSpot |
| 15 | * @property string|null $cancel_subscription_date HubSpot property name for cancel date |
| 16 | * @property string|null $payment_status HubSpot property name for payment status |
| 17 | * @property string|null $subscription_annual_recurring_revenue HubSpot property name for ARR |
| 18 | * @property string|null $subscription_churn_date HubSpot property name for churn date |
| 19 | * @property string|null $subscription_expiration_date HubSpot property name for expiration date |
| 20 | * @property string|null $subscription_frequency HubSpot property name for billing frequency |
| 21 | * @property string|null $subscription_monthly_recurring_revenue HubSpot property name for MRR |
| 22 | * @property string|null $subscription_plan_type HubSpot property name for plan type |
| 23 | * @property string|null $subscription_start_date HubSpot property name for start date |
| 24 | * @property string|null $subscription_status HubSpot property name for subscription status |
| 25 | * @property string|null $subscription_status_updated_on HubSpot property name for status update timestamp |
| 26 | * @property string|null $user_type HubSpot property name for user type |
| 27 | */ |
| 28 | class UpsertPlanHubspotConfigRequest extends FormRequest |
| 29 | { |
| 30 | use AuthorizesVengresoAdmin; |
| 31 | |
| 32 | /** |
| 33 | * Get the validation rules that apply to the request. |
| 34 | * |
| 35 | * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string> |
| 36 | */ |
| 37 | public function rules(): array |
| 38 | { |
| 39 | return [ |
| 40 | 'name' => 'nullable|string|max:255', |
| 41 | 'last_product' => 'nullable|string|max:255', |
| 42 | 'cancel_subscription_date' => 'nullable|string|max:255', |
| 43 | 'payment_status' => 'nullable|string|max:255', |
| 44 | 'subscription_annual_recurring_revenue' => 'nullable|string|max:255', |
| 45 | 'subscription_churn_date' => 'nullable|string|max:255', |
| 46 | 'subscription_expiration_date' => 'nullable|string|max:255', |
| 47 | 'subscription_frequency' => 'nullable|string|max:255', |
| 48 | 'subscription_monthly_recurring_revenue' => 'nullable|string|max:255', |
| 49 | 'subscription_plan_type' => 'nullable|string|max:255', |
| 50 | 'subscription_start_date' => 'nullable|string|max:255', |
| 51 | 'subscription_status' => 'nullable|string|max:255', |
| 52 | 'subscription_status_updated_on' => 'nullable|string|max:255', |
| 53 | 'user_type' => 'nullable|string|max:255', |
| 54 | ]; |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Get custom messages for validator errors. |
| 59 | * |
| 60 | * @return array<string, string> |
| 61 | */ |
| 62 | public function messages(): array |
| 63 | { |
| 64 | return [ |
| 65 | 'name.max' => 'The HubSpot name must not exceed 255 characters.', |
| 66 | 'last_product.max' => 'The HubSpot last product must not exceed 255 characters.', |
| 67 | ]; |
| 68 | } |
| 69 | } |