diff --git a/app/PaymentDrivers/PayFast/CreditCard.php b/app/PaymentDrivers/PayFast/CreditCard.php index e9214168cc24..5ba86898f59d 100644 --- a/app/PaymentDrivers/PayFast/CreditCard.php +++ b/app/PaymentDrivers/PayFast/CreditCard.php @@ -89,6 +89,8 @@ class CreditCard 'notify_url' => $this->payfast->genericWebhookUrl(), 'amount' => 5, 'item_name' => 'pre-auth', + 'item_description' => 'cc_auth', + 'custom_str1' => 'cc_auth', 'subscription_type' => 2, 'passphrase' => $this->payfast->company_gateway->getConfigField('passphrase'), ]; @@ -100,36 +102,34 @@ class CreditCard return render('gateways.payfast.authorize', $data); } - -/* - 'm_payment_id' => NULL, - 'pf_payment_id' => '1409993', - 'payment_status' => 'COMPLETE', - 'item_name' => 'pre-auth', - 'item_description' => NULL, - 'amount_gross' => '5.00', - 'amount_fee' => '-2.53', - 'amount_net' => '2.47', - 'custom_str1' => NULL, - 'custom_str2' => NULL, - 'custom_str3' => NULL, - 'custom_str4' => NULL, - 'custom_str5' => NULL, - 'custom_int1' => NULL, - 'custom_int2' => NULL, - 'custom_int3' => NULL, - 'custom_int4' => NULL, - 'custom_int5' => NULL, - 'name_first' => NULL, - 'name_last' => NULL, - 'email_address' => NULL, - 'merchant_id' => '10023100', - 'token' => '34b66bc2-3c54-9590-03ea-42ee8b89922a', - 'billing_date' => '2021-07-05', - 'signature' => 'ebdb4ca937d0e3f43462841c0afc6ad9', - 'q' => '/payment_notification_webhook/EhbnVYyzJZyccY85hcHIkIzNPI2rtHzznAyyyG73oSxZidAdN9gf8BvAKDomqeHp/4openRe7Az/WPe99p3eLy', -) - */ + /* + 'm_payment_id' => NULL, + 'pf_payment_id' => '1409993', + 'payment_status' => 'COMPLETE', + 'item_name' => 'pre-auth', + 'item_description' => NULL, + 'amount_gross' => '5.00', + 'amount_fee' => '-2.53', + 'amount_net' => '2.47', + 'custom_str1' => NULL, + 'custom_str2' => NULL, + 'custom_str3' => NULL, + 'custom_str4' => NULL, + 'custom_str5' => NULL, + 'custom_int1' => NULL, + 'custom_int2' => NULL, + 'custom_int3' => NULL, + 'custom_int4' => NULL, + 'custom_int5' => NULL, + 'name_first' => NULL, + 'name_last' => NULL, + 'email_address' => NULL, + 'merchant_id' => '10023100', + 'token' => '34b66bc2-3c54-9590-03ea-42ee8b89922a', + 'billing_date' => '2021-07-05', + 'signature' => 'ebdb4ca937d0e3f43462841c0afc6ad9', + 'q' => '/payment_notification_webhook/EhbnVYyzJZyccY85hcHIkIzNPI2rtHzznAyyyG73oSxZidAdN9gf8BvAKDomqeHp/4openRe7Az/WPe99p3eLy', + */ public function authorizeResponse($request) { $data = $request->all(); @@ -147,7 +147,11 @@ class CreditCard $cgt['payment_meta'] = $payment_meta; - $this->payfast->storeGatewayToken($cgt, []); + $token = $this->payfast->storeGatewayToken($cgt, []); + + nlog($token); + + return response()->json([], 200); } diff --git a/app/PaymentDrivers/PayFastPaymentDriver.php b/app/PaymentDrivers/PayFastPaymentDriver.php index 7e449bbee6d9..d1e131e841ef 100644 --- a/app/PaymentDrivers/PayFastPaymentDriver.php +++ b/app/PaymentDrivers/PayFastPaymentDriver.php @@ -141,8 +141,17 @@ class PayFastPaymentDriver extends BaseDriver public function processWebhookRequest(Request $request, Payment $payment = null) { + $this->init(); nlog($request->all()); + $data = $request->all(); + + if(array_key_exists('custom_str1', $data) && $data['custom_str1'] == 'cc_auth') + { + return $this->setPaymentMethod(GatewayType::CREDIT_CARD) + ->authorizeResponse($request); + } + return response()->json([], 200); } diff --git a/config/logging.php b/config/logging.php index cfa68f0e57a7..b45e098a40fd 100644 --- a/config/logging.php +++ b/config/logging.php @@ -108,7 +108,6 @@ return [ 'gelf' => [ 'driver' => 'custom', - 'via' => \Hedii\LaravelGelfLogger\GelfLoggerFactory::class, // This optional option determines the processors that should be