mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-05 18:52:44 +01:00
Fleshing out payment drivers
This commit is contained in:
parent
f8734db1b6
commit
f72bd34483
@ -21,11 +21,16 @@ use Omnipay\Omnipay;
|
||||
*/
|
||||
class BasePaymentDriver
|
||||
{
|
||||
|
||||
/* The company gateway instance*/
|
||||
protected $company_gateway;
|
||||
|
||||
/* The Omnipay payment driver instance*/
|
||||
protected $gateway;
|
||||
|
||||
/* Member variables */
|
||||
protected $refundable = false;
|
||||
protected $token_billing = false;
|
||||
|
||||
public function __construct(CompanyGateway $company_gateway)
|
||||
{
|
||||
$this->company_gateway = $company_gateway;
|
||||
@ -33,37 +38,74 @@ class BasePaymentDriver
|
||||
//$this->gatewayType = $gatewayType ?: $this->gatewayTypes()[0];
|
||||
}
|
||||
|
||||
/* Stubbed in parent, but should never be initialized
|
||||
* The boot method should be used in the superclass
|
||||
* to initialize all the member variables for the
|
||||
* given driver / payment gateway
|
||||
*
|
||||
* ie.
|
||||
*
|
||||
* ->gateway()
|
||||
* ->setRefundable(true)
|
||||
* ->setTokenBilling(true)
|
||||
*
|
||||
* @return Instance
|
||||
*/
|
||||
public function boot(){}
|
||||
|
||||
/**
|
||||
* Returns the Omnipay driver
|
||||
* @return object Omnipay initialized object
|
||||
*/
|
||||
protected function gateway()
|
||||
{
|
||||
if ($this->gateway)
|
||||
return $this->gateway;
|
||||
|
||||
|
||||
$this->gateway = Omnipay::create($this->company_gateway->gateway->provider);
|
||||
$this->gateway->initialize((array) $this->company_gateway->getConfig());
|
||||
|
||||
return $this->gateway;
|
||||
return $this;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function setRefundable($value)
|
||||
{
|
||||
$this->refundable = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether refunds are possible with the gateway
|
||||
* @return boolean TRUE|FALSE
|
||||
*/
|
||||
public function isRefundable() :bool {}
|
||||
public function getRefundable()
|
||||
{
|
||||
return $this->refundable;
|
||||
}
|
||||
|
||||
public function setTokenBilling($value)
|
||||
{
|
||||
$this->token_billing = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether token billing is possible with the gateway
|
||||
* @return boolean TRUE|FALSE
|
||||
*/
|
||||
public function hasTokenBilling() :bool {}
|
||||
public function getTokenBilling()
|
||||
{
|
||||
return $this->token_billing;
|
||||
}
|
||||
|
||||
/**
|
||||
* Refunds a given payment
|
||||
* @return void
|
||||
*/
|
||||
public function refundPayment() {}
|
||||
public function refundPayment()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user