ILIAS  release_4-4 Revision
ilEPaySettings Class Reference
+ Collaboration diagram for ilEPaySettings:

Public Member Functions

 validateEPayData ($amount, $orderid, $transactionid, $md5Key)
 This function validates data received from ePay, and verifies the md5key is valid. More...
 
 generatekeyForEpay ($cur, $amount, $orderid)
 This function generates a valid MD5 key on the data about to be transmitted to ePay. More...
 
 setSettingsId ($a_settings_id=0)
 
 getSettingsId ()
 
 setServerHost ($a_server_host)
 
 setServerPath ($a_server_path)
 
 setMerchantNumber ($a_merchant_number)
 
 setAuthToken ($a_auth_token)
 
 setAuthEmail ($a_auth_email)
 
 setInstantCapture ($a_instant_capture)
 
 getAll ()
 Returns array of all epay settings. More...
 
 setAll ($a)
 Set all ePay settings using an array. More...
 
 valid ()
 Check if the current settings looks valid. More...
 
 clearAll ()
 Clears the payment settings for the epay payment method. More...
 
 save ()
 Inserts or updates (if payment settings already exist) the epay settings data. More...
 

Static Public Member Functions

static getInstance ()
 Static method to get the singleton instance. More...
 

Data Fields

 $pSettings
 

Private Member Functions

 __construct ()
 Constructor. More...
 
 getSettings ()
 Called from constructor to fetch settings from database. More...
 
 fetchSettingsId ()
 Fetches and sets the primary key of the payment settings. More...
 
 getServerHost ()
 
 getServerPath ()
 
 getMerchantNumber ()
 
 getAuthToken ()
 
 getAuthEmail ()
 
 getInstantCapture ()
 

Private Attributes

 $db
 
 $server_host
 
 $server_path
 
 $vendor
 
 $auth_token
 
 $page_style
 
 $merchant_number
 
 $ssl
 
 $instant_capture
 

Static Private Attributes

static $instance = null
 

Detailed Description

Author
Nicolai Lundgaard nicol.nosp@m.ai@i.nosp@m.lias..nosp@m.dk
Jesper Godvad jespe.nosp@m.r@il.nosp@m.ias.d.nosp@m.k
Version
Id
class.ilPaypalSettings.php 19533 2009-04-03 10:23:37Z nkrzywon

Definition at line 35 of file class.ilEPaySettings.php.

Constructor & Destructor Documentation

◆ __construct()

ilEPaySettings::__construct ( )
private

Constructor.

Definition at line 74 of file class.ilEPaySettings.php.

References ilPaymentSettings\_getInstance(), and getSettings().

75  {
76  $this->pSettings = ilPaymentSettings::_getInstance();
77  $this->getSettings();
78  }
getSettings()
Called from constructor to fetch settings from database.
+ Here is the call graph for this function:

Member Function Documentation

◆ clearAll()

ilEPaySettings::clearAll ( )

Clears the payment settings for the epay payment method.

public

Definition at line 283 of file class.ilEPaySettings.php.

284  {
285  $this->pSettings->set('epay', NULL, 'epay');
286  $this->settings = array();
287 // $statement = $this->db->manipulateF('
288 // UPDATE payment_settings
289 // SET epay = %s
290 // WHERE settings_id = %s',
291 // array('text', 'integer'),
292 // array('NULL', $this->getSettingsId()));
293 //
294 //
295 // $this->settings = array();
296 
297  }

◆ fetchSettingsId()

ilEPaySettings::fetchSettingsId ( )
private

Fetches and sets the primary key of the payment settings.

private

Definition at line 147 of file class.ilEPaySettings.php.

148  {
149 // global $ilDB;
150 //
151 // $res = $ilDB->query('SELECT * FROM payment_settings');
152 //
153 // $result = $res->fetchRow(DB_FETCHMODE_OBJECT);
154 //
155 // $this->setSettingsId($result->settings_id);
156  }

◆ generatekeyForEpay()

