1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-21 00:41:34 +02:00

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)
{
$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'),
];

View File

@ -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);