2013-11-26 14:45:07 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
class Gateway extends Eloquent
|
|
|
|
|
{
|
2014-10-20 18:14:59 +02:00
|
|
|
public $timestamps = true;
|
2014-01-08 20:09:47 +00:00
|
|
|
protected $softDelete = false;
|
2014-03-21 08:15:53 -04:00
|
|
|
|
|
|
|
|
public function paymentlibrary()
|
|
|
|
|
{
|
2014-03-25 20:59:33 -04:00
|
|
|
return $this->belongsTo('PaymentLibrary', 'payment_library_id');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getLogoUrl()
|
|
|
|
|
{
|
|
|
|
|
return '/images/gateways/logo_'.$this->provider.'.png';
|
2014-03-21 08:15:53 -04:00
|
|
|
}
|
2014-10-19 21:20:59 +03:00
|
|
|
|
|
|
|
|
public function getHelp()
|
|
|
|
|
{
|
|
|
|
|
$link = '';
|
|
|
|
|
|
|
|
|
|
if ($this->id == GATEWAY_AUTHORIZE_NET || $this->id == GATEWAY_AUTHORIZE_NET_SIM) {
|
|
|
|
|
$link = 'http://reseller.authorize.net/application/?id=5560364';
|
|
|
|
|
} else if ($this->id == GATEWAY_PAYPAL_EXPRESS) {
|
|
|
|
|
$link = 'https://www.paypal.com/us/cgi-bin/webscr?cmd=_login-api-run';
|
|
|
|
|
} else if ($this->id == GATEWAY_TWO_CHECKOUT) {
|
|
|
|
|
$link = 'https://www.2checkout.com/referral?r=2c37ac2298';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$key = 'texts.gateway_help_' . $this->id;
|
|
|
|
|
$str = trans($key, ['link' => "<a href='$link' target='_blank'>Click here</a>"]);
|
|
|
|
|
return $key != $str ? $str : '';
|
|
|
|
|
}
|
2014-03-29 19:42:37 -04:00
|
|
|
|
|
|
|
|
public function getFields()
|
|
|
|
|
{
|
|
|
|
|
$paymentLibrary = $this->paymentlibrary;
|
|
|
|
|
|
2014-07-17 23:44:34 +03:00
|
|
|
if ($paymentLibrary->id == PAYMENT_LIBRARY_OMNIPAY)
|
2014-03-29 19:42:37 -04:00
|
|
|
{
|
2014-09-28 13:37:54 +03:00
|
|
|
$fields = Omnipay::create($this->provider)->getDefaultParameters();
|
2014-03-29 19:42:37 -04:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2014-04-13 08:28:16 +03:00
|
|
|
$fields = Payment_Utility::load('config', 'drivers/'.strtolower($this->provider));
|
2014-03-29 19:42:37 -04:00
|
|
|
}
|
|
|
|
|
|
2014-07-17 23:44:34 +03:00
|
|
|
if ($fields == null)
|
2014-03-29 19:42:37 -04:00
|
|
|
{
|
|
|
|
|
$fields = array();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $fields;
|
|
|
|
|
}
|
2014-07-17 23:44:34 +03:00
|
|
|
|
2014-10-20 18:14:59 +02:00
|
|
|
}
|