Fixes for credit payments

This commit is contained in:
David Bomba 2020-07-21 20:35:43 +10:00
parent 07244bd83b
commit 4bee89263a
2 changed files with 5 additions and 0 deletions

View File

@ -118,6 +118,7 @@ class Handler extends ExceptionHandler
} elseif ($exception instanceof MethodNotAllowedHttpException && $request->expectsJson()) {
return response()->json(['message'=>'Method not support for this route'], 404);
} elseif ($exception instanceof ValidationException && $request->expectsJson()) {
// info(print_r($exception->validator->getMessageBag(),1));
return response()->json(['message' => 'The given data was invalid.', 'errors' => $exception->validator->getMessageBag()], 422);
} elseif ($exception instanceof RelationNotFoundException && $request->expectsJson()) {
return response()->json(['message' => $exception->getMessage()], 400);

View File

@ -78,6 +78,10 @@ class ValidCreditsRules implements Rule
}
if(count($this->input['credits']) >=1 && count($this->input['invoices']) == 0)
$this->error_msg = "You must have an invoice set when using a credit";
return false;
return true;
}