Throw exception on paytrace failure

This commit is contained in:
David Bomba 2021-10-23 11:45:22 +11:00
parent 7a267b4406
commit f270fbe2d6
2 changed files with 3 additions and 2 deletions

View File

@ -26,7 +26,7 @@ class ValidAmount implements Rule
*/ */
public function passes($attribute, $value) public function passes($attribute, $value)
{ {
return (bool) is_float($value) || is_int($value); return (bool) is_float($value) || preg_match('#[^0-9]#',$value);
} }
/** /**

View File

@ -11,6 +11,7 @@
namespace App\PaymentDrivers; namespace App\PaymentDrivers;
use App\Exceptions\SystemError;
use App\Jobs\Util\SystemLogger; use App\Jobs\Util\SystemLogger;
use App\Models\ClientGatewayToken; use App\Models\ClientGatewayToken;
use App\Models\GatewayType; use App\Models\GatewayType;
@ -192,7 +193,7 @@ class PaytracePaymentDriver extends BaseDriver
$auth_data = json_decode($response); $auth_data = json_decode($response);
if(!property_exists($auth_data, 'access_token')) if(!property_exists($auth_data, 'access_token'))
throw new \Exception('Error authenticating with PayTrace'); throw new SystemError('Error authenticating with PayTrace');
$headers = []; $headers = [];
$headers[] = 'Content-type: application/json'; $headers[] = 'Content-type: application/json';