mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
Fixes for base driver
This commit is contained in:
parent
b53fe63858
commit
659d742477
@ -21,6 +21,7 @@ use App\Models\PaymentType;
|
||||
use App\Models\SystemLog;
|
||||
use App\PaymentDrivers\PayFastPaymentDriver;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
class CreditCard
|
||||
{
|
||||
@ -81,6 +82,8 @@ class CreditCard
|
||||
|
||||
public function authorizeView($data)
|
||||
{
|
||||
$hash = Cache::put(Str::random(32), 'cc_auth', 300);
|
||||
|
||||
$data = [
|
||||
'merchant_id' => $this->payfast->company_gateway->getConfigField('merchantId'),
|
||||
'merchant_key' => $this->payfast->company_gateway->getConfigField('merchantKey'),
|
||||
@ -88,9 +91,8 @@ class CreditCard
|
||||
'cancel_url' => route('client.payment_methods.index'),
|
||||
'notify_url' => $this->payfast->genericWebhookUrl(),
|
||||
'amount' => 5,
|
||||
'm_payment_id' => $hash,
|
||||
'item_name' => 'pre-auth',
|
||||
// 'item_description' => 'cc_auth',
|
||||
'custom_str1' => 'cc_auth',
|
||||
'subscription_type' => 2,
|
||||
'passphrase' => $this->payfast->company_gateway->getConfigField('passphrase'),
|
||||
];
|
||||
|
@ -20,6 +20,7 @@ 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,10 +147,17 @@ class PayFastPaymentDriver extends BaseDriver
|
||||
nlog($request->all());
|
||||
$data = $request->all();
|
||||
|
||||
if(array_key_exists('custom_str1', $data) && $data['custom_str1'] == 'cc_auth')
|
||||
if(array_key_exists('m_payment_id', $data))
|
||||
{
|
||||
return $this->setPaymentMethod(GatewayType::CREDIT_CARD)
|
||||
->authorizeResponse($request);
|
||||
|
||||
$hash = Cache::get($data['m_payment_id']);
|
||||
|
||||
if($hash == 'cc_auth')
|
||||
{
|
||||
return $this->setPaymentMethod(GatewayType::CREDIT_CARD)
|
||||
->authorizeResponse($request);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return response()->json([], 200);
|
||||
|
@ -26,9 +26,9 @@ use App\Utils\CurlUtils;
|
||||
use App\Utils\HtmlEngine;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class Phantom
|
||||
|
Loading…
Reference in New Issue
Block a user