Minor fixes

This commit is contained in:
David Bomba 2021-10-24 15:14:36 +11:00
parent 699d5d39f0
commit ebc58a18bb
2 changed files with 17 additions and 1 deletions

View File

@ -26,7 +26,10 @@ class ValidAmount implements Rule
*/
public function passes($attribute, $value)
{
return trim($value, '-1234567890.,') === '';
return is_numeric((string)$value);
//return filter_var((string)$value, FILTER_VALIDATE_FLOAT);
// return preg_match('^(?=.)([+-]?([0-9]*)(\.([0-9]+))?)$^', (string)$value);
// return trim($value, '-1234567890.,') === '';
}

View File

@ -221,6 +221,19 @@ class BaseDriver extends AbstractPaymentDriver
{
$this->confirmGatewayFee();
/*Never create a payment with a duplicate transaction reference*/
if(array_key_exists('transaction_reference', $data)){
$_payment = Payment::where('transaction_reference', $data['transaction_reference'])
->where('client_id', $this->client->id)
->first();
if($_payment)
return $_payment;
}
$payment = PaymentFactory::create($this->client->company->id, $this->client->user->id);
$payment->client_id = $this->client->id;
$payment->company_gateway_id = $this->company_gateway->id;