Match Care/Frontdesk: branches stepper next to billing period, live totals, and checkout charges for the selected seat count.
This commit is contained in:
@@ -67,16 +67,23 @@ class ProController extends Controller
|
||||
->with('success', 'Your organization already has an active paid plan.');
|
||||
}
|
||||
|
||||
$validated = $request->validate([
|
||||
'branches' => ['required', 'integer', 'min:1', 'max:999'],
|
||||
]);
|
||||
|
||||
$branches = $plans->resolveCheckoutBranches($organization, (int) $validated['branches']);
|
||||
$amountMinor = $plans->priceForBranches('pro', $branches);
|
||||
|
||||
return $this->chargeMonthlyWallet(
|
||||
$organization,
|
||||
$billing,
|
||||
$plans->proPriceMinor($organization),
|
||||
$amountMinor,
|
||||
'pro',
|
||||
'queue_pro',
|
||||
'queue-pro-'.$organization->id.'-'.now()->format('Y-m-d-His'),
|
||||
'Ladill Queue Pro — monthly subscription',
|
||||
'Ladill Queue Pro — '.$branches.' branch(es) monthly',
|
||||
'Welcome to Queue Pro — active for one month.',
|
||||
$plans->activeBranchCount($organization),
|
||||
$branches,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -97,16 +104,23 @@ class ProController extends Controller
|
||||
->with('error', "Enterprise billing requires at least {$min} active branches. Add another branch or choose Pro for a single site.");
|
||||
}
|
||||
|
||||
$validated = $request->validate([
|
||||
'branches' => ['required', 'integer', 'min:1', 'max:999'],
|
||||
]);
|
||||
|
||||
$branches = $plans->resolveCheckoutBranches($organization, (int) $validated['branches']);
|
||||
$amountMinor = $plans->priceForBranches('enterprise', $branches);
|
||||
|
||||
return $this->chargeMonthlyWallet(
|
||||
$organization,
|
||||
$billing,
|
||||
$plans->enterprisePriceMinor($organization),
|
||||
$amountMinor,
|
||||
'enterprise',
|
||||
'queue_enterprise',
|
||||
'queue-enterprise-'.$organization->id.'-'.now()->format('Y-m-d-His'),
|
||||
'Ladill Queue Enterprise — monthly subscription',
|
||||
'Ladill Queue Enterprise — '.$branches.' branch(es) monthly',
|
||||
'Welcome to Queue Enterprise — active for one month.',
|
||||
$plans->activeBranchCount($organization),
|
||||
$branches,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -116,6 +130,7 @@ class ProController extends Controller
|
||||
$validated = $request->validate([
|
||||
'plan' => ['required', 'in:pro,enterprise'],
|
||||
'months' => ['required', 'integer', 'in:6,12,24'],
|
||||
'branches' => ['required', 'integer', 'min:1', 'max:999'],
|
||||
]);
|
||||
|
||||
$organization = $this->organization($request);
|
||||
@@ -134,11 +149,8 @@ class ProController extends Controller
|
||||
->with('error', "Enterprise billing requires at least {$min} active branches.");
|
||||
}
|
||||
|
||||
$monthlyMinor = $plan === 'enterprise'
|
||||
? $plans->enterprisePriceMinor($organization)
|
||||
: $plans->proPriceMinor($organization);
|
||||
$amountMinor = $monthlyMinor * $months;
|
||||
$branches = $plans->activeBranchCount($organization);
|
||||
$branches = $plans->resolveCheckoutBranches($organization, (int) $validated['branches']);
|
||||
$amountMinor = $plans->priceForBranches($plan, $branches) * $months;
|
||||
|
||||
$metadata = [
|
||||
'organization_id' => $organization->id,
|
||||
|
||||
Reference in New Issue
Block a user