diff --git a/app/PaymentDrivers/DriverTemplate.php b/app/PaymentDrivers/DriverTemplate.php index 083db80e8d68..c38f126d8e33 100644 --- a/app/PaymentDrivers/DriverTemplate.php +++ b/app/PaymentDrivers/DriverTemplate.php @@ -39,6 +39,22 @@ class DriverTemplate extends BaseDriver const SYSTEM_LOG_TYPE = SystemLog::TYPE_STRIPE; //define a constant for your gateway ie TYPE_YOUR_CUSTOM_GATEWAY - set the const in the SystemLog model + public function init() + { + return $this; /* This is where you boot the gateway with your auth credentials*/ + } + + /* Returns an array of gateway types for the payment gateway */ + public function gatewayTypes(): array + { + $types = []; + + $types[] = GatewayType::CREDIT_CARD; + + return $types; + } + + /* Sets the payment method initialized */ public function setPaymentMethod($payment_method_id) { $class = self::$methods[$payment_method_id]; diff --git a/app/PaymentDrivers/PayFast/CreditCard.php b/app/PaymentDrivers/PayFast/CreditCard.php index 85fef271eac9..a95815507161 100644 --- a/app/PaymentDrivers/PayFast/CreditCard.php +++ b/app/PaymentDrivers/PayFast/CreditCard.php @@ -95,6 +95,7 @@ class CreditCard $data['signature'] = $this->payfast->generateSignature($data); $data['gateway'] = $this->payfast; + $data['payment_endpoint_url'] = $this->payfast->endpointUrl(); return render('gateways.payfast.authorize', $data); } diff --git a/app/PaymentDrivers/PayFastPaymentDriver.php b/app/PaymentDrivers/PayFastPaymentDriver.php index 3948b8cbbf44..c759a2ee561a 100644 --- a/app/PaymentDrivers/PayFastPaymentDriver.php +++ b/app/PaymentDrivers/PayFastPaymentDriver.php @@ -40,9 +40,6 @@ class PayFastPaymentDriver extends BaseDriver const SYSTEM_LOG_TYPE = SystemLog::TYPE_PAYFAST; - //Live: https://www.payfast.co.za/eng/process - //Sandbox: https://sandbox.payfast.co.za/eng/process - public function gatewayTypes(): array { $types = []; @@ -52,6 +49,14 @@ class PayFastPaymentDriver extends BaseDriver return $types; } + public function endpointUrl() + { + if($this->company_gateway->getConfigField('testMode')) + return 'https://sandbox.payfast.co.za/eng/process'; + + return 'https://www.payfast.co.za/eng/process'; + } + public function init() { diff --git a/resources/views/portal/ninja2020/gateways/payfast/authorize.blade.php b/resources/views/portal/ninja2020/gateways/payfast/authorize.blade.php index 41a54580f5e4..f7eb6cabc7f9 100644 --- a/resources/views/portal/ninja2020/gateways/payfast/authorize.blade.php +++ b/resources/views/portal/ninja2020/gateways/payfast/authorize.blade.php @@ -6,7 +6,7 @@ @endsection @section('gateway_content') -
+