From 46852794aa6622e10bdbf088f68df1731b22180a Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 20 Jul 2021 07:58:40 +1000 Subject: [PATCH] return 200 HTTP code on webhook response from payfast. --- app/PaymentDrivers/PayFast/CreditCard.php | 2 +- app/PaymentDrivers/PayFastPaymentDriver.php | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/app/PaymentDrivers/PayFast/CreditCard.php b/app/PaymentDrivers/PayFast/CreditCard.php index ea5caebb56..796c59ce4d 100644 --- a/app/PaymentDrivers/PayFast/CreditCard.php +++ b/app/PaymentDrivers/PayFast/CreditCard.php @@ -248,7 +248,7 @@ class CreditCard $payment = $this->payfast->createPayment($payment_record, Payment::STATUS_COMPLETED); - return redirect()->route('client.payments.show', ['payment' => $this->payfast->encodePrimaryKey($payment->id)]); + //return redirect()->route('client.payments.show', ['payment' => $this->payfast->encodePrimaryKey($payment->id)]); } private function processUnsuccessfulPayment($server_response) diff --git a/app/PaymentDrivers/PayFastPaymentDriver.php b/app/PaymentDrivers/PayFastPaymentDriver.php index 8e274eb8cf..4a56edb8ad 100644 --- a/app/PaymentDrivers/PayFastPaymentDriver.php +++ b/app/PaymentDrivers/PayFastPaymentDriver.php @@ -169,6 +169,7 @@ class PayFastPaymentDriver extends BaseDriver { $data = $request->all(); + nlog("payfast"); nlog($data); if(array_key_exists('m_payment_id', $data)) @@ -179,17 +180,23 @@ class PayFastPaymentDriver extends BaseDriver switch ($hash) { case 'cc_auth': - return $this->setPaymentMethod(GatewayType::CREDIT_CARD) - ->authorizeResponse($request); + $this->setPaymentMethod(GatewayType::CREDIT_CARD) + ->authorizeResponse($request); + + return response()->json([], 200); + break; default: $payment_hash = PaymentHash::whereRaw('BINARY `hash`= ?', [$data['m_payment_id']])->first(); - return $this->setPaymentMethod(GatewayType::CREDIT_CARD) - ->setPaymentHash($payment_hash) - ->processPaymentResponse($request); + $this->setPaymentMethod(GatewayType::CREDIT_CARD) + ->setPaymentHash($payment_hash) + ->processPaymentResponse($request); + + return response()->json([], 200); + break; }