ilEPaySettings::generatekeyForEpay (   $cur,
  $amount,
  $orderid 
)

This function generates a valid MD5 key on the data about to be transmitted to ePay.

ePay will again verify the data and if the data is not valid and error will be thrown (redirected to decline)

Definition at line 104 of file class.ilEPaySettings.php.

References getAuthToken(), and getSettings().

105  {
106  $this->getSettings();
107  $password = $this->getAuthToken();
108  return md5($cur . $amount . $orderid . $password);
109  }
getSettings()
Called from constructor to fetch settings from database.
+ Here is the call graph for this function:

◆ getAll()

ilEPaySettings::getAll ( )

Returns array of all epay settings.

public

Returns
array $values Array of all epay settings

Definition at line 237 of file class.ilEPaySettings.php.

References getAuthEmail(), getAuthToken(), getInstantCapture(), getMerchantNumber(), getServerHost(), and getServerPath().

Referenced by save(), and valid().

238  {
239  $values = array(
240  "server_host" => $this->getServerHost(),
241  "server_path" => $this->getServerPath(),
242  "merchant_number" => (int) $this->getMerchantNumber(),
243  "auth_token" => $this->getAuthToken(),
244  "auth_email" => $this->getAuthEmail(),
245  "instant_capture" => $this->getInstantCapture()
246  );
247  return $values;
248  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAuthEmail()

ilEPaySettings::getAuthEmail ( )
private

Definition at line 214 of file class.ilEPaySettings.php.

Referenced by getAll().

215  {
216  return $this->auth_email;
217  }
+ Here is the caller graph for this function:

◆ getAuthToken()

ilEPaySettings::getAuthToken ( )
private

Definition at line 203 of file class.ilEPaySettings.php.

References $auth_token.

Referenced by generatekeyForEpay(), getAll(), and validateEPayData().

204  {
205  return $this->auth_token;
206  }
+ Here is the caller graph for this function:

◆ getInstance()

static ilEPaySettings::getInstance ( )
static

Static method to get the singleton instance.

public

Returns
object $instance Singular ilBMFSettings instance

Definition at line 60 of file class.ilEPaySettings.php.

61  {
62  if (!self::$instance)
63  {
64  self::$instance = new ilEPaySettings();
65  }
66 
67  return self::$instance;
68  }

◆ getInstantCapture()

ilEPaySettings::getInstantCapture ( )
private

Definition at line 225 of file class.ilEPaySettings.php.

References $instant_capture.

Referenced by getAll().

226  {
227  return $this->instant_capture;
228  }
+ Here is the caller graph for this function:

◆ getMerchantNumber()

ilEPaySettings::getMerchantNumber ( )
private

Definition at line 193 of file class.ilEPaySettings.php.

References $merchant_number.

Referenced by getAll().

194  {
195  return $this->merchant_number;
196  }
+ Here is the caller graph for this function:

◆ getServerHost()

ilEPaySettings::getServerHost ( )
private

Definition at line 173 of file class.ilEPaySettings.php.

References $server_host.

Referenced by getAll().

174  {
175  return $this->server_host;
176  }
+ Here is the caller graph for this function:

◆ getServerPath()

ilEPaySettings::getServerPath ( )
private

Definition at line 183 of file class.ilEPaySettings.php.

References $server_path.

Referenced by getAll().

184  {
185  return $this->server_path;
186  }
+ Here is the caller graph for this function:

◆ getSettings()

ilEPaySettings::getSettings ( )
private

Called from constructor to fetch settings from database.

private

Definition at line 117 of file class.ilEPaySettings.php.

References $data, $result, and setAll().

Referenced by __construct(), generatekeyForEpay(), and validateEPayData().

118  {
119 
120  $result->epay = $this->pSettings->get('epay');
121 
122 // global $ilDB;
123 //
124 // $this->fetchSettingsId();
125 //
126 // $res = $ilDB->queryf('
127 // SELECT epay FROM payment_settings WHERE settings_id = %s',
128 // array('integer'), array($this->getSettingsId()));
129 //
130 // $result = $res->fetchRow(DB_FETCHMODE_OBJECT);
131 
132  $data = array();
133  if (is_object($result))
134  {
135  if ($result->epay != "") $data = unserialize($result->epay);
136  else $data = array();
137  }
138 
139  $this->setAll($data);
140  }
$result
setAll($a)
Set all ePay settings using an array.
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSettingsId()

ilEPaySettings::getSettingsId ( )

Definition at line 163 of file class.ilEPaySettings.php.

164  {
165 // return $this->settings_id;
166  }

◆ save()

ilEPaySettings::save ( )

Inserts or updates (if payment settings already exist) the epay settings data.

public

Definition at line 304 of file class.ilEPaySettings.php.

References getAll().

305  {
306  $values = $this->getAll();
307  $this->pSettings->set('epay', serialize($values), 'epay');
308 
309 // global $ilDB;
310 // if ($this->getSettingsId())
311 // {
312 // $statement = $ilDB->manipulateF('
313 // UPDATE payment_settings
314 // SET epay = %s
315 // WHERE settings_id = %s',
316 // array('text', 'integer'),
317 // array(serialize($values), $this->getSettingsId()));
318 //
319 // }
320 // else
321 // {
322 // $next_id = $ilDB->nextId('payment_settings');
323 // $statement = $ilDB->manipulateF('
324 // INSERT INTO payment_settings
325 // ( settings_id,
326 // epay)
327 // VALUES (%s, %s)',
328 // array('integer','text'), array($next_id, serialize($values)));
329 //
330 // $this->setSettingsId($next_id);
331 // }
332  }
getAll()
Returns array of all epay settings.
+ Here is the call graph for this function:

◆ setAll()

ilEPaySettings::setAll (   $a)

Set all ePay settings using an array.

Definition at line 253 of file class.ilEPaySettings.php.

References setAuthEmail(), setAuthToken(), setInstantCapture(), setMerchantNumber(), setServerHost(), and setServerPath().

Referenced by getSettings().

254  {
255  if (isset($a['server_host'])) $this->setServerHost($a['server_host']);
256  if (isset($a['server_path'])) $this->setServerPath($a['server_path']);
257  if (isset($a['merchant_number'])) $this->setMerchantNumber($a['merchant_number']);
258  if (isset($a['auth_token'])) $this->setAuthToken($a['auth_token']);
259  if (isset($a['auth_email'])) $this->setAuthEmail($a['auth_email']);
260  if (isset($a['instant_capture'])) $this->setInstantCapture($a['instant_capture']);
261  }
setInstantCapture($a_instant_capture)
setServerHost($a_server_host)
setMerchantNumber($a_merchant_number)
setServerPath($a_server_path)
setAuthToken($a_auth_token)
setAuthEmail($a_auth_email)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setAuthEmail()

ilEPaySettings::setAuthEmail (   $a_auth_email)

Definition at line 209 of file class.ilEPaySettings.php.

Referenced by setAll().

210  {
211  $this->auth_email = $a_auth_email;
212  }
+ Here is the caller graph for this function:

◆ setAuthToken()

ilEPaySettings::setAuthToken (   $a_auth_token)

Definition at line 198 of file class.ilEPaySettings.php.

Referenced by setAll().

199  {
200  $this->auth_token = $a_auth_token;
201  }
+ Here is the caller graph for this function:

◆ setInstantCapture()

ilEPaySettings::setInstantCapture (   $a_instant_capture)

Definition at line 219 of file class.ilEPaySettings.php.

Referenced by setAll().

220  {
221  if ((!$a_instant_capture == 1) || (!$a_instant_capture== '1')) $a_instant_capture=0; else $a_instant_capture=1;
222  $this->instant_capture = $a_instant_capture;
223  }
+ Here is the caller graph for this function:

◆ setMerchantNumber()

ilEPaySettings::setMerchantNumber (   $a_merchant_number)

Definition at line 188 of file class.ilEPaySettings.php.

Referenced by setAll().

189  {
190  $this->merchant_number = (int) $a_merchant_number;
191  }
+ Here is the caller graph for this function:

◆ setServerHost()

ilEPaySettings::setServerHost (   $a_server_host)

Definition at line 168 of file class.ilEPaySettings.php.

Referenced by setAll().

169  {
170  $this->server_host = $a_server_host;
171  }
+ Here is the caller graph for this function:

◆ setServerPath()

ilEPaySettings::setServerPath (   $a_server_path)

Definition at line 178 of file class.ilEPaySettings.php.

Referenced by setAll().

179  {
180  $this->server_path = $a_server_path;
181  }
+ Here is the caller graph for this function:

◆ setSettingsId()

ilEPaySettings::setSettingsId (   $a_settings_id = 0)

Definition at line 158 of file class.ilEPaySettings.php.

159  {
160 // $this->settings_id = $a_settings_id;
161  }

◆ valid()

ilEPaySettings::valid ( )

Check if the current settings looks valid.

Definition at line 266 of file class.ilEPaySettings.php.

References $r, and getAll().

267  {
268  $r = true;
269  $a = $this->getAll();
270  if ( ($a['server_host'] == '') || ($a['server_path'] == '') ) $r = false;
271  if ( (int) $a['merchant_number'] <= 0 ) $r = false;
272  if ( ((int) $a['instant_capture'] != 0 ) && ((int) $a['instant_capture'] != 1)) $r = false;
273  return $r;
274  }
getAll()
Returns array of all epay settings.
$r
+ Here is the call graph for this function:

◆ validateEPayData()

ilEPaySettings::validateEPayData (   $amount,
  $orderid,
  $transactionid,
  $md5Key 
)

This function validates data received from ePay, and verifies the md5key is valid.

Returns
bool

Definition at line 85 of file class.ilEPaySettings.php.

References getAuthToken(), and getSettings().

86  {
87  $this->getSettings();
88  $password = $this->getAuthToken();
89  $strForValidate = "";
90  $strForValidate = $amount . $orderid . $transactionid . $password;
91  if (md5($strForValidate) == $md5Key) {
92  return true;
93  }
94  else {
95  return false;
96  }
97  }
getSettings()
Called from constructor to fetch settings from database.
+ Here is the call graph for this function:

Field Documentation

◆ $auth_token

ilEPaySettings::$auth_token
private

Definition at line 46 of file class.ilEPaySettings.php.

Referenced by getAuthToken().

◆ $db

ilEPaySettings::$db
private

Definition at line 37 of file class.ilEPaySettings.php.

◆ $instance

ilEPaySettings::$instance = null
staticprivate

Definition at line 52 of file class.ilEPaySettings.php.

◆ $instant_capture

ilEPaySettings::$instant_capture
private

Definition at line 50 of file class.ilEPaySettings.php.

Referenced by getInstantCapture().

◆ $merchant_number

ilEPaySettings::$merchant_number
private

Definition at line 48 of file class.ilEPaySettings.php.

Referenced by getMerchantNumber().

◆ $page_style

ilEPaySettings::$page_style
private

Definition at line 47 of file class.ilEPaySettings.php.

◆ $pSettings

ilEPaySettings::$pSettings

Definition at line 38 of file class.ilEPaySettings.php.

◆ $server_host

ilEPaySettings::$server_host
private

Definition at line 43 of file class.ilEPaySettings.php.

Referenced by getServerHost().

◆ $server_path

ilEPaySettings::$server_path
private

Definition at line 44 of file class.ilEPaySettings.php.

Referenced by getServerPath().

◆ $ssl

ilEPaySettings::$ssl
private

Definition at line 49 of file class.ilEPaySettings.php.

◆ $vendor

ilEPaySettings::$vendor
private

Definition at line 45 of file class.ilEPaySettings.php.


The documentation for this class was generated from the following file: