Changeset View
Changeset View
Standalone View
Standalone View
src/app/Http/Controllers/API/SignupController.php
Show First 20 Lines • Show All 425 Lines • ▼ Show 20 Lines | class SignupController extends Controller | ||||
* Collects some content to display to the user before redirect to a checkout page. | * Collects some content to display to the user before redirect to a checkout page. | ||||
* Optionally creates a recurrent payment mandate for specified user/plan. | * Optionally creates a recurrent payment mandate for specified user/plan. | ||||
*/ | */ | ||||
protected function mandateForPlan(Plan $plan, Discount $discount = null, User $user = null): array | protected function mandateForPlan(Plan $plan, Discount $discount = null, User $user = null): array | ||||
{ | { | ||||
$result = []; | $result = []; | ||||
$min = \App\Payment::MIN_AMOUNT; | $min = \App\Payment::MIN_AMOUNT; | ||||
$planCost = $cost = $plan->cost() * $plan->months; | $planCost = $cost = $plan->cost(); | ||||
$disc = 0; | $disc = 0; | ||||
if ($discount) { | if ($discount) { | ||||
$planCost = (int) ($planCost * (100 - $discount->discount) / 100); | $planCost = (int) ($planCost * (100 - $discount->discount) / 100); | ||||
$disc = $cost - $planCost; | $disc = $cost - $planCost; | ||||
} | } | ||||
if ($planCost > $min) { | if ($planCost > $min) { | ||||
▲ Show 20 Lines • Show All 157 Lines • Show Last 20 Lines |