2013-11-26 13:45:07 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class Gateway extends Eloquent
|
|
|
|
{
|
2014-01-08 21:09:47 +01:00
|
|
|
public $timestamps = false;
|
|
|
|
protected $softDelete = false;
|
2014-03-21 13:15:53 +01:00
|
|
|
|
|
|
|
public function paymentlibrary()
|
|
|
|
{
|
2014-03-26 01:59:33 +01:00
|
|
|
return $this->belongsTo('PaymentLibrary', 'payment_library_id');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getLogoUrl()
|
|
|
|
{
|
|
|
|
return '/images/gateways/logo_'.$this->provider.'.png';
|
2014-03-21 13:15:53 +01:00
|
|
|
}
|
2014-03-30 00:42:37 +01:00
|
|
|
|
|
|
|
public function getFields()
|
|
|
|
{
|
|
|
|
$paymentLibrary = $this->paymentlibrary;
|
|
|
|
|
2014-07-17 22:44:34 +02:00
|
|
|
if ($paymentLibrary->id == PAYMENT_LIBRARY_OMNIPAY)
|
2014-03-30 00:42:37 +01:00
|
|
|
{
|
2014-09-28 12:37:54 +02:00
|
|
|
$fields = Omnipay::create($this->provider)->getDefaultParameters();
|
2014-03-30 00:42:37 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-04-13 07:28:16 +02:00
|
|
|
$fields = Payment_Utility::load('config', 'drivers/'.strtolower($this->provider));
|
2014-03-30 00:42:37 +01:00
|
|
|
}
|
|
|
|
|
2014-07-17 22:44:34 +02:00
|
|
|
if ($fields == null)
|
2014-03-30 00:42:37 +01:00
|
|
|
{
|
|
|
|
$fields = array();
|
|
|
|
}
|
|
|
|
|
|
|
|
return $fields;
|
|
|
|
}
|
2014-07-17 22:44:34 +02:00
|
|
|
|
2013-11-26 13:45:07 +01:00
|
|
|
}
|