Code: Alles auswählen
class sofortueberweisung {
var $code, $title, $description, $enabled;
// class constructor
function sofortueberweisung() {
global $order, $aLang;
$this->code = 'sofortueberweisung';
$this->title = $aLang['module_payment_sofortueberweisung_text_title'];
$this->description = $aLang['module_payment_sofortueberweisung_text_description'];
$this->sort_order = MODULE_PAYMENT_SOFORTUEBERWEISUNG_SORT_ORDER;
$this->enabled = ((MODULE_PAYMENT_SOFORTUEBERWEISUNG_STATUS == 'True') ? true : false);
if ((int)MODULE_PAYMENT_SOFORTUEBERWEISUNG_ORDER_STATUS_ID > 0) {
$this->order_status = MODULE_PAYMENT_SOFORTUEBERWEISUNG_ORDER_STATUS_ID;
}
if (is_object($order)) $this->update_status();
$this->form_action_url = 'https://www.sofortueberweisung.de/payment/start';
}
// class methods
function update_status() {
global $order;
if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_SOFORTUEBERWEISUNG_ZONE > 0) ) {
$check_flag = false;
$db =& oosDBGetConn();
$oosDBTable = oosDBGetTables();
$check_result = $db->Execute("SELECT zone_id FROM " . $oosDBTable['zones_to_geo_zones'] . " WHERE geo_zone_id = '" . MODULE_PAYMENT_SOFORTUEBERWEISUNG_ZONE . "' AND zone_country_id = '" . $order->billing['country']['id'] . "' ORDER BY zone_id");
while ($check = $check_result->fields) {
if ($check['zone_id'] < 1) {
$check_flag = true;
break;
} elseif ($check['zone_id'] == $order->billing['zone_id']) {
$check_flag = true;
break;
}
$check_result->MoveNext();
}
if ($check_flag == false) {
$this->enabled = false;
}
}
}
function javascript_validation() {
return false;
}
function selection() {
return array('id' => $this->code,
'module' => $this->title);
}
function pre_confirmation_check() {
return false;
}
function confirmation() {
return false;
}
function process_button() {
global $order, $oCurrencies;
if (MODULE_PAYMENT_SOFORTUEBERWEISUNG_CURRENCY == 'Selected Currency') {
$my_currency = $_SESSION['currency'];
} else {
$my_currency = substr(MODULE_PAYMENT_SOFORTUEBERWEISUNG_CURRENCY, 5);
}
if (!in_array($my_currency, array('CAD', 'EUR', 'GBP', 'JPY', 'USD'))) {
$my_currency = 'EUR';
}
$process_button_string = oos_draw_hidden_field('user_id', MODULE_PAYMENT_SOFORTUEBERWEISUNG_KDNR) .
oos_draw_hidden_field('project_id', MODULE_PAYMENT_SOFORTUEBERWEISUNG_PROJEKT) .
oos_draw_hidden_field('amount', number_format(($order->info['total'] - $order->info['shipping_cost']) * $oCurrencies->get_value($my_currency), $oCurrencies->get_decimal_places($my_currency)));
return $process_button_string;
}
function before_process() {
return false;
}
function after_process() {
return false;
}
function output_error() {
return false;
}
function check() {
if (!isset($this->_check)) {
$db =& oosDBGetConn();
$oosDBTable = oosDBGetTables();
$check_result = $db->Execute("SELECT configuration_value FROM " . $oosDBTable['configuration'] . " WHERE configuration_key = 'MODULE_PAYMENT_SOFORTUEBERWEISUNG_STATUS'");
$this->_check = $check_result->RecordCount();
}
return $this->_check;
}
function install() {
$db =& oosDBGetConn();
$oosDBTable = oosDBGetTables();
$db->Execute("INSERT INTO " . $oosDBTable['configuration'] . " (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_PAYMENT_SOFORTUEBERWEISUNG_STATUS', 'True', '6', '3', 'oosCfgSelectOption(array(\'True\', \'False\'), ', now())");
$db->Execute("INSERT INTO " . $oosDBTable['configuration'] . " (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_PAYMENT_SOFORTUEBERWEISUNG_KDNR', '10000', '6', '4', now())");
$db->Execute("INSERT INTO " . $oosDBTable['configuration'] . " (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_PAYMENT_SOFORTUEBERWEISUNG_PROJEKT', '50000', '6', '4', now())");
$db->Execute("INSERT INTO " . $oosDBTable['configuration'] . " (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_PAYMENT_SOFORTUEBERWEISUNG_CURRENCY', 'Selected Currency', '6', '6', 'oosCfgSelectOption(array(\'Selected Currency\',\'Only USD\',\'Only CAD\',\'Only EUR\',\'Only GBP\',\'Only JPY\'), ', now())");
$db->Execute("INSERT INTO " . $oosDBTable['configuration'] . " (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_PAYMENT_SOFORTUEBERWEISUNG_SORT_ORDER', '0', '6', '0', now())");
$db->Execute("INSERT INTO " . $oosDBTable['configuration'] . " (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_PAYMENT_SOFORTUEBERWEISUNG_ZONE', '0', '6', '2', 'oosCfgGetZoneClassTitle', 'oosCfgPullDownZoneClasses(', now())");
$db->Execute("INSERT INTO " . $oosDBTable['configuration'] . " (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, use_function, date_added) VALUES ('MODULE_PAYMENT_SOFORTUEBERWEISUNG_ORDER_STATUS_ID', '0', '6', '0', 'oosCfgPullDownOrderStatuses(', 'oosCfgGetOrderStatusName', now())");
}
function remove() {
$db =& oosDBGetConn();
$oosDBTable = oosDBGetTables();
$db->Execute("DELETE FROM " . $oosDBTable['configuration'] . " WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
function keys() {
return array('MODULE_PAYMENT_SOFORTUEBERWEISUNG_STATUS', 'MODULE_PAYMENT_SOFORTUEBERWEISUNG_KDNR', 'MODULE_PAYMENT_SOFORTUEBERWEISUNG_PROJEKT', 'MODULE_PAYMENT_SOFORTUEBERWEISUNG_CURRENCY', 'MODULE_PAYMENT_SOFORTUEBERWEISUNG_ZONE', 'MODULE_PAYMENT_SOFORTUEBERWEISUNG_ORDER_STATUS_ID', 'MODULE_PAYMENT_SOFORTUEBERWEISUNG_SORT_ORDER');
}
}
?>
Die Schnittstelle bietet allerdings noch einige weitere optionale Felder die ich dann auch im weitern Verlauf einbauen werde
Bevor wir das aber tun hier noch die benötigte Sprachdatei die ihr bitte unter includes/languages/deu/modules/payment als sofortueberweisung.php speichert
Code: Alles auswählen
define('MODULE_PAYMENT_SOFORTUEBERWEISUNG_STATUS_TITLE', 'Sofortüberweisung');
define('MODULE_PAYMENT_SOFORTUEBERWEISUNG_STATUS_DESC', 'Möchten Sie Zahlungen per sofortueberweisung.de anbieten?');
define('MODULE_PAYMENT_SOFORTUEBERWEISUNG_KDNR_TITLE', 'Ihre Kundennummer');
define('MODULE_PAYMENT_SOFORTUEBERWEISUNG_KDNR_DESC', 'Ihre Kundennummer bei der Sofortüberweisung');
define('MODULE_PAYMENT_SOFORTUEBERWEISUNG_PROJEKT_TITLE', 'Ihre Projektnummer');
define('MODULE_PAYMENT_SOFORTUEBERWEISUNG_PROJEKT_DESC', 'Ihre Projektnummer bei der Sofortüberweisung');
define('MODULE_PAYMENT_SOFORTUEBERWEISUNG_CURRENCY_TITLE', 'Transaction Currency');
define('MODULE_PAYMENT_SOFORTUEBERWEISUNG_CURRENCY_DESC', 'The currency to use for credit card transactions');
define('MODULE_PAYMENT_SOFORTUEBERWEISUNG_ZONE_TITLE', 'Zone für diese Zahlungsweise');
define('MODULE_PAYMENT_SOFORTUEBERWEISUNG_ZONE_DESC', 'Wenn Sie eine Zone auswählen, wird diese Zahlungsweise nur in dieser Zone angeboten.');
define('MODULE_PAYMENT_SOFORTUEBERWEISUNG_ORDER_STATUS_ID_TITLE', 'Order Status');
define('MODULE_PAYMENT_SOFORTUEBERWEISUNG_ORDER_STATUS_ID_DESC', 'Festlegung des Status für Bestellungen, welche mit dieser Zahlungsweise durchgeführt werden.');
define('MODULE_PAYMENT_SOFORTUEBERWEISUNG_SORT_ORDER_TITLE', 'Reihenfolge der Anzeige');
define('MODULE_PAYMENT_SOFORTUEBERWEISUNG_SORT_ORDER_DESC', 'Niedrigste wird zuerst angezeigt.');
$aLang['module_payment_sofortueberweisung_text_title'] = 'Sofortueberweisung';
$aLang['module_payment_sofortueberweisung_text_description'] = 'SOFORTUEBERWEISUNG';
Das mit der Währung hab ich mal gelassen ....(da muss ich noch mal schauen denn eigenltich kann die schnittstelle nur EUR oder Schweizer Franken ) ist momentan aber auch nicht so wichtig