From 1ca4eaba7b07538a5437ff7ec1a5922b9c1605ce Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 5 Jul 2021 13:51:03 +1000 Subject: [PATCH] Fixes for base driver --- app/PaymentDrivers/PayFast/CreditCard.php | 3 ++- app/PaymentDrivers/PayFastPaymentDriver.php | 16 ++++------------ 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/app/PaymentDrivers/PayFast/CreditCard.php b/app/PaymentDrivers/PayFast/CreditCard.php index f704ee04bf..b7da94eab1 100644 --- a/app/PaymentDrivers/PayFast/CreditCard.php +++ b/app/PaymentDrivers/PayFast/CreditCard.php @@ -82,7 +82,7 @@ class CreditCard public function authorizeView($data) { - $hash = Cache::put(Str::random(32), 'cc_auth', 300); + // $hash = Cache::put(Str::random(32), 'cc_auth', 300); $data = [ 'merchant_id' => $this->payfast->company_gateway->getConfigField('merchantId'), @@ -92,6 +92,7 @@ class CreditCard 'notify_url' => $this->payfast->genericWebhookUrl(), 'amount' => 5, 'item_name' => 'pre-auth', + 'item_description' => 'Pre authorization', 'subscription_type' => 2, 'passphrase' => $this->payfast->company_gateway->getConfigField('passphrase'), ]; diff --git a/app/PaymentDrivers/PayFastPaymentDriver.php b/app/PaymentDrivers/PayFastPaymentDriver.php index 9c17acb43b..6ec63540ea 100644 --- a/app/PaymentDrivers/PayFastPaymentDriver.php +++ b/app/PaymentDrivers/PayFastPaymentDriver.php @@ -20,7 +20,6 @@ use App\PaymentDrivers\PayFast\CreditCard; use App\Utils\Traits\MakesHash; use \PayFastPayment; use Illuminate\Http\Request; -use Illuminate\Support\Facades\Cache; class PayFastPaymentDriver extends BaseDriver { @@ -146,18 +145,11 @@ class PayFastPaymentDriver extends BaseDriver nlog($request->all()); $data = $request->all(); - - if(array_key_exists('m_payment_id', $data)) + + if(array_key_exists('m_payment_id', $data) && $data['m_payment_id'] == 'pre-auth') { - - $hash = Cache::get($data['m_payment_id']); - - if($hash == 'cc_auth') - { - return $this->setPaymentMethod(GatewayType::CREDIT_CARD) - ->authorizeResponse($request); - } - + return $this->setPaymentMethod(GatewayType::CREDIT_CARD) + ->authorizeResponse($request); } return response()->json([], 200);