ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
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.
 generatekeyForEpay ($cur, $amount, $orderid)
 This function generates a valid MD5 key on the data about to be transmitted to ePay.
 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.
 setAll ($a)
 Set all ePay settings using an array.
 valid ()
 Check if the current settings looks valid.
 clearAll ()
 Clears the payment settings for the epay payment method.
 save ()
 Inserts or updates (if payment settings already exist) the epay settings data.

Static Public Member Functions

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

Private Member Functions

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

Private Attributes

 $db
 $settings
 $settings_id
 $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 32 of file class.ilEPaySettings.php.

Constructor & Destructor Documentation

ilEPaySettings::__construct ( )
private

Constructor.

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

References getSettings().

{
$this->getSettings();
}

+ Here is the call graph for this function:

Member Function Documentation

ilEPaySettings::clearAll ( )

Clears the payment settings for the epay payment method.

public

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

References getSettingsId().

{
$statement = $this->db->manipulateF('
UPDATE payment_settings
SET epay = %s
WHERE settings_id = %s',
array('text', 'integer'),
array('NULL', $this->getSettingsId()));
$this->settings = array();
}

+ Here is the call graph for this function:

ilEPaySettings::fetchSettingsId ( )
private

Fetches and sets the primary key of the payment settings.

private

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

References $ilDB, $res, DB_FETCHMODE_OBJECT, and setSettingsId().

Referenced by getSettings().

