Changeset View
Changeset View
Standalone View
Standalone View
src/app/Http/Controllers/API/V4/PaymentsController.php
Show First 20 Lines • Show All 150 Lines • ▼ Show 20 Lines | protected static function mandateValidate(Request $request, Wallet $wallet) | ||||
]; | ]; | ||||
// Check required fields | // Check required fields | ||||
$v = Validator::make($request->all(), $rules); | $v = Validator::make($request->all(), $rules); | ||||
// TODO: allow comma as a decimal point? | // TODO: allow comma as a decimal point? | ||||
if ($v->fails()) { | if ($v->fails()) { | ||||
return $v->errors(); | return $v->errors()->toArray(); | ||||
} | } | ||||
$amount = (int) ($request->amount * 100); | $amount = (int) ($request->amount * 100); | ||||
// Validate the minimum value | // Validate the minimum value | ||||
// It has to be at least minimum payment amount and must cover current debt | // It has to be at least minimum payment amount and must cover current debt | ||||
if ( | if ( | ||||
$wallet->balance < 0 | $wallet->balance < 0 | ||||
▲ Show 20 Lines • Show All 161 Lines • Show Last 20 Lines |