Changeset View
Changeset View
Standalone View
Standalone View
src/app/Http/Controllers/API/V4/PaymentsController.php
Show First 20 Lines • Show All 161 Lines • ▼ Show 20 Lines | protected static function mandateValidate(Request $request, Wallet $wallet) | ||||
} | } | ||||
$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 | ||||
&& $wallet->balance * -1 > PaymentProvider::MIN_AMOUNT | && $wallet->balance <= PaymentProvider::MIN_AMOUNT * -1 | ||||
mollekopf: This doesn't belong in this patch I think. | |||||
&& $wallet->balance + $amount < 0 | && $wallet->balance + $amount < 0 | ||||
) { | ) { | ||||
return ['amount' => \trans('validation.minamountdebt')]; | return ['amount' => \trans('validation.minamountdebt')]; | ||||
} | } | ||||
if ($amount < PaymentProvider::MIN_AMOUNT) { | if ($amount < PaymentProvider::MIN_AMOUNT) { | ||||
$min = $wallet->money(PaymentProvider::MIN_AMOUNT); | $min = $wallet->money(PaymentProvider::MIN_AMOUNT); | ||||
return ['amount' => \trans('validation.minamount', ['amount' => $min])]; | return ['amount' => \trans('validation.minamount', ['amount' => $min])]; | ||||
▲ Show 20 Lines • Show All 304 Lines • Show Last 20 Lines |
This doesn't belong in this patch I think.