Fixes for base driver

This commit is contained in:
David Bomba 2021-07-05 13:51:03 +10:00
parent bc46ab86a2
commit 1ca4eaba7b
2 changed files with 6 additions and 13 deletions

View File

@ -82,7 +82,7 @@ class CreditCard
public function authorizeView($data) public function authorizeView($data)
{ {
$hash = Cache::put(Str::random(32), 'cc_auth', 300); // $hash = Cache::put(Str::random(32), 'cc_auth', 300);
$data = [ $data = [
'merchant_id' => $this->payfast->company_gateway->getConfigField('merchantId'), 'merchant_id' => $this->payfast->company_gateway->getConfigField('merchantId'),
@ -92,6 +92,7 @@ class CreditCard
'notify_url' => $this->payfast->genericWebhookUrl(), 'notify_url' => $this->payfast->genericWebhookUrl(),
'amount' => 5, 'amount' => 5,
'item_name' => 'pre-auth', 'item_name' => 'pre-auth',
'item_description' => 'Pre authorization',
'subscription_type' => 2, 'subscription_type' => 2,
'passphrase' => $this->payfast->company_gateway->getConfigField('passphrase'), 'passphrase' => $this->payfast->company_gateway->getConfigField('passphrase'),
]; ];

View File

@ -20,7 +20,6 @@ use App\PaymentDrivers\PayFast\CreditCard;
use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesHash;
use \PayFastPayment; use \PayFastPayment;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
class PayFastPaymentDriver extends BaseDriver class PayFastPaymentDriver extends BaseDriver
{ {
@ -147,19 +146,12 @@ class PayFastPaymentDriver extends BaseDriver
nlog($request->all()); nlog($request->all());
$data = $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) return $this->setPaymentMethod(GatewayType::CREDIT_CARD)
->authorizeResponse($request); ->authorizeResponse($request);
} }
}
return response()->json([], 200); return response()->json([], 200);
} }