Match Care/Frontdesk: branches stepper next to billing period, live totals, and checkout charges for the selected seat count.
This commit is contained in:
@@ -84,9 +84,7 @@ class PlanService
|
||||
|
||||
public function proPriceMinor(Organization $organization): int
|
||||
{
|
||||
$branches = max(1, $this->activeBranchCount($organization));
|
||||
|
||||
return $branches * $this->proPricePerBranchMinor();
|
||||
return $this->priceForBranches('pro', $this->activeBranchCount($organization));
|
||||
}
|
||||
|
||||
public function enterprisePricePerBranchMinor(): int
|
||||
@@ -96,9 +94,26 @@ class PlanService
|
||||
|
||||
public function enterprisePriceMinor(Organization $organization): int
|
||||
{
|
||||
$branches = max(1, $this->activeBranchCount($organization));
|
||||
return $this->priceForBranches('enterprise', $this->activeBranchCount($organization));
|
||||
}
|
||||
|
||||
return $branches * $this->enterprisePricePerBranchMinor();
|
||||
/** Fixed branch count × per-branch rate (checkout when the user picks seats). */
|
||||
public function priceForBranches(string $plan, int $branches): int
|
||||
{
|
||||
$branches = max(1, $branches);
|
||||
$rate = $plan === 'enterprise'
|
||||
? $this->enterprisePricePerBranchMinor()
|
||||
: $this->proPricePerBranchMinor();
|
||||
|
||||
return $branches * $rate;
|
||||
}
|
||||
|
||||
public function resolveCheckoutBranches(Organization $organization, int $requested): int
|
||||
{
|
||||
$branches = max(1, min(999, $requested));
|
||||
$active = max(1, $this->activeBranchCount($organization));
|
||||
|
||||
return max($branches, $active);
|
||||
}
|
||||
|
||||
public function canSubscribeEnterprise(Organization $organization): bool
|
||||
|
||||
Reference in New Issue
Block a user