mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-14 15:13:29 +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\Models\SystemLog;
|
||||||
use App\PaymentDrivers\PayFastPaymentDriver;
|
use App\PaymentDrivers\PayFastPaymentDriver;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
use Illuminate\Support\Facades\Cache;
|
||||||
|
|
||||||
class CreditCard
|
class CreditCard
|
||||||
{
|
{
|
||||||
@ -81,6 +82,8 @@ class CreditCard
|
|||||||
|
|
||||||
public function authorizeView($data)
|
public function authorizeView($data)
|
||||||
{
|
{
|
||||||
|
$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'),
|
||||||
'merchant_key' => $this->payfast->company_gateway->getConfigField('merchantKey'),
|
'merchant_key' => $this->payfast->company_gateway->getConfigField('merchantKey'),
|
||||||
@ -88,9 +91,8 @@ class CreditCard
|
|||||||
'cancel_url' => route('client.payment_methods.index'),
|
'cancel_url' => route('client.payment_methods.index'),
|
||||||
'notify_url' => $this->payfast->genericWebhookUrl(),
|
'notify_url' => $this->payfast->genericWebhookUrl(),
|
||||||
'amount' => 5,
|
'amount' => 5,
|
||||||
|
'm_payment_id' => $hash,
|
||||||
'item_name' => 'pre-auth',
|
'item_name' => 'pre-auth',
|
||||||
// 'item_description' => 'cc_auth',
|
|
||||||
'custom_str1' => 'cc_auth',
|
|
||||||
'subscription_type' => 2,
|
'subscription_type' => 2,
|
||||||
'passphrase' => $this->payfast->company_gateway->getConfigField('passphrase'),
|
'passphrase' => $this->payfast->company_gateway->getConfigField('passphrase'),
|
||||||
];
|
];
|
||||||
|
@ -20,6 +20,7 @@ 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
|
||||||
{
|
{
|
||||||
@ -146,10 +147,17 @@ class PayFastPaymentDriver extends BaseDriver
|
|||||||
nlog($request->all());
|
nlog($request->all());
|
||||||
$data = $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);
|
return response()->json([], 200);
|
||||||
|
@ -26,9 +26,9 @@ use App\Utils\CurlUtils;
|
|||||||
use App\Utils\HtmlEngine;
|
use App\Utils\HtmlEngine;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
use Illuminate\Support\Facades\App;
|
use Illuminate\Support\Facades\App;
|
||||||
use Illuminate\Support\Facades\Cache;
|
|
||||||
use Illuminate\Support\Facades\Response;
|
use Illuminate\Support\Facades\Response;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Illuminate\Support\Facades\Cache;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class Phantom
|
class Phantom
|
||||||
|
Loading…
Reference in New Issue
Block a user