feat: Added Quartely billing period

This commit is contained in:
IceToast 2022-07-22 05:31:05 +02:00 committed by IceToast
parent 8565faa40b
commit e254b2acfe
No known key found for this signature in database
GPG key ID: 1464353E063A5B97
8 changed files with 21 additions and 2 deletions

View file

@ -67,6 +67,9 @@ class ChargeServers extends Command
case 'half-annually': case 'half-annually':
$newBillingDate = Carbon::parse($server->last_billed)->addMonths(6); $newBillingDate = Carbon::parse($server->last_billed)->addMonths(6);
break; break;
case 'quarterly':
$newBillingDate = Carbon::parse($server->last_billed)->addMonths(3);
break;
case 'monthly': case 'monthly':
$newBillingDate = Carbon::parse($server->last_billed)->addMonth(); $newBillingDate = Carbon::parse($server->last_billed)->addMonth();
break; break;

View file

@ -72,7 +72,7 @@ class ProductController extends Controller
"nodes.*" => "required|exists:nodes,id", "nodes.*" => "required|exists:nodes,id",
"eggs.*" => "required|exists:eggs,id", "eggs.*" => "required|exists:eggs,id",
"disabled" => "nullable", "disabled" => "nullable",
"billing_period" => "required|in:hourly,daily,weekly,monthly,half-annually,annually", "billing_period" => "required|in:hourly,daily,weekly,monthly,quarterly,half-annually,annually",
]); ]);
$disabled = ! is_null($request->input('disabled')); $disabled = ! is_null($request->input('disabled'));
@ -139,7 +139,7 @@ class ProductController extends Controller
"nodes.*" => "required|exists:nodes,id", "nodes.*" => "required|exists:nodes,id",
"eggs.*" => "required|exists:eggs,id", "eggs.*" => "required|exists:eggs,id",
"disabled" => "nullable", "disabled" => "nullable",
"billing_period" => "required|in:hourly,daily,weekly,monthly,half-annually,annually", "billing_period" => "required|in:hourly,daily,weekly,monthly,quarterly,half-annually,annually",
]); ]);
$disabled = ! is_null($request->input('disabled')); $disabled = ! is_null($request->input('disabled'));

View file

@ -51,6 +51,8 @@ class Product extends Model
return $this->price / 24 / 7; return $this->price / 24 / 7;
case 'monthly': case 'monthly':
return $this->price / 24 / 30; return $this->price / 24 / 30;
case 'quarterly':
return $this->price / 24 / 30 / 3;
case 'half-annually': case 'half-annually':
return $this->price / 24 / 30 / 6; return $this->price / 24 / 30 / 6;
case 'annually': case 'annually':

View file

@ -464,6 +464,7 @@
"yearly": "Jährlich", "yearly": "Jährlich",
"daily": "Täglich", "daily": "Täglich",
"weekly": "Wöchentlich", "weekly": "Wöchentlich",
"quarterly": "Vierteljährlich",
"half-annually": "Halbjährlich", "half-annually": "Halbjährlich",
"annually": "Jährlich", "annually": "Jährlich",
"Suspended": "Gesperrt", "Suspended": "Gesperrt",

View file

@ -447,6 +447,7 @@
"yearly": "Yearly", "yearly": "Yearly",
"daily": "Daily", "daily": "Daily",
"weekly": "Weekly", "weekly": "Weekly",
"quarterly": "Quarterly",
"half-annually": "Half-annually", "half-annually": "Half-annually",
"annually": "Annually", "annually": "Annually",
"Suspended": "Suspended", "Suspended": "Suspended",

View file

@ -145,6 +145,9 @@
@case('hourly') @case('hourly')
{{ \Carbon\Carbon::parse($server->last_billed)->addHour()->toDayDateTimeString(); }} {{ \Carbon\Carbon::parse($server->last_billed)->addHour()->toDayDateTimeString(); }}
@break @break
@case('quarterly')
{{ \Carbon\Carbon::parse($server->last_billed)->addMonths(3)->toDayDateTimeString(); }}
@break
@case('half-annually') @case('half-annually')
{{ \Carbon\Carbon::parse($server->last_billed)->addMonths(6)->toDayDateTimeString(); }} {{ \Carbon\Carbon::parse($server->last_billed)->addMonths(6)->toDayDateTimeString(); }}
@break @break
@ -172,6 +175,8 @@
{{ __('per Month') }} {{ __('per Month') }}
@elseif($server->product->billing_period == 'half-annually') @elseif($server->product->billing_period == 'half-annually')
{{ __('per 6 Months') }} {{ __('per 6 Months') }}
@elseif($server->product->billing_period == 'quarterly')
{{ __('per 3 Months') }}
@elseif($server->product->billing_period == 'annually') @elseif($server->product->billing_period == 'annually')
{{ __('per Year') }} {{ __('per Year') }}
@elseif($server->product->billing_period == 'weekly') @elseif($server->product->billing_period == 'weekly')

View file

@ -183,6 +183,9 @@
<option value="monthly"> <option value="monthly">
{{__('Monthly')}} {{__('Monthly')}}
</option> </option>
<option value="quarterly">
{{__('Quarterly')}}
</option>
<option value="half-annually"> <option value="half-annually">
{{__('Half Annually')}} {{__('Half Annually')}}
</option> </option>

View file

@ -190,6 +190,10 @@
@endif> @endif>
{{__('Monthly')}} {{__('Monthly')}}
</option> </option>
<option value="quarterly" @if ($product->billing_period == 'quarterly') selected
@endif>
{{__('Quarterly')}}
</option>
<option value="half-annually" @if ($product->billing_period == 'half-annually') selected <option value="half-annually" @if ($product->billing_period == 'half-annually') selected
@endif> @endif>
{{__('Half Annually')}} {{__('Half Annually')}}