{
global $ilDB;
$res = $ilDB->query('SELECT * FROM payment_settings');
$result = $res->fetchRow(DB_FETCHMODE_OBJECT);
$this->setSettingsId($result->settings_id);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 99 of file class.ilEPaySettings.php.

References getAuthToken(), and getSettings().

{
$this->getSettings();
$password = $this->getAuthToken();
return md5($cur . $amount . $orderid . $password);
}

+ Here is the call graph for this function:

ilEPaySettings::getAll ( )

Returns array of all epay settings.

public

Returns
array $values Array of all epay settings

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

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

Referenced by save(), and valid().

{
$values = array(
"server_host" => $this->getServerHost(),
"server_path" => $this->getServerPath(),
"merchant_number" => (int) $this->getMerchantNumber(),
"auth_token" => $this->getAuthToken(),
"auth_email" => $this->getAuthEmail(),
"instant_capture" => $this->getInstantCapture()
);
return $values;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilEPaySettings::getAuthEmail ( )
private

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

Referenced by getAll().

{
return $this->auth_email;
}

+ Here is the caller graph for this function:

ilEPaySettings::getAuthToken ( )
private

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

References $auth_token.

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

{
}

+ Here is the caller graph for this function:

static ilEPaySettings::getInstance ( )
static

Static method to get the singleton instance.

public

Returns
object $instance Singular ilBMFSettings instance

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

References $instance.

Referenced by ilShopShoppingCartGUI\__construct(), ilObjPaymentSettingsGUI\epaySettingsObject(), and ilObjPaymentSettingsGUI\saveEPaySettingsObject().

{
if (!self::$instance)
{
self::$instance = new ilEPaySettings();
}
return self::$instance;
}

+ Here is the caller graph for this function:

ilEPaySettings::getInstantCapture ( )
private

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

References $instant_capture.

Referenced by getAll().

+ Here is the caller graph for this function:

ilEPaySettings::getMerchantNumber ( )
private

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

References $merchant_number.

Referenced by getAll().

+ Here is the caller graph for this function:

ilEPaySettings::getServerHost ( )
private

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

References $server_host.

Referenced by getAll().

{
}

+ Here is the caller graph for this function:

ilEPaySettings::getServerPath ( )
private

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

References $server_path.

Referenced by getAll().

{
}

+ Here is the caller graph for this function:

ilEPaySettings::getSettings ( )
private

Called from constructor to fetch settings from database.

private

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

References $data, $ilDB, $res, DB_FETCHMODE_OBJECT, fetchSettingsId(), getSettingsId(), and setAll().

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

{
global $ilDB;
$this->fetchSettingsId();
$res = $ilDB->queryf('
SELECT epay FROM payment_settings WHERE settings_id = %s',
array('integer'), array($this->getSettingsId()));
$result = $res->fetchRow(DB_FETCHMODE_OBJECT);
$data = array();
if (is_object($result))
{
if ($result->epay != "") $data = unserialize($result->epay);
else $data = array();
}
$this->setAll($data);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilEPaySettings::getSettingsId ( )

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

References $settings_id.

Referenced by clearAll(), getSettings(), and save().

{
}

+ Here is the caller graph for this function:

ilEPaySettings::save ( )

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

public

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

References $ilDB, getAll(), getSettingsId(), and setSettingsId().

{
global $ilDB;
$values = $this->getAll();
if ($this->getSettingsId())
{
$statement = $ilDB->manipulateF('
UPDATE payment_settings
SET epay = %s
WHERE settings_id = %s',
array('text', 'integer'),
array(serialize($values), $this->getSettingsId()));
}
else
{
$next_id = $ilDB->nextId('payment_settings');
$statement = $ilDB->manipulateF('
INSERT INTO payment_settings
( settings_id,
epay)
VALUES (%s, %s)',
array('integer','text'), array($next_id, serialize($values)));
$this->setSettingsId($next_id);
}
}

+ Here is the call graph for this function:

ilEPaySettings::setAll (   $a)

Set all ePay settings using an array.

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

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

Referenced by getSettings().

{
if (isset($a['server_host'])) $this->setServerHost($a['server_host']);
if (isset($a['server_path'])) $this->setServerPath($a['server_path']);
if (isset($a['merchant_number'])) $this->setMerchantNumber($a['merchant_number']);
if (isset($a['auth_token'])) $this->setAuthToken($a['auth_token']);
if (isset($a['auth_email'])) $this->setAuthEmail($a['auth_email']);
if (isset($a['instant_capture'])) $this->setInstantCapture($a['instant_capture']);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilEPaySettings::setAuthEmail (   $a_auth_email)

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

Referenced by setAll().

{
$this->auth_email = $a_auth_email;
}

+ Here is the caller graph for this function:

ilEPaySettings::setAuthToken (   $a_auth_token)

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

Referenced by setAll().

{
$this->auth_token = $a_auth_token;
}

+ Here is the caller graph for this function:

ilEPaySettings::setInstantCapture (   $a_instant_capture)

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

Referenced by setAll().

{
if ((!$a_instant_capture == 1) || (!$a_instant_capture== '1')) $a_instant_capture=0; else $a_instant_capture=1;
$this->instant_capture = $a_instant_capture;
}

+ Here is the caller graph for this function:

ilEPaySettings::setMerchantNumber (   $a_merchant_number)

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

Referenced by setAll().

{
$this->merchant_number = (int) $a_merchant_number;
}

+ Here is the caller graph for this function:

ilEPaySettings::setServerHost (   $a_server_host)

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

Referenced by setAll().

{
$this->server_host = $a_server_host;
}

+ Here is the caller graph for this function:

ilEPaySettings::setServerPath (   $a_server_path)

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

Referenced by setAll().

{
$this->server_path = $a_server_path;
}

+ Here is the caller graph for this function:

ilEPaySettings::setSettingsId (   $a_settings_id = 0)

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

Referenced by fetchSettingsId(), and save().

{
$this->settings_id = $a_settings_id;
}

+ Here is the caller graph for this function:

ilEPaySettings::valid ( )

Check if the current settings looks valid.

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

References getAll().

{
$r = true;
$a = $this->getAll();
if ( ($a['server_host'] == '') || ($a['server_path'] == '') ) $r = false;
if ( (int) $a['merchant_number'] <= 0 ) $r = false;
if ( ((int) $a['instant_capture'] != 0 ) && ((int) $a['instant_capture'] != 1)) $r = false;
return $r;
}

+ Here is the call graph for this function:

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

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

Returns
bool

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

References getAuthToken(), and getSettings().

{
$this->getSettings();
$password = $this->getAuthToken();
$strForValidate = "";
$strForValidate = $amount . $orderid . $transactionid . $password;
if (md5($strForValidate) == $md5Key) {
return true;
}
else {
return false;
}
}

+ Here is the call graph for this function:

Field Documentation

ilEPaySettings::$auth_token
private

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

Referenced by getAuthToken().

ilEPaySettings::$db
private

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

ilEPaySettings::$instance = null
staticprivate

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

Referenced by getInstance().

ilEPaySettings::$instant_capture
private

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

Referenced by getInstantCapture().

ilEPaySettings::$merchant_number
private

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

Referenced by getMerchantNumber().

ilEPaySettings::$page_style
private

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

ilEPaySettings::$server_host
private

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

Referenced by getServerHost().

ilEPaySettings::$server_path
private

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

Referenced by getServerPath().

ilEPaySettings::$settings
private

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

ilEPaySettings::$settings_id
private

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

Referenced by getSettingsId().

ilEPaySettings::$ssl
private

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

ilEPaySettings::$vendor
private

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


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