From f0eb912e0703ac783386077cd406dd0720f63b9b Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 9 Sep 2021 15:14:05 +1000 Subject: [PATCH] fixes --- app/Console/Commands/S3Cleanup.php | 2 ++ app/Models/ClientGatewayToken.php | 2 ++ app/PaymentDrivers/WePay/CreditCard.php | 31 +++++++++++++++++-------- 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/app/Console/Commands/S3Cleanup.php b/app/Console/Commands/S3Cleanup.php index 6aa4d2d3b1d4..d20362c8f303 100644 --- a/app/Console/Commands/S3Cleanup.php +++ b/app/Console/Commands/S3Cleanup.php @@ -15,6 +15,8 @@ class S3Cleanup extends Command */ protected $signature = 'ninja:s3-cleanup'; + protected $log = ''; + /** * The console command description. * diff --git a/app/Models/ClientGatewayToken.php b/app/Models/ClientGatewayToken.php index a3928ce4bf79..2aed46bf9edc 100644 --- a/app/Models/ClientGatewayToken.php +++ b/app/Models/ClientGatewayToken.php @@ -13,10 +13,12 @@ namespace App\Models; use App\Utils\Traits\MakesDates; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\SoftDeletes; class ClientGatewayToken extends BaseModel { use MakesDates; + use SoftDeletes; protected $casts = [ 'meta' => 'object', diff --git a/app/PaymentDrivers/WePay/CreditCard.php b/app/PaymentDrivers/WePay/CreditCard.php index 5cb3567976b0..8209c71c3546 100644 --- a/app/PaymentDrivers/WePay/CreditCard.php +++ b/app/PaymentDrivers/WePay/CreditCard.php @@ -60,12 +60,18 @@ use WePayCommon; 'method' => '1', */ - $response = $this->wepay_payment_driver->wepay->request('credit_card/authorize', array( - 'client_id' => config('ninja.wepay.client_id'), - 'client_secret' => config('ninja.wepay.client_secret'), - 'credit_card_id' => (int)$data['credit_card_id'], - )); + try { + + $response = $this->wepay_payment_driver->wepay->request('credit_card/authorize', array( + 'client_id' => config('ninja.wepay.client_id'), + 'client_secret' => config('ninja.wepay.client_secret'), + 'credit_card_id' => (int)$data['credit_card_id'], + )); + } + catch(\Exception $e){ + return $this->wepay_payment_driver->processInternallyFailedPayment($this->wepay_payment_driver, $e); + } // display the response // nlog($response); @@ -116,11 +122,16 @@ use WePayCommon; { nlog("authorize the card first!"); - $response = $this->wepay_payment_driver->wepay->request('credit_card/authorize', array( - 'client_id' => config('ninja.wepay.client_id'), - 'client_secret' => config('ninja.wepay.client_secret'), - 'credit_card_id' => (int)$request->input('credit_card_id'), - )); + try { + $response = $this->wepay_payment_driver->wepay->request('credit_card/authorize', array( + 'client_id' => config('ninja.wepay.client_id'), + 'client_secret' => config('ninja.wepay.client_secret'), + 'credit_card_id' => (int)$request->input('credit_card_id'), + )); + } + catch(\Exception $e){ + return $this->wepay_payment_driver->processInternallyFailedPayment($this->wepay_payment_driver, $e); + } $credit_card_id = (int)$response->credit_card_id;