1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Padding our DriverTemplate

This commit is contained in:
David Bomba 2021-06-24 15:51:30 +10:00
parent 15bdb3ff3c
commit 6f1593a35e
4 changed files with 26 additions and 4 deletions

View File

@ -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];

View File

@ -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);
}

View File

@ -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()
{

View File

@ -6,7 +6,7 @@
@endsection
@section('gateway_content')
<form action="https://sandbox.payfast.co.za/eng/process" method="post">
<form action="{{ $payment_endpoint_url }}" method="post">
<input type="hidden" name="merchant_id" value="{{ $merchant_id }}">
<input type="hidden" name="merchant_key" value="{{ $merchant_key }}">
<input type="hidden" name="return_url" value="{{ $return_url }}">