diff --git a/callback_novalnet2zencart.php b/callback_novalnet2zencart.php new file mode 100644 index 0000000..867260f --- /dev/null +++ b/callback_novalnet2zencart.php @@ -0,0 +1,307 @@ +'; +$addSubsequentTidToDb = true; //whether to add the new tid to db; adapt if necessary +// Order State/Status Settings +/* 4. Standard Types of Status: + 1. Pending = 1 + 2. Processing = 2 + 3. Delivered = 3 + 4. Update = 4 + + */ +$orderState = 3; //Note: Indicates Payment accepted. +//Security Setting; only this IP is allowed for call back script +$ipAllowed = '195.143.189.210'; //Novalnet IP, is a fixed value, DO NOT CHANGE!!!!! +//Reporting Email Addresses Settings +$shopInfo = 'Zencart Shop' . $lineBreak; //manditory;adapt for your need +$mailHost = 'mail.novalnet.de'; //adapt +$mailPort = 25; //adapt +$emailFromAddr = ''; //sender email addr., manditory, adapt it +$emailToAddr = ''; //recipient email addr., manditory, adapt it +$emailSubject = 'Novalnet Callback Script Access Report'; //adapt if necessary; +$emailBody = ''; //Email text, adapt +$emailFromName = ""; // Sender name, adapt +$emailToName = ""; // Recipient name, adapt +//Parameters Settings +$hParamsRequired = array( + 'vendor_id' => '', + 'tid' => '', + 'payment_type' => '', + 'status' => '', + 'amount' => '', + 'tid_payment' => ''); + +$hParamsTest = array( + 'vendor_id' => '4', + 'status' => '100', + 'amount' => '52679', //must be avail. in shop database; 850 = 8.50 + 'payment_type' => 'INVOICE_CREDIT', + 'tid_payment' => '12613900002304354', //orig. tid; must be avail. in shop database + 'tid' => '12345678901234567', //subsequent tid, from Novalnet backend; can be a fake for test +); + +//Test Data Settings +if ($test) { + $_REQUEST = $hParamsTest; + $emailFromName = "Novalnet"; // Sender name, adapt + $emailToName = "Novalnet"; // Recipient name, adapt + $emailFromAddr = 'test@novalnet.de'; //manditory for test; adapt + $emailToAddr = 'test@novalnet.de'; //manditory for test; adapt + $emailSubject = $emailSubject . ' - TEST'; //adapt +} + +// ################### Main Prog. ########################## +try { + //Check Params + if (checkIP($_REQUEST)) { + if (checkParams($_REQUEST)) { + //Get Order ID and Set New Order Status + if ($orderIncrementId = getIncrementId($_REQUEST)) { + setOrderStatus($orderIncrementId); //and send error mails if any + } + } + } + if (!$emailBody) { + $emailBody .= 'Novalnet Callback Script called for StoreId Parameters: ' . print_r($_POST, true) . $lineBreak; + $emailBody .= 'Novalnet callback succ. ' . $lineBreak; + $emailBody .= 'Params: ' . print_r($_REQUEST, true) . $lineBreak; + } +} catch (Exception $e) { + $emailBody .= "Exception catched: $lineBreak\$e:" . $e->getMessage() . $lineBreak; +} + +if ($emailBody) { + if (!sendEmailZencart($emailBody)) { + if ($debug) { + echo "Mailing failed!" . $lineBreak; + echo "This mail text should be sent: " . $lineBreak; + echo $emailBody; + } + } +} + +// ############## Sub Routines ##################### +function sendEmailZencart($emailBody) { + global $lineBreak, $debug, $test, $emailFromAddr, $emailToAddr, $emailFromName, $emailToName, $emailSubject, $shopInfo, $mailHost, $mailPort; + $emailBodyT = str_replace('
', PHP_EOL, $emailBody); + //Send Email + ini_set('SMTP', $mailHost); + ini_set('smtp_port', $mailPort); + header('Content-Type: text/html; charset=iso-8859-1'); + $headers = 'From: ' . $emailFromAddr . "\r\n"; + try { + if ($debug) { + echo __FUNCTION__ . ': Sending Email suceeded!' . $lineBreak; + } + $sendmail = mail($emailToAddr, $emailSubject, $emailBodyT, $headers); + } catch (Exception $e) { + if ($debug) { + echo 'Email sending failed: ' . $e->getMessage(); + } + return false; + } + if ($debug) { + echo 'This text has been sent:' . $lineBreak . $emailBody; + } + return true; +} + +function checkParams($_request) { + global $lineBreak, $hParamsRequired, $emailBody; + $error = false; + $emailBody = ''; + if (!$_request) { + $emailBody .= 'No params passed over!' . $lineBreak; + return false; + } elseif ($hParamsRequired) { + foreach ($hParamsRequired as $k => $v) { + if (empty($_request[$k])) { + $error = true; + $emailBody .= 'Required param (' . $k . ') missing!' . $lineBreak; + } + } + if ($error) { + return false; + } + } + //Only Payment Type 'INVOICE_CREDIT' allowed; Otherwise you have to adapt the logic + if (!empty($_request['payment_type']) and 'INVOICE_CREDIT' != strtoupper($_request['payment_type'])) { + // Nothing to do + $emailBody .= "Novalnet callback received. But payment_type != INVOICE_CREDIT (" . $_request['payment_type'] . ")$lineBreak"; + return false; + } + + if (!empty($_request['status']) and 100 != $_request['status']) { + $emailBody .= 'The status codes [' . $_request['status'] . '] is not valid: Only 100 is allowed.' . "$lineBreak$lineBreak" . $lineBreak; + return false; + } + return true; +} + +function getIncrementId($_request) { + global $lineBreak, $tableOrderPayment, $tableOrder, $emailBody, $debug, $db; + $orderDetails = array(); + + if (!empty($_request['order_no'])) { + return $_request['order_no']; + } elseif (!empty($_request['order_id'])) { + return $_request['order_id']; + } + if(strlen($_request['tid_payment'])==17){ + $query = "SELECT orders_id, orders_status_id from " . TABLE_ORDERS_STATUS_HISTORY . " WHERE comments LIKE '%" . $_request['tid_payment'] . "%'"; + try { + $orders = $db->Execute($query); + $orders_id = $orders->fields['orders_id']; + $order_status = $orders->fields['orders_status_id']; + } catch (Exception $e) { + $emailBody .= 'The original order not found in the shop database table (`' . TABLE_ORDERS_STATUS_HISTORY . '`);'; + $emailBody .= 'Reason: ' . $e->getMessage() . $lineBreak . $lineBreak; + $emailBody .= 'Query : ' . $qry . $lineBreak . $lineBreak; + return false; + } + } + require(DIR_WS_CLASSES . 'order.php'); + $orderDetails = new order($orders_id); + if ($debug) { + echo'Order Details:
';
+        //print_r($orderDetails);
+		echo $orderDetails->info['total'].'
'; + echo $orderDetails->info['payment_module_code']; + echo'
'; + } + if (!$orders or empty($orders_id) or !$orderDetails) { + //$emailBody .= 'increment_id n/a' . $lineBreak; + $emailBody .= 'No Order for TID : '.$_request['tid_payment']. $lineBreak; + return false; + } + //check amount + $amount = $_request['amount']; + $order_total = $orderDetails->info['total']; + $_amount = intval(round($order_total * 100)); + + // $final_price = round($order_total->fields['value'], 2); + // $_amount = isset($final_price) ? $final_price * 100 : 0; + if (!$_amount || (intval("$_amount") != intval("$amount"))) { + $emailBody .= "The order amount ($_amount) does not match with the request amount ($amount)$lineBreak$lineBreak"; + return false; + } + $paymentType = strtolower($orderDetails->info['payment_module_code']); + if (!in_array($paymentType, array('novalnet_prepayment', 'novalnet_invoice','novalnet kauf auf rechnung','novalnet vorauskasse'))) { + $emailBody .= "The order payment type ($paymentType) is not Prepayment!$lineBreak$lineBreak"; + return false; + } + return $orders_id; // == true +} + +function setOrderStatus($incrementId) { + global $lineBreak, $createInvoice, $emailBody, $orderStatus, $orderState, $tableOrderPayment, $addSubsequentTidToDb, $db; + + if ($incrementId) { + if ($addSubsequentTidToDb){ + $comments = ' Novalnet Callback Script executed successfully. The subsequent TID: (' . $_REQUEST['tid'] . ') on ' . date('Y-m-d H:i:s'); + } + $query = "SELECT orders_status from " . TABLE_ORDERS . " WHERE orders_id = '".$incrementId."' "; + $order_qry = $db->Execute($query); + $orders_status_id = $order_qry->fields['orders_status']; + if($orders_status_id!= $orderState){ + $qry ="update ".TABLE_ORDERS." set orders_status = '$orderState', last_modified = now() where orders_id = '".$incrementId."' "; + $random_query = $db->Execute($qry); + // if ($num_rows > 1){ + ### INSERT HISTORY RECORDS ### + $customer_notified = '1'; + $new_status_qry = $db->Execute("INSERT INTO ".TABLE_ORDERS_STATUS_HISTORY." (orders_id, orders_status_id, date_added, customer_notified, comments) VALUES (".$incrementId.", ".$orderState.", NOW(), '".$customer_notified."', '".$comments."')"); + + // }else{ + // $emailBody .= 'Updating database table ('.TABLE_ORDERS.') failed;'; + // //$emailBody .= 'Reason: '.$e->getMessage().$lineBreak.$lineBreak; + // $emailBody .= 'Query : '.$qry.$lineBreak.$lineBreak; + // return false; + // } + } + else{ + $emailBody .= 'Updating database table ('.TABLE_ORDERS.') failed;'; + return false; + } + } else { + $emailBody .= "Novalnet Callback: No order for Increment-ID $incrementId found."; + return false; + } + $emailBody .= "succeeded."; + + return true; +} + +function checkIP($_REQUEST) { + global $lineBreak, $ipAllowed, $test, $emailBody; + if ($test) { + $ipAllowed = getRealIpAddr(); + } + $callerIp = $_SERVER['REMOTE_ADDR']; + if ($ipAllowed != $callerIp) { + $emailBody .= 'Unauthorised access from the IP [' . $callerIp . ']' . $lineBreak . $lineBreak; + $emailBody .= 'Request Params: ' . print_r($_REQUEST, true); + return false; + } + return true; +} + +function isPublicIP($value) { + if (!$value || count(explode('.', $value)) != 4) + return false; + return !preg_match('~^((0|10|172\.16|192\.168|169\.254|255|127\.0)\.)~', $value); +} + +function getRealIpAddr() { + if (isPublicIP($_SERVER['HTTP_X_FORWARDED_FOR'])) + return $_SERVER['HTTP_X_FORWARDED_FOR']; + if ($iplist = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR'])) { + if (isPublicIP($iplist[0])) + return $iplist[0]; + } + if (isPublicIP($_SERVER['HTTP_CLIENT_IP'])) + return $_SERVER['HTTP_CLIENT_IP']; + if (isPublicIP($_SERVER['HTTP_X_CLUSTER_CLIENT_IP'])) + return $_SERVER['HTTP_X_CLUSTER_CLIENT_IP']; + if (isPublicIP($_SERVER['HTTP_FORWARDED_FOR'])) + return $_SERVER['HTTP_FORWARDED_FOR']; + return $_SERVER['REMOTE_ADDR']; +} +include ('includes/application_bottom.php'); +?> diff --git a/includes/languages/english/modules/payment/novalnet_cc.php b/includes/languages/english/modules/payment/novalnet_cc.php new file mode 100644 index 0000000..16db8b1 --- /dev/null +++ b/includes/languages/english/modules/payment/novalnet_cc.php @@ -0,0 +1,43 @@ +Credit Card Visa & Mastercard'); + define('MODULE_PAYMENT_NOVALNET_CC_TEXT_DESCRIPTION', 'Pay safe and easy through Novalnet AG
Before activating please enter the required Novalnet IDs in Edit mode!'); + define('MODULE_PAYMENT_NOVALNET_CC_TEXT_LANG', 'EN'); + define('MODULE_PAYMENT_NOVALNET_CC_TEXT_INFO', ''); + + define('MODULE_PAYMENT_NOVALNET_CC_TEXT_PUBLIC_TITLE', 'Credit Card Visa & Mastercard'); + + define('MODULE_PAYMENT_NOVALNET_CC_IN_TEST_MODE', ' (in Testing mode)'); + define('MODULE_PAYMENT_NOVALNET_CC_NOT_CONFIGURED', ' (Not Configured)'); + define('MODULE_PAYMENT_NOVALNET_CC_GUEST_USER', 'Guest'); + + + define('MODULE_PAYMENT_NOVALNET_CC_TEXT_JS_NN_MISSING', '* Basic Parameter Missing!'); + define('MODULE_PAYMENT_NOVALNET_CC_TEXT_JS_NN_ID2_MISSING', '* Product-ID2 and/or Tariff-ID2 missing!'); + define('MODULE_PAYMENT_NOVALNET_CC_TEXT_ERROR', 'Credit card data Error:'); + define('MODULE_PAYMENT_NOVALNET_CC_TEXT_ORDERNO', 'Order No..: '); + define('MODULE_PAYMENT_NOVALNET_CC_TEXT_ORDERDATE', 'Best-date: '); + define('MODULE_PAYMENT_NOVALNET_CC_TEST_MODE', 'Test mode'); + define('MODULE_PAYMENT_NOVALNET_CC_TEST_ORDER_MESSAGE',"Test Order"); + define('MODULE_PAYMENT_NOVALNET_CC_TID_MESSAGE',"Novalnet Transaction ID : "); + define('MODULE_PAYMENT_NOVALNET_CC_AMOUNT_VARIATION_MESSAGE',"You have changed the cart amount after getting PIN number, please try again with new call"); + define('MODULE_PAYMENT_NOVALNET_CC_CURL_MESSAGE',"* You have to enable the CURL function on server, please check with your hosting provider about it!"); + define('MODULE_PAYMENT_NOVALNET_INFORMATION_PAYMENT_CC', "The amount will be booked immediatley from your credit card when you submit the order."); +?> diff --git a/includes/languages/english/modules/payment/novalnet_cc3d.php b/includes/languages/english/modules/payment/novalnet_cc3d.php new file mode 100644 index 0000000..ca496ce --- /dev/null +++ b/includes/languages/english/modules/payment/novalnet_cc3d.php @@ -0,0 +1,62 @@ +Credit Card 3D Secure Visa & Mastercard'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_DESCRIPTION', 'Pay safe and easy through Novalnet AG
Before activating please enter the required Novalnet IDs in Edit mode!'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_LANG', 'EN'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_INFO', ''); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_PUBLIC_TITLE', 'Credit Card 3D Secure Visa & Mastercard'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_CARD_OWNER', 'Credit card holder:'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_CARD_OWNER_LENGTH', '3'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_CC_NO', 'Card number:'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_CC_NO_LENGTH', '12'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_EXP_MONTH', 'Month :'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_EXP_MONTH_LENGTH', '2'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_EXP_YEAR', 'Year :'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_EXP_YEAR_LENGTH', '2'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_EXP_MONTHS_YEARS', 'Expiration Date :'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_SELECT', 'Please select'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_CVC', 'CVC (Verification Code): '); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_CVC_LENGTH', '3'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_CVC2', '
* On Visa-, Master- and Eurocard you will find the 3 digit CVC-Code
near the signature field at the rearside of the creditcard.'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_BOOKING_INFO', 'The amount will be booked immediatley from your credit card when you submit the order.'); + + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_JS_NN_ID2_MISSING', '* Product-ID2 and/or Tariff-ID2 missing!'); + define('MODULE_PAYMENT_NOVALNET_CC3D_IN_TEST_MODE', ' (in Testing mode)'); + define('MODULE_PAYMENT_NOVALNET_CC3D_NOT_CONFIGURED', ' (Not Configured)'); + define('MODULE_PAYMENT_NOVALNET_CC3D_GUEST_USER', 'Guest'); + + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_JS_NN_MISSING', '* Basic Parameter Missing!'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_JS_CARD_OWNER', '* Please enter valid credit card details!'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_JS_CC_NO', '* Please enter valid credit card details!'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_JS_EXP_MONTH', '* Please enter valid credit card details!'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_JS_EXP_YEAR', '* Please enter valid credit card details!'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_JS_CVC', '* Please enter valid credit card details!'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_ERROR_EXP_MONTH', '* Please enter valid credit card details!'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_ERROR_EXP_YEAR', '* Please enter valid credit card details!'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_JS_CVC2', '* Please enter valid credit card details!'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_ERROR', 'Credit card data Error:'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_ORDERNO', 'Order no. '); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_ORDERDATE', 'Order date '); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEST_MODE', 'Test Mode'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEST_ORDER_MESSAGE',"Test Order"); + define('MODULE_PAYMENT_NOVALNET_CC3D_TID_MESSAGE',"Novalnet Transaction ID : "); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_JS_CC_NO_ERR', '* Please enter valid credit card details!'); + define('MODULE_PAYMENT_NOVALNET_CC3D_CURL_MESSAGE',"* You have to enable the CURL function on server, please check with your hosting provider about it!"); +?> diff --git a/includes/languages/english/modules/payment/novalnet_cc_pci.php b/includes/languages/english/modules/payment/novalnet_cc_pci.php new file mode 100644 index 0000000..888b38f --- /dev/null +++ b/includes/languages/english/modules/payment/novalnet_cc_pci.php @@ -0,0 +1,43 @@ +Credit Card PCI Visa & Mastercard'); + define('MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_DESCRIPTION', 'Pay safe and easy through Novalnet AG
Before activating please enter the required Novalnet IDs in Edit mode!'); + define('MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_LANG', 'EN'); + define('MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_INFO', ''); + + define('MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_PUBLIC_TITLE', 'Credit Card PCI Visa & Mastercard'); + define('MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_BOOKING_INFO', '

The amount will be booked immediatley from your credit card
with $BOOKINFO note.'); + + define('MODULE_PAYMENT_NOVALNET_CC_PCI_IN_TEST_MODE', ' (in Testing mode)'); + define('MODULE_PAYMENT_NOVALNET_CC_PCI_NOT_CONFIGURED', ' (Not Configured)'); + define('MODULE_PAYMENT_NOVALNET_CC_PCI_GUEST_USER', 'Guest'); + + define('MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_JS_NN_ID2_MISSING', '* Product-ID2 and/or Tariff-ID2 missing!'); + define('MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_JS_NN_MISSING', '* Basic Parameter Missing!'); + define('MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_ERROR', 'Credit card data Error:'); + define('MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_ORDERNO', 'Order no. '); + define('MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_ORDERDATE', 'Order date '); + define('MODULE_PAYMENT_NOVALNET_CC_PCI_TEST_MODE', 'Test Mode'); + define('MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_HASH_ERROR', 'checkHash failed'); + define('MODULE_PAYMENT_NOVALNET_CC_PCI_TEST_ORDER_MESSAGE',"Test Order"); + define('MODULE_PAYMENT_NOVALNET_CC_PCI_TID_MESSAGE',"Novalnet Transaction ID : "); + define('MODULE_PAYMENT_NOVALNET_CC_PCI_CURL_MESSAGE',"* You have to enable the CURL function on server, please check with your hosting provider about it!"); + define('MODULE_PAYMENT_NOVALNET_INFORMATION_PAYMENT_CC_PCI', 'You will be redirected to Novalnet AG website when you place the order.'); + +?> diff --git a/includes/languages/english/modules/payment/novalnet_elv_at.php b/includes/languages/english/modules/payment/novalnet_elv_at.php new file mode 100644 index 0000000..7423d64 --- /dev/null +++ b/includes/languages/english/modules/payment/novalnet_elv_at.php @@ -0,0 +1,73 @@ +Direct Debit Austria Austrian direct debit'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_DESCRIPTION', 'Pay safe and easy through Novalnet AG
Before activating please enter the required Novalnet IDs in Edit mode'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_LANG', 'EN'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_INFO', ''); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_PUBLIC_TITLE', 'Direct Debit Austria Austrian direct debit'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_BANK_ACCOUNT_OWNER', 'Account holder:'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_BANK_ACCOUNT_OWNER_LENGTH', '3'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_BANK_ACCOUNT_NUMBER', 'Account number:'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_BANK_ACCOUNT_NUMBER_LENGTH', '5'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_BANK_CODE', 'Bankcode:'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_BANK_CODE_LENGTH', '3'); + + define('MODULE_PAYMENT_NOVALNET_ELV_AT_IN_TEST_MODE', ' (in Testing mode)'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_NOT_CONFIGURED', ' (Not Configured)'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_GUEST_USER', 'Guest'); + + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_JS_NN_ID2_MISSING', '* Product-ID2 and/or Tariff-ID2 missing!'); + + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_JS_NN_MISSING', '* Basic Parameter Missing!'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_JS_BANK_ACCOUNT_OWNER', '* Please enter valid account details!'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_JS_BANK_ACCOUNT_NUMBER', '* Please enter valid account details!'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_JS_BANK_CODE', '* Please enter valid account details!'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_ERROR', 'Account data Error:'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_CUST_INFORM', ''); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_ORDERNO', 'Order no. '); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_ORDERDATE', 'Order date '); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEST_MODE', 'Test Mode'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEST_ORDER_MESSAGE',"Test Order"); + + //Start : Pin by call back + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_TEL_REQ', 'Phone Number:*'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_SMS_REQ', 'Mobile Number:*'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_SMS_PIN', 'Enter your PIN Number:*'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_SMS_NEW_PIN', 'Forgot PIN? [New PIN Request]'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_SMS_TEL_NOTVALID', 'Please enter the Telephone / Mobilenumber!'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_SMS_PIN_NOTVALID', 'PIN you have entered is incorrect or empty!'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_SMS_CALL_MESSAGE', 'You will shortly receive a PIN via phone / SMS. Please enter the PIN in the appropriate text box.'); + + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_INPUT_REQUEST_DESC',"You will shortly receive a PIN by phone / SMS. Please enter the PIN in the appropriate text box."); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_SESSION_ERROR',"Your PIN session has expired. Please try again with a new call!"); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_EMAIL_REQ', 'Email Address:*'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_EMAIL_NOTVALID', 'Please enter the E-Mail Address!'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_EMAIL_INPUT_REQUEST_DESC',"We have sent a email, please answer"); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_AMOUNT_VARIATION_MESSAGE',"You have changed the order amount after getting PIN number, please try again with new call"); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_AMOUNT_VARIATION_MESSAGE_EMAIL',"You have changed the order amount after getting e-mail, please try again with a new call"); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_EMAIL_PHONE_INPUT_REQUEST_DESC',"* Please enter your phonenumber/email."); + //End : Pin by call back + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TID_MESSAGE'," Novalnet Transaction ID : "); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_CURL_MESSAGE',"* You have to enable the CURL function on server, please check with your hosting provider about it!"); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_JS_BANK_ERROR_ACCOUNT_NUMBER', '* Please enter valid account details!'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_JS_BANK_CODE_ERROR', '* Please enter valid account details!'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_MAX_TIME_ERROR', '*Maximum number of PIN entries exceeded!'); + define('MODULE_PAYMENT_NOVALNET_INFORMATION_PAYMENT_AT', 'Your account will be debited upon delivery of goods.'); + +?> diff --git a/includes/languages/english/modules/payment/novalnet_elv_at_pci.php b/includes/languages/english/modules/payment/novalnet_elv_at_pci.php new file mode 100644 index 0000000..1cddb22 --- /dev/null +++ b/includes/languages/english/modules/payment/novalnet_elv_at_pci.php @@ -0,0 +1,39 @@ +Direct Debit Austria PCI Austrian direct debit'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEXT_DESCRIPTION', 'Pay safe and easy through Novalnet AG
Before activating please enter the required Novalnet IDs in Edit mode'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEXT_LANG', 'EN'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEXT_INFO', ''); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEXT_PUBLIC_TITLE', 'Direct Debit Austria PCI Austrian direct debit'); + define('MODULE_PAYMENT_NOVALNET_AT_PCI_IN_TEST_MODE', ' (in Testing mode)'); + define('MODULE_PAYMENT_NOVALNET_AT_PCI_NOT_CONFIGURED', ' (Not Configured)'); + define('MODULE_PAYMENT_NOVALNET_AT_PCI_GUEST_USER', 'Guest'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEXT_JS_NN_ID2_MISSING', '* Product-ID2 and/or Tariff-ID2 missing!'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEXT_JS_NN_MISSING', '* Basic Parameter Missing!'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEXT_ERROR', 'Account data Error:'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEXT_CUST_INFORM', ''); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEXT_ORDERNO', 'Order no. '); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEXT_ORDERDATE', 'Order date '); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEST_MODE', 'Test Mode'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEXT_HASH_ERROR', 'checkHash failed'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEST_ORDER_MESSAGE',"Test Order"); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TID_MESSAGE',"Novalnet Transaction ID : "); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_CURL_MESSAGE',"* You have to enable the CURL function on server, please check with your hosting provider about it!"); + define('MODULE_PAYMENT_NOVALNET_INFORMATION_PAYMENT_AT_PCI', 'You will be redirected to Novalnet AG website when you place the order.'); + +?> diff --git a/includes/languages/english/modules/payment/novalnet_elv_de.php b/includes/languages/english/modules/payment/novalnet_elv_de.php new file mode 100644 index 0000000..9203041 --- /dev/null +++ b/includes/languages/english/modules/payment/novalnet_elv_de.php @@ -0,0 +1,76 @@ +Direct Debit German German direct debit'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_DESCRIPTION', 'Pay safe and easy through Novalnet AG
Before activating please enter the required Novalnet IDs in Edit mode!'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_LANG', 'EN'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_INFO', ''); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_PUBLIC_TITLE', 'Direct Debit German German direct debit'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_BANK_ACCOUNT_OWNER', 'Account holder:*'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_BANK_ACCOUNT_OWNER_LENGTH', '3'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_BANK_ACCOUNT_NUMBER', 'Account number:*'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_BANK_ACCOUNT_NUMBER_LENGTH', '5'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_BANK_CODE', 'Bankcode:*'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_BANK_CODE_LENGTH', '3'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_ACDC_INFO', "The ACDC-Check Accepted"); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_ACDC_DIV', ""); + + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_JS_NN_ID2_MISSING', '* Product-ID2 and/or Tariff-ID2 missing!'); + + define('MODULE_PAYMENT_NOVALNET_ELV_DE_IN_TEST_MODE', ' (in Testing mode)'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_NOT_CONFIGURED', ' (Not Configured)'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_GUEST_USER', 'Guest'); + + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_JS_NN_MISSING', '* Basic Parameter Missing!'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_JS_BANK_ACCOUNT_OWNER', '* Please enter valid account details!'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_JS_BANK_ACCOUNT_NUMBER', '* Please enter valid account details!'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_JS_BANK_CODE', '* Please enter valid account details!'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_JS_ACDC', '*Please enable ACDC Check!'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_JS_ACDC', '*Please enable ACDC Check!'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_ERROR', 'Account data Error:'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_CUST_INFORM', '"First of all we carry out a credit check, only after this check has returned a positive result will the order be processed. The goods can be shipped after debiting. In cases of non-payment / cancellation we will charge an administration fee of 10.00 € (Ten) and the case is then immediately transferred to the debt collection process."'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_ORDERNO', 'Order no.: '); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_ORDERDATE', 'Order date: '); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEST_MODE', 'Test Mode'); + //Start : Pin by call back + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_TEL_REQ', 'Phone Number:*'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_SMS_REQ', 'Mobile Number:*'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_SMS_PIN', 'Enter your PIN Number:*'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_SMS_NEW_PIN', 'Forgot PIN? [New PIN Request]'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_SMS_TEL_NOTVALID', 'Please enter the Telephone / Mobilenumber!'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_SMS_PIN_NOTVALID', 'PIN you have entered is incorrect or empty!'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_SMS_CALL_MESSAGE', 'You will shortly receive a PIN via phone / SMS. Please enter the PIN in the appropriate text box.'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_MIN_LIMIT_TITLE', 'Minimum Amount Limit for PIN by Callback'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_MIN_LIMIT_DESC', 'Please enter minimum amount limit to enable "Pin by CallBack" modul (In Cents, e.g. 100,200)'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_INPUT_REQUEST_DESC',"You will shortly receive a PIN by phone / SMS. Please enter the PIN in the appropriate text box."); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_SESSION_ERROR',"Your PIN session has expired. Please try again with a new call"); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_EMAIL_REQ', 'Email Address:*'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_EMAIL_NOTVALID', 'Please enter the E-Mail Address!'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_EMAIL_INPUT_REQUEST_DESC',"We have sent a email, please answer"); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_AMOUNT_VARIATION_MESSAGE',"You have changed the cart amount after getting PIN number, please try again with new call"); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_AMOUNT_VARIATION_MESSAGE_EMAIL',"You have changed the order amount after getting e-mail, please try again with a new call"); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_EMAIL_PHONE_INPUT_REQUEST_DESC',"* Please enter your phonenumber/email."); + //End : Pin by call back + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TID_MESSAGE'," Novalnet Transaction ID : "); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEST_ORDER_MESSAGE',"Test Order"); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_CURL_MESSAGE',"* You have to enable the CURL function on server, please check with your hosting provider about it!"); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_JS_BANK_ERROR_ACCOUNT_NUMBER', '* Please enter valid account details!'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_JS_BANK_CODE_ERROR', '* Please enter valid account details!'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_MAX_TIME_ERROR', '*Maximum number of PIN entries exceeded!'); + define('MODULE_PAYMENT_NOVALNET_INFORMATION_PAYMENT_DE', 'Your account will be debited upon delivery of goods.'); + +?> diff --git a/includes/languages/english/modules/payment/novalnet_elv_de_pci.php b/includes/languages/english/modules/payment/novalnet_elv_de_pci.php new file mode 100644 index 0000000..5e5c5b9 --- /dev/null +++ b/includes/languages/english/modules/payment/novalnet_elv_de_pci.php @@ -0,0 +1,43 @@ +Direct Debit German PCI German direct debit'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEXT_DESCRIPTION', 'Pay safe and easy through Novalnet AG
Before activating please enter the required Novalnet IDs in Edit mode!'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEXT_LANG', 'EN'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEXT_INFO', ''); + + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEXT_PUBLIC_TITLE', 'Direct Debit German PCI German direct debit'); + + define('MODULE_PAYMENT_NOVALNET_DE_PCI_IN_TEST_MODE', ' (in Testing mode)'); + define('MODULE_PAYMENT_NOVALNET_DE_PCI_NOT_CONFIGURED', ' (Not Configured)'); + define('MODULE_PAYMENT_NOVALNET_DE_PCI_GUEST_USER', 'Guest'); + + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEXT_JS_NN_ID2_MISSING', '* Product-ID2 and/or Tariff-ID2 missing!'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEXT_JS_NN_MISSING', '* Basic Parameter Missing!'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEXT_ERROR', 'Account data Error:'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEXT_CUST_INFORM', ''); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEXT_ORDERNO', 'Order no. '); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEXT_ORDERDATE', 'Order date '); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEST_MODE', 'Test Mode'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEXT_HASH_ERROR', 'checkHash failed'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEST_ORDER_MESSAGE',"Test Order"); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TID_MESSAGE',"Novalnet Transaction ID : "); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_CURL_MESSAGE',"* You have to enable the CURL function on server, please check with your hosting provider about it!"); + define('MODULE_PAYMENT_NOVALNET_INFORMATION_PAYMENT_DE_PCI', 'You will be redirected to Novalnet AG website when you place the order.'); + +?> diff --git a/includes/languages/english/modules/payment/novalnet_ideal.php b/includes/languages/english/modules/payment/novalnet_ideal.php new file mode 100644 index 0000000..9b9b5b8 --- /dev/null +++ b/includes/languages/english/modules/payment/novalnet_ideal.php @@ -0,0 +1,40 @@ +iDEAL iDEAL'); + define('MODULE_PAYMENT_NOVALNET_IDEAL_TEXT_DESCRIPTION', 'Pay safe and easy through Novalnet AG
Before activating please enter the required Novalnet IDs in Edit mode!'); + define('MODULE_PAYMENT_NOVALNET_IDEAL_TEXT_LANG', 'EN'); + define('MODULE_PAYMENT_NOVALNET_IDEAL_TEXT_INFO', ''); + define('MODULE_PAYMENT_NOVALNET_IDEAL_TEXT_PUBLIC_TITLE', 'iDEAL iDEAL'); + + define('MODULE_PAYMENT_NOVALNET_IDEAL_IN_TEST_MODE', ' (in Testing mode)'); + define('MODULE_PAYMENT_NOVALNET_IDEAL_NOT_CONFIGURED', ' (Not Configured)'); + define('MODULE_PAYMENT_NOVALNET_IDEAL_GUEST_USER', 'Guest'); + + define('MODULE_PAYMENT_NOVALNET_IDEAL_TEXT_JS_NN_MISSING', '* Basic Parameter Missing!'); + define('MODULE_PAYMENT_NOVALNET_IDEAL_TEXT_ERROR', 'Account data Error:'); + define('MODULE_PAYMENT_NOVALNET_IDEAL_TEXT_CUST_INFORM', ''); + define('MODULE_PAYMENT_NOVALNET_IDEAL_TEXT_ORDERNO', 'Order no. '); + define('MODULE_PAYMENT_NOVALNET_IDEAL_TEXT_ORDERDATE', 'Order date '); + define('MODULE_PAYMENT_NOVALNET_IDEAL_TEST_MODE', 'Test Mode'); + define('MODULE_PAYMENT_NOVALNET_IDEAL_TEXT_HASH_ERROR', 'checkHash failed'); + define('MODULE_PAYMENT_NOVALNET_IDEAL_TEST_ORDER_MESSAGE',"Test Order"); + define('MODULE_PAYMENT_NOVALNET_IDEAL_TID_MESSAGE',"Novalnet Transaction ID : "); + define('MODULE_PAYMENT_NOVALNET_IDEAL_CURL_MESSAGE',"* You have to enable the CURL function on server, please check with your hosting provider about it!"); + define('MODULE_PAYMENT_NOVALNET_INFORMATION_PAYMENT_IDEAL', 'You will be redirected to Novalnet AG website when you place the order.'); +?> diff --git a/includes/languages/english/modules/payment/novalnet_instantbanktransfer.php b/includes/languages/english/modules/payment/novalnet_instantbanktransfer.php new file mode 100644 index 0000000..6678ee4 --- /dev/null +++ b/includes/languages/english/modules/payment/novalnet_instantbanktransfer.php @@ -0,0 +1,41 @@ +Instant Bank Transfer Instant Bank Transfer'); + define('MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEXT_DESCRIPTION', 'Pay safe and easy through Novalnet AG
Before activating please enter the required Novalnet IDs in Edit mode!'); + define('MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEXT_LANG', 'EN'); + define('MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEXT_INFO', ''); + define('MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEXT_PUBLIC_TITLE', 'Instant Bank Transfer Instant Bank Transfer'); + + define('MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_IN_TEST_MODE', ' (in Testing mode)'); + define('MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_NOT_CONFIGURED', ' (Not Configured)'); + define('MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_GUEST_USER', 'Guest'); + + define('MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEXT_JS_NN_MISSING', '* Basic Parameter Missing!'); + define('MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEXT_ERROR', 'Account data Error:'); + define('MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEXT_CUST_INFORM', ''); + define('MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEXT_ORDERNO', 'Order no. '); + define('MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEXT_ORDERDATE', 'Order date '); + define('MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEST_MODE', 'Test Mode'); + define('MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEXT_HASH_ERROR', 'checkHash failed'); + define('MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEST_ORDER_MESSAGE',"Test Order"); + define('MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TID_MESSAGE',"Novalnet Transaction ID : "); + define('MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_CURL_MESSAGE',"* You have to enable the CURL function on server, please check with your hosting provider about it!"); + define('MODULE_PAYMENT_NOVALNET_INFORMATION_PAYMENT_INSTANT', 'You will be redirected to Novalnet AG website when you place the order.'); +?> diff --git a/includes/languages/english/modules/payment/novalnet_invoice.php b/includes/languages/english/modules/payment/novalnet_invoice.php new file mode 100644 index 0000000..c7e6bd6 --- /dev/null +++ b/includes/languages/english/modules/payment/novalnet_invoice.php @@ -0,0 +1,71 @@ +Before activating please enter the required Novalnet IDs in Edit mode!'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_LANG', 'EN'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_INFO', ''); + define('MODULE_PAYMENT_NOVALNET_INVOICE_INVOICE_TEST_MODE', ' (in Testing mode)'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_NOT_CONFIGURED', ' (Not Configured)'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_GUEST_USER', 'Guest'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_PUBLIC_TITLE', 'Invoice'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_BANK_ACCOUNT_OWNER', 'Account holder :'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_BANK_ACCOUNT_NUMBER', 'Account number :'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_BANK_CODE', 'Bankcode :'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_BANK_IBAN', 'IBAN :'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_BANK_BIC', 'SWIFT / BIC :'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_BANK_BANK', 'Bank :'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_BANK_CITY', 'City :'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_REFERENCE', 'Reference : TID'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_REFERENCE_INFO', 'Please note that the Transfer can only be identified with the above mentioned Reference.'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_AMOUNT', 'Amount :'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_TRANSFER_INFO', 'Please transfer the amount to the following information to our payment service Novalnet AG'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_BANK_INFO', 'The bank details will be emailed to you soon after the completion of checkout process.'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_DURATION_INFO', 'Payment duration:'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_DURATION_INFO_DAYS', 'days'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_DURATION_LIMIT_INFO', 'Please transfer the amount to the following information to our payment service Novalnet AG'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_DURATION_LIMIT_END_INFO', 'Due date :'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_JS_NN_MISSING', '* Basic Parameter Missing!'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_ORDERNO', 'Order no. '); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_ORDERDATE', 'Order date '); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEST_MODE', 'Test Mode'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_ERROR', 'Account data Error:'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_TEL_REQ', 'Phone Number:*'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_SMS_REQ', 'Mobile phone number:*'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_SMS_PIN', 'Enter your PIN Number:*'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_SMS_NEW_PIN', 'Forgot PIN? [New PIN Request]'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_SMS_TEL_NOTVALID', 'Please enter the Telephone / Mobilenumber!'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_SMS_PIN_NOTVALID', 'PIN you have entered is incorrect or empty!'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_SMS_CALL_MESSAGE', 'You will shortly receive a PIN via phone / SMS. Please enter the PIN in the appropriate text box.'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_PIN_INPUT_REQUEST_DESC',"You will shortly receive a PIN by phone / SMS. Please enter the PIN in the appropriate text box."); + define('MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_SESSION_ERROR',"Your PIN session has expired. Please try again with a new call"); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEST_ORDER_MESSAGE',"Test Order"); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TID_MESSAGE',"Novalnet Transaction ID : "); + define('MODULE_PAYMENT_NOVALNET_INVOICE_AMOUNT_VARIATION_MESSAGE',"You have changed the cart amount after getting PIN number, please try again with new call"); + define('MODULE_PAYMENT_NOVALNET_INVOICE_AMOUNT_VARIATION_MESSAGE_EMAIL',"You have changed the order amount after getting e-mail, please try again with a new call"); + define('MODULE_PAYMENT_NOVALNET_INVOICE_EMAIL_PHONE_INPUT_REQUEST_DESC',"* Please enter your phonenumber/email."); + define('MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_EMAIL_REQ', 'Email Address:*'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_EMAIL_NOTVALID', 'Please enter the E-Mail Address!'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_EMAIL_INPUT_REQUEST_DESC',"We have sent a email, please answer"); + define('MODULE_PAYMENT_NOVALNET_INVOICE_CURL_MESSAGE',"* You have to enable the CURL function on server, please check with your hosting provider about it!"); + define('MODULE_PAYMENT_NOVALNET_INVOICE_MAX_TIME_ERROR', '*Maximum number of PIN entries exceeded!'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_NAME', 'NOVALNET AG'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_PAYMNETNAME', 'Novalnet Invoice'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TID', 'TID :'); + define('MODULE_PAYMENT_NOVALNET_TEXT_DETAILS_INVOICE_INTERNATIONAL_INFO', 'Only for international transfers:'); +?> diff --git a/includes/languages/english/modules/payment/novalnet_paypal.php b/includes/languages/english/modules/payment/novalnet_paypal.php new file mode 100644 index 0000000..c3cb6f3 --- /dev/null +++ b/includes/languages/english/modules/payment/novalnet_paypal.php @@ -0,0 +1,39 @@ +PayPal'); + define('MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_DESCRIPTION', 'Pay safe and easy through Novalnet AG
Before activating please enter the required Novalnet IDs in Edit mode!
You must have an Paypal Trader Account in order to use this module.'); + define('MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_LANG', 'EN'); + define('MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_INFO', ''); + define('MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_PUBLIC_TITLE', 'PayPal PayPal'); + define('MODULE_PAYMENT_NOVALNET_PAYPAL_IN_TEST_MODE', ' (in Testing mode)'); + define('MODULE_PAYMENT_NOVALNET_PAYPAL_NOT_CONFIGURED', ' (Not Configured)'); + define('MODULE_PAYMENT_NOVALNET_PAYPAL_GUEST_USER', 'Guest'); + define('MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_JS_NN_MISSING', '* Basic Parameter Missing!'); + define('MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_ERROR', 'Account data Error:'); + define('MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_CUST_INFORM', ''); + define('MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_ORDERNO', 'Order no. '); + define('MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_ORDERDATE', 'Order date '); + define('MODULE_PAYMENT_NOVALNET_PAYPAL_TEST_MODE', 'Test Mode'); + define('MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_HASH_ERROR', 'checkHash failed'); + define('MODULE_PAYMENT_NOVALNET_PAYPAL_TEST_ORDER_MESSAGE',"Test Order"); + define('MODULE_PAYMENT_NOVALNET_PAYPAL_TID_MESSAGE'," Novalnet Transaction ID : "); + define('MODULE_PAYMENT_NOVALNET_PAYPAL_CURL_MESSAGE',"* You have to enable the CURL function on server, please check with your hosting provider about it!"); + define('MODULE_PAYMENT_NOVALNET_INFORMATION_PAYMENT_PAYPAL', 'You will be redirected to Novalnet AG website when you place the order.'); + +?> diff --git a/includes/languages/english/modules/payment/novalnet_prepayment.php b/includes/languages/english/modules/payment/novalnet_prepayment.php new file mode 100644 index 0000000..a85148f --- /dev/null +++ b/includes/languages/english/modules/payment/novalnet_prepayment.php @@ -0,0 +1,55 @@ +Before activating please enter the required Novalnet IDs in Edit mode!'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_LANG', 'EN'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_INFO', ''); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_PUBLIC_TITLE', 'Prepayment'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_BANK_ACCOUNT_OWNER', 'Account holder :'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_BANK_ACCOUNT_NUMBER', 'Account number :'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_BANK_CODE', 'Bankcode :'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_BANK_IBAN', 'IBAN :'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_BANK_BIC', 'SWIFT / BIC :'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_BANK_BANK', 'Bank :'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_BANK_CITY', 'City :'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_REFERENCE', 'Reference : TID'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_REFERENCE_INFO', 'Please note that the Transfer can only be identified with the above mentioned Reference.'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_AMOUNT', 'Amount :'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_TRANSFER_INFO', 'Please transfer the amount to the following information to our payment service Novalnet AG'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_IN_TEST_MODE', ' (in Testing mode)'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_NOT_CONFIGURED', ' (Not Configured)'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_GUEST_USER', 'Guest'); + + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_BANK_INFO', 'The bank details will be emailed to you soon after the completion of checkout process.'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_JS_NN_MISSING', '* Basic Parameter Missing!'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_ORDERNO', 'Order no. '); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_ORDERDATE', 'Order date '); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEST_MODE', 'Test Mode'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEST_ORDER_MESSAGE',"Test Order"); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TID_MESSAGE',"Novalnet Transaction ID : "); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_ERROR', 'Account data Error:'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_CURL_MESSAGE',"* You have to enable the CURL function on server, please check with your hosting provider about it!"); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_NAME', 'NOVALNET AG'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_PAYMNETNAME', 'Novalnet Prepayment'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TID', 'TID :'); + define('MODULE_PAYMENT_NOVALNET_TEXT_DETAILS_PREPAYMENT_INTERNATIONAL_INFO', 'Only for international transfers:'); + + +?> diff --git a/includes/languages/english/modules/payment/novalnet_tel.php b/includes/languages/english/modules/payment/novalnet_tel.php new file mode 100644 index 0000000..e173507 --- /dev/null +++ b/includes/languages/english/modules/payment/novalnet_tel.php @@ -0,0 +1,49 @@ +Novalnet Telephone Payment - Pay by callTelephone Payment'); + define('MODULE_PAYMENT_NOVALNET_TEL_TEXT_DESCRIPTION', 'Pay safe and easy through Novalnet AG
Before activating please enter the required Novalnet IDs in Edit mode'); + define('MODULE_PAYMENT_NOVALNET_TEL_TEXT_LANG', 'EN'); + define('MODULE_PAYMENT_NOVALNET_TEL_TEXT_INFO', ''); + + define('MODULE_PAYMENT_NOVALNET_TEL_IN_TEST_MODE', ' (in Testing mode)'); + define('MODULE_PAYMENT_NOVALNET_TEL_NOT_CONFIGURED', ' (Not Configured)'); + define('MODULE_PAYMENT_NOVALNET_TEL_GUEST_USER', 'Guest'); + + define('MODULE_PAYMENT_NOVALNET_TEL_TEXT_PUBLIC_TITLE', 'Telephone PaymentTelephone Payment'); + define('MODULE_PAYMENT_NOVALNET_TEL_TEXT_STEP_INFO', 'Following steps are required to complete the telephone payment process:'); + define('MODULE_PAYMENT_NOVALNET_TEL_TEXT_STEP1', 'Step 1:'); + define('MODULE_PAYMENT_NOVALNET_TEL_TEXT_STEP2', 'Step 2:'); + define('MODULE_PAYMENT_NOVALNET_TEL_TEXT_STEP1_DESC', 'Please dial the following number:'); + define('MODULE_PAYMENT_NOVALNET_TEL_TEXT_STEP2_DESC', 'Please wait for the Signal ton and hangup the reciever.
Please click on continue after your successive call.'); + define('MODULE_PAYMENT_NOVALNET_TEL_TEXT_COST_INFO', '* This call costs '); + define('MODULE_PAYMENT_NOVALNET_TEL_TEXT_TAX_INFO', '€ (inclusive tax) and is only possible from German Landline Telefon connection! *'); + define('MODULE_PAYMENT_NOVALNET_TEL_TEXT_AMOUNT_ERROR1', 'Amount below 0.90 Euro and above 10.00 Euro is not accepted!'); + define('MODULE_PAYMENT_NOVALNET_TEL_TEXT_AMOUNT_ERROR2', 'Amount below 0.90 Euro is not accepted!'); + define('MODULE_PAYMENT_NOVALNET_TEL_TEXT_ERROR', 'Telephone Payment not possible!'); + define('MODULE_PAYMENT_NOVALNET_TEL_TEXT_JS_NN_MISSING', '* Basic Paramater Missing!'); + define('MODULE_PAYMENT_NOVALNET_TEL_TEXT_ORDERNO', 'Order no. '); + define('MODULE_PAYMENT_NOVALNET_TEL_TEXT_ORDERDATE', 'Order date '); + define('MODULE_PAYMENT_NOVALNET_TEL_TEST_MODE', 'Test Mode'); + define('MODULE_PAYMENT_NOVALNET_TEL_TEST_ORDER_MESSAGE'," TESTORDER
"); + define('MODULE_PAYMENT_NOVALNET_TEL_CURL_MESSAGE',"* You have to enable the CURL function on server, please check with your hosting provider about it!"); + +?> diff --git a/includes/languages/german/modules/payment/novalnet_cc.php b/includes/languages/german/modules/payment/novalnet_cc.php new file mode 100644 index 0000000..cb55300 --- /dev/null +++ b/includes/languages/german/modules/payment/novalnet_cc.php @@ -0,0 +1,39 @@ +Kreditkarte Visa & Mastercard'); + define('MODULE_PAYMENT_NOVALNET_CC_TEXT_DESCRIPTION', 'Schnell und Sicher bezahlen über Novalnet AG
Bitte vor aktivierung alle noetige IDs in Bearbeitungmodus eingeben!'); + define('MODULE_PAYMENT_NOVALNET_CC_TEXT_LANG', 'DE'); + define('MODULE_PAYMENT_NOVALNET_CC_TEXT_INFO', ''); + define('MODULE_PAYMENT_NOVALNET_CC_TEXT_PUBLIC_TITLE', 'Kreditkarte Visa & Mastercard'); + define('MODULE_PAYMENT_NOVALNET_CC_TEXT_JS_NN_ID2_MISSING', '* Produkt-ID2 und / oder Tarif-ID2 fehlen!'); + define('MODULE_PAYMENT_NOVALNET_CC_TEXT_JS_NN_MISSING', '* Grundlegende Parameter fehlt!'); + define('MODULE_PAYMENT_NOVALNET_CC_TEXT_ERROR', 'Kartendaten Fehler:'); + define('MODULE_PAYMENT_NOVALNET_CC_TEXT_ORDERNO', 'Best.-Nr.: '); + define('MODULE_PAYMENT_NOVALNET_CC_TEXT_ORDERDATE', 'Best.-Datum: '); + define('MODULE_PAYMENT_NOVALNET_CC_TEST_MODE', 'Testmodus'); + define('MODULE_PAYMENT_NOVALNET_CC_IN_TEST_MODE', ' (im Testbetrieb)'); + define('MODULE_PAYMENT_NOVALNET_CC_NOT_CONFIGURED', ' (Nicht konfiguriert)'); + define('MODULE_PAYMENT_NOVALNET_CC_GUEST_USER', 'Gast'); + define('MODULE_PAYMENT_NOVALNET_CC_TEST_ORDER_MESSAGE',"Testbestellung"); + define('MODULE_PAYMENT_NOVALNET_CC_TID_MESSAGE',"Novalnet Transaktions ID: "); + define('MODULE_PAYMENT_NOVALNET_CC_TEXT_HASH_ERROR', 'checkHash fehlgeschlagen'); + define('MODULE_PAYMENT_NOVALNET_CC_CURL_MESSAGE',"* Sie müssen die CURL-Funktion auf Server aktivieren, überprüfen Sie bitte mit Ihrem Hosting-Provider darüber!"); + define('MODULE_PAYMENT_NOVALNET_INFORMATION_PAYMENT_CC', 'Die Belastung Ihrer Kreditkarte erfolgt mit dem Abschluss der Bestellung.'); + +?> diff --git a/includes/languages/german/modules/payment/novalnet_cc3d.php b/includes/languages/german/modules/payment/novalnet_cc3d.php new file mode 100644 index 0000000..475659f --- /dev/null +++ b/includes/languages/german/modules/payment/novalnet_cc3d.php @@ -0,0 +1,59 @@ +Kreditkarte 3D Secure Visa & Mastercard'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_DESCRIPTION', 'Schnell und Sicher bezahlen über Novalnet AG
Bitte vor aktivierung alle noetige IDs in Bearbeitungmodus eingeben!'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_LANG', 'DE'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_INFO', ''); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_PUBLIC_TITLE', 'Kreditkarte 3D Secure Visa & Mastercard'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_CARD_OWNER', 'Kreditkarteninhaber:'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_CARD_OWNER_LENGTH', '3'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_CC_NO', 'Kartennummer:'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_CC_NO_LENGTH', '12'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_EXP_MONTH', 'Monat :'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_EXP_MONTH_LENGTH', '2'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_EXP_YEAR', 'Jahr :'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_EXP_YEAR_LENGTH', '2'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_SELECT', 'Bitte waehlen'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_CVC', 'CVC (Pruefziffer): '); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_EXP_MONTHS_YEARS', 'Gültigkeit (Monat/Jahr) :'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_CVC_LENGTH', '3'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_CVC2', '
* Bei Visa-, Master- und Eurocard besteht der CVC-Code
aus den drei letzten Ziffern im Unterschriftenfeld auf der
Rueckseite der Kreditkarte.'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_BOOKING_INFO', '
Die Belastung Ihrer Kreditkarte erfolgt mit dem Abschluss der Bestellung.'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_JS_NN_ID2_MISSING', '* Produkt-ID2 und / oder Tarif-ID2 fehlen!'); + define('MODULE_PAYMENT_NOVALNET_CC3D_IN_TEST_MODE', ' (im Testbetrieb)'); + define('MODULE_PAYMENT_NOVALNET_CC3D_NOT_CONFIGURED', ' (Nicht konfiguriert)'); + define('MODULE_PAYMENT_NOVALNET_CC3D_GUEST_USER', 'Gast'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_JS_NN_MISSING', '* Grundlegende Parameter fehlt!'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_JS_CARD_OWNER', '* Geben Sie bitte gültige Kreditkartendaten ein! '); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_JS_CC_NO', '* Geben Sie bitte gültige Kreditkartendaten ein! '); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_JS_EXP_MONTH', '*Geben Sie bitte gültige Kreditkartendaten ein! '); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_JS_EXP_YEAR', '* Geben Sie bitte gültige Kreditkartendaten ein! '); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_JS_CVC', '* Geben Sie bitte gültige Kreditkartendaten ein! '); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_JS_CVC2', '* Geben Sie bitte gültige Kreditkartendaten ein! '); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_ERROR_EXP_MONTH', '*Geben Sie bitte gültige Kreditkartendaten ein! '); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_ERROR_EXP_YEAR', '*Geben Sie bitte gültige Kreditkartendaten ein! '); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_ERROR', 'Kartendaten Fehler:'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_ORDERNO', 'Best.-Nr.: '); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_ORDERDATE', 'Best.-Datum: '); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEST_MODE', 'Testmodus'); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEST_ORDER_MESSAGE',"Testbestellung"); + define('MODULE_PAYMENT_NOVALNET_CC3D_TID_MESSAGE',"Novalnet Transaktions ID: "); + define('MODULE_PAYMENT_NOVALNET_CC3D_TEXT_JS_CC_NO_ERR', '*Geben Sie bitte gültige Kreditkartendaten ein!'); + define('MODULE_PAYMENT_NOVALNET_CC3D_CURL_MESSAGE',"* Sie müssen die CURL-Funktion auf Server aktivieren, überprüfen Sie bitte mit Ihrem Hosting-Provider darüber!"); +?> diff --git a/includes/languages/german/modules/payment/novalnet_cc_pci.php b/includes/languages/german/modules/payment/novalnet_cc_pci.php new file mode 100644 index 0000000..4d3481d --- /dev/null +++ b/includes/languages/german/modules/payment/novalnet_cc_pci.php @@ -0,0 +1,39 @@ +Kreditkarte PCI Visa & Mastercard'); + define('MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_DESCRIPTION', 'Schnell und Sicher bezahlen über Novalnet AG
Bitte vor aktivierung alle noetige IDs in Bearbeitungmodus eingeben!'); + define('MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_LANG', 'DE'); + define('MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_INFO', ''); + define('MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_PUBLIC_TITLE', 'Kreditkarte PCI Visa & Mastercard'); + define('MODULE_PAYMENT_NOVALNET_CC_PCI_IN_TEST_MODE', ' (im Testbetrieb)'); + define('MODULE_PAYMENT_NOVALNET_CC_PCI_NOT_CONFIGURED', ' (Nicht konfiguriert)'); + define('MODULE_PAYMENT_NOVALNET_CC_PCI_NOT_CONFIGURED', 'Gast'); + define('MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_JS_NN_ID2_MISSING', '* Produkt-ID2 und / oder Tarif-ID2 fehlen!'); + define('MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_JS_NN_MISSING', '* Grundlegende Parameter fehlt!'); + define('MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_ERROR', 'Kartendaten Fehler:'); + define('MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_ORDERNO', 'Best.-Nr.: '); + define('MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_ORDERDATE', 'Best.-Datum: '); + define('MODULE_PAYMENT_NOVALNET_CC_PCI_TEST_MODE', 'Testmodus'); + define('MODULE_PAYMENT_NOVALNET_CC_PCI_TEST_ORDER_MESSAGE',"Testbestellung"); + define('MODULE_PAYMENT_NOVALNET_CC_PCI_TID_MESSAGE',"Novalnet Transaktions ID: "); + define('MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_HASH_ERROR', 'checkHash fehlgeschlagen'); + define('MODULE_PAYMENT_NOVALNET_CC_PCI_CURL_MESSAGE',"* Sie müssen die CURL-Funktion auf Server aktivieren, überprüfen Sie bitte mit Ihrem Hosting-Provider darüber!"); + define('MODULE_PAYMENT_NOVALNET_INFORMATION_PAYMENT_CC_PCI', 'Sie werden zur Website der Novalnet AG umgeleitet, sobald Sie die Bestellung bestätigen.'); + +?> diff --git a/includes/languages/german/modules/payment/novalnet_elv_at.php b/includes/languages/german/modules/payment/novalnet_elv_at.php new file mode 100644 index 0000000..3e4a0e9 --- /dev/null +++ b/includes/languages/german/modules/payment/novalnet_elv_at.php @@ -0,0 +1,68 @@ +Lastschrift Österreich Österreichische Lastschriftverfahren'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_DESCRIPTION', 'Schnell und Sicher bezahlen über Novalnet AG
Bitte vor aktivierung alle noetige IDs in Bearbeitungmodus eingeben!'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_LANG', 'DE'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_INFO', ''); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_PUBLIC_TITLE', 'Lastschrift Österreich Österreichische Lastschriftverfahren'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_BANK_ACCOUNT_OWNER', 'Kontoinhaber:'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_BANK_ACCOUNT_OWNER_LENGTH', '3'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_BANK_ACCOUNT_NUMBER', 'Kontonummer:'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_BANK_ACCOUNT_NUMBER_LENGTH', '5'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_BANK_CODE', 'Bankleitzahl:'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_BANK_CODE_LENGTH', '3'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_IN_TEST_MODE', ' (im Testbetrieb)'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_NOT_CONFIGURED', ' (Nicht konfiguriert)'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_GUEST_USER', 'Gast'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_JS_NN_ID2_MISSING', '* Produkt-ID2 und / oder Tarif-ID2 fehlen!'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_JS_NN_MISSING', '* Grundlegende Parameter fehlt!'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_JS_BANK_ACCOUNT_OWNER', '* Geben Sie bitte gültige Kontodaten ein!'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_JS_BANK_ACCOUNT_NUMBER', '* Geben Sie bitte gültige Kontodaten ein!'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_JS_BANK_CODE', '* Geben Sie bitte gültige Kontodaten ein!'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_ERROR', 'Kontodaten Fehler:'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_CUST_INFORM', '"Wir holen zuvor eine Bonitätsauskunft ein, denn nur bei positiver Auskunft können wir die Bestellung durchführen und die Abbuchung erfolgt mit dem Warenversand. Bei Nichteinlösung/Widerruf berechnen wir eine Aufwandspauschale von 10,00 Euro und der Vorgang wird sofort dem Inkasso-Verfahren übergeben."'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_ORDERNO', 'Best.-Nr. '); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_ORDERDATE', 'Best.-Datum '); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEST_MODE', 'Testmodus'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEST_ORDER_MESSAGE',"Testbestellung"); + //Start : Pin by call back + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_TEL_REQ', 'Telefonnummer:*'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_SMS_REQ', 'Mobiltelefonnummer:*'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_EMAIL_REQ', 'E-Mail Adresse:*'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_SMS_PIN', 'Geben Sie Ihre PIN Nummer:*'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_SMS_NEW_PIN', 'PIN vergessen? [Neue PIN beantragen]'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_SMS_TEL_NOTVALID', 'Geben Sie bitte die Telefon- / Handynummer ein!'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_SMS_PIN_NOTVALID', 'Die eingegebene PIN ist falsch oder leer!'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_EMAIL_NOTVALID', 'Geben Sie bitte die Emailadresse ein!'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_EMAIL_INPUT_REQUEST_DESC',"Wir haben Ihnen eine Email geschickt, beantworten Sie diese bitte."); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_SMS_CALL_MESSAGE', 'Sie werden in kürze eine PIN per Telefon/SMS erhalten. Bitte geben Sie die PIN in das entsprechende Textfeld ein.'); + + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_INPUT_REQUEST_DESC',"Sie erhalten in Kürze eine PIN per Telefon/SMS. Geben Sie bitte die PIN in das entsprechende Textfeld ein."); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_SESSION_ERROR',"Ihre PIN Sitzung ist abgelaufen. Bitte versuchen Sie es erneut mit einem neuen Anruf."); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_AMOUNT_VARIATION_MESSAGE',"Sie haben die Bestellmenge nach dem Erhalt der PIN-Nummer geändert, versuchen Sie es bitte erneut mit einem neuen Anruf."); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_AMOUNT_VARIATION_MESSAGE_EMAIL',"Sie haben die Bestellmenge nach dem Erhalt der Email geändert, versuchen Sie es bitte erneut mit einem neuen Anruf."); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_EMAIL_PHONE_INPUT_REQUEST_DESC',"* Bitte geben Sie Ihre Telefonnummer / E-Mail."); + //End : Pin by call back + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TID_MESSAGE'," Novalnet Transaktions ID : "); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_CURL_MESSAGE',"* Sie müssen die CURL-Funktion auf Server aktivieren, überprüfen Sie bitte mit Ihrem Hosting-Provider darüber!"); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_JS_BANK_ERROR_ACCOUNT_NUMBER', '* Geben Sie bitte gültige Kontodaten ein!'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_JS_BANK_CODE_ERROR', '* Geben Sie bitte gültige Kontodaten ein!'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_MAX_TIME_ERROR', '*Maximale Anzahl von PIN-Eingaben überschritten!'); + define('MODULE_PAYMENT_NOVALNET_INFORMATION_PAYMENT_AT', 'Die Belastung Ihres Kontos erfolgt mit dem Versand der Ware.'); +?> diff --git a/includes/languages/german/modules/payment/novalnet_elv_at_pci.php b/includes/languages/german/modules/payment/novalnet_elv_at_pci.php new file mode 100644 index 0000000..fa2bbbe --- /dev/null +++ b/includes/languages/german/modules/payment/novalnet_elv_at_pci.php @@ -0,0 +1,39 @@ +Lastschrift Österreich PCI Österreichische Lastschriftverfahren'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEXT_DESCRIPTION', 'Schnell und Sicher bezahlen über Novalnet AG
Bitte vor aktivierung alle noetige IDs in Bearbeitungmodus eingeben!'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEXT_LANG', 'DE'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEXT_INFO', ''); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEXT_PUBLIC_TITLE', 'Lastschrift Österreich PCI Österreichische Lastschriftverfahren'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEXT_BOOKING_INFO', '

Der Betrag wird von Ihrer Kreditkarte mit dem
Verwendungszweck $BOOKINFO sofort abgebucht.'); + define('MODULE_PAYMENT_NOVALNET_AT_PCI_IN_TEST_MODE', ' (im Testbetrieb)'); + define('MODULE_PAYMENT_NOVALNET_AT_PCI_NOT_CONFIGURED', ' (Nicht konfiguriert)'); + define('MODULE_PAYMENT_NOVALNET_AT_PCI_GUEST_USER', 'Gast'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEXT_JS_NN_ID2_MISSING', '* Produkt-ID2 und / oder Tarif-ID2 fehlen!'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEXT_JS_NN_MISSING', '* Grundlegende Parameter fehlt.'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEXT_ERROR', 'Kartendaten Fehler:'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEXT_ORDERNO', 'Best.-Nr.: '); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEXT_ORDERDATE', 'Best.-Datum: '); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEST_MODE', 'Testmodus'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEXT_HASH_ERROR', 'checkHash fehlgeschlagen'); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEST_ORDER_MESSAGE',"Testbestellung"); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TID_MESSAGE',"Novalnet Transaktions ID: "); + define('MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_CURL_MESSAGE',"* Sie müssen die CURL-Funktion auf Server aktivieren, überprüfen Sie bitte mit Ihrem Hosting-Provider darüber!"); + define('MODULE_PAYMENT_NOVALNET_INFORMATION_PAYMENT_AT_PCI', 'Sie werden zur Website der Novalnet AG umgeleitet, sobald Sie die Bestellung bestätigen.'); +?> diff --git a/includes/languages/german/modules/payment/novalnet_elv_de.php b/includes/languages/german/modules/payment/novalnet_elv_de.php new file mode 100644 index 0000000..a79407f --- /dev/null +++ b/includes/languages/german/modules/payment/novalnet_elv_de.php @@ -0,0 +1,70 @@ +Lastschrift Deutschland Deutsche Lastschriftverfahren'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_DESCRIPTION', 'Schnell und Sicher bezahlen über Novalnet AG
Bitte vor aktivierung alle noetige IDs in Bearbeitungmodus eingeben!'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_LANG', 'DE'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_INFO', ''); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_PUBLIC_TITLE', 'Lastschrift Deutschland Deutsche Lastschriftverfahren'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_BANK_ACCOUNT_OWNER', 'Kontoinhaber:'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_BANK_ACCOUNT_OWNER_LENGTH', '3'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_BANK_ACCOUNT_NUMBER', 'Kontonummer:'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_BANK_ACCOUNT_NUMBER_LENGTH', '5'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_BANK_CODE', 'Bankleitzahl:'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_BANK_CODE_LENGTH', '3'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_ACDC_INFO', "Der ACDC-Check wird akzeptiert"); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_ACDC_DIV', ""); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_JS_NN_ID2_MISSING', '* Produkt-ID2-und / oder Tarif-ID2 fehlen!'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_IN_TEST_MODE', ' (im Testbetrieb)'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_NOT_CONFIGURED', ' (Nicht konfiguriert)'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_GUEST_USER', 'Gast'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_JS_NN_MISSING', '* Grundlegende Parameter fehlt'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_JS_BANK_ACCOUNT_OWNER', '* Geben Sie bitte gültige Kontodaten ein!'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_JS_BANK_ACCOUNT_NUMBER', '* Geben Sie bitte gültige Kontodaten ein!'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_JS_BANK_CODE', '* Geben Sie bitte gültige Kontodaten ein!'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_JS_ACDC', '*Aktivieren Sie bitte den ACDC-Check!'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_JS_ACDC', '*Aktivieren Sie bitte den ACDC-Check!'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_ERROR', 'Kontodaten Fehler:'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_CUST_INFORM', '"Wir holen zuvor eine Bonitätsauskunft ein, denn nur bei positiver Auskunft können wir die Bestellung durchführen und die Abbuchung erfolgt mit dem Warenversand. Bei Nichteinlösung/Widerruf berechnen wir eine Aufwandspauschale von 10,00 Euro und der Vorgang wird sofort dem Inkasso-Verfahren übergeben."'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_ORDERNO', 'Best.-Nr.: '); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_ORDERDATE', 'Best.-Datum: '); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEST_MODE', 'Testmodus'); + //Start : Pin by call back + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_TEL_REQ', 'Telefonnummer:*'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_SMS_REQ', 'Mobiltelefonnummer:*'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_EMAIL_REQ', 'E-Mail Adresse:*'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_SMS_PIN', 'Geben Sie Ihre PIN Nummer:*'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_SMS_NEW_PIN', 'PIN vergessen? [Neue PIN beantragen]'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_SMS_TEL_NOTVALID', 'Geben Sie bitte die Telefon- / Handynummer ein!'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_SMS_PIN_NOTVALID', 'Die eingegebene PIN ist falsch oder leer!'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_EMAIL_NOTVALID', 'Geben Sie bitte die Emailadresse ein!'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_EMAIL_INPUT_REQUEST_DESC',"Wir haben Ihnen eine Email geschickt, beantworten Sie diese bitte."); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_SMS_CALL_MESSAGE', 'Sie werden in kürze eine PIN per Telefon/SMS erhalten. Bitte geben Sie die PIN in das entsprechende Textfeld ein.'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_INPUT_REQUEST_DESC',"Sie erhalten in Kürze eine PIN per Telefon/SMS. Geben Sie bitte die PIN in das entsprechende Textfeld ein."); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_SESSION_ERROR',"Ihre PIN Sitzung ist abgelaufen. Bitte versuchen Sie es erneut mit einem neuen Anruf."); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_AMOUNT_VARIATION_MESSAGE',"Sie haben die Bestellmenge nach dem Erhalt der PIN-Nummer geändert, versuchen Sie es bitte erneut mit einem neuen Anruf."); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_AMOUNT_VARIATION_MESSAGE_EMAIL',"Sie haben die Bestellmenge nach dem Erhalt der Email geändert, versuchen Sie es bitte erneut mit einem neuen Anruf."); + //End : Pin by call back + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEST_ORDER_MESSAGE',"Testbestellung"); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TID_MESSAGE',"Novalnet Transaktions ID : "); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_CURL_MESSAGE',"* Sie müssen die CURL-Funktion auf Server aktivieren, überprüfen Sie bitte mit Ihrem Hosting-Provider darüber!"); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_JS_BANK_ERROR_ACCOUNT_NUMBER', '* Geben Sie bitte gültige Kontodaten ein!'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_JS_BANK_CODE_ERROR', '* Geben Sie bitte gültige Kontodaten ein!'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_MAX_TIME_ERROR', '*Maximale Anzahl von PIN-Eingaben überschritten!'); + define('MODULE_PAYMENT_NOVALNET_INFORMATION_PAYMENT_DE', 'Die Belastung Ihres Kontos erfolgt mit dem Versand der Ware.'); +?> diff --git a/includes/languages/german/modules/payment/novalnet_elv_de_pci.php b/includes/languages/german/modules/payment/novalnet_elv_de_pci.php new file mode 100644 index 0000000..76e4fb5 --- /dev/null +++ b/includes/languages/german/modules/payment/novalnet_elv_de_pci.php @@ -0,0 +1,38 @@ +Lastschrift Deutschland PCI Deutsche Lastschriftverfahren'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEXT_DESCRIPTION', 'Schnell und Sicher bezahlen über Novalnet AG
Bitte vor aktivierung alle noetige IDs in Bearbeitungmodus eingeben!'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEXT_LANG', 'DE'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEXT_INFO', ''); + define('MODULE_PAYMENT_NOVALNET_DE_PCI_IN_TEST_MODE', ' (im Testbetrieb)'); + define('MODULE_PAYMENT_NOVALNET_DE_PCI_NOT_CONFIGURED', ' (Nicht konfiguriert)'); + define('MODULE_PAYMENT_NOVALNET_DE_PCI_GUEST_USER', 'Gast'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEXT_JS_NN_ID2_MISSING', '* Produkt-ID2-und / oder Tarif-ID2 fehlen!'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEXT_PUBLIC_TITLE', 'Lastschrift Deutschland PCI Deutsche Lastschriftverfahren'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEXT_BOOKING_INFO', '

Der Betrag wird von Ihrer Kreditkarte mit dem
Verwendungszweck $BOOKINFO sofort abgebucht.'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEXT_JS_NN_MISSING', '* Grundlegende Parameter fehlt!'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEXT_ERROR', 'Kartendaten Fehler:'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEXT_ORDERNO', 'Best.-Nr.: '); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEXT_ORDERDATE', 'Best.-Datum: '); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEST_MODE', 'Testmodus'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEXT_HASH_ERROR', 'checkHash fehlgeschlagen'); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEST_ORDER_MESSAGE',"Testbestellung"); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TID_MESSAGE',"Novalnet Transaktions ID: "); + define('MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_CURL_MESSAGE',"* Sie müssen die CURL-Funktion auf Server aktivieren, überprüfen Sie bitte mit Ihrem Hosting-Provider darüber!"); + define('MODULE_PAYMENT_NOVALNET_INFORMATION_PAYMENT_DE_PCI', 'Sie werden zur Website der Novalnet AG umgeleitet, sobald Sie die Bestellung bestätigen.'); +?> diff --git a/includes/languages/german/modules/payment/novalnet_ideal.php b/includes/languages/german/modules/payment/novalnet_ideal.php new file mode 100644 index 0000000..02db396 --- /dev/null +++ b/includes/languages/german/modules/payment/novalnet_ideal.php @@ -0,0 +1,40 @@ +iDEAL iDEAL'); + define('MODULE_PAYMENT_NOVALNET_IDEAL_TEXT_DESCRIPTION', 'Schnell und Sicher bezahlen über Novalnet AG
Bitte vor der Aktivierung alle noetigen IDs im Bearbeitungsmodus eingeben!'); + define('MODULE_PAYMENT_NOVALNET_IDEAL_TEXT_LANG', 'DE'); + define('MODULE_PAYMENT_NOVALNET_IDEAL_TEXT_INFO', ''); + define('MODULE_PAYMENT_NOVALNET_IDEAL_TEXT_PUBLIC_TITLE', 'iDEAL iDEAL'); + define('MODULE_PAYMENT_NOVALNET_IDEAL_IN_TEST_MODE', ' (im Testbetrieb)'); + define('MODULE_PAYMENT_NOVALNET_IDEAL_NOT_CONFIGURED', ' (Nicht konfiguriert)'); + define('MODULE_PAYMENT_NOVALNET_IDEAL_GUEST_USER', 'Gast'); + define('MODULE_PAYMENT_NOVALNET_IDEAL_TEXT_JS_NN_MISSING', '* Grundlegende Parameter fehlt!'); + define('MODULE_PAYMENT_NOVALNET_IDEAL_TEXT_ERROR', 'Kontodaten Fehler:'); + define('MODULE_PAYMENT_NOVALNET_IDEAL_TEXT_CUST_INFORM', '"Wir holen zuvor eine Bonitätsauskunft ein, denn nur bei positiver Auskunft können wir die Bestellung durchführen und die Abbuchung erfolgt mit dem Warenversand. Bei Nichteinlösung/Widerruf berechnen wir eine Aufwandspauschale von 10,00 Euro und der Vorgang wird sofort dem Inkasso-Verfahren übergeben."'); + define('MODULE_PAYMENT_NOVALNET_IDEAL_TEXT_ORDERNO', 'Best.-Nr.: '); + define('MODULE_PAYMENT_NOVALNET_IDEAL_TEXT_ORDERDATE', 'Best.-Datum: '); + define('MODULE_PAYMENT_NOVALNET_IDEAL_TEST_MODE', 'Testmodus'); + define('MODULE_PAYMENT_NOVALNET_IDEAL_TEXT_HASH_ERROR', 'checkHash fehlgeschlagen'); + define('MODULE_PAYMENT_NOVALNET_IDEAL_TEST_ORDER_MESSAGE',"Testbestellung"); + define('MODULE_PAYMENT_NOVALNET_IDEAL_TID_MESSAGE',"Novalnet Transaktions ID : "); + define('MODULE_PAYMENT_NOVALNET_IDEAL_PROXY_DESC', 'Wenn Sie ein Proxy einsetzen, tragen Sie hier Ihre Proxy-IP ein (z.B. www.proxy.de:80)'); + define('MODULE_PAYMENT_NOVALNET_IDEAL_CURL_MESSAGE',"* Sie müssen die CURL-Funktion auf Server aktivieren, überprüfen Sie bitte mit Ihrem Hosting-Provider darüber!"); + define('MODULE_PAYMENT_NOVALNET_INFORMATION_PAYMENT_IDEAL', 'Sie werden zur Website der Novalnet AG umgeleitet, sobald Sie die Bestellung bestätigen.'); +?> diff --git a/includes/languages/german/modules/payment/novalnet_instantbanktransfer.php b/includes/languages/german/modules/payment/novalnet_instantbanktransfer.php new file mode 100644 index 0000000..fc58198 --- /dev/null +++ b/includes/languages/german/modules/payment/novalnet_instantbanktransfer.php @@ -0,0 +1,39 @@ +Sofortüberweisung Sofortüberweisung'); + define('MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEXT_DESCRIPTION', 'Schnell und Sicher bezahlen über Novalnet AG
Bitte vor der Aktivierung alle noetigen IDs im Bearbeitungsmodus eingeben!'); + define('MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEXT_LANG', 'DE'); + define('MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEXT_INFO', ''); + define('MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEXT_PUBLIC_TITLE', 'Sofortüberweisung Sofortüberweisung'); + define('MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_IN_TEST_MODE', ' (im Testbetrieb)'); + define('MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_NOT_CONFIGURED', ' (Nicht konfiguriert)'); + define('MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_GUEST_USER', 'Gast'); + define('MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEXT_JS_NN_MISSING', '* Grundlegende Parameter fehlt!'); + define('MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEXT_ERROR', 'Kontodaten Fehler:'); + define('MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEXT_CUST_INFORM', '"Wir holen zuvor eine Bonitätsauskunft ein, denn nur bei positiver Auskunft können wir die Bestellung durchführen und die Abbuchung erfolgt mit dem Warenversand. Bei Nichteinlösung/Widerruf berechnen wir eine Aufwandspauschale von 10,00 Euro und der Vorgang wird sofort dem Inkasso-Verfahren übergeben."'); + define('MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEXT_ORDERNO', 'Best.-Nr.: '); + define('MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEXT_ORDERDATE', 'Best.-Datum: '); + define('MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEST_MODE', 'Testmodus'); + define('MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEXT_HASH_ERROR', 'checkHash fehlgeschlagen'); + define('MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEST_ORDER_MESSAGE',"Testbestellung"); + define('MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TID_MESSAGE',"Novalnet Transaktions ID : "); + define('MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_PROXY_DESC', 'Wenn Sie ein Proxy einsetzen, tragen Sie hier Ihre Proxy-IP ein (z.B. www.proxy.de:80)'); + define('MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_CURL_MESSAGE',"* Sie müssen die CURL-Funktion auf Server aktivieren, überprüfen Sie bitte mit Ihrem Hosting-Provider darüber!"); + define('MODULE_PAYMENT_NOVALNET_INFORMATION_PAYMENT_INSTANT', 'Sie werden zur Website der Novalnet AG umgeleitet, sobald Sie die Bestellung bestätigen.'); +?> diff --git a/includes/languages/german/modules/payment/novalnet_invoice.php b/includes/languages/german/modules/payment/novalnet_invoice.php new file mode 100644 index 0000000..e2406d8 --- /dev/null +++ b/includes/languages/german/modules/payment/novalnet_invoice.php @@ -0,0 +1,70 @@ +Bitte vor aktivierung alle noetige IDs in Bearbeitungmodus eingeben!'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_LANG', 'DE'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_INFO', ''); + define('MODULE_PAYMENT_NOVALNET_INVOICE_INVOICE_TEST_MODE', ' (im Testbetrieb)'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_NOT_CONFIGURED', ' (Nicht konfiguriert)'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_GUEST_USER', 'Gast'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_PUBLIC_TITLE', 'Kauf auf Rechnung'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_BANK_ACCOUNT_OWNER', 'Kontoinhaber :'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_BANK_ACCOUNT_NUMBER', 'Kontonummer :'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_BANK_CODE', 'Bankleitzahl :'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_BANK_IBAN', 'IBAN :'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_BANK_BIC', 'SWIFT / BIC :'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_BANK_BANK', 'Bank :'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_BANK_CITY', 'Stadt :'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_AMOUNT', 'Betrag :'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_REFERENCE', 'Verwendungszweck : TID'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_REFERENCE_INFO', 'Bitte beachten Sie, dass die Ueberweisung nur bearbeitet werden kann, wenn der oben angegebene Verwendungszweck verwendet wird.'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_TRANSFER_INFO', 'Bitte überweisen Sie den Betrag mit der folgenden Information an unseren Zahlungsdienstleister Novalnet AG'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_BANK_INFO', 'Die Bankverbindung wird Ihnen nach Abschluss Ihrer Bestellung per E-Mail zugeschickt.'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_DURATION_INFO', 'Zahlungsfrist:'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_DURATION_INFO_DAYS', 'Tage'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_DURATION_LIMIT_INFO', 'Bitte überweisen Sie den Betrag mit der folgenden Information an unseren Zahlungsdienstleister Novalnet AG'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_DURATION_LIMIT_END_INFO', 'Fälligkeitsdatum :'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_JS_NN_MISSING', '* Grundlegende Parameter fehlt!'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_ORDERNO', 'Best.-Nr. '); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_ORDERDATE', 'Best.-Datum '); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEST_MODE', 'Testmodus'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_ERROR', 'Kontodaten Fehler:'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_TEL_REQ', 'Telefonnummer:*'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_SMS_REQ', 'Mobiltelefonnummer:*'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_SMS_PIN', 'Geben Sie Ihre PIN Nummer:*'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_SMS_NEW_PIN', 'PIN vergessen? [Neue PIN beantragen]'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_SMS_TEL_NOTVALID', 'Geben Sie bitte die Telefon- / Handynummer ein!'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_SMS_PIN_NOTVALID', 'Die eingegebene PIN ist falsch oder leer!'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_SMS_CALL_MESSAGE', 'Sie werden in kürze eine PIN per Telefon/SMS erhalten. Bitte geben Sie die PIN in das entsprechende Textfeld ein.'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_PIN_INPUT_REQUEST_DESC',"Sie erhalten in Kürze eine PIN per Telefon/SMS. Geben Sie bitte die PIN in das entsprechende Textfeld ein."); + define('MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_SESSION_ERROR',"Ihre PIN Sitzung ist abgelaufen. Bitte versuchen Sie es erneut mit einem neuen Anruf."); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TEST_ORDER_MESSAGE',"Testbestellung"); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TID_MESSAGE',"Novalnet Transaktions ID : "); + define('MODULE_PAYMENT_NOVALNET_INVOICE_AMOUNT_VARIATION_MESSAGE',"Sie haben die Bestellmenge nach dem Erhalt der PIN-Nummer geändert, versuchen Sie es bitte erneut mit einem neuen Anruf."); + define('MODULE_PAYMENT_NOVALNET_INVOICE_AMOUNT_VARIATION_MESSAGE_EMAIL',"Sie haben die Bestellmenge nach dem Erhalt der Email geändert, versuchen Sie es bitte erneut mit einem neuen Anruf."); + define('MODULE_PAYMENT_NOVALNET_INVOICE_EMAIL_PHONE_INPUT_REQUEST_DESC',"* Bitte geben Sie Ihre Telefonnummer / E-Mail."); + define('MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_EMAIL_REQ', 'E-Mail Adresse:*'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_EMAIL_NOTVALID', 'Geben Sie bitte die Emailadresse ein!'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_EMAIL_INPUT_REQUEST_DESC',"Wir haben Ihnen eine Email geschickt, beantworten Sie diese bitte."); + define('MODULE_PAYMENT_NOVALNET_INVOICE_CURL_MESSAGE',"* Sie müssen die CURL-Funktion auf Server aktivieren, überprüfen Sie bitte mit Ihrem Hosting-Provider darüber!"); + define('MODULE_PAYMENT_NOVALNET_INVOICE_MAX_TIME_ERROR', '*Maximale Anzahl von PIN-Eingaben überschritten!'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_NAME', 'NOVALNET AG'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_PAYMNETNAME', 'Novalnet Kauf auf Rechnung'); + define('MODULE_PAYMENT_NOVALNET_INVOICE_TID', 'TID :'); + define('MODULE_PAYMENT_NOVALNET_TEXT_DETAILS_INVOICE_INTERNATIONAL_INFO', 'Nur bei Auslandsüberweisungen:'); +?> diff --git a/includes/languages/german/modules/payment/novalnet_paypal.php b/includes/languages/german/modules/payment/novalnet_paypal.php new file mode 100644 index 0000000..70d4d13 --- /dev/null +++ b/includes/languages/german/modules/payment/novalnet_paypal.php @@ -0,0 +1,37 @@ +PayPal PayPal'); + define('MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_DESCRIPTION', 'Schnell und Sicher bezahlen über Novalnet AG
Bitte vor der Aktivierung alle noetigen IDs im Bearbeitungsmodus eingeben!
Sie mü ssen ü ber ein Paypal-Hä ndlerkonto verfü gen, bevor Sie dieses Modul einsetzen kö nnen.'); + define('MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_LANG', 'DE'); + define('MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_INFO', ''); + define('MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_PUBLIC_TITLE', 'PayPal PayPal'); + define('MODULE_PAYMENT_NOVALNET_PAYPAL_IN_TEST_MODE', ' (im Testbetrieb)'); + define('MODULE_PAYMENT_NOVALNET_PAYPAL_NOT_CONFIGURED', ' (Nicht konfiguriert)'); + define('MODULE_PAYMENT_NOVALNET_PAYPAL_GUEST_USER', 'Gast'); + define('MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_JS_NN_MISSING', '* Grundlegende Parameter fehlt!'); + define('MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_ERROR', 'Kontodaten Fehler:'); + define('MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_CUST_INFORM', '"Wir holen zuvor eine Bonitätsauskunft ein, denn nur bei positiver Auskunft können wir die Bestellung durchführen und die Abbuchung erfolgt mit dem Warenversand. Bei Nichteinlösung/Widerruf berechnen wir eine Aufwandspauschale von 10,00 Euro und der Vorgang wird sofort dem Inkasso-Verfahren übergeben."'); + define('MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_ORDERNO', 'Best.-Nr.: '); + define('MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_ORDERDATE', 'Best.-Datum: '); + define('MODULE_PAYMENT_NOVALNET_PAYPAL_TEST_MODE', 'Test Mode'); + define('MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_HASH_ERROR', 'checkHash fehlgeschlagen'); + define('MODULE_PAYMENT_NOVALNET_PAYPAL_TEST_ORDER_MESSAGE',"Testbestellung"); + define('MODULE_PAYMENT_NOVALNET_PAYPAL_TID_MESSAGE',"Novalnet Transaktions ID : "); + define('MODULE_PAYMENT_NOVALNET_PAYPAL_CURL_MESSAGE',"* Sie müssen die CURL-Funktion auf Server aktivieren, überprüfen Sie bitte mit Ihrem Hosting-Provider darüber!"); + define('MODULE_PAYMENT_NOVALNET_INFORMATION_PAYMENT_PAYPAL', 'Sie werden zur Website der Novalnet AG umgeleitet, sobald Sie die Bestellung bestätigen.'); +?> diff --git a/includes/languages/german/modules/payment/novalnet_prepayment.php b/includes/languages/german/modules/payment/novalnet_prepayment.php new file mode 100644 index 0000000..14c8f52 --- /dev/null +++ b/includes/languages/german/modules/payment/novalnet_prepayment.php @@ -0,0 +1,50 @@ +Bitte vor aktivierung alle noetige IDs in Bearbeitungmodus eingeben!'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_LANG', 'DE'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_INFO', ''); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_IN_TEST_MODE', ' (im Testbetrieb)'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_NOT_CONFIGURED', ' (Nicht konfiguriert)'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_GUEST_USER', 'Gast'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_PUBLIC_TITLE', 'Vorauskasse'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_BANK_ACCOUNT_OWNER', 'Kontoinhaber :'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_BANK_ACCOUNT_NUMBER', 'Kontonummer :'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_BANK_CODE', 'Bankleitzahl :'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_BANK_IBAN', 'IBAN :'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_BANK_BIC', 'SWIFT / BIC :'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_BANK_BANK', 'Bank :'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_BANK_CITY', 'Stadt :'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_AMOUNT', 'Betrag :'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_REFERENCE', 'Verwendungszweck : TID'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_REFERENCE_INFO', 'Bitte beachten Sie, dass die Ueberweisung nur bearbeitet werden kann, wenn der oben angegebene Verwendungszweck verwendet wird.'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_TRANSFER_INFO', 'Bitte überweisen Sie den Betrag mit der folgenden Information an unseren Zahlungsdienstleister Novalnet AG'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_BANK_INFO', 'Die Bankverbindung wird Ihnen nach Abschluss Ihrer Bestellung per E-Mail zugeschickt.'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_JS_NN_MISSING', '* Grundlegende Parameter fehlt!'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_ORDERNO', 'Best.-Nr.: '); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_ORDERDATE', 'Best.-Datum: '); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEST_MODE', 'Testmodus'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEST_ORDER_MESSAGE',"Testbestellung"); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TID_MESSAGE',"Novalnet Transaktions ID: "); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_ERROR', 'Kontodaten Fehler:'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_CURL_MESSAGE',"* Sie müssen die CURL-Funktion auf Server aktivieren, überprüfen Sie bitte mit Ihrem Hosting-Provider darüber!"); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_NAME', 'NOVALNET AG'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_PAYMNETNAME', 'Novalnet Vorauskasse'); + define('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TID', 'TID :'); + define('MODULE_PAYMENT_NOVALNET_TEXT_DETAILS_PREPAYMENT_INTERNATIONAL_INFO', 'Nur bei Auslandsüberweisungen:'); +?> \ No newline at end of file diff --git a/includes/languages/german/modules/payment/novalnet_tel.php b/includes/languages/german/modules/payment/novalnet_tel.php new file mode 100644 index 0000000..bc0c04d --- /dev/null +++ b/includes/languages/german/modules/payment/novalnet_tel.php @@ -0,0 +1,48 @@ +Novalnet Telefonpayment - Pay by callTelefon Payment'); + define('MODULE_PAYMENT_NOVALNET_TEL_TEXT_DESCRIPTION', 'Schnell und Sicher bezahlen über Novalnet AG
Bitte vor aktivierung alle noetige IDs in Bearbeitungmodus eingeben!'); + define('MODULE_PAYMENT_NOVALNET_TEL_TEXT_LANG', 'DE'); + define('MODULE_PAYMENT_NOVALNET_TEL_TEXT_INFO', ''); + + define('MODULE_PAYMENT_NOVALNET_TEL_IN_TEST_MODE', ' (im Testbetrieb)'); + define('MODULE_PAYMENT_NOVALNET_TEL_NOT_CONFIGURED', ' (Nicht konfiguriert)'); + define('MODULE_PAYMENT_NOVALNET_TEL_GUEST_USER', 'Gast'); + + define('MODULE_PAYMENT_NOVALNET_TEL_TEXT_PUBLIC_TITLE', 'TelefonpaymentTelefon Payment'); + define('MODULE_PAYMENT_NOVALNET_TEL_TEXT_STEP_INFO', 'Folgende Schritte sind noetig um Ihre Zahlung abzuschliessen:'); + define('MODULE_PAYMENT_NOVALNET_TEL_TEXT_STEP1', 'Schritt 1:'); + define('MODULE_PAYMENT_NOVALNET_TEL_TEXT_STEP2', 'Schritt 2:'); + define('MODULE_PAYMENT_NOVALNET_TEL_TEXT_STEP1_DESC', 'Bitte rufen Sie die angezeigte Telefonnummer an:'); + define('MODULE_PAYMENT_NOVALNET_TEL_TEXT_STEP2_DESC', 'Bitte warten Sie auf den Signalton und legen Sie dann den Hoerer auf.
Nach Ihrem erfolgreichen Anruf klicken Sie bitte unten auf Weiter.'); + define('MODULE_PAYMENT_NOVALNET_TEL_TEXT_COST_INFO', '* Dieser Anruf kostet einmalig '); + define('MODULE_PAYMENT_NOVALNET_TEL_TEXT_TAX_INFO', '€ (inkl. MwSt) und ist nur vom Deutschen Festnetzanschluss moeglich! *'); + define('MODULE_PAYMENT_NOVALNET_TEL_TEXT_AMOUNT_ERROR1', 'Betraege unter 0,90 Euro und ueber 10,00 Euro koennen nicht verarbeitet werden bzw. werden nicht akzeptiert!'); + define('MODULE_PAYMENT_NOVALNET_TEL_TEXT_AMOUNT_ERROR2', 'Betraege unter 0,90 Euro koennen nicht verarbeitet werden bzw. werden nicht akzeptiert!'); + define('MODULE_PAYMENT_NOVALNET_TEL_TEXT_ERROR', 'Zahlung nicht moeglich!'); + define('MODULE_PAYMENT_NOVALNET_TEL_TEXT_JS_NN_MISSING', '* Der zugrundeliegende Parameter fehlt.'); + define('MODULE_PAYMENT_NOVALNET_TEL_TEXT_ORDERNO', 'Best.-Nr.: '); + define('MODULE_PAYMENT_NOVALNET_TEL_TEXT_ORDERDATE', 'Best.-Datum: '); + define('MODULE_PAYMENT_NOVALNET_TEL_TEST_MODE', 'Testmodus'); + define('MODULE_PAYMENT_NOVALNET_TEL_CURL_MESSAGE',"* Sie müssen die CURL-Funktion auf Server aktivieren, überprüfen Sie bitte mit Ihrem Hosting-Provider darüber!"); +?> diff --git a/includes/modules/pages/checkout_novalnet_confirmation/header_php.php b/includes/modules/pages/checkout_novalnet_confirmation/header_php.php new file mode 100644 index 0000000..d1367da --- /dev/null +++ b/includes/modules/pages/checkout_novalnet_confirmation/header_php.php @@ -0,0 +1,63 @@ +notify('NOTIFY_HEADER_START_CHECKOUT_CONFIRMATION'); + +// if there is nothing in the customers cart, redirect them to the shopping cart page +if ($_SESSION['cart']->count_contents() <= 0) { + zen_redirect(zen_href_link(FILENAME_TIME_OUT)); +} + +// if the customer is not logged on, redirect them to the login page + if (!$_SESSION['customer_id']) { + $_SESSION['navigation']->set_snapshot(array('mode' => 'SSL', 'page' => FILENAME_CHECKOUT_PAYMENT)); + zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL')); + } else { + // validate customer + if (zen_get_customer_validate_session($_SESSION['customer_id']) == false) { + $_SESSION['navigation']->set_snapshot(); + zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL')); + } + } + +// avoid hack attempts during the checkout procedure by checking the internal cartID +if (isset($_SESSION['cart']->cartID) && $_SESSION['cartID']) { + if ($_SESSION['cart']->cartID != $_SESSION['cartID']) { + zen_redirect(zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')); + } +} + +// load the selected payment module +require(DIR_WS_CLASSES . 'payment.php'); + +$payment_modules = new payment($_SESSION['payment']); + +if ($messageStack->size('checkout_payment') > 0) { + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')); +} + +if (isset($_GET['payment_error']) && is_object(${$_GET['payment_error']}) && ($error = ${$_GET['payment_error']}->get_error())) { + //print $error; + $messageStack->add('checkout_payment', $error['error'], 'error'); +} +// This should be last line of the script: +$zco_notifier->notify('NOTIFY_HEADER_END_CHECKOUT_CONFIRMATION'); +?> \ No newline at end of file diff --git a/includes/modules/payment/novalnet_cc.php b/includes/modules/payment/novalnet_cc.php new file mode 100644 index 0000000..3c6bb81 --- /dev/null +++ b/includes/modules/payment/novalnet_cc.php @@ -0,0 +1,913 @@ +key = trim(MODULE_PAYMENT_NOVALNET_CC_PASSWORD); #'z2Vw3E4j'; + $this->vendor_id = trim(MODULE_PAYMENT_NOVALNET_CC_VENDOR_ID); + $this->auth_code = trim(MODULE_PAYMENT_NOVALNET_CC_AUTH_CODE); + $this->product_id = trim(MODULE_PAYMENT_NOVALNET_CC_PRODUCT_ID); + $this->tariff_id = trim(MODULE_PAYMENT_NOVALNET_CC_TARIFF_ID); + $this->manual_check_limit = trim(MODULE_PAYMENT_NOVALNET_CC_MANUAL_CHECK_LIMIT); + $this->product_id2 = trim(MODULE_PAYMENT_NOVALNET_CC_PRODUCT_ID2); + $this->tariff_id2 = trim(MODULE_PAYMENT_NOVALNET_CC_TARIFF_ID2); + $this->test_mode = (strtolower(MODULE_PAYMENT_NOVALNET_CC_TEST_MODE) == 'true' or MODULE_PAYMENT_NOVALNET_CC_TEST_MODE == '1')? 1: 0; + + $this->code = 'novalnet_cc'; + $this->title = MODULE_PAYMENT_NOVALNET_CC_TEXT_TITLE; + $this->public_title = MODULE_PAYMENT_NOVALNET_CC_TEXT_PUBLIC_TITLE; + $this->description = MODULE_PAYMENT_NOVALNET_CC_TEXT_DESCRIPTION; + $this->sort_order = MODULE_PAYMENT_NOVALNET_CC_SORT_ORDER; + $this->enabled = ((MODULE_PAYMENT_NOVALNET_CC_STATUS == 'True') ? true : false); + $this->proxy = MODULE_PAYMENT_NOVALNET_CC_PROXY; + $this->implementation = 'PHP_PCI'; + if(MODULE_PAYMENT_NOVALNET_CC_LOGO_STATUS == 'True'){ + $this->public_title = 'Novalnet'.' '.MODULE_PAYMENT_NOVALNET_CC_TEXT_PUBLIC_TITLE; + $this->title = 'Novalnet'.' '.MODULE_PAYMENT_NOVALNET_CC_TEXT_TITLE; + } + $this->checkConfigure(); + $this->checkReturnedData(); + + + + + if ((int)MODULE_PAYMENT_NOVALNET_CC_ORDER_STATUS_ID > 0){ + $this->order_status = MODULE_PAYMENT_NOVALNET_CC_ORDER_STATUS_ID; + } + if (is_object($order)) $this->update_status(); + $error = $this->get_error(); + if($_POST['session'] && $_SESSION['payment'] == $this->code){ + $this->checkSecurity(); + } + + } + + function checkConfigure() { + if (IS_ADMIN_FLAG == true) { + $this->title = MODULE_PAYMENT_NOVALNET_CC_TEXT_TITLE; // Payment module title in Admin + if(MODULE_PAYMENT_NOVALNET_CC_LOGO_STATUS == 'True'){ + $this->public_title = 'Novalnet'.' '.MODULE_PAYMENT_NOVALNET_CC_TEXT_PUBLIC_TITLE; + $this->title = 'Novalnet'.' '.MODULE_PAYMENT_NOVALNET_CC_TEXT_TITLE; + } + if ($this->enabled == 'true' && (!$this->vendor_id || !$this->auth_code || !$this->product_id || !$this->tariff_id || !$this->key )) { + $this->title .= ''.MODULE_PAYMENT_NOVALNET_CC_NOT_CONFIGURED.''; + } elseif ($this->test_mode == '1') { + $this->title .= ''.MODULE_PAYMENT_NOVALNET_CC_IN_TEST_MODE.''; + } + + } + } + + ### calculate zone matches and flag settings to determine whether this module should display to customers or not ### + function update_status(){ + global $order, $db; + + if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_NOVALNET_CC_ZONE > 0) ){ + $check_flag = false; + $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_NOVALNET_CC_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id"); + + while (!$check->EOF){ + if ($check->fields['zone_id'] < 1){ + $check_flag = true; + break; + }elseif ($check->fields['zone_id'] == $order->billing['zone_id']) { + $check_flag = true; + break; + } + $check->MoveNext(); + } + + if ($check_flag == false){ + $this->enabled = false; + } + } + } + + ### JS validation which does error-checking of data-entry if this module is selected for use ### + ### the fields to be cheked are (Bank Owner, Bank Account Number and Bank Code Lengths) ### + ### currently this function is not in use ### + // @return string + function javascript_validation() { + return false; + } + + ### Builds set of input fields for collecting Bankdetail info ### + // @return array + function selection() { + global $order, $HTTP_POST_VARS, $_POST, $HTTP_GET_VARS, $_GET; + $onFocus = ''; + if(count($HTTP_POST_VARS)==0 || $HTTP_POST_VARS=='') $HTTP_POST_VARS = $_POST; + + $selection = array('id' => $this->code, + 'module' => $this->public_title, + 'fields' => array(array('title' => '', 'field' => MODULE_PAYMENT_NOVALNET_INFORMATION_PAYMENT_CC), + + array('title' => '', 'field' => MODULE_PAYMENT_NOVALNET_CC_BOOK_REF) + )); + + MODULE_PAYMENT_NOVALNET_INFORMATION_PAYMENT_CC; + + if(function_exists(get_percent)){ + $selection['module_cost'] = $GLOBALS['ot_payment']->get_percent($this->code); + } + + return $selection; + } + + ### Precheck to Evaluate the Bank Datas ### + function pre_confirmation_check(){ + global $HTTP_POST_VARS, $_POST,$messageStack; + if(count($HTTP_POST_VARS)==0 || $HTTP_POST_VARS=='') $HTTP_POST_VARS = $_POST; + $error = ''; + + if (!function_exists('curl_init') && ($this->code=='novalnet_cc')){ + ini_set('display_errors', 1); + ini_set('error_reporting', E_ALL); + + $error = MODULE_PAYMENT_NOVALNET_CC_CURL_MESSAGE; + } + + if(!$this->vendor_id || !$this->auth_code || !$this->product_id || !$this->tariff_id || !$this->key) + { + $error = MODULE_PAYMENT_NOVALNET_CC_TEXT_JS_NN_MISSING; + } + elseif(!empty($this->manual_check_limit) && (!$this->product_id2 || !$this->tariff_id2)){ + $error = MODULE_PAYMENT_NOVALNET_CC_TEXT_JS_NN_ID2_MISSING; + } + + if($error!=''){ + $payment_error_return = 'payment_error=' . $this->code; + $messageStack->add_session('checkout_payment', $error . '', 'error'); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + } + + ### Display Information on the Checkout Confirmation Page ### + // @return array + function confirmation(){ + global $HTTP_POST_VARS, $_POST, $order; + $_SESSION['nn_total'] = $order->info['total']; + if(count($HTTP_POST_VARS)==0 || $HTTP_POST_VARS=='') $HTTP_POST_VARS = $_POST; + return $confirmation; + } + + ### Build the data and actions to process when the "Submit" button is pressed on the order-confirmation screen. ### + ### These are hidden fields on the checkout confirmation page ### + // @return string + function process_button(){ + return false; + } + + ### Insert the Novalnet Transaction ID in DB ### + function before_process(){ + global $HTTP_POST_VARS, $_POST, $order, $db, $currencies, $messageStack, $insert_id; + if(count($HTTP_POST_VARS)==0 || $HTTP_POST_VARS=='') $HTTP_POST_VARS = $_POST; + + if($_POST['tid'] && $_POST['status'] == '100'){ + if( $this->order_status ) { + $order->info['order_status'] = $this->order_status; + } + if($_POST['test_mode'] && $_POST['test_mode'] == '1'){ + $order->info['comments'] .= '
'.MODULE_PAYMENT_NOVALNET_CC_TEST_ORDER_MESSAGE.'
'; + } + $_SESSION['tid'] = $_POST['tid']; + + $order->info['comments'] .= '
'.MODULE_PAYMENT_NOVALNET_CC_TID_MESSAGE.$_POST['tid'].'

'; + $order->info['comments'] = str_replace(array('', '','','', '
','
','
'), array('', '', '','',"\n", "\n","\n"), $order->info['comments']); + + + + }else { + + #Get the required additional customer details from DB + $nn_customer_id = (isset($_SESSION['customer_id'])) ? $_SESSION['customer_id'] : ''; + $customer_values = $db->Execute("SELECT customers_gender, customers_dob, customers_fax FROM ". TABLE_CUSTOMERS . " WHERE customers_id='". (int)$nn_customer_id ."'"); + + while(!$customer_values->EOF) { + $customer_values->MoveNext(); + } + + list($customer_values->fields['customers_dob'], $extra) = explode(' ', $customer_values->fields['customers_dob']); + + if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status_add_tax_ot'] == 1) { + $totalamount=$order->info['total'] + $order->info['tax']; + } else { + $totalamount=$order->info['total']; + } + $totalamount = number_format($totalamount * $currencies->get_value($order->info['currency']),2); + $amount = str_replace(',', '', $totalamount); + $amount = intval(round($amount*100)); + // echo '
'. $amount =sprintf('%0.2f', $totalamount); + + + if (preg_match('/[^\d\.]/', $amount) or !$amount){ + ### $amount contains some unallowed chars or empty ### + $err = '$amount ('.$amount.') is empty or has a wrong format'; + $order->info['comments'] .= 'Novalnet Error Message : '.$err; + $payment_error_return = 'payment_error='.$this->code; + $messageStack->add_session('checkout_payment', $err . '', 'error'); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + // $amount = preg_replace('/^0+/', '', $amount); + //echo '
'.$amount = sprintf('%0.2f', $amount); + #echo __CLASS__.' : '.$order->info['total']." <=> $amount
"; + $_SESSION['nn_amount_cc'] = $amount; + + $vendor_id = $this->vendor_id; + $auth_code = $this->auth_code; + $product_id = $this->product_id; + $tariff_id = $this->tariff_id; + //$customer_id = $_SESSION['customer_id']; + + $uniqid = uniqid(); + $test_mode = (strtolower(MODULE_PAYMENT_NOVALNET_CC_TEST_MODE) == 'true' or MODULE_PAYMENT_NOVALNET_CC_TEST_MODE == '1')? 1: 0; + + $manual_check_limit = $this->manual_check_limit; + $manual_check_limit = str_replace(',', '', $manual_check_limit); + $manual_check_limit = str_replace('.', '', $manual_check_limit); + + if($manual_check_limit && $amount>=$manual_check_limit) + { + $product_id = $this->product_id2;; + $tariff_id = $this->tariff_id2; + } + + #encode params + list($auth_code, $product_id, $tariff_id, $amount, $test_mode, $uniqid, $hash) = $this->encodeParams($auth_code, $product_id, $tariff_id, $amount, $test_mode, $uniqid); + + $user_ip = $this->getRealIpAddr(); + + $checkout_url = zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'); + + + if(strstr($checkout_url, '?')){ + $checkout_url = str_replace(' ', '', $checkout_url); + if(substr($checkout_url,-1)=='?')$error_url = $checkout_url.'payment_error=novalnet_cc&error=$ERROR_MESSAGE ($STATUS)'; + else $error_url = $checkout_url.'&payment_error=novalnet_cc&error=$ERROR_MESSAGE ($STATUS)'; + + } + + else $error_url = $checkout_url.'?payment_error=novalnet_cc&error=$ERROR_MESSAGE ($STATUS)'; + + $_SESSION['order_status_id_value']=$this->order_status; + $oldreturnurl=zen_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL'); + $old_value=explode(':',$oldreturnurl); + $new_protocol_value=(empty($_SERVER["HTTPS"])) ? 'http' : 'https'; + $return_url=$new_protocol_value.':'.$old_value[1]; + + + $firstname = !empty($order->customer['firstname']) ? $order->customer['firstname'] : $order->billing['firstname']; + $lastname = !empty($order->customer['lastname']) ? $order->customer['lastname'] : $order->billing['lastname']; + $email_address = !empty($order->customer['email_address']) ? $order->customer['email_address'] : $order->billing['email_address']; + $street_address = !empty($order->customer['street_address']) ? $order->customer['street_address'] : $order->billing['street_address']; + $city = !empty($order->customer['city']) ? $order->customer['city'] : $order->billing['city']; + $postcode = !empty($order->customer['postcode']) ? $order->customer['postcode'] : $order->billing['postcode']; + $country_iso_code_2 = !empty($order->customer['country']['iso_code_2']) ? $order->customer['country']['iso_code_2'] : $order->billing['country']['iso_code_2']; + $customer_no = ($customer['customers_status'] != 1) ? $nn_customer_id : MODULE_PAYMENT_NOVALNET_CC_GUEST_USER; + + $data = array('iframe_field'=>( + array( + 'vendor_id' => $vendor_id, + 'product_id' => $product_id, + 'payment_id' => $this->payment_key, + 'tariff_id' => $tariff_id, + 'vendor_authcode' => $auth_code, + 'is_iframe' => '1', + 'uniqid' => $uniqid, + 'hash' => $hash, + 'currency' => $order->info['currency'], + 'amount' => $amount, + 'first_name' => $this->html_to_utf8($firstname), + 'last_name' => $this->html_to_utf8($lastname), + 'gender' => 'u', + 'email' => $email_address, + 'street' => $this->html_to_utf8($street_address), + 'search_in_street' => 1, + 'city' => $this->html_to_utf8($city), + 'zip' => $postcode, + 'country' => $country_iso_code_2, + 'country_code' => $country_iso_code_2, + 'tel' => $order->customer['telephone'], + 'birth_date' => $customer_values->fields['customers_dob'], + 'fax' => $customer['customers_fax'], + 'session' => zen_session_id(), + 'remote_ip' => $user_ip, + 'lang' => MODULE_PAYMENT_NOVALNET_CC_TEXT_LANG, + 'language' => MODULE_PAYMENT_NOVALNET_CC_TEXT_LANG, + 'return_url' => $return_url, + 'return_method' => 'POST', + 'error_return_url' => $error_url, + 'customer_no' => $customer_no, + 'use_utf8' => '1', + 'error_return_method' => 'POST', + 'test_mode' => $test_mode, + 'implementation' => strtoupper($this->implementation) + ))); + + $_SESSION['iFrame_params']= $data; + if(zen_session_id()) zen_redirect(zen_href_link('checkout_novalnet_confirmation', $payment_error_return, 'SSL', true, false)); + else zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + + } + } + + function isPublicIP($value){ + if(!$value || count(explode('.',$value))!=4) return false; + return !preg_match('~^((0|10|172\.16|192\.168|169\.254|255|127\.0)\.)~', $value); + } + + ### get the real Ip Adress of the User ### + function getRealIpAddr(){ + if($this->isPublicIP($_SERVER['HTTP_X_FORWARDED_FOR'])) return $_SERVER['HTTP_X_FORWARDED_FOR']; + if($iplist=explode(',', $_SERVER['HTTP_X_FORWARDED_FOR'])){ + if($this->isPublicIP($iplist[0])) return $iplist[0]; + } + if ($this->isPublicIP($_SERVER['HTTP_CLIENT_IP'])) return $_SERVER['HTTP_CLIENT_IP']; + if ($this->isPublicIP($_SERVER['HTTP_X_CLUSTER_CLIENT_IP'])) return $_SERVER['HTTP_X_CLUSTER_CLIENT_IP']; + if ($this->isPublicIP($_SERVER['HTTP_FORWARDED_FOR']) ) return $_SERVER['HTTP_FORWARDED_FOR']; + + return $_SERVER['REMOTE_ADDR']; + } + + ### Send the order detail to Novalnet ### + function after_process() { + unset($_SESSION['iFrame_params']['iframe_field']); + global $insert_id, $_POST; + $vendor_id = $this->vendor_id; + $auth_code = $this->auth_code; + $product_id = $this->product_id; + $tariff_id = $this->tariff_id; + + $manual_check_limit = $this->manual_check_limit; + $manual_check_limit = str_replace(',', '', $manual_check_limit); + $manual_check_limit = str_replace('.', '', $manual_check_limit); + + if($manual_check_limit && $_SESSION['nn_amount_cc']>=$manual_check_limit) + { + $product_id = $this->product_id2;; + $tariff_id = $this->tariff_id2; + } + if($_POST['tid']){ + ### Pass the Order Reference to paygate ## + $url = 'https://payport.novalnet.de/paygate.jsp'; + $urlparam = 'vendor='.$vendor_id.'&product='.$product_id.'&key='.$this->payment_key.'&tariff='.$tariff_id; + $urlparam .= '&auth_code='.$auth_code.'&status=100&tid='.$_POST['tid'].'&vwz2='.MODULE_PAYMENT_NOVALNET_CC_TEXT_ORDERNO.''.$insert_id.'&vwz3='.MODULE_PAYMENT_NOVALNET_CC_TEXT_ORDERDATE.''.date('Y-m-d H:i:s').'&order_no='.$insert_id; + list($errno, $errmsg, $data) = $this->perform_https_request($url, $urlparam); + $_POST['tid'] = ''; + ### Implement here the Emailversand and further functions, incase if you want to send a own email ### + } + unset($_SESSION['nn_amount_cc']); + return false; + } + + ### Used to display error message details ### + // @return array + function get_error() { + global $HTTP_GET_VARS, $_GET; + if(count($HTTP_GET_VARS)==0 || $HTTP_GET_VARS==''){ + $HTTP_GET_VARS = $_GET; + } + $error = array('title' => MODULE_PAYMENT_NOVALNET_CC_TEXT_ERROR, + 'error' => stripslashes(urldecode($HTTP_GET_VARS['error']))); + return $error; + } + + ### Check to see whether module is installed ### + // @return boolean + function check() { + global $db; + if (!isset($this->_check)) { + $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_NOVALNET_CC_STATUS'"); + $this->_check = $check_query->RecordCount(); + } + return $this->_check; + } + + function install_lang($field_text,$lang) + { + #Allowed Zones + $install_text['allowed_title'] = array('en' => "Allowed zones", + 'de' => "erlaubte Zonen"); + $install_text['allowed_desc'] = array('en' => "Please enter the desired zones separated by comma (Eg: AT, DE) or leave it blank", + 'de' => "Bitte die gewünschten Zonen durch Komma getrennt eingeben (z.B: AT,DE) oder einfach leer lassen"); + #Enable Module + $install_text['enable_title'] = array('en' => "Enable Module", + 'de' => "Modul aktivieren"); + $install_text['enable_desc'] = array('en' => "Do you want to activate the Credit Card of Novalnet AG?", + 'de' => "Wollen Sie das Kreditkarten Modul des Novalnet AG aktivieren?"); + #Test Mode + $install_text['test_title'] = array('en' => "Enable Test Mode:", + 'de' => "Testmodus einschalten"); + $install_text['test_desc'] = array('en' => "Do you want to activate test mode?", + 'de' => "Wollen Sie den Test-Modus aktivieren?"); + #Vendor id + $install_text['vendor_title'] = array('en' => "Novalnet Merchant ID", + 'de' => "Novalnet Händler ID"); + $install_text['vendor_desc'] = array('en' => "Enter your Novalnet Merchant ID ", + 'de' => "Geben Sie Ihre Novalnet Händler-ID ein "); + #Auth Code + $install_text['auth_title'] = array('en' => "Novalnet Merchant Authorisation Code", + 'de' => "Novalnet Authorisierungsschlüssel"); + $install_text['auth_desc'] = array('en' => "Enter your Novalnet Merchant Authorisation code ", + 'de' => "Geben Sie Ihren Novalnet-Authorisierungsschlüssel ein"); + + #Product id + $install_text['product_title'] = array('en' => "Novalnet Product ID", + 'de' => "Novalnet Produkt ID"); + $install_text['product_desc'] = array('en' => "Enter your Novalnet Product ID", + 'de' => "Geben Sie Ihre Novalnet Produkt-ID ein"); + + #Tariff id + $install_text['tariff_title'] = array('en' => "Novalnet Tariff ID", + 'de' => "Novalnet Tarif ID"); + $install_text['tariff_desc'] = array('en' => "Enter your Novalnet Tariff ID ", + 'de' => "Geben Sie Ihre Novalnet Tarif-ID ein"); + + #Booking amount limit + $install_text['booking_title'] = array('en' => "Manual checking amount in cents", + 'de' => "Manuelle Überprüfung des Betrags in Cent"); + $install_text['booking_desc'] = array('en' => "Please enter the amount in cents", + 'de' => "Bitte den Betrag in Cent eingeben"); + + #Second Product id + $install_text['secondproduct_title'] = array('en' => "Second Product ID in Novalnet", + 'de' => "Zweite Novalnet Produkt ID"); + $install_text['secondproduct_desc'] = array('en' => "for the manual checking", + 'de' => "zur manuellen Überprüfung"); + + #Second Tariff id + $install_text['secondtariff_title'] = array('en' => "Second Tariff ID in Novalnet", + 'de' => "Zweite Novalnet Tarif ID"); + $install_text['secondtariff_desc'] = array('en' => "for the manual checking", + 'de' => "zur manuellen Überprüfung"); + + #Enduser info + $install_text['enduser_title'] = array('en' => "Information to the end customer", + 'de' => "Informationen für den Endkunden"); + $install_text['enduser_desc'] = array('en' => "will appear in the payment form", + 'de' => "wird im Bezahlformular erscheinen"); + + #Sortorder display + $install_text['sortorder_title'] = array('en' => "Sort order of display", + 'de' => "Sortierung nach"); + $install_text['sortorder_desc'] = array('en' => "Sort order of display. Lowest is displayed first.", + 'de' => "Sortierung der Anzeige. Der niedrigste Wert wird zuerst angezeigt."); + + #Setorder status display + $install_text['setorderstatus_title'] = array('en' => "Set Order Status", + 'de' => "Bestellungsstatus setzen"); + $install_text['setorderstatus_desc'] = array('en' => "Set the status of orders made with this payment module to this value.", + 'de' => "Setzen Sie den Status von über dieses Zahlungsmodul durchgeführten Bestellungen auf diesen Wert."); + + #Proxy + $install_text['proxy_title'] = array('en' => "Proxy-Server", + 'de' => "Proxy-Server"); + $install_text['proxy_desc'] = array('en' => " If you use a Proxy Server, enter the Proxy Server IP with port here (e.g. www.proxy.de:80).", + 'de' => "Wenn Sie einen Proxy-Server einsetzen, tragen Sie hier Ihre Proxy-IP und den Port ein (z.B. www.proxy.de:80)."); + + #Payment Zone + $install_text['paymnetzone_title'] = array('en' => "Payment Zone", + 'de' => "Zahlungsgebiet"); + $install_text['paymnetzone_desc'] = array('en' => "If a zone is selected then this module is activated only for Selected zone. ", + 'de' => "Wird ein Bereich ausgewählt, dann wird dieses Modul nur für den ausgewählten Bereich aktiviert."); + + #Novalnet Password + $install_text['password_title'] = array('en' => "Novalnet Password", + 'de' => "Novalnet Passwort"); + $install_text['password_desc'] = array('en' => "Enter your Novalnet Password.", + 'de' => "Geben Sie Ihr Novalnet Passwort ein."); + + #Activate Logo Mode + $install_text['logo_title'] = array('en' => "Activate logo mode:", + 'de' => "Aktivieren Sie Logo Modus:"); + $install_text['logo_desc'] = array('en' => "Do you want to activate logo mode?", + 'de' => "Wollen Sie Logo-Modus zu aktivieren?"); + + return $install_text[$field_text][$lang]; + } + + ### Install the payment module and its configuration settings ### + function install() { + global $db; + + $allowed_title = $this->install_lang('allowed_title', DEFAULT_LANGUAGE); + $allowed_desc = $this->install_lang('allowed_desc', DEFAULT_LANGUAGE); + + $enable_title = $this->install_lang('enable_title', DEFAULT_LANGUAGE); + $enable_desc = $this->install_lang('enable_desc', DEFAULT_LANGUAGE); + + $test_title = $this->install_lang('test_title', DEFAULT_LANGUAGE); + $test_desc = $this->install_lang('test_desc', DEFAULT_LANGUAGE); + + $vendor_title = $this->install_lang('vendor_title', DEFAULT_LANGUAGE); + $vendor_desc = $this->install_lang('vendor_desc', DEFAULT_LANGUAGE); + + $auth_title = $this->install_lang('auth_title', DEFAULT_LANGUAGE); + $auth_desc = $this->install_lang('auth_desc', DEFAULT_LANGUAGE); + + $product_title = $this->install_lang('product_title', DEFAULT_LANGUAGE); + $product_desc = $this->install_lang('product_desc', DEFAULT_LANGUAGE); + + $tariff_title = $this->install_lang('tariff_title', DEFAULT_LANGUAGE); + $tariff_desc = $this->install_lang('tariff_desc', DEFAULT_LANGUAGE); + + $booking_title = $this->install_lang('booking_title', DEFAULT_LANGUAGE); + $booking_desc = $this->install_lang('booking_desc', DEFAULT_LANGUAGE); + + $secondproduct_title = $this->install_lang('secondproduct_title', DEFAULT_LANGUAGE); + $secondproduct_desc = $this->install_lang('secondproduct_desc', DEFAULT_LANGUAGE); + + $secondtariff_title = $this->install_lang('secondtariff_title', DEFAULT_LANGUAGE); + $secondtariff_desc = $this->install_lang('secondtariff_desc', DEFAULT_LANGUAGE); + + $enduser_title = $this->install_lang('enduser_title', DEFAULT_LANGUAGE); + $enduser_desc = $this->install_lang('enduser_desc', DEFAULT_LANGUAGE); + + $sortorder_title = $this->install_lang('sortorder_title', DEFAULT_LANGUAGE); + $sortorder_desc = $this->install_lang('sortorder_desc', DEFAULT_LANGUAGE); + + $setorderstatus_title = $this->install_lang('setorderstatus_title', DEFAULT_LANGUAGE); + $setorderstatus_desc = $this->install_lang('setorderstatus_desc', DEFAULT_LANGUAGE); + + $proxy_title = $this->install_lang('proxy_title', DEFAULT_LANGUAGE); + $proxy_desc = $this->install_lang('proxy_desc', DEFAULT_LANGUAGE); + + $paymnetzone_title = $this->install_lang('paymnetzone_title', DEFAULT_LANGUAGE); + $paymnetzone_desc = $this->install_lang('paymnetzone_desc', DEFAULT_LANGUAGE); + + $password_title = $this->install_lang('password_title', DEFAULT_LANGUAGE); + $password_desc = $this->install_lang('password_desc', DEFAULT_LANGUAGE); + + $logo_title = $this->install_lang('logo_title', DEFAULT_LANGUAGE); + $logo_desc = $this->install_lang('logo_desc', DEFAULT_LANGUAGE); + + //$db->Execute("alter table ".TABLE_ORDERS." modify payment_method varchar(250)"); + + // Alter table change text; + + //$db->Execute("alter table ".TABLE_ORDERS." change payment_method payment_method text"); + + /*$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$allowed_title."','MODULE_PAYMENT_NOVALNET_CC_ALLOWED', '','".$allowed_desc."', '6', '0', now())");*/ + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('".$enable_title."', 'MODULE_PAYMENT_NOVALNET_CC_STATUS', 'True', '".$enable_desc."', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('".$test_title."', 'MODULE_PAYMENT_NOVALNET_CC_TEST_MODE', 'True', '".$test_desc."', '6', '1', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$vendor_title."', 'MODULE_PAYMENT_NOVALNET_CC_VENDOR_ID', '', '".$vendor_desc."', '6', '2', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$auth_title."', 'MODULE_PAYMENT_NOVALNET_CC_AUTH_CODE', '', '".$auth_desc."', '6', '3', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$product_title."', 'MODULE_PAYMENT_NOVALNET_CC_PRODUCT_ID', '', '".$product_desc."', '6', '4', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$tariff_title."', 'MODULE_PAYMENT_NOVALNET_CC_TARIFF_ID', '', '".$tariff_desc."', '6', '5', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$booking_title."', 'MODULE_PAYMENT_NOVALNET_CC_MANUAL_CHECK_LIMIT', '', '".$booking_desc."', '6', '6', now())"); + + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$secondproduct_title."', 'MODULE_PAYMENT_NOVALNET_CC_PRODUCT_ID2', '', '".$secondproduct_desc."', '6', '7', now())"); + + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$secondtariff_title."', 'MODULE_PAYMENT_NOVALNET_CC_TARIFF_ID2', '', '".$secondtariff_desc."', '6', '8', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$enduser_title."', 'MODULE_PAYMENT_NOVALNET_CC_BOOK_REF', '', '".$enduser_desc."', '6', '9', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$sortorder_title."', 'MODULE_PAYMENT_NOVALNET_CC_SORT_ORDER', '0', '".$sortorder_desc."', '6', '10', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('".$setorderstatus_title."', 'MODULE_PAYMENT_NOVALNET_CC_ORDER_STATUS_ID', '0', '".$setorderstatus_desc."', '6', '11', 'zen_cfg_pull_down_order_statuses(', 'zen_get_order_status_name', now())"); + + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('".$paymnetzone_title."', 'MODULE_PAYMENT_NOVALNET_CC_ZONE', '0', '".$paymnetzone_desc."', '6', '12', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', now())"); + + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$proxy_title."', 'MODULE_PAYMENT_NOVALNET_CC_PROXY', '', '".$proxy_desc."', '6', '13', now())"); + + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$password_title."', 'MODULE_PAYMENT_NOVALNET_CC_PASSWORD', '', '".$password_desc."', '6', '14', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('".$logo_title."', 'MODULE_PAYMENT_NOVALNET_CC_LOGO_STATUS', 'True', '".$logo_desc."', '6', '15', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + } + + ### Remove the module and all its settings ### + function remove(){ + global $db; + $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); + } + + ### Internal list of configuration keys used for configuration of the module ### + // @return array + function keys() { + return array( 'MODULE_PAYMENT_NOVALNET_CC_LOGO_STATUS','MODULE_PAYMENT_NOVALNET_CC_STATUS', 'MODULE_PAYMENT_NOVALNET_CC_TEST_MODE', 'MODULE_PAYMENT_NOVALNET_CC_VENDOR_ID', 'MODULE_PAYMENT_NOVALNET_CC_AUTH_CODE', 'MODULE_PAYMENT_NOVALNET_CC_PRODUCT_ID', 'MODULE_PAYMENT_NOVALNET_CC_TARIFF_ID', 'MODULE_PAYMENT_NOVALNET_CC_MANUAL_CHECK_LIMIT', 'MODULE_PAYMENT_NOVALNET_CC_PRODUCT_ID2', 'MODULE_PAYMENT_NOVALNET_CC_TARIFF_ID2','MODULE_PAYMENT_NOVALNET_CC_PASSWORD', 'MODULE_PAYMENT_NOVALNET_CC_BOOK_REF', 'MODULE_PAYMENT_NOVALNET_CC_SORT_ORDER', 'MODULE_PAYMENT_NOVALNET_CC_ORDER_STATUS_ID', 'MODULE_PAYMENT_NOVALNET_CC_ZONE', 'MODULE_PAYMENT_NOVALNET_CC_PROXY'); + } + + ### replace the Special German Charectors ### + function ReplaceSpecialGermanChars($string){ + $what = array("ä", "ö", "ü", "Ä", "Ö", "Ãœ", "ß"); + $how = array("ae", "oe", "ue", "Ae", "Oe", "Ue", "ss"); + + $string = str_replace($what, $how, $string); + + return $string; + } + function html_to_utf8 ($data){ + return preg_replace("/\\&\\#([0-9]{3,10})\\;/e", '$this->_html_to_utf8("\\1")', $data); + } + + function _html_to_utf8 ($data){ + if ($data > 127){ + $i = 5; + while (($i--) > 0){ + if ($data != ($a = $data % ($p = pow(64, $i)))){ + $ret = chr(base_convert(str_pad(str_repeat(1, $i + 1), 8, "0"), 2, 10) + (($data - $a) / $p)); + for ($i; $i > 0; $i--) + $ret .= chr(128 + ((($data % pow(64, $i)) - ($data % ($p = pow(64, $i - 1)))) / $p)); + break; + } + } + }else{ + $ret = "&#$data;"; + } + return $ret; + } + + ### Realtime accesspoint for communication to the Novalnet paygate ### + function perform_https_request($nn_url, $urlparam){ + $debug = 0;#set it to 1 if you want to activate the debug mode + + if($debug) print "
perform_https_request: $nn_url
\n\r\n"; + if($debug) print "perform_https_request: $urlparam
\n\r\n"; + + ## some prerquisites for the connection + $ch = curl_init($nn_url); + curl_setopt($ch, CURLOPT_POST, 1); // a non-zero parameter tells the library to do a regular HTTP post. + curl_setopt($ch, CURLOPT_POSTFIELDS, $urlparam); // add POST fields + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); // don't allow redirects + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // decomment it if you want to have effective ssl checking + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // decomment it if you want to have effective ssl checking + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable + curl_setopt($ch, CURLOPT_TIMEOUT, 240); // maximum time, in seconds, that you'll allow the CURL functions to take + + if ($this->proxy){ + curl_setopt($ch, CURLOPT_PROXY, $this->proxy); + } + + ## establish connection + $data = curl_exec($ch); + //$data = $this->ReplaceSpecialGermanChars($data); + + ## determine if there were some problems on cURL execution + $errno = curl_errno($ch); + $errmsg = curl_error($ch); + + ###bug fix for PHP 4.1.0/4.1.2 (curl_errno() returns high negative value in case of successful termination) + if($errno < 0) $errno = 0; + ##bug fix for PHP 4.1.0/4.1.2 + + if($debug){ + print_r(curl_getinfo($ch)); + echo "\n

\n\n\nperform_https_request: cURL error number:" . $errno . "\n
\n\n"; + echo "\n\n\nperform_https_request: cURL error:" . $errmsg . "\n
\n\n"; + } + + #close connection + curl_close($ch); + + ## read and return data from novalnet paygate + if($debug) print "
\n\n" . $data . "\n
\n\n"; + + return array ($errno, $errmsg, $data); + } + + + function debug2($object, $filename, $debug = false) + { + if (!$debug){return;} + $fh = fopen("/tmp/$filename", 'a+'); + fwrite($fh, date('Y-m-d H:i:s').' '.print_r($object, true)); + fwrite($fh, "
\n"); + fclose($fh); + } + + function checkSecurity() { + global $_POST, $order, $insert_id, $messageStack; + + if(strlen(trim($_POST['tid']))==17 && $_POST['status']==100 && $_POST['session']== zen_session_id()){ + #xtc_redirect(zen_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL')); + }else{ + if($_POST['status_desc']){ + $error_status = $_POST['status_desc']; + }else { + $error_status = "There was an error and your payment could not be completed "; + } + $err = $error_status; + #'session missing or returned session is wrong'; + $order->info['comments'] .= '. Novalnet Error Message : '.$err; + $payment_error_return = 'payment_error='.$this->code/*.'&error='.$err*/; + $messageStack->add_session('checkout_payment', $err . '', 'error'); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + } + + function encode($data){ + $data = trim($data); + if ($data == '') return'Error: no data'; + if (!function_exists('base64_encode') or !function_exists('pack') or !function_exists('crc32')){return'Error: func n/a';} + + try { + $crc = sprintf('%u', crc32($data));# %u is a must for ccrc32 returns a signed value + $data = $crc."|".$data; + $data = bin2hex($data.$this->key); + $data = strrev(base64_encode($data)); + }catch (Exception $e){ + echo('Error: '.$e); + } + return $data; + } + + function decode($data) { + + $data = trim($data); + if ($data == '') { + return'Error: no data'; + } + if (!function_exists('base64_decode') or !function_exists('pack') or !function_exists('crc32')){ + return'Error: func n/a'; + } + + try { + $data = base64_decode(strrev($data)); + $data = pack("H".strlen($data), $data); + $data = substr($data, 0, stripos($data, $this->key)); + $pos = strpos($data, "|"); + if ($pos === false) + { + return("Error: CKSum not found!"); + } + $crc = substr($data, 0, $pos); + $value = trim(substr($data, $pos+1)); + if ($crc != sprintf('%u', crc32($value))) { + return("Error; CKSum invalid!"); + } + return $value; + }catch (Exception $e){ + echo('Error: '.$e); + } + } + + function hash($h){ #$h contains encoded data + global $amount_zh; + if (!$h) return'Error: no data'; + if (!function_exists('md5')){return'Error: func n/a';} + return md5($h['auth_code'].$h['product_id'].$h['tariff'].$h['amount'].$h['test_mode'].$h['uniqid'].strrev($this->key)); + } + + function checkHash($request) { + if (!$request) return false; #'Error: no data'; + $h['auth_code'] = $request['vendor_authcode'];#encoded + $h['product_id'] = $request['product_id'];#encoded + $h['tariff'] = $request['tariff_id'];#encoded + $h['amount'] = $request['amount'];#encoded + $h['test_mode'] = $request['test_mode'];#encoded + $h['uniqid'] = $request['uniqid'];#encoded + if ($request['hash2']!= $this->hash($h)){ + return false; + } + return true; + } + + function checkHash4java($request) { + if (!$request) return false; #'Error: no data'; + $h['auth_code'] = $request['auth_code'];#encoded + $h['product_id'] = $request['product_id'];#encoded + $h['tariff'] = $request['tariff_id'];#encoded + $h['amount'] = $request['amount'];#encoded + $h['test_mode'] = $request['test_mode'];#encoded + $h['uniqid'] = $request['uniqid'];#encoded + if ($request['hash2'] != $this->hash($h)){ + return false; + } + return true; + } + + function encode4java($data = '', $func = '') { + + echo"encode4java"; exit; + $salt = 1010; + if (!isset($data) or trim($data) == '' or !$func){ + return'Error: missing arguments: $str and/or $func!'; + } + + if ($func != 'decbin' and $func != 'bindec'){ + return'Error: $func has wrong value!'; + } + + if ($func == 'decbin'){ + return decbin(intval($data) + intval($salt)); + }else{ + return bindec($data) - intval($salt); + } + } + + + function checkReturnedData(){ + if ($_POST['hash2'] && $_SESSION['payment'] == $this->code){ + if (strtoupper($this->implementation) == 'JAVA_PCI'){ + #Java encoded + if( $_POST['vendor_authcode'] != md5(MODULE_PAYMENT_NOVALNET_CC_PCI_AUTH_CODE.strrev($this->key)) ){ + $err = MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_HASH_ERROR.'; wrong auth_code!'; + $payment_error_return = 'payment_error=novalnet_cc_pci&error='.$_POST['status_text'].'; '.$err; + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + $_POST['auth_code'] = MODULE_PAYMENT_NOVALNET_CC_PCI_AUTH_CODE;#todo: check? + $_POST['product_id'] = $this->encode4java($_POST['product_id'], 'bindec'); + $_POST['tariff_id'] = $this->encode4java($_POST['tariff_id'], 'bindec'); + $_POST['amount'] = $this->encode4java($_POST['amount'], 'bindec'); + $_POST['test_mode'] = $this->encode4java($_POST['test_mode'], 'bindec'); + $_POST['uniqid'] = $this->encode4java($_POST['uniqid'], 'bindec'); + + if (!$this->checkHash4java($_POST)){ #PHP encoded + $err = MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_HASH_ERROR; + $payment_error_return = 'payment_error=novalnet_cc_pci&error='.$_POST['status_text'].'; '.$err; + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + }else{ #PHP encoded + if (!$this->checkHash($_POST)){ + $err = MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_HASH_ERROR; + $payment_error_return = 'payment_error=novalnet_cc_pci&error='.$_POST['status_text'].'; '.$err; + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + }else{ + $_POST['test_mode'] = $this->decode($_POST['test_mode']); + } + } + } + } + + function encodeParams($auth_code, $product_id, $tariff_id, $amount, $test_mode, $uniqid){ + if (strtoupper($this->implementation) == 'JAVA_PCI'){ + $uniqid = time();#must ne a long integer + $hash = md5($auth_code.$product_id.$tariff_id.$amount.$test_mode.$uniqid.strrev($this->key)); + $auth_code = md5($auth_code.strrev($this->key)); + $product_id = $this->encode4java($product_id, 'decbin'); + $tariff_id = $this->encode4java($tariff_id, 'decbin'); + $amount = $this->encode4java($amount, 'decbin'); + $test_mode = $this->encode4java($test_mode, 'decbin'); + $uniqid = $this->encode4java($uniqid, 'decbin'); + }else{ + $auth_code = $this->encode($auth_code); + $product_id = $this->encode($product_id); + $tariff_id = $this->encode($tariff_id); + $amount = $this->encode($amount); + $test_mode = $this->encode($test_mode); + $uniqid = $this->encode($uniqid); + $hash = $this->hash(array('auth_code' => $auth_code, 'product_id' => $product_id, 'tariff' => $tariff_id, 'amount' => $amount, 'test_mode' => $test_mode, 'uniqid' => $uniqid)); + } + return array($auth_code, $product_id, $tariff_id, $amount, $test_mode, $uniqid, $hash); + } + +} + /* + flow of functions: + selection -> $order-info['total'] wrong, cause shipping_cost is net + pre_confirmation_check -> $order-info['total'] wrong, cause shipping_cost is net + confirmation -> $order-info['total'] right, cause shipping_cost is gross + process_button -> $order-info['total'] right, cause shipping_cost is gross + before_process -> $order-info['total'] wrong, cause shipping_cost is net + after_process -> $order-info['total'] right, cause shipping_cost is gross + --------------- + */ + +?> diff --git a/includes/modules/payment/novalnet_cc3d.php b/includes/modules/payment/novalnet_cc3d.php new file mode 100644 index 0000000..a7acb3f --- /dev/null +++ b/includes/modules/payment/novalnet_cc3d.php @@ -0,0 +1,832 @@ +vendor_id = trim(MODULE_PAYMENT_NOVALNET_CC3D_VENDOR_ID); + $this->auth_code = trim(MODULE_PAYMENT_NOVALNET_CC3D_AUTH_CODE); + $this->product_id = trim(MODULE_PAYMENT_NOVALNET_CC3D_PRODUCT_ID); + $this->tariff_id = trim(MODULE_PAYMENT_NOVALNET_CC3D_TARIFF_ID); + $this->manual_check_limit = trim(MODULE_PAYMENT_NOVALNET_CC3D_MANUAL_CHECK_LIMIT); + $this->product_id2 = trim(MODULE_PAYMENT_NOVALNET_CC3D_PRODUCT_ID2); + $this->tariff_id2 = trim(MODULE_PAYMENT_NOVALNET_CC3D_TARIFF_ID2); + $this->test_mode = (strtolower(MODULE_PAYMENT_NOVALNET_CC3D_TEST_MODE) == 'true' or MODULE_PAYMENT_NOVALNET_CC3D_TEST_MODE == '1')? 1: 0; + + $this->code = 'novalnet_cc3d'; + $this->title = MODULE_PAYMENT_NOVALNET_CC3D_TEXT_TITLE; + $this->public_title = MODULE_PAYMENT_NOVALNET_CC3D_TEXT_PUBLIC_TITLE; + $this->description = MODULE_PAYMENT_NOVALNET_CC3D_TEXT_DESCRIPTION; + $this->sort_order = MODULE_PAYMENT_NOVALNET_CC3D_SORT_ORDER; + $this->enabled = ((MODULE_PAYMENT_NOVALNET_CC3D_STATUS == 'True') ? true : false); + $this->proxy = MODULE_PAYMENT_NOVALNET_CC3D_PROXY; + + + if(MODULE_PAYMENT_NOVALNET_CC3D_LOGO_STATUS == 'True'){ + $this->public_title = 'Novalnet'.' '.MODULE_PAYMENT_NOVALNET_CC3D_TEXT_PUBLIC_TITLE; + $this->title = 'Novalnet'.' '.MODULE_PAYMENT_NOVALNET_CC3D_TEXT_TITLE; + } + + $this->checkConfigure(); + + if ((int)MODULE_PAYMENT_NOVALNET_CC3D_ORDER_STATUS_ID > 0) { + $this->order_status = MODULE_PAYMENT_NOVALNET_CC3D_ORDER_STATUS_ID; + } + + if (is_object($order)) $this->update_status(); + $this->form_action_url = 'https://payport.novalnet.de/global_pci_payport'; + + if($_POST['session'] && $_SESSION['payment'] == $this->code){ + $this->checkSecurity(); + } + + } + + function checkConfigure() { + if (IS_ADMIN_FLAG == true) { + $this->title = MODULE_PAYMENT_NOVALNET_CC3D_TEXT_TITLE; // Payment module title in Admin + if(MODULE_PAYMENT_NOVALNET_CC3D_LOGO_STATUS == 'True'){ + $this->public_title = 'Novalnet'.' '.MODULE_PAYMENT_NOVALNET_CC3D_TEXT_PUBLIC_TITLE; + $this->title = 'Novalnet'.' '.MODULE_PAYMENT_NOVALNET_CC3D_TEXT_TITLE; + } + if ($this->enabled == 'true' && (!$this->vendor_id || !$this->auth_code || !$this->product_id || !$this->tariff_id )) { + $this->title .= ''.MODULE_PAYMENT_NOVALNET_CC3D_NOT_CONFIGURED.''; + } elseif ($this->test_mode == '1') { + $this->title .= ''.MODULE_PAYMENT_NOVALNET_CC3D_IN_TEST_MODE.''; + } + + } + } + + ### calculate zone matches and flag settings to determine whether this module should display to customers or not ### + function update_status() { + global $order, $db; + + if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_NOVALNET_CC3D_ZONE > 0) ) { + $check_flag = false; + $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_NOVALNET_CC3D_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id"); + while (!$check->EOF) { + if ($check->fields['zone_id'] < 1) { + $check_flag = true; + break; + } elseif ($check->fields['zone_id'] == $order->billing['zone_id']) { + $check_flag = true; + break; + } + $check->MoveNext(); + } + + if ($check_flag == false) { + $this->enabled = false; + } + } + } + + ### JS validation which does error-checking of data-entry if this module is selected for use ### + ### the fields to be cheked are (Bank Owner, Bank Account Number and Bank Code Lengths) ### + ### currently this function is not in use ### + // @return string + function javascript_validation() { + return false; + } + + ### Builds set of input fields for collecting Bankdetail info ### + // @return array + function selection() { + global $xtPrice, $order, $HTTP_POST_VARS, $_POST; + $onFocus = ' onfocus="methodSelect(\'pmt-' . $this->code . '\')"'; + if(count($HTTP_POST_VARS)==0 || $HTTP_POST_VARS=='') $HTTP_POST_VARS = $_POST; + + $card_holder = ''; + if (isset($HTTP_POST_VARS['cc3d_holder'])) {$card_holder = $HTTP_POST_VARS['cc3d_holder'];} + if(!$card_holder and isset($_SESSION['cc3d_holder'])){$card_holder = $_SESSION['cc3d_holder'];} + if(!$card_holder){$card_holder=$order->billing['firstname'].' '.$order->billing['lastname'];} + $cc3d_no = ''; + if (isset($HTTP_POST_VARS['cc3d_no'])) {$cc3d_no = $HTTP_POST_VARS['cc3d_no'];} + if(!$cc3d_no and isset($_SESSION['cc3d_no'])){$cc3d_no = $_SESSION['cc3d_no'];} + $cc3d_exp_month = ''; + if (isset($HTTP_POST_VARS['cc3d_exp_month'])) {$cc3d_exp_month = $HTTP_POST_VARS['cc3d_exp_month'];} + if(!$cc3d_exp_month and isset($_SESSION['cc3d_exp_month'])){$cc3d_exp_month = $_SESSION['cc3d_exp_month'];} + $cc3d_exp_year = ''; + if (isset($HTTP_POST_VARS['cc3d_exp_year'])) {$cc3d_exp_year = $HTTP_POST_VARS['cc3d_exp_year'];} + if(!$cc3d_exp_year and isset($_SESSION['cc3d_exp_year'])){$cc3d_exp_year = $_SESSION['cc3d_exp_year'];} + $cc3d_cvc2 = ''; + if (isset($HTTP_POST_VARS['cc3d_cvc2'])) {$cc3d_cvc2 = $HTTP_POST_VARS['cc3d_cvc2'];} + if(!$cc3d_cvc2 and isset($_SESSION['cc3d_cvc2'])){$cc3d_cvc2 = $_SESSION['cc3d_cvc2'];} + + //$book_info = str_replace('$BOOKINFO', MODULE_PAYMENT_NOVALNET_CC3D_BOOK_REF, MODULE_PAYMENT_NOVALNET_CC3D_TEXT_BOOKING_INFO); + + //$expires_month[] = array ('id' => '', 'text' => MODULE_PAYMENT_NOVALNET_CC3D_TEXT_SELECT); + for ($i = 1; $i < 13; $i ++) + { + $expires_month[] = array ('id' => sprintf('%02d', $i), 'text' => strftime('%B', mktime(0, 0, 0, $i, 1, 2000))); + if($i==3) $expires_month[$i-1]['text']= (MODULE_PAYMENT_NOVALNET_CC3D_TEXT_LANG=='DE')?'März':'March'; + } + + $today = getdate(); + //$expires_year[] = array ('id' => '', 'text' => MODULE_PAYMENT_NOVALNET_CC3D_TEXT_SELECT); + for ($i = $today['year']; $i < $today['year'] + 10; $i ++) + { + $expires_year[] = array ('id' => strftime('%Y', mktime(0, 0, 0, 1, 1, $i)), 'text' => strftime('%Y', mktime(0, 0, 0, 1, 1, $i))); + } + + $selection = array('id' => $this->code, + 'module' => $this->public_title, + 'fields' => array(array('title' => '', 'field' => MODULE_PAYMENT_NOVALNET_CC3D_TEXT_BOOKING_INFO), + array('title' => MODULE_PAYMENT_NOVALNET_CC3D_TEXT_CARD_OWNER, + 'field' => zen_draw_input_field('cc3d_holder', $card_holder, 'id="'.$this->code.'-cc3d_holder"' . $onFocus), + 'tag' => $this->code.'-cc3d_holder'), + array('title' => MODULE_PAYMENT_NOVALNET_CC3D_TEXT_CC_NO, + 'field' => zen_draw_input_field('cc3d_no', '', 'id="' . $this->code . '-cc3d_no"' . $onFocus), + 'tag' => $this->code . '-cc3d_no'), + array('title' => MODULE_PAYMENT_NOVALNET_CC3D_TEXT_EXP_MONTHS_YEARS, + 'field' => zen_draw_pull_down_menu('cc3d_exp_month', $expires_month, 'id="' . $this->code . '-cc3d_exp_month"' . $onFocus)." ".zen_draw_pull_down_menu('cc3d_exp_year', $expires_year, 'id="' . $this->code . '-cc3d_exp_year"' . $onFocus), + 'tag' => $this->code . '-cc3d_exp_month',$this->code . '-cc3d_exp_year'), + /*array('title' => MODULE_PAYMENT_NOVALNET_CC3D_TEXT_EXP_YEAR, + 'field' => zen_draw_pull_down_menu('cc3d_exp_year', $expires_year, $_SESSION['cc3d_exp_year'], 'id="' . $this->code . '-cc3d_exp_year"' . $onFocus), + 'tag' => $this->code . '-cc3d_exp_year'),*/ + array('title' => MODULE_PAYMENT_NOVALNET_CC3D_TEXT_CVC, + 'field' => zen_draw_input_field('cc3d_cvc2', '' /*$cc3d_cvc2*/, 'id="' . $this->code . '-cc3d_cvc2"' . $onFocus. 'maxlength=3').MODULE_PAYMENT_NOVALNET_CC3D_TEXT_CVC2, + 'tag' => $this->code . '-cc3d_cvc2'), + array('title' => '', 'field' => MODULE_PAYMENT_NOVALNET_CC3D_BOOK_REF) + )); + + /*if(function_exists('get_percent')) + { + $selection['module_cost'] = $GLOBALS['ot_payment']->get_percent($this->code); + }*/ + + return $selection; + } + + ### Precheck to Evaluate the Bank Datas ### + function pre_confirmation_check() { + global $HTTP_POST_VARS, $_POST,$messageStack; + if(count($HTTP_POST_VARS)==0 || $HTTP_POST_VARS=='') $HTTP_POST_VARS = $_POST; + + $cc3d_holder = str_replace(' ','',trim($HTTP_POST_VARS['cc3d_holder'])); + $cc3d_no = str_replace(' ','',trim($HTTP_POST_VARS['cc3d_no'])); + $cc3d_cvc2 = str_replace(' ','',trim($HTTP_POST_VARS['cc3d_cvc2'])); + $cc3d_year = $HTTP_POST_VARS['cc3d_exp_year']; + $cc3d_month = $HTTP_POST_VARS['cc3d_exp_month']; + + #echo'
';var_dump($_REQUEST); exit;
+    $error = '';
+	
+		if (!function_exists('curl_init') && ($this->code=='novalnet_cc3d')){
+		ini_set('display_errors', 1);
+		ini_set('error_reporting', E_ALL);
+
+		$error =  MODULE_PAYMENT_NOVALNET_CC3D_CURL_MESSAGE;
+		}
+		
+		if(!$this->vendor_id || !$this->auth_code || !$this->product_id || !$this->tariff_id)
+    {
+      $error = MODULE_PAYMENT_NOVALNET_CC3D_TEXT_JS_NN_MISSING;
+    }
+	elseif(!empty($this->manual_check_limit) && (!$this->product_id2 || !$this->tariff_id2)){
+					$error = MODULE_PAYMENT_NOVALNET_CC3D_TEXT_JS_NN_ID2_MISSING;				
+				}
+    elseif(!$cc3d_holder || (preg_match('/[#%\^<>@$=*!]/',$cc3d_holder))) $error = MODULE_PAYMENT_NOVALNET_CC3D_TEXT_JS_CARD_OWNER;
+	elseif(preg_match('/[^\d]/',$cc3d_no)) $error = MODULE_PAYMENT_NOVALNET_CC3D_TEXT_JS_CC_NO_ERR;
+    elseif(!$cc3d_no || strlen($cc3d_no)code;
+      $messageStack->add_session('checkout_payment', $error . '', 'error');
+      zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false));
+    }
+  }
+
+  ### Display Bank Information on the Checkout Confirmation Page ###
+  // @return array
+  function confirmation() {
+    global $HTTP_POST_VARS, $_POST, $order;
+    $_SESSION['nn_total'] = $order->info['total'];
+    if(count($HTTP_POST_VARS)==0 || $HTTP_POST_VARS=='') $HTTP_POST_VARS = $_POST;
+    
+	$cc_number = $HTTP_POST_VARS['cc3d_no'];
+	$cc3d_exp_month = $HTTP_POST_VARS['cc3d_exp_month'];
+	$cc3d_exp_year = $HTTP_POST_VARS['cc3d_exp_year'];
+	$cvv_cvc = $HTTP_POST_VARS['cc3d_cvc2'];
+
+	if($cc_number) {
+		$cc_number=str_replace(' ','',$cc_number);
+		$cc_number=str_pad(substr($cc_number,0,6),strlen($cc_number)-4,'*',STR_PAD_RIGHT).substr($cc_number,-4);
+	}
+	if($cc3d_exp_month) {
+		$cc3d_exp_month=str_pad('',2,'*',STR_PAD_RIGHT);
+	}
+	if($cc3d_exp_year) {
+	
+		$cc3d_exp_year=str_pad(substr($cc3d_exp_year,0,-2),strlen($cc3d_exp_year),'*',STR_PAD_RIGHT);
+	}
+	if($cvv_cvc) {
+		$cvv_cvc=str_pad('',strlen($cvv_cvc),'*',STR_PAD_RIGHT);
+	}
+	
+    $confirmation = array('fields' => array(array('title' => MODULE_PAYMENT_NOVALNET_CC3D_TEXT_CARD_OWNER,
+                          'field' => $HTTP_POST_VARS['cc3d_holder']),
+                    array('title' => MODULE_PAYMENT_NOVALNET_CC3D_TEXT_CC_NO,
+                          'field' => $cc_number),
+                    array('title' => MODULE_PAYMENT_NOVALNET_CC3D_TEXT_EXP_MONTH,
+						  'field' => $cc3d_exp_month),
+					array('title' => MODULE_PAYMENT_NOVALNET_CC3D_TEXT_EXP_YEAR,
+                          'field' => $cc3d_exp_year),
+					array('title' => MODULE_PAYMENT_NOVALNET_CC3D_TEXT_CVC,
+                          'field' => $cvv_cvc)
+                          ));
+	 
+
+    return $confirmation;
+  }
+
+  ### Build the data and actions to process when the "Submit" button is pressed on the order-confirmation screen. ###
+  ### These are hidden fields on the checkout confirmation page ###
+  // @return string
+  function process_button() {
+    global $HTTP_POST_VARS, $_POST, $order, $currencies, $customer_id, $db;
+    if(count($HTTP_POST_VARS)==0 || $HTTP_POST_VARS=='') $HTTP_POST_VARS = $_POST;
+
+    #Get the required additional customer details from DB
+	$nn_customer_id = (isset($_SESSION['customer_id'])) ? $_SESSION['customer_id'] : '';
+    $customer = $db->Execute("SELECT customers_gender, customers_dob, customers_fax FROM ". TABLE_CUSTOMERS . " WHERE customers_id='". (int)$nn_customer_id."'");
+
+    if ($customer->RecordCount() > 0){
+      $customer = $customer->fields;
+    }
+    list($customer['customers_dob'], $extra) = explode(' ', $customer['customers_dob']);
+
+    if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status_add_tax_ot'] == 1) {
+       $totalamount=$order->info['total'] + $order->info['tax'];
+       } else { 
+       $totalamount=$order->info['total'];
+    }
+	
+	$totalamount = number_format($totalamount * $currencies->get_value($order->info['currency']),2);
+	$amount = str_replace(',', '', $totalamount);
+	$amount = intval(round($amount*100));
+	
+   //$amount =sprintf('%.2f', $totalamount);
+
+    if (preg_match('/[^\d\.]/', $amount) or !$amount){
+      ### $amount contains some unallowed chars or empty ###
+      $err                      = '$amount ('.$amount.') is empty or has a wrong format';
+      $order->info['comments'] .= 'Novalnet Error Message : '.$err;
+      $payment_error_return     = 'payment_error='.$this->code.'&error='.$err;
+      zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false));
+    }
+    // $amount = preg_replace('/^0+/', '', $amount);
+    // $amount = sprintf('%0.2f', $amount);
+    // $amount = str_replace('.', '', $amount);
+    #echo __CLASS__.' : '.$order->info['total']." <=> $amount
"; + $_SESSION['nn_amount_cc3d'] = $amount; + $vendor_id = $this->vendor_id; + $auth_code = $this->auth_code; + $product_id = $this->product_id; + $tariff_id = $this->tariff_id; + //$customer_id = $_SESSION['customer_id']; + + $manual_check_limit = $this->manual_check_limit; + $manual_check_limit = str_replace(',', '', $manual_check_limit); + $manual_check_limit = str_replace('.', '', $manual_check_limit); + + if($manual_check_limit && $amount>=$manual_check_limit) + { + $product_id = $this->product_id2; + $tariff_id = $this->tariff_id2; + } + + $user_ip = $this->getRealIpAddr(); + + $checkout_url = zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'); + + if(strstr($checkout_url, '?')) + { + $checkout_url = str_replace(' ', '', $checkout_url); + if(substr($checkout_url,-1)=='?')$error_url = $checkout_url.'payment_error=novalnet_cc3d&error=$ERROR_MESSAGE ($STATUS)'; + else $error_url = $checkout_url.'&payment_error=novalnet_cc3d&error=$ERROR_MESSAGE ($STATUS)'; + } + else $error_url = $checkout_url.'?payment_error=novalnet_cc3d&error=$ERROR_MESSAGE ($STATUS)'; + + $test_mode = (strtolower(MODULE_PAYMENT_NOVALNET_CC3D_TEST_MODE) == 'true' or MODULE_PAYMENT_NOVALNET_CC3D_TEST_MODE == '1')? 1: 0; + + + $oldreturnurl=zen_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL'); + $old_value=explode(':',$oldreturnurl); + $new_protocol_value=(empty($_SERVER["HTTPS"])) ? 'http' : 'https'; + $return_url=$new_protocol_value.':'.$old_value[1]; + + $firstname = !empty($order->customer['firstname']) ? $order->customer['firstname'] : $order->billing['firstname']; + $lastname = !empty($order->customer['lastname']) ? $order->customer['lastname'] : $order->billing['lastname']; + $email_address = !empty($order->customer['email_address']) ? $order->customer['email_address'] : $order->billing['email_address']; + $street_address = !empty($order->customer['street_address']) ? $order->customer['street_address'] : $order->billing['street_address']; + $city = !empty($order->customer['city']) ? $order->customer['city'] : $order->billing['city']; + $postcode = !empty($order->customer['postcode']) ? $order->customer['postcode'] : $order->billing['postcode']; + $country_iso_code_2 = !empty($order->customer['country']['iso_code_2']) ? $order->customer['country']['iso_code_2'] : $order->billing['country']['iso_code_2']; + $customer_no = ($customer['customers_status'] != 1) ? $nn_customer_id : MODULE_PAYMENT_NOVALNET_CC3D_GUEST_USER; + + $process_button_string = zen_draw_hidden_field('vendor', $vendor_id) . + zen_draw_hidden_field('product', $product_id) . + zen_draw_hidden_field('key', $this->payment_key) . + zen_draw_hidden_field('tariff', $tariff_id) . + zen_draw_hidden_field('auth_code', $auth_code) . + zen_draw_hidden_field('currency', $order->info['currency']) . + zen_draw_hidden_field('amount', $amount) . + zen_draw_hidden_field('first_name', $this->html_to_utf8($firstname)) . + zen_draw_hidden_field('last_name', $this->html_to_utf8($lastname)) . + zen_draw_hidden_field('email', $email_address) . + zen_draw_hidden_field('street', $this->html_to_utf8($street_address)) . + zen_draw_hidden_field('search_in_street', '1') . + zen_draw_hidden_field('city', $this->html_to_utf8($city)) . + zen_draw_hidden_field('zip', $postcode) . + zen_draw_hidden_field('country', $country_iso_code_2) . + zen_draw_hidden_field('country_code', $country_iso_code_2) . + zen_draw_hidden_field('lang', MODULE_PAYMENT_NOVALNET_CC3D_TEXT_LANG) . + zen_draw_hidden_field('language', MODULE_PAYMENT_NOVALNET_CC3D_TEXT_LANG) . + zen_draw_hidden_field('remote_ip', $user_ip) . + zen_draw_hidden_field('tel', $order->customer['telephone']) . + zen_draw_hidden_field('fax', $customer['customers_fax']) . + zen_draw_hidden_field('birth_date', $customer['customers_dob']) . + zen_draw_hidden_field('session', zen_session_id()) . + zen_draw_hidden_field('cc_holder', $this->html_to_utf8($HTTP_POST_VARS['cc3d_holder'])) . + zen_draw_hidden_field('cc_no', $HTTP_POST_VARS['cc3d_no']) . + zen_draw_hidden_field('cc_exp_month', $HTTP_POST_VARS['cc3d_exp_month']) . + zen_draw_hidden_field('cc_exp_year', $HTTP_POST_VARS['cc3d_exp_year']) . + zen_draw_hidden_field('cc_cvc2', $HTTP_POST_VARS['cc3d_cvc2']) . + zen_draw_hidden_field('return_url', $return_url) . + zen_draw_hidden_field('return_method', 'POST') . + zen_draw_hidden_field('error_return_url', $error_url) . + zen_draw_hidden_field('test_mode', $test_mode) . + zen_draw_hidden_field('customer_no', $customer_no) . + zen_draw_hidden_field('use_utf8', '1') . + zen_draw_hidden_field('error_return_method', 'POST'); + + return $process_button_string; + } + + ### Insert the Novalnet Transaction ID in DB ### + function before_process() { + global $HTTP_POST_VARS, $_POST, $order, $currencies, $customer_id,$messageStack; + if($_POST['tid'] && $_POST['status'] == '100'){ + if( $this->order_status ) { + $order->info['order_status'] = $this->order_status; + } + if($_POST['test_mode'] == 1 ){ + $order->info['comments'] .= '
'.MODULE_PAYMENT_NOVALNET_CC3D_TEST_ORDER_MESSAGE.'
'; + } + if(count($HTTP_POST_VARS)==0 || $HTTP_POST_VARS=='') $HTTP_POST_VARS = $_POST; + $order->info['comments'] .= '
'.MODULE_PAYMENT_NOVALNET_CC3D_TID_MESSAGE.$HTTP_POST_VARS['tid'].'

'; + $order->info['comments'] = str_replace(array('', '','','', '
','
','
'), array('', '', '','',"\n", "\n","\n"), $order->info['comments']); + $_SESSION['nn_tid'] = $HTTP_POST_VARS['tid']; + + } + } + + function isPublicIP($value) + { + if(!$value || count(explode('.',$value))!=4) return false; + return !preg_match('~^((0|10|172\.16|192\.168|169\.254|255|127\.0)\.)~', $value); + } + + ### get the real Ip Adress of the User ### + function getRealIpAddr() + { + if($this->isPublicIP($_SERVER['HTTP_X_FORWARDED_FOR'])) return $_SERVER['HTTP_X_FORWARDED_FOR']; + if($iplist=explode(',', $_SERVER['HTTP_X_FORWARDED_FOR'])) + { + if($this->isPublicIP($iplist[0])) return $iplist[0]; + } + if ($this->isPublicIP($_SERVER['HTTP_CLIENT_IP'])) return $_SERVER['HTTP_CLIENT_IP']; + if ($this->isPublicIP($_SERVER['HTTP_X_CLUSTER_CLIENT_IP'])) return $_SERVER['HTTP_X_CLUSTER_CLIENT_IP']; + if ($this->isPublicIP($_SERVER['HTTP_FORWARDED_FOR']) ) return $_SERVER['HTTP_FORWARDED_FOR']; + + return $_SERVER['REMOTE_ADDR']; + } + + ### replace the Special German Charectors ### + function ReplaceSpecialGermanChars($string) + { + $what = array("ä", "ö", "ü", "Ä", "Ö", "Ãœ", "ß"); + $how = array("ae", "oe", "ue", "Ae", "Oe", "Ue", "ss"); + + $string = str_replace($what, $how, $string); + + return $string; + } + + ### Send the order detail to Novalnet ### + function after_process() { + global $order, $customer_id, $insert_id,$db,$_POST; + + $vendor_id = $this->vendor_id; + $auth_code = $this->auth_code; + $product_id = $this->product_id; + $tariff_id = $this->tariff_id; + + $manual_check_limit = $this->manual_check_limit; + $manual_check_limit = str_replace(',', '', $manual_check_limit); + $manual_check_limit = str_replace('.', '', $manual_check_limit); + + if($manual_check_limit && $_SESSION['nn_amount_cc3d']>=$manual_check_limit) + { + $product_id = $this->product_id2;; + $tariff_id = $this->tariff_id2; + } + + if($_SESSION['nn_tid']){ + ### Pass the Order Reference to paygate ## + $url = 'https://payport.novalnet.de/paygate.jsp'; + + $urlparam = 'vendor='.$vendor_id.'&product='.$product_id.'&key='.$this->payment_key.'&tariff='.$tariff_id; + $urlparam .= '&auth_code='.$auth_code.'&status=100&tid='.$_SESSION['nn_tid'].'&reference=BNR-'.$insert_id.'&vwz2='.MODULE_PAYMENT_NOVALNET_CC3D_TEXT_ORDERNO.''.$insert_id.'&vwz3='.MODULE_PAYMENT_NOVALNET_CC3D_TEXT_ORDERDATE.''.date('Y-m-d H:i:s').'&order_no='.$insert_id; + + list($errno, $errmsg, $data) = $this->perform_https_request($url, $urlparam); + $_SESSION['nn_tid'] = ''; + unset($_SESSION['nn_tid']); + unset($_SESSION['nn_amount_cc3d']); + unset($_SESSION['cc3d_holder']); + unset($_SESSION['cc3d_no']); + unset($_SESSION['cc3d_exp_month']); + unset($_SESSION['cc3d_exp_year']); + unset($_SESSION['cc3d_cvc2']); + + ### Implement here the Emailversand and further functions, incase if you want to send a own email ### + } + + return false; + } + + function checkSecurity() { + global $_POST, $order, $insert_id, $messageStack; + + if(strlen(trim($_POST['tid']))==17 && $_POST['status']==100 && $_POST['session']== zen_session_id()){ + #xtc_redirect(zen_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL')); + }else{ + if($_POST['status_text']){ + $error_status = $_POST['status_text']; + }else { + $error_status = "There was an error and your payment could not be completed "; + } + $err = $error_status; + #'session missing or returned session is wrong'; + $order->info['comments'] .= '. Novalnet Error Message : '.$err; + $payment_error_return = 'payment_error='.$this->code; + $messageStack->add_session('checkout_payment', $err . '', 'error'); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + } + ### Used to display error message details ### + // @return array + function get_error() { + global $HTTP_GET_VARS, $_GET; + if(count($HTTP_GET_VARS)==0 || $HTTP_GET_VARS=='') $HTTP_GET_VARS = $_GET; + + $error = array('title' => MODULE_PAYMENT_NOVALNET_CC3D_TEXT_ERROR, 'error' => stripslashes(utf8_decode($HTTP_GET_VARS['error']))); + + return $error; + } + + ### Check to see whether module is installed ### + // @return boolean + function check() { + global $db; + if (!isset($this->_check)) { + $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_NOVALNET_CC3D_STATUS'"); + $this->_check = $check_query->RecordCount(); + } + return $this->_check; + } + + function install_lang($field_text,$lang) + { + #Allowed Zones + $install_text['allowed_title'] = array('en' => "Allowed zones", + 'de' => "erlaubte Zonen"); + $install_text['allowed_desc'] = array('en' => "Please enter the desired zones separated by comma (Eg: AT, DE) or leave it blank", + 'de' => "Bitte die gewünschten Zonen durch Komma getrennt eingeben (z.B: AT,DE) oder einfach leer lassen"); + #Enable Module + $install_text['enable_title'] = array('en' => "Enable Module", + 'de' => "Modul aktivieren"); + $install_text['enable_desc'] = array('en' => "Do you want to activate the Credit Card of Novalnet AG?", + 'de' => "Wollen Sie das Kreditkarten Modul des Novalnet AG aktivieren?"); + #Test Mode + $install_text['test_title'] = array('en' => "Enable Test Mode:", + 'de' => "Testmodus einschalten"); + $install_text['test_desc'] = array('en' => "Do you want to activate test mode?", + 'de' => "Wollen Sie den Test-Modus aktivieren?"); + #Vendor id + $install_text['vendor_title'] = array('en' => "Novalnet Merchant ID", + 'de' => "Novalnet Händler ID"); + $install_text['vendor_desc'] = array('en' => "Enter your Novalnet Merchant ID ", + 'de' => "Geben Sie Ihre Novalnet Händler-ID ein "); + #Auth Code + $install_text['auth_title'] = array('en' => "Novalnet Merchant Authorisation Code", + 'de' => "Novalnet Authorisierungsschlüssel"); + $install_text['auth_desc'] = array('en' => "Enter your Novalnet Merchant Authorisation code ", + 'de' => "Geben Sie Ihren Novalnet-Authorisierungsschlüssel ein"); + + #Product id + $install_text['product_title'] = array('en' => "Novalnet Product ID", + 'de' => "Novalnet Produkt ID"); + $install_text['product_desc'] = array('en' => "Enter your Novalnet Product ID", + 'de' => "Geben Sie Ihre Novalnet Produkt-ID ein"); + + #Tariff id + $install_text['tariff_title'] = array('en' => "Novalnet Tariff ID", + 'de' => "Novalnet Tarif ID"); + $install_text['tariff_desc'] = array('en' => "Enter your Novalnet Tariff ID ", + 'de' => "Geben Sie Ihre Novalnet Tarif-ID ein"); + + #Booking amount limit + $install_text['booking_title'] = array('en' => "Manual checking amount in cents", + 'de' => "Manuelle Überprüfung des Betrags in Cent"); + $install_text['booking_desc'] = array('en' => "Please enter the amount in cents", + 'de' => "Bitte den Betrag in Cent eingeben"); + + #Second Product id + $install_text['secondproduct_title'] = array('en' => "Second Product ID in Novalnet", + 'de' => "Zweite Novalnet Produkt ID"); + $install_text['secondproduct_desc'] = array('en' => "for the manual checking", + 'de' => "zur manuellen Überprüfung"); + + #Second Tariff id + $install_text['secondtariff_title'] = array('en' => "Second Tariff ID in Novalnet", + 'de' => "Zweite Novalnet Tarif ID"); + $install_text['secondtariff_desc'] = array('en' => "for the manual checking", + 'de' => "zur manuellen Überprüfung"); + + #Enduser info + $install_text['enduser_title'] = array('en' => "Information to the end customer", + 'de' => "Informationen für den Endkunden"); + $install_text['enduser_desc'] = array('en' => "will appear in the payment form", + 'de' => "wird im Bezahlformular erscheinen"); + + #Sortorder display + $install_text['sortorder_title'] = array('en' => "Sort order of display", + 'de' => "Sortierung nach"); + $install_text['sortorder_desc'] = array('en' => "Sort order of display. Lowest is displayed first.", + 'de' => "Sortierung der Anzeige. Der niedrigste Wert wird zuerst angezeigt."); + + #Setorder status display + $install_text['setorderstatus_title'] = array('en' => "Set Order Status", + 'de' => "Bestellungsstatus setzen"); + $install_text['setorderstatus_desc'] = array('en' => "Set the status of orders made with this payment module to this value.", + 'de' => "Setzen Sie den Status von über dieses Zahlungsmodul durchgeführten Bestellungen auf diesen Wert."); + + #Proxy + $install_text['proxy_title'] = array('en' => "Proxy-Server", + 'de' => "Proxy-Server"); + $install_text['proxy_desc'] = array('en' => " If you use a Proxy Server, enter the Proxy Server IP with port here (e.g. www.proxy.de:80).", + 'de' => "Wenn Sie einen Proxy-Server einsetzen, tragen Sie hier Ihre Proxy-IP und den Port ein (z.B. www.proxy.de:80)."); + + #Payment Zone + $install_text['paymnetzone_title'] = array('en' => "Payment Zone", + 'de' => "Zahlungsgebiet"); + $install_text['paymnetzone_desc'] = array('en' => "If a zone is selected then this module is activated only for Selected zone. ", + 'de' => "Wird ein Bereich ausgewählt, dann wird dieses Modul nur für den ausgewählten Bereich aktiviert."); + + + #Activate Logo Mode + $install_text['logo_title'] = array('en' => "Activate logo mode:", + 'de' => "Aktivieren Sie Logo Modus:"); + $install_text['logo_desc'] = array('en' => "Do you want to activate logo mode?", + 'de' => "Wollen Sie Logo-Modus zu aktivieren?"); + + return $install_text[$field_text][$lang]; + } + + + ### Install the payment module and its configuration settings ### + function install() { + global $db; + + $allowed_title = $this->install_lang('allowed_title', DEFAULT_LANGUAGE); + $allowed_desc = $this->install_lang('allowed_desc', DEFAULT_LANGUAGE); + + $enable_title = $this->install_lang('enable_title', DEFAULT_LANGUAGE); + $enable_desc = $this->install_lang('enable_desc', DEFAULT_LANGUAGE); + + $test_title = $this->install_lang('test_title', DEFAULT_LANGUAGE); + $test_desc = $this->install_lang('test_desc', DEFAULT_LANGUAGE); + + $vendor_title = $this->install_lang('vendor_title', DEFAULT_LANGUAGE); + $vendor_desc = $this->install_lang('vendor_desc', DEFAULT_LANGUAGE); + + $auth_title = $this->install_lang('auth_title', DEFAULT_LANGUAGE); + $auth_desc = $this->install_lang('auth_desc', DEFAULT_LANGUAGE); + + $product_title = $this->install_lang('product_title', DEFAULT_LANGUAGE); + $product_desc = $this->install_lang('product_desc', DEFAULT_LANGUAGE); + + $tariff_title = $this->install_lang('tariff_title', DEFAULT_LANGUAGE); + $tariff_desc = $this->install_lang('tariff_desc', DEFAULT_LANGUAGE); + + $booking_title = $this->install_lang('booking_title', DEFAULT_LANGUAGE); + $booking_desc = $this->install_lang('booking_desc', DEFAULT_LANGUAGE); + + $secondproduct_title = $this->install_lang('secondproduct_title', DEFAULT_LANGUAGE); + $secondproduct_desc = $this->install_lang('secondproduct_desc', DEFAULT_LANGUAGE); + + $secondtariff_title = $this->install_lang('secondtariff_title', DEFAULT_LANGUAGE); + $secondtariff_desc = $this->install_lang('secondtariff_desc', DEFAULT_LANGUAGE); + + $enduser_title = $this->install_lang('enduser_title', DEFAULT_LANGUAGE); + $enduser_desc = $this->install_lang('enduser_desc', DEFAULT_LANGUAGE); + + $sortorder_title = $this->install_lang('sortorder_title', DEFAULT_LANGUAGE); + $sortorder_desc = $this->install_lang('sortorder_desc', DEFAULT_LANGUAGE); + + $setorderstatus_title = $this->install_lang('setorderstatus_title', DEFAULT_LANGUAGE); + $setorderstatus_desc = $this->install_lang('setorderstatus_desc', DEFAULT_LANGUAGE); + + $proxy_title = $this->install_lang('proxy_title', DEFAULT_LANGUAGE); + $proxy_desc = $this->install_lang('proxy_desc', DEFAULT_LANGUAGE); + + $paymnetzone_title = $this->install_lang('paymnetzone_title', DEFAULT_LANGUAGE); + $paymnetzone_desc = $this->install_lang('paymnetzone_desc', DEFAULT_LANGUAGE); + + $logo_title = $this->install_lang('logo_title', DEFAULT_LANGUAGE); + $logo_desc = $this->install_lang('logo_desc', DEFAULT_LANGUAGE); + + /*$db->Execute("alter table ".TABLE_ORDERS." modify payment_method varchar(250)");*/ + /*$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$allowed_title."','MODULE_PAYMENT_NOVALNET_CC3D_ALLOWED', '','".$allowed_desc."', '6', '0', now())"); */ + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('".$enable_title."', 'MODULE_PAYMENT_NOVALNET_CC3D_STATUS', 'True', '".$enable_desc."', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('".$test_title."', 'MODULE_PAYMENT_NOVALNET_CC3D_TEST_MODE', 'True', '".$test_desc."', '6', '1', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$vendor_title."', 'MODULE_PAYMENT_NOVALNET_CC3D_VENDOR_ID', '', '".$vendor_desc."', '6', '2', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$auth_title."', 'MODULE_PAYMENT_NOVALNET_CC3D_AUTH_CODE', '', '".$auth_desc."', '6', '3', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$product_title."', 'MODULE_PAYMENT_NOVALNET_CC3D_PRODUCT_ID', '', '".$product_desc."', '6', '4', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$tariff_title."', 'MODULE_PAYMENT_NOVALNET_CC3D_TARIFF_ID', '', '".$tariff_desc."', '6', '5', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$booking_title."', 'MODULE_PAYMENT_NOVALNET_CC3D_MANUAL_CHECK_LIMIT', '', '".$booking_desc."', '6', '6', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$secondproduct_title."', 'MODULE_PAYMENT_NOVALNET_CC3D_PRODUCT_ID2', '', '".$secondproduct_desc."', '6', '7', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$secondtariff_title."', 'MODULE_PAYMENT_NOVALNET_CC3D_TARIFF_ID2', '', '".$secondtariff_desc."', '6', '8', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$enduser_title."', 'MODULE_PAYMENT_NOVALNET_CC3D_BOOK_REF', '', '".$enduser_desc."', '6', '9', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$sortorder_title."', 'MODULE_PAYMENT_NOVALNET_CC3D_SORT_ORDER', '0', '".$sortorder_desc."', '6', '10', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('".$setorderstatus_title."', 'MODULE_PAYMENT_NOVALNET_CC3D_ORDER_STATUS_ID', '0', '".$setorderstatus_desc."', '6', '11', 'zen_cfg_pull_down_order_statuses(', 'zen_get_order_status_name', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('".$paymnetzone_title."', 'MODULE_PAYMENT_NOVALNET_CC3D_ZONE', '0', '".$paymnetzone_desc."', '6', '12', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$proxy_title."', 'MODULE_PAYMENT_NOVALNET_CC3D_PROXY', '', '".$proxy_desc."', '6', '13', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('".$logo_title."', 'MODULE_PAYMENT_NOVALNET_CC3D_LOGO_STATUS', 'True', '".$logo_desc."', '6', '14', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + + + + } + + ### Remove the module and all its settings ### + function remove() { + global $db; + $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); + } + + ### Internal list of configuration keys used for configuration of the module ### + // @return array + function keys() { + return array('MODULE_PAYMENT_NOVALNET_CC3D_LOGO_STATUS','MODULE_PAYMENT_NOVALNET_CC3D_STATUS', 'MODULE_PAYMENT_NOVALNET_CC3D_TEST_MODE', 'MODULE_PAYMENT_NOVALNET_CC3D_VENDOR_ID', 'MODULE_PAYMENT_NOVALNET_CC3D_AUTH_CODE', 'MODULE_PAYMENT_NOVALNET_CC3D_PRODUCT_ID', 'MODULE_PAYMENT_NOVALNET_CC3D_TARIFF_ID', 'MODULE_PAYMENT_NOVALNET_CC3D_MANUAL_CHECK_LIMIT', 'MODULE_PAYMENT_NOVALNET_CC3D_PRODUCT_ID2', 'MODULE_PAYMENT_NOVALNET_CC3D_TARIFF_ID2', 'MODULE_PAYMENT_NOVALNET_CC3D_BOOK_REF', 'MODULE_PAYMENT_NOVALNET_CC3D_SORT_ORDER', 'MODULE_PAYMENT_NOVALNET_CC3D_ORDER_STATUS_ID', 'MODULE_PAYMENT_NOVALNET_CC3D_ZONE', 'MODULE_PAYMENT_NOVALNET_CC3D_PROXY'); + } + + function html_to_utf8 ($data) + { + return preg_replace("/\\&\\#([0-9]{3,10})\\;/e", '$this->_html_to_utf8("\\1")', $data); + } + + function _html_to_utf8 ($data) + { + if ($data > 127) + { + $i = 5; + while (($i--) > 0) + { + if ($data != ($a = $data % ($p = pow(64, $i)))) + { + $ret = chr(base_convert(str_pad(str_repeat(1, $i + 1), 8, "0"), 2, 10) + (($data - $a) / $p)); + for ($i; $i > 0; $i--) + $ret .= chr(128 + ((($data % pow(64, $i)) - ($data % ($p = pow(64, $i - 1)))) / $p)); + break; + } + } + } + else + { + $ret = "&#$data;"; + } + return $ret; + } + + ### Realtime accesspoint for communication to the Novalnet paygate ### + function perform_https_request($nn_url, $urlparam) + { + $debug = 0;#set it to 1 if you want to activate the debug mode + + if($debug) print "
perform_https_request: $nn_url
\n\r\n"; + if($debug) print "perform_https_request: $urlparam
\n\r\n"; + + ## some prerquisites for the connection + $ch = curl_init($nn_url); + curl_setopt($ch, CURLOPT_POST, 1); // a non-zero parameter tells the library to do a regular HTTP post. + curl_setopt($ch, CURLOPT_POSTFIELDS, $urlparam); // add POST fields + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); // don't allow redirects + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // decomment it if you want to have effective ssl checking + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // decomment it if you want to have effective ssl checking + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable + curl_setopt($ch, CURLOPT_TIMEOUT, 240); // maximum time, in seconds, that you'll allow the CURL functions to take + if ($this->proxy) {curl_setopt($ch, CURLOPT_PROXY, $this->proxy); } + + ## establish connection + $data = curl_exec($ch); + //$data = $this->ReplaceSpecialGermanChars($data); + + ## determine if there were some problems on cURL execution + $errno = curl_errno($ch); + $errmsg = curl_error($ch); + + ###bug fix for PHP 4.1.0/4.1.2 (curl_errno() returns high negative value in case of successful termination) + if($errno < 0) $errno = 0; + ##bug fix for PHP 4.1.0/4.1.2 + + if($debug) + { + print_r(curl_getinfo($ch)); + echo "\n

\n\n\nperform_https_request: cURL error number:" . $errno . "\n
\n\n"; + echo "\n\n\nperform_https_request: cURL error:" . $errmsg . "\n
\n\n"; + } + + #close connection + curl_close($ch); + + ## read and return data from novalnet paygate + if($debug) print "
\n\n" . $data . "\n
\n\n"; + + return array ($errno, $errmsg, $data); + } + +} +/* +order of functions: +selection -> $order-info['total'] wrong, cause shipping_cost is net +pre_confirmation_check -> $order-info['total'] wrong, cause shipping_cost is net +confirmation -> $order-info['total'] right, cause shipping_cost is gross +process_button -> $order-info['total'] right, cause shipping_cost is gross +before_process -> $order-info['total'] wrong, cause shipping_cost is net +after_process -> $order-info['total'] right, cause shipping_cost is gross +*/ + +?> diff --git a/includes/modules/payment/novalnet_cc_pci.php b/includes/modules/payment/novalnet_cc_pci.php new file mode 100644 index 0000000..75e02ef --- /dev/null +++ b/includes/modules/payment/novalnet_cc_pci.php @@ -0,0 +1,903 @@ +key = trim(MODULE_PAYMENT_NOVALNET_CC_PCI_PASSWORD); #'z2Vw3E4j'; + $this->vendor_id = trim(MODULE_PAYMENT_NOVALNET_CC_PCI_VENDOR_ID); + $this->auth_code = trim(MODULE_PAYMENT_NOVALNET_CC_PCI_AUTH_CODE); + $this->product_id = trim(MODULE_PAYMENT_NOVALNET_CC_PCI_PRODUCT_ID); + $this->tariff_id = trim(MODULE_PAYMENT_NOVALNET_CC_PCI_TARIFF_ID); + $this->manual_check_limit = trim(MODULE_PAYMENT_NOVALNET_CC_PCI_MANUAL_CHECK_LIMIT); + $this->product_id2 = trim(MODULE_PAYMENT_NOVALNET_CC_PCI_PRODUCT_ID2); + $this->tariff_id2 = trim(MODULE_PAYMENT_NOVALNET_CC_PCI_TARIFF_ID2); + $this->test_mode = (strtolower(MODULE_PAYMENT_NOVALNET_CC_PCI_TEST_MODE) == 'true' or MODULE_PAYMENT_NOVALNET_CC_PCI_TEST_MODE == '1')? 1: 0; + + $this->code = 'novalnet_cc_pci'; + $this->title = MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_TITLE; + $this->public_title = MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_PUBLIC_TITLE; + $this->description = MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_DESCRIPTION; + $this->sort_order = MODULE_PAYMENT_NOVALNET_CC_PCI_SORT_ORDER; + $this->enabled = ((MODULE_PAYMENT_NOVALNET_CC_PCI_STATUS == 'True') ? true : false); + $this->proxy = MODULE_PAYMENT_NOVALNET_CC_PCI_PROXY; + $this->implementation = 'PHP_PCI'; + + $this->checkReturnedData(); + + if(MODULE_PAYMENT_NOVALNET_CC_PCI_LOGO_STATUS == 'True'){ + $this->public_title = 'Novalnet'.' '.MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_PUBLIC_TITLE; + $this->title = 'Novalnet'.' '.MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_TITLE; + } + + $this->checkConfigure(); + + if ((int)MODULE_PAYMENT_NOVALNET_CC_PCI_ORDER_STATUS_ID > 0){ + $this->order_status = MODULE_PAYMENT_NOVALNET_CC_PCI_ORDER_STATUS_ID; + } + + if (is_object($order)) $this->update_status(); + $this->form_action_url = 'https://payport.novalnet.de/pci_payport'; + + if($_POST['session'] && $_SESSION['payment'] == $this->code){ + $this->checkSecurity(); + } + } + + function checkConfigure() { + if (IS_ADMIN_FLAG == true) { + $this->title = MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_TITLE; // Payment module title in Admin + if(MODULE_PAYMENT_NOVALNET_CC_PCI_LOGO_STATUS == 'True'){ + $this->public_title = 'Novalnet'.' '.MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_PUBLIC_TITLE; + $this->title = 'Novalnet'.' '.MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_TITLE; + } + if ($this->enabled == 'true' && (!$this->vendor_id || !$this->auth_code || !$this->product_id || !$this->tariff_id || !$this->key )) { + $this->title .= ''.MODULE_PAYMENT_NOVALNET_CC_PCI_NOT_CONFIGURED.''; + } elseif ($this->test_mode == '1') { + $this->title .= ''.MODULE_PAYMENT_NOVALNET_CC_PCI_IN_TEST_MODE.''; + } + + } + } + + ### calculate zone matches and flag settings to determine whether this module should display to customers or not ### + function update_status() { + global $order, $db; + + if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_NOVALNET_CC_PCI_ZONE > 0) ){ + $check_flag = false; + $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_NOVALNET_CC_PCI_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id"); + + while (!$check->EOF){ + if ($check->fields['zone_id'] < 1){ + $check_flag = true; + break; + } + elseif ($check->fields['zone_id'] == $order->billing['zone_id']){ + $check_flag = true; + break; + } + $check->MoveNext(); + } + + if ($check_flag == false){ + $this->enabled = false; + } + } + } + + ### JS validation which does error-checking of data-entry if this module is selected for use ### + ### the fields to be cheked are (Bank Owner, Bank Account Number and Bank Code Lengths) ### + ### currently this function is not in use ### + // @return string + function javascript_validation(){ + return false; + } + + ### Builds set of input fields for collecting Bankdetail info ### + // @return array + function selection(){ + global $order, $HTTP_POST_VARS, $_POST, $HTTP_GET_VARS, $_GET; + $onFocus = ''; + if(count($HTTP_POST_VARS)==0 || $HTTP_POST_VARS=='') $HTTP_POST_VARS = $_POST; + + $selection = array('id' => $this->code, + 'module' => $this->public_title, + 'fields' => array(array('title' => '', 'field' => MODULE_PAYMENT_NOVALNET_INFORMATION_PAYMENT_CC_PCI), + array('title' => '', 'field' => MODULE_PAYMENT_NOVALNET_CC_PCI_BOOK_REF) + )); + + if(function_exists(get_percent)){ + $selection['module_cost'] = $GLOBALS['ot_payment']->get_percent($this->code); + } + + return $selection; + } + + ### Precheck to Evaluate the Bank Datas ### + function pre_confirmation_check(){ + global $HTTP_POST_VARS, $_POST,$messageStack; + if(count($HTTP_POST_VARS)==0 || $HTTP_POST_VARS=='') $HTTP_POST_VARS = $_POST; + #echo'
';var_dump($_REQUEST); exit;
+		$error = '';
+
+		
+			if (!function_exists('curl_init') && ($this->code=='novalnet_cc_pci')){
+			ini_set('display_errors', 1);
+			ini_set('error_reporting', E_ALL);
+			
+			$error =  MODULE_PAYMENT_NOVALNET_CC_PCI_CURL_MESSAGE;
+		}
+
+		  if(!$this->vendor_id || !$this->auth_code || !$this->product_id  || ! $this->tariff_id || !$this->key)
+    {
+      $error = MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_JS_NN_MISSING;
+    }
+    elseif(!empty($this->manual_check_limit) && (!$this->product_id2 || !$this->tariff_id2)){
+					$error = MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_JS_NN_ID2_MISSING;				
+				}
+
+		if($error!=''){
+		  $payment_error_return = 'payment_error=' . $this->code;
+		  $messageStack->add_session('checkout_payment', $error . '', 'error');
+		  zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false));
+		}
+  }
+
+  ### Display Information on the Checkout Confirmation Page ###
+  // @return array
+  function confirmation(){
+		global $HTTP_POST_VARS, $_POST, $order;
+		$_SESSION['nn_total'] = $order->info['total'];
+		if(count($HTTP_POST_VARS)==0 || $HTTP_POST_VARS=='') $HTTP_POST_VARS = $_POST;
+		#print "in confirmation"; exit;
+
+		return $confirmation;
+  }
+
+  ### Build the data and actions to process when the "Submit" button is pressed on the order-confirmation screen. ###
+  ### These are hidden fields on the checkout confirmation page ###
+  // @return string
+  function process_button(){
+		global $HTTP_POST_VARS, $_POST, $order, $db, $currencies, $messageStack, $insert_id;    
+		if(count($HTTP_POST_VARS)==0 || $HTTP_POST_VARS=='') $HTTP_POST_VARS = $_POST;
+
+		#Get the required additional customer details from DB
+		$nn_customer_id = (isset($_SESSION['customer_id'])) ? $_SESSION['customer_id'] : '';
+		$customer_values = $db->Execute("SELECT customers_gender, customers_dob, customers_fax FROM ". TABLE_CUSTOMERS . " WHERE customers_id='". (int)$nn_customer_id."'");
+		
+		while(!$customer_values->EOF){
+		   $customer_values->MoveNext();
+		}
+		
+		list($customer_values->fields['customers_dob'], $extra) = explode(' ', $customer_values->fields['customers_dob']);    
+
+		if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status_add_tax_ot'] == 1){
+		   $totalamount=$order->info['total'] + $order->info['tax'];
+		} else { $totalamount=$order->info['total'];}
+		
+		$totalamount = number_format($totalamount * $currencies->get_value($order->info['currency']),2);
+		$amount = str_replace(',', '', $totalamount);
+		$amount = intval(round($amount*100));
+		
+		//$amount =sprintf('%.2f', $totalamount);
+
+		if (preg_match('/[^\d\.]/', $amount) or !$amount){
+			  ### $amount contains some unallowed chars or empty ###
+			  $err                      = '$amount ('.$amount.') is empty or has a wrong format';
+			  $order->info['comments'] .= 'Novalnet Error Message : '.$err;
+			  $payment_error_return     = 'payment_error='.$this->code;
+			  $messageStack->add_session('checkout_payment', $err . '', 'error');
+			  zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false));      
+		}
+	
+		// $amount = preg_replace('/^0+/', '', $amount);
+		// $amount = sprintf('%0.2f', $amount);
+		// $amount = str_replace('.', '', $amount);
+		#echo __CLASS__.' : '.$order->info['total']." <=> $amount
"; + + $_SESSION['nn_amount_ccpci'] = $amount; + + $vendor_id = $this->vendor_id; + $auth_code = $this->auth_code; + $product_id = $this->product_id; + $tariff_id = $this->tariff_id; + $customer_id = $_SESSION['customer_id']; + + $manual_check_limit = $this->manual_check_limit; + $manual_check_limit = str_replace(',', '', $manual_check_limit); + $manual_check_limit = str_replace('.', '', $manual_check_limit); + + if($manual_check_limit && $amount>=$manual_check_limit) + { + $product_id = $this->product_id2; + $tariff_id = $this->tariff_id2; + } + + $uniqid = uniqid(); + $test_mode = (strtolower(MODULE_PAYMENT_NOVALNET_CC_PCI_TEST_MODE) == 'true' or MODULE_PAYMENT_NOVALNET_CC_PCI_TEST_MODE == '1')? 1: 0; + + + list($auth_code, $product_id, $tariff_id, $amount, $test_mode, $uniqid, $hash) = $this->encodeParams($auth_code, $product_id, $tariff_id, $amount, $test_mode, $uniqid); + + $user_ip = $this->getRealIpAddr(); + + $checkout_url = zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'); + + if(strstr($checkout_url, '?')){ + $checkout_url = str_replace(' ', '', $checkout_url); + if(substr($checkout_url,-1)=='?')$error_url = $checkout_url.'payment_error=novalnet_cc_pci&error=$ERROR_MESSAGE ($STATUS)'; + else $error_url = $checkout_url.'&payment_error=novalnet_cc_pci&error=$ERROR_MESSAGE ($STATUS)'; + }else $error_url = $checkout_url.'?payment_error=novalnet_cc_pci&error=$ERROR_MESSAGE ($STATUS)'; + + $_SESSION['order_status_id_value']=$this->order_status; + $oldreturnurl=zen_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL'); + $old_value=explode(':',$oldreturnurl); + $new_protocol_value=(empty($_SERVER["HTTPS"])) ? 'http' : 'https'; + $return_url=$new_protocol_value.':'.$old_value[1]; + + $firstname = !empty($order->customer['firstname']) ? $order->customer['firstname'] : $order->billing['firstname']; + $lastname = !empty($order->customer['lastname']) ? $order->customer['lastname'] : $order->billing['lastname']; + $email_address = !empty($order->customer['email_address']) ? $order->customer['email_address'] : $order->billing['email_address']; + $street_address = !empty($order->customer['street_address']) ? $order->customer['street_address'] : $order->billing['street_address']; + $city = !empty($order->customer['city']) ? $order->customer['city'] : $order->billing['city']; + $postcode = !empty($order->customer['postcode']) ? $order->customer['postcode'] : $order->billing['postcode']; + $country_iso_code_2 = !empty($order->customer['country']['iso_code_2']) ? $order->customer['country']['iso_code_2'] : $order->billing['country']['iso_code_2']; + $customer_no = ($customer['customers_status'] != 1) ? $nn_customer_id : MODULE_PAYMENT_NOVALNET_CC_PCI_GUEST_USER; + + + $process_button_string = zen_draw_hidden_field('vendor_id', $vendor_id) . + zen_draw_hidden_field('product_id', $product_id) . + zen_draw_hidden_field('payment_id', $this->payment_key) . + zen_draw_hidden_field('tariff_id', $tariff_id) . + zen_draw_hidden_field('vendor_authcode', $auth_code) . + zen_draw_hidden_field('currency', $order->info['currency']) . + zen_draw_hidden_field('amount', $amount) . + zen_draw_hidden_field('hash', $hash) . + zen_draw_hidden_field('uniqid', $uniqid) . + zen_draw_hidden_field('gender', 'u') . + zen_draw_hidden_field('first_name', $this->html_to_utf8($firstname)) . + zen_draw_hidden_field('last_name', $this->html_to_utf8(lastname)) . + zen_draw_hidden_field('email', $email_address) . + zen_draw_hidden_field('street', $this->html_to_utf8($street_address)) . + #zen_draw_hidden_field('house_no', '2') . + zen_draw_hidden_field('search_in_street', '1') . + zen_draw_hidden_field('city', $this->html_to_utf8($order->customer['city'])) . + zen_draw_hidden_field('zip', $order->customer['postcode']) . + zen_draw_hidden_field('country', $country_iso_code_2) . + zen_draw_hidden_field('country_code', $country_iso_code_2) . + zen_draw_hidden_field('lang', MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_LANG) . + zen_draw_hidden_field('language', MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_LANG) . + zen_draw_hidden_field('remote_ip', $user_ip) . + zen_draw_hidden_field('tel', $order->customer['telephone']) . + zen_draw_hidden_field('fax', $customer['customers_fax']) . + zen_draw_hidden_field('birth_date', $customer_values->fields['customers_dob']) . + zen_draw_hidden_field('session', zen_session_id()) . + zen_draw_hidden_field('return_url', $return_url) . + zen_draw_hidden_field('return_method', 'POST') . + zen_draw_hidden_field('error_return_url', $error_url) . + zen_draw_hidden_field('test_mode', $test_mode) . + zen_draw_hidden_field('error_return_method', 'POST'). + zen_draw_hidden_field('implementation', strtoupper($this->implementation)) . + zen_draw_hidden_field('proxy', $this->proxy) . + zen_draw_hidden_field('customer_no', $customer_no) . + zen_draw_hidden_field('use_utf8', '1'); + + + return $process_button_string; + } + + ### Insert the Novalnet Transaction ID in DB ### + function before_process(){ + global $_POST, $order; + + if($_POST['tid'] && $_POST['status'] == '100'){ + if( $this->order_status ) { + $order->info['order_status'] = $this->order_status; + } + + if ($_POST['test_mode'] == 1){ + $order->info['comments'] .= '
'.MODULE_PAYMENT_NOVALNET_CC_PCI_TEST_ORDER_MESSAGE.'
'; + } + $order->info['comments'] .= '
'.MODULE_PAYMENT_NOVALNET_CC_PCI_TID_MESSAGE.$_POST['tid'].'

'; + $order->info['comments'] = str_replace(array('', '','','', '
','
','
'), array('', '', '','',"\n", "\n","\n"), $order->info['comments']); + + } + } + + function isPublicIP($value){ + if(!$value || count(explode('.',$value))!=4) return false; + return !preg_match('~^((0|10|172\.16|192\.168|169\.254|255|127\.0)\.)~', $value); + } + + ### get the real Ip Adress of the User ### + function getRealIpAddr(){ + if($this->isPublicIP($_SERVER['HTTP_X_FORWARDED_FOR'])) return $_SERVER['HTTP_X_FORWARDED_FOR']; + if($iplist=explode(',', $_SERVER['HTTP_X_FORWARDED_FOR'])) + { + if($this->isPublicIP($iplist[0])) return $iplist[0]; + } + if ($this->isPublicIP($_SERVER['HTTP_CLIENT_IP'])) return $_SERVER['HTTP_CLIENT_IP']; + if ($this->isPublicIP($_SERVER['HTTP_X_CLUSTER_CLIENT_IP'])) return $_SERVER['HTTP_X_CLUSTER_CLIENT_IP']; + if ($this->isPublicIP($_SERVER['HTTP_FORWARDED_FOR']) ) return $_SERVER['HTTP_FORWARDED_FOR']; + + return $_SERVER['REMOTE_ADDR']; + } + + ### Send the order detail to Novalnet ### + function after_process(){ + global $order, $customer_id, $insert_id,$db,$_POST; + + $vendor_id = $this->vendor_id; + $auth_code = $this->auth_code; + $product_id = $this->product_id; + $tariff_id = $this->tariff_id; + + $manual_check_limit = $this->manual_check_limit; + $manual_check_limit = str_replace(',', '', $manual_check_limit); + $manual_check_limit = str_replace('.', '', $manual_check_limit); + + if($manual_check_limit && $_SESSION['nn_amount_ccpci']>=$manual_check_limit) + { + $product_id = $this->product_id2;; + $tariff_id = $this->tariff_id2; + } + if($_POST['tid'] != ''){ + ### Pass the Order Reference to paygate ## + $url = 'https://payport.novalnet.de/paygate.jsp'; + $urlparam = 'vendor='.$vendor_id.'&product='.$product_id.'&key='.$this->payment_key.'&tariff='.$tariff_id; + $urlparam .= '&auth_code='.$auth_code.'&status=100&tid='.$_POST['tid'].'&vwz2='.MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_ORDERNO.''.$insert_id.'&vwz3='.MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_ORDERDATE.''.date('Y-m-d H:i:s').'&order_no='.$insert_id; + list($errno, $errmsg, $data) = $this->perform_https_request($url, $urlparam); + $_POST['tid'] = ''; + ### Implement here the Emailversand and further functions, incase if you want to send a own email ### + } + unset($_SESSION['nn_amount_ccpci']); + return false; + } + + ### Used to display error message details ### + // @return array + function get_error(){ + global $HTTP_GET_VARS, $_GET; + if(count($HTTP_GET_VARS)==0 || $HTTP_GET_VARS=='') $HTTP_GET_VARS = $_GET; + + #$error = array('title' => MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_ERROR, + # 'error' => stripslashes(urldecode($HTTP_GET_VARS['error']))); + #print $HTTP_GET_VARS['error']; exit; + $error = array('title' => MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_ERROR, 'error' => stripslashes(utf8_decode($HTTP_GET_VARS['error']))); + + return $error; + } + + ### Check to see whether module is installed ### + // @return boolean + function check() { + global $db; + if (!isset($this->_check)){ + $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_NOVALNET_CC_PCI_STATUS'"); + $this->_check = $check_query->RecordCount(); + } + return $this->_check; + } + + function install_lang($field_text,$lang) + { + #Allowed Zones + $install_text['allowed_title'] = array('en' => "Allowed zones", + 'de' => "erlaubte Zonen"); + $install_text['allowed_desc'] = array('en' => "Please enter the desired zones separated by comma (Eg: AT, DE) or leave it blank", + 'de' => "Bitte die gewünschten Zonen durch Komma getrennt eingeben (z.B: AT,DE) oder einfach leer lassen"); + #Enable Module + $install_text['enable_title'] = array('en' => "Enable Module", + 'de' => "Modul aktivieren"); + $install_text['enable_desc'] = array('en' => "Do you want to activate the Credit Card of Novalnet AG?", + 'de' => "Wollen Sie das Kreditkarten Modul des Novalnet AG aktivieren?"); + #Test Mode + $install_text['test_title'] = array('en' => "Enable Test Mode:", + 'de' => "Testmodus einschalten"); + $install_text['test_desc'] = array('en' => "Do you want to activate test mode?", + 'de' => "Wollen Sie den Test-Modus aktivieren?"); + #Vendor id + $install_text['vendor_title'] = array('en' => "Novalnet Merchant ID", + 'de' => "Novalnet Händler ID"); + $install_text['vendor_desc'] = array('en' => "Enter your Novalnet Merchant ID ", + 'de' => "Geben Sie Ihre Novalnet Händler-ID ein "); + #Auth Code + $install_text['auth_title'] = array('en' => "Novalnet Merchant Authorisation Code", + 'de' => "Novalnet Authorisierungsschlüssel"); + $install_text['auth_desc'] = array('en' => "Enter your Novalnet Merchant Authorisation code ", + 'de' => "Geben Sie Ihren Novalnet-Authorisierungsschlüssel ein"); + + #Product id + $install_text['product_title'] = array('en' => "Novalnet Product ID", + 'de' => "Novalnet Produkt ID"); + $install_text['product_desc'] = array('en' => "Enter your Novalnet Product ID", + 'de' => "Geben Sie Ihre Novalnet Produkt-ID ein"); + + #Tariff id + $install_text['tariff_title'] = array('en' => "Novalnet Tariff ID", + 'de' => "Novalnet Tarif ID"); + $install_text['tariff_desc'] = array('en' => "Enter your Novalnet Tariff ID ", + 'de' => "Geben Sie Ihre Novalnet Tarif-ID ein"); + + #Booking amount limit + $install_text['booking_title'] = array('en' => "Manual checking amount in cents", + 'de' => "Manuelle Überprüfung des Betrags in Cent"); + $install_text['booking_desc'] = array('en' => "Please enter the amount in cents", + 'de' => "Bitte den Betrag in Cent eingeben"); + + #Second Product id + $install_text['secondproduct_title'] = array('en' => "Second Product ID in Novalnet", + 'de' => "Zweite Novalnet Produkt ID"); + $install_text['secondproduct_desc'] = array('en' => "for the manual checking", + 'de' => "zur manuellen Überprüfung"); + + #Second Tariff id + $install_text['secondtariff_title'] = array('en' => "Second Tariff ID in Novalnet", + 'de' => "Zweite Novalnet Tarif ID"); + $install_text['secondtariff_desc'] = array('en' => "for the manual checking", + 'de' => "zur manuellen Überprüfung"); + + #Enduser info + $install_text['enduser_title'] = array('en' => "Information to the end customer", + 'de' => "Informationen für den Endkunden"); + $install_text['enduser_desc'] = array('en' => "will appear in the payment form", + 'de' => "wird im Bezahlformular erscheinen"); + + #Sortorder display + $install_text['sortorder_title'] = array('en' => "Sort order of display", + 'de' => "Sortierung nach"); + $install_text['sortorder_desc'] = array('en' => "Sort order of display. Lowest is displayed first.", + 'de' => "Sortierung der Anzeige. Der niedrigste Wert wird zuerst angezeigt."); + + #Setorder status display + $install_text['setorderstatus_title'] = array('en' => "Set Order Status", + 'de' => "Bestellungsstatus setzen"); + $install_text['setorderstatus_desc'] = array('en' => "Set the status of orders made with this payment module to this value.", + 'de' => "Setzen Sie den Status von über dieses Zahlungsmodul durchgeführten Bestellungen auf diesen Wert."); + + #Proxy + $install_text['proxy_title'] = array('en' => "Proxy-Server", + 'de' => "Proxy-Server"); + $install_text['proxy_desc'] = array('en' => " If you use a Proxy Server, enter the Proxy Server IP with port here (e.g. www.proxy.de:80).", + 'de' => "Wenn Sie einen Proxy-Server einsetzen, tragen Sie hier Ihre Proxy-IP und den Port ein (z.B. www.proxy.de:80)."); + + #Payment Zone + $install_text['paymnetzone_title'] = array('en' => "Payment Zone", + 'de' => "Zahlungsgebiet"); + $install_text['paymnetzone_desc'] = array('en' => "If a zone is selected then this module is activated only for Selected zone. ", + 'de' => "Wird ein Bereich ausgewählt, dann wird dieses Modul nur für den ausgewählten Bereich aktiviert."); + + #Novalnet Password + $install_text['password_title'] = array('en' => "Novalnet Password", + 'de' => "Novalnet Passwort"); + $install_text['password_desc'] = array('en' => "Enter your Novalnet Password.", + 'de' => "Geben Sie Ihr Novalnet Passwort ein."); + + #Activate Logo Mode + $install_text['logo_title'] = array('en' => "Activate logo mode:", + 'de' => "Aktivieren Sie Logo Modus:"); + $install_text['logo_desc'] = array('en' => "Do you want to activate logo mode?", + 'de' => "Wollen Sie Logo-Modus zu aktivieren?"); + + return $install_text[$field_text][$lang]; + } + + ### Install the payment module and its configuration settings ### + function install() { + global $db; + //echo DEFAULT_LANGUAGE; + $allowed_title = $this->install_lang('allowed_title', DEFAULT_LANGUAGE); + $allowed_desc = $this->install_lang('allowed_desc', DEFAULT_LANGUAGE); + + $enable_title = $this->install_lang('enable_title', DEFAULT_LANGUAGE); + $enable_desc = $this->install_lang('enable_desc', DEFAULT_LANGUAGE); + + $test_title = $this->install_lang('test_title', DEFAULT_LANGUAGE); + $test_desc = $this->install_lang('test_desc', DEFAULT_LANGUAGE); + + $vendor_title = $this->install_lang('vendor_title', DEFAULT_LANGUAGE); + $vendor_desc = $this->install_lang('vendor_desc', DEFAULT_LANGUAGE); + + $auth_title = $this->install_lang('auth_title', DEFAULT_LANGUAGE); + $auth_desc = $this->install_lang('auth_desc', DEFAULT_LANGUAGE); + + $product_title = $this->install_lang('product_title', DEFAULT_LANGUAGE); + $product_desc = $this->install_lang('product_desc', DEFAULT_LANGUAGE); + + $tariff_title = $this->install_lang('tariff_title', DEFAULT_LANGUAGE); + $tariff_desc = $this->install_lang('tariff_desc', DEFAULT_LANGUAGE); + + $booking_title = $this->install_lang('booking_title', DEFAULT_LANGUAGE); + $booking_desc = $this->install_lang('booking_desc', DEFAULT_LANGUAGE); + + $secondproduct_title = $this->install_lang('secondproduct_title', DEFAULT_LANGUAGE); + $secondproduct_desc = $this->install_lang('secondproduct_desc', DEFAULT_LANGUAGE); + + $secondtariff_title = $this->install_lang('secondtariff_title', DEFAULT_LANGUAGE); + $secondtariff_desc = $this->install_lang('secondtariff_desc', DEFAULT_LANGUAGE); + + $enduser_title = $this->install_lang('enduser_title', DEFAULT_LANGUAGE); + $enduser_desc = $this->install_lang('enduser_desc', DEFAULT_LANGUAGE); + + $sortorder_title = $this->install_lang('sortorder_title', DEFAULT_LANGUAGE); + $sortorder_desc = $this->install_lang('sortorder_desc', DEFAULT_LANGUAGE); + + $setorderstatus_title = $this->install_lang('setorderstatus_title', DEFAULT_LANGUAGE); + $setorderstatus_desc = $this->install_lang('setorderstatus_desc', DEFAULT_LANGUAGE); + + $proxy_title = $this->install_lang('proxy_title', DEFAULT_LANGUAGE); + $proxy_desc = $this->install_lang('proxy_desc', DEFAULT_LANGUAGE); + + $paymnetzone_title = $this->install_lang('paymnetzone_title', DEFAULT_LANGUAGE); + $paymnetzone_desc = $this->install_lang('paymnetzone_desc', DEFAULT_LANGUAGE); + + $password_title = $this->install_lang('password_title', DEFAULT_LANGUAGE); + $password_desc = $this->install_lang('password_desc', DEFAULT_LANGUAGE); + + $logo_title = $this->install_lang('logo_title', DEFAULT_LANGUAGE); + $logo_desc = $this->install_lang('logo_desc', DEFAULT_LANGUAGE); + + + //$db->Execute("alter table ".TABLE_ORDERS." change payment_method payment_method text"); + + /*$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$allowed_title."','MODULE_PAYMENT_NOVALNET_CC_PCI_ALLOWED', '','".$allowed_desc."', '6', '0', now())");*/ + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('".$enable_title."', 'MODULE_PAYMENT_NOVALNET_CC_PCI_STATUS', 'True', '".$enable_desc."', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('".$test_title."', 'MODULE_PAYMENT_NOVALNET_CC_PCI_TEST_MODE', 'True', '".$test_desc."', '6', '1', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$vendor_title."', 'MODULE_PAYMENT_NOVALNET_CC_PCI_VENDOR_ID', '', '".$vendor_desc."', '6', '2', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$auth_title."', 'MODULE_PAYMENT_NOVALNET_CC_PCI_AUTH_CODE', '', '".$auth_desc."', '6', '3', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$product_title."', 'MODULE_PAYMENT_NOVALNET_CC_PCI_PRODUCT_ID', '', '".$product_desc."', '6', '4', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$tariff_title."', 'MODULE_PAYMENT_NOVALNET_CC_PCI_TARIFF_ID', '', '".$tariff_desc."', '6', '5', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$booking_title."', 'MODULE_PAYMENT_NOVALNET_CC_PCI_MANUAL_CHECK_LIMIT', '', '".$booking_desc."', '6', '6', now())"); + + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$secondproduct_title."', 'MODULE_PAYMENT_NOVALNET_CC_PCI_PRODUCT_ID2', '', '".$secondproduct_desc."', '6', '7', now())"); + + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$secondtariff_title."', 'MODULE_PAYMENT_NOVALNET_CC_PCI_TARIFF_ID2', '', '".$secondtariff_desc."', '6', '8', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$enduser_title."', 'MODULE_PAYMENT_NOVALNET_CC_PCI_BOOK_REF', '', '".$enduser_desc."', '6', '9', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$sortorder_title."', 'MODULE_PAYMENT_NOVALNET_CC_PCI_SORT_ORDER', '0', '".$sortorder_desc."', '6', '10', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('".$setorderstatus_title."', 'MODULE_PAYMENT_NOVALNET_CC_PCI_ORDER_STATUS_ID', '0', '".$setorderstatus_desc."', '6', '11', 'zen_cfg_pull_down_order_statuses(', 'zen_get_order_status_name', now())"); + + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('".$paymnetzone_title."', 'MODULE_PAYMENT_NOVALNET_CC_PCI_ZONE', '0', '".$paymnetzone_desc."', '6', '12', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', now())"); + + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$proxy_title."', 'MODULE_PAYMENT_NOVALNET_CC_PCI_PROXY', '', '".$proxy_desc."', '6', '13', now())"); + + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$password_title."', 'MODULE_PAYMENT_NOVALNET_CC_PCI_PASSWORD', '', '".$password_desc."', '6', '14', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('".$logo_title."', 'MODULE_PAYMENT_NOVALNET_CC_PCI_LOGO_STATUS', 'True', '".$logo_desc."', '6', '15', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + + + } + + ### Remove the module and all its settings ### + function remove(){ + global $db; + $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); + } + + ### Internal list of configuration keys used for configuration of the module ### + // @return array + function keys() { + return array('MODULE_PAYMENT_NOVALNET_CC_PCI_LOGO_STATUS','MODULE_PAYMENT_NOVALNET_CC_PCI_STATUS', 'MODULE_PAYMENT_NOVALNET_CC_PCI_TEST_MODE', 'MODULE_PAYMENT_NOVALNET_CC_PCI_VENDOR_ID', 'MODULE_PAYMENT_NOVALNET_CC_PCI_AUTH_CODE', 'MODULE_PAYMENT_NOVALNET_CC_PCI_PRODUCT_ID', 'MODULE_PAYMENT_NOVALNET_CC_PCI_TARIFF_ID', 'MODULE_PAYMENT_NOVALNET_CC_PCI_MANUAL_CHECK_LIMIT', 'MODULE_PAYMENT_NOVALNET_CC_PCI_PRODUCT_ID2', 'MODULE_PAYMENT_NOVALNET_CC_PCI_TARIFF_ID2','MODULE_PAYMENT_NOVALNET_CC_PCI_PASSWORD', 'MODULE_PAYMENT_NOVALNET_CC_PCI_BOOK_REF', 'MODULE_PAYMENT_NOVALNET_CC_PCI_SORT_ORDER', 'MODULE_PAYMENT_NOVALNET_CC_PCI_ORDER_STATUS_ID', 'MODULE_PAYMENT_NOVALNET_CC_PCI_ZONE', 'MODULE_PAYMENT_NOVALNET_CC_PCI_PROXY'); + } + + ### replace the Special German Charectors ### + function ReplaceSpecialGermanChars($string){ + $what = array("ä", "ö", "ü", "Ä", "Ö", "Ãœ", "ß"); + $how = array("ae", "oe", "ue", "Ae", "Oe", "Ue", "ss"); + + $string = str_replace($what, $how, $string); + + return $string; + } + + function html_to_utf8 ($data){ + return preg_replace("/\\&\\#([0-9]{3,10})\\;/e", '$this->_html_to_utf8("\\1")', $data); + } + + function _html_to_utf8 ($data){ + if ($data > 127){ + $i = 5; + while (($i--) > 0){ + if ($data != ($a = $data % ($p = pow(64, $i)))){ + $ret = chr(base_convert(str_pad(str_repeat(1, $i + 1), 8, "0"), 2, 10) + (($data - $a) / $p)); + for ($i; $i > 0; $i--) + $ret .= chr(128 + ((($data % pow(64, $i)) - ($data % ($p = pow(64, $i - 1)))) / $p)); + break; + } + } + }else{ + $ret = "&#$data;"; + } + return $ret; + } + + ### Realtime accesspoint for communication to the Novalnet paygate ### + function perform_https_request($nn_url, $urlparam){ + $debug = 0;#set it to 1 if you want to activate the debug mode + + if($debug) print "
perform_https_request: $nn_url
\n\r\n"; + if($debug) print "perform_https_request: $urlparam
\n\r\n"; + + ## some prerquisites for the connection + $ch = curl_init($nn_url); + curl_setopt($ch, CURLOPT_POST, 1); // a non-zero parameter tells the library to do a regular HTTP post. + curl_setopt($ch, CURLOPT_POSTFIELDS, $urlparam); // add POST fields + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); // don't allow redirects + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // decomment it if you want to have effective ssl checking + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // decomment it if you want to have effective ssl checking + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable + curl_setopt($ch, CURLOPT_TIMEOUT, 240); // maximum time, in seconds, that you'll allow the CURL functions to take + + if ($this->proxy){ + curl_setopt($ch, CURLOPT_PROXY, $this->proxy); + } + + ## establish connection + $data = curl_exec($ch); + //$data = $this->ReplaceSpecialGermanChars($data); + + ## determine if there were some problems on cURL execution + $errno = curl_errno($ch); + $errmsg = curl_error($ch); + + ###bug fix for PHP 4.1.0/4.1.2 (curl_errno() returns high negative value in case of successful termination) + if($errno < 0) $errno = 0; + ##bug fix for PHP 4.1.0/4.1.2 + + if($debug){ + print_r(curl_getinfo($ch)); + echo "\n

\n\n\nperform_https_request: cURL error number:" . $errno . "\n
\n\n"; + echo "\n\n\nperform_https_request: cURL error:" . $errmsg . "\n
\n\n"; + } + + #close connection + curl_close($ch); + + ## read and return data from novalnet paygate + if($debug) print "
\n\n" . $data . "\n
\n\n"; + + return array ($errno, $errmsg, $data); + } + + function debug2($object, $filename, $debug = false){ + if (!$debug){return;} + $fh = fopen("/tmp/$filename", 'a+'); + fwrite($fh, date('Y-m-d H:i:s').' '.print_r($object, true)); + fwrite($fh, "
\n"); + fclose($fh); + } + + function checkSecurity() { + global $_POST, $order, $insert_id, $messageStack; + + if(strlen(trim($_POST['tid']))==17 && $_POST['status']==100 && $_POST['session']== zen_session_id()){ + #xtc_redirect(zen_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL')); + }else{ + if($_POST['status_desc']){ + $error_status = $_POST['status_desc']; + }else { + $error_status = "There was an error and your payment could not be completed "; + } + $err = $error_status; + #'session missing or returned session is wrong'; + $order->info['comments'] .= '. Novalnet Error Message : '.$err; + $payment_error_return = 'payment_error='.$this->code/*.'&error='.$err*/; + $messageStack->add_session('checkout_payment', $err . '', 'error'); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + } + function encode($data){ + $data = trim($data); + if ($data == '') return'Error: no data'; + if (!function_exists('base64_encode') or !function_exists('pack') or !function_exists('crc32')){return'Error: func n/a';} + + try { + $crc = sprintf('%u', crc32($data));# %u is a must for ccrc32 returns a signed value + $data = $crc."|".$data; + $data = bin2hex($data.$this->key); + $data = strrev(base64_encode($data)); + } + catch (Exception $e){ + echo('Error: '.$e); + } + return $data; + } + + function decode($data){ + $data = trim($data); + if ($data == ''){ + return'Error: no data'; + } + if (!function_exists('base64_decode') or !function_exists('pack') or !function_exists('crc32')){ + return'Error: func n/a'; + } + + try { + $data = base64_decode(strrev($data)); + $data = pack("H".strlen($data), $data); + $data = substr($data, 0, stripos($data, $this->key)); + $pos = strpos($data, "|"); + if ($pos === false){ + return("Error: CKSum not found!"); + } + $crc = substr($data, 0, $pos); + $value = trim(substr($data, $pos+1)); + if ($crc != sprintf('%u', crc32($value))){ + return("Error; CKSum invalid!"); + } + return $value; + } + catch (Exception $e){ + echo('Error: '.$e); + } + } + + function hash($h){ #$h contains encoded data + global $amount_zh; + if (!$h) return'Error: no data'; + if (!function_exists('md5')){return'Error: func n/a';} + return md5($h['auth_code'].$h['product_id'].$h['tariff'].$h['amount'].$h['test_mode'].$h['uniqid'].strrev($this->key)); + } + + function checkHash($request){ + if (!$request) return false; #'Error: no data'; + $h['auth_code'] = $request['vendor_authcode'];#encoded + $h['product_id'] = $request['product_id'];#encoded + $h['tariff'] = $request['tariff_id'];#encoded + $h['amount'] = $request['amount'];#encoded + $h['test_mode'] = $request['test_mode'];#encoded + $h['uniqid'] = $request['uniqid'];#encoded + if ($request['hash2']!= $this->hash($h)){ + return false; + } + return true; + } + + function checkHash4java($request){ + if (!$request) return false; #'Error: no data'; + $h['auth_code'] = $request['auth_code'];#encoded + $h['product_id'] = $request['product_id'];#encoded + $h['tariff'] = $request['tariff_id'];#encoded + $h['amount'] = $request['amount'];#encoded + $h['test_mode'] = $request['test_mode'];#encoded + $h['uniqid'] = $request['uniqid'];#encoded + + if ($request['hash2'] != $this->hash($h)) + { + return false; + } + return true; + } + + function encode4java($data = '', $func = ''){ + $salt = 1010; + if (!isset($data) or trim($data) == '' or !$func){ + return'Error: missing arguments: $str and/or $func!'; + } + if ($func != 'decbin' and $func != 'bindec'){ + return'Error: $func has wrong value!'; + } + if ($func == 'decbin'){ + return decbin(intval($data) + intval($salt)); + }else{ + return bindec($data) - intval($salt); + } + } + function checkReturnedData(){ + if ($_POST['hash2'] && $_SESSION['payment'] == $this->code){ + if (strtoupper($this->implementation) == 'JAVA_PCI'){ + #Java encoded + if( $_POST['vendor_authcode'] != md5(MODULE_PAYMENT_NOVALNET_CC_PCI_AUTH_CODE.strrev($this->key)) ){ + $err = MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_HASH_ERROR.'; wrong auth_code!'; + $payment_error_return = 'payment_error=novalnet_cc_pci&error='.$_POST['status_text'].'; '.$err; + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + $_POST['auth_code'] = MODULE_PAYMENT_NOVALNET_CC_PCI_AUTH_CODE;#todo: check? + $_POST['product_id'] = $this->encode4java($_POST['product_id'], 'bindec'); + $_POST['tariff_id'] = $this->encode4java($_POST['tariff_id'], 'bindec'); + $_POST['amount'] = $this->encode4java($_POST['amount'], 'bindec'); + $_POST['test_mode'] = $this->encode4java($_POST['test_mode'], 'bindec'); + $_POST['uniqid'] = $this->encode4java($_POST['uniqid'], 'bindec'); + + if (!$this->checkHash4java($_POST)){ #PHP encoded + $err = MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_HASH_ERROR; + $payment_error_return = 'payment_error=novalnet_cc_pci&error='.$_POST['status_text'].'; '.$err; + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + }else{ #PHP encoded + if (!$this->checkHash($_POST)){ + $err = MODULE_PAYMENT_NOVALNET_CC_PCI_TEXT_HASH_ERROR; + $payment_error_return = 'payment_error=novalnet_cc_pci&error='.$_POST['status_text'].'; '.$err; + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + }else{ + $_POST['test_mode'] = $this->decode($_POST['test_mode']); + } + } + } + } + + function encodeParams($auth_code, $product_id, $tariff_id, $amount, $test_mode, $uniqid){ + if (strtoupper($this->implementation) == 'JAVA_PCI'){ + $uniqid = time();#must ne a long integer + $hash = md5($auth_code.$product_id.$tariff_id.$amount.$test_mode.$uniqid.strrev($this->key)); + $auth_code = md5($auth_code.strrev($this->key)); + $product_id = $this->encode4java($product_id, 'decbin'); + $tariff_id = $this->encode4java($tariff_id, 'decbin'); + $amount = $this->encode4java($amount, 'decbin'); + $test_mode = $this->encode4java($test_mode, 'decbin'); + $uniqid = $this->encode4java($uniqid, 'decbin'); + }else{ + $auth_code = $this->encode($auth_code); + $product_id = $this->encode($product_id); + $tariff_id = $this->encode($tariff_id); + $amount = $this->encode($amount); + $test_mode = $this->encode($test_mode); + $uniqid = $this->encode($uniqid); + $hash = $this->hash(array('auth_code' => $auth_code, 'product_id' => $product_id, 'tariff' => $tariff_id, 'amount' => $amount, 'test_mode' => $test_mode, 'uniqid' => $uniqid)); + } + return array($auth_code, $product_id, $tariff_id, $amount, $test_mode, $uniqid, $hash); + } + + +} + /* + flow of functions: + selection -> $order-info['total'] wrong, cause shipping_cost is net + pre_confirmation_check -> $order-info['total'] wrong, cause shipping_cost is net + confirmation -> $order-info['total'] right, cause shipping_cost is gross + process_button -> $order-info['total'] right, cause shipping_cost is gross + before_process -> $order-info['total'] wrong, cause shipping_cost is net + after_process -> $order-info['total'] right, cause shipping_cost is gross + --------------- + */ + +?> diff --git a/includes/modules/payment/novalnet_elv_at.php b/includes/modules/payment/novalnet_elv_at.php new file mode 100644 index 0000000..43119a7 --- /dev/null +++ b/includes/modules/payment/novalnet_elv_at.php @@ -0,0 +1,1103 @@ +vendor_id = trim(MODULE_PAYMENT_NOVALNET_ELV_AT_VENDOR_ID); + $this->auth_code = trim(MODULE_PAYMENT_NOVALNET_ELV_AT_AUTH_CODE); + $this->product_id = trim(MODULE_PAYMENT_NOVALNET_ELV_AT_PRODUCT_ID); + $this->tariff_id = trim(MODULE_PAYMENT_NOVALNET_ELV_AT_TARIFF_ID); + $this->manual_check_limit = trim(MODULE_PAYMENT_NOVALNET_ELV_AT_MANUAL_CHECK_LIMIT); + $this->product_id2 = trim(MODULE_PAYMENT_NOVALNET_ELV_AT_PRODUCT_ID2); + $this->tariff_id2 = trim(MODULE_PAYMENT_NOVALNET_ELV_AT_TARIFF_ID2); + $this->test_mode = (strtolower(MODULE_PAYMENT_NOVALNET_ELV_AT_TEST_MODE) == 'true' or MODULE_PAYMENT_NOVALNET_ELV_AT_TEST_MODE == '1') ? 1 : 0; + + $this->code = 'novalnet_elv_at'; + $this->title = MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_TITLE; + $this->public_title = MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_PUBLIC_TITLE; + $this->description = MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_DESCRIPTION; + $this->sort_order = MODULE_PAYMENT_NOVALNET_ELV_AT_SORT_ORDER; + $this->enabled = ((MODULE_PAYMENT_NOVALNET_ELV_AT_STATUS == 'True') ? true : false); + $this->proxy = MODULE_PAYMENT_NOVALNET_ELV_AT_PROXY; + + + if (MODULE_PAYMENT_NOVALNET_ELV_AT_LOGO_STATUS == 'True') { + $this->public_title = 'Novalnet'.' '. MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_PUBLIC_TITLE; + $this->title = 'Novalnet'.' '.MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_TITLE; + } + $this->title = html_entity_decode($this->title, ENT_QUOTES, "UTF-8"); + $this->checkConfigure(); + + if ((int) MODULE_PAYMENT_NOVALNET_ELV_AT_ORDER_STATUS_ID > 0) { + $this->order_status = MODULE_PAYMENT_NOVALNET_ELV_AT_ORDER_STATUS_ID; + } + if (is_object($order)) + $this->update_status(); + + // Check the tid in session and make the second call + if ($_SESSION['nn_tid_elv_at']) { + //echo $_SESSION['customer_id']; + if ((empty($_SESSION['invalid_count_at'])) || ( isset($_SESSION['max_time_elv_at']) && (time() >= $_SESSION['max_time_elv_at']))) { + $_SESSION['invalid_count_at'] = 0; + } + if (!empty($_SESSION['invalid_count_at']) && $_SESSION['invalid_count_at'] == 3) { + + if ($_SESSION['max_time_elv_at'] && (time() < $_SESSION['max_time_elv_at'])) { + $payment_error_return = 'payment_error=' . $this->code . '&error=' . utf8_encode(MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_SESSION_ERROR); + //$payment_error_return = MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_SESSION_ERROR; + } + } + + //Check the time limit + if ($_SESSION['max_time_elv_at'] && time() > $_SESSION['max_time_elv_at']) { + unset($_SESSION['nn_tid_elv_at']); + unset($_SESSION['invalid_count_at']); + $payment_error_return = 'payment_error=' . $this->code; + $messageStack->add_session('checkout_payment', MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_SESSION_ERROR . '', 'error'); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + + if ($_GET['new_novalnet_pin_elv_at'] == 'true') { + $_SESSION['new_novalnet_pin_elv_at'] = true; + $this->secondcall(); + } + } + + // define callback types + $this->isActivatedCallback = false; + if (MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_SMS != 'False') { + $this->isActivatedCallback = true; + } + } + + function checkConfigure() { + if (IS_ADMIN_FLAG == true) { + $this->title = MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_TITLE; // Payment module title in Admin + if (MODULE_PAYMENT_NOVALNET_ELV_AT_LOGO_STATUS == 'True') { + $this->public_title = 'Novalnet'.' '. MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_PUBLIC_TITLE; + $this->title = 'Novalnet'.' '.MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_TITLE; + } + if ($this->enabled == 'true' && (!$this->vendor_id || !$this->auth_code || !$this->product_id || !$this->tariff_id )) { + $this->title .= '' . MODULE_PAYMENT_NOVALNET_ELV_AT_NOT_CONFIGURED . ''; + } elseif ($this->test_mode == '1') { + $this->title .= '' . MODULE_PAYMENT_NOVALNET_ELV_AT_IN_TEST_MODE . ''; + } + } + } + + ### calculate zone matches and flag settings to determine whether this module should display to customers or not ### + + function update_status() { + global $order, $db; + + if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_ELV_AT_ZONE > 0)) { + $check_flag = false; + $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_NOVALNET_ELV_AT_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id"); + while (!$check->EOF) { + if ($check->fields['zone_id'] < 1) { + $check_flag = true; + break; + } elseif ($check->fields['zone_id'] == $order->billing['zone_id']) { + $check_flag = true; + break; + } + $check->MoveNext(); + } + + if ($check_flag == false) { + $this->enabled = false; + } + } + } + + ### JS validation which does error-checking of data-entry if this module is selected for use ### + ### the fields to be cheked are (Bank Owner, Bank Account Number and Bank Code Lengths) ### + ### currently this function is not in use ### + // @return string + + function javascript_validation() { + return false; + } + + ### Builds set of input fields for collecting Bankdetail info ### + // @return array + + function selection() { + global $order, $_POST, $HTTP_POST_VARS; + + $onFocus = ' onfocus="methodSelect(\'pmt-' . $this->code . '\')"'; + $billing_iso_code = strtolower($order->customer['country']['iso_code_2']); + $bank_account = ''; + if (isset($_POST['bank_account_at'])) { + $bank_account = $_POST['bank_account_at']; + } + if (!$bank_account and isset($_GET['bank_account_at'])) { + $bank_account = $_GET['bank_account_at']; + } + $bank_code = ''; + if (isset($_POST['bank_code_at'])) { + $bank_code = $_POST['bank_code_at']; + } + if (!$bank_code and isset($_GET['bank_code_at'])) { + $bank_code = $_GET['bank_code_at']; + } + + + if (!$_SESSION['nn_tid_elv_at']) { + $selection = array('id' => $this->code, + 'module' => $this->title, + 'fields' => array(array('title' => MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_BANK_ACCOUNT_OWNER, + 'field' => zen_draw_input_field('bank_account_holder_at', $order->billing['firstname'] . ' ' . $order->billing['lastname'], 'id="' . $this->code . '-bank_account_holder_at" AUTOCOMPLETE="OFF"' . $onFocus), + 'tag' => $this->code . '-bank_account_holder_at'), + array('title' => MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_BANK_ACCOUNT_NUMBER, + 'field' => zen_draw_input_field('bank_account_at', '', 'id="' . $this->code . '-bank_account_at" AUTOCOMPLETE="OFF"' . $onFocus), + 'tag' => $this->code . '-bank_account_at'), + array('title' => MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_BANK_CODE, + 'field' => zen_draw_input_field('bank_code_at', '', 'id="' . $this->code . '-bank_code_at" AUTOCOMPLETE="OFF"' . $onFocus), + 'tag' => $this->code . '-bank_code_at'), + array('title' => '', 'field' => MODULE_PAYMENT_NOVALNET_INFORMATION_PAYMENT_AT), + array('title' => '', 'field' => MODULE_PAYMENT_NOVALNET_ELV_AT_INFO) + )); + + + // Display callback fields + $amount_check = $this->findTotalAmount(); + + if ($this->isActivatedCallback && in_array($billing_iso_code, $this->nnelvat_allowed_pin_country_list) && $amount_check >= MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_MIN_LIMIT) { + if (MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_SMS == 'Email Reply') { + $_SESSION['user_email_elv_at'] = ($_SESSION['user_email_elv_at'] == '') ? $order->customer['email_address'] : $_SESSION['user_email_elv_at']; + + $selection['fields'][] = array('title' => MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_EMAIL_REQ, 'field' => zen_draw_input_field('user_email_elv_at', $_SESSION['user_email_elv_at'], 'id="' . $this->code . '-callback" AUTOCOMPLETE="OFF"' . $onFocus)); + } else { + $_SESSION['user_tel_elv_at'] = ($_SESSION['user_tel_elv_at'] == '') ? $order->customer['telephone'] : $_SESSION['user_tel_elv_at']; + + $label_str = (MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_SMS == 'Callback (Telefon & Handy)') ? MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_TEL_REQ : MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_SMS_REQ; + + $selection['fields'][] = array('title' => $label_str, 'field' => zen_draw_input_field('user_tel_elv_at', $_SESSION['user_tel_elv_at'], 'id="' . $this->code . '-callback" AUTOCOMPLETE="OFF"' . $onFocus)); + } + } + } + $amount_check = $_SESSION['nn_amount_elv_at']; + + if ($this->isActivatedCallback && in_array($billing_iso_code, $this->nnelvat_allowed_pin_country_list) && $amount_check >= MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_MIN_LIMIT && isset($_SESSION['nn_tid_elv_at']) && ($_SESSION['invalid_count_at'] < 3)) { + + $selection = array('id' => $this->code, 'module' => $this->public_title); + if (MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_SMS == 'Email Reply') { + $selection['fields'][] = array('title' => MODULE_PAYMENT_NOVALNET_ELV_AT_EMAIL_INPUT_REQUEST_DESC); + } else { + $selection = array('id' => $this->code, + 'module' => $this->public_title); + // Show PIN field, after first call + $selection['fields'][] = array('title' => MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_SMS_PIN, 'field' => zen_draw_input_field('novalnet_pin_elv_at', '', 'id="' . $this->code . '-callback" AUTOCOMPLETE="OFF"' . $onFocus)); + $selection['fields'][] = array('title' => '' . MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_SMS_NEW_PIN . ''); + } + } + + + return $selection; + } + + ### Precheck to Evaluate the Bank Datas ### + + function pre_confirmation_check() { + global $HTTP_POST_VARS, $_POST, $order, $messageStack; + $billing_iso_code = strtolower($order->customer['country']['iso_code_2']); + if (count($HTTP_POST_VARS) == 0 || $HTTP_POST_VARS == '') + $HTTP_POST_VARS = $_POST; + + $HTTP_POST_VARS['bank_account_holder_at'] = trim($HTTP_POST_VARS['bank_account_holder_at']); + $HTTP_POST_VARS['bank_account_at'] = trim($HTTP_POST_VARS['bank_account_at']); + $HTTP_POST_VARS['bank_code_at'] = trim($HTTP_POST_VARS['bank_code_at']); + + + if (isset($HTTP_POST_VARS['user_tel_elv_at'])) + $HTTP_POST_VARS['user_tel_elv_at'] = trim($HTTP_POST_VARS['user_tel_elv_at']); + + if (isset($HTTP_POST_VARS['user_email_elv_at'])) + $HTTP_POST_VARS['user_email_elv_at'] = trim($HTTP_POST_VARS['user_email_elv_at']); + + if (isset($HTTP_POST_VARS['novalnet_pin_elv_at'])) + $HTTP_POST_VARS['novalnet_pin_elv_at'] = trim($HTTP_POST_VARS['novalnet_pin_elv_at']); + + + // Callback stuff.... + + if ($_SESSION['nn_tid_elv_at']) { + //check the amount is equal with the first call or not + $amount = $this->findTotalAmount(); + if ($_SESSION['elv_at_order_amount'] != $amount) { + + if (MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_SMS == 'Email Reply') { + $error_message = MODULE_PAYMENT_NOVALNET_ELV_AT_AMOUNT_VARIATION_MESSAGE_EMAIL; + } elseif (MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_SMS == 'Callback (Telefon & Handy)' || MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_SMS == 'SMS (nur Handy)') { + $error_message = MODULE_PAYMENT_NOVALNET_ELV_AT_AMOUNT_VARIATION_MESSAGE; + } + + unset($_SESSION['nn_tid_elv_at']); + unset($_SESSION['elv_at_order_amount']); + + if (isset($_SESSION['invalid_count_at'])) { + unset($_SESSION['invalid_count_at']); + } + $payment_error_return = 'payment_error=' . $this->code; + $messageStack->add_session('checkout_payment', $error_message . '', 'error'); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + if (isset($HTTP_POST_VARS['novalnet_pin_elv_at']) && isset($_SESSION['nn_tid_elv_at'])) { + // check pin + //if( !is_numeric( $HTTP_POST_VARS['novalnet_pin_elv_at'] ) || strlen( $HTTP_POST_VARS['novalnet_pin_elv_at'] ) != 4 ) + if ($HTTP_POST_VARS['novalnet_pin_elv_at'] == '' || (preg_match('/[&_#%\^<>@$=*!]/', $HTTP_POST_VARS['novalnet_pin_elv_at']))) { + $payment_error_return = 'payment_error=' . $this->code . '&error=' . utf8_encode(MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_SMS_PIN_NOTVALID); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } else { + if ($HTTP_POST_VARS['novalnet_pin_elv_at']) + $_SESSION['novalnet_pin_elv_at'] = $HTTP_POST_VARS['novalnet_pin_elv_at']; + } + } + return; + }else { + $error = ''; + + if (!function_exists('curl_init') && ($this->_code == 'novalnet_elv_at')) { + ini_set('display_errors', 1); + ini_set('error_reporting', E_ALL); + + $error = MODULE_PAYMENT_NOVALNET_ELV_AT_CURL_MESSAGE; + } + + if (!isset($_SESSION['nn_tid_elv_at'])) { + + + if (!$this->vendor_id || !$this->auth_code || !$this->product_id || !$this->tariff_id) { + $error = MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_JS_NN_MISSING; + } elseif (!empty($this->manual_check_limit) && (!$this->product_id2 || !$this->tariff_id2)) { + + $error = MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_JS_NN_ID2_MISSING; + } elseif (!$HTTP_POST_VARS['bank_account_holder_at'] || (preg_match('/[#%\^<>@$=*!]/', $HTTP_POST_VARS['bank_account_holder_at']))) { + $error = MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_JS_BANK_ACCOUNT_OWNER; + } elseif (preg_match('/[^\d]/', $HTTP_POST_VARS['bank_account_at'])) { + $error = MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_JS_BANK_ERROR_ACCOUNT_NUMBER; + } elseif (!$HTTP_POST_VARS['bank_account_at'] || strlen($HTTP_POST_VARS['bank_account_at']) < MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_BANK_ACCOUNT_NUMBER_LENGTH) { + $error = MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_JS_BANK_ACCOUNT_NUMBER; + } elseif (preg_match('/[^\d]/', $HTTP_POST_VARS['bank_code_at'])) { + $error = MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_JS_BANK_CODE_ERROR; + } elseif (!$HTTP_POST_VARS['bank_code_at'] || strlen($HTTP_POST_VARS['bank_code_at']) < MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_BANK_CODE_LENGTH) { + $error = MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_JS_BANK_CODE; + } + $_SESSION['bank_account_holder_at'] = $HTTP_POST_VARS['bank_account_holder_at']; + $_SESSION['bank_code_at'] = $HTTP_POST_VARS['bank_code_at']; + $_SESSION['bank_account_at'] = $HTTP_POST_VARS['bank_account_at']; + + if (isset($HTTP_POST_VARS['user_email_elv_at'])) { + $_SESSION['user_email_elv_at'] = $HTTP_POST_VARS['user_email_elv_at']; + } + + if (isset($HTTP_POST_VARS['user_tel_elv_at'])) { + $_SESSION['user_tel_elv_at'] = $HTTP_POST_VARS['user_tel_elv_at']; + } + + + // Callback stuff.... + //$_SESSION['nn_amount_elv_at'] = $this->findTotalAmount(); + $amount_check = $this->findTotalAmount(); + if ($this->isActivatedCallback && in_array($billing_iso_code, $this->nnelvat_allowed_pin_country_list) && $amount_check >= MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_MIN_LIMIT) { + + + //checking email address + if (isset($HTTP_POST_VARS['user_email_elv_at'])) { + if (!trim($HTTP_POST_VARS['user_email_elv_at']) || !eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $HTTP_POST_VARS['user_email_elv_at'])) { + $error = MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_EMAIL_NOTVALID; + } + } + + //checking telephone number + if (isset($HTTP_POST_VARS['user_tel_elv_at'])) { + if (strlen($HTTP_POST_VARS['user_tel_elv_at']) < 8 || !is_numeric($HTTP_POST_VARS['user_tel_elv_at'])) { + $error = MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_SMS_TEL_NOTVALID; + } + } + if ($error != '') { + /* $payment_error_return = 'payment_error=' . $this->code . '&error=' . utf8_encode($error); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); */ + + $payment_error_return = 'payment_error=' . $this->code; + $messageStack->add_session('checkout_payment', utf8_encode($error) . '', 'error'); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } else { + + $_SESSION['user_tel_elv_at'] = $HTTP_POST_VARS['user_tel_elv_at']; + if (isset($HTTP_POST_VARS['user_email_elv_at'])) { + $error_msg = MODULE_PAYMENT_NOVALNET_ELV_AT_EMAIL_INPUT_REQUEST_DESC; + } else { + $error_msg = MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_INPUT_REQUEST_DESC; + } + // firstcall() + $this->before_process(); + $payment_error_return = 'payment_error=' . $this->code; + $messageStack->add_session('checkout_payment', $error_msg . '', 'error'); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + return; + } + } + + if ($error != '') { + $payment_error_return = 'payment_error=' . $this->code; + $messageStack->add_session('checkout_payment', $error . '', 'error'); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + } + } + } + + ### Display Bank Information on the Checkout Confirmation Page ### + // @return array + + function confirmation() { + global $HTTP_POST_VARS, $_POST, $order; + + if (count($HTTP_POST_VARS) == 0 || $HTTP_POST_VARS == '') + $HTTP_POST_VARS = $_POST; + + $cardnoInfo_at = $_SESSION['bank_account_at']; + $codeInfo_at = $_SESSION['bank_code_at']; + + if ($cardnoInfo_at) { + $cardnoInfo_at = str_pad(substr($cardnoInfo_at, 0, -4), strlen($cardnoInfo_at), '*', STR_PAD_RIGHT); + } + if ($codeInfo_at) { + $codeInfo_at = str_pad(substr($codeInfo_at, 0, -4), strlen($codeInfo_at), '*', STR_PAD_RIGHT); + } + + $confirmation = array('fields' => array(array('title' => MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_BANK_ACCOUNT_OWNER, + 'field' => $_SESSION['bank_account_holder_at']), + array('title' => MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_BANK_ACCOUNT_NUMBER, + 'field' => $cardnoInfo_at), + array('title' => MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_BANK_CODE, + 'field' => $codeInfo_at) + )); + + return $confirmation; + } + + ### Build the data and actions to process when the "Submit" button is pressed on the order-confirmation screen. ### + ### These are hidden fields on the checkout confirmation page ### + // @return string + + function process_button() { + global $HTTP_POST_VARS, $_POST; + + if (count($HTTP_POST_VARS) == 0 || $HTTP_POST_VARS == '') + $HTTP_POST_VARS = $_POST; + $process_button_string = zen_draw_hidden_field('bank_account_holder_at', $_SESSION['bank_account_holder_at']) . + zen_draw_hidden_field('bank_account_at', $_SESSION['bank_account_at']) . + zen_draw_hidden_field('bank_code_at', $_SESSION['bank_code_at']); + + return $process_button_string; + } + + //This is user defined function used for getting order amount in cents with tax + public function findTotalAmount() { + global $order, $currencies; + if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) { + $total = $order->info['total'] + $order->info['tax']; + } else { + $total = $order->info['total']; + } + + $totalamount = number_format($total * $currencies->get_value($order->info['currency']), 2); + $amount = str_replace(',', '', $totalamount); + $amount = intval(round($amount * 100)); + + if (preg_match('/[^\d\.]/', $total) or !$total) { + ### $amount contains some unallowed chars or empty ### + $err = 'amount (' . $total . ') is empty or has a wrong format'; + $payment_error_return = 'payment_error=' . $this->code; + $messageStack->add_session('checkout_payment', $err . '', 'error'); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + // $amount = sprintf('%0.2f', $total); + // $amount = preg_replace('/^0+/', '', $amount); + // $amount = str_replace('.', '', $amount); + return $amount; + } + + public function secondCall() { + $xmlresponse_erros = ''; + // If customer forgets PIN, send a new PIN + if ($_SESSION['new_novalnet_pin_elv_at']) + $request_type = 'TRANSMIT_PIN_AGAIN'; + else + $request_type = 'PIN_STATUS'; + if ($_SESSION['email_reply_check_elv_at'] == 'Email Reply') + $request_type = 'REPLY_EMAIL_STATUS'; + + if ($_SESSION['new_novalnet_pin_elv_at']) + $_SESSION['new_novalnet_pin_elv_at'] = false; + + $xml = ''; + $xml = ' + + + ' . $this->vendor_id . ' + ' . $this->auth_code . ' + ' . $request_type . ' + ' . $_SESSION['nn_tid_elv_at'] . ''; + if ($request_type != 'REPLY_EMAIL_STATUS') + $xml .= '' . $_SESSION['novalnet_pin_elv_at'] . '';$xml .= ' + + '; + + $xml_response = $this->curl_xml_post($xml); + + // Parse XML Response to object + $xml_response = simplexml_load_string($xml_response); + + #$_SESSION['status'] = $xml_response->status; + if ($xml_response->status != '') { + $xmlresponse_erros = $xml_response->status; + } + if ($xmlresponse_erros == '') { + $errormesage = $xml_response->pin_status->status_message; + $payment_error_return = 'payment_error=' . $this->code . '&error=' . utf8_encode($errormesage); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } else { + if ($xml_response->status != 100) { + if ($xml_response->status == '0529005') { + $_SESSION['invalid_count_at'] = $_SESSION['invalid_count_at'] + 1; + if ($_SESSION['invalid_count_at'] == 3) { + $payment_error_return = 'payment_error=' . $this->code . '&error=' . utf8_encode(MODULE_PAYMENT_NOVALNET_ELV_AT_MAX_TIME_ERROR); + } else { + $payment_error_return = 'payment_error=' . $this->code . '&error=' . utf8_encode($xml_response->status_message); + } + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } else { + $payment_error_return = 'payment_error=' . $this->code . '&error=' . utf8_encode($xml_response->status_message); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + } else { + $array = (array) $xml_response; + // add tid, because it's missing in the answer + $array['tid'] = $_SESSION['nn_tid_elv_at']; + $array['statusdesc'] = $array['status_message']; // Param-name is changed + $array['test_mode'] = $_SESSION['test_mode_elv_at']; + return $array; + } + } + } + + public function curl_xml_post($request) { + $ch = curl_init("https://payport.novalnet.de/nn_infoport.xml"); + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: close')); + curl_setopt($ch, CURLOPT_POST, 1); // a non-zero parameter tells the library to do a regular HTTP post. + curl_setopt($ch, CURLOPT_POSTFIELDS, $request); // add POST fields + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); // don't allow redirects + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // decomment it if you want to have effective ssl checking + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // decomment it if you want to have effective ssl checking + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable + curl_setopt($ch, CURLOPT_TIMEOUT, 240); // maximum time, in seconds, that you'll allow the CURL functions to take + ## establish connection + $xml_response = curl_exec($ch); + + ## determine if there were some problems on cURL execution + $errno = curl_errno($ch); + $errmsg = curl_error($ch); + + ###bug fix for PHP 4.1.0/4.1.2 (curl_errno() returns high negative value in case of successful termination) + if ($errno < 0) + $errno = 0; + ##bug fix for PHP 4.1.0/4.1.2 + + if ($debug) { + print_r(curl_getinfo($ch)); + echo "\n

\n\n\nperform_https_request: cURL error number:" . $errno . "\n
\n\n"; + echo "\n\n\nperform_https_request: cURL error:" . $errmsg . "\n
\n\n"; + } + + #close connection + curl_close($ch); + + return $xml_response; + } + + ### Store the BANK info to the order ### + ### This sends the data to the payment gateway for processing and Evaluates the Bankdatas for acceptance and the validity of the Bank Details ### + + function before_process() { + global $_POST, $order, $db, $currencies, $messageStack; + $billing_iso_code = strtolower($order->customer['country']['iso_code_2']); + if (count($HTTP_POST_VARS) == 0 || $HTTP_POST_VARS == '') + $HTTP_POST_VARS = $_POST; + $_SESSION['nn_amount_elv_at'] = $this->findTotalAmount(); + + //Test mode based on the responsone test mode value + $test_mode = (strtolower(MODULE_PAYMENT_NOVALNET_ELV_AT_TEST_MODE) == 'true' or MODULE_PAYMENT_NOVALNET_ELV_AT_TEST_MODE == '1') ? 1 : 0; + + // Setting callback type // see constructor + // First call is done, so check PIN / second call... + if ($_SESSION['nn_tid_elv_at'] && $this->isActivatedCallback) { + if (MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_SMS == 'Email Reply') + $_SESSION['email_reply_check_elv_at'] = 'Email Reply'; + else + unset($_SESSION['email_reply_check_elv_at']); + $_SESSION['new_novalnet_pin_elv_at'] = false; + + if ($aryResponse = $this->secondCall()) { + if ($this->order_status) + $order->info['order_status'] = $this->order_status; + if ($_SESSION['test_mode_elv_at'] == 1 || $test_mode) + $order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_ELV_AT_TEST_ORDER_MESSAGE . '
'; + $order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_ELV_AT_TID_MESSAGE . $_SESSION['nn_tid_elv_at'] . '

'; + $order->info['comments'] = str_replace(array('', '', '', '', '
', '
', '
'), array('', '', '', '', "\n", "\n", "\n"), $order->info['comments']); + } + return; + } + + + + #Get the required additional customer details from DB + $nn_customer_id = (isset($_SESSION['customer_id'])) ? $_SESSION['customer_id'] : ''; + $customer_values = $db->Execute("SELECT customers_gender, customers_firstname, customers_lastname, customers_dob, customers_email_address, customers_telephone, customers_fax, customers_email_format FROM " . TABLE_CUSTOMERS . " WHERE customers_id='" . (int) $nn_customer_id . "'"); + while (!$customer_values->EOF) { + $customer_values->MoveNext(); + } + list($customer_values->fields['customers_dob'], $extra) = explode(' ', $customer_values->fields['customers_dob']); + + ### Process the payment to paygate ## + $url = 'https://payport.novalnet.de/paygate.jsp'; + + + $amount = $_SESSION['nn_amount_elv_at']; + $user_ip = $this->getRealIpAddr(); + + $vendor_id = $this->vendor_id; + $auth_code = $this->auth_code; + $product_id = $this->product_id; + $tariff_id = $this->tariff_id; + + $customer_id = $_SESSION['customer_id']; + + $manual_check_limit = $this->manual_check_limit; + $manual_check_limit = str_replace(',', '', $manual_check_limit); + $manual_check_limit = str_replace('.', '', $manual_check_limit); + + if ($manual_check_limit && $amount >= $manual_check_limit) { + $product_id = $this->product_id2; + $tariff_id = $this->tariff_id2; + } + + + //set the user telephone + $tel_param = '&tel='; + if ($_SESSION['user_tel_elv_at']) + $user_telephone = $_SESSION['user_tel_elv_at']; + else + $user_telephone = $order->customer['telephone']; + //set the user email + if ($_SESSION['user_email_elv_at']) + $user_email = $_SESSION['user_email_elv_at']; + else + $user_email = $order->customer['email_address']; + + //set the user telephone + if ($_SESSION['user_tel_elv_at']) { + $user_telephone = $_SESSION['user_tel_elv_at']; + } else { + $user_telephone = $order->customer['telephone']; + } + // set post params + if ($this->isActivatedCallback && in_array($billing_iso_code, $this->nnelvat_allowed_pin_country_list) && $amount >= MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_MIN_LIMIT) { + if (MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_SMS == 'Callback (Telefon & Handy)') { + $this->callback_type = '&pin_by_callback=1'; + $user_telephone = '&tel=' . $user_telephone; + } + if (MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_SMS == 'SMS (nur Handy)') { + $this->callback_type = '&pin_by_sms=1'; + $user_telephone = '&mobile=' . $user_telephone; + } + if (MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_SMS == 'Email Reply') { + $this->callback_type = '&reply_email_check=1'; + } + } + + $firstname = !empty($order->customer['firstname']) ? $order->customer['firstname'] : $order->billing['firstname']; + $lastname = !empty($order->customer['lastname']) ? $order->customer['lastname'] : $order->billing['lastname']; + $email_address = !empty($order->customer['email_address']) ? $order->customer['email_address'] : $order->billing['email_address']; + $street_address = !empty($order->customer['street_address']) ? $order->customer['street_address'] : $order->billing['street_address']; + $city = !empty($order->customer['city']) ? $order->customer['city'] : $order->billing['city']; + $postcode = !empty($order->customer['postcode']) ? $order->customer['postcode'] : $order->billing['postcode']; + $country_iso_code_2 = !empty($order->customer['country']['iso_code_2']) ? $order->customer['country']['iso_code_2'] : $order->billing['country']['iso_code_2']; + $customer_no = ($customer['customers_status'] != 1) ? $nn_customer_id : MODULE_PAYMENT_NOVALNET_ELV_AT_GUEST_USER; + + $user_ip = $this->getRealIpAddr(); + + $urlparam = 'vendor=' . $vendor_id . '&product=' . $product_id . '&key=' . $this->payment_key . '&tariff=' . $tariff_id . '&auth_code=' . $auth_code . '¤cy=' . $order->info['currency']; + $urlparam .= '&bank_account_holder=' . $HTTP_POST_VARS['bank_account_holder_at'] . '&bank_account=' . $HTTP_POST_VARS['bank_account_at']; + $urlparam .= '&bank_code=' . $HTTP_POST_VARS['bank_code_at'] . '&first_name=' . $firstname . '&last_name=' . $lastname; + $urlparam .= '&street=' . $street_address . '&city=' . $city . '&zip=' . $postcode; + $urlparam .= '&country=' . $country_iso_code_2 . '&email=' . $email_address; + $urlparam .= '&search_in_street=1' . '&tel=' . $user_telephone . '&remote_ip=' . $user_ip; + $urlparam .= '&gender=' . $customer['customers_gender'] . '&birth_date=' . $customer_values->fields['customers_dob'] . '&fax=' . $customer['customers_fax']; + $urlparam .= '&language=' . MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_LANG; + $urlparam .= '&lang=' . MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_LANG; + $urlparam .= '&test_mode=' . $test_mode; + $urlparam .= '&customer_no=' . $customer_no; + $urlparam .= '&use_utf8=1'; + $urlparam .= '&amount=' . $amount; + $urlparam .= $this->callback_type; + + list($errno, $errmsg, $data) = $this->perform_https_request($url, $urlparam); + +// echo '
Result: '. print_r($data); exit; + $aryResponse = array(); + #capture the result and message and other parameters from response data '$data' in an array + $aryPaygateResponse = explode('&', $data); + foreach ($aryPaygateResponse as $key => $value) { + if ($value != "") { + $aryKeyVal = explode("=", $value); + $aryResponse[$aryKeyVal[0]] = $aryKeyVal[1]; + } + } +//echo '
Result :'.print_r($aryResponse); exit; + if ($aryResponse['status'] == 100) { + ### Passing through the Transaction ID from Novalnet's paygate into order-info ### + if ($this->isActivatedCallback && in_array($billing_iso_code, $this->nnelvat_allowed_pin_country_list) && $amount >= MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_MIN_LIMIT) { + $_SESSION['elv_at_order_amount'] = $amount; + $_SESSION['nn_tid_elv_at'] = $aryResponse['tid']; + // To avoide payment method confussion add code in session + //set session for maximum time limit to 30 minutes + $_SESSION['max_time_elv_at'] = time() + (30 * 60); + //TEST BILLING MESSAGE BASED ON THE RESPONSE TEST MODE + $_SESSION['test_mode_elv_at'] = $aryResponse['test_mode']; + } else { + + $test_mode = (strtolower(MODULE_PAYMENT_NOVALNET_ELV_AT_TEST_MODE) == 'true' or MODULE_PAYMENT_NOVALNET_ELV_AT_TEST_MODE == '1') ? 1 : 0; + if ($aryResponse['test_mode'] == 1 || $test_mode) + $order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_ELV_AT_TEST_ORDER_MESSAGE . '
'; + + if ($this->order_status) + $order->info['order_status'] = $this->order_status; + + $order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_ELV_AT_TID_MESSAGE . $aryResponse['tid'] . '

'; + $_SESSION['nn_tid_elv_at'] = $aryResponse['tid']; + $order->info['comments'] = str_replace(array('', '', '', '', '
', '
', '
'), array('', '', '', '', "\n", "\n", "\n"), $order->info['comments']); + } + } + else { + ### Passing through the Error Response from Novalnet's paygate into order-info ### + $order->info['comments'] .= 'Novalnet Error Code : ' . $aryResponse['status'] . ', Novalnet Error Message : ' . $aryResponse['status_desc']; + + $payment_error_return = 'payment_error=' . $this->code; + + $messageStack->add_session('checkout_payment', $aryResponse['status_desc'] . '', 'error'); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + } + + ### Realtime accesspoint for communication to the Novalnet paygate ### + + function perform_https_request($nn_url, $urlparam) { + $debug = 0; #set it to 1 if you want to activate the debug mode + + if ($debug) + print "
perform_https_request: $nn_url
\n\r\n"; + if ($debug) + print "perform_https_request: $urlparam
\n\r\n"; + + ## some prerquisites for the connection + $ch = curl_init($nn_url); + curl_setopt($ch, CURLOPT_POST, 1); // a non-zero parameter tells the library to do a regular HTTP post. + curl_setopt($ch, CURLOPT_POSTFIELDS, $urlparam); // add POST fields + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); // don't allow redirects + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // decomment it if you want to have effective ssl checking + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // decomment it if you want to have effective ssl checking + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable + curl_setopt($ch, CURLOPT_TIMEOUT, 240); // maximum time, in seconds, that you'll allow the CURL functions to take + if ($this->proxy) { + curl_setopt($ch, CURLOPT_PROXY, $this->proxy); + } + + ## establish connection + $data = curl_exec($ch); + //$data = $this->ReplaceSpecialGermanChars($data); + + ## determine if there were some problems on cURL execution + $errno = curl_errno($ch); + $errmsg = curl_error($ch); + + ###bug fix for PHP 4.1.0/4.1.2 (curl_errno() returns high negative value in case of successful termination) + if ($errno < 0) + $errno = 0; + ##bug fix for PHP 4.1.0/4.1.2 + + if ($debug) { + print_r(curl_getinfo($ch)); + echo "\n

\n\n\nperform_https_request: cURL error number:" . $errno . "\n
\n\n"; + echo "\n\n\nperform_https_request: cURL error:" . $errmsg . "\n
\n\n"; + } + + #close connection + curl_close($ch); + + ## read and return data from novalnet paygate + if ($debug) + print "
\n\n" . $data . "\n
\n\n"; + + return array($errno, $errmsg, $data); + } + + ### replace the Special German Charectors ### + + function ReplaceSpecialGermanChars($string) { + $what = array("ä", "ö", "ü", "Ä", "Ö", "Ãœ", "ß"); + $how = array("ae", "oe", "ue", "Ae", "Oe", "Ue", "ss"); + + $string = str_replace($what, $how, $string); + + return $string; + } + + ### get the real Ip Adress of the User ### + + function getRealIpAddr() { + if (!empty($_SERVER['HTTP_CLIENT_IP'])) { //check ip from share internet + $ip = $_SERVER['HTTP_CLIENT_IP']; + } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { //to check ip is pass from proxy + $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; + } else { + $ip = $_SERVER['REMOTE_ADDR']; + } + /* + $num="(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])"; + if (!preg_match("/^$num\\.$num\\.$num\\.$num$/", $ip)){ + $ip='127.0.0.1'; + + */ + return $ip; + + // } + } + + ### Send additional information about bankdata via email to the store owner ### + ### Send the order detail to Novalnet ### + + function after_process() { + global $order, $customer_id, $insert_id, $db; + + $url = 'https://payport.novalnet.de/paygate.jsp'; + $amount = $_SESSION['nn_amount_elv_at']; + $vendor_id = $this->vendor_id; + $auth_code = $this->auth_code; + $product_id = $this->product_id; + $tariff_id = $this->tariff_id; + + + $manual_check_limit = $this->manual_check_limit; + $manual_check_limit = str_replace(',', '', $manual_check_limit); + $manual_check_limit = str_replace('.', '', $manual_check_limit); + + if ($manual_check_limit && $amount >= $manual_check_limit) { + $product_id = $this->product_id2; + $tariff_id = $this->tariff_id2; + } + $urlparam = 'vendor=' . $vendor_id . '&product=' . $product_id . '&key=' . $this->payment_key . '&tariff=' . $tariff_id; + $urlparam .= '&auth_code=' . $auth_code . '&status=100&tid=' . $_SESSION['nn_tid_elv_at'] . '&vwz3=' . $insert_id . '&vwz3_prefix=' . MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_ORDERNO . '&vwz4=' . date('Y.m.d') . '&vwz4_prefix=' . MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_ORDERDATE . '&order_no=' . $insert_id; + + list($errno, $errmsg, $data) = $this->perform_https_request($url, $urlparam); + + + unset($_SESSION['nn_tid_elv_at']); + unset($_SESSION['bank_account_at']); + unset($_SESSION['bank_code_at']); + unset($_SESSION['bank_account_holder_at']); + unset($_SESSION['max_time_elv_at']); + unset($_SESSION['test_mode_elv_at']); + unset($_SESSION['user_tel_elv_at']); + unset($_SESSION['nn_amount_elv_at']); + unset($_SESSION['user_email_elv_at']); + unset($_SESSION['email_reply_check_elv_at']); + unset($_SESSION['new_novalnet_pin_elv_at']); + unset($_SESSION['elv_at_order_amount']); + if (isset($_SESSION['invalid_count_at'])) { + unset($_SESSION['invalid_count_at']); + } + return false; + } + + ### Store additional order information ### + ### not in use ### + // @param int $zf_order_id + + function after_order_create($zf_order_id) { + return false; + } + + ### Used to display error message details ### + // @return array + + function get_error() { + global $_GET; + + $error = array('title' => MODULE_PAYMENT_NOVALNET_ELV_AT_TEXT_ERROR, + 'error' => stripslashes(urldecode($_GET['error']))); + + return $error; + } + + ### Check to see whether module is installed ### + // @return boolean + + function check() { + global $db; + if (!isset($this->_check)) { + $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_NOVALNET_ELV_AT_STATUS'"); + $this->_check = $check_query->RecordCount(); + } + return $this->_check; + } + + function install_lang($field_text, $lang) { + #Allowed Zones + $install_text['allowed_title'] = array('en' => "Allowed zones", + 'de' => "erlaubte Zonen"); + $install_text['allowed_desc'] = array('en' => "Please enter the desired zones separated by comma (Eg: AT, DE) or leave it blank", + 'de' => "Bitte die gewünschten Zonen durch Komma getrennt eingeben (z.B: AT,DE) oder einfach leer lassen"); + #Enable Module + $install_text['enable_title'] = array('en' => "Enable Module", + 'de' => "Modul aktivieren"); + $install_text['enable_desc'] = array('en' => "Do you want to activate the Credit Card of Novalnet AG?", + 'de' => "Wollen Sie das Kreditkarten Modul des Novalnet AG aktivieren?"); + #Test Mode + $install_text['test_title'] = array('en' => "Enable Test Mode:", + 'de' => "Testmodus einschalten"); + $install_text['test_desc'] = array('en' => "Do you want to activate test mode?", + 'de' => "Wollen Sie den Test-Modus aktivieren?"); + #Vendor id + $install_text['vendor_title'] = array('en' => "Novalnet Merchant ID", + 'de' => "Novalnet Händler ID"); + $install_text['vendor_desc'] = array('en' => "Enter your Novalnet Merchant ID ", + 'de' => "Geben Sie Ihre Novalnet Händler-ID ein "); + #Auth Code + $install_text['auth_title'] = array('en' => "Novalnet Merchant Authorisation Code", + 'de' => "Novalnet Authorisierungsschlüssel"); + $install_text['auth_desc'] = array('en' => "Enter your Novalnet Merchant Authorisation code ", + 'de' => "Geben Sie Ihren Novalnet-Authorisierungsschlüssel ein"); + + #Product id + $install_text['product_title'] = array('en' => "Novalnet Product ID", + 'de' => "Novalnet Produkt ID"); + $install_text['product_desc'] = array('en' => "Enter your Novalnet Product ID", + 'de' => "Geben Sie Ihre Novalnet Produkt-ID ein"); + + #Tariff id + $install_text['tariff_title'] = array('en' => "Novalnet Tariff ID", + 'de' => "Novalnet Tarif ID"); + $install_text['tariff_desc'] = array('en' => "Enter your Novalnet Tariff ID ", + 'de' => "Geben Sie Ihre Novalnet Tarif-ID ein"); + + #Booking amount limit + $install_text['booking_title'] = array('en' => "Manual checking amount in cents", + 'de' => "Manuelle Überprüfung des Betrags in Cent"); + $install_text['booking_desc'] = array('en' => "Please enter the amount in cents", + 'de' => "Bitte den Betrag in Cent eingeben"); + + #Second Product id + $install_text['secondproduct_title'] = array('en' => "Second Product ID in Novalnet", + 'de' => "Zweite Novalnet Produkt ID"); + $install_text['secondproduct_desc'] = array('en' => "for the manual checking", + 'de' => "zur manuellen Überprüfung"); + + #Second Tariff id + $install_text['secondtariff_title'] = array('en' => "Second Tariff ID in Novalnet", + 'de' => "Zweite Novalnet Tarif ID"); + $install_text['secondtariff_desc'] = array('en' => "for the manual checking", + 'de' => "zur manuellen Überprüfung"); + + #Enduser info + $install_text['enduser_title'] = array('en' => "Information to the end customer", + 'de' => "Informationen für den Endkunden"); + $install_text['enduser_desc'] = array('en' => "will appear in the payment form", + 'de' => "wird im Bezahlformular erscheinen"); + + #Sortorder display + $install_text['sortorder_title'] = array('en' => "Sort order of display", + 'de' => "Sortierung nach"); + $install_text['sortorder_desc'] = array('en' => "Sort order of display. Lowest is displayed first.", + 'de' => "Sortierung der Anzeige. Der niedrigste Wert wird zuerst angezeigt."); + + #Setorder status display + $install_text['setorderstatus_title'] = array('en' => "Set Order Status", + 'de' => "Bestellungsstatus setzen"); + $install_text['setorderstatus_desc'] = array('en' => "Set the status of orders made with this payment module to this value.", + 'de' => "Setzen Sie den Status von über dieses Zahlungsmodul durchgeführten Bestellungen auf diesen Wert."); + + #Proxy + $install_text['proxy_title'] = array('en' => "Proxy-Server", + 'de' => "Proxy-Server"); + $install_text['proxy_desc'] = array('en' => " If you use a Proxy Server, enter the Proxy Server IP with port here (e.g. www.proxy.de:80).", + 'de' => "Wenn Sie einen Proxy-Server einsetzen, tragen Sie hier Ihre Proxy-IP und den Port ein (z.B. www.proxy.de:80)."); + + #Payment Zone + $install_text['paymnetzone_title'] = array('en' => "Payment Zone", + 'de' => "Zahlungsgebiet"); + $install_text['paymnetzone_desc'] = array('en' => "If a zone is selected then this module is activated only for Selected zone. ", + 'de' => "Wird ein Bereich ausgewählt, dann wird dieses Modul nur für den ausgewählten Bereich aktiviert."); + + + #Activate Logo Mode + $install_text['logo_title'] = array('en' => "Activate logo mode:", + 'de' => "Aktivieren Sie Logo Modus:"); + $install_text['logo_desc'] = array('en' => "Do you want to activate logo mode?", + 'de' => "Wollen Sie Logo-Modus zu aktivieren?"); + + #Pin by callback sms + $install_text['pinbycallback_title'] = array('en' => "PIN by Callback/SMS/E-Mail", + 'de' => "PIN by Callback/SMS/E-Mail"); + $install_text['pinbycallback_desc'] = array('en' => "When activated by PIN Callback / SMS / E-Mail the customer to enter their phone / mobile number / E-Mail requested. By phone or SMS, the customer receives a PIN from Novalnet AG, which must enter before ordering. If the PIN is valid, the payment process has been completed successfully, otherwise the customer will be prompted again to enter the PIN. This service is only available for customers from specified countries.", + 'de' => "Wenn durch PIN Callback / SMS / E-Mail des Kunden aktiviert, um ihre Telefonnummer / Handynummer / E-Mail angefordert geben. Per Telefon oder SMS, erhält der Kunde eine PIN von Novalnet AG, die vor der Bestellung eingeben müssen. Wenn die PIN gültig ist, hat die Zahlung Prozess erfolgreich beendet wurde, andernfalls hat der Kunde erneut aufgefordert, die PIN einzugeben. Dieser Service ist nur für Kunden aus bestimmten Ländern."); + + #Manual Amount Limit For Pin by callback/sms + $install_text['amountlimitpin_title'] = array('en' => "Minimum Amount Limit for Callback in cents", + 'de' => "Grenzwert (Mindestbetrag) in Cent für Rückruf"); + $install_text['amountlimitpin_desc'] = array('en' => "Please enter minimum amount limit to enable Pin by CallBackmodul (In Cents, e.g. 100,200)", + 'de' => "Bitte geben Sie Mindestbetrag Grenze zu Pin durch CallBack Modul (in Cent, z. B. 100,200) ermÖglichen"); + + #ACDC CONTROL FOR DE + + $install_text['acdccontrol_title'] = array('en' => "Enable ACDC Control", + 'de' => "ACDC-Check aktivieren"); + $install_text['acdccontrol_desc'] = array('en' => "Do you want to activate the ACDC Control?", + 'de' => "Wollen Sie ACDC Control aktivieren?"); + + return $install_text[$field_text][$lang]; + } + + ### Install the payment module and its configuration settings ### + + function install() { + global $db; + + + $allowed_title = $this->install_lang('allowed_title', DEFAULT_LANGUAGE); + $allowed_desc = $this->install_lang('allowed_desc', DEFAULT_LANGUAGE); + + $enable_title = $this->install_lang('enable_title', DEFAULT_LANGUAGE); + $enable_desc = $this->install_lang('enable_desc', DEFAULT_LANGUAGE); + + $test_title = $this->install_lang('test_title', DEFAULT_LANGUAGE); + $test_desc = $this->install_lang('test_desc', DEFAULT_LANGUAGE); + + $vendor_title = $this->install_lang('vendor_title', DEFAULT_LANGUAGE); + $vendor_desc = $this->install_lang('vendor_desc', DEFAULT_LANGUAGE); + + $auth_title = $this->install_lang('auth_title', DEFAULT_LANGUAGE); + $auth_desc = $this->install_lang('auth_desc', DEFAULT_LANGUAGE); + + $product_title = $this->install_lang('product_title', DEFAULT_LANGUAGE); + $product_desc = $this->install_lang('product_desc', DEFAULT_LANGUAGE); + + $tariff_title = $this->install_lang('tariff_title', DEFAULT_LANGUAGE); + $tariff_desc = $this->install_lang('tariff_desc', DEFAULT_LANGUAGE); + + $booking_title = $this->install_lang('booking_title', DEFAULT_LANGUAGE); + $booking_desc = $this->install_lang('booking_desc', DEFAULT_LANGUAGE); + + $secondproduct_title = $this->install_lang('secondproduct_title', DEFAULT_LANGUAGE); + $secondproduct_desc = $this->install_lang('secondproduct_desc', DEFAULT_LANGUAGE); + + $secondtariff_title = $this->install_lang('secondtariff_title', DEFAULT_LANGUAGE); + $secondtariff_desc = $this->install_lang('secondtariff_desc', DEFAULT_LANGUAGE); + + $enduser_title = $this->install_lang('enduser_title', DEFAULT_LANGUAGE); + $enduser_desc = $this->install_lang('enduser_desc', DEFAULT_LANGUAGE); + + $sortorder_title = $this->install_lang('sortorder_title', DEFAULT_LANGUAGE); + $sortorder_desc = $this->install_lang('sortorder_desc', DEFAULT_LANGUAGE); + + $setorderstatus_title = $this->install_lang('setorderstatus_title', DEFAULT_LANGUAGE); + $setorderstatus_desc = $this->install_lang('setorderstatus_desc', DEFAULT_LANGUAGE); + + $proxy_title = $this->install_lang('proxy_title', DEFAULT_LANGUAGE); + $proxy_desc = $this->install_lang('proxy_desc', DEFAULT_LANGUAGE); + + $paymnetzone_title = $this->install_lang('paymnetzone_title', DEFAULT_LANGUAGE); + $paymnetzone_desc = $this->install_lang('paymnetzone_desc', DEFAULT_LANGUAGE); + + $logo_title = $this->install_lang('logo_title', DEFAULT_LANGUAGE); + $logo_desc = $this->install_lang('logo_desc', DEFAULT_LANGUAGE); + + $pinbycallback_title = $this->install_lang('pinbycallback_title', DEFAULT_LANGUAGE); + $pinbycallback_desc = $this->install_lang('pinbycallback_desc', DEFAULT_LANGUAGE); + + $amountlimitpin_title = $this->install_lang('amountlimitpin_title', DEFAULT_LANGUAGE); + $amountlimitpin_desc = $this->install_lang('amountlimitpin_desc', DEFAULT_LANGUAGE); + + /* $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$allowed_title."','MODULE_PAYMENT_NOVALNET_ELV_AT_ALLOWED', '','".$allowed_desc."', '6', '0', now())"); */ + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('" . $enable_title . "', 'MODULE_PAYMENT_NOVALNET_ELV_AT_STATUS', 'True', '" . $enable_desc . "', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('" . $pinbycallback_title . "','MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_SMS','False','" . $pinbycallback_desc . "', '6', '1', 'zen_cfg_select_option(array( \'False\', \'Callback (Telefon & Handy)\', \'SMS (nur Handy)\',\'Email Reply\'), ', now())"); + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $amountlimitpin_title . "','MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_MIN_LIMIT', '','" . $amountlimitpin_desc . "', '6', '2', now())"); + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('" . $test_title . "', 'MODULE_PAYMENT_NOVALNET_ELV_AT_TEST_MODE', 'True', '" . $test_desc . "', '6', '3', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $vendor_title . "', 'MODULE_PAYMENT_NOVALNET_ELV_AT_VENDOR_ID', '', '" . $vendor_desc . "', '6', '4', now())"); + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $auth_title . "', 'MODULE_PAYMENT_NOVALNET_ELV_AT_AUTH_CODE', '', '" . $auth_desc . "', '6', '5', now())"); + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $product_title . "', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PRODUCT_ID', '', '" . $product_desc . "', '6', '6', now())"); + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $tariff_title . "', 'MODULE_PAYMENT_NOVALNET_ELV_AT_TARIFF_ID', '', '" . $tariff_desc . "', '6', '7', now())"); + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $booking_title . "', 'MODULE_PAYMENT_NOVALNET_ELV_AT_MANUAL_CHECK_LIMIT', '', '" . $booking_desc . "', '6', '8', now())"); + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $secondproduct_title . "', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PRODUCT_ID2', '', '" . $secondproduct_desc . "', '6', '9', now())"); + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $secondtariff_title . "', 'MODULE_PAYMENT_NOVALNET_ELV_AT_TARIFF_ID2', '', '" . $secondtariff_desc . "', '6', '10', now())"); + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $enduser_title . "', 'MODULE_PAYMENT_NOVALNET_ELV_AT_INFO', '', '" . $enduser_desc . "', '6', '11', now())"); + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $sortorder_title . "', 'MODULE_PAYMENT_NOVALNET_ELV_AT_SORT_ORDER', '0', '" . $sortorder_desc . "', '6', '12', now())"); + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('" . $setorderstatus_title . "', 'MODULE_PAYMENT_NOVALNET_ELV_AT_ORDER_STATUS_ID', '0', '" . $setorderstatus_desc . "', '6', '13', 'zen_cfg_pull_down_order_statuses(', 'zen_get_order_status_name', now())"); + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('" . $paymnetzone_title . "', 'MODULE_PAYMENT_NOVALNET_ELV_AT_ZONE', '0', '" . $paymnetzone_desc . "', '6', '14', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', now())"); + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $proxy_title . "', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PROXY', '', '" . $proxy_desc . "', '6', '15', now())"); + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('" . $logo_title . "', 'MODULE_PAYMENT_NOVALNET_ELV_AT_LOGO_STATUS', 'True', '" . $logo_desc . "', '6', '16', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + } + + ### Remove the module and all its settings ### + + function remove() { + global $db; + $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); + } + + ### Internal list of configuration keys used for configuration of the module ### + // @return array + + function keys() { + return array( 'MODULE_PAYMENT_NOVALNET_ELV_AT_LOGO_STATUS','MODULE_PAYMENT_NOVALNET_ELV_AT_STATUS', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_SMS', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PIN_BY_CALLBACK_MIN_LIMIT', 'MODULE_PAYMENT_NOVALNET_ELV_AT_TEST_MODE', 'MODULE_PAYMENT_NOVALNET_ELV_AT_VENDOR_ID', 'MODULE_PAYMENT_NOVALNET_ELV_AT_AUTH_CODE', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PRODUCT_ID', 'MODULE_PAYMENT_NOVALNET_ELV_AT_TARIFF_ID', 'MODULE_PAYMENT_NOVALNET_ELV_AT_MANUAL_CHECK_LIMIT', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PRODUCT_ID2', 'MODULE_PAYMENT_NOVALNET_ELV_AT_TARIFF_ID2', 'MODULE_PAYMENT_NOVALNET_ELV_AT_INFO', 'MODULE_PAYMENT_NOVALNET_ELV_AT_SORT_ORDER', 'MODULE_PAYMENT_NOVALNET_ELV_AT_ORDER_STATUS_ID', 'MODULE_PAYMENT_NOVALNET_ELV_AT_ZONE', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PROXY'); + } + +} + +?> diff --git a/includes/modules/payment/novalnet_elv_at_pci.php b/includes/modules/payment/novalnet_elv_at_pci.php new file mode 100644 index 0000000..d5ef7f6 --- /dev/null +++ b/includes/modules/payment/novalnet_elv_at_pci.php @@ -0,0 +1,944 @@ +key = trim(MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_PASSWORD); #'z2Vw3E4j'; + $this->vendor_id = trim(MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_VENDOR_ID); + $this->auth_code = trim(MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_AUTH_CODE); + $this->product_id = trim(MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_PRODUCT_ID); + $this->tariff_id = trim(MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TARIFF_ID); + $this->manual_check_limit = trim(MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_MANUAL_CHECK_LIMIT); + $this->product_id2 = trim(MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_PRODUCT_ID2); + $this->tariff_id2 = trim(MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TARIFF_ID2); + $this->test_mode = (strtolower(MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEST_MODE) == 'true' or MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEST_MODE == '1')? 1: 0; + + $this->code = 'novalnet_elv_at_pci'; + $this->title = MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEXT_TITLE; + $this->public_title = MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEXT_PUBLIC_TITLE; + $this->description = MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEXT_DESCRIPTION; + $this->sort_order = MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_SORT_ORDER; + $this->enabled = ((MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_STATUS == 'True') ? true : false); + $this->proxy = MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_PROXY; + $this->implementation = 'PHP_PCI'; + + + $this->checkReturnedData(); + + if(MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_LOGO_STATUS == 'True'){ + $this->public_title = 'Novalnet'.' '.MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEXT_PUBLIC_TITLE; + $this->title = 'Novalnet'.' '.MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEXT_TITLE; + } + + $this->checkConfigure(); + + if ((int)MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_ORDER_STATUS_ID > 0){ + $this->order_status = MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_ORDER_STATUS_ID; + } + + $this->title = html_entity_decode($this->title, ENT_QUOTES, "UTF-8"); + + if (is_object($order)) $this->update_status(); + $this->form_action_url = 'https://payport.novalnet.de/pci_payport'; + if($_POST['session'] && $_SESSION['payment'] == $this->code){$this->checkSecurity();} + + } + + function checkConfigure() { + if (IS_ADMIN_FLAG == true) { + $this->title = MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEXT_TITLE; // Payment module title in Admin + if(MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_LOGO_STATUS == 'True'){ + $this->public_title = 'Novalnet'.' '.MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEXT_PUBLIC_TITLE; + $this->title = 'Novalnet'.' '.MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEXT_TITLE; + } + if ($this->enabled == 'true' && (!$this->vendor_id || !$this->auth_code || !$this->product_id || !$this->tariff_id || !$this->key )) { + $this->title .= ''.MODULE_PAYMENT_NOVALNET_AT_PCI_NOT_CONFIGURED.''; + } elseif ($this->test_mode == '1') { + $this->title .= ''.MODULE_PAYMENT_NOVALNET_AT_PCI_IN_TEST_MODE.''; + } + + } + } + + ### calculate zone matches and flag settings to determine whether this module should display to customers or not ### + function update_status() { + global $order,$db; + + if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_ZONE > 0) ) { + $check_flag = false; + $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id"); + while (!$check->EOF) { + if ($check->fields['zone_id'] < 1) { + $check_flag = true; + break; + }elseif ($check->fields['zone_id'] == $order->billing['zone_id']) { + $check_flag = true; + break; + } + $check->MoveNext(); + } + + if ($check_flag == false) {$this->enabled = false; } + } + } + + ### JS validation which does error-checking of data-entry if this module is selected for use ### + ### the fields to be cheked are (Bank Owner, Bank Account Number and Bank Code Lengths) ### + ### currently this function is not in use ### + // @return string + function javascript_validation(){ + return false; + } + + ### Builds set of input fields for collecting Bankdetail info ### + // @return array + function selection() { + global $order, $HTTP_POST_VARS, $_POST, $HTTP_GET_VARS, $_GET; + + $onFocus = ''; + if(count($HTTP_POST_VARS)==0 || $HTTP_POST_VARS=='') $HTTP_POST_VARS = $_POST; + + + $selection = array('id' => $this->code, + 'module' => $this->public_title, + 'fields' => array(array('title' => '', 'field' => MODULE_PAYMENT_NOVALNET_INFORMATION_PAYMENT_AT_PCI), + array('title' => '', 'field' => MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_BOOK_REF) + )); + + if(function_exists(get_percent)){ + $selection['module_cost'] = $GLOBALS['ot_payment']->get_percent($this->code); + } + + return $selection; + } + + ### Precheck to Evaluate the Bank Datas ### + function pre_confirmation_check() { + global $HTTP_POST_VARS, $_POST,$messageStack; + if(count($HTTP_POST_VARS)==0 || $HTTP_POST_VARS=='') $HTTP_POST_VARS = $_POST; + #echo'
';var_dump($_REQUEST); exit;
+		$error = '';
+		
+		 if (!function_exists('curl_init') && ($this->code=='novalnet_elv_at_pci')){
+			ini_set('display_errors', 1);
+			ini_set('error_reporting', E_ALL);
+			
+			$error =  MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_CURL_MESSAGE;
+		}
+		
+		if(!$this->vendor_id || !$this->auth_code || !$this->product_id || !$this->tariff_id || !$this->key)
+		{
+		$error = MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEXT_JS_NN_MISSING;
+		}
+		elseif(!empty($this->manual_check_limit) && (!$this->product_id2 || !$this->tariff_id2)){
+			$error = MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEXT_JS_NN_ID2_MISSING;				
+		}
+
+
+		if($error!='')	{
+			  $payment_error_return = 'payment_error=' . $this->code;
+			  $messageStack->add_session('checkout_payment', $error . '', 'error');
+			  zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false));
+		}
+  }
+
+  ### Display Information on the Checkout Confirmation Page ###
+  // @return array
+  function confirmation() {
+		global $HTTP_POST_VARS, $_POST, $order;    
+		$_SESSION['nn_total'] = $order->info['total'];
+		if(count($HTTP_POST_VARS)==0 || $HTTP_POST_VARS=='') $HTTP_POST_VARS = $_POST;
+		#print "in confirmation"; exit;
+
+		return $confirmation;
+  }
+
+  ### Build the data and actions to process when the "Submit" button is pressed on the order-confirmation screen. ###
+  ### These are hidden fields on the checkout confirmation page ###
+  // @return string
+  function process_button() {
+		global $HTTP_POST_VARS, $_POST, $order, $db, $currencies, $messageStack;    
+		if(count($HTTP_POST_VARS)==0 || $HTTP_POST_VARS=='') $HTTP_POST_VARS = $_POST;
+		#Get the required additional customer details from DB
+		$nn_customer_id = (isset($_SESSION['customer_id'])) ? $_SESSION['customer_id'] : '';
+		$customer_values = $db->Execute("SELECT customers_gender, customers_dob, customers_fax FROM ". TABLE_CUSTOMERS . " WHERE customers_id='". (int)$nn_customer_id."'");
+		
+		while(!$customer_values->EOF) {
+			$customer_values->MoveNext();
+		}
+		
+		list($customer_values->fields['customers_dob'], $extra) = explode(' ', $customer_values->fields['customers_dob']);
+
+		if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status_add_tax_ot'] == 1){
+			$totalamount=$order->info['total'] + $order->info['tax'];
+		}else{ 
+			$totalamount=$order->info['total'];
+		}
+		
+		$totalamount = number_format($totalamount * $currencies->get_value($order->info['currency']),2);
+		$amount = str_replace(',', '', $totalamount);
+		$amount = intval(round($amount*100));
+		
+		//$amount =sprintf('%.2f', $totalamount);
+		
+		
+		
+		if (preg_match('/[^\d\.]/', $amount) or !$amount){
+			  ### $amount contains some unallowed chars or empty ###
+			  $err                      = '$amount ('.$amount.') is empty or has a wrong format';
+			  $order->info['comments'] .= '. Novalnet Error Message : '.$err;
+			  $payment_error_return     = 'payment_error='.$this->code;
+			  $messageStack->add_session('checkout_payment', $err . '', 'error');
+			  zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false));      
+		}
+		
+			$vendor_id  = $this->vendor_id;
+			$auth_code  = $this->auth_code;
+			$product_id = $this->product_id;
+			$tariff_id  = $this->tariff_id;
+			$test_mode  = (strtolower(MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEST_MODE) == 'true' or MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEST_MODE == '1')? 1: 0;
+			$uniqid     = uniqid();
+			
+			$customer_id = $_SESSION['customer_id'];
+			
+			// $amount = preg_replace('/^0+/', '', $amount);
+			// $amount = sprintf('%0.2f', $amount);
+			// $amount = str_replace('.', '', $amount);
+			#echo __CLASS__.' : '.$order->info['total']." <=> $amount
"; + + $_SESSION['nn_amount_elv_at_pci'] = $amount; + + $manual_check_limit = $this->manual_check_limit; + $manual_check_limit = str_replace(',', '', $manual_check_limit); + $manual_check_limit = str_replace('.', '', $manual_check_limit); + + if($manual_check_limit && $amount>=$manual_check_limit) + { + $product_id = $this->product_id2; + $tariff_id = $this->tariff_id2; + } + + + $user_ip = $this->getRealIpAddr(); + + $checkout_url = zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'); + + if(strstr($checkout_url, '?')){ + $checkout_url = str_replace(' ', '', $checkout_url); + if(substr($checkout_url,-1)=='?')$error_url = $checkout_url.'payment_error=novalnet_elv_at_pci&error=$ERROR_MESSAGE ($STATUS)'; + else $error_url = $checkout_url.'&payment_error=novalnet_elv_at_pci&error=$ERROR_MESSAGE ($STATUS)'; + } + else $error_url = $checkout_url.'?payment_error=novalnet_elv_at_pci&error=$ERROR_MESSAGE ($STATUS)'; + + $test_mode = (strtolower(MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEST_MODE) == 'true' or MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEST_MODE == '1')? 1: 0; + + $_SESSION['order_status_id_value']=$this->order_status; + + $oldreturnurl=zen_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL'); + $old_value=explode(':',$oldreturnurl); + $new_protocol_value=(empty($_SERVER["HTTPS"])) ? 'http' : 'https'; + $return_url=$new_protocol_value.':'.$old_value[1]; + + $uniqid = uniqid(); + + + list($auth_code, $product_id, $tariff_id, $amount, $test_mode, $uniqid, $hash) = $this->encodeParams($auth_code, $product_id, $tariff_id, $amount, $test_mode, $uniqid); + + $firstname = !empty($order->customer['firstname']) ? $order->customer['firstname'] : $order->billing['firstname']; + $lastname = !empty($order->customer['lastname']) ? $order->customer['lastname'] : $order->billing['lastname']; + $email_address = !empty($order->customer['email_address']) ? $order->customer['email_address'] : $order->billing['email_address']; + $street_address = !empty($order->customer['street_address']) ? $order->customer['street_address'] : $order->billing['street_address']; + $city = !empty($order->customer['city']) ? $order->customer['city'] : $order->billing['city']; + $postcode = !empty($order->customer['postcode']) ? $order->customer['postcode'] : $order->billing['postcode']; + $country_iso_code_2 = !empty($order->customer['country']['iso_code_2']) ? $order->customer['country']['iso_code_2'] : $order->billing['country']['iso_code_2']; + $customer_no = ($customer['customers_status'] != 1) ? $nn_customer_id : MODULE_PAYMENT_NOVALNET_AT_PCI_GUEST_USER; + + + $process_button_string = zen_draw_hidden_field('vendor_id', $vendor_id) . + zen_draw_hidden_field('product_id', $product_id) . + zen_draw_hidden_field('payment_id', $this->payment_key) . + zen_draw_hidden_field('tariff_id', $tariff_id) . + zen_draw_hidden_field('vendor_authcode', $auth_code) . + zen_draw_hidden_field('currency', $order->info['currency']) . + zen_draw_hidden_field('amount', $amount) . + zen_draw_hidden_field('hash', $hash) . + zen_draw_hidden_field('uniqid', $uniqid) . + zen_draw_hidden_field('gender', 'u') . + zen_draw_hidden_field('first_name', $this->html_to_utf8($firstname)) . + zen_draw_hidden_field('last_name', $this->html_to_utf8($lastname)) . + zen_draw_hidden_field('email', $email_address) . + zen_draw_hidden_field('street', $this->html_to_utf8($street_address)) . + zen_draw_hidden_field('search_in_street', '1') . + zen_draw_hidden_field('city', $this->html_to_utf8($city)) . + zen_draw_hidden_field('zip', $postcode) . + zen_draw_hidden_field('country', $country_iso_code_2) . + zen_draw_hidden_field('country_code', $country_iso_code_2) . + zen_draw_hidden_field('lang', MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEXT_LANG) . + zen_draw_hidden_field('language', MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEXT_LANG) . + zen_draw_hidden_field('remote_ip', $user_ip) . + zen_draw_hidden_field('tel', $order->customer['telephone']) . + zen_draw_hidden_field('fax', $customer['customers_fax']) . + zen_draw_hidden_field('birth_date', $customer_values->fields['customers_dob']) . + zen_draw_hidden_field('session', zen_session_id()) . + zen_draw_hidden_field('return_url', $return_url) . + zen_draw_hidden_field('return_method', 'POST') . + zen_draw_hidden_field('error_return_url', $error_url) . + zen_draw_hidden_field('test_mode', $test_mode) . + zen_draw_hidden_field('error_return_method', 'POST'). + zen_draw_hidden_field('customer_no', $customer_no) . + zen_draw_hidden_field('use_utf8', '1') . + zen_draw_hidden_field('implementation', strtoupper($this->implementation)). + zen_draw_hidden_field('proxy', $this->proxy); + return $process_button_string; + + } + + ### Insert the Novalnet Transaction ID in DB ### + function before_process() { + global $_POST, $order; + if($_POST['tid'] && $_POST['status'] == '100'){ + if( $this->order_status ) { + $order->info['order_status'] = $this->order_status; + } + + if ($_POST['test_mode'] == 1){ + $order->info['comments'] .= '
'.MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEST_ORDER_MESSAGE.'
'; + } + + $order->info['comments'] .= '
'.MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TID_MESSAGE.$_POST['tid'].'

'; + $order->info['comments'] = str_replace(array('', '','','', '
','
','
'), array('', '', '','',"\n", "\n","\n"), $order->info['comments']); + + } + } + + function isPublicIP($value){ + if(!$value || count(explode('.',$value))!=4) return false; + return !preg_match('~^((0|10|172\.16|192\.168|169\.254|255|127\.0)\.)~', $value); + } + + ### get the real Ip Adress of the User ### + function getRealIpAddr(){ + if($this->isPublicIP($_SERVER['HTTP_X_FORWARDED_FOR'])) return $_SERVER['HTTP_X_FORWARDED_FOR']; + if($iplist=explode(',', $_SERVER['HTTP_X_FORWARDED_FOR'])){ + if($this->isPublicIP($iplist[0])) return $iplist[0]; + } + if ($this->isPublicIP($_SERVER['HTTP_CLIENT_IP'])) return $_SERVER['HTTP_CLIENT_IP']; + if ($this->isPublicIP($_SERVER['HTTP_X_CLUSTER_CLIENT_IP'])) return $_SERVER['HTTP_X_CLUSTER_CLIENT_IP']; + if ($this->isPublicIP($_SERVER['HTTP_FORWARDED_FOR']) ) return $_SERVER['HTTP_FORWARDED_FOR']; + + return $_SERVER['REMOTE_ADDR']; + } + + ### Send the order detail to Novalnet ### + function after_process(){ + + global $order, $customer_id, $insert_id,$db,$_POST; + + $vendor_id = $this->vendor_id; + $auth_code = $this->auth_code; + $product_id = $this->product_id; + $tariff_id = $this->tariff_id; + + $manual_check_limit = $this->manual_check_limit; + $manual_check_limit = str_replace(',', '', $manual_check_limit); + $manual_check_limit = str_replace('.', '', $manual_check_limit); + + if($manual_check_limit && $_SESSION['nn_amount_elv_at_pci']>=$manual_check_limit) + { + $product_id = $this->product_id2;; + $tariff_id = $this->tariff_id2; + } + + if($_POST['tid'] != ''){ + ### Pass the Order Reference to paygate ## + $url = 'https://payport.novalnet.de/paygate.jsp'; + $urlparam = 'vendor='.$vendor_id.'&product='.$product_id.'&key='.$this->payment_key.'&tariff='.$tariff_id; + $urlparam .= '&auth_code='.$auth_code.'&status=100&tid='.$_POST['tid'].'&vwz2='.MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEXT_ORDERNO.''.$insert_id.'&vwz3='.MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEXT_ORDERDATE.''.date('Y-m-d H:i:s').'&order_no='.$insert_id; + list($errno, $errmsg, $data) = $this->perform_https_request($url, $urlparam); + $_POST['tid'] = ''; + ### Implement here the Emailversand and further functions, incase if you want to send a own email ### + } + unset($_SESSION['nn_amount_elv_at_pci']); + return false; + } + + ### Used to display error message details ### + // @return array + function get_error() + { + global $HTTP_GET_VARS, $_GET; + if(count($HTTP_GET_VARS)==0 || $HTTP_GET_VARS=='') $HTTP_GET_VARS = $_GET; + $error = array('title' => MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEXT_ERROR, 'error' => stripslashes(utf8_decode($HTTP_GET_VARS['error']))); + return $error; + } + + ### Check to see whether module is installed ### + // @return boolean + function check() + { + global $db; + if (!isset($this->_check)) + { + $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_STATUS'"); + $this->_check = $check_query->RecordCount(); + } + return $this->_check; + } + + function install_lang($field_text,$lang) + { + #Allowed Zones + $install_text['allowed_title'] = array('en' => "Allowed zones", + 'de' => "erlaubte Zonen"); + $install_text['allowed_desc'] = array('en' => "Please enter the desired zones separated by comma (Eg: AT, DE) or leave it blank", + 'de' => "Bitte die gewünschten Zonen durch Komma getrennt eingeben (z.B: AT,DE) oder einfach leer lassen"); + #Enable Module + $install_text['enable_title'] = array('en' => "Enable Module", + 'de' => "Modul aktivieren"); + $install_text['enable_desc'] = array('en' => "Do you want to activate the Credit Card of Novalnet AG?", + 'de' => "Wollen Sie das Kreditkarten Modul des Novalnet AG aktivieren?"); + #Test Mode + $install_text['test_title'] = array('en' => "Enable Test Mode:", + 'de' => "Testmodus einschalten"); + $install_text['test_desc'] = array('en' => "Do you want to activate test mode?", + 'de' => "Wollen Sie den Test-Modus aktivieren?"); + #Vendor id + $install_text['vendor_title'] = array('en' => "Novalnet Merchant ID", + 'de' => "Novalnet Händler ID"); + $install_text['vendor_desc'] = array('en' => "Enter your Novalnet Merchant ID ", + 'de' => "Geben Sie Ihre Novalnet Händler-ID ein "); + #Auth Code + $install_text['auth_title'] = array('en' => "Novalnet Merchant Authorisation Code", + 'de' => "Novalnet Authorisierungsschlüssel"); + $install_text['auth_desc'] = array('en' => "Enter your Novalnet Merchant Authorisation code ", + 'de' => "Geben Sie Ihren Novalnet-Authorisierungsschlüssel ein"); + + #Product id + $install_text['product_title'] = array('en' => "Novalnet Product ID", + 'de' => "Novalnet Produkt ID"); + $install_text['product_desc'] = array('en' => "Enter your Novalnet Product ID", + 'de' => "Geben Sie Ihre Novalnet Produkt-ID ein"); + + #Tariff id + $install_text['tariff_title'] = array('en' => "Novalnet Tariff ID", + 'de' => "Novalnet Tarif ID"); + $install_text['tariff_desc'] = array('en' => "Enter your Novalnet Tariff ID ", + 'de' => "Geben Sie Ihre Novalnet Tarif-ID ein"); + + #Booking amount limit + $install_text['booking_title'] = array('en' => "Manual checking amount in cents", + 'de' => "Manuelle Überprüfung des Betrags in Cent"); + $install_text['booking_desc'] = array('en' => "Please enter the amount in cents", + 'de' => "Bitte den Betrag in Cent eingeben"); + + #Second Product id + $install_text['secondproduct_title'] = array('en' => "Second Product ID in Novalnet", + 'de' => "Zweite Novalnet Produkt ID"); + $install_text['secondproduct_desc'] = array('en' => "for the manual checking", + 'de' => "zur manuellen Überprüfung"); + + #Second Tariff id + $install_text['secondtariff_title'] = array('en' => "Second Tariff ID in Novalnet", + 'de' => "Zweite Novalnet Tarif ID"); + $install_text['secondtariff_desc'] = array('en' => "for the manual checking", + 'de' => "zur manuellen Überprüfung"); + + #Enduser info + $install_text['enduser_title'] = array('en' => "Information to the end customer", + 'de' => "Informationen für den Endkunden"); + $install_text['enduser_desc'] = array('en' => "will appear in the payment form", + 'de' => "wird im Bezahlformular erscheinen"); + + #Sortorder display + $install_text['sortorder_title'] = array('en' => "Sort order of display", + 'de' => "Sortierung nach"); + $install_text['sortorder_desc'] = array('en' => "Sort order of display. Lowest is displayed first.", + 'de' => "Sortierung der Anzeige. Der niedrigste Wert wird zuerst angezeigt."); + + #Setorder status display + $install_text['setorderstatus_title'] = array('en' => "Set Order Status", + 'de' => "Bestellungsstatus setzen"); + $install_text['setorderstatus_desc'] = array('en' => "Set the status of orders made with this payment module to this value.", + 'de' => "Setzen Sie den Status von über dieses Zahlungsmodul durchgeführten Bestellungen auf diesen Wert."); + + #Proxy + $install_text['proxy_title'] = array('en' => "Proxy-Server", + 'de' => "Proxy-Server"); + $install_text['proxy_desc'] = array('en' => " If you use a Proxy Server, enter the Proxy Server IP with port here (e.g. www.proxy.de:80).", + 'de' => "Wenn Sie einen Proxy-Server einsetzen, tragen Sie hier Ihre Proxy-IP und den Port ein (z.B. www.proxy.de:80)."); + + #Payment Zone + $install_text['paymnetzone_title'] = array('en' => "Payment Zone", + 'de' => "Zahlungsgebiet"); + $install_text['paymnetzone_desc'] = array('en' => "If a zone is selected then this module is activated only for Selected zone. ", + 'de' => "Wird ein Bereich ausgewählt, dann wird dieses Modul nur für den ausgewählten Bereich aktiviert."); + + #Novalnet Password + $install_text['password_title'] = array('en' => "Novalnet Password", + 'de' => "Novalnet Passwort"); + $install_text['password_desc'] = array('en' => "Enter your Novalnet Password.", + 'de' => "Geben Sie Ihr Novalnet Passwort ein."); + + #Activate Logo Mode + $install_text['logo_title'] = array('en' => "Activate logo mode:", + 'de' => "Aktivieren Sie Logo Modus:"); + $install_text['logo_desc'] = array('en' => "Do you want to activate logo mode?", + 'de' => "Wollen Sie Logo-Modus zu aktivieren?"); + + return $install_text[$field_text][$lang]; + } + + ### Install the payment module and its configuration settings ### + function install() { + global $db; + + $allowed_title = $this->install_lang('allowed_title', DEFAULT_LANGUAGE); + $allowed_desc = $this->install_lang('allowed_desc', DEFAULT_LANGUAGE); + + $enable_title = $this->install_lang('enable_title', DEFAULT_LANGUAGE); + $enable_desc = $this->install_lang('enable_desc', DEFAULT_LANGUAGE); + + $test_title = $this->install_lang('test_title', DEFAULT_LANGUAGE); + $test_desc = $this->install_lang('test_desc', DEFAULT_LANGUAGE); + + $vendor_title = $this->install_lang('vendor_title', DEFAULT_LANGUAGE); + $vendor_desc = $this->install_lang('vendor_desc', DEFAULT_LANGUAGE); + + $auth_title = $this->install_lang('auth_title', DEFAULT_LANGUAGE); + $auth_desc = $this->install_lang('auth_desc', DEFAULT_LANGUAGE); + + $product_title = $this->install_lang('product_title', DEFAULT_LANGUAGE); + $product_desc = $this->install_lang('product_desc', DEFAULT_LANGUAGE); + + $tariff_title = $this->install_lang('tariff_title', DEFAULT_LANGUAGE); + $tariff_desc = $this->install_lang('tariff_desc', DEFAULT_LANGUAGE); + + $booking_title = $this->install_lang('booking_title', DEFAULT_LANGUAGE); + $booking_desc = $this->install_lang('booking_desc', DEFAULT_LANGUAGE); + + $secondproduct_title = $this->install_lang('secondproduct_title', DEFAULT_LANGUAGE); + $secondproduct_desc = $this->install_lang('secondproduct_desc', DEFAULT_LANGUAGE); + + $secondtariff_title = $this->install_lang('secondtariff_title', DEFAULT_LANGUAGE); + $secondtariff_desc = $this->install_lang('secondtariff_desc', DEFAULT_LANGUAGE); + + $enduser_title = $this->install_lang('enduser_title', DEFAULT_LANGUAGE); + $enduser_desc = $this->install_lang('enduser_desc', DEFAULT_LANGUAGE); + + $sortorder_title = $this->install_lang('sortorder_title', DEFAULT_LANGUAGE); + $sortorder_desc = $this->install_lang('sortorder_desc', DEFAULT_LANGUAGE); + + $setorderstatus_title = $this->install_lang('setorderstatus_title', DEFAULT_LANGUAGE); + $setorderstatus_desc = $this->install_lang('setorderstatus_desc', DEFAULT_LANGUAGE); + + $proxy_title = $this->install_lang('proxy_title', DEFAULT_LANGUAGE); + $proxy_desc = $this->install_lang('proxy_desc', DEFAULT_LANGUAGE); + + $paymnetzone_title = $this->install_lang('paymnetzone_title', DEFAULT_LANGUAGE); + $paymnetzone_desc = $this->install_lang('paymnetzone_desc', DEFAULT_LANGUAGE); + + $password_title = $this->install_lang('password_title', DEFAULT_LANGUAGE); + $password_desc = $this->install_lang('password_desc', DEFAULT_LANGUAGE); + + $logo_title = $this->install_lang('logo_title', DEFAULT_LANGUAGE); + $logo_desc = $this->install_lang('logo_desc', DEFAULT_LANGUAGE); + + /*$db->Execute("alter table ".TABLE_ORDERS." modify payment_method varchar(250)"); + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Allowed zones', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_ALLOWED', '', 'Please enter the zones separately which should be allowed to use this modul (e. g. AT,DE (leave empty if you want to allow all zones))', '6', '0', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable ELV-AT Module', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_STATUS', 'True', 'Do you want to activate the Austrian Direct Debit Method(ELV-AT) of Novalnet AG?', '6', '1', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Test Mode', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEST_MODE', 'True', 'Do you want to enable the test mode?', '6', '2', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Please contact sales@novalnet.de if you do not have any of the following Novalnet IDs!

Wenn Sie keine oder irgendeine der folgenden Novalnet IDs nicht haben sollten, bitte sich an sales@novalnet.de wenden!

Novalnet Merchant ID', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_VENDOR_ID', '', 'Your Merchant ID of Novalnet', '6', '3', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Novalnet Authorisation Code', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_AUTH_CODE', '', 'Your Authorisation Code of Novalnet', '6', '4', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Novalnet Product ID', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_PRODUCT_ID', '', 'Your Product ID of Novalnet', '6', '5', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Novalnet Tariff ID', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TARIFF_ID', '', 'Your Tariff ID of Novalnet', '6', '6', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Manual checking amount in cents', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_MANUAL_CHECK_LIMIT', '', 'Please enter the amount in cents', '6', '7', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Your second Product ID in Novalnet', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_PRODUCT_ID2', '', 'for the manual checking', '6', '8', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('The Tariff ID of the second product', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TARIFF_ID2', '', 'for the manual checking', '6', '9', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Password please', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_PASSWORD', '', 'for the manual checking', '6', '10', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Your Booking Reference at Novalnet', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_BOOK_REF', '', 'Your Booking Reference at Novalnet', '6', '11', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '12', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '13', 'zen_cfg_pull_down_order_statuses(', 'zen_get_order_status_name', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '14', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Proxy', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_PROXY', '0', 'If you use a Proxy Server, enter the Proxy Server IP with port here (e.g. www.proxy.de:80)', '6', '15', now())");*/ + + /*$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$allowed_title."','MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_ALLOWED', '','".$allowed_desc."', '6', '0', now())"); */ + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('".$enable_title."', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_STATUS', 'True', '".$enable_desc."', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('".$test_title."', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEST_MODE', 'True', '".$test_desc."', '6', '1', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$vendor_title."', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_VENDOR_ID', '', '".$vendor_desc."', '6', '3', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$auth_title."', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_AUTH_CODE', '', '".$auth_desc."', '6', '4', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$product_title."', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_PRODUCT_ID', '', '".$product_desc."', '6', '5', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$tariff_title."', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TARIFF_ID', '', '".$tariff_desc."', '6', '6', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$booking_title."', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_MANUAL_CHECK_LIMIT', '', '".$booking_desc."', '6', '7', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$secondproduct_title."', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_PRODUCT_ID2', '', '".$secondproduct_desc."', '6', '8', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$secondtariff_title."', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TARIFF_ID2', '', '".$secondtariff_desc."', '6', '9', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$enduser_title."', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_BOOK_REF', '', '".$enduser_desc."', '6', '10', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$sortorder_title."', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_SORT_ORDER', '0', '".$sortorder_desc."', '6', '11', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('".$setorderstatus_title."', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_ORDER_STATUS_ID', '0', '".$setorderstatus_desc."', '6', '12', 'zen_cfg_pull_down_order_statuses(', 'zen_get_order_status_name', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('".$paymnetzone_title."', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_ZONE', '0', '".$paymnetzone_desc."', '6', '13', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$password_title."', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_PASSWORD', '', '".$password_desc."', '6', '14', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$proxy_title."', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_PROXY', '', '".$proxy_desc."', '6', '15', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('".$logo_title."', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_LOGO_STATUS', 'True', '".$logo_desc."', '6', '16', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + + } + + ### Remove the module and all its settings ### + function remove() + { + global $db; + $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); + } + + ### Internal list of configuration keys used for configuration of the module ### + // @return array + function keys() + { + return array( 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_LOGO_STATUS','MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_STATUS', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEST_MODE', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_VENDOR_ID', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_AUTH_CODE', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_PRODUCT_ID', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TARIFF_ID', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_MANUAL_CHECK_LIMIT', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_PRODUCT_ID2', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TARIFF_ID2','MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_PASSWORD','MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_BOOK_REF', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_SORT_ORDER', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_ORDER_STATUS_ID', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_ZONE', 'MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_PROXY'); + } + + + + + ### replace the Special German Charectors ### + function ReplaceSpecialGermanChars($string){ + $what = array("ä", "ö", "ü", "Ä", "Ö", "Ü", "ß"); + $how = array("ae", "oe", "ue", "Ae", "Oe", "Ue", "ss"); + + $string = str_replace($what, $how, $string); + + return $string; + } + + function html_to_utf8 ($data){ + return preg_replace("/\\&\\#([0-9]{3,10})\\;/e", '$this->_html_to_utf8("\\1")', $data); + } + + function _html_to_utf8 ($data){ + if ($data > 127){ + $i = 5; + while (($i--) > 0){ + if ($data != ($a = $data % ($p = pow(64, $i)))){ + $ret = chr(base_convert(str_pad(str_repeat(1, $i + 1), 8, "0"), 2, 10) + (($data - $a) / $p)); + for ($i; $i > 0; $i--) + $ret .= chr(128 + ((($data % pow(64, $i)) - ($data % ($p = pow(64, $i - 1)))) / $p)); + break; + } + } + }else{ + $ret = "&#$data;"; + } + return $ret; + } + + ### Realtime accesspoint for communication to the Novalnet paygate ### + function perform_https_request($nn_url, $urlparam){ + $debug = 0;#set it to 1 if you want to activate the debug mode + + if($debug) print "
perform_https_request: $nn_url
\n\r\n"; + if($debug) print "perform_https_request: $urlparam
\n\r\n"; + + ## some prerquisites for the connection + $ch = curl_init($nn_url); + curl_setopt($ch, CURLOPT_POST, 1); // a non-zero parameter tells the library to do a regular HTTP post. + curl_setopt($ch, CURLOPT_POSTFIELDS, $urlparam); // add POST fields + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); // don't allow redirects + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // decomment it if you want to have effective ssl checking + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // decomment it if you want to have effective ssl checking + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable + curl_setopt($ch, CURLOPT_TIMEOUT, 240); // maximum time, in seconds, that you'll allow the CURL functions to take + + if ($this->proxy){ + curl_setopt($ch, CURLOPT_PROXY, $this->proxy); + } + + ## establish connection + $data = curl_exec($ch); + //$data = $this->ReplaceSpecialGermanChars($data); + + ## determine if there were some problems on cURL execution + $errno = curl_errno($ch); + $errmsg = curl_error($ch); + + ###bug fix for PHP 4.1.0/4.1.2 (curl_errno() returns high negative value in case of successful termination) + if($errno < 0) $errno = 0; + ##bug fix for PHP 4.1.0/4.1.2 + + if($debug){ + print_r(curl_getinfo($ch)); + echo "\n

\n\n\nperform_https_request: cURL error number:" . $errno . "\n
\n\n"; + echo "\n\n\nperform_https_request: cURL error:" . $errmsg . "\n
\n\n"; + } + + #close connection + curl_close($ch); + + ## read and return data from novalnet paygate + if($debug) print "
\n\n" . $data . "\n
\n\n"; + + return array ($errno, $errmsg, $data); + } + + function debug2($object, $filename, $debug = false){ + if (!$debug){return;} + $fh = fopen("/tmp/$filename", 'a+'); + fwrite($fh, date('Y-m-d H:i:s').' '.print_r($object, true)); + fwrite($fh, "


\n"); + fclose($fh); + } + + function checkSecurity() { + global $_POST, $order, $insert_id, $messageStack; + + if(strlen(trim($_POST['tid']))==17 && $_POST['status']==100 && $_POST['session']== zen_session_id()){ + #xtc_redirect(zen_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL')); + }else{ + if($_POST['status_desc']){ + $error_status = $_POST['status_desc']; + }else { + $error_status = "There was an error and your payment could not be completed "; + } + $err = $error_status; + #'session missing or returned session is wrong'; + $order->info['comments'] .= '. Novalnet Error Message : '.$err; + $payment_error_return = 'payment_error='.$this->code/*.'&error='.$err*/; + $messageStack->add_session('checkout_payment', $err . '', 'error'); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + } + function encode($data){ + $data = trim($data); + if ($data == '') return'Error: no data'; + if (!function_exists('base64_encode') or !function_exists('pack') or !function_exists('crc32')){return'Error: func n/a';} + + try { + $crc = sprintf('%u', crc32($data));# %u is a must for ccrc32 returns a signed value + $data = $crc."|".$data; + $data = bin2hex($data.$this->key); + $data = strrev(base64_encode($data)); + } + catch (Exception $e){ + echo('Error: '.$e); + } + return $data; + } + + function decode($data){ + $data = trim($data); + if ($data == ''){ + return'Error: no data'; + } + if (!function_exists('base64_decode') or !function_exists('pack') or !function_exists('crc32')){ + return'Error: func n/a'; + } + + try { + $data = base64_decode(strrev($data)); + $data = pack("H".strlen($data), $data); + $data = substr($data, 0, stripos($data, $this->key)); + $pos = strpos($data, "|"); + if ($pos === false){ + return("Error: CKSum not found!"); + } + $crc = substr($data, 0, $pos); + $value = trim(substr($data, $pos+1)); + if ($crc != sprintf('%u', crc32($value))){ + return("Error; CKSum invalid!"); + } + return $value; + } + catch (Exception $e){ + echo('Error: '.$e); + } + } + + function hash($h){ #$h contains encoded data + global $amount_zh; + if (!$h) return'Error: no data'; + if (!function_exists('md5')){return'Error: func n/a';} + return md5($h['auth_code'].$h['product_id'].$h['tariff'].$h['amount'].$h['test_mode'].$h['uniqid'].strrev($this->key)); + } + + function checkHash($request){ + if (!$request) return false; #'Error: no data'; + $h['auth_code'] = $request['vendor_authcode'];#encoded + $h['product_id'] = $request['product_id'];#encoded + $h['tariff'] = $request['tariff_id'];#encoded + $h['amount'] = $request['amount'];#encoded + $h['test_mode'] = $request['test_mode'];#encoded + $h['uniqid'] = $request['uniqid'];#encoded + if ($request['hash2']!= $this->hash($h)){ + return false; + } + return true; + } + + function checkHash4java($request){ + if (!$request) return false; #'Error: no data'; + $h['auth_code'] = $request['auth_code'];#encoded + $h['product_id'] = $request['product_id'];#encoded + $h['tariff'] = $request['tariff_id'];#encoded + $h['amount'] = $request['amount'];#encoded + $h['test_mode'] = $request['test_mode'];#encoded + $h['uniqid'] = $request['uniqid'];#encoded + + if ($request['hash2'] != $this->hash($h)) + { + return false; + } + return true; + } + + function encode4java($data = '', $func = ''){ + $salt = 1010; + if (!isset($data) or trim($data) == '' or !$func){ + return'Error: missing arguments: $str and/or $func!'; + } + if ($func != 'decbin' and $func != 'bindec'){ + return'Error: $func has wrong value!'; + } + if ($func == 'decbin'){ + return decbin(intval($data) + intval($salt)); + }else{ + return bindec($data) - intval($salt); + } + } + function checkReturnedData(){ + if ($_POST['hash2'] && $_SESSION['payment'] == $this->code){ + if (strtoupper($this->implementation) == 'JAVA_PCI'){ + #Java encoded + if( $_POST['vendor_authcode'] != md5(MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_AUTH_CODE.strrev($this->key)) ){ + $err = MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEXT_HASH_ERROR.'; wrong auth_code!'; + $payment_error_return = 'payment_error=novalnet_elv_at_pci&error='.$_POST['status_text'].'; '.$err; + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + $_POST['auth_code'] = MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_AUTH_CODE;#todo: check? + $_POST['product_id'] = $this->encode4java($_POST['product_id'], 'bindec'); + $_POST['tariff_id'] = $this->encode4java($_POST['tariff_id'], 'bindec'); + $_POST['amount'] = $this->encode4java($_POST['amount'], 'bindec'); + $_POST['test_mode'] = $this->encode4java($_POST['test_mode'], 'bindec'); + $_POST['uniqid'] = $this->encode4java($_POST['uniqid'], 'bindec'); + + if (!$this->checkHash4java($_POST)){ #PHP encoded + $err = MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEXT_HASH_ERROR; + $payment_error_return = 'payment_error=novalnet_elv_at_pci&error='.$_POST['status_text'].'; '.$err; + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + }else{ #PHP encoded + if (!$this->checkHash($_POST)){ + $err = MODULE_PAYMENT_NOVALNET_ELV_AT_PCI_TEXT_HASH_ERROR; + $payment_error_return = 'payment_error=novalnet_elv_at_pci&error='.$_POST['status_text'].'; '.$err; + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + }else{ + $_POST['test_mode'] = $this->decode($_POST['test_mode']); + } + } + } + } + + function encodeParams($auth_code, $product_id, $tariff_id, $amount, $test_mode, $uniqid){ + if (strtoupper($this->implementation) == 'JAVA_PCI'){ + $uniqid = time();#must ne a long integer + $hash = md5($auth_code.$product_id.$tariff_id.$amount.$test_mode.$uniqid.strrev($this->key)); + $auth_code = md5($auth_code.strrev($this->key)); + $product_id = $this->encode4java($product_id, 'decbin'); + $tariff_id = $this->encode4java($tariff_id, 'decbin'); + $amount = $this->encode4java($amount, 'decbin'); + $test_mode = $this->encode4java($test_mode, 'decbin'); + $uniqid = $this->encode4java($uniqid, 'decbin'); + }else{ + $auth_code = $this->encode($auth_code); + $product_id = $this->encode($product_id); + $tariff_id = $this->encode($tariff_id); + $amount = $this->encode($amount); + $test_mode = $this->encode($test_mode); + $uniqid = $this->encode($uniqid); + $hash = $this->hash(array('auth_code' => $auth_code, 'product_id' => $product_id, 'tariff' => $tariff_id, 'amount' => $amount, 'test_mode' => $test_mode, 'uniqid' => $uniqid)); + } + return array($auth_code, $product_id, $tariff_id, $amount, $test_mode, $uniqid, $hash); + } + + +} +/* +flow of functions: +selection -> $order-info['total'] wrong, cause shipping_cost is net +pre_confirmation_check -> $order-info['total'] wrong, cause shipping_cost is net +confirmation -> $order-info['total'] right, cause shipping_cost is gross +process_button -> $order-info['total'] right, cause shipping_cost is gross +before_process -> $order-info['total'] wrong, cause shipping_cost is net +after_process -> $order-info['total'] right, cause shipping_cost is gross +--------------- +flow of url/path: +/xtcommerce/account.php +/xtcommerce/account_history_info.php +/xtcommerce/address_book.php +/xtcommerce/checkout_shipping.php +/xtcommerce/checkout_shipping.php +/xtcommerce/checkout_payment.php +/xtcommerce/checkout_confirmation.php +*/ + +?> diff --git a/includes/modules/payment/novalnet_elv_de.php b/includes/modules/payment/novalnet_elv_de.php new file mode 100644 index 0000000..1d1b2a5 --- /dev/null +++ b/includes/modules/payment/novalnet_elv_de.php @@ -0,0 +1,1154 @@ +vendor_id = trim(MODULE_PAYMENT_NOVALNET_ELV_DE_VENDOR_ID); + $this->auth_code = trim(MODULE_PAYMENT_NOVALNET_ELV_DE_AUTH_CODE); + $this->product_id = trim(MODULE_PAYMENT_NOVALNET_ELV_DE_PRODUCT_ID); + $this->tariff_id = trim(MODULE_PAYMENT_NOVALNET_ELV_DE_TARIFF_ID); + $this->manual_check_limit = trim(MODULE_PAYMENT_NOVALNET_ELV_DE_MANUAL_CHECK_LIMIT); + $this->product_id2 = trim(MODULE_PAYMENT_NOVALNET_ELV_DE_PRODUCT_ID2); + $this->tariff_id2 = trim(MODULE_PAYMENT_NOVALNET_ELV_DE_TARIFF_ID2); + $this->test_mode = (strtolower(MODULE_PAYMENT_NOVALNET_ELV_DE_TEST_MODE) == 'true' or MODULE_PAYMENT_NOVALNET_ELV_DE_TEST_MODE == '1')? 1: 0; + + + + $this->code = 'novalnet_elv_de'; + $this->title = MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_TITLE; + $this->public_title = MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_PUBLIC_TITLE; + $this->description = MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_DESCRIPTION; + $this->sort_order = MODULE_PAYMENT_NOVALNET_ELV_DE_SORT_ORDER; + $this->enabled = ((MODULE_PAYMENT_NOVALNET_ELV_DE_STATUS == 'True') ? true : false); + $this->proxy = MODULE_PAYMENT_NOVALNET_ELV_DE_PROXY; + + + + /*if(MODULE_PAYMENT_ELV_DE_LOGO_STATUS == 'True'){ + $this->public_title = ' Novalnet '.MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_PUBLIC_TITLE; + }*/ + + if(MODULE_PAYMENT_ELV_DE_LOGO_STATUS == 'True'){ + $this->public_title = 'Novalnet'.' '.MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_PUBLIC_TITLE; + $this->title = 'Novalnet'.' '.MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_TITLE; + } + + $this->checkConfigure(); + + if ((int)MODULE_PAYMENT_NOVALNET_ELV_DE_ORDER_STATUS_ID > 0) { + $this->order_status = MODULE_PAYMENT_NOVALNET_ELV_DE_ORDER_STATUS_ID; + } + + if (is_object($order)) $this->update_status(); + + // Check the tid in session and make the second call + if($_SESSION['nn_tid_elv_de']){ + + if( (empty($_SESSION['invalid_count_de'])) || ( isset($_SESSION['max_time_elv_de']) && (time() >= $_SESSION['max_time_elv_de'])) ){ + $_SESSION['invalid_count_de'] = 0; + } + if( !empty($_SESSION['invalid_count_de']) && $_SESSION['invalid_count_de'] == 3 ){ + + if($_SESSION['max_time_elv_de'] && (time() < $_SESSION['max_time_elv_de'])){ + $payment_error_return = 'payment_error=' . $this->code . '&error=' . utf8_encode( MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_SESSION_ERROR ); + } + + } + + //Check the time limit + if($_SESSION['max_time_elv_de'] && time() > $_SESSION['max_time_elv_de']){ + unset($_SESSION['nn_tid_elv_de']); + unset($_SESSION['invalid_count_de']); + + $payment_error_return = 'payment_error=' . $this->code; + $messageStack->add_session('checkout_payment', MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_SESSION_ERROR . '', 'error'); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + + } + + if( $_GET['new_novalnet_pin_elv_de'] == 'true') + { + $_SESSION['new_novalnet_pin_elv_de'] = true; + $this->secondcall(); + } + } + + // define callback types + $this->isActivatedCallback = false; + if(MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_SMS != 'False'){ + $this->isActivatedCallback = true; + } + + } + + function checkConfigure() { + if (IS_ADMIN_FLAG == true) { + $this->title = MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_TITLE; // Payment module title in Admin + if(MODULE_PAYMENT_ELV_DE_LOGO_STATUS == 'True'){ + $this->public_title = 'Novalnet'.' '.MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_PUBLIC_TITLE; + $this->title = 'Novalnet'.' '.MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_TITLE; + } + if ($this->enabled == 'true' && (!$this->vendor_id || !$this->auth_code || !$this->product_id || !$this->tariff_id )) { + $this->title .= ''.MODULE_PAYMENT_NOVALNET_ELV_DE_NOT_CONFIGURED.''; + } elseif ($this->test_mode == '1') { + $this->title .= ''.MODULE_PAYMENT_NOVALNET_ELV_DE_IN_TEST_MODE.''; + } + + } + } + + ### calculate zone matches and flag settings to determine whether this module should display to customers or not ### + function update_status() { + global $order, $db; + + if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_NOVALNET_ELV_DE_ZONE > 0) ) { + $check_flag = false; + $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_NOVALNET_ELV_DE_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id"); + while (!$check->EOF) { + if ($check->fields['zone_id'] < 1) { + $check_flag = true; + break; + } elseif ($check->fields['zone_id'] == $order->billing['zone_id']) { + $check_flag = true; + break; + } + $check->MoveNext(); + } + + if ($check_flag == false) { + $this->enabled = false; + } + } + } + + ### JS validation which does error-checking of data-entry if this module is selected for use ### + ### the fields to be cheked are (Bank Owner, Bank Account Number and Bank Code Lengths) ### + ### currently this function is not in use ### + // @return string + function javascript_validation() { + return false; + } + + ### Builds set of input fields for collecting Bankdetail info ### + // @return array + function selection() { + global $order, $_POST, $_GET; + $onFocus = ' onfocus="methodSelect(\'pmt-' . $this->code . '\')"'; + // $onFocus = ''; + $billing_iso_code = strtolower($order->customer['country']['iso_code_2']); + $bank_account = ''; + if (isset($_POST['bank_account'])) {$bank_account = $_POST['bank_account'];} + if(!$bank_account and isset($_GET['bank_account'])) {$bank_account = $_GET['bank_account'];} + if (isset($_POST['bank_code'])){$bank_code = $_POST['bank_code'];} + $bank_code = ''; + if(!$bank_code and isset($_GET['bank_code'])) {$bank_code=$_GET['bank_code'];} + + if(!$_SESSION['nn_tid_elv_de']){ + $selection = array('id' => $this->code, + 'module' => $this->public_title, + 'fields' => array(array('title' => MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_BANK_ACCOUNT_OWNER, + 'field' => zen_draw_input_field('bank_account_holder', $order->billing['firstname'] . ' ' . $order->billing['lastname'], 'id="'.$this->code.'-bank_account_holder"' . $onFocus), + 'tag' => $this->code.'-bank_account_holder'), + array('title' => MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_BANK_ACCOUNT_NUMBER, + 'field' => zen_draw_input_field('bank_account', '', 'id="' . $this->code . '-bank_account" AUTOCOMPLETE="OFF"' . $onFocus), + 'tag' => $this->code . '-bank_account'), + array('title' => MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_BANK_CODE, + 'field' => zen_draw_input_field('bank_code', '', 'id="' . $this->code . '-bank_code" AUTOCOMPLETE="OFF"' . $onFocus), + 'tag' => $this->code . '-bank_code'), + array('title' => '', 'field' => MODULE_PAYMENT_NOVALNET_INFORMATION_PAYMENT_DE), + #array('title' => 'INFO:', 'field' => MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_CUST_INFORM), + array('title' => '', 'field' => MODULE_PAYMENT_NOVALNET_ELV_DE_INFO) + )); + + if(MODULE_PAYMENT_NOVALNET_ELV_DE_ACDC=="True") + { + $aryAcdc = array('title' => '', 'field' => zen_draw_checkbox_field('acdc', '1', false, 'id="' . $this->code . '-acdc"' . $onFocus).MODULE_PAYMENT_NOVALNET_ELV_DE_ACDC_INFO); + array_push($selection['fields'], $aryAcdc); + $aryAcdc = array('title' => '', 'field' => MODULE_PAYMENT_NOVALNET_ELV_DE_ACDC_DIV); + array_push($selection['fields'], $aryAcdc); + } + + // Display callback fields + $amount_check = $this->findTotalAmount(); + if($this->isActivatedCallback && in_array($billing_iso_code, $this->nnelvde_allowed_pin_country_list) && $amount_check >= MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_MIN_LIMIT ) + { + if( MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_SMS == 'Email Reply' ){ + $_SESSION['user_email_elv_de'] = ($_SESSION['user_email_elv_de'] == '')?$order->customer['email_address']:$_SESSION['user_email_elv_de']; + + $selection['fields'][] = array( 'title' => MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_EMAIL_REQ, 'field' => zen_draw_input_field ( 'user_email_elv_de', $_SESSION['user_email_elv_de'], 'id="'.$this->code.'-callback" AUTOCOMPLETE="OFF"'.$onFocus ) ); + }else{ + $_SESSION['user_tel_elv_de'] = ($_SESSION['user_tel_elv_de'] == '')?$order->customer['telephone']:$_SESSION['user_tel_elv_de']; + + $label_str =(MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_SMS == 'Callback (Telefon & Handy)')?MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_TEL_REQ:MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_SMS_REQ; + + $selection['fields'][] = array( 'title' => $label_str, 'field' => zen_draw_input_field ( 'user_tel_elv_de', $_SESSION['user_tel_elv_de'], 'id="'.$this->code.'-callback" AUTOCOMPLETE="OFF"'.$onFocus ) ); + } + } + } + $amount_check = $_SESSION['nn_amount_elv_de']; + + if($this->isActivatedCallback && in_array($billing_iso_code, $this->nnelvde_allowed_pin_country_list) && $amount_check >= MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_MIN_LIMIT && isset($_SESSION['nn_tid_elv_de']) && ($_SESSION['invalid_count_de'] < 3) ) + { + + $selection = array('id' => $this->code,'module' => $this->public_title); + if( MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_SMS == 'Email Reply' ){ + $selection['fields'][] = array( 'title' => MODULE_PAYMENT_NOVALNET_ELV_DE_EMAIL_INPUT_REQUEST_DESC); + }else{ + $selection = array('id' => $this->code, + 'module' => $this->public_title); + // Show PIN field, after first call + $selection['fields'][] = array( 'title' => MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_SMS_PIN, 'field' => zen_draw_input_field( 'novalnet_pin_elv_de', '', 'id="'.$this->code.'-callback" AUTOCOMPLETE="OFF"'.$onFocus) ); + $selection['fields'][] = array( 'title' => ''.MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_SMS_NEW_PIN.'') ; + } + } + + return $selection; + } + + ### Precheck to Evaluate the Bank Datas ### + ### Precheck to Evaluate the Bank Datas ### + function pre_confirmation_check() { + global $HTTP_POST_VARS, $_POST, $order,$messageStack; + $billing_iso_code = strtolower($order->customer['country']['iso_code_2']); + if(count($HTTP_POST_VARS)==0 || $HTTP_POST_VARS=='') $HTTP_POST_VARS = $_POST; + + // print_r($_SESSION['elv_de_order_amount']); exit; + + $HTTP_POST_VARS['bank_account_holder'] = trim($HTTP_POST_VARS['bank_account_holder']); + $HTTP_POST_VARS['bank_account'] = trim($HTTP_POST_VARS['bank_account']); + $HTTP_POST_VARS['bank_code'] = trim($HTTP_POST_VARS['bank_code']); + $HTTP_POST_VARS['acdc'] = trim($HTTP_POST_VARS['acdc']); + + if(isset($HTTP_POST_VARS['user_tel_elv_de'])) + $HTTP_POST_VARS['user_tel_elv_de'] = trim($HTTP_POST_VARS['user_tel_elv_de']); + + if(isset($HTTP_POST_VARS['user_email_elv_de'])) + $HTTP_POST_VARS['user_email_elv_de'] = trim($HTTP_POST_VARS['user_email_elv_de']); + + if(isset($HTTP_POST_VARS['novalnet_pin_elv_de'])) + $HTTP_POST_VARS['novalnet_pin_elv_de'] = trim($HTTP_POST_VARS['novalnet_pin_elv_de']); + + // Callback stuff.... + + if($_SESSION['nn_tid_elv_de']) + { + + //check the amount is equal with the first call or not + $amount = $this->findTotalAmount(); + if($_SESSION['elv_de_order_amount'] != $amount){ + + if( MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_SMS == 'Email Reply' ){ + $error_message = MODULE_PAYMENT_NOVALNET_ELV_DE_AMOUNT_VARIATION_MESSAGE_EMAIL; + }elseif( MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_SMS == 'Callback (Telefon & Handy)' || MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_SMS == 'SMS (nur Handy)' ) + { + $error_message = MODULE_PAYMENT_NOVALNET_ELV_DE_AMOUNT_VARIATION_MESSAGE; + } + + unset($_SESSION['nn_tid_elv_de']); + unset($_SESSION['elv_de_order_amount']); + if(isset($_SESSION['invalid_count_de'])) + { + unset($_SESSION['invalid_count_de']); + } + $payment_error_return = 'payment_error=' . $this->code; + $messageStack->add_session('checkout_payment', $error_message . '', 'error'); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + if(isset($HTTP_POST_VARS['novalnet_pin_elv_de']) && isset($_SESSION['nn_tid_elv_de'])) { + // check pin + //if( !is_numeric( $HTTP_POST_VARS['novalnet_pin_elv_de'] ) || strlen( $HTTP_POST_VARS['novalnet_pin_elv_de'] ) != 4 ) + if($HTTP_POST_VARS['novalnet_pin_elv_de'] == '' || (preg_match('/[&_#%\^<>@$=*!]/',$HTTP_POST_VARS['novalnet_pin_elv_de']))) + { + $payment_error_return = 'payment_error=' . $this->code . '&error=' . utf8_encode( MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_SMS_PIN_NOTVALID ); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + }else{ + if( $HTTP_POST_VARS['novalnet_pin_elv_de'] ) + $_SESSION['novalnet_pin_elv_de'] = $HTTP_POST_VARS['novalnet_pin_elv_de']; + } + } + return; + }else{ + $error = ''; + + if (!function_exists('curl_init') && ($this->_code=='novalnet_elv_de')){ + ini_set('display_errors', 1); + ini_set('error_reporting', E_ALL); + + $error = MODULE_PAYMENT_NOVALNET_ELV_DE_CURL_MESSAGE; + } + if (!isset($_SESSION['nn_tid_elv_de'])) { + if(!$this->vendor_id || !$this->auth_code || !$this->product_id || !$this->tariff_id) + { + $error = MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_JS_NN_MISSING; + } + elseif(!empty($this->manual_check_limit) && (!$this->product_id2 || !$this->tariff_id2)) + { + + $error = MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_JS_NN_ID2_MISSING; + } + elseif(!$HTTP_POST_VARS['bank_account_holder'] || (preg_match('/[#%\^<>@$=*!]/',$HTTP_POST_VARS['bank_account_holder']))){ + $error = MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_JS_BANK_ACCOUNT_OWNER; + } + elseif(preg_match('/[^\d]/',$HTTP_POST_VARS['bank_account'])) { + $error = MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_JS_BANK_ERROR_ACCOUNT_NUMBER; + } + elseif(!$HTTP_POST_VARS['bank_account'] || strlen($HTTP_POST_VARS['bank_account'])findTotalAmount(); + if( $this->isActivatedCallback && in_array($billing_iso_code, $this->nnelvde_allowed_pin_country_list) && $amount_check >= MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_MIN_LIMIT ){ + + //checking email address + if (isset($HTTP_POST_VARS['user_email_elv_de'])){ + if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $HTTP_POST_VARS['user_email_elv_de'])){ + $error .= MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_EMAIL_NOTVALID ; + } + } + //checking telephone number + if (isset($HTTP_POST_VARS['user_tel_elv_de'])){ + if( strlen( $HTTP_POST_VARS['user_tel_elv_de'] ) < 8 || !is_numeric( $HTTP_POST_VARS['user_tel_elv_de'] ) ){ + $error .= MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_SMS_TEL_NOTVALID ; + } + } + if($error!='') { + /*$payment_error_return = 'payment_error=' . $this->code . '&error=' . utf8_encode($error); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false));*/ + + $payment_error_return = 'payment_error=' . $this->code; + $messageStack->add_session('checkout_payment', utf8_encode($error) . '', 'error'); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + }else{ + $_SESSION['user_tel_elv_de'] = $HTTP_POST_VARS['user_tel_elv_de']; + if (isset($HTTP_POST_VARS['user_email_elv_de'])) + { + $error_msg = MODULE_PAYMENT_NOVALNET_ELV_DE_EMAIL_INPUT_REQUEST_DESC; + } + else + { + $error_msg = MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_INPUT_REQUEST_DESC ; + } + + // firstcall() + $this->before_process(); + $payment_error_return = 'payment_error=' . $this->code; + $messageStack->add_session('checkout_payment', $error_msg . '', 'error'); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + return; + } + + } + if($error!='') { + $payment_error_return = 'payment_error=' . $this->code; + $messageStack->add_session('checkout_payment', $error . '', 'error'); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + } + } + } + + + + + + //This is user defined function used for getting order amount in cents with tax + public function findTotalAmount(){ + global $order, $currencies; + if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) { + $total = $order->info['total'] + $order->info['tax']; + } else { + $total = $order->info['total']; + } + $totalamount = number_format($total * $currencies->get_value($order->info['currency']),2); + $amount = str_replace(',', '', $totalamount); + $amount = intval(round($amount*100)); + + if (preg_match('/[^\d\.]/', $total) or !$total){ + ### $amount contains some unallowed chars or empty ### + $err = 'amount ('.$total.') is empty or has a wrong format'; + $payment_error_return = 'payment_error='.$this->code; + $messageStack->add_session('checkout_payment', $err . '', 'error'); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + // $amount = sprintf('%0.2f', $total); + // $amount = preg_replace('/^0+/', '', $amount); + // $amount = str_replace('.', '', $amount); + return $amount; + } + + + + public function secondCall() + { + $xmlresponse_erros =''; + // If customer forgets PIN, send a new PIN + if( $_SESSION['new_novalnet_pin_elv_de'] ) + $request_type = 'TRANSMIT_PIN_AGAIN'; + else + $request_type = 'PIN_STATUS'; + if($_SESSION['email_reply_check_elv_de']=='Email Reply') + $request_type = 'REPLY_EMAIL_STATUS'; + + if( $_SESSION['new_novalnet_pin_elv_de'] ) + $_SESSION['new_novalnet_pin_elv_de'] = false; + + $xml = ''; + $xml = ' + + + '.$this->vendor_id.' + '.$this->auth_code.' + '.$request_type.' + '.$_SESSION['nn_tid_elv_de'].''; + if($request_type != 'REPLY_EMAIL_STATUS') + $xml .= ''.$_SESSION['novalnet_pin_elv_de'].'';$xml .= ' + + '; + + $xml_response = $this->curl_xml_post( $xml ); + + // Parse XML Response to object + $xml_response = simplexml_load_string( $xml_response ); + #$_SESSION['status'] = $xml_response->status; + if($xml_response->status != ''){ + $xmlresponse_erros = $xml_response->status; + } + if($xmlresponse_erros=='') + { + $errormesage = $xml_response->pin_status->status_message; + $payment_error_return = 'payment_error='.$this->code.'&error='.utf8_encode($errormesage); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + else + { + if( $xml_response->status != 100 ) + { + if($xml_response->status == '0529005'){ + $_SESSION['invalid_count_de'] = $_SESSION['invalid_count_de'] + 1; + if($_SESSION['invalid_count_de'] == 3) { + $payment_error_return = 'payment_error='.$this->code.'&error='.utf8_encode(MODULE_PAYMENT_NOVALNET_ELV_DE_MAX_TIME_ERROR); + } + else { $payment_error_return = 'payment_error='.$this->code.'&error='.utf8_encode($xml_response->status_message);} + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + else + { + $payment_error_return = 'payment_error='.$this->code.'&error='.utf8_encode($xml_response->status_message); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + } + else + { + $array = (array) $xml_response; + // add tid, because it's missing in the answer + $array['tid'] = $_SESSION['nn_tid_elv_de']; + $array['statusdesc'] = $array['status_message']; // Param-name is changed + $array['test_mode'] = $_SESSION['test_mode_elv_de']; + return $array; + } + } + } + + public function curl_xml_post( $request ) + { + $ch = curl_init( "https://payport.novalnet.de/nn_infoport.xml" ); + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: close')); + curl_setopt($ch, CURLOPT_POST, 1); // a non-zero parameter tells the library to do a regular HTTP post. + curl_setopt($ch, CURLOPT_POSTFIELDS, $request); // add POST fields + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); // don't allow redirects + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // decomment it if you want to have effective ssl checking + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // decomment it if you want to have effective ssl checking + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable + curl_setopt($ch, CURLOPT_TIMEOUT, 240); // maximum time, in seconds, that you'll allow the CURL functions to take + + ## establish connection + $xml_response = curl_exec($ch); + + ## determine if there were some problems on cURL execution + $errno = curl_errno($ch); + $errmsg = curl_error($ch); + + ###bug fix for PHP 4.1.0/4.1.2 (curl_errno() returns high negative value in case of successful termination) + if($errno < 0) $errno = 0; + ##bug fix for PHP 4.1.0/4.1.2 + + if($debug) + { + print_r(curl_getinfo($ch)); + echo "\n

\n\n\nperform_https_request: cURL error number:" . $errno . "\n
\n\n"; + echo "\n\n\nperform_https_request: cURL error:" . $errmsg . "\n
\n\n"; + } + + #close connection + curl_close($ch); + + return $xml_response; + } + + + ### Display Bank Information on the Checkout Confirmation Page ### + // @return array + function confirmation() { + global $HTTP_POST_VARS,$_POST, $order;; + + + if(count($HTTP_POST_VARS)==0 || $HTTP_POST_VARS=='') $HTTP_POST_VARS = $_POST; + + $cardnoInfo = $_SESSION['bank_account']; + $codeInfo = $_SESSION['bank_code']; + + if($cardnoInfo) { + $cardnoInfo=str_pad(substr($cardnoInfo,0,-4),strlen($cardnoInfo),'*',STR_PAD_RIGHT); + } + if($codeInfo) { + $codeInfo=str_pad(substr($codeInfo,0,-4),strlen($codeInfo),'*',STR_PAD_RIGHT); + } + $confirmation = array('fields' => array(array('title' => MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_BANK_ACCOUNT_OWNER, + 'field' => $_SESSION['bank_account_holder']), + array('title' => MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_BANK_ACCOUNT_NUMBER, + 'field' => $cardnoInfo), + array('title' => MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_BANK_CODE, + 'field' => $codeInfo) + )); + + + return $confirmation; + } + + ### Build the data and actions to process when the "Submit" button is pressed on the order-confirmation screen. ### + ### These are hidden fields on the checkout confirmation page ### + // @return string + + function process_button() { + global $HTTP_POST_VARS, $_POST; + + if(count($HTTP_POST_VARS)==0 || $HTTP_POST_VARS=='') $HTTP_POST_VARS = $_POST; + + $process_button_string = zen_draw_hidden_field('bank_account_holder', $_SESSION['bank_account_holder']) . + zen_draw_hidden_field('bank_account', $_SESSION['bank_account']) . + zen_draw_hidden_field('bank_code', $_SESSION['bank_code']) . + zen_draw_hidden_field('acdc', $_SESSION['acdc']); + + return $process_button_string; + } + + + ### Store the BANK info to the order ### + ### This sends the data to the payment gateway for processing and Evaluates the Bankdatas for acceptance and the validity of the Bank Details ### + function before_process() { + global $_POST, $order, $db, $currencies, $messageStack; + $billing_iso_code = strtolower($order->customer['country']['iso_code_2']); + if(count($HTTP_POST_VARS)==0 || $HTTP_POST_VARS=='') $HTTP_POST_VARS = $_POST; + $_SESSION['nn_amount_elv_de'] = $this->findTotalAmount(); + // Setting callback type // see constructor + // First call is done, so check PIN / second call... + if( $_SESSION['nn_tid_elv_de'] && $this->isActivatedCallback ) + { + if( MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_SMS == 'Email Reply' ) + $_SESSION['email_reply_check_elv_de']='Email Reply'; + else + unset($_SESSION['email_reply_check_elv_de']); + $_SESSION['new_novalnet_pin_elv_de']=false; + + if($aryResponse = $this->secondCall()){ + if( $this->order_status ) + $order->info['order_status'] = $this->order_status; + if($_SESSION['test_mode_elv_de'] == 1 || $test_mode ) + $order->info['comments'] .= '
'.MODULE_PAYMENT_NOVALNET_ELV_DE_TEST_ORDER_MESSAGE.'
'; + $order->info['comments'] .= '
'.MODULE_PAYMENT_NOVALNET_ELV_DE_TID_MESSAGE.$_SESSION['nn_tid_elv_de'].'

'; + $order->info['comments'] = str_replace(array('', '','','', '
','
','
'), array('', '', '','',"\n", "\n","\n"), $order->info['comments']); + } + return; + } + + + $test_mode = (strtolower(MODULE_PAYMENT_NOVALNET_ELV_DE_TEST_MODE) == 'true' or MODULE_PAYMENT_NOVALNET_ELV_DE_TEST_MODE == '1')? 1: 0; + + + #Get the required additional customer details from DB + $nn_customer_id = (isset($_SESSION['customer_id'])) ? $_SESSION['customer_id'] : ''; + $customer_values = $db->Execute("SELECT customers_gender, customers_firstname, customers_lastname, customers_dob, customers_email_address, customers_telephone, customers_fax, customers_email_format FROM ". TABLE_CUSTOMERS . " WHERE customers_id='".(int)$_SESSION['customer_id']."'"); + while(!$customer_values->EOF) + { + $customer_values->MoveNext(); + } + list($customer_values->fields['customers_dob'], $extra) = explode(' ', $customer_values->fields['customers_dob']); + ### Process the payment to paygate ## + $url = 'https://payport.novalnet.de/paygate.jsp'; + //$amount = $this->findTotalAmount(); + $amount = $_SESSION['nn_amount_elv_de']; + + + $user_ip = $this->getRealIpAddr(); + + $vendor_id = $this->vendor_id; + $auth_code = $this->auth_code; + $product_id = $this->product_id; + $tariff_id = $this->tariff_id; + $customer_id = $_SESSION['customer_id']; + + $manual_check_limit = $this->manual_check_limit; + $manual_check_limit = str_replace(',', '', $manual_check_limit); + $manual_check_limit = str_replace('.', '', $manual_check_limit); + + if($manual_check_limit && $amount>=$manual_check_limit) + { + $product_id = $this->product_id2; + $tariff_id = $this->tariff_id2; + } + $acdc = ''; + if($_POST['acdc']){$acdc = "&acdc=1";} + + //set the user telephone + $tel_param = '&tel='; + if($_SESSION['user_tel_elv_de']) + $user_telephone = $_SESSION['user_tel_elv_de']; + else + $user_telephone = $order->customer['telephone']; + //set the user email + if($_SESSION['user_email_elv_de']) + $user_email = $_SESSION['user_email_elv_de']; + else + $user_email = $order->customer['email_address']; + + //set the user telephone + if($_SESSION['user_tel_elv_de']){ + $user_telephone = $_SESSION['user_tel_elv_de']; + }else{ + $user_telephone = $order->customer['telephone']; + } + // set post params + if( $this->isActivatedCallback && in_array($billing_iso_code, $this->nnelvde_allowed_pin_country_list) && $amount >= MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_MIN_LIMIT ){ + if( MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_SMS == 'Callback (Telefon & Handy)' ){ + $this->callback_type = '&pin_by_callback=1'; + $user_telephone = '&tel='.$user_telephone; + } + if( MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_SMS == 'SMS (nur Handy)' ){ + $this->callback_type = '&pin_by_sms=1'; + $user_telephone = '&mobile='.$user_telephone; + } + if( MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_SMS == 'Email Reply' ){ + $this->callback_type = '&reply_email_check=1'; + } + } + + $firstname = !empty($order->customer['firstname']) ? $order->customer['firstname'] : $order->billing['firstname']; + $lastname = !empty($order->customer['lastname']) ? $order->customer['lastname'] : $order->billing['lastname']; + $email_address = !empty($order->customer['email_address']) ? $order->customer['email_address'] : $order->billing['email_address']; + $street_address = !empty($order->customer['street_address']) ? $order->customer['street_address'] : $order->billing['street_address']; + $city = !empty($order->customer['city']) ? $order->customer['city'] : $order->billing['city']; + $postcode = !empty($order->customer['postcode']) ? $order->customer['postcode'] : $order->billing['postcode']; + $country_iso_code_2 = !empty($order->customer['country']['iso_code_2']) ? $order->customer['country']['iso_code_2'] : $order->billing['country']['iso_code_2']; + $customer_no = ($customer['customers_status'] != 1) ? $nn_customer_id : MODULE_PAYMENT_NOVALNET_ELV_DE_GUEST_USER; + + $urlparam = 'vendor='.$vendor_id.'&product='.$product_id.'&key='.$this->payment_key.'&tariff='.$tariff_id.'&auth_code='.$auth_code.'¤cy='.$order->info['currency']; + $urlparam .= '&bank_account_holder='.utf8_encode($HTTP_POST_VARS['bank_account_holder']).'&bank_account='.$HTTP_POST_VARS['bank_account']; + $urlparam .= '&bank_code='.$HTTP_POST_VARS['bank_code'].'&first_name='.$firstname.'&last_name='.$lastname; + $urlparam .= '&street='.$street_address.'&city='.$city.'&zip='.$postcode; + $urlparam .= '&country='.$country_iso_code_2.'&email='.$email_address; + $urlparam .= '&search_in_street=1'.'&tel='.$user_telephone.'&remote_ip='.$user_ip.$acdc; + $urlparam .= '&gender='.$customer['customers_gender'].'&birth_date='.$customer_values->fields['customers_dob'].'&fax='.$customer['customers_fax']; + $urlparam .= '&language='.MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_LANG; + $urlparam .= '&lang='.MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_LANG; + $urlparam .= '&test_mode='.$test_mode; + $urlparam .= '&customer_no='.$customer_no; + $urlparam .= '&use_utf8=1'; + $urlparam .= '&amount='.$amount; + $urlparam .= $this->callback_type; + + list($errno, $errmsg, $data) = $this->perform_https_request($url, $urlparam); + + $aryResponse = array(); + #capture the result and message and other parameters from response data '$data' in an array + $aryPaygateResponse = explode('&', $data); + foreach($aryPaygateResponse as $key => $value) + { + if($value!="") + { + $aryKeyVal = explode("=",$value); + $aryResponse[$aryKeyVal[0]] = $aryKeyVal[1]; + } + } + + + if($aryResponse['status']==100) + { + ### Passing through the Transaction ID from Novalnet's paygate into order-info ### + if( $this->isActivatedCallback && in_array($billing_iso_code, $this->nnelvde_allowed_pin_country_list) && $amount >= MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_MIN_LIMIT ){ + $_SESSION['elv_de_order_amount']= $amount; + $_SESSION['nn_tid_elv_de'] = $aryResponse['tid']; + // To avoide payment method confussion add code in session + //set session for maximum time limit to 30 minutes + $_SESSION['max_time_elv_de'] = time() + (30 * 60); + //TEST BILLING MESSAGE BASED ON THE RESPONSE TEST MODE + $_SESSION['test_mode_elv_de'] = $aryResponse['test_mode']; + }else{ + $test_mode = (strtolower(MODULE_PAYMENT_NOVALNET_ELV_DE_TEST_MODE) == 'true' or MODULE_PAYMENT_NOVALNET_ELV_DE_TEST_MODE == '1')? 1: 0; + if($aryResponse['test_mode'] == 1 || $test_mode ) + $order->info['comments'] .= '
'.MODULE_PAYMENT_NOVALNET_ELV_DE_TEST_ORDER_MESSAGE.'
'; + + if( $this->order_status ) + $order->info['order_status'] = $this->order_status; + + $order->info['comments'] .= '
'.MODULE_PAYMENT_NOVALNET_ELV_DE_TID_MESSAGE.$aryResponse['tid'].'

'; + $_SESSION['nn_tid_elv_de'] = $aryResponse['tid']; + $order->info['comments'] = str_replace(array('', '','','', '
','
','
'), array('', '', '','',"\n", "\n","\n"), $order->info['comments']); + } + } + else + { + ### Passing through the Error Response from Novalnet's paygate into order-info ### + $order->info['comments'] .= 'Novalnet Error Code : '.$aryResponse['status'].', Novalnet Error Message : '.$aryResponse['status_desc']; + + $payment_error_return = 'payment_error=' . $this->code; + $messageStack->add_session('checkout_payment', $aryResponse['status_desc'] . '', 'error'); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + + } + + ### Realtime accesspoint for communication to the Novalnet paygate ### + function perform_https_request($nn_url, $urlparam) + { + $debug = 0;#set it to 1 if you want to activate the debug mode + + if($debug) print "
perform_https_request: $nn_url
\n\r\n"; + if($debug) print "perform_https_request: $urlparam
\n\r\n"; + + ## some prerquisites for the connection + $ch = curl_init($nn_url); + curl_setopt($ch, CURLOPT_POST, 1); // a non-zero parameter tells the library to do a regular HTTP post. + curl_setopt($ch, CURLOPT_POSTFIELDS, $urlparam); // add POST fields + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); // don't allow redirects + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // decomment it if you want to have effective ssl checking + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // decomment it if you want to have effective ssl checking + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable + curl_setopt($ch, CURLOPT_TIMEOUT, 240); // maximum time, in seconds, that you'll allow the CURL functions to take + if ($this->proxy) {curl_setopt($ch, CURLOPT_PROXY, $this->proxy); } + + ## establish connection + $data = curl_exec($ch); + //$data = $this->ReplaceSpecialGermanChars($data); + + ## determine if there were some problems on cURL execution + $errno = curl_errno($ch); + $errmsg = curl_error($ch); + + ###bug fix for PHP 4.1.0/4.1.2 (curl_errno() returns high negative value in case of successful termination) + if($errno < 0) $errno = 0; + ##bug fix for PHP 4.1.0/4.1.2 + + if($debug) + { + print_r(curl_getinfo($ch)); + echo "\n

\n\n\nperform_https_request: cURL error number:" . $errno . "\n
\n\n"; + echo "\n\n\nperform_https_request: cURL error:" . $errmsg . "\n
\n\n"; + } + + #close connection + curl_close($ch); + + ## read and return data from novalnet paygate + if($debug) print "
\n\n" . $data . "\n
\n\n"; + + return array ($errno, $errmsg, $data); + } + + ### replace the Special German Charectors ### + function ReplaceSpecialGermanChars($string) + { + $what = array("ä", "ö", "ü", "Ä", "Ö", "Ãœ", "ß"); + $how = array("ae", "oe", "ue", "Ae", "Oe", "Ue", "ss"); + + $string = str_replace($what, $how, $string); + + return $string; + } + + ### get the real Ip Adress of the User ### + function getRealIpAddr() + { + if (!empty($_SERVER['HTTP_CLIENT_IP'])) //check ip from share internet + { + $ip=$_SERVER['HTTP_CLIENT_IP']; + } + elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy + { + $ip=$_SERVER['HTTP_X_FORWARDED_FOR']; + } + else + { + $ip=$_SERVER['REMOTE_ADDR']; + } + + return $ip; + } + + ### Send additional information about bankdata via email to the store owner ### + ### Send the order detail to Novalnet ### + function after_process() { + global $order, $customer_id, $insert_id; + + $amount = $_SESSION['nn_amount_elv_de']; + + $vendor_id = $this->vendor_id; + $auth_code = $this->auth_code; + $product_id = $this->product_id; + $tariff_id = $this->tariff_id; + + $manual_check_limit = $this->manual_check_limit; + $manual_check_limit = str_replace(',', '', $manual_check_limit); + $manual_check_limit = str_replace('.', '', $manual_check_limit); + + if($manual_check_limit && $amount>=$manual_check_limit) + { + $product_id = $this->product_id2; + $tariff_id = $this->tariff_id2; + } + + $url = 'https://payport.novalnet.de/paygate.jsp'; + $urlparam = 'vendor='.$vendor_id.'&product='.$product_id.'&key='.$this->payment_key.'&tariff='.$tariff_id; + $urlparam .= '&auth_code='.$auth_code.'&status=100&tid='.$_SESSION['nn_tid_elv_de'].'&vwz3='.$insert_id.'&vwz3_prefix='.MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_ORDERNO.'&vwz4='.date('Y.m.d').'&vwz4_prefix='.MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_ORDERDATE.'&order_no='.$insert_id; + + list($errno, $errmsg, $data) = $this->perform_https_request($url, $urlparam); + + unset($_SESSION['nn_tid_elv_de']); + unset($_SESSION['bank_account']); + unset($_SESSION['bank_code']); + unset($_SESSION['bank_account_holder']); + unset($_SESSION['max_time_elv_de']); + unset($_SESSION['test_mode_elv_de']); + unset($_SESSION['user_tel_elv_de']); + unset($_SESSION['nn_amount_elv_de']); + unset($_SESSION['user_email_elv_de']); + unset($_SESSION['email_reply_check_elv_de']); + unset($_SESSION['new_novalnet_pin_elv_de']); + unset($_SESSION['elv_de_order_amount']); + if(isset($_SESSION['invalid_count_de'])) + { + unset($_SESSION['invalid_count_de']); + } + + #print "$customer_id, $insert_id"; exit; + ### Implement here the Emailversand and further functions, incase if you want to send a own email ### + + return false; + } + + ### Store additional order information ### + ### not in use ### + // @param int $zf_order_id + function after_order_create($zf_order_id) { + return false; + } + + ### Used to display error message details ### + // @return array + function get_error() { + global $_GET; + + $error = array('title' => MODULE_PAYMENT_NOVALNET_ELV_DE_TEXT_ERROR, + 'error' => stripslashes(urldecode($_GET['error']))); + + return $error; + } + + ### Check to see whether module is installed ### + // @return boolean + function check() { + global $db; + if (!isset($this->_check)) { + $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_NOVALNET_ELV_DE_STATUS'"); + $this->_check = $check_query->RecordCount(); + } + return $this->_check; + } + + + function install_lang($field_text,$lang) + { + #Allowed Zones + $install_text['allowed_title'] = array('en' => "Allowed zones", + 'de' => "erlaubte Zonen"); + $install_text['allowed_desc'] = array('en' => "Please enter the desired zones separated by comma (Eg: AT, DE) or leave it blank", + 'de' => "Bitte die gewünschten Zonen durch Komma getrennt eingeben (z.B: AT,DE) oder einfach leer lassen"); + #Enable Module + $install_text['enable_title'] = array('en' => "Enable Module", + 'de' => "Modul aktivieren"); + $install_text['enable_desc'] = array('en' => "Do you want to activate the Credit Card of Novalnet AG?", + 'de' => "Wollen Sie das Kreditkarten Modul des Novalnet AG aktivieren?"); + #Test Mode + $install_text['test_title'] = array('en' => "Enable Test Mode:", + 'de' => "Testmodus einschalten"); + $install_text['test_desc'] = array('en' => "Do you want to activate test mode?", + 'de' => "Wollen Sie den Test-Modus aktivieren?"); + #Vendor id + $install_text['vendor_title'] = array('en' => "Novalnet Merchant ID", + 'de' => "Novalnet Händler ID"); + $install_text['vendor_desc'] = array('en' => "Enter your Novalnet Merchant ID ", + 'de' => "Geben Sie Ihre Novalnet Händler-ID ein "); + #Auth Code + $install_text['auth_title'] = array('en' => "Novalnet Merchant Authorisation Code", + 'de' => "Novalnet Authorisierungsschlüssel"); + $install_text['auth_desc'] = array('en' => "Enter your Novalnet Merchant Authorisation code ", + 'de' => "Geben Sie Ihren Novalnet-Authorisierungsschlüssel ein"); + + #Product id + $install_text['product_title'] = array('en' => "Novalnet Product ID", + 'de' => "Novalnet Produkt ID"); + $install_text['product_desc'] = array('en' => "Enter your Novalnet Product ID", + 'de' => "Geben Sie Ihre Novalnet Produkt-ID ein"); + + #Tariff id + $install_text['tariff_title'] = array('en' => "Novalnet Tariff ID", + 'de' => "Novalnet Tarif ID"); + $install_text['tariff_desc'] = array('en' => "Enter your Novalnet Tariff ID ", + 'de' => "Geben Sie Ihre Novalnet Tarif-ID ein"); + + #Booking amount limit + $install_text['booking_title'] = array('en' => "Manual checking amount in cents", + 'de' => "Manuelle Überprüfung des Betrags in Cent"); + $install_text['booking_desc'] = array('en' => "Please enter the amount in cents", + 'de' => "Bitte den Betrag in Cent eingeben"); + + #Second Product id + $install_text['secondproduct_title'] = array('en' => "Second Product ID in Novalnet", + 'de' => "Zweite Novalnet Produkt ID"); + $install_text['secondproduct_desc'] = array('en' => "for the manual checking", + 'de' => "zur manuellen Überprüfung"); + + #Second Tariff id + $install_text['secondtariff_title'] = array('en' => "Second Tariff ID in Novalnet", + 'de' => "Zweite Novalnet Tarif ID"); + $install_text['secondtariff_desc'] = array('en' => "for the manual checking", + 'de' => "zur manuellen Überprüfung"); + + #Enduser info + $install_text['enduser_title'] = array('en' => "Information to the end customer", + 'de' => "Informationen für den Endkunden"); + $install_text['enduser_desc'] = array('en' => "will appear in the payment form", + 'de' => "wird im Bezahlformular erscheinen"); + + #Sortorder display + $install_text['sortorder_title'] = array('en' => "Sort order of display", + 'de' => "Sortierung nach"); + $install_text['sortorder_desc'] = array('en' => "Sort order of display. Lowest is displayed first.", + 'de' => "Sortierung der Anzeige. Der niedrigste Wert wird zuerst angezeigt."); + + #Setorder status display + $install_text['setorderstatus_title'] = array('en' => "Set Order Status", + 'de' => "Bestellungsstatus setzen"); + $install_text['setorderstatus_desc'] = array('en' => "Set the status of orders made with this payment module to this value.", + 'de' => "Setzen Sie den Status von über dieses Zahlungsmodul durchgeführten Bestellungen auf diesen Wert."); + + #Proxy + $install_text['proxy_title'] = array('en' => "Proxy-Server", + 'de' => "Proxy-Server"); + $install_text['proxy_desc'] = array('en' => " If you use a Proxy Server, enter the Proxy Server IP with port here (e.g. www.proxy.de:80).", + 'de' => "Wenn Sie einen Proxy-Server einsetzen, tragen Sie hier Ihre Proxy-IP und den Port ein (z.B. www.proxy.de:80)."); + + #Payment Zone + $install_text['paymnetzone_title'] = array('en' => "Payment Zone", + 'de' => "Zahlungsgebiet"); + $install_text['paymnetzone_desc'] = array('en' => "If a zone is selected then this module is activated only for Selected zone. ", + 'de' => "Wird ein Bereich ausgewählt, dann wird dieses Modul nur für den ausgewählten Bereich aktiviert."); + + + #Activate Logo Mode + $install_text['logo_title'] = array('en' => "Activate logo mode:", + 'de' => "Aktivieren Sie Logo Modus:"); + $install_text['logo_desc'] = array('en' => "Do you want to activate logo mode?", + 'de' => "Wollen Sie Logo-Modus zu aktivieren?"); + + #Pin by callback sms + $install_text['pinbycallback_title'] = array('en' => "PIN by Callback/SMS/E-Mail", + 'de' => "PIN by Callback/SMS/E-Mail"); + $install_text['pinbycallback_desc'] = array('en' => "When activated by PIN Callback / SMS / E-Mail the customer to enter their phone / mobile number / E-Mail requested. By phone or SMS, the customer receives a PIN from Novalnet AG, which must enter before ordering. If the PIN is valid, the payment process has been completed successfully, otherwise the customer will be prompted again to enter the PIN. This service is only available for customers from specified countries.", + + 'de' => "Wenn durch PIN Callback / SMS / E-Mail des Kunden aktiviert, um ihre Telefonnummer / Handynummer / E-Mail angefordert geben. Per Telefon oder SMS, erhält der Kunde eine PIN von Novalnet AG, die vor der Bestellung eingeben müssen. Wenn die PIN gültig ist, hat die Zahlung Prozess erfolgreich beendet wurde, andernfalls hat der Kunde erneut aufgefordert, die PIN einzugeben. Dieser Service ist nur für Kunden aus bestimmten Ländern."); + + #Manual Amount Limit For Pin by callback/sms + $install_text['amountlimitpin_title'] = array('en' => "Minimum Amount Limit for Callback in cents", + 'de' => "Grenzwert (Mindestbetrag) in Cent für Rückruf"); + $install_text['amountlimitpin_desc'] = array('en' => "Please enter minimum amount limit to enable Pin by CallBackmodul (In Cents, e.g. 100,200)", + 'de' => "Bitte geben Sie Mindestbetrag Grenze zu Pin durch CallBack Modul (in Cent, z. B. 100,200) ermÖglichen"); + + #ACDC CONTROL FOR DE + + $install_text['acdccontrol_title'] = array('en' => "Enable ACDC Control", + 'de' => "ACDC-Check aktivieren"); + $install_text['acdccontrol_desc'] = array('en' => "Do you want to activate the ACDC Control?", + 'de' => "Wollen Sie ACDC Control aktivieren?"); + + return $install_text[$field_text][$lang]; + } + + ### Install the payment module and its configuration settings ### + function install() { + global $db; + + $allowed_title = $this->install_lang('allowed_title', DEFAULT_LANGUAGE); + $allowed_desc = $this->install_lang('allowed_desc', DEFAULT_LANGUAGE); + + $enable_title = $this->install_lang('enable_title', DEFAULT_LANGUAGE); + $enable_desc = $this->install_lang('enable_desc', DEFAULT_LANGUAGE); + + $test_title = $this->install_lang('test_title', DEFAULT_LANGUAGE); + $test_desc = $this->install_lang('test_desc', DEFAULT_LANGUAGE); + + $vendor_title = $this->install_lang('vendor_title', DEFAULT_LANGUAGE); + $vendor_desc = $this->install_lang('vendor_desc', DEFAULT_LANGUAGE); + + $auth_title = $this->install_lang('auth_title', DEFAULT_LANGUAGE); + $auth_desc = $this->install_lang('auth_desc', DEFAULT_LANGUAGE); + + $product_title = $this->install_lang('product_title', DEFAULT_LANGUAGE); + $product_desc = $this->install_lang('product_desc', DEFAULT_LANGUAGE); + + $tariff_title = $this->install_lang('tariff_title', DEFAULT_LANGUAGE); + $tariff_desc = $this->install_lang('tariff_desc', DEFAULT_LANGUAGE); + + $booking_title = $this->install_lang('booking_title', DEFAULT_LANGUAGE); + $booking_desc = $this->install_lang('booking_desc', DEFAULT_LANGUAGE); + + $secondproduct_title = $this->install_lang('secondproduct_title', DEFAULT_LANGUAGE); + $secondproduct_desc = $this->install_lang('secondproduct_desc', DEFAULT_LANGUAGE); + + $secondtariff_title = $this->install_lang('secondtariff_title', DEFAULT_LANGUAGE); + $secondtariff_desc = $this->install_lang('secondtariff_desc', DEFAULT_LANGUAGE); + + $enduser_title = $this->install_lang('enduser_title', DEFAULT_LANGUAGE); + $enduser_desc = $this->install_lang('enduser_desc', DEFAULT_LANGUAGE); + + $sortorder_title = $this->install_lang('sortorder_title', DEFAULT_LANGUAGE); + $sortorder_desc = $this->install_lang('sortorder_desc', DEFAULT_LANGUAGE); + + $setorderstatus_title = $this->install_lang('setorderstatus_title', DEFAULT_LANGUAGE); + $setorderstatus_desc = $this->install_lang('setorderstatus_desc', DEFAULT_LANGUAGE); + + $proxy_title = $this->install_lang('proxy_title', DEFAULT_LANGUAGE); + $proxy_desc = $this->install_lang('proxy_desc', DEFAULT_LANGUAGE); + + $paymnetzone_title = $this->install_lang('paymnetzone_title', DEFAULT_LANGUAGE); + $paymnetzone_desc = $this->install_lang('paymnetzone_desc', DEFAULT_LANGUAGE); + + $logo_title = $this->install_lang('logo_title', DEFAULT_LANGUAGE); + $logo_desc = $this->install_lang('logo_desc', DEFAULT_LANGUAGE); + + $pinbycallback_title = $this->install_lang('pinbycallback_title', DEFAULT_LANGUAGE); + $pinbycallback_desc = $this->install_lang('pinbycallback_desc', DEFAULT_LANGUAGE); + + $amountlimitpin_title = $this->install_lang('amountlimitpin_title', DEFAULT_LANGUAGE); + $amountlimitpin_desc = $this->install_lang('amountlimitpin_desc', DEFAULT_LANGUAGE); + + $acdccontrol_title = $this->install_lang('acdccontrol_title', DEFAULT_LANGUAGE); + $acdccontrol_desc = $this->install_lang('acdccontrol_desc', DEFAULT_LANGUAGE); + + /*$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$allowed_title."','MODULE_PAYMENT_NOVALNET_ELV_DE_ALLOWED', '','".$allowed_desc."', '6', '0', now())"); */ + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('".$enable_title."', 'MODULE_PAYMENT_NOVALNET_ELV_DE_STATUS', 'True', '".$enable_desc."', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('".$pinbycallback_title."','MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_SMS','False','".$pinbycallback_desc."', '6', '1', 'zen_cfg_select_option(array( \'False\', \'Callback (Telefon & Handy)\', \'SMS (nur Handy)\',\'Email Reply\'), ', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$amountlimitpin_title."','MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_MIN_LIMIT', '','".$amountlimitpin_desc."', '6', '2', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('".$test_title."', 'MODULE_PAYMENT_NOVALNET_ELV_DE_TEST_MODE', 'True', '".$test_desc."', '6', '3', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$vendor_title."', 'MODULE_PAYMENT_NOVALNET_ELV_DE_VENDOR_ID', '', '".$vendor_desc."', '6', '4', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$auth_title."', 'MODULE_PAYMENT_NOVALNET_ELV_DE_AUTH_CODE', '', '".$auth_desc."', '6', '5', now())"); + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$product_title."', 'MODULE_PAYMENT_NOVALNET_ELV_DE_PRODUCT_ID', '', '".$product_desc."', '6', '6', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$tariff_title."', 'MODULE_PAYMENT_NOVALNET_ELV_DE_TARIFF_ID', '', '".$tariff_desc."', '6', '7', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$booking_title."', 'MODULE_PAYMENT_NOVALNET_ELV_DE_MANUAL_CHECK_LIMIT', '', '".$booking_desc."', '6', '8', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$secondproduct_title."', 'MODULE_PAYMENT_NOVALNET_ELV_DE_PRODUCT_ID2', '', '".$secondproduct_desc."', '6', '9', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$secondtariff_title."', 'MODULE_PAYMENT_NOVALNET_ELV_DE_TARIFF_ID2', '', '".$secondtariff_desc."', '6', '10', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$enduser_title."', 'MODULE_PAYMENT_NOVALNET_ELV_DE_INFO', '', '".$enduser_desc."', '6', '11', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('".$acdccontrol_title."', 'MODULE_PAYMENT_NOVALNET_ELV_DE_ACDC', 'False', '".$acdccontrol_desc."', '6', '12', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$sortorder_title."', 'MODULE_PAYMENT_NOVALNET_ELV_DE_SORT_ORDER', '0', '".$sortorder_desc."', '6', '12', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('".$setorderstatus_title."', 'MODULE_PAYMENT_NOVALNET_ELV_DE_ORDER_STATUS_ID', '0', '".$setorderstatus_desc."', '6', '13', 'zen_cfg_pull_down_order_statuses(', 'zen_get_order_status_name', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('".$paymnetzone_title."', 'MODULE_PAYMENT_NOVALNET_ELV_DE_ZONE', '0', '".$paymnetzone_desc."', '6', '14', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$proxy_title."', 'MODULE_PAYMENT_NOVALNET_ELV_DE_PROXY', '', '".$proxy_desc."', '6', '15', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('".$logo_title."', 'MODULE_PAYMENT_ELV_DE_LOGO_STATUS', 'True', '".$logo_desc."', '6', '16', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + + } + + ### Remove the module and all its settings ### + function remove() { + global $db; + $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); + } + + ### Internal list of configuration keys used for configuration of the module ### + // @return array + function keys() { + return array('MODULE_PAYMENT_ELV_DE_LOGO_STATUS','MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_SMS','MODULE_PAYMENT_NOVALNET_ELV_DE_PIN_BY_CALLBACK_MIN_LIMIT', 'MODULE_PAYMENT_NOVALNET_ELV_DE_STATUS', 'MODULE_PAYMENT_NOVALNET_ELV_DE_TEST_MODE', 'MODULE_PAYMENT_NOVALNET_ELV_DE_VENDOR_ID', 'MODULE_PAYMENT_NOVALNET_ELV_DE_AUTH_CODE', 'MODULE_PAYMENT_NOVALNET_ELV_DE_PRODUCT_ID', 'MODULE_PAYMENT_NOVALNET_ELV_DE_TARIFF_ID', 'MODULE_PAYMENT_NOVALNET_ELV_DE_MANUAL_CHECK_LIMIT', 'MODULE_PAYMENT_NOVALNET_ELV_DE_PRODUCT_ID2', 'MODULE_PAYMENT_NOVALNET_ELV_DE_TARIFF_ID2', 'MODULE_PAYMENT_NOVALNET_ELV_DE_ACDC', 'MODULE_PAYMENT_NOVALNET_ELV_DE_INFO', 'MODULE_PAYMENT_NOVALNET_ELV_DE_SORT_ORDER', 'MODULE_PAYMENT_NOVALNET_ELV_DE_ORDER_STATUS_ID', 'MODULE_PAYMENT_NOVALNET_ELV_DE_ZONE','MODULE_PAYMENT_NOVALNET_ELV_DE_PROXY',); + } + + +} + +?> diff --git a/includes/modules/payment/novalnet_elv_de_pci.php b/includes/modules/payment/novalnet_elv_de_pci.php new file mode 100644 index 0000000..0e08946 --- /dev/null +++ b/includes/modules/payment/novalnet_elv_de_pci.php @@ -0,0 +1,941 @@ +key = trim(MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_PASSWORD); #'z2Vw3E4j'; + $this->vendor_id = trim(MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_VENDOR_ID); + $this->auth_code = trim(MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_AUTH_CODE); + $this->product_id = trim(MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_PRODUCT_ID); + $this->tariff_id = trim(MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TARIFF_ID); + $this->manual_check_limit = trim(MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_MANUAL_CHECK_LIMIT); + $this->product_id2 = trim(MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_PRODUCT_ID2); + $this->tariff_id2 = trim(MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TARIFF_ID2); + $this->test_mode = (strtolower(MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEST_MODE) == 'true' or MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEST_MODE == '1')? 1: 0; + + + $this->code = 'novalnet_elv_de_pci'; + $this->title = MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEXT_TITLE; + $this->public_title = MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEXT_PUBLIC_TITLE; + $this->description = MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEXT_DESCRIPTION; + $this->sort_order = MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_SORT_ORDER; + $this->enabled = ((MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_STATUS == 'True') ? true : false); + $this->proxy = MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_PROXY; + $this->implementation = 'PHP_PCI'; + + + $this->checkReturnedData(); + + if(MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_LOGO_STATUS == 'True'){ + $this->public_title = 'Novalnet'.' '.MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEXT_PUBLIC_TITLE; + $this->title = 'Novalnet'.' '.MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEXT_TITLE; + } + $this->checkConfigure(); + + if ((int)MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_ORDER_STATUS_ID > 0) + { + $this->order_status = MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_ORDER_STATUS_ID; + } + + if (is_object($order)) $this->update_status(); + $this->form_action_url = 'https://payport.novalnet.de/pci_payport'; + + if($_POST['session'] && $_SESSION['payment'] == $this->code){ + $this->checkSecurity(); + } + + + } + + function checkConfigure() { + if (IS_ADMIN_FLAG == true) { + $this->title = MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEXT_TITLE; // Payment module title in Admin + if(MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_LOGO_STATUS == 'True'){ + $this->public_title = 'Novalnet'.' '.MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEXT_PUBLIC_TITLE; + $this->title = 'Novalnet'.' '.MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEXT_TITLE; + } + if ($this->enabled == 'true' && (!$this->vendor_id || !$this->auth_code || !$this->product_id || !$this->tariff_id || !$this->key )) { + $this->title .= ''.MODULE_PAYMENT_NOVALNET_DE_PCI_NOT_CONFIGURED.''; + } elseif ($this->test_mode == '1') { + $this->title .= ''.MODULE_PAYMENT_NOVALNET_DE_PCI_IN_TEST_MODE.''; + } + + } + } + + ### calculate zone matches and flag settings to determine whether this module should display to customers or not ### + function update_status() + { + global $order, $db; + + if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_ZONE > 0) ) + { + $check_flag = false; + $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id"); + while (!$check->EOF) + { + if ($check->fields['zone_id'] < 1) + { + $check_flag = true; + break; + } + elseif ($check->fields['zone_id'] == $order->billing['zone_id']) + { + $check_flag = true; + break; + } + $check->MoveNext(); + } + + if ($check_flag == false) + { + $this->enabled = false; + } + } + } + + ### JS validation which does error-checking of data-entry if this module is selected for use ### + ### the fields to be cheked are (Bank Owner, Bank Account Number and Bank Code Lengths) ### + ### currently this function is not in use ### + // @return string + function javascript_validation() + { + return false; + } + + ### Builds set of input fields for collecting Bankdetail info ### + // @return array + function selection() + { + global $xtPrice, $order, $HTTP_POST_VARS, $_POST; + $onFocus = ''; + if(count($HTTP_POST_VARS)==0 || $HTTP_POST_VARS=='') $HTTP_POST_VARS = $_POST; + + $selection = array('id' => $this->code, + 'module' => $this->public_title, + 'fields' => array(array('title' => '', 'field' => MODULE_PAYMENT_NOVALNET_INFORMATION_PAYMENT_DE_PCI), + array('title' => '', 'field' => MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_BOOK_REF) + + )); + + if(function_exists(get_percent)) + { + $selection['module_cost'] = $GLOBALS['ot_payment']->get_percent($this->code); + } + + return $selection; + } + + ### Precheck to Evaluate the Bank Datas ### + function pre_confirmation_check() + { + global $HTTP_POST_VARS, $_POST,$messageStack; + if(count($HTTP_POST_VARS)==0 || $HTTP_POST_VARS=='') $HTTP_POST_VARS = $_POST; + #echo'
';var_dump($_REQUEST); exit;
+		$error = '';
+		
+		if (!function_exists('curl_init') && ($this->code=='novalnet_elv_de_pci')){
+			ini_set('display_errors', 1);
+			ini_set('error_reporting', E_ALL);
+			
+			$error =  MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_CURL_MESSAGE;
+		}
+		
+		if(!$this->vendor_id || !$this->auth_code || !$this->product_id || !$this->tariff_id || !$this->key)
+		{
+		$error = MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEXT_JS_NN_MISSING;
+		}
+		elseif(!empty($this->manual_check_limit) && (!$this->product_id2 || !$this->tariff_id2)){
+		$error = MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEXT_JS_NN_ID2_MISSING;				
+		}
+
+		if($error!='') 
+		{
+		  $payment_error_return = 'payment_error=' . $this->code;
+		  $messageStack->add_session('checkout_payment', $error . '', 'error');
+		  zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false));      
+		}
+  }
+
+  ### Display Information on the Checkout Confirmation Page ###
+  // @return array
+  function confirmation() 
+  {
+		global $HTTP_POST_VARS, $_POST, $order;
+		$_SESSION['nn_total'] = $order->info['total'];
+		if(count($HTTP_POST_VARS)==0 || $HTTP_POST_VARS=='') $HTTP_POST_VARS = $_POST;
+		#print "in confirmation"; exit;
+
+		return $confirmation;
+  }
+
+  ### Build the data and actions to process when the "Submit" button is pressed on the order-confirmation screen. ###
+  ### These are hidden fields on the checkout confirmation page ###
+  // @return string
+  function process_button()
+  {
+    
+		global $HTTP_POST_VARS, $_POST, $order, $currencies, $db,$messageStack;
+		if(count($HTTP_POST_VARS)==0 || $HTTP_POST_VARS=='') $HTTP_POST_VARS = $_POST;
+
+		#Get the required additional customer details from DB
+		$nn_customer_id = (isset($_SESSION['customer_id'])) ? $_SESSION['customer_id'] : '';
+		$customer_values = $db->Execute("SELECT customers_gender, customers_dob, customers_fax FROM ". TABLE_CUSTOMERS . " WHERE customers_id='". (int)$nn_customer_id."'");
+		
+		while(!$customer_values->EOF) 
+		{
+			$customer_values->MoveNext();
+		}
+		
+		list($customer_values->fields['customers_dob'], $extra) = explode(' ', $customer_values->fields['customers_dob']);
+
+		if($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status_add_tax_ot'] == 1) 
+		{
+			$totalamount=$order->info['total'] + $order->info['tax'];
+		}
+		else
+		{ 
+			$totalamount=$order->info['total'];
+		}
+		
+		$totalamount = number_format($totalamount * $currencies->get_value($order->info['currency']),2);
+		$amount = str_replace(',', '', $totalamount);
+		$amount = intval(round($amount*100));
+		
+		//$amount =sprintf('%.2f', $totalamount);
+
+		//$amount = number_format($p_amount * $currencies->currencies['EUR']['value'], $currencies->currencies['EUR']['decimal_places']);
+
+
+		// $amount = $_SESSION['nn_total'];
+		if(preg_match('/[^\d\.]/', $amount) or !$amount)
+		{
+			  ### $amount contains some unallowed chars or empty ###
+			  $err                      = '$amount ('.$amount.') is empty or has a wrong format';
+			  $order->info['comments'] .= '. Novalnet Error Message : '.$err;
+			  $payment_error_return     = 'payment_error='.$this->code;
+			  $messageStack->add_session('checkout_payment', $err . '', 'error');	  
+			  zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false));
+		}
+		
+		// $amount = preg_replace('/^0+/', '', $amount);
+		// $amount = sprintf('%0.2f', $amount);
+		// $amount = str_replace('.', '', $amount);
+		#echo __CLASS__.' : '.$order->info['total']." <=> $amount
"; + + $_SESSION[nn_amount_elv_de_pci] = $amount; + + $vendor_id = $this->vendor_id; + $auth_code = $this->auth_code; + $product_id = $this->product_id; + $tariff_id = $this->tariff_id; + $customer_id = $_SESSION['customer_id']; + + $manual_check_limit = $this->manual_check_limit; + $manual_check_limit = str_replace(',', '', $manual_check_limit); + $manual_check_limit = str_replace('.', '', $manual_check_limit); + + if($manual_check_limit && $amount>=$manual_check_limit) + { + $product_id = $this->product_id2; + $tariff_id = $this->tariff_id2; + } + + $user_ip = $this->getRealIpAddr(); + + $checkout_url = zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'); + + if(strstr($checkout_url, '?')) + { + $checkout_url = str_replace(' ', '', $checkout_url); + if(substr($checkout_url,-1)=='?')$error_url = $checkout_url.'payment_error=novalnet_elv_de_pci&error=$ERROR_MESSAGE ($STATUS)'; + else $error_url = $checkout_url.'&payment_error=novalnet_elv_de_pci&error=$ERROR_MESSAGE ($STATUS)'; + } + else $error_url = $checkout_url.'?payment_error=novalnet_elv_de_pci&error=$ERROR_MESSAGE ($STATUS)'; + + $test_mode = (strtolower(MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEST_MODE) == 'true' or MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEST_MODE == '1')? 1: 0; + + $_SESSION['order_status_id_value']=$this->order_status; + + $oldreturnurl=zen_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL'); + $old_value=explode(':',$oldreturnurl); + $new_protocol_value=(empty($_SERVER["HTTPS"])) ? 'http' : 'https'; + $return_url=$new_protocol_value.':'.$old_value[1]; + + $uniqid = uniqid(); + + + list($auth_code, $product_id, $tariff_id, $amount, $test_mode, $uniqid, $hash) = $this->encodeParams($auth_code, $product_id, $tariff_id, $amount, $test_mode, $uniqid); + + $firstname = !empty($order->customer['firstname']) ? $order->customer['firstname'] : $order->billing['firstname']; + $lastname = !empty($order->customer['lastname']) ? $order->customer['lastname'] : $order->billing['lastname']; + $email_address = !empty($order->customer['email_address']) ? $order->customer['email_address'] : $order->billing['email_address']; + $street_address = !empty($order->customer['street_address']) ? $order->customer['street_address'] : $order->billing['street_address']; + $city = !empty($order->customer['city']) ? $order->customer['city'] : $order->billing['city']; + $postcode = !empty($order->customer['postcode']) ? $order->customer['postcode'] : $order->billing['postcode']; + $country_iso_code_2 = !empty($order->customer['country']['iso_code_2']) ? $order->customer['country']['iso_code_2'] : $order->billing['country']['iso_code_2']; + $customer_no = ($customer['customers_status'] != 1) ? $nn_customer_id : MODULE_PAYMENT_NOVALNET_DE_PCI_GUEST_USER; + + $process_button_string = zen_draw_hidden_field('vendor_id', $vendor_id) . + zen_draw_hidden_field('product_id', $product_id) . + zen_draw_hidden_field('payment_id', $this->payment_key) . + zen_draw_hidden_field('tariff_id', $tariff_id) . + zen_draw_hidden_field('vendor_authcode', $auth_code) . + zen_draw_hidden_field('currency', $order->info['currency']) . + zen_draw_hidden_field('amount', $amount) . + zen_draw_hidden_field('hash', $hash) . + zen_draw_hidden_field('uniqid', $uniqid) . + zen_draw_hidden_field('gender', 'u') . + zen_draw_hidden_field('first_name', $this->html_to_utf8($firstname)) . + zen_draw_hidden_field('last_name', $this->html_to_utf8($lastname)) . + zen_draw_hidden_field('email', $email_address) . + zen_draw_hidden_field('street', $this->html_to_utf8($street_address)) . + zen_draw_hidden_field('search_in_street', '1') . + zen_draw_hidden_field('city', $this->html_to_utf8($city)) . + zen_draw_hidden_field('zip', $order->customer['postcode']) . + zen_draw_hidden_field('country', $country_iso_code_2) . + zen_draw_hidden_field('country_code', $country_iso_code_2) . + zen_draw_hidden_field('lang', MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEXT_LANG) . + zen_draw_hidden_field('language', MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEXT_LANG) . + zen_draw_hidden_field('remote_ip', $user_ip) . + zen_draw_hidden_field('tel', $order->customer['telephone']) . + zen_draw_hidden_field('fax', $customer['customers_fax']) . + zen_draw_hidden_field('birth_date', $customer_values->fields['customers_dob']) . + zen_draw_hidden_field('session', zen_session_id()) . + zen_draw_hidden_field('return_url', $return_url) . + zen_draw_hidden_field('return_method', 'POST') . + zen_draw_hidden_field('error_return_url', $error_url) . + zen_draw_hidden_field('test_mode', $test_mode) . + zen_draw_hidden_field('error_return_method', 'POST'). + zen_draw_hidden_field('customer_no', $customer_no). + zen_draw_hidden_field('use_utf8', '1'). + zen_draw_hidden_field('implementation', strtoupper($this->implementation)) . + zen_draw_hidden_field('proxy', $this->proxy); + + return $process_button_string; + } + + ### Insert the Novalnet Transaction ID in DB ### + function before_process() + { + global $_POST, $order; + if($_POST['tid'] && $_POST['status'] == '100'){ + if( $this->order_status ) { + $order->info['order_status'] = $this->order_status; + } + + if ($_POST['test_mode'] == 1) + { + $order->info['comments'] .= '
'.MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEST_ORDER_MESSAGE.'
'; + } + + $order->info['comments'] .= '
'.MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TID_MESSAGE.$_POST['tid'].'

'; + $order->info['comments'] = str_replace(array('', '','','', '
','
','
'), array('', '', '','',"\n", "\n","\n"), $order->info['comments']); + } + } + + function isPublicIP($value) + { + if(!$value || count(explode('.',$value))!=4) return false; + return !preg_match('~^((0|10|172\.16|192\.168|169\.254|255|127\.0)\.)~', $value); + } + + ### get the real Ip Adress of the User ### + function getRealIpAddr() + { + if($this->isPublicIP($_SERVER['HTTP_X_FORWARDED_FOR'])) return $_SERVER['HTTP_X_FORWARDED_FOR']; + if($iplist=explode(',', $_SERVER['HTTP_X_FORWARDED_FOR'])) + { + if($this->isPublicIP($iplist[0])) return $iplist[0]; + } + if ($this->isPublicIP($_SERVER['HTTP_CLIENT_IP'])) return $_SERVER['HTTP_CLIENT_IP']; + if ($this->isPublicIP($_SERVER['HTTP_X_CLUSTER_CLIENT_IP'])) return $_SERVER['HTTP_X_CLUSTER_CLIENT_IP']; + if ($this->isPublicIP($_SERVER['HTTP_FORWARDED_FOR']) ) return $_SERVER['HTTP_FORWARDED_FOR']; + + return $_SERVER['REMOTE_ADDR']; + } + + ### Send the order detail to Novalnet ### + function after_process() + { + global $order, $customer_id, $insert_id,$db,$_POST; + + $vendor_id = $this->vendor_id; + $auth_code = $this->auth_code; + $product_id = $this->product_id; + $tariff_id = $this->tariff_id; + + $manual_check_limit = $this->manual_check_limit; + $manual_check_limit = str_replace(',', '', $manual_check_limit); + $manual_check_limit = str_replace('.', '', $manual_check_limit); + + if($manual_check_limit && $_SESSION['nn_amount_elv_de_pci']>=$manual_check_limit) + { + $product_id = $this->product_id2;; + $tariff_id = $this->tariff_id2; + } + + if($_POST['tid'] != ''){ + ### Pass the Order Reference to paygate ## + $url = 'https://payport.novalnet.de/paygate.jsp'; + $urlparam = 'vendor='.$vendor_id.'&product='.$product_id.'&key='.$this->payment_key.'&tariff='.$tariff_id; + $urlparam .= '&auth_code='.$auth_code.'&status=100&tid='.$_POST['tid'].'&vwz2='.MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEXT_ORDERNO.''.$insert_id.'&vwz3='.MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEXT_ORDERDATE.''.date('Y-m-d H:i:s').'&order_no='.$insert_id; + list($errno, $errmsg, $data) = $this->perform_https_request($url, $urlparam); + $_POST['tid'] = ''; + ### Implement here the Emailversand and further functions, incase if you want to send a own email ### + } + unset($_SESSION['nn_amount_elv_de_pci']); + return false; + } + + ### Used to display error message details ### + // @return array + function get_error() + { + global $HTTP_GET_VARS, $_GET; + if(count($HTTP_GET_VARS)==0 || $HTTP_GET_VARS=='') $HTTP_GET_VARS = $_GET; + $error = array('title' => MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEXT_ERROR, 'error' => stripslashes(utf8_decode($HTTP_GET_VARS['error']))); + + return $error; + } + + ### Check to see whether module is installed ### + // @return boolean + function check() + { + global $db; + if (!isset($this->_check)) + { + $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_STATUS'"); + $this->_check = $check_query->RecordCount(); + } + return $this->_check; + } + + + function install_lang($field_text,$lang) + { + #Allowed Zones + $install_text['allowed_title'] = array('en' => "Allowed zones", + 'de' => "erlaubte Zonen"); + $install_text['allowed_desc'] = array('en' => "Please enter the desired zones separated by comma (Eg: AT, DE) or leave it blank", + 'de' => "Bitte die gewünschten Zonen durch Komma getrennt eingeben (z.B: AT,DE) oder einfach leer lassen"); + #Enable Module + $install_text['enable_title'] = array('en' => "Enable Module", + 'de' => "Modul aktivieren"); + $install_text['enable_desc'] = array('en' => "Do you want to activate the Credit Card of Novalnet AG?", + 'de' => "Wollen Sie das Kreditkarten Modul des Novalnet AG aktivieren?"); + #Test Mode + $install_text['test_title'] = array('en' => "Enable Test Mode:", + 'de' => "Testmodus einschalten"); + $install_text['test_desc'] = array('en' => "Do you want to activate test mode?", + 'de' => "Wollen Sie den Test-Modus aktivieren?"); + #Vendor id + $install_text['vendor_title'] = array('en' => "Novalnet Merchant ID", + 'de' => "Novalnet Händler ID"); + $install_text['vendor_desc'] = array('en' => "Enter your Novalnet Merchant ID ", + 'de' => "Geben Sie Ihre Novalnet Händler-ID ein "); + #Auth Code + $install_text['auth_title'] = array('en' => "Novalnet Merchant Authorisation Code", + 'de' => "Novalnet Authorisierungsschlüssel"); + $install_text['auth_desc'] = array('en' => "Enter your Novalnet Merchant Authorisation code ", + 'de' => "Geben Sie Ihren Novalnet-Authorisierungsschlüssel ein"); + + #Product id + $install_text['product_title'] = array('en' => "Novalnet Product ID", + 'de' => "Novalnet Produkt ID"); + $install_text['product_desc'] = array('en' => "Enter your Novalnet Product ID", + 'de' => "Geben Sie Ihre Novalnet Produkt-ID ein"); + + #Tariff id + $install_text['tariff_title'] = array('en' => "Novalnet Tariff ID", + 'de' => "Novalnet Tarif ID"); + $install_text['tariff_desc'] = array('en' => "Enter your Novalnet Tariff ID ", + 'de' => "Geben Sie Ihre Novalnet Tarif-ID ein"); + + #Booking amount limit + $install_text['booking_title'] = array('en' => "Manual checking amount in cents", + 'de' => "Manuelle Überprüfung des Betrags in Cent"); + $install_text['booking_desc'] = array('en' => "Please enter the amount in cents", + 'de' => "Bitte den Betrag in Cent eingeben"); + + #Second Product id + $install_text['secondproduct_title'] = array('en' => "Second Product ID in Novalnet", + 'de' => "Zweite Novalnet Produkt ID"); + $install_text['secondproduct_desc'] = array('en' => "for the manual checking", + 'de' => "zur manuellen Überprüfung"); + + #Second Tariff id + $install_text['secondtariff_title'] = array('en' => "Second Tariff ID in Novalnet", + 'de' => "Zweite Novalnet Tarif ID"); + $install_text['secondtariff_desc'] = array('en' => "for the manual checking", + 'de' => "zur manuellen Überprüfung"); + + #Enduser info + $install_text['enduser_title'] = array('en' => "Information to the end customer", + 'de' => "Informationen für den Endkunden"); + $install_text['enduser_desc'] = array('en' => "will appear in the payment form", + 'de' => "wird im Bezahlformular erscheinen"); + + #Sortorder display + $install_text['sortorder_title'] = array('en' => "Sort order of display", + 'de' => "Sortierung nach"); + $install_text['sortorder_desc'] = array('en' => "Sort order of display. Lowest is displayed first.", + 'de' => "Sortierung der Anzeige. Der niedrigste Wert wird zuerst angezeigt."); + + #Setorder status display + $install_text['setorderstatus_title'] = array('en' => "Set Order Status", + 'de' => "Bestellungsstatus setzen"); + $install_text['setorderstatus_desc'] = array('en' => "Set the status of orders made with this payment module to this value.", + 'de' => "Setzen Sie den Status von über dieses Zahlungsmodul durchgeführten Bestellungen auf diesen Wert."); + + #Proxy + $install_text['proxy_title'] = array('en' => "Proxy-Server", + 'de' => "Proxy-Server"); + $install_text['proxy_desc'] = array('en' => " If you use a Proxy Server, enter the Proxy Server IP with port here (e.g. www.proxy.de:80).", + 'de' => "Wenn Sie einen Proxy-Server einsetzen, tragen Sie hier Ihre Proxy-IP und den Port ein (z.B. www.proxy.de:80)."); + + #Payment Zone + $install_text['paymnetzone_title'] = array('en' => "Payment Zone", + 'de' => "Zahlungsgebiet"); + $install_text['paymnetzone_desc'] = array('en' => "If a zone is selected then this module is activated only for Selected zone. ", + 'de' => "Wird ein Bereich ausgewählt, dann wird dieses Modul nur für den ausgewählten Bereich aktiviert."); + + #Novalnet Password + $install_text['password_title'] = array('en' => "Novalnet Password", + 'de' => "Novalnet Passwort"); + $install_text['password_desc'] = array('en' => "Enter your Novalnet Password.", + 'de' => "Geben Sie Ihr Novalnet Passwort ein."); + + #Activate Logo Mode + $install_text['logo_title'] = array('en' => "Activate logo mode:", + 'de' => "Aktivieren Sie Logo Modus:"); + $install_text['logo_desc'] = array('en' => "Do you want to activate logo mode?", + 'de' => "Wollen Sie Logo-Modus zu aktivieren?"); + + return $install_text[$field_text][$lang]; + } + + ### Install the payment module and its configuration settings ### + function install() + { + global $db; + + $allowed_title = $this->install_lang('allowed_title', DEFAULT_LANGUAGE); + $allowed_desc = $this->install_lang('allowed_desc', DEFAULT_LANGUAGE); + + $enable_title = $this->install_lang('enable_title', DEFAULT_LANGUAGE); + $enable_desc = $this->install_lang('enable_desc', DEFAULT_LANGUAGE); + + $test_title = $this->install_lang('test_title', DEFAULT_LANGUAGE); + $test_desc = $this->install_lang('test_desc', DEFAULT_LANGUAGE); + + $vendor_title = $this->install_lang('vendor_title', DEFAULT_LANGUAGE); + $vendor_desc = $this->install_lang('vendor_desc', DEFAULT_LANGUAGE); + + $auth_title = $this->install_lang('auth_title', DEFAULT_LANGUAGE); + $auth_desc = $this->install_lang('auth_desc', DEFAULT_LANGUAGE); + + $product_title = $this->install_lang('product_title', DEFAULT_LANGUAGE); + $product_desc = $this->install_lang('product_desc', DEFAULT_LANGUAGE); + + $tariff_title = $this->install_lang('tariff_title', DEFAULT_LANGUAGE); + $tariff_desc = $this->install_lang('tariff_desc', DEFAULT_LANGUAGE); + + $booking_title = $this->install_lang('booking_title', DEFAULT_LANGUAGE); + $booking_desc = $this->install_lang('booking_desc', DEFAULT_LANGUAGE); + + $secondproduct_title = $this->install_lang('secondproduct_title', DEFAULT_LANGUAGE); + $secondproduct_desc = $this->install_lang('secondproduct_desc', DEFAULT_LANGUAGE); + + $secondtariff_title = $this->install_lang('secondtariff_title', DEFAULT_LANGUAGE); + $secondtariff_desc = $this->install_lang('secondtariff_desc', DEFAULT_LANGUAGE); + + $enduser_title = $this->install_lang('enduser_title', DEFAULT_LANGUAGE); + $enduser_desc = $this->install_lang('enduser_desc', DEFAULT_LANGUAGE); + + $sortorder_title = $this->install_lang('sortorder_title', DEFAULT_LANGUAGE); + $sortorder_desc = $this->install_lang('sortorder_desc', DEFAULT_LANGUAGE); + + $setorderstatus_title = $this->install_lang('setorderstatus_title', DEFAULT_LANGUAGE); + $setorderstatus_desc = $this->install_lang('setorderstatus_desc', DEFAULT_LANGUAGE); + + $proxy_title = $this->install_lang('proxy_title', DEFAULT_LANGUAGE); + $proxy_desc = $this->install_lang('proxy_desc', DEFAULT_LANGUAGE); + + $paymnetzone_title = $this->install_lang('paymnetzone_title', DEFAULT_LANGUAGE); + $paymnetzone_desc = $this->install_lang('paymnetzone_desc', DEFAULT_LANGUAGE); + + $password_title = $this->install_lang('password_title', DEFAULT_LANGUAGE); + $password_desc = $this->install_lang('password_desc', DEFAULT_LANGUAGE); + + $logo_title = $this->install_lang('logo_title', DEFAULT_LANGUAGE); + $logo_desc = $this->install_lang('logo_desc', DEFAULT_LANGUAGE); + + /* $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$allowed_title."','MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_ALLOWED', '','".$allowed_desc."', '6', '0', now())");*/ + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('".$enable_title."', 'MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_STATUS', 'True', '".$enable_desc."', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('".$test_title."', 'MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEST_MODE', 'True', '".$test_desc."', '6', '1', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$vendor_title."', 'MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_VENDOR_ID', '', '".$vendor_desc."', '6', '2', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$auth_title."', 'MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_AUTH_CODE', '', '".$auth_desc."', '6', '3', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$product_title."', 'MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_PRODUCT_ID', '', '".$product_desc."', '6', '4', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$tariff_title."', 'MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TARIFF_ID', '', '".$tariff_desc."', '6', '5', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$booking_title."', 'MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_MANUAL_CHECK_LIMIT', '', '".$booking_desc."', '6', '6', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$secondproduct_title."', 'MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_PRODUCT_ID2', '', '".$secondproduct_desc."', '6', '7', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$secondtariff_title."', 'MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TARIFF_ID2', '', '".$secondtariff_desc."', '6', '8', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$enduser_title."', 'MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_BOOK_REF', '', '".$enduser_desc."', '6', '9', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$sortorder_title."', 'MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_SORT_ORDER', '0', '".$sortorder_desc."', '6', '10', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('".$setorderstatus_title."', 'MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_ORDER_STATUS_ID', '0', '".$setorderstatus_desc."', '6', '11', 'zen_cfg_pull_down_order_statuses(', 'zen_get_order_status_name', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('".$paymnetzone_title."', 'MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_ZONE', '0', '".$paymnetzone_desc."', '6', '12', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$password_title."', 'MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_PASSWORD', '', '".$password_desc."', '6', '13', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$proxy_title."', 'MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_PROXY', '', '".$proxy_desc."', '6', '14', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('".$logo_title."', 'MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_LOGO_STATUS', 'True', '".$logo_desc."', '6', '15', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + + + } + + ### Remove the module and all its settings ### + function remove() + { + global $db; + $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); + } + + ### Internal list of configuration keys used for configuration of the module ### + // @return array + function keys() + { + return array('MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_LOGO_STATUS','MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_STATUS', 'MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEST_MODE', 'MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_VENDOR_ID', 'MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_AUTH_CODE', 'MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_PRODUCT_ID', 'MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TARIFF_ID', 'MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_MANUAL_CHECK_LIMIT', 'MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_PRODUCT_ID2', 'MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TARIFF_ID2','MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_PASSWORD', 'MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_BOOK_REF', 'MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_SORT_ORDER', 'MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_ORDER_STATUS_ID', 'MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_ZONE', 'MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_PROXY'); + } + + + + ### replace the Special German Charectors ### + function ReplaceSpecialGermanChars($string){ + $what = array("ä", "ö", "ü", "Ä", "Ö", "Ãœ", "ß"); + $how = array("ae", "oe", "ue", "Ae", "Oe", "Ue", "ss"); + + $string = str_replace($what, $how, $string); + + return $string; + } + + function html_to_utf8 ($data){ + return preg_replace("/\\&\\#([0-9]{3,10})\\;/e", '$this->_html_to_utf8("\\1")', $data); + } + + function _html_to_utf8 ($data){ + if ($data > 127){ + $i = 5; + while (($i--) > 0){ + if ($data != ($a = $data % ($p = pow(64, $i)))){ + $ret = chr(base_convert(str_pad(str_repeat(1, $i + 1), 8, "0"), 2, 10) + (($data - $a) / $p)); + for ($i; $i > 0; $i--) + $ret .= chr(128 + ((($data % pow(64, $i)) - ($data % ($p = pow(64, $i - 1)))) / $p)); + break; + } + } + }else{ + $ret = "&#$data;"; + } + return $ret; + } + + ### Realtime accesspoint for communication to the Novalnet paygate ### + function perform_https_request($nn_url, $urlparam){ + $debug = 0;#set it to 1 if you want to activate the debug mode + + if($debug) print "
perform_https_request: $nn_url
\n\r\n"; + if($debug) print "perform_https_request: $urlparam
\n\r\n"; + + ## some prerquisites for the connection + $ch = curl_init($nn_url); + curl_setopt($ch, CURLOPT_POST, 1); // a non-zero parameter tells the library to do a regular HTTP post. + curl_setopt($ch, CURLOPT_POSTFIELDS, $urlparam); // add POST fields + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); // don't allow redirects + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // decomment it if you want to have effective ssl checking + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // decomment it if you want to have effective ssl checking + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable + curl_setopt($ch, CURLOPT_TIMEOUT, 240); // maximum time, in seconds, that you'll allow the CURL functions to take + + if ($this->proxy){ + curl_setopt($ch, CURLOPT_PROXY, $this->proxy); + } + + ## establish connection + $data = curl_exec($ch); + //$data = $this->ReplaceSpecialGermanChars($data); + + ## determine if there were some problems on cURL execution + $errno = curl_errno($ch); + $errmsg = curl_error($ch); + + ###bug fix for PHP 4.1.0/4.1.2 (curl_errno() returns high negative value in case of successful termination) + if($errno < 0) $errno = 0; + ##bug fix for PHP 4.1.0/4.1.2 + + if($debug){ + print_r(curl_getinfo($ch)); + echo "\n

\n\n\nperform_https_request: cURL error number:" . $errno . "\n
\n\n"; + echo "\n\n\nperform_https_request: cURL error:" . $errmsg . "\n
\n\n"; + } + + #close connection + curl_close($ch); + + ## read and return data from novalnet paygate + if($debug) print "
\n\n" . $data . "\n
\n\n"; + + return array ($errno, $errmsg, $data); + } + + function debug2($object, $filename, $debug = false){ + if (!$debug){return;} + $fh = fopen("/tmp/$filename", 'a+'); + fwrite($fh, date('Y-m-d H:i:s').' '.print_r($object, true)); + fwrite($fh, "
\n"); + fclose($fh); + } + + function checkSecurity() { + global $_POST, $order, $insert_id, $messageStack; + + if(strlen(trim($_POST['tid']))==17 && $_POST['status']==100 && $_POST['session']== zen_session_id()){ + #xtc_redirect(zen_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL')); + }else{ + if($_POST['status_desc']){ + $error_status = $_POST['status_desc']; + }else { + $error_status = "There was an error and your payment could not be completed "; + } + $err = $error_status; + #'session missing or returned session is wrong'; + $order->info['comments'] .= '. Novalnet Error Message : '.$err; + $payment_error_return = 'payment_error='.$this->code/*.'&error='.$err*/; + $messageStack->add_session('checkout_payment', $err . '', 'error'); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + } + function encode($data){ + $data = trim($data); + if ($data == '') return'Error: no data'; + if (!function_exists('base64_encode') or !function_exists('pack') or !function_exists('crc32')){return'Error: func n/a';} + + try { + $crc = sprintf('%u', crc32($data));# %u is a must for ccrc32 returns a signed value + $data = $crc."|".$data; + $data = bin2hex($data.$this->key); + $data = strrev(base64_encode($data)); + } + catch (Exception $e){ + echo('Error: '.$e); + } + return $data; + } + + function decode($data){ + $data = trim($data); + if ($data == ''){ + return'Error: no data'; + } + if (!function_exists('base64_decode') or !function_exists('pack') or !function_exists('crc32')){ + return'Error: func n/a'; + } + + try { + $data = base64_decode(strrev($data)); + $data = pack("H".strlen($data), $data); + $data = substr($data, 0, stripos($data, $this->key)); + $pos = strpos($data, "|"); + if ($pos === false){ + return("Error: CKSum not found!"); + } + $crc = substr($data, 0, $pos); + $value = trim(substr($data, $pos+1)); + if ($crc != sprintf('%u', crc32($value))){ + return("Error; CKSum invalid!"); + } + return $value; + } + catch (Exception $e){ + echo('Error: '.$e); + } + } + + function hash($h){ #$h contains encoded data + global $amount_zh; + if (!$h) return'Error: no data'; + if (!function_exists('md5')){return'Error: func n/a';} + return md5($h['auth_code'].$h['product_id'].$h['tariff'].$h['amount'].$h['test_mode'].$h['uniqid'].strrev($this->key)); + } + + function checkHash($request){ + if (!$request) return false; #'Error: no data'; + $h['auth_code'] = $request['vendor_authcode'];#encoded + $h['product_id'] = $request['product_id'];#encoded + $h['tariff'] = $request['tariff_id'];#encoded + $h['amount'] = $request['amount'];#encoded + $h['test_mode'] = $request['test_mode'];#encoded + $h['uniqid'] = $request['uniqid'];#encoded + if ($request['hash2']!= $this->hash($h)){ + return false; + } + return true; + } + + function checkHash4java($request){ + if (!$request) return false; #'Error: no data'; + $h['auth_code'] = $request['auth_code'];#encoded + $h['product_id'] = $request['product_id'];#encoded + $h['tariff'] = $request['tariff_id'];#encoded + $h['amount'] = $request['amount'];#encoded + $h['test_mode'] = $request['test_mode'];#encoded + $h['uniqid'] = $request['uniqid'];#encoded + + if ($request['hash2'] != $this->hash($h)) + { + return false; + } + return true; + } + + function encode4java($data = '', $func = ''){ + $salt = 1010; + if (!isset($data) or trim($data) == '' or !$func){ + return'Error: missing arguments: $str and/or $func!'; + } + if ($func != 'decbin' and $func != 'bindec'){ + return'Error: $func has wrong value!'; + } + if ($func == 'decbin'){ + return decbin(intval($data) + intval($salt)); + }else{ + return bindec($data) - intval($salt); + } + } + function checkReturnedData(){ + if ($_POST['hash2'] && $_SESSION['payment'] == $this->code){ + if (strtoupper($this->implementation) == 'JAVA_PCI'){ + #Java encoded + if( $_POST['vendor_authcode'] != md5(MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_AUTH_CODE.strrev($this->key)) ){ + $err = MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEXT_HASH_ERROR.'; wrong auth_code!'; + $payment_error_return = 'payment_error=novalnet_elv_de_pci&error='.$_POST['status_text'].'; '.$err; + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + $_POST['auth_code'] = MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_AUTH_CODE;#todo: check? + $_POST['product_id'] = $this->encode4java($_POST['product_id'], 'bindec'); + $_POST['tariff_id'] = $this->encode4java($_POST['tariff_id'], 'bindec'); + $_POST['amount'] = $this->encode4java($_POST['amount'], 'bindec'); + $_POST['test_mode'] = $this->encode4java($_POST['test_mode'], 'bindec'); + $_POST['uniqid'] = $this->encode4java($_POST['uniqid'], 'bindec'); + + if (!$this->checkHash4java($_POST)){ #PHP encoded + $err = MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEXT_HASH_ERROR; + $payment_error_return = 'payment_error=novalnet_elv_de_pci&error='.$_POST['status_text'].'; '.$err; + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + }else{ #PHP encoded + if (!$this->checkHash($_POST)){ + $err = MODULE_PAYMENT_NOVALNET_ELV_DE_PCI_TEXT_HASH_ERROR; + $payment_error_return = 'payment_error=novalnet_elv_de_pci&error='.$_POST['status_text'].'; '.$err; + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + }else{ + $_POST['test_mode'] = $this->decode($_POST['test_mode']); + } + } + } + } + + function encodeParams($auth_code, $product_id, $tariff_id, $amount, $test_mode, $uniqid){ + if (strtoupper($this->implementation) == 'JAVA_PCI'){ + $uniqid = time();#must ne a long integer + $hash = md5($auth_code.$product_id.$tariff_id.$amount.$test_mode.$uniqid.strrev($this->key)); + $auth_code = md5($auth_code.strrev($this->key)); + $product_id = $this->encode4java($product_id, 'decbin'); + $tariff_id = $this->encode4java($tariff_id, 'decbin'); + $amount = $this->encode4java($amount, 'decbin'); + $test_mode = $this->encode4java($test_mode, 'decbin'); + $uniqid = $this->encode4java($uniqid, 'decbin'); + }else{ + $auth_code = $this->encode($auth_code); + $product_id = $this->encode($product_id); + $tariff_id = $this->encode($tariff_id); + $amount = $this->encode($amount); + $test_mode = $this->encode($test_mode); + $uniqid = $this->encode($uniqid); + $hash = $this->hash(array('auth_code' => $auth_code, 'product_id' => $product_id, 'tariff' => $tariff_id, 'amount' => $amount, 'test_mode' => $test_mode, 'uniqid' => $uniqid)); + } + return array($auth_code, $product_id, $tariff_id, $amount, $test_mode, $uniqid, $hash); + } + +} +/* +flow of functions: +selection -> $order-info['total'] wrong, cause shipping_cost is net +pre_confirmation_check -> $order-info['total'] wrong, cause shipping_cost is net +confirmation -> $order-info['total'] right, cause shipping_cost is gross +process_button -> $order-info['total'] right, cause shipping_cost is gross +before_process -> $order-info['total'] wrong, cause shipping_cost is net +after_process -> $order-info['total'] right, cause shipping_cost is gross +--------------- +flow of url/path: +/xtcommerce/account.php +/xtcommerce/account_history_info.php +/xtcommerce/address_book.php +/xtcommerce/checkout_shipping.php +/xtcommerce/checkout_shipping.php +/xtcommerce/checkout_payment.php +/xtcommerce/checkout_confirmation.php +*/ + +?> diff --git a/includes/modules/payment/novalnet_ideal.php b/includes/modules/payment/novalnet_ideal.php new file mode 100644 index 0000000..a458604 --- /dev/null +++ b/includes/modules/payment/novalnet_ideal.php @@ -0,0 +1,893 @@ +key = trim(MODULE_PAYMENT_NOVALNET_IDEAL_PASSWORD); #'z2Vw3E4j'; + $this->vendor_id = trim(MODULE_PAYMENT_NOVALNET_IDEAL_VENDOR_ID); + $this->auth_code = trim(MODULE_PAYMENT_NOVALNET_IDEAL_AUTH_CODE); + $this->product_id = trim(MODULE_PAYMENT_NOVALNET_IDEAL_PRODUCT_ID); + $this->tariff_id = trim(MODULE_PAYMENT_NOVALNET_IDEAL_TARIFF_ID); + $this->test_mode = (strtolower(MODULE_PAYMENT_NOVALNET_IDEAL_TEST_MODE) == 'true' or MODULE_PAYMENT_NOVALNET_IDEAL_TEST_MODE == '1')? 1: 0; + + $this->code = 'novalnet_ideal'; + $this->form_action_url = 'https://payport.novalnet.de/online_transfer_payport'; + $this->title = MODULE_PAYMENT_NOVALNET_IDEAL_TEXT_TITLE; + $this->public_title = MODULE_PAYMENT_NOVALNET_IDEAL_TEXT_PUBLIC_TITLE; + $this->description = MODULE_PAYMENT_NOVALNET_IDEAL_TEXT_DESCRIPTION; + $this->sort_order = MODULE_PAYMENT_NOVALNET_IDEAL_SORT_ORDER; + $this->enabled = ((MODULE_PAYMENT_NOVALNET_IDEAL_STATUS == 'True') ? true : false); + $this->blnDebug = false; #todo: set to false for live system + $this->proxy = MODULE_PAYMENT_NOVALNET_IDEAL_PROXY; + $this->implementation = ''; + + + + if(MODULE_PAYMENT_NOVALNET_IDEAL_LOGO_STATUS == 'True'){ + $this->public_title = 'Novalnet'.' '.MODULE_PAYMENT_NOVALNET_IDEAL_TEXT_PUBLIC_TITLE; + $this->title = 'Novalnet'.' '.MODULE_PAYMENT_NOVALNET_IDEAL_TEXT_TITLE; + } + $this->checkConfigure(); + + if ((int)MODULE_PAYMENT_NOVALNET_IDEAL_ORDER_STATUS_ID > 0) { + $this->order_status = MODULE_PAYMENT_NOVALNET_IDEAL_ORDER_STATUS_ID; + } + #check encoded data + #check encoded data + if ($_REQUEST['hash2']){ + if (!$this->checkHash($_REQUEST)){ + $err = MODULE_PAYMENT_NOVALNET_IDEAL_TEXT_HASH_ERROR; + $payment_error_return = 'payment_error=novalnet_ideal&error='.$_REQUEST['status_text'].'; '.$err; + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + }else{ + $_REQUEST['auth_code'] = $this->decode($_REQUEST['auth_code']); + $_REQUEST['product_id'] = $this->decode($_REQUEST['product_id']); + $_REQUEST['tariff_id'] = $this->decode($_REQUEST['tariff_id']); + $_REQUEST['amount'] = $this->decode($_REQUEST['amount']); + $_REQUEST['test_mode'] = $this->decode($_REQUEST['test_mode']); + $_REQUEST['uniqid'] = $this->decode($_REQUEST['uniqid']); + } + } + + if ((int)MODULE_PAYMENT_NOVALNET_IDEAL_ORDER_STATUS_ID > 0) { + $this->order_status = MODULE_PAYMENT_NOVALNET_IDEAL_ORDER_STATUS_ID; + } + + if (is_object($order)) $this->update_status(); + } + + + function checkConfigure() { + if (IS_ADMIN_FLAG == true) { + $this->title = MODULE_PAYMENT_NOVALNET_IDEAL_TEXT_TITLE; // Payment module title in Admin + if(MODULE_PAYMENT_NOVALNET_IDEAL_LOGO_STATUS == 'True'){ + $this->public_title = 'Novalnet'.' '.MODULE_PAYMENT_NOVALNET_IDEAL_TEXT_PUBLIC_TITLE; + $this->title = 'Novalnet'.' '.MODULE_PAYMENT_NOVALNET_IDEAL_TEXT_TITLE; + } + if ($this->enabled == 'true' && (!$this->vendor_id || !$this->auth_code || !$this->product_id || !$this->tariff_id || !$this->key )) { + $this->title .= ''.MODULE_PAYMENT_NOVALNET_IDEAL_NOT_CONFIGURED.''; + } elseif ($this->test_mode == '1') { + $this->title .= ''.MODULE_PAYMENT_NOVALNET_IDEAL_IN_TEST_MODE.''; + } + + } + } + ### calculate zone matches and flag settings to determine whether this module should display to customers or not ### + function update_status() { + global $order, $db; + + if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_NOVALNET_IDEAL_ZONE > 0) ) { + $check_flag = false; + $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_NOVALNET_IDEAL_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id"); + while (!$check->EOF) { + if ($check->fields['zone_id'] < 1) { + $check_flag = true; + break; + } elseif ($check->fields['zone_id'] == $order->billing['zone_id']) { + $check_flag = true; + break; + } + $check->MoveNext(); + } + + if ($check_flag == false) { + $this->enabled = false; + } + } + } + + ### JS validation which does error-checking of data-entry if this module is selected for use ### + ### the fields to be cheked are (Bank Owner, Bank Account Number and Bank Code Lengths) ### + ### currently this function is not in use ### + // @return string + function javascript_validation() { + return false; + } + + ### Builds set of input fields for collecting Bankdetail info ### + // @return array + function selection() { + global $xtPrice, $order, $HTTP_POST_VARS, $_POST; + + $onFocus = ''; + if(count($HTTP_POST_VARS)==0 || $HTTP_POST_VARS=='') $HTTP_POST_VARS = $_POST; + + + $selection = array('id' => $this->code, + 'module' => $this->public_title, + 'fields' => array(array('title' => '', 'field' => MODULE_PAYMENT_NOVALNET_INFORMATION_PAYMENT_IDEAL), + array('title' => '', 'field' => MODULE_PAYMENT_NOVALNET_IDEAL_INFO) + )); + + + if(function_exists('get_percent')) + { + $selection['module_cost'] = $GLOBALS['ot_payment']->get_percent($this->code); + } + return $selection; + } + + ### Precheck to Evaluate the Bank Datas ### + function pre_confirmation_check() { + global $HTTP_POST_VARS, $_POST, $messageStack; + + if(count($HTTP_POST_VARS)==0 || $HTTP_POST_VARS=='') $HTTP_POST_VARS = $_POST; + + $error = ''; + + if (!function_exists('curl_init') && ($this->code=='novalnet_ideal')){ + ini_set('display_errors', 1); + ini_set('error_reporting', E_ALL); + $error = MODULE_PAYMENT_NOVALNET_IDEAL_CURL_MESSAGE; + } + + if(!$this->vendor_id || !$this->auth_code || !$this->product_id || !$this->tariff_id || !$this->key) + { + $error = MODULE_PAYMENT_NOVALNET_IDEAL_TEXT_JS_NN_MISSING; + } + + + if($error!='') { + $payment_error_return = 'payment_error=' . $this->code; + $messageStack->add_session('checkout_payment', $error . '', 'error'); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + } + + ### Display Bank Information on the Checkout Confirmation Page ### + // @return array + function confirmation() { + global $HTTP_POST_VARS, $_POST, $order; + $_SESSION['nn_total'] = $order->info['total']; + if(count($HTTP_POST_VARS)==0 || $HTTP_POST_VARS=='') $HTTP_POST_VARS = $_POST; + + $confirmation = array(); + + return $confirmation; + } + + ### Build the data and actions to process when the "Submit" button is pressed on the order-confirmation screen. ### + ### These are hidden fields on the checkout confirmation page ### + // @return string + function process_button() { + global $HTTP_POST_VARS, $_POST, $order, $currencies, $customer_id, $db; + if(count($HTTP_POST_VARS)==0 || $HTTP_POST_VARS=='') $HTTP_POST_VARS = $_POST; + + #Get the required additional customer details from DB + $nn_customer_id = (isset($_SESSION['customer_id'])) ? $_SESSION['customer_id'] : ''; + $customer = $db->Execute("SELECT customers_gender, customers_dob, customers_fax FROM ". TABLE_CUSTOMERS . " WHERE customers_id='". (int)$nn_customer_id."'"); + + if ($customer->RecordCount() > 0){ + $customer = $customer->fields; + } + list($customer['customers_dob'], $extra) = explode(' ', $customer['customers_dob']); + + if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status_add_tax_ot'] == 1) { + $totalamount=$order->info['total'] + $order->info['tax']; + } else { + $totalamount=$order->info['total']; + } + $totalamount = number_format($totalamount * $currencies->get_value($order->info['currency']),2); + $amount = str_replace(',', '', $totalamount); + $amount = intval(round($amount*100)); + //$amount =sprintf('%.2f', $totalamount); + if (preg_match('/[^\d\.]/', $amount) or !$amount){ + ### $amount contains some unallowed chars or empty ### + $err = '$amount ('.$amount.') is empty or has a wrong format'; + $order->info['comments'] .= 'Novalnet Error Message : '.$err; + $payment_error_return = 'payment_error='.$this->code; + $messageStack->add_session('checkout_payment', $err . '', 'error'); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + // $amount = preg_replace('/^0+/', '', $amount); + // $amount = sprintf('%0.2f', $amount); + // $amount = str_replace('.', '', $amount); + //$amount = $amount; + $vendor_id = $this->vendor_id; + $auth_code = $this->auth_code; + $product_id = $this->product_id; + $tariff_id = $this->tariff_id; + $customer_id = $_SESSION['customer_id']; + $uniqid = uniqid(); + + $auth_code = $this->encode($auth_code); + $product_id = $this->encode($product_id); + $tariff_id = $this->encode($tariff_id); + $amount = $this->encode($amount); + $test_mode = $this->encode((strtolower(MODULE_PAYMENT_NOVALNET_IDEAL_TEST_MODE) == 'true' or MODULE_PAYMENT_NOVALNET_IDEAL_TEST_MODE == '1')? 1: 0); + $uniqid = $this->encode(uniqid()); + $hash = $this->hash(array('auth_code' => $auth_code, 'product_id' => $product_id, 'tariff' => $tariff_id, 'amount' => $amount, 'test_mode' => $test_mode, 'uniqid' => $uniqid)); + + $user_ip = $this->getRealIpAddr(); + $checkout_url = zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'); + + + + if(strstr($checkout_url, '?')) + { + $checkout_url = str_replace(' ', '', $checkout_url); + if(substr($checkout_url,-1)=='?') + $error_url = $checkout_url.'payment_error=novalnet_ideal&error=$ERROR_MESSAGE'; + else $error_url = $checkout_url.'&payment_error=novalnet_ideal&error=$ERROR_MESSAGE'; + } + else $error_url = $checkout_url.'?payment_error=novalnet_ideal&error=$ERROR_MESSAGE'; + $oldreturnurl=zen_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL'); + $old_value=explode(':',$oldreturnurl); + $new_protocol_value=(empty($_SERVER["HTTPS"])) ? 'http' : 'https'; + $return_url=$new_protocol_value.':'.$old_value[1]; + $_SESSION['pymt_method'] = 'ideal'; + + + $firstname = !empty($order->customer['firstname']) ? $order->customer['firstname'] : $order->billing['firstname']; + $lastname = !empty($order->customer['lastname']) ? $order->customer['lastname'] : $order->billing['lastname']; + $email_address = !empty($order->customer['email_address']) ? $order->customer['email_address'] : $order->billing['email_address']; + $street_address = !empty($order->customer['street_address']) ? $order->customer['street_address'] : $order->billing['street_address']; + $city = !empty($order->customer['city']) ? $order->customer['city'] : $order->billing['city']; + $postcode = !empty($order->customer['postcode']) ? $order->customer['postcode'] : $order->billing['postcode']; + $country_iso_code_2 = !empty($order->customer['country']['iso_code_2']) ? $order->customer['country']['iso_code_2'] : $order->billing['country']['iso_code_2']; + $customer_no = ($customer['customers_status'] != 1) ? $nn_customer_id : MODULE_PAYMENT_NOVALNET_IDEAL_GUEST_USER; + + $process_button_string = + zen_draw_hidden_field('vendor', $vendor_id) .#Pflicht + zen_draw_hidden_field('auth_code', $auth_code) . + zen_draw_hidden_field('product', $product_id) . + zen_draw_hidden_field('tariff', $tariff_id) . + zen_draw_hidden_field('test_mode', $test_mode) . + zen_draw_hidden_field('uniqid', $uniqid) . + zen_draw_hidden_field('amount', $amount) . + zen_draw_hidden_field('hash', $hash) . + zen_draw_hidden_field('nnpayment','ideal') . + zen_draw_hidden_field('key', $this->payment_key) .#Pflicht + zen_draw_hidden_field('currency', $order->info['currency']) . + zen_draw_hidden_field('first_name', $firstname) . + zen_draw_hidden_field('last_name', $lastname) . + zen_draw_hidden_field('gender', 'u') . + zen_draw_hidden_field('email', $email_address) . + zen_draw_hidden_field('street', $street_address) . + zen_draw_hidden_field('search_in_street', '1') . + zen_draw_hidden_field('city', $order->customer['city']) . + zen_draw_hidden_field('zip', $postcode) . + zen_draw_hidden_field('country', $country_iso_code_2) . + zen_draw_hidden_field('country_code', $country_iso_code_2) . + zen_draw_hidden_field('lang', MODULE_PAYMENT_NOVALNET_IDEAL_TEXT_LANG) .#default: 'DE' + zen_draw_hidden_field('language', MODULE_PAYMENT_NOVALNET_IDEAL_TEXT_LANG) .#default: 'DE' + zen_draw_hidden_field('remote_ip', $user_ip) . #Pflicht + zen_draw_hidden_field('tel', $order->customer['telephone']) . + zen_draw_hidden_field('fax', $customer['customers_fax']) . + zen_draw_hidden_field('birth_date', $customer['customers_dob']) . + zen_draw_hidden_field('session', zen_session_id()) . + zen_draw_hidden_field('return_url', $return_url) . + zen_draw_hidden_field('return_method', 'POST') . + zen_draw_hidden_field('error_return_url', $error_url) . + //zen_draw_hidden_field('user_variable_0', str_replace(array($new_protocol_value.'://', 'www.'), array('', ''), $_SERVER['SERVER_NAME'])) . + zen_draw_hidden_field('error_return_method', 'POST'). + zen_draw_hidden_field('customer_no', $customer_no) . + zen_draw_hidden_field('use_utf8', '1') . + zen_draw_hidden_field('proxy', $this->proxy); + + $process_button_string .= $this->getParams4Ideal(); + + return $process_button_string; + } + + ### Insert the Novalnet Transaction ID in DB ### + function before_process() { + global $HTTP_POST_VARS, $_POST, $order, $currencies, $customer_id; + if( isset( $_POST['status'] ) && $_POST['status'] == 100 ) { + if( $this->order_status ) { + $order->info['order_status'] = $this->order_status; + } + + if(count($HTTP_POST_VARS)==0 || $HTTP_POST_VARS=='') $HTTP_POST_VARS = $_POST; + if ($_REQUEST['test_mode'] == 1){ + $order->info['comments'] .= '
'.MODULE_PAYMENT_NOVALNET_IDEAL_TEST_ORDER_MESSAGE.'
'; + } + + $order->info['comments'] .= '
'.MODULE_PAYMENT_NOVALNET_IDEAL_TID_MESSAGE.$HTTP_POST_VARS['tid'].'

'; + $_SESSION['nn_tid'] = $HTTP_POST_VARS['tid'];#todo: + $order->info['comments'] = str_replace(array('', '','','', '
','
','
'), array('', '', '','',"\n", "\n","\n"), $order->info['comments']); + } + } + + ### Send the order detail to Novalnet ### + function after_process() { + global $order, $customer_id, $insert_id; + $product_id = MODULE_PAYMENT_NOVALNET_IDEAL_PRODUCT_ID; + $tariff_id = MODULE_PAYMENT_NOVALNET_IDEAL_TARIFF_ID; + if( $_SESSION['nn_tid'] != ''){ + ### Pass the Order Reference to paygate ## + $url = 'https://payport.novalnet.de/paygate.jsp'; + $urlparam = 'vendor='.$this->vendor_id.'&product='.$this->product_id.'&key='.$this->payment_key.'&tariff='.$this->tariff_id; + $urlparam .= '&auth_code='.$this->auth_code.'&status=100&tid='.$_SESSION['nn_tid'].'&vwz2='.MODULE_PAYMENT_NOVALNET_IDEAL_TEXT_ORDERNO.''.$insert_id.'&vwz3='.MODULE_PAYMENT_NOVALNET_IDEAL_TEXT_ORDERDATE.''.date('Y-m-d H:i:s').'&order_no='.$insert_id; + list($errno, $errmsg, $data) = $this->perform_https_request($url, $urlparam); + } + unset($_SESSION['nn_tid']); + + #print "$customer_id, $insert_id"; exit; + ### Implement here the Emailversand and further functions, incase if you want to send a own email ### + //$_SESSION['t_id']=$insert_id; + return false; + } + + ### Used to display error message details ### + // @return array + function get_error() { + global $HTTP_GET_VARS, $_GET; + if(count($HTTP_GET_VARS)==0 || $HTTP_GET_VARS=='') $HTTP_GET_VARS = $_GET; + + #print $HTTP_GET_VARS['error']; exit; + $error = array('title' => MODULE_PAYMENT_NOVALNET_IDEAL_TEXT_ERROR, 'error' => stripslashes(utf8_decode($HTTP_GET_VARS['error']))); + + return $error; + } + + ### Check to see whether module is installed ### + // @return boolean + function check() { + global $db; + if (!isset($this->_check)) { + $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_NOVALNET_IDEAL_STATUS'"); + $this->_check = $check_query->RecordCount(); + } + return $this->_check; + } + + function install_lang($field_text,$lang) + { + #Allowed Zones + $install_text['allowed_title'] = array('en' => "Allowed zones", + 'de' => "erlaubte Zonen"); + $install_text['allowed_desc'] = array('en' => "Please enter the desired zones separated by comma (Eg: AT, DE) or leave it blank", + 'de' => "Bitte die gewünschten Zonen durch Komma getrennt eingeben (z.B: AT,DE) oder einfach leer lassen"); + #Enable Module + $install_text['enable_title'] = array('en' => "Enable Module", + 'de' => "Modul aktivieren"); + $install_text['enable_desc'] = array('en' => "Do you want to activate the Credit Card of Novalnet AG?", + 'de' => "Wollen Sie das Kreditkarten Modul des Novalnet AG aktivieren?"); + #Test Mode + $install_text['test_title'] = array('en' => "Enable Test Mode:", + 'de' => "Testmodus einschalten"); + $install_text['test_desc'] = array('en' => "Do you want to activate test mode?", + 'de' => "Wollen Sie den Test-Modus aktivieren?"); + #Vendor id + $install_text['vendor_title'] = array('en' => "Novalnet Merchant ID", + 'de' => "Novalnet Händler ID"); + $install_text['vendor_desc'] = array('en' => "Enter your Novalnet Merchant ID ", + 'de' => "Geben Sie Ihre Novalnet Händler-ID ein "); + #Auth Code + $install_text['auth_title'] = array('en' => "Novalnet Merchant Authorisation Code", + 'de' => "Novalnet Authorisierungsschlüssel"); + $install_text['auth_desc'] = array('en' => "Enter your Novalnet Merchant Authorisation code ", + 'de' => "Geben Sie Ihren Novalnet-Authorisierungsschlüssel ein"); + + #Product id + $install_text['product_title'] = array('en' => "Novalnet Product ID", + 'de' => "Novalnet Produkt ID"); + $install_text['product_desc'] = array('en' => "Enter your Novalnet Product ID", + 'de' => "Geben Sie Ihre Novalnet Produkt-ID ein"); + + #Tariff id + $install_text['tariff_title'] = array('en' => "Novalnet Tariff ID", + 'de' => "Novalnet Tarif ID"); + $install_text['tariff_desc'] = array('en' => "Enter your Novalnet Tariff ID ", + 'de' => "Geben Sie Ihre Novalnet Tarif-ID ein"); + + #Enduser info + $install_text['enduser_title'] = array('en' => "Information to the end customer", + 'de' => "Informationen für den Endkunden"); + $install_text['enduser_desc'] = array('en' => "will appear in the payment form", + 'de' => "wird im Bezahlformular erscheinen"); + + #Sortorder display + $install_text['sortorder_title'] = array('en' => "Sort order of display", + 'de' => "Sortierung nach"); + $install_text['sortorder_desc'] = array('en' => "Sort order of display. Lowest is displayed first.", + 'de' => "Sortierung der Anzeige. Der niedrigste Wert wird zuerst angezeigt."); + + #Setorder status display + $install_text['setorderstatus_title'] = array('en' => "Set Order Status", + 'de' => "Bestellungsstatus setzen"); + $install_text['setorderstatus_desc'] = array('en' => "Set the status of orders made with this payment module to this value.", + 'de' => "Setzen Sie den Status von über dieses Zahlungsmodul durchgeführten Bestellungen auf diesen Wert."); + + #Proxy + $install_text['proxy_title'] = array('en' => "Proxy-Server", + 'de' => "Proxy-Server"); + $install_text['proxy_desc'] = array('en' => " If you use a Proxy Server, enter the Proxy Server IP with port here (e.g. www.proxy.de:80).", + 'de' => "Wenn Sie einen Proxy-Server einsetzen, tragen Sie hier Ihre Proxy-IP und den Port ein (z.B. www.proxy.de:80)."); + + #Payment Zone + $install_text['paymnetzone_title'] = array('en' => "Payment Zone", + 'de' => "Zahlungsgebiet"); + $install_text['paymnetzone_desc'] = array('en' => "If a zone is selected then this module is activated only for Selected zone. ", + 'de' => "Wird ein Bereich ausgewählt, dann wird dieses Modul nur für den ausgewählten Bereich aktiviert."); + + #Novalnet Password + $install_text['password_title'] = array('en' => "Novalnet Password", + 'de' => "Novalnet Passwort"); + $install_text['password_desc'] = array('en' => "Enter your Novalnet Password.", + 'de' => "Geben Sie Ihr Novalnet Passwort ein."); + + #Activate Logo Mode + $install_text['logo_title'] = array('en' => "Activate logo mode:", + 'de' => "Aktivieren Sie Logo Modus:"); + $install_text['logo_desc'] = array('en' => "Do you want to activate logo mode?", + 'de' => "Wollen Sie Logo-Modus zu aktivieren?"); + + return $install_text[$field_text][$lang]; + } + + + ### Install the payment module and its configuration settings ### + function install() { + global $db; + + $allowed_title = $this->install_lang('allowed_title', DEFAULT_LANGUAGE); + $allowed_desc = $this->install_lang('allowed_desc', DEFAULT_LANGUAGE); + + $enable_title = $this->install_lang('enable_title', DEFAULT_LANGUAGE); + $enable_desc = $this->install_lang('enable_desc', DEFAULT_LANGUAGE); + + $test_title = $this->install_lang('test_title', DEFAULT_LANGUAGE); + $test_desc = $this->install_lang('test_desc', DEFAULT_LANGUAGE); + + $vendor_title = $this->install_lang('vendor_title', DEFAULT_LANGUAGE); + $vendor_desc = $this->install_lang('vendor_desc', DEFAULT_LANGUAGE); + + $auth_title = $this->install_lang('auth_title', DEFAULT_LANGUAGE); + $auth_desc = $this->install_lang('auth_desc', DEFAULT_LANGUAGE); + + $product_title = $this->install_lang('product_title', DEFAULT_LANGUAGE); + $product_desc = $this->install_lang('product_desc', DEFAULT_LANGUAGE); + + $tariff_title = $this->install_lang('tariff_title', DEFAULT_LANGUAGE); + $tariff_desc = $this->install_lang('tariff_desc', DEFAULT_LANGUAGE); + + $enduser_title = $this->install_lang('enduser_title', DEFAULT_LANGUAGE); + $enduser_desc = $this->install_lang('enduser_desc', DEFAULT_LANGUAGE); + + $sortorder_title = $this->install_lang('sortorder_title', DEFAULT_LANGUAGE); + $sortorder_desc = $this->install_lang('sortorder_desc', DEFAULT_LANGUAGE); + + $setorderstatus_title = $this->install_lang('setorderstatus_title', DEFAULT_LANGUAGE); + $setorderstatus_desc = $this->install_lang('setorderstatus_desc', DEFAULT_LANGUAGE); + + $proxy_title = $this->install_lang('proxy_title', DEFAULT_LANGUAGE); + $proxy_desc = $this->install_lang('proxy_desc', DEFAULT_LANGUAGE); + + $paymnetzone_title = $this->install_lang('paymnetzone_title', DEFAULT_LANGUAGE); + $paymnetzone_desc = $this->install_lang('paymnetzone_desc', DEFAULT_LANGUAGE); + + $password_title = $this->install_lang('password_title', DEFAULT_LANGUAGE); + $password_desc = $this->install_lang('password_desc', DEFAULT_LANGUAGE); + + $logo_title = $this->install_lang('logo_title', DEFAULT_LANGUAGE); + $logo_desc = $this->install_lang('logo_desc', DEFAULT_LANGUAGE); + + + /*$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$allowed_title."','MODULE_PAYMENT_NOVALNET_IDEAL_ALLOWED', '','".$allowed_desc."', '6', '0', now())"); */ + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('".$enable_title."', 'MODULE_PAYMENT_NOVALNET_IDEAL_STATUS', 'True', '".$enable_desc."', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('".$test_title."', 'MODULE_PAYMENT_NOVALNET_IDEAL_TEST_MODE', 'True', '".$test_desc."', '6', '1', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$vendor_title."', 'MODULE_PAYMENT_NOVALNET_IDEAL_VENDOR_ID', '', '".$vendor_desc."', '6', '2', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$auth_title."', 'MODULE_PAYMENT_NOVALNET_IDEAL_AUTH_CODE', '', '".$auth_desc."', '6', '3', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$product_title."','MODULE_PAYMENT_NOVALNET_IDEAL_PRODUCT_ID', '', '".$product_desc."', '6', '4', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$tariff_title."', 'MODULE_PAYMENT_NOVALNET_IDEAL_TARIFF_ID', '', '".$tariff_desc."', '6', '5', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$password_title."', 'MODULE_PAYMENT_NOVALNET_IDEAL_PASSWORD', '', '".$password_desc."', '6', '6', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$sortorder_title."', 'MODULE_PAYMENT_NOVALNET_IDEAL_SORT_ORDER', '0', '".$sortorder_desc."', '6', '7', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$enduser_title."', 'MODULE_PAYMENT_NOVALNET_IDEAL_INFO', '', '".$enduser_desc."', '6', '8', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('".$setorderstatus_title."', 'MODULE_PAYMENT_NOVALNET_IDEAL_ORDER_STATUS_ID', '0', '".$setorderstatus_desc."', '6', '9', 'zen_cfg_pull_down_order_statuses(', 'zen_get_order_status_name', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('".$paymnetzone_title."', 'MODULE_PAYMENT_NOVALNET_IDEAL_ZONE', '0', '".$paymnetzone_desc."', '6', '10', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$proxy_title."', 'MODULE_PAYMENT_NOVALNET_IDEAL_PROXY', '', '".$proxy_desc."', '6', '11', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('".$logo_title."', 'MODULE_PAYMENT_NOVALNET_IDEAL_LOGO_STATUS', 'True', '".$logo_desc."', '6', '12', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + + } + + ### Remove the module and all its settings ### + function remove() { + global $db; + $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); + } + + ### Internal list of configuration keys used for configuration of the module ### + // @return array + function keys(){ + return array('MODULE_PAYMENT_NOVALNET_IDEAL_LOGO_STATUS','MODULE_PAYMENT_NOVALNET_IDEAL_STATUS', + 'MODULE_PAYMENT_NOVALNET_IDEAL_TEST_MODE','MODULE_PAYMENT_NOVALNET_IDEAL_VENDOR_ID', 'MODULE_PAYMENT_NOVALNET_IDEAL_AUTH_CODE', 'MODULE_PAYMENT_NOVALNET_IDEAL_PRODUCT_ID', 'MODULE_PAYMENT_NOVALNET_IDEAL_TARIFF_ID', 'MODULE_PAYMENT_NOVALNET_IDEAL_INFO', 'MODULE_PAYMENT_NOVALNET_IDEAL_SORT_ORDER', 'MODULE_PAYMENT_NOVALNET_IDEAL_ORDER_STATUS_ID', + 'MODULE_PAYMENT_NOVALNET_IDEAL_ZONE', 'MODULE_PAYMENT_NOVALNET_IDEAL_PASSWORD', 'MODULE_PAYMENT_NOVALNET_IDEAL_PROXY'); + } + + + function html_to_utf8 ($data) + { + $data = utf8_encode($data); + return preg_replace("/\\&\\#([0-9]{3,10})\\;/e", '$this->_html_to_utf8("\\1")', $data); + } + + function _html_to_utf8 ($data) + { + if ($data > 127) + { + $i = 5; + while (($i--) > 0) + { + if ($data != ($a = $data % ($p = pow(64, $i)))) + { + $ret = chr(base_convert(str_pad(str_repeat(1, $i + 1), 8, "0"), 2, 10) + (($data - $a) / $p)); + for ($i; $i > 0; $i--) + $ret .= chr(128 + ((($data % pow(64, $i)) - ($data % ($p = pow(64, $i - 1)))) / $p)); + break; + } + } + } + else + { + #$this->debug2("&#$data;"); + $ret = "&#$data;"; + } + return $ret; + } + + function debug2($text) + { + $fh = fopen('/tmp/debug2.txt', 'a+'); + if (gettype($text) == 'class' or gettype($text) == 'array') + { + $text = serialize($text); + fwrite($fh, $text); + } + else + { + fwrite($fh, date('H:i:s ').$text."\n"); + } + fclose($fh); + } + + function getAmount($amount) + { + if(!$amount)$amount = $order->info['total']; + if(preg_match('/[,.]$/', $amount)) + { + $amount = $amount . '00'; + } + else if(preg_match('/[,.][0-9]$/', $amount)) + { + $amount = $amount . '0'; + } + $amount = str_replace(array('.', ','),array('',''), $amount); + return$amount; + } + + function isPublicIP($value) + { + if(!$value || count(explode('.',$value))!=4) return false; + return !preg_match('~^((0|10|172\.16|192\.168|169\.254|255|127\.0)\.)~', $value); + } + + ### get the real Ip Adress of the User ### + function getRealIpAddr() + { + if($this->isPublicIP($_SERVER['HTTP_X_FORWARDED_FOR'])) return $_SERVER['HTTP_X_FORWARDED_FOR']; + if($iplist=explode(',', $_SERVER['HTTP_X_FORWARDED_FOR'])) + { + if($this->isPublicIP($iplist[0])) return $iplist[0]; + } + if ($this->isPublicIP($_SERVER['HTTP_CLIENT_IP'])) return $_SERVER['HTTP_CLIENT_IP']; + if ($this->isPublicIP($_SERVER['HTTP_X_CLUSTER_CLIENT_IP'])) return $_SERVER['HTTP_X_CLUSTER_CLIENT_IP']; + if ($this->isPublicIP($_SERVER['HTTP_FORWARDED_FOR']) ) return $_SERVER['HTTP_FORWARDED_FOR']; + + return $_SERVER['REMOTE_ADDR']; + } + + ### replace the Special German Charectors ### + function ReplaceSpecialGermanChars($string) + { + $what = array("ä", "ö", "ü", "Ä", "Ö", "Ãœ", "ß"); + $how = array("ae", "oe", "ue", "Ae", "Oe", "Ue", "ss"); + + $string = str_replace($what, $how, $string); + + return $string; + } + function getParams4Ideal() + { + if(count($HTTP_POST_VARS)==0 || $HTTP_POST_VARS=='') $HTTP_POST_VARS = $_POST; + /*for instant bank transfer via www.sofortueberweisung.de + required params: + project_id= must be registred at via www.sofortueberweisung.de + user_id = Kundennr. ($_SESSION['nn_tid']) + + optional params: + Parameter Bedeutung Typ (Länge) Erklärung + amount Betrag Double (8,2) Der zu überweisende Betrag (Minimum: 0.10 EURO, wichtig für Testbestellungen) Bitte keine Trennzeichen bei Tausender-Beträgen, z.B. 1010.50 Euro, correct: + + reason_1 Verwendungszweck1 String (27) Der Verwendungszweck in Zeile 1 (max. 27 Zeichen). Dieser sollte bei jeder Bestellung unterschiedliche Zuordnungsmerkmale aufweisen (z.B. Bestellnummer, Datum der Bestellung) und ist damit eindeutig. + + reason_2 + + sender_bank_code Bankleitzahl des Kunden String (30) Absender-Bankleitzahl + sender_account_number Kontonummer des Kunden String (30) Absender-Kontonummer + sender_holder Kontoinhaber des Kunden String (27) Absender-Kontoinhaber + sender_country_id Kontoinhaber Länderkürzel String (2) Absender-Land(zweistellig,z.B. DE, CH, AT) + hash Hash-Wert String (>=32) Input-Prüfung, siehe Kapitel 3.2.5 + currency_id Transaktionswährung String (3) Werte sind EUR, CHF und GBP* (* Voraussetzung: englischesKonto) + language_id Sprache des Zahlformulars String (2) Legen Sie mit diesem Parameter die Sprache des Zahlformulars fest, Werte, z.B. DE, EN + + user_variable_0 bis user_variable_5 Kundenvariable 0-5 String (255) Zu Ihrer freien Verwendung (z.B. Session-ID) + + #to deposit at www.sofortueberweisung.de: + Erfolgslink: http://zencart.gsoftpro.de/checkout_process.php + Abbruchlink: http://zencart.gsoftpro.de/.php + + ####Plausicheck error von XT: + http://localhost/zencart/checkout_payment.php?payment_error=novalnet_instantbanktransfer&error=*+Deutsche+Kontonummer+muss+mindestens+3+stellig+sein! + ####wrong bank code error von Novalnet: + http://localhost/zencart/checkout_payment.php?payment_error=novalnet_instantbanktransfer&error=Die+angegebene+Bankleitzahl+gibt+es+nicht+%28501007%29 + http://zencart.gsoftpro.de/checkout_payment.php?payment_error=novalnet_INSTANTBANKTRANSFER&error=zh + ####sucess + */ + //$params = + #zen_draw_hidden_field('amount', str_replace(',', '.', $_SESSION['nn_total'])).#todo:form check + #zen_draw_hidden_field('sender_bank_code', $HTTP_POST_VARS['bank_code']). + #zen_draw_hidden_field('sender_account_number', $HTTP_POST_VARS['bank_account']). + #zen_draw_hidden_field('sender_holder=', $this->html_to_utf8($HTTP_POST_VARS['bank_account_holder'])). + #zen_draw_hidden_field('sender_country_id', 'DE'). + #zen_draw_hidden_field('currency_id', 'EUR'). + #zen_draw_hidden_field('language_id', MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEXT_LANG); + #zen_draw_hidden_field('customer_id', $_SESSION['nn_tid']). + //zen_draw_hidden_field('user_variable_0', (str_replace(array('http://', 'www.'), array('', ''), HTTP_SERVER))); + $params = zen_draw_hidden_field('user_variable_0', HTTP_SERVER); + return$params; + #this link is stored at www.soforueberweisung.de: https://payport.novalnet.de/online_transfer_payport?status=ok&customer_id=-CUSTOMER_ID-&transaction=-TRANSACTION-&sender_holder=-SENDER_HOLDER-&sender_holder_urlencode=-SENDER_HOLDER_URLENCODE-&sender_account_number=-SENDER_ACCOUNT_NUMBER-&sender_bank_code=-SENDER_BANK_CODE-&sender_bank_name=-SENDER_BANK_NAME-&sender_bank_name_urlencode=-SENDER_BANK_NAME_URLENCODE-&sender_bank_bic=-SENDER_BANK_BIC-&sender_iban=-SENDER_IBAN-&user_variable_0=-USER_VARIABLE_0- + } + + function encode($data) + { + $data = trim($data); + if ($data == '') return'Error: no data'; + if (!function_exists('base64_encode') or !function_exists('pack') or !function_exists('crc32')){return'Error: func n/a';} + + try { + $crc = sprintf('%u', crc32($data));# %u is a must for ccrc32 returns a signed value + $data = $crc."|".$data; + $data = bin2hex($data.$this->key); + $data = strrev(base64_encode($data)); + }catch (Exception $e){ + echo('Error: '.$e); + } + return $data; + } + function decode($data) + { + $data = trim($data); + if ($data == '') {return'Error: no data';} + if (!function_exists('base64_decode') or !function_exists('pack') or !function_exists('crc32')){return'Error: func n/a';} + + try { + $data = base64_decode(strrev($data)); + $data = pack("H".strlen($data), $data); + $data = substr($data, 0, stripos($data, $this->key)); + $pos = strpos($data, "|"); + if ($pos === false){ + return("Error: CKSum not found!"); + } + $crc = substr($data, 0, $pos); + $value = trim(substr($data, $pos+1)); + if ($crc != sprintf('%u', crc32($value))){ + return("Error; CKSum invalid!"); + } + return $value; + }catch (Exception $e){ + echo('Error: '.$e); + } + } + function hash($h)#$h contains encoded data + { + global $amount_zh; + if (!$h) return'Error: no data'; + if (!function_exists('md5')){return'Error: func n/a';} + //echo '
rev pass : '; + //echo strrev($this->key); + //echo '
stright pass : '; + //echo $this->key; + //echo '
'; + return md5($h['auth_code'].$h['product_id'].$h['tariff'].$h['amount'].$h['test_mode'].$h['uniqid'].strrev($this->key)); + } + function checkHash($request) + { + //echo 'check hash called '; + if (!$request) return false; #'Error: no data'; + $h['auth_code'] = $request['auth_code'];#encoded + $h['product_id'] = $request['product'];#encoded + $h['tariff'] = $request['tariff'];#encoded + $h['amount'] = $request['amount'];#encoded + $h['test_mode'] = $request['test_mode'];#encoded + $h['uniqid'] = $request['uniqid'];#encoded + if ($request['hash2'] != $this->hash($h)){ + return false; + } + return true; + } + + function checkHash4java($request) + { + if (!$request) return false; #'Error: no data'; + $h['auth_code'] = $request['auth_code'];#encoded + $h['product_id'] = $request['product_id'];#encoded + $h['tariff'] = $request['tariff_id'];#encoded + $h['amount'] = $request['amount'];#encoded + $h['test_mode'] = $request['test_mode'];#encoded + $h['uniqid'] = $request['uniqid'];#encoded + if ($request['hash2'] != $this->hash($h)){ + return false; + } + return true; + } + + function encode4java($data = '', $func = ''){ + $salt = 1010; + if (!isset($data) or trim($data) == '' or !$func){ + return'Error: missing arguments: $str and/or $func!'; + } + if ($func != 'decbin' and $func != 'bindec'){ + return'Error: $func has wrong value!'; + } + if ($func == 'decbin'){ + return decbin(intval($data) + intval($salt)); + }else{ + return bindec($data) - intval($salt); + } + } + + ### Realtime accesspoint for communication to the Novalnet paygate ### + function perform_https_request($nn_url, $urlparam) + { + $debug = 0;#set it to 1 if you want to activate the debug mode + + if($debug) print "
perform_https_request: $nn_url
\n\r\n"; + if($debug) print "perform_https_request: $urlparam
\n\r\n"; + + ## some prerquisites for the connection + $ch = curl_init($nn_url); + curl_setopt($ch, CURLOPT_POST, 1); // a non-zero parameter tells the library to do a regular HTTP post. + curl_setopt($ch, CURLOPT_POSTFIELDS, $urlparam); // add POST fields + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); // don't allow redirects + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // decomment it if you want to have effective ssl checking + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // decomment it if you want to have effective ssl checking + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable + curl_setopt($ch, CURLOPT_TIMEOUT, 240); // maximum time, in seconds, that you'll allow the CURL functions to take + + ## establish connection + $data = curl_exec($ch); + //$data = $this->ReplaceSpecialGermanChars($data); + + ## determine if there were some problems on cURL execution + $errno = curl_errno($ch); + $errmsg = curl_error($ch); + + ###bug fix for PHP 4.1.0/4.1.2 (curl_errno() returns high negative value in case of successful termination) + if($errno < 0) $errno = 0; + ##bug fix for PHP 4.1.0/4.1.2 + + if($debug) + { + print_r(curl_getinfo($ch)); + echo "\n

\n\n\nperform_https_request: cURL error number:" . $errno . "\n
\n\n"; + echo "\n\n\nperform_https_request: cURL error:" . $errmsg . "\n
\n\n"; + } + + #close connection + curl_close($ch); + + ## read and return data from novalnet paygate + if($debug) print "
\n\n" . $data . "\n
\n\n"; + + return array ($errno, $errmsg, $data); + } + +} +/* + Parameters passed on Novalnet: + vendor + product + key + tariff + auth_code + currency + amount + first_name + last_name + email + street + search_in_street + city + zip + country_code + lang + remote_ip + tel + fax + birth_date + session + return_url + return_method + error_return_url + test_mode + error_return_method + amount + user_variable_0 +*/ +/* +order of functions: +selection -> $order-info['total'] wrong, cause shipping_cost is net +pre_confirmation_check -> $order-info['total'] wrong, cause shipping_cost is net +confirmation -> $order-info['total'] right, cause shipping_cost is gross +process_button -> $order-info['total'] right, cause shipping_cost is gross +before_process -> $order-info['total'] wrong, cause shipping_cost is net +after_process -> $order-info['total'] right, cause shipping_cost is gross +*/ + +?> diff --git a/includes/modules/payment/novalnet_instantbanktransfer.php b/includes/modules/payment/novalnet_instantbanktransfer.php new file mode 100644 index 0000000..17025f0 --- /dev/null +++ b/includes/modules/payment/novalnet_instantbanktransfer.php @@ -0,0 +1,871 @@ +key = trim(MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_PASSWORD); #'z2Vw3E4j'; + $this->vendor_id = trim(MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_VENDOR_ID); + $this->auth_code = trim(MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_AUTH_CODE); + $this->product_id = trim(MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_PRODUCT_ID); + $this->tariff_id = trim(MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TARIFF_ID); + $this->test_mode = (strtolower(MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEST_MODE) == 'true' or MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEST_MODE == '1') ? 1 : 0; + $this->code = 'novalnet_instantbanktransfer'; + $this->form_action_url = 'https://payport.novalnet.de/online_transfer_payport'; + $this->title = MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEXT_TITLE; + $this->public_title = MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEXT_PUBLIC_TITLE; + $this->description = MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEXT_DESCRIPTION; + $this->sort_order = MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_SORT_ORDER; + $this->enabled = ((MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_STATUS == 'True') ? true : false); + $this->blnDebug = false; #todo: set to false for live system + $this->proxy = MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_PROXY; + $this->implementation = ''; + + if (MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_LOGO_STATUS == 'True') { + $this->public_title = 'Novalnet'.' '. MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEXT_PUBLIC_TITLE; + $this->title = 'Novalnet'.' '.MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEXT_TITLE; + } + $this->title = html_entity_decode($this->title, ENT_QUOTES, "UTF-8"); + $this->checkConfigure(); + + if ((int) MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_ORDER_STATUS_ID > 0) { + $this->order_status = MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_ORDER_STATUS_ID; + } + #check encoded data + if ($_REQUEST['hash2'] && $_SESSION['payment'] == $this->code) { + if (!$this->checkHash($_REQUEST)) { + $err = MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEXT_HASH_ERROR; + $payment_error_return = 'payment_error=' . $this->code . '&error=' . $_REQUEST['status_text']; + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } else { + $_REQUEST['auth_code'] = $this->decode($_REQUEST['auth_code']); + $_REQUEST['product_id'] = $this->decode($_REQUEST['product_id']); + $_REQUEST['tariff_id'] = $this->decode($_REQUEST['tariff_id']); + $_REQUEST['amount'] = $this->decode($_REQUEST['amount']); + $_REQUEST['test_mode'] = $this->decode($_REQUEST['test_mode']); + $_REQUEST['uniqid'] = $this->decode($_REQUEST['uniqid']); + } + } + if ((int) MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_ORDER_STATUS_ID > 0) { + $this->order_status = MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_ORDER_STATUS_ID; + } + if (is_object($order)) + $this->update_status(); + } + + function checkConfigure() { + if (IS_ADMIN_FLAG == true) { + $this->title = MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEXT_TITLE; // Payment module title in Admin + if (MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_LOGO_STATUS == 'True') { + $this->public_title = 'Novalnet'.' '. MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEXT_PUBLIC_TITLE; + $this->title = 'Novalnet'.' '.MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEXT_TITLE; + } + if ($this->enabled == 'true' && (!$this->vendor_id || !$this->auth_code || !$this->product_id || !$this->tariff_id || !$this->key )) { + $this->title .= '' . MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_NOT_CONFIGURED . ''; + } elseif ($this->test_mode == '1') { + $this->title .= '' . MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_IN_TEST_MODE . ''; + } + } + } + + ### calculate zone matches and flag settings to determine whether this module should display to customers or not ### + + function update_status() { + global $order, $db; + if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_ZONE > 0)) { + $check_flag = false; + $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id"); + while (!$check->EOF) { + if ($check->fields['zone_id'] < 1) { + $check_flag = true; + break; + } elseif ($check->fields['zone_id'] == $order->billing['zone_id']) { + $check_flag = true; + break; + } + $check->MoveNext(); + } + if ($check_flag == false) { + $this->enabled = false; + } + } + } + + ### JS validation which does error-checking of data-entry if this module is selected for use ### + ### the fields to be cheked are (Bank Owner, Bank Account Number and Bank Code Lengths) ### + ### currently this function is not in use ### + // @return string + + function javascript_validation() { + return false; + } + + ### Builds set of input fields for collecting Bankdetail info ### + // @return array + + function selection() { + global $xtPrice, $order, $HTTP_POST_VARS, $_POST; + $onFocus = ''; + if (count($HTTP_POST_VARS) == 0 || $HTTP_POST_VARS == '') + $HTTP_POST_VARS = $_POST; + $selection = array('id' => $this->code, + 'module' => $this->public_title, + 'fields' => array(array('title' => '', 'field' => MODULE_PAYMENT_NOVALNET_INFORMATION_PAYMENT_INSTANT), + array('title' => '', 'field' => MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_INFO) + )); + if (function_exists('get_percent')) { + $selection['module_cost'] = $GLOBALS['ot_payment']->get_percent($this->code); + } + return $selection; + } + + ### Precheck to Evaluate the Bank Datas ### + + function pre_confirmation_check() { + global $HTTP_POST_VARS, $_POST, $messageStack; + if (count($HTTP_POST_VARS) == 0 || $HTTP_POST_VARS == '') + $HTTP_POST_VARS = $_POST; + $error = ''; + if (!function_exists('curl_init') && ($this->code == 'novalnet_instantbanktransfer')) { + ini_set('display_errors', 1); + ini_set('error_reporting', E_ALL); + $error = MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_CURL_MESSAGE; + } + if (!$this->vendor_id || !$this->auth_code || !$this->product_id || !$this->tariff_id || !$this->key) { + $error = MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEXT_JS_NN_MISSING; + } + if ($error != '') { + $payment_error_return = 'payment_error=' . $this->code; + $messageStack->add_session('checkout_payment', $error . '', 'error'); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + } + + ### Display Bank Information on the Checkout Confirmation Page ### + // @return array + + function confirmation() { + global $HTTP_POST_VARS, $_POST, $order; + $_SESSION['nn_total'] = $order->info['total']; + if (count($HTTP_POST_VARS) == 0 || $HTTP_POST_VARS == '') + $HTTP_POST_VARS = $_POST; + $confirmation = array(); + return $confirmation; + } + + ### Build the data and actions to process when the "Submit" button is pressed on the order-confirmation screen. ### + ### These are hidden fields on the checkout confirmation page ### + // @return string + + function process_button() { + global $HTTP_POST_VARS, $_POST, $order, $currencies, $customer_id, $db; + if (count($HTTP_POST_VARS) == 0 || $HTTP_POST_VARS == '') + $HTTP_POST_VARS = $_POST; + #Get the required additional customer details from DB + $nn_customer_id = (isset($_SESSION['customer_id'])) ? $_SESSION['customer_id'] : ''; + $customer = $db->Execute("SELECT customers_gender, customers_dob, customers_fax FROM " . TABLE_CUSTOMERS . " WHERE customers_id='" . (int) $nn_customer_id . "'"); + if ($customer->RecordCount() > 0) { + $customer = $customer->fields; + } + list($customer['customers_dob'], $extra) = explode(' ', $customer['customers_dob']); + if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status_add_tax_ot'] == 1) { + $totalamount = $order->info['total'] + $order->info['tax']; + } else { + $totalamount = $order->info['total']; + } + $totalamount = number_format($totalamount * $currencies->get_value($order->info['currency']), 2); + $amount = str_replace(',', '', $totalamount); + $amount = intval(round($amount * 100)); + //$amount =sprintf('%.2f', $totalamount); + if (preg_match('/[^\d\.]/', $amount) or !$amount) { + ### $amount contains some unallowed chars or empty ### + $err = '$amount (' . $amount . ') is empty or has a wrong format'; + $order->info['comments'] .= 'Novalnet Error Message : ' . $err; + $payment_error_return = 'payment_error=' . $this->code; + $messageStack->add_session('checkout_payment', $err . '', 'error'); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + // $amount = preg_replace('/^0+/', '', $amount); + // $amount = sprintf('%0.2f', $amount); + // $amount = str_replace('.', '', $amount); + //$amount = $amount; + $vendor_id = $this->vendor_id; + $auth_code = $this->auth_code; + $product_id = $this->product_id; + $tariff_id = $this->tariff_id; + $customer_id = $_SESSION['customer_id']; + $uniqid = uniqid(); + $auth_code = $this->encode($auth_code); + $product_id = $this->encode($product_id); + $tariff_id = $this->encode($tariff_id); + $amount = $this->encode($amount); + $test_mode = $this->encode((strtolower(MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEST_MODE) == 'true' or MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEST_MODE == '1') ? 1 : 0); + $uniqid = $this->encode(uniqid()); + $hash = $this->hash(array('auth_code' => $auth_code, 'product_id' => $product_id, 'tariff' => $tariff_id, 'amount' => $amount, 'test_mode' => $test_mode, 'uniqid' => $uniqid)); + $user_ip = $this->getRealIpAddr(); + $checkout_url = zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'); + if (strstr($checkout_url, '?')) { + $checkout_url = str_replace(' ', '', $checkout_url); + if (substr($checkout_url, -1) == '?') + $error_url = $checkout_url . 'payment_error=' . $this->code . '&error=$ERROR_MESSAGE'; + else + $error_url = $checkout_url . '&payment_error=' . $this->code . '&error=$ERROR_MESSAGE'; + } + else + $error_url = $checkout_url . '?payment_error=' . $this->code . '&error=$ERROR_MESSAGE'; + $oldreturnurl = zen_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL'); + $old_value = explode(':', $oldreturnurl); + $new_protocol_value = (empty($_SERVER["HTTPS"])) ? 'http' : 'https'; + $return_url = $new_protocol_value . ':' . $old_value[1]; + $_SESSION['pymt_method'] = 'instantbanktransfer'; + $firstname = !empty($order->customer['firstname']) ? $order->customer['firstname'] : $order->billing['firstname']; + $lastname = !empty($order->customer['lastname']) ? $order->customer['lastname'] : $order->billing['lastname']; + $email_address = !empty($order->customer['email_address']) ? $order->customer['email_address'] : $order->billing['email_address']; + $street_address = !empty($order->customer['street_address']) ? $order->customer['street_address'] : $order->billing['street_address']; + $city = !empty($order->customer['city']) ? $order->customer['city'] : $order->billing['city']; + $postcode = !empty($order->customer['postcode']) ? $order->customer['postcode'] : $order->billing['postcode']; + $country_iso_code_2 = !empty($order->customer['country']['iso_code_2']) ? $order->customer['country']['iso_code_2'] : $order->billing['country']['iso_code_2']; + $customer_no = ($customer['customers_status'] != 1) ? $nn_customer_id : MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_GUEST_USER; + $process_button_string = + zen_draw_hidden_field('vendor', $vendor_id) . #Pflicht + zen_draw_hidden_field('auth_code', $auth_code) . + zen_draw_hidden_field('product', $product_id) . + zen_draw_hidden_field('tariff', $tariff_id) . + zen_draw_hidden_field('test_mode', $test_mode) . + zen_draw_hidden_field('uniqid', $uniqid) . + zen_draw_hidden_field('amount', $amount) . + zen_draw_hidden_field('hash', $hash) . + zen_draw_hidden_field('nnpayment', 'onlinetransfer') . + zen_draw_hidden_field('key', $this->payment_key) . #Pflicht + zen_draw_hidden_field('currency', $order->info['currency']) . + zen_draw_hidden_field('first_name', $firstname) . + zen_draw_hidden_field('last_name', $lastname) . + zen_draw_hidden_field('gender', 'u') . + zen_draw_hidden_field('email', $email_address) . + zen_draw_hidden_field('street', $street_address) . + zen_draw_hidden_field('search_in_street', '1') . + zen_draw_hidden_field('city', $order->customer['city']) . + zen_draw_hidden_field('zip', $postcode) . + zen_draw_hidden_field('country', $country_iso_code_2) . + zen_draw_hidden_field('country_code', $country_iso_code_2) . + zen_draw_hidden_field('lang', MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEXT_LANG) . #default: 'DE' + zen_draw_hidden_field('language', MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEXT_LANG) . #default: 'DE' + zen_draw_hidden_field('remote_ip', $user_ip) . #Pflicht + zen_draw_hidden_field('tel', $order->customer['telephone']) . + zen_draw_hidden_field('fax', $customer['customers_fax']) . + zen_draw_hidden_field('birth_date', $customer['customers_dob']) . + zen_draw_hidden_field('session', zen_session_id()) . + zen_draw_hidden_field('return_url', $return_url) . + zen_draw_hidden_field('return_method', 'POST') . + zen_draw_hidden_field('error_return_url', $error_url) . + //zen_draw_hidden_field('user_variable_0', str_replace(array($new_protocol_value.'://', 'www.'), array('', ''), $_SERVER['SERVER_NAME'])) . + zen_draw_hidden_field('error_return_method', 'POST') . + zen_draw_hidden_field('customer_no', $customer_no) . + zen_draw_hidden_field('use_utf8', '1') . + zen_draw_hidden_field('proxy', $this->proxy); + $process_button_string .= $this->getParams4InstantBankTransfer(); + return $process_button_string; + } + + ### Insert the Novalnet Transaction ID in DB ### + + function before_process() { + global $HTTP_POST_VARS, $_POST, $order, $currencies, $customer_id; + if (isset($_POST['status']) && $_POST['status'] == 100) { + if ($this->order_status) { + $order->info['order_status'] = $this->order_status; + } + if (count($HTTP_POST_VARS) == 0 || $HTTP_POST_VARS == '') + $HTTP_POST_VARS = $_POST; + if ($_REQUEST['test_mode'] == 1) { + $order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEST_ORDER_MESSAGE . '
'; + } + $order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TID_MESSAGE . $HTTP_POST_VARS['tid'] . '

'; + $_SESSION['nn_tid'] = $HTTP_POST_VARS['tid']; #todo: + $order->info['comments'] = str_replace(array('', '', '', '', '
', '
', '
'), array('', '', '', '', "\n", "\n", "\n"), $order->info['comments']); + } + } + + ### Send the order detail to Novalnet ### + + function after_process() { + global $order, $customer_id, $insert_id; + $product_id = MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_PRODUCT_ID; + $tariff_id = MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TARIFF_ID; + if ($_SESSION['nn_tid'] != '') { + ### Pass the Order Reference to paygate ## + $url = 'https://payport.novalnet.de/paygate.jsp'; + $urlparam = 'vendor=' . $this->vendor_id . '&product=' . $this->product_id . '&key=' . $this->payment_key . '&tariff=' . $this->tariff_id; + $urlparam .= '&auth_code=' . $this->auth_code . '&status=100&tid=' . $_SESSION['nn_tid'] . '&vwz2=' . MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEXT_ORDERNO . '' . $insert_id . '&vwz3=' . MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEXT_ORDERDATE . '' . date('Y-m-d H:i:s') . '&order_no=' . $insert_id; + list($errno, $errmsg, $data) = $this->perform_https_request($url, $urlparam); + } + unset($_SESSION['nn_tid']); + #print "$customer_id, $insert_id"; exit; + ### Implement here the Emailversand and further functions, incase if you want to send a own email ### + //$_SESSION['t_id']=$insert_id; + return false; + } + + ### Used to display error message details ### + // @return array + + function get_error() { + global $HTTP_GET_VARS, $_GET; + if (count($HTTP_GET_VARS) == 0 || $HTTP_GET_VARS == '') + $HTTP_GET_VARS = $_GET; + #print $HTTP_GET_VARS['error']; exit; + $error = array('title' => MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEXT_ERROR, 'error' => stripslashes(utf8_decode($HTTP_GET_VARS['error']))); + return $error; + } + + ### Check to see whether module is installed ### + // @return boolean + + function check() { + global $db; + if (!isset($this->_check)) { + $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_STATUS'"); + $this->_check = $check_query->RecordCount(); + } + return $this->_check; + } + + function install_lang($field_text, $lang) { + #Allowed Zones + $install_text['allowed_title'] = array('en' => "Allowed zones", + 'de' => "erlaubte Zonen"); + $install_text['allowed_desc'] = array('en' => "Please enter the desired zones separated by comma (Eg: AT, DE) or leave it blank", + 'de' => "Bitte die gewünschten Zonen durch Komma getrennt eingeben (z.B: AT,DE) oder einfach leer lassen"); + #Enable Module + $install_text['enable_title'] = array('en' => "Enable Module", + 'de' => "Modul aktivieren"); + $install_text['enable_desc'] = array('en' => "Do you want to activate the Credit Card of Novalnet AG?", + 'de' => "Wollen Sie das Kreditkarten Modul des Novalnet AG aktivieren?"); + #Test Mode + $install_text['test_title'] = array('en' => "Enable Test Mode:", + 'de' => "Testmodus einschalten"); + $install_text['test_desc'] = array('en' => "Do you want to activate test mode?", + 'de' => "Wollen Sie den Test-Modus aktivieren?"); + #Vendor id + $install_text['vendor_title'] = array('en' => "Novalnet Merchant ID", + 'de' => "Novalnet Händler ID"); + $install_text['vendor_desc'] = array('en' => "Enter your Novalnet Merchant ID ", + 'de' => "Geben Sie Ihre Novalnet Händler-ID ein "); + #Auth Code + $install_text['auth_title'] = array('en' => "Novalnet Merchant Authorisation Code", + 'de' => "Novalnet Authorisierungsschlüssel"); + $install_text['auth_desc'] = array('en' => "Enter your Novalnet Merchant Authorisation code ", + 'de' => "Geben Sie Ihren Novalnet-Authorisierungsschlüssel ein"); + + #Product id + $install_text['product_title'] = array('en' => "Novalnet Product ID", + 'de' => "Novalnet Produkt ID"); + $install_text['product_desc'] = array('en' => "Enter your Novalnet Product ID", + 'de' => "Geben Sie Ihre Novalnet Produkt-ID ein"); + + #Tariff id + $install_text['tariff_title'] = array('en' => "Novalnet Tariff ID", + 'de' => "Novalnet Tarif ID"); + $install_text['tariff_desc'] = array('en' => "Enter your Novalnet Tariff ID ", + 'de' => "Geben Sie Ihre Novalnet Tarif-ID ein"); + + #Enduser info + $install_text['enduser_title'] = array('en' => "Information to the end customer", + 'de' => "Informationen für den Endkunden"); + $install_text['enduser_desc'] = array('en' => "will appear in the payment form", + 'de' => "wird im Bezahlformular erscheinen"); + + #Sortorder display + $install_text['sortorder_title'] = array('en' => "Sort order of display", + 'de' => "Sortierung nach"); + $install_text['sortorder_desc'] = array('en' => "Sort order of display. Lowest is displayed first.", + 'de' => "Sortierung der Anzeige. Der niedrigste Wert wird zuerst angezeigt."); + + #Setorder status display + $install_text['setorderstatus_title'] = array('en' => "Set Order Status", + 'de' => "Bestellungsstatus setzen"); + $install_text['setorderstatus_desc'] = array('en' => "Set the status of orders made with this payment module to this value.", + 'de' => "Setzen Sie den Status von über dieses Zahlungsmodul durchgeführten Bestellungen auf diesen Wert."); + + #Proxy + $install_text['proxy_title'] = array('en' => "Proxy-Server", + 'de' => "Proxy-Server"); + $install_text['proxy_desc'] = array('en' => " If you use a Proxy Server, enter the Proxy Server IP with port here (e.g. www.proxy.de:80).", + 'de' => "Wenn Sie einen Proxy-Server einsetzen, tragen Sie hier Ihre Proxy-IP und den Port ein (z.B. www.proxy.de:80)."); + + #Payment Zone + $install_text['paymnetzone_title'] = array('en' => "Payment Zone", + 'de' => "Zahlungsgebiet"); + $install_text['paymnetzone_desc'] = array('en' => "If a zone is selected then this module is activated only for Selected zone. ", + 'de' => "Wird ein Bereich ausgewählt, dann wird dieses Modul nur für den ausgewählten Bereich aktiviert."); + + #Novalnet Password + $install_text['password_title'] = array('en' => "Novalnet Password", + 'de' => "Novalnet Passwort"); + $install_text['password_desc'] = array('en' => "Enter your Novalnet Password.", + 'de' => "Geben Sie Ihr Novalnet Passwort ein."); + + #Activate Logo Mode + $install_text['logo_title'] = array('en' => "Activate logo mode:", + 'de' => "Aktivieren Sie Logo Modus:"); + $install_text['logo_desc'] = array('en' => "Do you want to activate logo mode?", + 'de' => "Wollen Sie Logo-Modus zu aktivieren?"); + + return $install_text[$field_text][$lang]; + } + + ### Install the payment module and its configuration settings ### + + function install() { + global $db; + + $allowed_title = $this->install_lang('allowed_title', DEFAULT_LANGUAGE); + $allowed_desc = $this->install_lang('allowed_desc', DEFAULT_LANGUAGE); + + $enable_title = $this->install_lang('enable_title', DEFAULT_LANGUAGE); + $enable_desc = $this->install_lang('enable_desc', DEFAULT_LANGUAGE); + + $test_title = $this->install_lang('test_title', DEFAULT_LANGUAGE); + $test_desc = $this->install_lang('test_desc', DEFAULT_LANGUAGE); + + $vendor_title = $this->install_lang('vendor_title', DEFAULT_LANGUAGE); + $vendor_desc = $this->install_lang('vendor_desc', DEFAULT_LANGUAGE); + + $auth_title = $this->install_lang('auth_title', DEFAULT_LANGUAGE); + $auth_desc = $this->install_lang('auth_desc', DEFAULT_LANGUAGE); + + $product_title = $this->install_lang('product_title', DEFAULT_LANGUAGE); + $product_desc = $this->install_lang('product_desc', DEFAULT_LANGUAGE); + + $tariff_title = $this->install_lang('tariff_title', DEFAULT_LANGUAGE); + $tariff_desc = $this->install_lang('tariff_desc', DEFAULT_LANGUAGE); + + $enduser_title = $this->install_lang('enduser_title', DEFAULT_LANGUAGE); + $enduser_desc = $this->install_lang('enduser_desc', DEFAULT_LANGUAGE); + + $sortorder_title = $this->install_lang('sortorder_title', DEFAULT_LANGUAGE); + $sortorder_desc = $this->install_lang('sortorder_desc', DEFAULT_LANGUAGE); + + $setorderstatus_title = $this->install_lang('setorderstatus_title', DEFAULT_LANGUAGE); + $setorderstatus_desc = $this->install_lang('setorderstatus_desc', DEFAULT_LANGUAGE); + + $proxy_title = $this->install_lang('proxy_title', DEFAULT_LANGUAGE); + $proxy_desc = $this->install_lang('proxy_desc', DEFAULT_LANGUAGE); + + $paymnetzone_title = $this->install_lang('paymnetzone_title', DEFAULT_LANGUAGE); + $paymnetzone_desc = $this->install_lang('paymnetzone_desc', DEFAULT_LANGUAGE); + + $password_title = $this->install_lang('password_title', DEFAULT_LANGUAGE); + $password_desc = $this->install_lang('password_desc', DEFAULT_LANGUAGE); + + $logo_title = $this->install_lang('logo_title', DEFAULT_LANGUAGE); + $logo_desc = $this->install_lang('logo_desc', DEFAULT_LANGUAGE); + + /* $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$allowed_title."','MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_ALLOWED', '','".$allowed_desc."', '6', '0', now())"); */ + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('" . $enable_title . "', 'MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_STATUS', 'True', '" . $enable_desc . "', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('" . $test_title . "', 'MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEST_MODE', 'True', '" . $test_desc . "', '6', '1', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $vendor_title . "', 'MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_VENDOR_ID', '', '" . $vendor_desc . "', '6', '2', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $auth_title . "', 'MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_AUTH_CODE', '', '" . $auth_desc . "', '6', '3', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $product_title . "','MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_PRODUCT_ID', '', '" . $product_desc . "', '6', '4', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $tariff_title . "', 'MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TARIFF_ID', '', '" . $tariff_desc . "', '6', '5', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $password_title . "', 'MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_PASSWORD', '', '" . $password_desc . "', '6', '6', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $sortorder_title . "', 'MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_SORT_ORDER', '0', '" . $sortorder_desc . "', '6', '7', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $enduser_title . "', 'MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_INFO', '', '" . $enduser_desc . "', '6', '8', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('" . $setorderstatus_title . "', 'MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_ORDER_STATUS_ID', '0', '" . $setorderstatus_desc . "', '6', '9', 'zen_cfg_pull_down_order_statuses(', 'zen_get_order_status_name', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('" . $paymnetzone_title . "', 'MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_ZONE', '0', '" . $paymnetzone_desc . "', '6', '10', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $proxy_title . "', 'MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_PROXY', '', '" . $proxy_desc . "', '6', '11', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('" . $logo_title . "', 'MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_LOGO_STATUS', 'True', '" . $logo_desc . "', '6', '12', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + } + + ### Remove the module and all its settings ### + + function remove() { + global $db; + $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); + } + + ### Internal list of configuration keys used for configuration of the module ### + // @return array + + function keys() { + return array( 'MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_LOGO_STATUS','MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_STATUS', + 'MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEST_MODE', 'MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_VENDOR_ID', 'MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_AUTH_CODE', 'MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_PRODUCT_ID', 'MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TARIFF_ID', 'MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_INFO', 'MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_SORT_ORDER', 'MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_ORDER_STATUS_ID', + 'MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_ZONE', 'MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_PASSWORD', 'MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_PROXY'); + } + + function html_to_utf8($data) { + $data = utf8_encode($data); + return preg_replace("/\\&\\#([0-9]{3,10})\\;/e", '$this->_html_to_utf8("\\1")', $data); + } + + function _html_to_utf8($data) { + if ($data > 127) { + $i = 5; + while (($i--) > 0) { + if ($data != ($a = $data % ($p = pow(64, $i)))) { + $ret = chr(base_convert(str_pad(str_repeat(1, $i + 1), 8, "0"), 2, 10) + (($data - $a) / $p)); + for ($i; $i > 0; $i--) + $ret .= chr(128 + ((($data % pow(64, $i)) - ($data % ($p = pow(64, $i - 1)))) / $p)); + break; + } + } + } else { + #$this->debug2("&#$data;"); + $ret = "&#$data;"; + } + return $ret; + } + + function debug2($text) { + $fh = fopen('/tmp/debug2.txt', 'a+'); + if (gettype($text) == 'class' or gettype($text) == 'array') { + $text = serialize($text); + fwrite($fh, $text); + } else { + fwrite($fh, date('H:i:s ') . $text . "\n"); + } + fclose($fh); + } + + function getAmount($amount) { + if (!$amount) + $amount = $order->info['total']; + if (preg_match('/[,.]$/', $amount)) { + $amount = $amount . '00'; + } else if (preg_match('/[,.][0-9]$/', $amount)) { + $amount = $amount . '0'; + } + $amount = str_replace(array('.', ','), array('', ''), $amount); + return$amount; + } + + function isPublicIP($value) { + if (!$value || count(explode('.', $value)) != 4) + return false; + return !preg_match('~^((0|10|172\.16|192\.168|169\.254|255|127\.0)\.)~', $value); + } + + ### get the real Ip Adress of the User ### + + function getRealIpAddr() { + if ($this->isPublicIP($_SERVER['HTTP_X_FORWARDED_FOR'])) + return $_SERVER['HTTP_X_FORWARDED_FOR']; + if ($iplist = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR'])) { + if ($this->isPublicIP($iplist[0])) + return $iplist[0]; + } + if ($this->isPublicIP($_SERVER['HTTP_CLIENT_IP'])) + return $_SERVER['HTTP_CLIENT_IP']; + if ($this->isPublicIP($_SERVER['HTTP_X_CLUSTER_CLIENT_IP'])) + return $_SERVER['HTTP_X_CLUSTER_CLIENT_IP']; + if ($this->isPublicIP($_SERVER['HTTP_FORWARDED_FOR'])) + return $_SERVER['HTTP_FORWARDED_FOR']; + + return $_SERVER['REMOTE_ADDR']; + } + + ### replace the Special German Charectors ### + + function ReplaceSpecialGermanChars($string) { + $what = array("ä", "ö", "ü", "Ä", "Ö", "Ãœ", "ß"); + $how = array("ae", "oe", "ue", "Ae", "Oe", "Ue", "ss"); + + $string = str_replace($what, $how, $string); + + return $string; + } + + function getParams4InstantBankTransfer() { + if (count($HTTP_POST_VARS) == 0 || $HTTP_POST_VARS == '') + $HTTP_POST_VARS = $_POST; + /* for instant bank transfer via www.sofortueberweisung.de + required params: + project_id= must be registred at via www.sofortueberweisung.de + user_id = Kundennr. ($_SESSION['nn_tid']) + + optional params: + Parameter Bedeutung Typ (Länge) Erklärung + amount Betrag Double (8,2) Der zu überweisende Betrag (Minimum: 0.10 EURO, wichtig für Testbestellungen) Bitte keine Trennzeichen bei Tausender-Beträgen, z.B. 1010.50 Euro, correct: + + reason_1 Verwendungszweck1 String (27) Der Verwendungszweck in Zeile 1 (max. 27 Zeichen). Dieser sollte bei jeder Bestellung unterschiedliche Zuordnungsmerkmale aufweisen (z.B. Bestellnummer, Datum der Bestellung) und ist damit eindeutig. + + reason_2 + + sender_bank_code Bankleitzahl des Kunden String (30) Absender-Bankleitzahl + sender_account_number Kontonummer des Kunden String (30) Absender-Kontonummer + sender_holder Kontoinhaber des Kunden String (27) Absender-Kontoinhaber + sender_country_id Kontoinhaber Länderkürzel String (2) Absender-Land(zweistellig,z.B. DE, CH, AT) + hash Hash-Wert String (>=32) Input-Prüfung, siehe Kapitel 3.2.5 + currency_id Transaktionswährung String (3) Werte sind EUR, CHF und GBP* (* Voraussetzung: englischesKonto) + language_id Sprache des Zahlformulars String (2) Legen Sie mit diesem Parameter die Sprache des Zahlformulars fest, Werte, z.B. DE, EN + + user_variable_0 bis user_variable_5 Kundenvariable 0-5 String (255) Zu Ihrer freien Verwendung (z.B. Session-ID) + + #to deposit at www.sofortueberweisung.de: + Erfolgslink: http://zencart.gsoftpro.de/checkout_process.php + Abbruchlink: http://zencart.gsoftpro.de/.php + + ####Plausicheck error von XT: + http://localhost/zencart/checkout_payment.php?payment_error=novalnet_instantbanktransfer&error=*+Deutsche+Kontonummer+muss+mindestens+3+stellig+sein! + ####wrong bank code error von Novalnet: + http://localhost/zencart/checkout_payment.php?payment_error=novalnet_instantbanktransfer&error=Die+angegebene+Bankleitzahl+gibt+es+nicht+%28501007%29 + http://zencart.gsoftpro.de/checkout_payment.php?payment_error=novalnet_INSTANTBANKTRANSFER&error=zh + ####sucess + */ + //$params = + #zen_draw_hidden_field('amount', str_replace(',', '.', $_SESSION['nn_total'])).#todo:form check + #zen_draw_hidden_field('sender_bank_code', $HTTP_POST_VARS['bank_code']). + #zen_draw_hidden_field('sender_account_number', $HTTP_POST_VARS['bank_account']). + #zen_draw_hidden_field('sender_holder=', $this->html_to_utf8($HTTP_POST_VARS['bank_account_holder'])). + #zen_draw_hidden_field('sender_country_id', 'DE'). + #zen_draw_hidden_field('currency_id', 'EUR'). + #zen_draw_hidden_field('language_id', MODULE_PAYMENT_NOVALNET_INSTANTBANKTRANSFER_TEXT_LANG); + #zen_draw_hidden_field('customer_id', $_SESSION['nn_tid']). + //zen_draw_hidden_field('user_variable_0', (str_replace(array('http://', 'www.'), array('', ''), HTTP_SERVER))); + $params = zen_draw_hidden_field('user_variable_0', HTTP_SERVER); + return$params; + #this link is stored at www.soforueberweisung.de: https://payport.novalnet.de/online_transfer_payport?status=ok&customer_id=-CUSTOMER_ID-&transaction=-TRANSACTION-&sender_holder=-SENDER_HOLDER-&sender_holder_urlencode=-SENDER_HOLDER_URLENCODE-&sender_account_number=-SENDER_ACCOUNT_NUMBER-&sender_bank_code=-SENDER_BANK_CODE-&sender_bank_name=-SENDER_BANK_NAME-&sender_bank_name_urlencode=-SENDER_BANK_NAME_URLENCODE-&sender_bank_bic=-SENDER_BANK_BIC-&sender_iban=-SENDER_IBAN-&user_variable_0=-USER_VARIABLE_0- + } + + function encode($data) { + $data = trim($data); + if ($data == '') + return'Error: no data'; + if (!function_exists('base64_encode') or !function_exists('pack') or !function_exists('crc32')) { + return'Error: func n/a'; + } + + try { + $crc = sprintf('%u', crc32($data)); # %u is a must for ccrc32 returns a signed value + $data = $crc . "|" . $data; + $data = bin2hex($data . $this->key); + $data = strrev(base64_encode($data)); + } catch (Exception $e) { + echo('Error: ' . $e); + } + return $data; + } + + function decode($data) { + $data = trim($data); + if ($data == '') { + return'Error: no data'; + } + if (!function_exists('base64_decode') or !function_exists('pack') or !function_exists('crc32')) { + return'Error: func n/a'; + } + + try { + $data = base64_decode(strrev($data)); + $data = pack("H" . strlen($data), $data); + $data = substr($data, 0, stripos($data, $this->key)); + $pos = strpos($data, "|"); + if ($pos === false) { + return("Error: CKSum not found!"); + } + $crc = substr($data, 0, $pos); + $value = trim(substr($data, $pos + 1)); + if ($crc != sprintf('%u', crc32($value))) { + return("Error; CKSum invalid!"); + } + return $value; + } catch (Exception $e) { + echo('Error: ' . $e); + } + } + + function hash($h) {#$h contains encoded data + global $amount_zh; + if (!$h) + return'Error: no data'; + if (!function_exists('md5')) { + return'Error: func n/a'; + } + //echo '
rev pass : '; + //echo strrev($this->key); + //echo '
stright pass : '; + //echo $this->key; + //echo '
'; + return md5($h['auth_code'] . $h['product_id'] . $h['tariff'] . $h['amount'] . $h['test_mode'] . $h['uniqid'] . strrev($this->key)); + } + + function checkHash($request) { + //echo 'check hash called '; + if (!$request) + return false;#'Error: no data'; + $h['auth_code'] = $request['auth_code']; #encoded + $h['product_id'] = $request['product']; #encoded + $h['tariff'] = $request['tariff']; #encoded + $h['amount'] = $request['amount']; #encoded + $h['test_mode'] = $request['test_mode']; #encoded + $h['uniqid'] = $request['uniqid']; #encoded + if ($request['hash2'] != $this->hash($h)) { + return false; + } + return true; + } + + function checkHash4java($request) { + if (!$request) + return false;#'Error: no data'; + $h['auth_code'] = $request['auth_code']; #encoded + $h['product_id'] = $request['product_id']; #encoded + $h['tariff'] = $request['tariff_id']; #encoded + $h['amount'] = $request['amount']; #encoded + $h['test_mode'] = $request['test_mode']; #encoded + $h['uniqid'] = $request['uniqid']; #encoded + if ($request['hash2'] != $this->hash($h)) { + return false; + } + return true; + } + + function encode4java($data = '', $func = '') { + $salt = 1010; + if (!isset($data) or trim($data) == '' or !$func) { + return'Error: missing arguments: $str and/or $func!'; + } + if ($func != 'decbin' and $func != 'bindec') { + return'Error: $func has wrong value!'; + } + if ($func == 'decbin') { + return decbin(intval($data) + intval($salt)); + } else { + return bindec($data) - intval($salt); + } + } + + ### Realtime accesspoint for communication to the Novalnet paygate ### + + function perform_https_request($nn_url, $urlparam) { + $debug = 0; #set it to 1 if you want to activate the debug mode + + if ($debug) + print "
perform_https_request: $nn_url
\n\r\n"; + if ($debug) + print "perform_https_request: $urlparam
\n\r\n"; + + ## some prerquisites for the connection + $ch = curl_init($nn_url); + curl_setopt($ch, CURLOPT_POST, 1); // a non-zero parameter tells the library to do a regular HTTP post. + curl_setopt($ch, CURLOPT_POSTFIELDS, $urlparam); // add POST fields + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); // don't allow redirects + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // decomment it if you want to have effective ssl checking + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // decomment it if you want to have effective ssl checking + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable + curl_setopt($ch, CURLOPT_TIMEOUT, 240); // maximum time, in seconds, that you'll allow the CURL functions to take + ## establish connection + $data = curl_exec($ch); + //$data = $this->ReplaceSpecialGermanChars($data); + + ## determine if there were some problems on cURL execution + $errno = curl_errno($ch); + $errmsg = curl_error($ch); + + ###bug fix for PHP 4.1.0/4.1.2 (curl_errno() returns high negative value in case of successful termination) + if ($errno < 0) + $errno = 0; + ##bug fix for PHP 4.1.0/4.1.2 + + if ($debug) { + print_r(curl_getinfo($ch)); + echo "\n

\n\n\nperform_https_request: cURL error number:" . $errno . "\n
\n\n"; + echo "\n\n\nperform_https_request: cURL error:" . $errmsg . "\n
\n\n"; + } + + #close connection + curl_close($ch); + + ## read and return data from novalnet paygate + if ($debug) + print "
\n\n" . $data . "\n
\n\n"; + + return array($errno, $errmsg, $data); + } + +} + +/* + Parameters passed on Novalnet: + vendor + product + key + tariff + auth_code + currency + amount + first_name + last_name + email + street + search_in_street + city + zip + country_code + lang + remote_ip + tel + fax + birth_date + session + return_url + return_method + error_return_url + test_mode + error_return_method + amount + user_variable_0 + */ +/* + order of functions: + selection -> $order-info['total'] wrong, cause shipping_cost is net + pre_confirmation_check -> $order-info['total'] wrong, cause shipping_cost is net + confirmation -> $order-info['total'] right, cause shipping_cost is gross + process_button -> $order-info['total'] right, cause shipping_cost is gross + before_process -> $order-info['total'] wrong, cause shipping_cost is net + after_process -> $order-info['total'] right, cause shipping_cost is gross + */ +?> diff --git a/includes/modules/payment/novalnet_invoice.php b/includes/modules/payment/novalnet_invoice.php new file mode 100644 index 0000000..ae59341 --- /dev/null +++ b/includes/modules/payment/novalnet_invoice.php @@ -0,0 +1,1059 @@ +vendor_id = trim(MODULE_PAYMENT_NOVALNET_INVOICE_VENDOR_ID); + $this->auth_code = trim(MODULE_PAYMENT_NOVALNET_INVOICE_AUTH_CODE); + $this->product_id = trim(MODULE_PAYMENT_NOVALNET_INVOICE_PRODUCT_ID); + $this->tariff_id = trim(MODULE_PAYMENT_NOVALNET_INVOICE_TARIFF_ID); + $this->test_mode = (strtolower(MODULE_PAYMENT_NOVALNET_INVOICE_TEST_MODE) == 'true' or MODULE_PAYMENT_NOVALNET_INVOICE_TEST_MODE == '1') ? 1 : 0; + $this->code = 'novalnet_invoice'; + $this->title = MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_TITLE; + $this->public_title = MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_PUBLIC_TITLE; + $this->description = MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_DESCRIPTION; + $this->sort_order = MODULE_PAYMENT_NOVALNET_INVOICE_SORT_ORDER; + $this->enabled = ((MODULE_PAYMENT_NOVALNET_INVOICE_STATUS == 'True') ? true : false); + $this->proxy = MODULE_PAYMENT_NOVALNET_INVOICE_PROXY; + + if (MODULE_PAYMENT_NOVALNET_INVOICE_LOGO_STATUS == 'True') { + $this->public_title = 'Novalnet'.' '. MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_PUBLIC_TITLE; + $this->title = 'Novalnet'.' '. MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_TITLE; + } + $this->checkConfigure(); + + if ((int) MODULE_PAYMENT_NOVALNET_INVOICE_ORDER_STATUS_ID > 0) { + $this->order_status = MODULE_PAYMENT_NOVALNET_INVOICE_ORDER_STATUS_ID; + } + if (is_object($order)) + $this->update_status(); + // Check the tid in session and make the second call + if ($_SESSION['nn_tid_invoice']) { + if ((empty($_SESSION['invalid_count_invoice'])) || ( isset($_SESSION['max_time_invoice']) && (time() >= $_SESSION['max_time_invoice']))) { + $_SESSION['invalid_count_invoice'] = 0; + } + if (!empty($_SESSION['invalid_count_invoice']) && $_SESSION['invalid_count_invoice'] == 3) { + + if ($_SESSION['max_time_invoice'] && (time() < $_SESSION['max_time_invoice'])) { + $payment_error_return = 'payment_error=' . $this->code . '&error=' . utf8_encode(MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_SESSION_ERROR); + } + } + //Check the time limit + if ($_SESSION['max_time_invoice'] && time() > $_SESSION['max_time_invoice']) { + unset($_SESSION['nn_tid_invoice']); + unset($_SESSION['invalid_count_invoice']); + $payment_error_return = 'payment_error=' . $this->code; + $messageStack->add_session('checkout_payment', MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_SESSION_ERROR . '', 'error'); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + if ($_GET['new_novalnet_pin_invoice'] == 'true') { + $_SESSION['new_novalnet_pin_invoice'] = true; + $this->secondcall(); + } + } + // define callback types + $this->isActivatedCallback = false; + if (MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_SMS != 'False') { + $this->isActivatedCallback = true; + } + } + + function checkConfigure() { + if (IS_ADMIN_FLAG == true) { + $this->title = MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_TITLE; // Payment module title in Admin + if (MODULE_PAYMENT_NOVALNET_INVOICE_LOGO_STATUS == 'True') { + $this->public_title = 'Novalnet'.' '. MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_PUBLIC_TITLE; + $this->title = 'Novalnet'.' '. MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_TITLE; + } + if ($this->enabled == 'true' && (!$this->vendor_id || !$this->auth_code || !$this->product_id || !$this->tariff_id )) { + $this->title .= '' . MODULE_PAYMENT_NOVALNET_INVOICE_NOT_CONFIGURED . ''; + } elseif ($this->test_mode == '1') { + $this->title .= '' . MODULE_PAYMENT_NOVALNET_INVOICE_INVOICE_TEST_MODE . ''; + } + } + } + + ### calculate zone matches and flag settings to determine whether this module should display to customers or not ### + + function update_status() { + global $order, $db; + if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_INVOICE_ZONE > 0)) { + $check_flag = false; + $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_NOVALNET_INVOICE_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id"); + while (!$check->EOF) { + if ($check->fields['zone_id'] < 1) { + $check_flag = true; + break; + } elseif ($check->fields['zone_id'] == $order->billing['zone_id']) { + $check_flag = true; + break; + } + $check->MoveNext(); + } + if ($check_flag == false) { + $this->enabled = false; + } + } + } + + ### JS validation which does error-checking of data-entry if this module is selected for use ### + ### the fields to be cheked are (Bank Owner, Bank Account Number and Bank Code Lengths) ### + ### currently this function is not in use ### + // @return string + + function javascript_validation() { + return false; + } + + ### Builds set of input fields for collecting Bankdetail info ### + // @return array + + function selection() { + global $order, $HTTP_POST_VARS, $_POST; + $onFocus = ''; + $billing_iso_code = strtolower($order->customer['country']['iso_code_2']); + if (count($HTTP_POST_VARS) == 0 || $HTTP_POST_VARS == '') + $HTTP_POST_VARS = $_POST; + if (!$_SESSION['nn_tid_invoice']) { + $selection = array('id' => $this->code, + 'module' => $this->public_title, + 'fields' => array(array('title' => '', 'field' => MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_BANK_INFO), + array('title' => '', 'field' => MODULE_PAYMENT_NOVALNET_INVOICE_INFO) + )); + #} + // Display callback fields + $amount_check = $this->findTotalAmount(); + if ($this->isActivatedCallback && in_array($billing_iso_code, $this->nninv_allowed_pin_country_list) && $amount_check >= MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_MIN_LIMIT) { + if (MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_SMS == 'Email Reply') { + $_SESSION['user_email_invoice'] = ($_SESSION['user_email_invoice'] == '') ? $order->customer['email_address'] : $_SESSION['user_email_invoice']; + $selection['fields'][] = array('title' => MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_EMAIL_REQ, 'field' => zen_draw_input_field('user_email_invoice', $_SESSION['user_email_invoice'], 'id="' . $this->code . '-callback" AUTOCOMPLETE="OFF"' . $onFocus)); + } else { + $_SESSION['user_tel_invoice'] = ($_SESSION['user_tel_invoice'] == '') ? $order->customer['telephone'] : $_SESSION['user_tel_invoice']; + + $label_str = (MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_SMS == 'Callback (Telefon & Handy)') ? MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_TEL_REQ : MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_SMS_REQ; + + $selection['fields'][] = array('title' => $label_str, 'field' => zen_draw_input_field('user_tel_invoice', $_SESSION['user_tel_invoice'], 'id="' . $this->code . '-callback" AUTOCOMPLETE="OFF"' . $onFocus)); + } + } + } + + $amount_check = $this->findTotalAmount(); + $_SESSION['nn_amount_invoice'] = $amount_check; + if ($this->isActivatedCallback && in_array($billing_iso_code, $this->nninv_allowed_pin_country_list) && $amount_check >= MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_MIN_LIMIT && isset($_SESSION['nn_tid_invoice']) && ($_SESSION['invalid_count_invoice'] < 3)) { + $selection = array('id' => $this->code, 'module' => $this->public_title); + if (MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_SMS == 'Email Reply') { + $selection['fields'][] = array('title' => MODULE_PAYMENT_NOVALNET_INVOICE_EMAIL_INPUT_REQUEST_DESC); + } else { + $selection = array('id' => $this->code, + 'module' => $this->public_title); + // Show PIN field, after first call + $selection['fields'][] = array('title' => MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_SMS_PIN, 'field' => zen_draw_input_field('novalnet_pin_invoice', '', 'id="' . $this->code . '-callback" AUTOCOMPLETE="OFF"' . $onFocus)); + $selection['fields'][] = array('title' => '' . MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_SMS_NEW_PIN . ''); + } + } + + + if (function_exists('get_percent')) { + $selection['module_cost'] = $GLOBALS['ot_payment']->get_percent($this->code); + } + + return $selection; + } + + ### Precheck to Evaluate the Bank Datas ### + + function pre_confirmation_check() { + global $HTTP_POST_VARS, $_POST, $order, $messageStack; + $billing_iso_code = strtolower($order->customer['country']['iso_code_2']); + if (count($HTTP_POST_VARS) == 0 || $HTTP_POST_VARS == '') + $HTTP_POST_VARS = $_POST; + if (isset($HTTP_POST_VARS['user_tel_invoice'])) + $HTTP_POST_VARS['user_tel_invoice'] = trim($HTTP_POST_VARS['user_tel_invoice']); + if (isset($HTTP_POST_VARS['user_email_invoice'])) + $HTTP_POST_VARS['user_email_invoice'] = trim($HTTP_POST_VARS['user_email_invoice']); + if (isset($HTTP_POST_VARS['novalnet_pin_invoice'])) + $HTTP_POST_VARS['novalnet_pin_invoice'] = trim($HTTP_POST_VARS['novalnet_pin_invoice']); + // Callback stuff.... + if ($_SESSION['nn_tid_invoice']) { + //check the amount is equal with the first call or not + $amount = $this->findTotalAmount(); + if ($_SESSION['invoice_order_amount'] != $amount) { + if (MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_SMS == 'Email Reply') { + $error_message = MODULE_PAYMENT_NOVALNET_INVOICE_AMOUNT_VARIATION_MESSAGE_EMAIL; + } elseif (MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_SMS == 'Callback (Telefon & Handy)' || MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_SMS == 'SMS (nur Handy)') { + $error_message = MODULE_PAYMENT_NOVALNET_INVOICE_AMOUNT_VARIATION_MESSAGE; + } + unset($_SESSION['nn_tid_invoice']); + unset($_SESSION['invoice_order_amount']); + if (isset($_SESSION['invalid_count_invoice'])) { + unset($_SESSION['invalid_count_invoice']); + } + $payment_error_return = 'payment_error=' . $this->code; + $messageStack->add_session('checkout_payment', $error_message . '', 'error'); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + if (isset($HTTP_POST_VARS['novalnet_pin_invoice']) && isset($_SESSION['nn_tid_invoice'])) { + // check pin + //if( !is_numeric( $HTTP_POST_VARS['novalnet_pin_invoice'] ) || strlen( $HTTP_POST_VARS['novalnet_pin_invoice'] ) != 4 ) + if ($HTTP_POST_VARS['novalnet_pin_invoice'] == '' || (preg_match('/[&_#%\^<>@$=*!]/', $HTTP_POST_VARS['novalnet_pin_invoice']))) { + $payment_error_return = 'payment_error=' . $this->code; + $messageStack->add_session('checkout_payment', MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_SMS_PIN_NOTVALID . '', 'error'); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } else { + if ($HTTP_POST_VARS['novalnet_pin_invoice']) + $_SESSION['novalnet_pin_invoice'] = $HTTP_POST_VARS['novalnet_pin_invoice']; + } + } + return; + }else { + $error = ''; + if (!function_exists('curl_init') && ($this->_code == 'novalnet_invoice')) { + ini_set('display_errors', 1); + ini_set('error_reporting', E_ALL); + $error = MODULE_PAYMENT_NOVALNET_INVOICE_CURL_MESSAGE; + } + if (!isset($_SESSION['nn_tid_invoice'])) { + if (!$this->vendor_id || !$this->auth_code || !$this->product_id || !$this->tariff_id) { + $error = MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_JS_NN_MISSING; + } + if (isset($HTTP_POST_VARS['user_email_invoice'])) { + $_SESSION['user_email_invoice'] = $HTTP_POST_VARS['user_email_invoice']; + } + if (isset($HTTP_POST_VARS['user_tel_invoice'])) { + $_SESSION['user_tel_invoice'] = $HTTP_POST_VARS['user_tel_invoice']; + } + // Callback stuff.... + //$amount_check = $_SESSION['nn_amount_invoice']; + $amount_check = $this->findTotalAmount(); + if ($this->isActivatedCallback && in_array($billing_iso_code, $this->nninv_allowed_pin_country_list) && $amount_check >= MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_MIN_LIMIT) { + //checking email address + if (isset($HTTP_POST_VARS['user_email_invoice'])) { + if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $HTTP_POST_VARS['user_email_invoice'])) { + $error .= MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_EMAIL_NOTVALID; + } + } + //checking telephone number + if (isset($HTTP_POST_VARS['user_tel_invoice'])) { + if (strlen($HTTP_POST_VARS['user_tel_invoice']) < 8 || !is_numeric($HTTP_POST_VARS['user_tel_invoice'])) { + $error .= MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_SMS_TEL_NOTVALID; + } + } + if ($error != '') { + /* $payment_error_return = 'payment_error=' . $this->code . '&error=' .utf8_encode($error); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); */ + $payment_error_return = 'payment_error=' . $this->code; + $messageStack->add_session('checkout_payment', utf8_encode($error) . '', 'error'); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } else { + $_SESSION['user_tel_invoice'] = $HTTP_POST_VARS['user_tel_invoice']; + if (isset($HTTP_POST_VARS['user_email_invoice'])) { + $error_msg = MODULE_PAYMENT_NOVALNET_INVOICE_EMAIL_INPUT_REQUEST_DESC; + } else { + $error_msg = MODULE_PAYMENT_NOVALNET_INVOICE_PIN_INPUT_REQUEST_DESC; + } + // firstcall() + $this->before_process(); + $payment_error_return = 'payment_error=' . $this->code; + $messageStack->add_session('checkout_payment', $error_msg . '', 'error'); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + //$messageStack->add_session('checkout_payment', MODULE_PAYMENT_NOVALNET_INVOICE_PIN_INPUT_REQUEST_DESC . '', 'error'); + //zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL', true, false)); + + return; + } + } + if ($error != '') { + $payment_error_return = 'payment_error=' . $this->code; + $messageStack->add_session('checkout_payment', $error . '', 'error'); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + } + } + } + + ### Display Bank Information on the Checkout Confirmation Page ### + // @return array + + function confirmation() { + global $order; + $_SESSION['nn_total'] = $order->info['total']; + $confirmation = array('fields' => array(array('field' => ''))); + return $confirmation; + } + + ### Build the data and actions to process when the "Submit" button is pressed on the order-confirmation screen. ### + ### These are hidden fields on the checkout confirmation page ### + // @return string + + function process_button() { + global $HTTP_POST_VARS, $_POST; + if (count($HTTP_POST_VARS) == 0 || $HTTP_POST_VARS == '') + $HTTP_POST_VARS = $_POST; + return $process_button_string; + } + + public function secondCall() { + global $messageStack; + $xmlresponse_erros = ''; + // If customer forgets PIN, send a new PIN + if ($_SESSION['new_novalnet_pin_invoice']) + $request_type = 'TRANSMIT_PIN_AGAIN'; + else + $request_type = 'PIN_STATUS'; + if ($_SESSION['email_reply_check_invoice'] == 'Email Reply') + $request_type = 'REPLY_EMAIL_STATUS'; + if ($_SESSION['new_novalnet_pin_invoice']) + $_SESSION['new_novalnet_pin_invoice'] = false; + $xml = ''; + $xml = ' + + + ' . $this->vendor_id . ' + ' . $this->auth_code . ' + ' . $request_type . ' + ' . $_SESSION['nn_tid_invoice'] . ''; + if ($request_type != 'REPLY_EMAIL_STATUS') + $xml .= '' . $_SESSION['novalnet_pin_invoice'] . '';$xml .= ' + + '; + $xml_response = $this->curl_xml_post($xml); + // Parse XML Response to object + $xml_response = simplexml_load_string($xml_response); + #$_SESSION['status'] = $xml_response->status; + if ($xml_response->status != '') { + $xmlresponse_erros = $xml_response->status; + } + if ($xmlresponse_erros == '') { + $errormesage = $xml_response->pin_status->status_message; + $payment_error_return = 'payment_error=' . $this->code . '&error=' . utf8_encode($errormesage); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } else { + if ($xml_response->status != 100) { + if ($xml_response->status == '0529005') { + $_SESSION['invalid_count_invoice'] = $_SESSION['invalid_count_invoice'] + 1; + if ($_SESSION['invalid_count_invoice'] == 3) { + $payment_error_return = 'payment_error=' . $this->code . '&error=' . utf8_encode(MODULE_PAYMENT_NOVALNET_INVOICE_MAX_TIME_ERROR); + // $payment_error_return = 'payment_error='.$this->code; + } else { + $payment_error_return = 'payment_error=' . $this->code . '&error=' . utf8_encode($xml_response->status_message); + } + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } else { + $payment_error_return = 'payment_error=' . $this->code . '&error=' . utf8_encode($xml_response->status_message); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + } else { + $array = (array) $xml_response; + // add tid, because it's missing in the answer + $array['tid'] = $_SESSION['nn_tid_invoice']; + $array['statusdesc'] = $array['status_message']; // Param-name is changed + $array['test_mode'] = $_SESSION['test_mode_invoice']; + return $array; + } + } + } + + public function curl_xml_post($request) { + $ch = curl_init("https://payport.novalnet.de/nn_infoport.xml"); + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: close')); + curl_setopt($ch, CURLOPT_POST, 1); // a non-zero parameter tells the library to do a regular HTTP post. + curl_setopt($ch, CURLOPT_POSTFIELDS, $request); // add POST fields + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); // don't allow redirects + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // decomment it if you want to have effective ssl checking + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // decomment it if you want to have effective ssl checking + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable + curl_setopt($ch, CURLOPT_TIMEOUT, 240); // maximum time, in seconds, that you'll allow the CURL functions to take + ## establish connection + $xml_response = curl_exec($ch); + ## determine if there were some problems on cURL execution + $errno = curl_errno($ch); + $errmsg = curl_error($ch); + ###bug fix for PHP 4.1.0/4.1.2 (curl_errno() returns high negative value in case of successful termination) + if ($errno < 0) + $errno = 0; + ##bug fix for PHP 4.1.0/4.1.2 + if ($debug) { + print_r(curl_getinfo($ch)); + echo "\n

\n\n\nperform_https_request: cURL error number:" . $errno . "\n
\n\n"; + echo "\n\n\nperform_https_request: cURL error:" . $errmsg . "\n
\n\n"; + } + #close connection + curl_close($ch); + return $xml_response; + } + + //This is user defined function used for getting order amount in cents with tax + public function findTotalAmount() { + global $order, $currencies; + if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) { + $total = $order->info['total'] + $order->info['tax']; + } else { + $total = $order->info['total']; + } + $totalamount = number_format($total * $currencies->get_value($order->info['currency']), 2); + $amount = str_replace(',', '', $totalamount); + $amount = intval(round($amount * 100)); + if (preg_match('/[^\d\.]/', $total) or !$total) { + ### $amount contains some unallowed chars or empty ### + $err = 'amount (' . $total . ') is empty or has a wrong format'; + $payment_error_return = 'payment_error=' . $this->code; + $messageStack->add_session('checkout_payment', $err . '', 'error'); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + // $amount = sprintf('%0.2f', $total); + // $amount = preg_replace('/^0+/', '', $amount); + // $amount = str_replace('.', '', $amount); + return $amount; + } + + ### Store the BANK info to the order ### + ### This sends the data to the payment gateway for processing and Evaluates the Bankdatas for acceptance and the validity of the Bank Details ### + + function before_process() { + global $HTTP_POST_VARS, $_POST, $order, $currencies, $customer_id, $db, $messageStack; + $billing_iso_code = strtolower($order->customer['country']['iso_code_2']); + $_SESSION['nn_amount_invoice'] = $this->findTotalAmount(); + if (count($HTTP_POST_VARS) == 0 || $HTTP_POST_VARS == '') + $HTTP_POST_VARS = $_POST; + // First call is done, so check PIN / second call... + if ($_SESSION['nn_tid_invoice'] && $this->isActivatedCallback) { + if (MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_SMS == 'Email Reply') + $_SESSION['email_reply_check_invoice'] = 'Email Reply'; + else + unset($_SESSION['email_reply_check_invoice']); + $_SESSION['new_novalnet_pin_invoice'] = false; + if ($aryResponse = $this->secondCall()) { + if ($this->order_status) + $order->info['order_status'] = $this->order_status; + //$old_comments = $order->info['comments']; + //$order->info['comments'] = ""; + $transferinvoice_info = utf8_encode(MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_TRANSFER_INFO); + $days_limit = utf8_encode(MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_DURATION_LIMIT_END_INFO); + $inrenationalinvoice_info = utf8_encode(MODULE_PAYMENT_NOVALNET_TEXT_DETAILS_INVOICE_INTERNATIONAL_INFO); + //Test mode based on the responsone test mode value + if ($_SESSION['test_mode_invoice'] == 1 || $test_mode) { + $order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_INVOICE_TEST_ORDER_MESSAGE . '
'; + unset($_SESSION['test_mode_invoice']); + } + //$order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_INVOICE_PAYMNETNAME . ''; + if (MODULE_PAYMENT_NOVALNET_INVOICE_LOGO_STATUS == 'True') { + $order->info['comments'] .= '
' . 'Novalnet'.' '. MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_TITLE; + } + else{ + $order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_TITLE; + } + $order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_INVOICE_TID . ' ' . $_SESSION['nn_tid_invoice'] . '
'; + if ($_SESSION['due_date_invoice']) { + $order->info['comments'] .= '
' . $transferinvoice_info . ' ' . ''; + $order->info['comments'] .= '
' . $days_limit . ' ' . $_SESSION['due_date_invoice'] . ''; + } else { + $order->info['comments'] .= '
' . $transferinvoice_info . ''; + } + //$amount = $currencies->format($amount/100); + // $ss_amount = str_replace('.', ',', sprintf("%.2f", $_SESSION['original_amount_invoice'])); + $order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_BANK_ACCOUNT_OWNER . ' ' . MODULE_PAYMENT_NOVALNET_INVOICE_NAME . ''; + $order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_BANK_ACCOUNT_NUMBER . ' ' . $_SESSION['nn_invoice_account'] . ''; + $order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_BANK_CODE . ' ' . $_SESSION['nn_invoice_bankcode'] . ''; + $order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_BANK_BANK . ' ' . $_SESSION['nn_invoice_bankname'] . ' ' . $_SESSION['nn_invoice_bankplace'] . ''; + //$order->info['comments'] .= ''.MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_AMOUNT.' '.$ss_amount.' '.$order->info['currency'].''; + $order->info['comments'] .= '' . MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_AMOUNT . ' ' . $currencies->format($_SESSION['original_amount_invoice']) . ''; + $order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_REFERENCE . ' ' . $_SESSION['nn_tid_invoice'] . '
'; + $order->info['comments'] .= '
' . $inrenationalinvoice_info . ''; + $order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_BANK_IBAN . ' ' . $_SESSION['nn_invoice_iban'] . ''; + $order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_BANK_BIC . ' ' . $_SESSION['nn_invoice_bic'] . ''; + $order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_REFERENCE_INFO . '
'; + //$order->info['comments'] .= $old_comments; + $order->info['comments'] = str_replace(array('', '', '
', '', '
', '
', '
', '
'), array('', '', '', '', "\n", "\n", "\n", "\n"), $order->info['comments']); + return; + } + } + #Get the required additional customer details from DB + $nn_customer_id = (isset($_SESSION['customer_id'])) ? $_SESSION['customer_id'] : ''; + $customer = $db->Execute("SELECT customers_gender, customers_dob, customers_fax FROM " . TABLE_CUSTOMERS . " WHERE customers_id='" . (int) $nn_customer_id . "'"); + if ($customer->RecordCount() > 0) { + $customer = $customer->fields; + } + list($customer['customers_dob'], $extra) = explode(' ', $customer['customers_dob']); + ### Process the payment to paygate ## + $url = 'https://payport.novalnet.de/paygate.jsp'; + //$amount = $this->findTotalAmount(); + $amount = $_SESSION['nn_amount_invoice']; + $vendor_id = $this->vendor_id; + $auth_code = $this->auth_code; + $product_id = $this->product_id; + $tariff_id = $this->tariff_id; + $payment_duration = MODULE_PAYMENT_NOVALNET_INVOICE_DURATION; + $payment_duration = trim($payment_duration); + $payment_duration = str_replace(' ', '', $payment_duration); + if (!eregi("^[0-9]*$", $payment_duration)) { + $payment_duration = ''; + } + $due_date = ''; + $due_date_string = ''; + if ($payment_duration) { + $due_date = date("d.m.Y", mktime(0, 0, 0, date("m"), date("d") + $payment_duration, date("Y"))); + $due_date_string = '&due_date=' . date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") + $payment_duration, date("Y"))); + } + $user_ip = $this->getRealIpAddr(); + //set the user telephone + $tel_param = '&tel='; + if ($_SESSION['user_tel_invoice']) + $user_telephone = $_SESSION['user_tel_invoice']; + else + $user_telephone = $order->customer['telephone']; + //set the user email + if ($_SESSION['user_email_invoice']) + $user_email = $_SESSION['user_email_invoice']; + else + $user_email = $order->customer['email_address']; + //set the user telephone + if ($_SESSION['user_tel_invoice']) { + $user_telephone = $_SESSION['user_tel_invoice']; + } else { + $user_telephone = '&tel=' . $order->customer['telephone']; + } + // set post params + if ($this->isActivatedCallback && in_array($billing_iso_code, $this->nninv_allowed_pin_country_list) && $amount >= MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_MIN_LIMIT) { + if (MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_SMS == 'Callback (Telefon & Handy)') { + $this->callback_type = '&pin_by_callback=1'; + $user_telephone = '&tel=' . $user_telephone; + } + if (MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_SMS == 'SMS (nur Handy)') { + $this->callback_type = '&pin_by_sms=1'; + $user_telephone = '&mobile=' . $user_telephone; + } + if (MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_SMS == 'Email Reply') { + $this->callback_type = '&reply_email_check=1'; + } + } + $firstname = !empty($order->customer['firstname']) ? $order->customer['firstname'] : $order->billing['firstname']; + $lastname = !empty($order->customer['lastname']) ? $order->customer['lastname'] : $order->billing['lastname']; + $email_address = !empty($order->customer['email_address']) ? $order->customer['email_address'] : $order->billing['email_address']; + $street_address = !empty($order->customer['street_address']) ? $order->customer['street_address'] : $order->billing['street_address']; + $city = !empty($order->customer['city']) ? $order->customer['city'] : $order->billing['city']; + $postcode = !empty($order->customer['postcode']) ? $order->customer['postcode'] : $order->billing['postcode']; + $country_iso_code_2 = !empty($order->customer['country']['iso_code_2']) ? $order->customer['country']['iso_code_2'] : $order->billing['country']['iso_code_2']; + $customer_no = ($customer['customers_status'] != 1) ? $nn_customer_id : MODULE_PAYMENT_NOVALNET_INVOICE_GUEST_USER; + + $urlparam = 'vendor=' . $vendor_id . '&product=' . $product_id . '&key=' . $this->payment_key . '&tariff=' . $tariff_id; + $urlparam .= '&auth_code=' . $auth_code . '¤cy=' . $order->info['currency']; + $testmode = (strtolower(MODULE_PAYMENT_NOVALNET_INVOICE_TEST_MODE) == 'true' or MODULE_PAYMENT_NOVALNET_INVOICE_TEST_MODE == '1') ? 1 : 0; + $urlparam .='&test_mode=' . $testmode; + $urlparam .= '&invoice_type=INVOICE' . $due_date_string; + $urlparam .= '&first_name=' . $firstname . '&last_name=' . $lastname; + $urlparam .= '&street=' . $street_address . '&city=' . $city . '&zip=' . $postcode; + $urlparam .= '&country=' . $country_iso_code_2 . '&email=' . $email_address; + $urlparam .= '&search_in_street=1' . '&tel=' . $user_telephone . '&remote_ip=' . $user_ip; + $urlparam .= '&gender=' . $customer['customers_gender'] . '&birth_date=' . $customer['customers_dob'] . '&fax=' . $customer['customers_fax']; + $urlparam .= '&language=' . MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_LANG; + $urlparam .= '&lang=' . MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_LANG; + $urlparam .= '&customer_no=' . $customer_no; + $urlparam .= '&use_utf8=1'; + $urlparam .= '&amount=' . $amount; + // For PIN by call back + $urlparam .= $this->callback_type; + list($errno, $errmsg, $data) = $this->perform_https_request($url, $urlparam); + $aryResponse = array(); + #capture the result and message and other parameters from response data '$data' in an array + $aryPaygateResponse = explode('&', $data); + foreach ($aryPaygateResponse as $key => $value) { + if ($value != "") { + $aryKeyVal = explode("=", $value); + $aryResponse[$aryKeyVal[0]] = $aryKeyVal[1]; + } + } + #Get the type of the comments field on TABLE_ORDERS + $customer = $db->Execute("SHOW FIELDS FROM " . TABLE_ORDERS_STATUS_HISTORY . " WHERE FIELD='comments'"); + if ($customer->RecordCount() > 0) { + $customer = $customer->fields; + } + if (strtolower($customer['Type']) != 'text') { + ### ALTER TABLE ORDERS modify the column comments ### + $db->Execute("ALTER TABLE " . TABLE_ORDERS_STATUS_HISTORY . " MODIFY comments text"); + } + + if ($aryResponse['status'] == 100) { + ### Passing through the Transaction ID from Novalnet's paygate into order-info ### + if ($this->isActivatedCallback && in_array($billing_iso_code, $this->nninv_allowed_pin_country_list) && $amount >= MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_MIN_LIMIT) { + $_SESSION['invoice_order_amount'] = $amount; + $_SESSION['nn_tid_invoice'] = $aryResponse['tid']; + // To avoide payment method confussion add code in session + //set session for maximum time limit to 30 minutes + $_SESSION['max_time_invoice'] = time() + (30 * 60); + //TEST BILLING MESSAGE BASED ON THE RESPONSE TEST MODE + $_SESSION['test_mode_invoice'] = $aryResponse['test_mode']; + $_SESSION['original_amount_invoice'] = $amount / 100; + $_SESSION['due_date_invoice'] = $due_date; + ### WRITE THE INVOICE BANK DATA ON SESSION ### + $_SESSION['nn_invoice_account'] = $aryResponse['invoice_account']; + $_SESSION['nn_invoice_bankcode'] = $aryResponse['invoice_bankcode']; + $_SESSION['nn_invoice_iban'] = $aryResponse['invoice_iban']; + $_SESSION['nn_invoice_bic'] = $aryResponse['invoice_bic']; + $_SESSION['nn_invoice_bankname'] = $aryResponse['invoice_bankname']; + $_SESSION['nn_invoice_bankplace'] = $aryResponse['invoice_bankplace']; + } else { + // $old_comments = $order->info['comments']; + // $order->info['comments'] =""; + $transferinvoice_info = utf8_encode(MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_TRANSFER_INFO); + $days_limit = utf8_encode(MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_DURATION_LIMIT_END_INFO); + $inrenationalinvoice_info = utf8_encode(MODULE_PAYMENT_NOVALNET_TEXT_DETAILS_INVOICE_INTERNATIONAL_INFO); + $test_mode = (strtolower(MODULE_PAYMENT_NOVALNET_INVOICE_TEST_MODE) == 'true' or MODULE_PAYMENT_NOVALNET_INVOICE_TEST_MODE == '1') ? 1 : 0; + if ($aryResponse['test_mode'] == 1 || $test_mode) { + + $order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_INVOICE_TEST_ORDER_MESSAGE . '
'; + } + //$amount = str_replace('.', ',', sprintf("%.2f", $amount/100)); + $amount = $currencies->format($amount / 100); + //$order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_INVOICE_PAYMNETNAME . ''; + if (MODULE_PAYMENT_NOVALNET_INVOICE_LOGO_STATUS == 'True') { + $order->info['comments'] .= '
' . 'Novalnet'.' '. MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_TITLE; + }else + { + $order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_TITLE; + } + $order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_INVOICE_TID . ' ' . $aryResponse['tid'] . '
'; + + if ($due_date) { + $order->info['comments'] .= '
' . $transferinvoice_info . ' ' . ''; + $order->info['comments'] .= '
' . $days_limit . ' ' . $due_date . ''; + } else { + $order->info['comments'] .= '
' . $transferinvoice_info . ''; + } + $order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_BANK_ACCOUNT_OWNER . ' ' . MODULE_PAYMENT_NOVALNET_INVOICE_NAME . ''; + $order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_BANK_ACCOUNT_NUMBER . ' ' . $aryResponse['invoice_account'] . ''; + $order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_BANK_CODE . ' ' . $aryResponse['invoice_bankcode'] . ''; + $order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_BANK_BANK . ' ' . $aryResponse['invoice_bankname'] . ' ' . $aryResponse['invoice_bankplace'] . ''; + //$order->info['comments'] .= ''.MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_AMOUNT.' '.$amount.' '.$order->info['currency'].''; + $order->info['comments'] .= '' . MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_AMOUNT . ' ' . $amount . ''; + $order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_REFERENCE . ' ' . $aryResponse['tid'] . '
'; + $order->info['comments'] .= '
' . $inrenationalinvoice_info . ''; + $order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_BANK_IBAN . ' ' . $aryResponse['invoice_iban'] . ''; + $order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_BANK_BIC . ' ' . $aryResponse['invoice_bic'] . ''; + $order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_REFERENCE_INFO . ''; + //$order->info['comments'] .= $old_comments; + $order->info['comments'] = str_replace(array('', '', '
', '', '
', '
', '
', '
'), array('', '', '', '', "\n", "\n", "\n", "\n"), $order->info['comments']); + $_SESSION['nn_tid_invoice'] = $aryResponse['tid']; + } + } else { + ### Passing through the Error Response from Novalnet's paygate into order-info ### + $order->info['comments'] .= '. Novalnet Error Code : ' . $aryResponse['status'] . ', Novalnet Error Message : ' . $aryResponse['status_desc']; + $payment_error_return = 'payment_error=' . $this->code; + $messageStack->add_session('checkout_payment', $aryResponse['status_desc'] . '', 'error'); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + return; + } + + ### Realtime accesspoint for communication to the Novalnet paygate ### + + function perform_https_request($nn_url, $urlparam) { + $debug = 0; #set it to 1 if you want to activate the debug mode + if ($debug) + print "
perform_https_request: $nn_url
\n\r\n"; + if ($debug) + print "perform_https_request: $urlparam
\n\r\n"; + ## some prerquisites for the connection + $ch = curl_init($nn_url); + curl_setopt($ch, CURLOPT_POST, 1); // a non-zero parameter tells the library to do a regular HTTP post. + curl_setopt($ch, CURLOPT_POSTFIELDS, $urlparam); // add POST fields + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); // don't allow redirects + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // decomment it if you want to have effective ssl checking + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // decomment it if you want to have effective ssl checking + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable + curl_setopt($ch, CURLOPT_TIMEOUT, 240); // maximum time, in seconds, that you'll allow the CURL functions to take + if ($this->proxy) { + curl_setopt($ch, CURLOPT_PROXY, $this->proxy); + } + ## establish connection + $data = curl_exec($ch); + //$data = $this->ReplaceSpecialGermanChars($data); + ## determine if there were some problems on cURL execution + $errno = curl_errno($ch); + $errmsg = curl_error($ch); + + ###bug fix for PHP 4.1.0/4.1.2 (curl_errno() returns high negative value in case of successful termination) + if ($errno < 0) + $errno = 0; + ##bug fix for PHP 4.1.0/4.1.2 + + if ($debug) { + print_r(curl_getinfo($ch)); + echo "\n

\n\n\nperform_https_request: cURL error number:" . $errno . "\n
\n\n"; + echo "\n\n\nperform_https_request: cURL error:" . $errmsg . "\n
\n\n"; + } + + #close connection + curl_close($ch); + + ## read and return data from novalnet paygate + if ($debug) + print "
\n\n" . $data . "\n
\n\n"; + + return array($errno, $errmsg, $data); + } + + function isPublicIP($value) { + if (!$value || count(explode('.', $value)) != 4) + return false; + return !preg_match('~^((0|10|172\.16|192\.168|169\.254|255|127\.0)\.)~', $value); + } + + ### get the real Ip Adress of the User ### + + function getRealIpAddr() { + if ($_SERVER['HTTP_X_FORWARDED_FOR'] and $this->isPublicIP($_SERVER['HTTP_X_FORWARDED_FOR'])) { + return $_SERVER['HTTP_X_FORWARDED_FOR']; + } + if ($_SERVER['HTTP_X_FORWARDED_FOR'] and $iplist = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR'])) { + if ($this->isPublicIP($iplist[0])) + return $iplist[0]; + } + if ($_SERVER['HTTP_CLIENT_IP'] and $this->isPublicIP($_SERVER['HTTP_CLIENT_IP'])) { + return $_SERVER['HTTP_CLIENT_IP']; + } + if ($_SERVER['HTTP_X_CLUSTER_CLIENT_IP'] and $this->isPublicIP($_SERVER['HTTP_X_CLUSTER_CLIENT_IP'])) { + return $_SERVER['HTTP_X_CLUSTER_CLIENT_IP']; + } + if ($_SERVER['HTTP_FORWARDED_FOR'] and $this->isPublicIP($_SERVER['HTTP_FORWARDED_FOR'])) { + return $_SERVER['HTTP_FORWARDED_FOR']; + } + return $_SERVER['REMOTE_ADDR']; + } + + ### replace the Special German Charectors ### + + function ReplaceSpecialGermanChars($string) { + $what = array("ä", "ö", "ü", "Ä", "Ö", "Ãœ", "ß"); + $how = array("ae", "oe", "ue", "Ae", "Oe", "Ue", "ss"); + + $string = str_replace($what, $how, $string); + + return $string; + } + + ### Send the order detail to Novalnet ### + + function after_process() { + global $order, $customer_id, $insert_id, $db; + + if ($_SESSION['nn_tid_invoice'] != '') { + ### Pass the Order Reference to paygate ## + $url = 'https://payport.novalnet.de/paygate.jsp'; + $urlparam = 'vendor=' . $this->vendor_id . '&product=' . $this->product_id . '&key=' . $this->payment_key . '&tariff=' . $this->tariff_id; + $urlparam .= '&auth_code=' . $this->auth_code . '&status=100&tid=' . $_SESSION['nn_tid_invoice']; + $urlparam .= '&order_no=' . $insert_id; + $urlparam .= "&invoice_ref=BNR-" . $this->product_id . "-" . $insert_id; + list($errno, $errmsg, $data) = $this->perform_https_request($url, $urlparam); + } + unset($_SESSION['user_tel_invoice']); + unset($_SESSION['nn_tid_invoice']); + unset($_SESSION['max_time_invoice']); + if (isset($_SESSION['invalid_count_invoice'])) { + unset($_SESSION['invalid_count_invoice']); + } + + #print "$customer_id, $insert_id"; exit; + ### Implement here the Emailversand and further functions, incase if you want to send a own email ### + /* + $db->Execute("update ".TABLE_ORDERS_STATUS_HISTORY." set comments = '".$order->info['comments']."' , orders_status_id= '".$this->order_status."' where orders_id = '".$insert_id."'"); + $db->Execute("update ".TABLE_ORDERS." set orders_status = '".$this->order_status."' where orders_id = '".$insert_id."'"); + */ + + return false; + } + + ### Used to display error message details ### + // @return array + + function get_error() { + global $HTTP_GET_VARS, $_GET; + if (count($HTTP_GET_VARS) == 0 || $HTTP_GET_VARS == '') + $HTTP_GET_VARS = $_GET; + + $error = array('title' => MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_ERROR, + 'error' => stripslashes(urldecode($HTTP_GET_VARS['error']))); + + return $error; + } + + ### Check to see whether module is installed ### + // @return boolean + + function check() { + global $db; + if (!isset($this->_check)) { + $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_NOVALNET_INVOICE_STATUS'"); + $this->_check = $check_query->RecordCount(); + } + return $this->_check; + } + + function install_lang($field_text, $lang) { + #Allowed Zones + $install_text['allowed_title'] = array('en' => "Allowed zones", + 'de' => "erlaubte Zonen"); + $install_text['allowed_desc'] = array('en' => "Please enter the desired zones separated by comma (Eg: AT, DE) or leave it blank", + 'de' => "Bitte die gewünschten Zonen durch Komma getrennt eingeben (z.B: AT,DE) oder einfach leer lassen"); + #Enable Module + $install_text['enable_title'] = array('en' => "Enable Module", + 'de' => "Modul aktivieren"); + $install_text['enable_desc'] = array('en' => "Do you want to activate the Credit Card of Novalnet AG?", + 'de' => "Wollen Sie das Kreditkarten Modul des Novalnet AG aktivieren?"); + #Test Mode + $install_text['test_title'] = array('en' => "Enable Test Mode:", + 'de' => "Testmodus einschalten"); + $install_text['test_desc'] = array('en' => "Do you want to activate test mode?", + 'de' => "Wollen Sie den Test-Modus aktivieren?"); + #Vendor id + $install_text['vendor_title'] = array('en' => "Novalnet Merchant ID", + 'de' => "Novalnet Händler ID"); + $install_text['vendor_desc'] = array('en' => "Enter your Novalnet Merchant ID ", + 'de' => "Geben Sie Ihre Novalnet Händler-ID ein "); + #Auth Code + $install_text['auth_title'] = array('en' => "Novalnet Merchant Authorisation Code", + 'de' => "Novalnet Authorisierungsschlüssel"); + $install_text['auth_desc'] = array('en' => "Enter your Novalnet Merchant Authorisation code ", + 'de' => "Geben Sie Ihren Novalnet-Authorisierungsschlüssel ein"); + + #Product id + $install_text['product_title'] = array('en' => "Novalnet Product ID", + 'de' => "Novalnet Produkt ID"); + $install_text['product_desc'] = array('en' => "Enter your Novalnet Product ID", + 'de' => "Geben Sie Ihre Novalnet Produkt-ID ein"); + + #Tariff id + $install_text['tariff_title'] = array('en' => "Novalnet Tariff ID", + 'de' => "Novalnet Tarif ID"); + $install_text['tariff_desc'] = array('en' => "Enter your Novalnet Tariff ID ", + 'de' => "Geben Sie Ihre Novalnet Tarif-ID ein"); + + #Enduser info + $install_text['enduser_title'] = array('en' => "Information to the end customer", + 'de' => "Informationen für den Endkunden"); + $install_text['enduser_desc'] = array('en' => "will appear in the payment form", + 'de' => "wird im Bezahlformular erscheinen"); + + #Sortorder display + $install_text['sortorder_title'] = array('en' => "Sort order of display", + 'de' => "Sortierung nach"); + $install_text['sortorder_desc'] = array('en' => "Sort order of display. Lowest is displayed first.", + 'de' => "Sortierung der Anzeige. Der niedrigste Wert wird zuerst angezeigt."); + + #Setorder status display + $install_text['setorderstatus_title'] = array('en' => "Set Order Status", + 'de' => "Bestellungsstatus setzen"); + $install_text['setorderstatus_desc'] = array('en' => "Set the status of orders made with this payment module to this value.", + 'de' => "Setzen Sie den Status von über dieses Zahlungsmodul durchgeführten Bestellungen auf diesen Wert."); + + #Proxy + $install_text['proxy_title'] = array('en' => "Proxy-Server", + 'de' => "Proxy-Server"); + $install_text['proxy_desc'] = array('en' => " If you use a Proxy Server, enter the Proxy Server IP with port here (e.g. www.proxy.de:80).", + 'de' => "Wenn Sie einen Proxy-Server einsetzen, tragen Sie hier Ihre Proxy-IP und den Port ein (z.B. www.proxy.de:80)."); + + #Payment Zone + $install_text['paymnetzone_title'] = array('en' => "Payment Zone", + 'de' => "Zahlungsgebiet"); + $install_text['paymnetzone_desc'] = array('en' => "If a zone is selected then this module is activated only for Selected zone. ", + 'de' => "Wird ein Bereich ausgewählt, dann wird dieses Modul nur für den ausgewählten Bereich aktiviert."); + + + + + #Novalnet Payment Duration + $install_text['timelimit_title'] = array('en' => "Payment period in days", + 'de' => "Zahlungsfrist in tagen"); + $install_text['timelimit_desc'] = array('en' => "Payment duration of the Invoice in Days", + 'de' => "Payment Dauer der Rechnung in Tagen"); + + + #Pin by callback sms + $install_text['pinbycallback_title'] = array('en' => "PIN by Callback/SMS/E-Mail", + 'de' => "PIN by Callback/SMS/E-Mail"); + $install_text['pinbycallback_desc'] = array('en' => "When activated by PIN Callback / SMS / E-Mail the customer to enter their phone / mobile number / E-Mail requested. By phone or SMS, the customer receives a PIN from Novalnet AG, which must enter before ordering. If the PIN is valid, the payment process has been completed successfully, otherwise the customer will be prompted again to enter the PIN. This service is only available for customers from specified countries.", + 'de' => "Wenn durch PIN Callback / SMS / E-Mail des Kunden aktiviert, um ihre Telefonnummer / Handynummer / E-Mail angefordert geben. Per Telefon oder SMS, erhält der Kunde eine PIN von Novalnet AG, die vor der Bestellung eingeben müssen. Wenn die PIN gültig ist, hat die Zahlung Prozess erfolgreich beendet wurde, andernfalls hat der Kunde erneut aufgefordert, die PIN einzugeben. Dieser Service ist nur für Kunden aus bestimmten Ländern."); + + #Manual Amount Limit For Pin by callback/sms + $install_text['amountlimitpin_title'] = array('en' => "Minimum Amount Limit for Callback in cents", + 'de' => "Grenzwert (Mindestbetrag) in Cent für Rückruf"); + $install_text['amountlimitpin_desc'] = array('en' => "Please enter minimum amount limit to enable Pin by CallBackmodule (In Cents, e.g. 100,200)", + 'de' => "Bitte geben Sie Mindestbetrag Grenze zu Pin durch CallBack Modul (in Cent, z. B. 100,200) ermÖglichen"); + + #Activate Logo Mode + $install_text['logo_title'] = array('en' => "Activate logo mode:", + 'de' => "Aktivieren Sie Logo Modus:"); + $install_text['logo_desc'] = array('en' => "Do you want to activate logo mode?", + 'de' => "Wollen Sie Logo-Modus zu aktivieren?"); + + return $install_text[$field_text][$lang]; + } + + ### Install the payment module and its configuration settings ### + + function install() { + global $db; + + $allowed_title = $this->install_lang('allowed_title', DEFAULT_LANGUAGE); + $allowed_desc = $this->install_lang('allowed_desc', DEFAULT_LANGUAGE); + + $enable_title = $this->install_lang('enable_title', DEFAULT_LANGUAGE); + $enable_desc = $this->install_lang('enable_desc', DEFAULT_LANGUAGE); + + $test_title = $this->install_lang('test_title', DEFAULT_LANGUAGE); + $test_desc = $this->install_lang('test_desc', DEFAULT_LANGUAGE); + + $vendor_title = $this->install_lang('vendor_title', DEFAULT_LANGUAGE); + $vendor_desc = $this->install_lang('vendor_desc', DEFAULT_LANGUAGE); + + $auth_title = $this->install_lang('auth_title', DEFAULT_LANGUAGE); + $auth_desc = $this->install_lang('auth_desc', DEFAULT_LANGUAGE); + + $product_title = $this->install_lang('product_title', DEFAULT_LANGUAGE); + $product_desc = $this->install_lang('product_desc', DEFAULT_LANGUAGE); + + $tariff_title = $this->install_lang('tariff_title', DEFAULT_LANGUAGE); + $tariff_desc = $this->install_lang('tariff_desc', DEFAULT_LANGUAGE); + + $enduser_title = $this->install_lang('enduser_title', DEFAULT_LANGUAGE); + $enduser_desc = $this->install_lang('enduser_desc', DEFAULT_LANGUAGE); + + $sortorder_title = $this->install_lang('sortorder_title', DEFAULT_LANGUAGE); + $sortorder_desc = $this->install_lang('sortorder_desc', DEFAULT_LANGUAGE); + + $setorderstatus_title = $this->install_lang('setorderstatus_title', DEFAULT_LANGUAGE); + $setorderstatus_desc = $this->install_lang('setorderstatus_desc', DEFAULT_LANGUAGE); + + $proxy_title = $this->install_lang('proxy_title', DEFAULT_LANGUAGE); + $proxy_desc = $this->install_lang('proxy_desc', DEFAULT_LANGUAGE); + + $paymnetzone_title = $this->install_lang('paymnetzone_title', DEFAULT_LANGUAGE); + $paymnetzone_desc = $this->install_lang('paymnetzone_desc', DEFAULT_LANGUAGE); + + $timelimit_title = $this->install_lang('timelimit_title', DEFAULT_LANGUAGE); + $timelimit_desc = $this->install_lang('timelimit_desc', DEFAULT_LANGUAGE); + + $pinbycallback_title = $this->install_lang('pinbycallback_title', DEFAULT_LANGUAGE); + $pinbycallback_desc = $this->install_lang('pinbycallback_desc', DEFAULT_LANGUAGE); + + $amountlimitpin_title = $this->install_lang('amountlimitpin_title', DEFAULT_LANGUAGE); + $amountlimitpin_desc = $this->install_lang('amountlimitpin_desc', DEFAULT_LANGUAGE); + + $logo_title = $this->install_lang('logo_title', DEFAULT_LANGUAGE); + $logo_desc = $this->install_lang('logo_desc', DEFAULT_LANGUAGE); + + + /* $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$allowed_title."','MODULE_PAYMENT_NOVALNET_INVOICE_ALLOWED', '','".$allowed_desc."', '6', '0', now())"); */ + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('" . $enable_title . "', 'MODULE_PAYMENT_NOVALNET_INVOICE_STATUS', 'True', '" . $enable_desc . "', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('" . $test_title . "', 'MODULE_PAYMENT_NOVALNET_INVOICE_TEST_MODE', 'True', '" . $test_desc . "', '6', '1', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('" . $pinbycallback_title . "','MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_SMS','False','" . $pinbycallback_desc . "', '6', '2', 'zen_cfg_select_option(array( \'False\', \'Callback (Telefon & Handy)\', \'SMS (nur Handy)\',\'Email Reply\'), ', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $amountlimitpin_title . "','MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_MIN_LIMIT', '','" . $amountlimitpin_desc . "', '6', '3', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $vendor_title . "', 'MODULE_PAYMENT_NOVALNET_INVOICE_VENDOR_ID', '', '" . $vendor_desc . "', '6', '4', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $auth_title . "', 'MODULE_PAYMENT_NOVALNET_INVOICE_AUTH_CODE', '', '" . $auth_desc . "', '6', '5', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $product_title . "', 'MODULE_PAYMENT_NOVALNET_INVOICE_PRODUCT_ID', '', '" . $product_desc . "', '6', '6', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $tariff_title . "', 'MODULE_PAYMENT_NOVALNET_INVOICE_TARIFF_ID', '', '" . $tariff_desc . "', '6', '7', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $timelimit_title . "', 'MODULE_PAYMENT_NOVALNET_INVOICE_DURATION', '', '" . $timelimit_desc . "', '6', '8', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $enduser_title . "', 'MODULE_PAYMENT_NOVALNET_INVOICE_INFO', '', '" . $enduser_desc . "', '6', '9', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $sortorder_title . "', 'MODULE_PAYMENT_NOVALNET_INVOICE_SORT_ORDER', '0', '" . $sortorder_desc . "', '6', '10', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('" . $setorderstatus_title . "', 'MODULE_PAYMENT_NOVALNET_INVOICE_ORDER_STATUS_ID', '0', '" . $setorderstatus_desc . "', '6', '11', 'zen_cfg_pull_down_order_statuses(', 'zen_get_order_status_name', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('" . $paymnetzone_title . "', 'MODULE_PAYMENT_NOVALNET_INVOICE_ZONE', '0', '" . $paymnetzone_desc . "', '6', '12', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $proxy_title . "', 'MODULE_PAYMENT_NOVALNET_INVOICE_PROXY', '', '" . $proxy_desc . "', '6', '13', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('" . $logo_title . "', 'MODULE_PAYMENT_NOVALNET_INVOICE_LOGO_STATUS', 'True', '" . $logo_desc . "', '6', '14', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + } + + ### Remove the module and all its settings ### + + function remove() { + global $db; + $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); + } + + ### Internal list of configuration keys used for configuration of the module ### + // @return array + + function keys() { + return array( 'MODULE_PAYMENT_NOVALNET_INVOICE_LOGO_STATUS', 'MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_SMS', 'MODULE_PAYMENT_NOVALNET_INVOICE_PIN_BY_CALLBACK_MIN_LIMIT', 'MODULE_PAYMENT_NOVALNET_INVOICE_STATUS', 'MODULE_PAYMENT_NOVALNET_INVOICE_TEST_MODE', + 'MODULE_PAYMENT_NOVALNET_INVOICE_VENDOR_ID', 'MODULE_PAYMENT_NOVALNET_INVOICE_AUTH_CODE', 'MODULE_PAYMENT_NOVALNET_INVOICE_PRODUCT_ID', + 'MODULE_PAYMENT_NOVALNET_INVOICE_TARIFF_ID', 'MODULE_PAYMENT_NOVALNET_INVOICE_DURATION', 'MODULE_PAYMENT_NOVALNET_INVOICE_INFO', + 'MODULE_PAYMENT_NOVALNET_INVOICE_SORT_ORDER', 'MODULE_PAYMENT_NOVALNET_INVOICE_ORDER_STATUS_ID', 'MODULE_PAYMENT_NOVALNET_INVOICE_ZONE', + 'MODULE_PAYMENT_NOVALNET_INVOICE_PROXY'); + } + + function html_to_utf8($data) { + return preg_replace("/\\&\\#([0-9]{3,10})\\;/e", '$this->_html_to_utf8("\\1")', $data); + } + + function _html_to_utf8($data) { + if ($data > 127) { + $i = 5; + while (($i--) > 0) { + if ($data != ($a = $data % ($p = pow(64, $i)))) { + $ret = chr(base_convert(str_pad(str_repeat(1, $i + 1), 8, "0"), 2, 10) + (($data - $a) / $p)); + for ($i; $i > 0; $i--) + $ret .= chr(128 + ((($data % pow(64, $i)) - ($data % ($p = pow(64, $i - 1)))) / $p)); + break; + } + } + } else { + $ret = "&#$data;"; + } + return $ret; + } + +} + +/* + order of functions: + selection -> $order-info['total'] wrong, cause shipping_cost is net + pre_confirmation_check -> $order-info['total'] wrong, cause shipping_cost is net + confirmation -> $order-info['total'] right, cause shipping_cost is gross + process_button -> $order-info['total'] right, cause shipping_cost is gross + before_process -> $order-info['total'] wrong, cause shipping_cost is net + after_process -> $order-info['total'] right, cause shipping_cost is gross + */ +?> diff --git a/includes/modules/payment/novalnet_paypal.php b/includes/modules/payment/novalnet_paypal.php new file mode 100644 index 0000000..bce7715 --- /dev/null +++ b/includes/modules/payment/novalnet_paypal.php @@ -0,0 +1,988 @@ +key = trim(MODULE_PAYMENT_NOVALNET_PAYPAL_PASSWORD); + $this->vendor_id = trim(MODULE_PAYMENT_NOVALNET_PAYPAL_VENDOR_ID); + $this->auth_code = trim(MODULE_PAYMENT_NOVALNET_PAYPAL_AUTH_CODE); + $this->product_id = trim(MODULE_PAYMENT_NOVALNET_PAYPAL_PRODUCT_ID); + $this->tariff_id = trim(MODULE_PAYMENT_NOVALNET_PAYPAL_TARIFF_ID); + $this->test_mode = (strtolower(MODULE_PAYMENT_NOVALNET_PAYPAL_TEST_MODE) == 'true' or MODULE_PAYMENT_NOVALNET_PAYPAL_TEST_MODE == '1') ? 1 : 0; + $this->api_signature = trim(MODULE_PAYMENT_NOVALNET_PAYPAL_API_SIGNATURE); + $this->api_user = trim(MODULE_PAYMENT_NOVALNET_PAYPAL_API_USER); + $this->api_pw = trim(MODULE_PAYMENT_NOVALNET_PAYPAL_API_PASSWORD); + + + $this->code = 'novalnet_paypal'; + $this->form_action_url = 'https://payport.novalnet.de/paypal_payport'; + $this->title = MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_TITLE; + $this->public_title = MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_PUBLIC_TITLE; + $this->description = MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_DESCRIPTION; + $this->sort_order = MODULE_PAYMENT_NOVALNET_PAYPAL_SORT_ORDER; + $this->enabled = ((MODULE_PAYMENT_NOVALNET_PAYPAL_STATUS == 'True') ? true : false); + $this->blnDebug = false; #todo: set to false for live system + $this->proxy = MODULE_PAYMENT_NOVALNET_PAYPAL_PROXY; + $this->implementation = ''; #'JAVA|PHP|''; defaults to 'PHP' + $this->info = MODULE_PAYMENT_PAYPAL_TEXT_INFO; + + + + if (MODULE_PAYMENT_NOVALNET_PAYPAL_LOGO_STATUS == 'True') { + $this->public_title = 'Novalnet'.' '. MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_PUBLIC_TITLE; + $this->title = 'Novalnet'.' '.MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_TITLE; + } + $this->checkConfigure(); + + #check encoded data + if ($_REQUEST['hash2'] && $_SESSION['payment'] == $this->code) { + if (strtoupper($this->implementation) == 'JAVA') {#Java encoded + if ($_REQUEST['auth_code'] != md5(MODULE_PAYMENT_NOVALNET_PAYPAL_AUTH_CODE . strrev($this->key))) { + $err = MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_HASH_ERROR . '; wrong auth_code!'; + $payment_error_return = 'payment_error=' . $this->code . '&error=' . $_REQUEST['status_text'] . '; ' . $err; + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + $_REQUEST['auth_code'] = MODULE_PAYMENT_NOVALNET_PAYPAL_AUTH_CODE; #todo: check? + $_REQUEST['product_id'] = $this->encode4java($_REQUEST['product'], 'bindec'); + $_REQUEST['tariff_id'] = $this->encode4java($_REQUEST['tariff'], 'bindec'); + $_REQUEST['amount'] = $this->encode4java($_REQUEST['amount'], 'bindec'); + $_REQUEST['test_mode'] = $this->encode4java($_REQUEST['test_mode'], 'bindec'); + $_REQUEST['uniqid'] = $this->encode4java($_REQUEST['uniqid'], 'bindec'); + + if (!$this->checkHash4java($_REQUEST)) {#PHP encoded + $err = MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_HASH_ERROR; + $payment_error_return = 'payment_error=' . $this->code . '&error=' . $_REQUEST['status_text'] . '; ' . $err; + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + } else {#PHP encoded + if (!$this->checkHash($_REQUEST)) { + if ($_REQUEST['status'] != 100) { + // $err = MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_HASH_ERROR; + $payment_error_return = 'payment_error=' . $this->code . '&error=' . $_REQUEST['status_text']; + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } else { + $err = MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_HASH_ERROR; + $payment_error_return = 'payment_error=' . $this->code . '&error=' . $err; + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + } else { + $_REQUEST['auth_code'] = $this->decode($_REQUEST['auth_code']); + $_REQUEST['product_id'] = $this->decode($_REQUEST['product_id']); + $_REQUEST['tariff_id'] = $this->decode($_REQUEST['tariff_id']); + $_REQUEST['amount'] = $this->decode($_REQUEST['amount']); + $_REQUEST['test_mode'] = $this->decode($_REQUEST['test_mode']); + $_REQUEST['uniqid'] = $this->decode($_REQUEST['uniqid']); + } + } + } + if ((int) MODULE_PAYMENT_NOVALNET_PAYPAL_ORDER_STATUS_ID > 0) { + $this->order_status = MODULE_PAYMENT_NOVALNET_PAYPAL_ORDER_STATUS_ID; + } + + if (is_object($order)) { + $this->update_status(); + } + } + + function checkConfigure() { + if (IS_ADMIN_FLAG == true) { + $this->title = MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_TITLE; // Payment module title in Admin + if (MODULE_PAYMENT_NOVALNET_PAYPAL_LOGO_STATUS == 'True') { + $this->public_title = 'Novalnet'.' '. MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_PUBLIC_TITLE; + $this->title = 'Novalnet'.' '.MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_TITLE; + } + if ($this->enabled == 'true' && (!$this->vendor_id || !$this->auth_code || !$this->product_id || + !$this->tariff_id || !$this->key || !$this->api_signature || + !$this->api_user || !$this->api_pw )) { + $this->title .= '' . MODULE_PAYMENT_NOVALNET_PAYPAL_NOT_CONFIGURED . ''; + } elseif ($this->test_mode == '1') { + $this->title .= '' . MODULE_PAYMENT_NOVALNET_PAYPAL_IN_TEST_MODE . ''; + } + } + } + + ### calculate zone matches and flag settings to determine whether this module should display to customers or not ### + + function update_status() { + global $order, $db; + + if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_PAYPAL_ZONE > 0)) { + $check_flag = false; + $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_NOVALNET_PAYPAL_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id"); + while (!$check->EOF) { + if ($check->fields['zone_id'] < 1) { + $check_flag = true; + break; + } elseif ($check->fields['zone_id'] == $order->billing['zone_id']) { + $check_flag = true; + break; + } + $check->MoveNext(); + } + + if ($check_flag == false) { + $this->enabled = false; + } + } + } + + ### JS validation which does error-checking of data-entry if this module is selected for use ### + ### the fields to be cheked are (Bank Owner, Bank Account Number and Bank Code Lengths) ### + ### currently this function is not in use ### + // @return string + + function javascript_validation() { + return false; + } + + ### Builds set of input fields for collecting Bankdetail info ### + // @return array + + function selection() { + + global $xtPrice, $order, $HTTP_POST_VARS, $_POST; + + $onFocus = ''; + if (count($HTTP_POST_VARS) == 0 || $HTTP_POST_VARS == '') + $HTTP_POST_VARS = $_POST; + + $selection = array('id' => $this->code, + 'module' => $this->public_title, + 'description' => $this->info, + 'fields' => array(array('title' => '', 'field' => MODULE_PAYMENT_NOVALNET_INFORMATION_PAYMENT_PAYPAL), + array('title' => '', 'field' => MODULE_PAYMENT_NOVALNET_PAYPAL_INFO) + )); + + if (function_exists(get_percent)) { + $selection['module_cost'] = $GLOBALS['ot_payment']->get_percent($this->code); + } + return $selection; + } + + ### Precheck to Evaluate the Bank Datas ### + + function pre_confirmation_check() { + global $HTTP_POST_VARS, $_POST; + + if (count($HTTP_POST_VARS) == 0 || $HTTP_POST_VARS == '') + $HTTP_POST_VARS = $_POST; + + $error = ''; + + if (!function_exists('curl_init') && ($this->code == 'novalnet_paypal')) { + ini_set('display_errors', 1); + ini_set('error_reporting', E_ALL); + $error = MODULE_PAYMENT_NOVALNET_PAYPAL_CURL_MESSAGE; + } + + + if (!$this->vendor_id || !$this->auth_code || !$this->product_id || + !$this->tariff_id || !$this->key || !$this->api_signature || + !$this->api_user || !$this->api_pw) { + $error = MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_JS_NN_MISSING; + } + + if ($error != '') { + $payment_error_return = 'payment_error=' . $this->code . '&error=' . urlencode($error); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + } + + ### Display Bank Information on the Checkout Confirmation Page ### + // @return array + + function confirmation() { + global $HTTP_POST_VARS, $_POST, $order; + + if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) { + $total = $order->info['total'] + $order->info['tax']; + } else { + $total = $order->info['total']; + } + $_SESSION['nn_total'] = sprintf('%.2f', $total); + + if (count($HTTP_POST_VARS) == 0 || $HTTP_POST_VARS == '') + $HTTP_POST_VARS = $_POST; + + $confirmation = array(); + + return $confirmation; + } + + ### Build the data and actions to process when the "Submit" button is pressed on the order-confirmation screen. ### + ### These are hidden fields on the checkout confirmation page ### + // @return string + + function process_button() { + global $HTTP_POST_VARS, $_POST, $order, $currencies, $customer_id, $db, $messageStack; + if (count($HTTP_POST_VARS) == 0 || $HTTP_POST_VARS == '') + $HTTP_POST_VARS = $_POST; + + #Get the required additional customer details from DB + $nn_customer_id = (isset($_SESSION['customer_id'])) ? $_SESSION['customer_id'] : ''; + $customer_values = $db->Execute("SELECT customers_gender, customers_dob, customers_fax FROM " . TABLE_CUSTOMERS . " WHERE customers_id='" . (int) $nn_customer_id . "'"); + + while (!$customer_values->EOF) { + $customer_values->MoveNext(); + } + + list($customer_values->fields['customers_dob'], $extra) = explode(' ', $customer_values->fields['customers_dob']); + + if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status_add_tax_ot'] == 1) { + $totalamount = $order->info['total'] + $order->info['tax']; + } else { + $totalamount = $order->info['total']; + } + + $totalamount = number_format($totalamount * $currencies->get_value($order->info['currency']), 2); + $amount = str_replace(',', '', $totalamount); + $amount = intval(round($amount * 100)); + + //$amount =sprintf('%.2f', $totalamount); + + if (preg_match('/[^\d\.]/', $amount) or !$amount) { + ### $amount contains some unallowed chars or empty ### + $err = '$amount (' . $amount . ') is empty or has a wrong format'; + $order->info['comments'] .= '. Novalnet Error Message : ' . $err; + $payment_error_return = 'payment_error=' . $this->code; + $messageStack->add_session('checkout_payment', $err . '', 'error'); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + // $amount = preg_replace('/^0+/', '', $amount); + // $amount = sprintf('%0.2f', $amount); + // $amount = str_replace('.', '', $amount); + + $api_signature = $this->api_signature; + $api_user = $this->api_user; + $api_pw = $this->api_pw; + + $vendor_id = $this->vendor_id; + $auth_code = $this->auth_code; + $product_id = $this->product_id; + $tariff_id = $this->tariff_id; + $uniqid = uniqid(); + $test_mode = (strtolower(MODULE_PAYMENT_NOVALNET_PAYPAL_TEST_MODE) == 'true' or MODULE_PAYMENT_NOVALNET_PAYPAL_TEST_MODE == '1') ? 1 : 0; + + $customer_id = $_SESSION['customer_id']; + + if (strtoupper($this->implementation) == 'JAVA') { + $uniqid = time(); #must ne a long integer + $hash = md5($auth_code . $product_id . $tariff_id . $amount . $test_mode . $uniqid . strrev($this->key)); + $auth_code = md5($auth_code . strrev($this->key)); + $product_id = $this->encode4java($product_id, 'decbin'); + $tariff_id = $this->encode4java($tariff_id, 'decbin'); + $amount = $this->encode4java($amount, 'decbin'); + $test_mode = $this->encode4java($test_mode, 'decbin'); + $uniqid = $this->encode4java($uniqid, 'decbin'); + $api_signature = $this->encode4java($api_signature, 'decbin'); + $api_user = $this->encode4java($api_user, 'decbin'); + $api_pw = $this->encode4java($api_pw, 'decbin'); + } else { + $auth_code = $this->encode($auth_code); + $product_id = $this->encode($product_id); + $tariff_id = $this->encode($tariff_id); + $amount = $this->encode($amount); + $test_mode = $this->encode($test_mode); + $uniqid = $this->encode($uniqid); + $hash = $this->hash(array('auth_code' => $auth_code, 'product_id' => $product_id, 'tariff' => $tariff_id, 'amount' => $amount, 'test_mode' => $test_mode, 'uniqid' => $uniqid)); + $api_signature = $this->encode($api_signature); + $api_user = $this->encode($api_user); + $api_pw = $this->encode($api_pw); + } + + $user_ip = $this->getRealIpAddr(); + $checkout_url = zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'); + if (strstr($checkout_url, '?')) { + $checkout_url = str_replace(' ', '', $checkout_url); + if (substr($checkout_url, -1) == '?') + $error_url = $checkout_url . 'payment_error=' . $this->code . '&error=$ERROR_MESSAGE ($STATUS)'; + else + $error_url = $checkout_url . '&payment_error=' . $this->code . '&error=$ERROR_MESSAGE ($STATUS)'; + } + else + $error_url = $checkout_url . '?payment_error=' . $this->code . '&error=$ERROR_MESSAGE ($STATUS)'; + + + #$error_url = http://localhost/xtcommerce/checkout_payment.php?payment_error=novalnet_paypal&error=$ERROR_MESSAGE ($STATUS) + #http://localhost/xtcommerce/checkout_payment.php?payment_error=checkHashfehlgeschlagen&error=EsfehlenEingabe-Daten + + $firstname = !empty($order->customer['firstname']) ? $order->customer['firstname'] : $order->billing['firstname']; + $lastname = !empty($order->customer['lastname']) ? $order->customer['lastname'] : $order->billing['lastname']; + $email_address = !empty($order->customer['email_address']) ? $order->customer['email_address'] : $order->billing['email_address']; + $street_address = !empty($order->customer['street_address']) ? $order->customer['street_address'] : $order->billing['street_address']; + $city = !empty($order->customer['city']) ? $order->customer['city'] : $order->billing['city']; + $postcode = !empty($order->customer['postcode']) ? $order->customer['postcode'] : $order->billing['postcode']; + $country_iso_code_2 = !empty($order->customer['country']['iso_code_2']) ? $order->customer['country']['iso_code_2'] : $order->billing['country']['iso_code_2']; + $customer_no = ($customer['customers_status'] != 1) ? $nn_customer_id : MODULE_PAYMENT_NOVALNET_PAYPAL_GUEST_USER; + + + $process_button_string = + zen_draw_hidden_field('api_signature', $api_signature) . + zen_draw_hidden_field('api_user', $api_user) . + zen_draw_hidden_field('api_pw', $api_pw) . + zen_draw_hidden_field('vendor', $vendor_id) . + zen_draw_hidden_field('auth_code', $auth_code) . + zen_draw_hidden_field('product', $product_id) . + zen_draw_hidden_field('tariff', $tariff_id) . + zen_draw_hidden_field('test_mode', $test_mode) . + zen_draw_hidden_field('uniqid', $uniqid) . + zen_draw_hidden_field('amount', $amount) . + zen_draw_hidden_field('hash', $hash) . + zen_draw_hidden_field('key', $this->payment_key) . #Pflicht + zen_draw_hidden_field('currency', $order->info['currency']) . + #zen_draw_hidden_field('first_name', $this->html_to_utf8($order->customer['firstname'])) . + zen_draw_hidden_field('first_name', $this->html_to_utf8($firstname)) . + #zen_draw_hidden_field('last_name', $this->html_to_utf8($order->customer['lastname'])) . + zen_draw_hidden_field('last_name', $this->html_to_utf8($lastname)) . + zen_draw_hidden_field('gender', 'u') . + zen_draw_hidden_field('email', $email_address) . + #zen_draw_hidden_field('street', $this->html_to_utf8($order->customer['street_address'])) . + zen_draw_hidden_field('street', $this->html_to_utf8($street_address)) . + zen_draw_hidden_field('search_in_street', '1') . + #zen_draw_hidden_field('city', $this->html_to_utf8($order->customer['city'])) . + zen_draw_hidden_field('city', $this->html_to_utf8($city)) . + #zen_draw_hidden_field('zip', $order->customer['postcode']) . + zen_draw_hidden_field('zip', $postcode) . + #zen_draw_hidden_field('country', $order->customer['country']['iso_code_2']) . + zen_draw_hidden_field('country', $country_iso_code_2) . + #zen_draw_hidden_field('country_code', $order->customer['country']['iso_code_2']) . + zen_draw_hidden_field('country_code', $country_iso_code_2) . + zen_draw_hidden_field('lang', MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_LANG) . #default: 'DE' + zen_draw_hidden_field('language', MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_LANG) . #default: 'DE' + zen_draw_hidden_field('remote_ip', $user_ip) . #Pflicht + zen_draw_hidden_field('tel', $order->customer['telephone']) . + zen_draw_hidden_field('fax', $customer['customers_fax']) . + zen_draw_hidden_field('birth_date', $customer_values->fields['customers_dob']) . + zen_draw_hidden_field('session', zen_session_id()) . + zen_draw_hidden_field('return_url', zen_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL')) . + zen_draw_hidden_field('return_method', 'POST') . + zen_draw_hidden_field('error_return_url', $error_url) . + //zen_draw_hidden_field('user_variable_0', str_replace(array('http://', 'www.'), array('', ''), $_SERVER['SERVER_NAME'])) . + zen_draw_hidden_field('customer_no', $customer_no) . + zen_draw_hidden_field('use_utf8', '1') . + zen_draw_hidden_field('error_return_method', 'POST'); + $process_button_string .= $this->getParams4paypal(); + return $process_button_string; + } + + ### Insert the Novalnet Transaction ID in DB ### + + function before_process() { + global $HTTP_POST_VARS, $_POST, $order, $currencies, $customer_id; + + if (count($HTTP_POST_VARS) == 0 || $HTTP_POST_VARS == '') + $HTTP_POST_VARS = $_POST; + if (isset($_POST['status']) && $_POST['status'] == 100) { + if ($this->order_status) { + $order->info['order_status'] = $this->order_status; + } + if ($_REQUEST['test_mode'] == 1) { + $order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_PAYPAL_TEST_ORDER_MESSAGE . '
'; + } + $order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_PAYPAL_TID_MESSAGE . $_POST['tid'] . '

'; + $order->info['comments'] = str_replace(array('', '', '', '', '
', '
', '
'), array('', '', '', '', "\n", "\n", "\n"), $order->info['comments']); + $_SESSION['nn_tid'] = $HTTP_POST_VARS['tid']; #todo: + } + } + + ### Send the order detail to Novalnet ### + + function after_process() { + global $order, $customer_id, $insert_id, $db; + + if ($this->order_status) { + $db->Execute("UPDATE " . TABLE_ORDERS . " SET orders_status='" . $this->order_status . "' WHERE orders_id='" . $insert_id . "'"); + } + + if ($_SESSION['nn_tid']) { + ### Pass the Order Reference to paygate ## + $url = 'https://payport.novalnet.de/paygate.jsp'; + $urlparam = 'vendor=' . $this->vendor_id . '&product=' . $this->product_id . '&key=' . $this->payment_key . '&tariff=' . $this->tariff_id; + $urlparam .= '&auth_code=' . $this->auth_code . '&status=100&tid=' . $_POST['tid'] . '&vwz2=' . MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_ORDERNO . '' . $insert_id . '&vwz3=' . MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_ORDERDATE . '' . date('Y-m-d H:i:s') . '&order_no=' . $insert_id; + list($errno, $errmsg, $data) = $this->perform_https_request($url, $urlparam); + + if ($errno or $errmsg) { + ### Payment Gateway Error ### + $order->info['comments'] .= '. func perform_https_request returned Errorno : ' . $errno . ', Error Message : ' . $errmsg; + $payment_error_return = 'payment_error=' . $this->code . '&error=' . $errmsg . '(' . $errno . ')'; + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + + unset($_SESSION['nn_tid']); + } + #print "$customer_id, $insert_id"; exit; + ### Implement here the Emailversand and further functions, incase if you want to send a own email ### + + return false; + } + + ### Used to display error message details ### + // @return array + + function get_error() { + global $HTTP_GET_VARS, $_GET; + if (count($HTTP_GET_VARS) == 0 || $HTTP_GET_VARS == '') + $HTTP_GET_VARS = $_GET; + + #$error = array('title' => MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_ERROR, + # 'error' => stripslashes(urldecode($HTTP_GET_VARS['error']))); + #print $HTTP_GET_VARS['error']; exit; + $error = array('title' => MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_ERROR, 'error' => stripslashes(utf8_decode($HTTP_GET_VARS['error']))); + + return $error; + } + + ### Check to see whether module is installed ### + // @return boolean + + function check() { + global $db; + if (!isset($this->_check)) { + $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_NOVALNET_PAYPAL_STATUS'"); + $this->_check = $check_query->RecordCount(); + } + return $this->_check; + } + + function install_lang($field_text, $lang) { #Allowed Zones + $install_text['allowed_title'] = array('en' => "Allowed zones", + 'de' => "erlaubte Zonen"); + $install_text['allowed_desc'] = array('en' => "Please enter the desired zones separated by comma (Eg: AT, DE) or leave it blank", + 'de' => "Bitte die gewünschten Zonen durch Komma getrennt eingeben (z.B: AT,DE) oder einfach leer lassen"); + #Enable Module + $install_text['enable_title'] = array('en' => "Enable Module", + 'de' => "Modul aktivieren"); + $install_text['enable_desc'] = array('en' => "Do you want to activate the Credit Card of Novalnet AG?", + 'de' => "Wollen Sie das Kreditkarten Modul des Novalnet AG aktivieren?"); + #Test Mode + $install_text['test_title'] = array('en' => "Enable Test Mode:", + 'de' => "Testmodus einschalten"); + $install_text['test_desc'] = array('en' => "Do you want to activate test mode?", + 'de' => "Wollen Sie den Test-Modus aktivieren?"); + #Vendor id + $install_text['vendor_title'] = array('en' => "Novalnet Merchant ID", + 'de' => "Novalnet Händler ID"); + $install_text['vendor_desc'] = array('en' => "Enter your Novalnet Merchant ID ", + 'de' => "Geben Sie Ihre Novalnet Händler-ID ein "); + #Auth Code + $install_text['auth_title'] = array('en' => "Novalnet Merchant Authorisation Code", + 'de' => "Novalnet Authorisierungsschlüssel"); + $install_text['auth_desc'] = array('en' => "Enter your Novalnet Merchant Authorisation code ", + 'de' => "Geben Sie Ihren Novalnet-Authorisierungsschlüssel ein"); + + #Product id + $install_text['product_title'] = array('en' => "Novalnet Product ID", + 'de' => "Novalnet Produkt ID"); + $install_text['product_desc'] = array('en' => "Enter your Novalnet Product ID", + 'de' => "Geben Sie Ihre Novalnet Produkt-ID ein"); + + #Tariff id + $install_text['tariff_title'] = array('en' => "Novalnet Tariff ID", + 'de' => "Novalnet Tarif ID"); + $install_text['tariff_desc'] = array('en' => "Enter your Novalnet Tariff ID ", + 'de' => "Geben Sie Ihre Novalnet Tarif-ID ein"); + + #Enduser info + $install_text['enduser_title'] = array('en' => "Information to the end customer", + 'de' => "Informationen für den Endkunden"); + $install_text['enduser_desc'] = array('en' => "will appear in the payment form", + 'de' => "wird im Bezahlformular erscheinen"); + + #Sortorder display + $install_text['sortorder_title'] = array('en' => "Sort order of display", + 'de' => "Sortierung nach"); + $install_text['sortorder_desc'] = array('en' => "Sort order of display. Lowest is displayed first.", + 'de' => "Sortierung der Anzeige. Der niedrigste Wert wird zuerst angezeigt."); + + #Setorder status display + $install_text['setorderstatus_title'] = array('en' => "Set Order Status", + 'de' => "Bestellungsstatus setzen"); + $install_text['setorderstatus_desc'] = array('en' => "Set the status of orders made with this payment module to this value.", + 'de' => "Setzen Sie den Status von über dieses Zahlungsmodul durchgeführten Bestellungen auf diesen Wert."); + + #Proxy + $install_text['proxy_title'] = array('en' => "Proxy-Server", + 'de' => "Proxy-Server"); + $install_text['proxy_desc'] = array('en' => " If you use a Proxy Server, enter the Proxy Server IP with port here (e.g. www.proxy.de:80).", + 'de' => "Wenn Sie einen Proxy-Server einsetzen, tragen Sie hier Ihre Proxy-IP und den Port ein (z.B. www.proxy.de:80)."); + + #Payment Zone + $install_text['paymnetzone_title'] = array('en' => "Payment Zone", + 'de' => "Zahlungsgebiet"); + $install_text['paymnetzone_desc'] = array('en' => "If a zone is selected then this module is activated only for Selected zone. ", + 'de' => "Wird ein Bereich ausgewählt, dann wird dieses Modul nur für den ausgewählten Bereich aktiviert."); + + #Novalnet Password + $install_text['password_title'] = array('en' => "Novalnet Password", + 'de' => "Novalnet Passwort"); + $install_text['password_desc'] = array('en' => "Enter your Novalnet Password.", + 'de' => "Geben Sie Ihr Novalnet Passwort ein."); + + #Activate Logo Mode + $install_text['logo_title'] = array('en' => "Activate logo mode:", + 'de' => "Aktivieren Sie Logo Modus:"); + $install_text['logo_desc'] = array('en' => "Do you want to activate logo mode?", + 'de' => "Wollen Sie Logo-Modus zu aktivieren?"); + + #Paypal Api user name + $install_text['paypalusername_title'] = array('en' => "PayPal API User Name", + 'de' => "PayPal API Benutzername"); + $install_text['paypalusername_desc'] = array('en' => "Please enter your PayPal API username", + 'de' => "Geben Sie Ihren PayPal API Benutzernamen ein"); + + + #Paypal Api password + $install_text['paypalpassword_title'] = array('en' => "PayPal API Password", + 'de' => "PayPal API Passwort"); + $install_text['paypalpassword_desc'] = array('en' => "Please enter your PayPal API password", + 'de' => "Geben Sie Ihr PayPal API Passwort ein"); + + + #Paypal Api signature + $install_text['paypalsign_title'] = array('en' => "PayPal API Signature", + 'de' => "PayPal API Signatur"); + $install_text['paypalsign_desc'] = array('en' => "Please enter your PayPal API signature", + 'de' => "Geben Sie Ihre PayPal API Signatur ein"); + + + return $install_text[$field_text][$lang]; + } + + ### Install the payment module and its configuration settings ### + + function install() { + global $db; + + $allowed_title = $this->install_lang('allowed_title', DEFAULT_LANGUAGE); + $allowed_desc = $this->install_lang('allowed_desc', DEFAULT_LANGUAGE); + + $enable_title = $this->install_lang('enable_title', DEFAULT_LANGUAGE); + $enable_desc = $this->install_lang('enable_desc', DEFAULT_LANGUAGE); + + $test_title = $this->install_lang('test_title', DEFAULT_LANGUAGE); + $test_desc = $this->install_lang('test_desc', DEFAULT_LANGUAGE); + + $vendor_title = $this->install_lang('vendor_title', DEFAULT_LANGUAGE); + $vendor_desc = $this->install_lang('vendor_desc', DEFAULT_LANGUAGE); + + $auth_title = $this->install_lang('auth_title', DEFAULT_LANGUAGE); + $auth_desc = $this->install_lang('auth_desc', DEFAULT_LANGUAGE); + + $product_title = $this->install_lang('product_title', DEFAULT_LANGUAGE); + $product_desc = $this->install_lang('product_desc', DEFAULT_LANGUAGE); + + $tariff_title = $this->install_lang('tariff_title', DEFAULT_LANGUAGE); + $tariff_desc = $this->install_lang('tariff_desc', DEFAULT_LANGUAGE); + + $enduser_title = $this->install_lang('enduser_title', DEFAULT_LANGUAGE); + $enduser_desc = $this->install_lang('enduser_desc', DEFAULT_LANGUAGE); + + $sortorder_title = $this->install_lang('sortorder_title', DEFAULT_LANGUAGE); + $sortorder_desc = $this->install_lang('sortorder_desc', DEFAULT_LANGUAGE); + + $setorderstatus_title = $this->install_lang('setorderstatus_title', DEFAULT_LANGUAGE); + $setorderstatus_desc = $this->install_lang('setorderstatus_desc', DEFAULT_LANGUAGE); + + $proxy_title = $this->install_lang('proxy_title', DEFAULT_LANGUAGE); + $proxy_desc = $this->install_lang('proxy_desc', DEFAULT_LANGUAGE); + + $paymnetzone_title = $this->install_lang('paymnetzone_title', DEFAULT_LANGUAGE); + $paymnetzone_desc = $this->install_lang('paymnetzone_desc', DEFAULT_LANGUAGE); + + $password_title = $this->install_lang('password_title', DEFAULT_LANGUAGE); + $password_desc = $this->install_lang('password_desc', DEFAULT_LANGUAGE); + + $logo_title = $this->install_lang('logo_title', DEFAULT_LANGUAGE); + $logo_desc = $this->install_lang('logo_desc', DEFAULT_LANGUAGE); + + $paypalusername_title = $this->install_lang('paypalusername_title', DEFAULT_LANGUAGE); + $paypalusername_desc = $this->install_lang('paypalusername_desc', DEFAULT_LANGUAGE); + + $paypalpassword_title = $this->install_lang('paypalpassword_title', DEFAULT_LANGUAGE); + $paypalpassword_desc = $this->install_lang('paypalpassword_desc', DEFAULT_LANGUAGE); + + $paypalsign_title = $this->install_lang('paypalsign_title', DEFAULT_LANGUAGE); + $paypalsign_desc = $this->install_lang('paypalsign_desc', DEFAULT_LANGUAGE); + + /* $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$allowed_title."', 'MODULE_PAYMENT_NOVALNET_PAYPAL_ALLOWED', '', '".$allowed_desc."', '6', '0', now())"); */ + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('" . $enable_title . "', 'MODULE_PAYMENT_NOVALNET_PAYPAL_STATUS', 'True', '" . $enable_desc . "', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('" . $test_title . "', 'MODULE_PAYMENT_NOVALNET_PAYPAL_TEST_MODE', 'True', '" . $test_desc . "', '6', '1', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $vendor_title . "', 'MODULE_PAYMENT_NOVALNET_PAYPAL_VENDOR_ID', '', '" . $vendor_desc . "', '6', '2', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $auth_title . "', 'MODULE_PAYMENT_NOVALNET_PAYPAL_AUTH_CODE', '', '" . $auth_desc . "', '6', '3', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $product_title . "', 'MODULE_PAYMENT_NOVALNET_PAYPAL_PRODUCT_ID', '', '" . $product_desc . "', '6', '4', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $tariff_title . "', 'MODULE_PAYMENT_NOVALNET_PAYPAL_TARIFF_ID', '', '" . $tariff_desc . "', '6', '5', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $password_title . "', 'MODULE_PAYMENT_NOVALNET_PAYPAL_PASSWORD', '', '" . $password_desc . "', '6', '6', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $enduser_title . "', 'MODULE_PAYMENT_NOVALNET_PAYPAL_INFO', '', '" . $enduser_desc . "', '6', '7', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $sortorder_title . "', 'MODULE_PAYMENT_NOVALNET_PAYPAL_SORT_ORDER', '0', '" . $sortorder_desc . "', '6', '8', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('" . $setorderstatus_title . "', 'MODULE_PAYMENT_NOVALNET_PAYPAL_ORDER_STATUS_ID', '0', '" . $setorderstatus_desc . "', '6', '9', 'zen_cfg_pull_down_order_statuses(', 'zen_get_order_status_name', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('" . $paymnetzone_title . "', 'MODULE_PAYMENT_NOVALNET_PAYPAL_ZONE', '0', '" . $paymnetzone_desc . "', '6', '10', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $proxy_title . "', 'MODULE_PAYMENT_NOVALNET_PAYPAL_PROXY', '', '" . $proxy_desc . "', '6', '11', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $paypalusername_title . "','MODULE_PAYMENT_NOVALNET_PAYPAL_API_USER', '','" . $paypalusername_desc . "','6', '12', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $paypalpassword_title . "','MODULE_PAYMENT_NOVALNET_PAYPAL_API_PASSWORD', '','" . $paypalpassword_desc . "','6', '13', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $paypalsign_title . "','MODULE_PAYMENT_NOVALNET_PAYPAL_API_SIGNATURE', '','" . $paypalsign_desc . "','6', '14', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('" . $logo_title . "', 'MODULE_PAYMENT_NOVALNET_PAYPAL_LOGO_STATUS', 'True', '" . $logo_desc . "', '6', '15', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + } + + ### Remove the module and all its settings ### + + function remove() { + global $db; + $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); + } + + ### Internal list of configuration keys used for configuration of the module ### + // @return array + + function keys() { + return array('MODULE_PAYMENT_NOVALNET_PAYPAL_LOGO_STATUS','MODULE_PAYMENT_NOVALNET_PAYPAL_STATUS', + 'MODULE_PAYMENT_NOVALNET_PAYPAL_TEST_MODE', 'MODULE_PAYMENT_NOVALNET_PAYPAL_VENDOR_ID', 'MODULE_PAYMENT_NOVALNET_PAYPAL_AUTH_CODE', 'MODULE_PAYMENT_NOVALNET_PAYPAL_PRODUCT_ID', 'MODULE_PAYMENT_NOVALNET_PAYPAL_TARIFF_ID', 'MODULE_PAYMENT_NOVALNET_PAYPAL_INFO', 'MODULE_PAYMENT_NOVALNET_PAYPAL_SORT_ORDER', 'MODULE_PAYMENT_NOVALNET_PAYPAL_ORDER_STATUS_ID', 'MODULE_PAYMENT_NOVALNET_PAYPAL_ZONE', 'MODULE_PAYMENT_NOVALNET_PAYPAL_PASSWORD', 'MODULE_PAYMENT_NOVALNET_PAYPAL_PROXY', 'MODULE_PAYMENT_NOVALNET_PAYPAL_API_USER', 'MODULE_PAYMENT_NOVALNET_PAYPAL_API_PASSWORD', 'MODULE_PAYMENT_NOVALNET_PAYPAL_API_SIGNATURE'); + } + + /* + Bestellstatus "abgebrochen" + + wähle den Bestellstatus für ein abgebrochenen Aktion aus (z.B. PayPal Abbruch) + Bestellstatus OK + + wähle den Bestellstatus für eine erfolgreiche Transaktion aus (z.B. Offen PP bezahlt) + Bestellstatus "in Bearbeitung" + + wähle den Bestellstatus für eine Transaktion aus, die noch nicht von PayPal bearbeitet wurde (z.B. Offen PP wartend) + Bestellstatus "abgewiesen" + */ + + function html_to_utf8($data) { + #$data = utf8_encode($data); + return preg_replace("/\\&\\#([0-9]{3,10})\\;/e", '$this->_html_to_utf8("\\1")', $data); + } + + function _html_to_utf8($data) { + if ($data > 127) { + $i = 5; + while (($i--) > 0) { + if ($data != ($a = $data % ($p = pow(64, $i)))) { + $ret = chr(base_convert(str_pad(str_repeat(1, $i + 1), 8, "0"), 2, 10) + (($data - $a) / $p)); + for ($i; $i > 0; $i--) + $ret .= chr(128 + ((($data % pow(64, $i)) - ($data % ($p = pow(64, $i - 1)))) / $p)); + break; + } + } + } else { + #$this->debug2("&#$data;"); + $ret = "&#$data;"; + } + return $ret; + } + + function debug2($text) { + $fh = fopen('/tmp/debug2.txt', 'a+'); + if (gettype($text) == 'class' or gettype($text) == 'array') { + $text = serialize($text); + fwrite($fh, $text); + } else { + fwrite($fh, date('H:i:s ') . $text . "\n"); + } + fclose($fh); + } + + function getAmount($amount) { + if (!$amount) + $amount = $order->info['total']; + if (preg_match('/[,.]$/', $amount)) { + $amount = $amount . '00'; + } else if (preg_match('/[,.][0-9]$/', $amount)) { + $amount = $amount . '0'; + } + $amount = str_replace(array('.', ','), array('', ''), $amount); + return$amount; + } + + function isPublicIP($value) { + if (!$value || count(explode('.', $value)) != 4) + return false; + return !preg_match('~^((0|10|172\.16|192\.168|169\.254|255|127\.0)\.)~', $value); + } + + ### get the real Ip Adress of the User ### + + function getRealIpAddr() { + if ($this->isPublicIP($_SERVER['HTTP_X_FORWARDED_FOR'])) + return $_SERVER['HTTP_X_FORWARDED_FOR']; + if ($iplist = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR'])) { + if ($this->isPublicIP($iplist[0])) + return $iplist[0]; + } + if ($this->isPublicIP($_SERVER['HTTP_CLIENT_IP'])) + return $_SERVER['HTTP_CLIENT_IP']; + if ($this->isPublicIP($_SERVER['HTTP_X_CLUSTER_CLIENT_IP'])) + return $_SERVER['HTTP_X_CLUSTER_CLIENT_IP']; + if ($this->isPublicIP($_SERVER['HTTP_FORWARDED_FOR'])) + return $_SERVER['HTTP_FORWARDED_FOR']; + + return $_SERVER['REMOTE_ADDR']; + } + + ### replace the Special German Charectors ### + + function ReplaceSpecialGermanChars($string) { + $what = array("ä", "ö", "ü", "Ä", "Ö", "Ãœ", "ß"); + $how = array("ae", "oe", "ue", "Ae", "Oe", "Ue", "ss"); + + $string = str_replace($what, $how, $string); + + return $string; + } + + function getParams4paypal() { + if (count($HTTP_POST_VARS) == 0 || $HTTP_POST_VARS == '') + $HTTP_POST_VARS = $_POST; + /* for paypal via www.paypal.com + required params: + project_id= must be registred at via www.sofortueberweisung.de + user_id = Kundennr. ($_SESSION['nn_tid']) + + optional params: + Parameter Bedeutung Typ (Länge) Erklärung + amount Betrag Double (8,2) Der zu überweisende Betrag (Minimum: 0.10 EURO, wichtig für Testbestellungen) Bitte keine Trennzeichen bei Tausender-Beträgen, z.B. 1010.50 Euro, correct: + + reason_1 Verwendungszweck1 String (27) Der Verwendungszweck in Zeile 1 (max. 27 Zeichen). Dieser sollte bei jeder Bestellung unterschiedliche Zuordnungsmerkmale aufweisen (z.B. Bestellnummer, Datum der Bestellung) und ist damit eindeutig. + + reason_2 + + sender_bank_code Bankleitzahl des Kunden String (30) Absender-Bankleitzahl + sender_account_number Kontonummer des Kunden String (30) Absender-Kontonummer + sender_holder Kontoinhaber des Kunden String (27) Absender-Kontoinhaber + sender_country_id Kontoinhaber Länderkürzel String (2) Absender-Land(zweistellig,z.B. DE, CH, AT) + hash Hash-Wert String (>=32) Input-Prüfung, siehe Kapitel 3.2.5 + currency_id Transaktionswährung String (3) Werte sind EUR, CHF und GBP* (* Voraussetzung: englischesKonto) + language_id Sprache des Zahlformulars String (2) Legen Sie mit diesem Parameter die Sprache des Zahlformulars fest, Werte, z.B. DE, EN + + user_variable_0 bis user_variable_5 Kundenvariable 0-5 String (255) Zu Ihrer freien Verwendung (z.B. Session-ID) + + #to deposit at www.sofortueberweisung.de: + Erfolgslink: http://xtcom.gsoftpro.de/checkout_process.php + Abbruchlink: http://xtcom.gsoftpro.de/.php + + ####Plausicheck error von XT: + http://localhost/xtcommerce/checkout_payment.php?payment_error=novalnet_paypal&error=*+Deutsche+Kontonummer+muss+mindestens+3+stellig+sein! + ####wrong bank code error von Novalnet: + http://localhost/xtcommerce/checkout_payment.php?payment_error=novalnet_paypal&error=Die+angegebene+Bankleitzahl+gibt+es+nicht+%28501007%29 + http://xtcom.gsoftpro.de/checkout_payment.php?payment_error=novalnet_paypal&error=zh + ####sucess + */ + //$params = zen_draw_hidden_field('user_variable_0', (str_replace(array('http://', 'www.'), array('', ''), HTTP_SERVER))); + $params = zen_draw_hidden_field('user_variable_0', HTTP_SERVER); + return $params; + #this link is stored at www.soforueberweisung.de: https://payport.novalnet.de/online_transfer_payport?status=ok&customer_id=-CUSTOMER_ID-&transaction=-TRANSACTION-&sender_holder=-SENDER_HOLDER-&sender_holder_urlencode=-SENDER_HOLDER_URLENCODE-&sender_account_number=-SENDER_ACCOUNT_NUMBER-&sender_bank_code=-SENDER_BANK_CODE-&sender_bank_name=-SENDER_BANK_NAME-&sender_bank_name_urlencode=-SENDER_BANK_NAME_URLENCODE-&sender_bank_bic=-SENDER_BANK_BIC-&sender_iban=-SENDER_IBAN-&user_variable_0=-USER_VARIABLE_0- + } + + ### Realtime accesspoint for communication to the Novalnet paygate ### + + function perform_https_request($nn_url, $urlparam) { + $debug = 0; #set it to 1 if you want to activate the debug mode + + if ($debug) + print "
perform_https_request: $nn_url
\n\r\n"; + if ($debug) + print "perform_https_request: $urlparam
\n\r\n"; + + ## some prerquisites for the connection + $ch = curl_init($nn_url); + curl_setopt($ch, CURLOPT_POST, 1); // a non-zero parameter tells the library to do a regular HTTP post. + curl_setopt($ch, CURLOPT_POSTFIELDS, $urlparam); // add POST fields + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); // don't allow redirects + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // decomment it if you want to have effective ssl checking + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // decomment it if you want to have effective ssl checking + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable + curl_setopt($ch, CURLOPT_TIMEOUT, 240); // maximum time, in seconds, that you'll allow the CURL functions to take + if ($this->proxy) { + curl_setopt($ch, CURLOPT_PROXY, $this->proxy); + } + + ## establish connection + $data = curl_exec($ch); + //$data = $this->ReplaceSpecialGermanChars($data); + + ## determine if there were some problems on cURL execution + $errno = curl_errno($ch); + $errmsg = curl_error($ch); + + ###bug fix for PHP 4.1.0/4.1.2 (curl_errno() returns high negative value in case of successful termination) + if ($errno < 0) + $errno = 0; + ##bug fix for PHP 4.1.0/4.1.2 + + if ($debug) { + print_r(curl_getinfo($ch)); + echo "\n

\n\n\nperform_https_request: cURL error number:" . $errno . "\n
\n\n"; + echo "\n\n\nperform_https_request: cURL error:" . $errmsg . "\n
\n\n"; + } + + #close connection + curl_close($ch); + + ## read and return data from novalnet paygate + if ($debug) + print "
\n\n" . $data . "\n
\n\n"; + + return array($errno, $errmsg, $data); + } + + function encode($data) { + $data = trim($data); + if ($data == '') + return'Error: no data'; + if (!function_exists('base64_encode') or !function_exists('pack') or !function_exists('crc32')) { + return'Error: func n/a'; + } + + try { + $crc = sprintf('%u', crc32($data)); # %u is a must for ccrc32 returns a signed value + $data = $crc . "|" . $data; + $data = bin2hex($data . $this->key); + $data = strrev(base64_encode($data)); + } catch (Exception $e) { + echo('Error: ' . $e); + } + return $data; + } + + function decode($data) { + $data = trim($data); + if ($data == '') { + return'Error: no data'; + } + if (!function_exists('base64_decode') or !function_exists('pack') or !function_exists('crc32')) { + return'Error: func n/a'; + } + + try { + $data = base64_decode(strrev($data)); + $data = pack("H" . strlen($data), $data); + $data = substr($data, 0, stripos($data, $this->key)); + $pos = strpos($data, "|"); + if ($pos === false) { + return("Error: CKSum not found!"); + } + $crc = substr($data, 0, $pos); + $value = trim(substr($data, $pos + 1)); + if ($crc != sprintf('%u', crc32($value))) { + return("Error; CKSum invalid!"); + } + return $value; + } catch (Exception $e) { + echo('Error: ' . $e); + } + } + + function hash($h) {#$h contains encoded data + global $amount_zh; + if (!$h) + return'Error: no data'; + if (!function_exists('md5')) { + return'Error: func n/a'; + } + return md5($h['auth_code'] . $h['product_id'] . $h['tariff'] . $h['amount'] . $h['test_mode'] . $h['uniqid'] . strrev($this->key)); + } + + function checkHash($request) { + if (!$request) + return false;#'Error: no data'; + $h['auth_code'] = $request['auth_code']; #encoded + $h['product_id'] = $request['product']; #encoded + $h['tariff'] = $request['tariff']; #encoded + $h['amount'] = $request['amount']; #encoded + $h['test_mode'] = $request['test_mode']; #encoded + $h['uniqid'] = $request['uniqid']; #encoded + //print $request['hash2']."
". $this->hash($h);exit; + if ($request['hash2'] != $this->hash($h)) { + return false; + } + return true; + } + + function checkHash4java($request) { + if (!$request) + return false;#'Error: no data'; + $h['auth_code'] = $request['auth_code']; #encoded + $h['product_id'] = $request['product_id']; #encoded + $h['tariff'] = $request['tariff_id']; #encoded + $h['amount'] = $request['amount']; #encoded + $h['test_mode'] = $request['test_mode']; #encoded + $h['uniqid'] = $request['uniqid']; #encoded + + if ($request['hash2'] != $this->hash($h)) { + return false; + } + return true; + } + + function encode4java($data = '', $func = '') { + $salt = 1010; + if (!isset($data) or trim($data) == '' or !$func) { + return'Error: missing arguments: $str and/or $func!'; + } + if ($func != 'decbin' and $func != 'bindec') { + return'Error: $func has wrong value!'; + } + if ($func == 'decbin') { + return decbin(intval($data) + intval($salt)); + } else { + return bindec($data) - intval($salt); + } + } + +} + +?> diff --git a/includes/modules/payment/novalnet_prepayment.php b/includes/modules/payment/novalnet_prepayment.php new file mode 100644 index 0000000..5175375 --- /dev/null +++ b/includes/modules/payment/novalnet_prepayment.php @@ -0,0 +1,749 @@ +blnDebug) { + $this->debug2(__FUNCTION__); + } + + $this->vendor_id = trim(MODULE_PAYMENT_NOVALNET_PREPAYMENT_VENDOR_ID); + $this->auth_code = trim(MODULE_PAYMENT_NOVALNET_PREPAYMENT_AUTH_CODE); + $this->product_id = trim(MODULE_PAYMENT_NOVALNET_PREPAYMENT_PRODUCT_ID); + $this->tariff_id = trim(MODULE_PAYMENT_NOVALNET_PREPAYMENT_TARIFF_ID); + $this->test_mode = (strtolower(MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEST_MODE) == 'true' or MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEST_MODE == '1') ? 1 : 0; + + $this->code = 'novalnet_prepayment'; + $this->title = MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_TITLE; + $this->public_title = MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_PUBLIC_TITLE; + $this->description = MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_DESCRIPTION; + $this->sort_order = MODULE_PAYMENT_NOVALNET_PREPAYMENT_SORT_ORDER; + $this->enabled = ((MODULE_PAYMENT_NOVALNET_PREPAYMENT_STATUS == 'True') ? true : false); + $this->proxy = MODULE_PAYMENT_NOVALNET_PREPAYMENT_PROXY; + + + if (MODULE_PAYMENT_NOVALNET_PREPAYMENT_LOGO_STATUS == 'True') { + $this->public_title = 'Novalnet'.' '. MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_PUBLIC_TITLE; + $this->title = 'Novalnet'.' '.MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_TITLE; + } + $this->checkConfigure(); + + if ((int) MODULE_PAYMENT_NOVALNET_PREPAYMENT_ORDER_STATUS_ID > 0) { + $this->order_status = MODULE_PAYMENT_NOVALNET_PREPAYMENT_ORDER_STATUS_ID; + } + + if (is_object($order)) + $this->update_status(); + } + + function checkConfigure() { + if (IS_ADMIN_FLAG == true) { + $this->title = MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_TITLE; // Payment module title in Admin + if (MODULE_PAYMENT_NOVALNET_PREPAYMENT_LOGO_STATUS == 'True') { + $this->title = 'Novalnet'.' '.MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_TITLE; + } + if ($this->enabled == 'true' && (!$this->vendor_id || !$this->auth_code || !$this->product_id || !$this->tariff_id )) { + $this->title .= '' . MODULE_PAYMENT_NOVALNET_PREPAYMENT_NOT_CONFIGURED . ''; + } elseif ($this->test_mode == '1') { + $this->title .= '' . MODULE_PAYMENT_NOVALNET_PREPAYMENT_IN_TEST_MODE . ''; + } + } + } + + ### calculate zone matches and flag settings to determine whether this module should display to customers or not ### + + function update_status() { + global $order, $db; + if ($this->blnDebug) { + $this->debug2(__FUNCTION__); + } + + if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_PREPAYMENT_ZONE > 0)) { + $check_flag = false; + $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_NOVALNET_PREPAYMENT_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id"); + while (!$check->EOF) { + if ($check->fields['zone_id'] < 1) { + $check_flag = true; + break; + } elseif ($check->fields['zone_id'] == $order->billing['zone_id']) { + $check_flag = true; + break; + } + $check->MoveNext(); + } + + if ($check_flag == false) { + $this->enabled = false; + } + } + } + + ### JS validation which does error-checking of data-entry if this module is selected for use ### + ### the fields to be cheked are (Bank Owner, Bank Account Number and Bank Code Lengths) ### + ### currently this function is not in use ### + // @return string + + function javascript_validation() { + if ($this->blnDebug) { + $this->debug2(__FUNCTION__); + } + return false; + } + + ### Builds set of input fields for collecting Bankdetail info ### + // @return array + + function selection() { + global $xtPrice, $order, $HTTP_POST_VARS, $_POST; + if ($this->blnDebug) { + $this->debug2(__FUNCTION__); + } + + $onFocus = ''; + if (count($HTTP_POST_VARS) == 0 || $HTTP_POST_VARS == '') + $HTTP_POST_VARS = $_POST; + + + $selection = array('id' => $this->code, + 'module' => $this->public_title, + 'fields' => array(array('title' => '', 'field' => MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_BANK_INFO), + array('title' => '', 'field' => MODULE_PAYMENT_NOVALNET_PREPAYMENT_INFO) + )); + + if (function_exists('get_percent')) { + $selection['module_cost'] = $GLOBALS['ot_payment']->get_percent($this->code); + } + + return $selection; + } + + ### Precheck to Evaluate the Bank Datas ### + + function pre_confirmation_check() { + global $HTTP_POST_VARS, $_POST, $messageStack; + if ($this->blnDebug) { + $this->debug2(__FUNCTION__); + } + + if (count($HTTP_POST_VARS) == 0 || $HTTP_POST_VARS == '') + $HTTP_POST_VARS = $_POST; + #var_dump($HTTP_POST_VARS); exit; + + $error = ''; + + if (!function_exists('curl_init') && ($this->_code == 'novalnet_prepayment')) { + ini_set('display_errors', 1); + ini_set('error_reporting', E_ALL); + + $error = MODULE_PAYMENT_NOVALNET_PREPAYMENT_CURL_MESSAGE; + } + + + if (!$this->vendor_id || !$this->auth_code || !$this->product_id || !$this->tariff_id) { + $error = MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_JS_NN_MISSING; + } + + if ($error != '') { + $payment_error_return = 'payment_error=' . $this->code; + $messageStack->add_session('checkout_payment', $error . '', 'error'); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + } + + ### Display Bank Information on the Checkout Confirmation Page ### + // @return array + + function confirmation() { + global $HTTP_POST_VARS, $_POST, $order; + $_SESSION['nn_total'] = $order->info['total']; + if ($this->blnDebug) { + $this->debug2(__FUNCTION__); + } + if (count($HTTP_POST_VARS) == 0 || $HTTP_POST_VARS == '') + $HTTP_POST_VARS = $_POST; + + $confirmation = array('fields' => array(array('title' => '', 'field' => ''))); + + return $confirmation; + } + + ### Build the data and actions to process when the "Submit" button is pressed on the order-confirmation screen. ### + ### These are hidden fields on the checkout confirmation page ### + // @return string + + function process_button() { + global $HTTP_POST_VARS, $_POST; + if ($this->blnDebug) { + $this->debug2(__FUNCTION__); + } + if (count($HTTP_POST_VARS) == 0 || $HTTP_POST_VARS == '') + $HTTP_POST_VARS = $_POST; + + return $process_button_string; + } + + ### Store the BANK info to the order ### + ### This sends the data to the payment gateway for processing and Evaluates the Bankdatas for acceptance and the validity of the Bank Details ### + + function before_process() { + global $HTTP_POST_VARS, $_POST, $order, $xtPrice, $currencies, $customer_id, $db, $messageStack; + if ($this->blnDebug) { + $this->debug2(__FUNCTION__); + } + + if (count($HTTP_POST_VARS) == 0 || $HTTP_POST_VARS == '') + $HTTP_POST_VARS = $_POST; + + #Get the required additional customer details from DB + $nn_customer_id = (isset($_SESSION['customer_id'])) ? $_SESSION['customer_id'] : ''; + $customer = $db->Execute("SELECT customers_gender, customers_dob, customers_fax FROM " . TABLE_CUSTOMERS . " WHERE customers_id='" . (int) $nn_customer_id . "'"); + + if ($customer->RecordCount() > 0) { + $customer = $customer->fields; + } + list($customer['customers_dob'], $extra) = explode(' ', $customer['customers_dob']); + + ### Process the payment to paygate ## + $url = 'https://payport.novalnet.de/paygate.jsp'; + +// $amount = $_SESSION['nn_total']; + + if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status_add_tax_ot'] == 1) { + $totalamount = $order->info['total'] + $order->info['tax']; + } else { + $totalamount = $order->info['total']; + } + $orig_amount = $totalamount; + $totalamount = number_format($totalamount * $currencies->get_value($order->info['currency']), 2); + $amount = str_replace(',', '', $totalamount); + $amount = intval(round($amount * 100)); + + // $p_amount =sprintf('%.2f', $totalamount); + // $amount = number_format($p_amount * $currencies->currencies['EUR']['value'], $currencies->currencies['EUR']['decimal_places']); + + + if (preg_match('/[^\d\.]/', $amount) or !$amount) { + ### $amount contains some unallowed chars or empty ### + $err = '$amount (' . $amount . ') is empty or has a wrong format'; + $order->info['comments'] .= 'Novalnet Error Message : ' . $err; + $payment_error_return = 'payment_error=' . $this->code; + $messageStack->add_session('checkout_payment', $err . '', 'error'); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + //$amount = preg_replace('/^0+/', '', $amount); + //$amount = sprintf('%0.2f', $amount); + //$amount = str_replace('.', '', $amount); + #echo __CLASS__.' : '.$order->info['total']." <=> $amount
";exit; + + /* $product_id = MODULE_PAYMENT_NOVALNET_PREPAYMENT_PRODUCT_ID; + $tariff_id = MODULE_PAYMENT_NOVALNET_PREPAYMENT_TARIFF_ID; */ + + $vendor_id = $this->vendor_id; + $auth_code = $this->auth_code; + $product_id = $this->product_id; + $tariff_id = $this->tariff_id; + + $user_ip = $this->getRealIpAddr(); + + $firstname = !empty($order->customer['firstname']) ? $order->customer['firstname'] : $order->billing['firstname']; + $lastname = !empty($order->customer['lastname']) ? $order->customer['lastname'] : $order->billing['lastname']; + $email_address = !empty($order->customer['email_address']) ? $order->customer['email_address'] : $order->billing['email_address']; + $street_address = !empty($order->customer['street_address']) ? $order->customer['street_address'] : $order->billing['street_address']; + $city = !empty($order->customer['city']) ? $order->customer['city'] : $order->billing['city']; + $postcode = !empty($order->customer['postcode']) ? $order->customer['postcode'] : $order->billing['postcode']; + $country_iso_code_2 = !empty($order->customer['country']['iso_code_2']) ? $order->customer['country']['iso_code_2'] : $order->billing['country']['iso_code_2']; + $customer_no = ($customer['customers_status'] != 1) ? $nn_customer_id : MODULE_PAYMENT_NOVALNET_PREPAYMENT_GUEST_USER; + + $urlparam = 'vendor=' . $vendor_id . '&product=' . $product_id . '&key=27&tariff=' . $tariff_id; + $urlparam .= '&auth_code=' . $auth_code . '¤cy=' . $order->info['currency']; + $urlparam .='&test_mode=' . $testmode; + $urlparam .= '&invoice_type=PREPAYMENT'; + $urlparam .= '&first_name=' . $firstname . '&last_name=' . $lastname; + $urlparam .= '&street=' . $street_address . '&city=' . $city . '&zip=' . $postcode; + $urlparam .= '&country=' . $country_iso_code_2 . '&email=' . $email_address; + $urlparam .= '&search_in_street=1&tel=' . $order->customer['telephone'] . '&remote_ip=' . $user_ip; + $urlparam .= '&gender=' . $customer['customers_gender'] . '&birth_date=' . $customer['customers_dob'] . '&fax=' . $customer['customers_fax']; + $urlparam .= '&language=' . MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_LANG; + $urlparam .= '&lang=' . MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_LANG; + $urlparam .= '&customer_no=' . $customer_no; + $urlparam .= '&use_utf8=1'; + $urlparam .= '&amount=' . $amount; + + #print str_replace('&', '
', "$urlparam"); exit; + list($errno, $errmsg, $data) = $this->perform_https_request($url, $urlparam); + + $aryResponse = array(); + #capture the result and message and other parameters from response data '$data' in an array + $aryPaygateResponse = explode('&', $data); + foreach ($aryPaygateResponse as $key => $value) { + if ($value != "") { + $aryKeyVal = explode("=", $value); + $aryResponse[$aryKeyVal[0]] = $aryKeyVal[1]; + } + } + + #Get the type of the comments field on TABLE_ORDERS + $customer = $db->Execute("SHOW FIELDS FROM " . TABLE_ORDERS_STATUS_HISTORY . " WHERE FIELD='comments'"); + if ($customer->RecordCount() > 0) { + $customer = $customer->fields; + } + if (strtolower($customer['Type']) != 'text') { + ### ALTER TABLE ORDERS modify the column comments ### + $db->Execute("ALTER TABLE " . TABLE_ORDERS_STATUS_HISTORY . " MODIFY comments text"); + } + + if ($aryResponse['status'] == 100) { + $_SESSION['nn_tid'] = $aryResponse['tid']; + //$old_comments = $order->info['comments']; + // $order->info['comments'] = ''; + //$amount = str_replace('.', ',', sprintf("%.2f", $amount/100)); + //$nn_amount = str_replace('.', ',', sprintf("%.2f", $amount/100)); + if ($this->order_status) { + $order->info['order_status'] = $this->order_status; + } + + if ($aryResponse['test_mode'] == 1) { + $order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEST_ORDER_MESSAGE . '
'; + } + + $transfer_info = utf8_encode(MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_TRANSFER_INFO); + $inrenationaltransfer_info = utf8_encode(MODULE_PAYMENT_NOVALNET_TEXT_DETAILS_PREPAYMENT_INTERNATIONAL_INFO); + $this->title = MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_TITLE; // Payment module title in Admin + if (MODULE_PAYMENT_NOVALNET_PREPAYMENT_LOGO_STATUS == 'True') { + $this->title = 'Novalnet'.' '.MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_TITLE; + } + $order->info['comments'] .= '
' . $this->title . ''; + $order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_PREPAYMENT_TID . ' ' . $aryResponse['tid'] . '
'; + $order->info['comments'] .= '
' . $transfer_info . ''; + $order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_BANK_ACCOUNT_OWNER . ' ' . MODULE_PAYMENT_NOVALNET_PREPAYMENT_NAME . ''; + $order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_BANK_ACCOUNT_NUMBER . ' ' . $aryResponse['invoice_account'] . ''; + $order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_BANK_CODE . ' ' . $aryResponse['invoice_bankcode'] . ''; + $order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_BANK_BANK . ' ' . $aryResponse['invoice_bankname'] . ' ' . $aryResponse['invoice_bankplace'] . ''; + //$order->info['comments'] .= ''.MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_AMOUNT.' '.$nn_amount.' '.$order->info['currency'].''; + $order->info['comments'] .= '' . MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_AMOUNT . ' ' . $currencies->format($orig_amount) . ''; + $order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_REFERENCE . ' ' . $aryResponse['tid'] . '
'; + $order->info['comments'] .= '
' . $inrenationaltransfer_info . ''; + $order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_BANK_IBAN . ' ' . $aryResponse['invoice_iban'] . ''; + $order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_BANK_BIC . ' ' . $aryResponse['invoice_bic'] . ''; + $order->info['comments'] .= '
' . MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_REFERENCE_INFO . ''; + //$order->info['comments'] .= $old_comments; + $order->info['comments'] = str_replace(array('', '', '
', '', '
', '
', '
', '
'), array('', '', '', '', "\n", "\n", "\n", "\n"), $order->info['comments']); + + + ### WRITE THE PREPAYMENT BANK DATA ON SESSION ### + $_SESSION['nn_invoice_account'] = $aryResponse['invoice_account']; + $_SESSION['nn_invoice_bankcode'] = $aryResponse['invoice_bankcode']; + $_SESSION['nn_invoice_iban'] = $aryResponse['invoice_iban']; + $_SESSION['nn_invoice_bic'] = $aryResponse['invoice_bic']; + $_SESSION['nn_invoice_bankname'] = $aryResponse['invoice_bankname']; + $_SESSION['nn_invoice_bankplace'] = $aryResponse['invoice_bankplace']; + } else { + ### Passing through the Error Response from Novalnet's paygate into order-info ### + $order->info['comments'] .= 'Novalnet Error Code : ' . $aryResponse['status'] . ', Novalnet Error Message : ' . $aryResponse['status_desc']; + + $payment_error_return = 'payment_error=' . $this->code; + $messageStack->add_session('checkout_payment', $aryResponse['status_desc'] . '', 'error'); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + + return; + } + + ### Realtime accesspoint for communication to the Novalnet paygate ### + + function perform_https_request($nn_url, $urlparam) { + if ($this->blnDebug) { + $this->debug2(__FUNCTION__); + } + $debug = 0; #set it to 1 if you want to activate the debug mode + + if ($debug) + print "
perform_https_request: $nn_url
\n\r\n"; + if ($debug) + print "perform_https_request: $urlparam
\n\r\n"; + + ## some prerquisites for the connection + $ch = curl_init($nn_url); + curl_setopt($ch, CURLOPT_POST, 1); // a non-zero parameter tells the library to do a regular HTTP post. + curl_setopt($ch, CURLOPT_POSTFIELDS, $urlparam); // add POST fields + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); // don't allow redirects + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // decomment it if you want to have effective ssl checking + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // decomment it if you want to have effective ssl checking + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable + curl_setopt($ch, CURLOPT_TIMEOUT, 240); // maximum time, in seconds, that you'll allow the CURL functions to take + if ($this->proxy) { + curl_setopt($ch, CURLOPT_PROXY, $this->proxy); + } + + ## establish connection + $data = curl_exec($ch); + //$data = $this->ReplaceSpecialGermanChars($data); + + ## determine if there were some problems on cURL execution + $errno = curl_errno($ch); + $errmsg = curl_error($ch); + + ###bug fix for PHP 4.1.0/4.1.2 (curl_errno() returns high negative value in case of successful termination) + if ($errno < 0) + $errno = 0; + ##bug fix for PHP 4.1.0/4.1.2 + + if ($debug) { + print_r(curl_getinfo($ch)); + echo "\n

\n\n\nperform_https_request: cURL error number:" . $errno . "\n
\n\n"; + echo "\n\n\nperform_https_request: cURL error:" . $errmsg . "\n
\n\n"; + } + + #close connection + curl_close($ch); + + ## read and return data from novalnet paygate + if ($debug) + print "
\n\n" . $data . "\n
\n\n"; + + return array($errno, $errmsg, $data); + } + + function isPublicIP($value) { + if (!$value || count(explode('.', $value)) != 4) + return false; + return !preg_match('~^((0|10|172\.16|192\.168|169\.254|255|127\.0)\.)~', $value); + } + + ### get the real Ip Adress of the User ### + + function getRealIpAddr() { + if ($this->isPublicIP($_SERVER['HTTP_X_FORWARDED_FOR'])) + return $_SERVER['HTTP_X_FORWARDED_FOR']; + if ($iplist = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR'])) { + if ($this->isPublicIP($iplist[0])) + return $iplist[0]; + } + if ($this->isPublicIP($_SERVER['HTTP_CLIENT_IP'])) + return $_SERVER['HTTP_CLIENT_IP']; + if ($this->isPublicIP($_SERVER['HTTP_X_CLUSTER_CLIENT_IP'])) + return $_SERVER['HTTP_X_CLUSTER_CLIENT_IP']; + if ($this->isPublicIP($_SERVER['HTTP_FORWARDED_FOR'])) + return $_SERVER['HTTP_FORWARDED_FOR']; + + return $_SERVER['REMOTE_ADDR']; + } + + ### replace the Special German Charectors ### + + function ReplaceSpecialGermanChars($string) { + $what = array("ä", "ö", "ü", "Ä", "Ö", "Ãœ", "ß"); + $how = array("ae", "oe", "ue", "Ae", "Oe", "Ue", "ss"); + + $string = str_replace($what, $how, $string); + + return $string; + } + + ### Send the order detail to Novalnet ### + + function after_process() { + global $order, $customer_id, $insert_id, $db; + if ($this->blnDebug) { + $this->debug2(__FUNCTION__); + } + + if ($_SESSION['nn_tid'] != '') { + ### Pass the Order Reference to paygate ## + $url = 'https://payport.novalnet.de/paygate.jsp'; + $urlparam = 'vendor=' . $this->vendor_id . '&product=' . $this->product_id . '&key=' . $this->payment_key . '&tariff=' . $this->tariff_id; + $urlparam .= '&auth_code=' . $this->auth_code . '&status=100&tid=' . $_SESSION['nn_tid'] . '&reference=BNR-' . $insert_id; + $urlparam .= '&order_no=' . $insert_id; + $urlparam .= "&invoice_ref=BNR-" . $this->product_id . "-" . $insert_id; + list($errno, $errmsg, $data) = $this->perform_https_request($url, $urlparam); + } + unset($_SESSION['nn_tid']); + + #print "$customer_id, $insert_id"; exit; + ### Implement here the Emailversand and further functions, incase if you want to send a own email ### + // $db->Execute("update ".TABLE_ORDERS_STATUS_HISTORY." set comments = '".$order->info['comments']."' , orders_status_id= '".$this->order_status."' where orders_id = '".$insert_id."'"); + // $db->Execute("update ".TABLE_ORDERS." set orders_status = '".$this->order_status."' where orders_id = '".$insert_id."'"); + + + return false; + } + + ### Used to display error message details ### + // @return array + + function get_error() { + global $HTTP_GET_VARS, $_GET; + if ($this->blnDebug) { + $this->debug2(__FUNCTION__); + } + if (count($HTTP_GET_VARS) == 0 || $HTTP_GET_VARS == '') + $HTTP_GET_VARS = $_GET; + + $error = array('title' => MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_ERROR, + 'error' => stripslashes(urldecode($HTTP_GET_VARS['error']))); + + return $error; + } + + ### Check to see whether module is installed ### + // @return boolean + + function check() { + global $db; + if ($this->blnDebug) { + $this->debug2(__FUNCTION__); + } + if (!isset($this->_check)) { + $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_NOVALNET_PREPAYMENT_STATUS'"); + $this->_check = $check_query->RecordCount(); + } + return $this->_check; + } + + function install_lang($field_text, $lang) { + + #Allowed Zones + $install_text['allowed_title'] = array('en' => "Allowed zones", + 'de' => "erlaubte Zonen"); + $install_text['allowed_desc'] = array('en' => "Please enter the desired zones separated by comma (Eg: AT, DE) or leave it blank", + 'de' => "Bitte die gewünschten Zonen durch Komma getrennt eingeben (z.B: AT,DE) oder einfach leer lassen"); + #Enable Module + $install_text['enable_title'] = array('en' => "Enable Module", + 'de' => "Modul aktivieren"); + $install_text['enable_desc'] = array('en' => "Do you want to activate the Credit Card of Novalnet AG?", + 'de' => "Wollen Sie das Kreditkarten Modul des Novalnet AG aktivieren?"); + #Test Mode + $install_text['test_title'] = array('en' => "Enable Test Mode:", + 'de' => "Testmodus einschalten"); + $install_text['test_desc'] = array('en' => "Do you want to activate test mode?", + 'de' => "Wollen Sie den Test-Modus aktivieren?"); + #Vendor id + $install_text['vendor_title'] = array('en' => "Novalnet Merchant ID", + 'de' => "Novalnet Händler ID"); + $install_text['vendor_desc'] = array('en' => "Enter your Novalnet Merchant ID ", + 'de' => "Geben Sie Ihre Novalnet Händler-ID ein "); + #Auth Code + $install_text['auth_title'] = array('en' => "Novalnet Merchant Authorisation Code", + 'de' => "Novalnet Authorisierungsschlüssel"); + $install_text['auth_desc'] = array('en' => "Enter your Novalnet Merchant Authorisation code ", + 'de' => "Geben Sie Ihren Novalnet-Authorisierungsschlüssel ein"); + + #Product id + $install_text['product_title'] = array('en' => "Novalnet Product ID", + 'de' => "Novalnet Produkt ID"); + $install_text['product_desc'] = array('en' => "Enter your Novalnet Product ID", + 'de' => "Geben Sie Ihre Novalnet Produkt-ID ein"); + + #Tariff id + $install_text['tariff_title'] = array('en' => "Novalnet Tariff ID", + 'de' => "Novalnet Tarif ID"); + $install_text['tariff_desc'] = array('en' => "Enter your Novalnet Tariff ID ", + 'de' => "Geben Sie Ihre Novalnet Tarif-ID ein"); + + + #Enduser info + $install_text['enduser_title'] = array('en' => "Information to the end customer", + 'de' => "Informationen für den Endkunden"); + $install_text['enduser_desc'] = array('en' => "will appear in the payment form", + 'de' => "wird im Bezahlformular erscheinen"); + + #Sortorder display + $install_text['sortorder_title'] = array('en' => "Sort order of display", + 'de' => "Sortierung nach"); + $install_text['sortorder_desc'] = array('en' => "Sort order of display. Lowest is displayed first.", + 'de' => "Sortierung der Anzeige. Der niedrigste Wert wird zuerst angezeigt."); + + #Setorder status display + $install_text['setorderstatus_title'] = array('en' => "Set Order Status", + 'de' => "Bestellungsstatus setzen"); + $install_text['setorderstatus_desc'] = array('en' => "Set the status of orders made with this payment module to this value.", + 'de' => "Setzen Sie den Status von über dieses Zahlungsmodul durchgeführten Bestellungen auf diesen Wert."); + + #Proxy + $install_text['proxy_title'] = array('en' => "Proxy-Server", + 'de' => "Proxy-Server"); + $install_text['proxy_desc'] = array('en' => " If you use a Proxy Server, enter the Proxy Server IP with port here (e.g. www.proxy.de:80).", + 'de' => "Wenn Sie einen Proxy-Server einsetzen, tragen Sie hier Ihre Proxy-IP und den Port ein (z.B. www.proxy.de:80)."); + + #Payment Zone + $install_text['paymnetzone_title'] = array('en' => "Payment Zone", + 'de' => "Zahlungsgebiet"); + $install_text['paymnetzone_desc'] = array('en' => "If a zone is selected then this module is activated only for Selected zone. ", + 'de' => "Wird ein Bereich ausgewählt, dann wird dieses Modul nur für den ausgewählten Bereich aktiviert."); + + + #Activate Logo Mode + $install_text['logo_title'] = array('en' => "Activate logo mode:", + 'de' => "Aktivieren Sie Logo Modus:"); + $install_text['logo_desc'] = array('en' => "Do you want to activate logo mode?", + 'de' => "Wollen Sie Logo-Modus zu aktivieren?"); + + return $install_text[$field_text][$lang]; + } + + ### Install the payment module and its configuration settings ### + + function install() { + global $db; + if ($this->blnDebug) { + $this->debug2(__FUNCTION__); + } + + $allowed_title = $this->install_lang('allowed_title', DEFAULT_LANGUAGE); + $allowed_desc = $this->install_lang('allowed_desc', DEFAULT_LANGUAGE); + + $enable_title = $this->install_lang('enable_title', DEFAULT_LANGUAGE); + $enable_desc = $this->install_lang('enable_desc', DEFAULT_LANGUAGE); + + $test_title = $this->install_lang('test_title', DEFAULT_LANGUAGE); + $test_desc = $this->install_lang('test_desc', DEFAULT_LANGUAGE); + + $vendor_title = $this->install_lang('vendor_title', DEFAULT_LANGUAGE); + $vendor_desc = $this->install_lang('vendor_desc', DEFAULT_LANGUAGE); + + $auth_title = $this->install_lang('auth_title', DEFAULT_LANGUAGE); + $auth_desc = $this->install_lang('auth_desc', DEFAULT_LANGUAGE); + + $product_title = $this->install_lang('product_title', DEFAULT_LANGUAGE); + $product_desc = $this->install_lang('product_desc', DEFAULT_LANGUAGE); + + $tariff_title = $this->install_lang('tariff_title', DEFAULT_LANGUAGE); + $tariff_desc = $this->install_lang('tariff_desc', DEFAULT_LANGUAGE); + + $enduser_title = $this->install_lang('enduser_title', DEFAULT_LANGUAGE); + $enduser_desc = $this->install_lang('enduser_desc', DEFAULT_LANGUAGE); + + $sortorder_title = $this->install_lang('sortorder_title', DEFAULT_LANGUAGE); + $sortorder_desc = $this->install_lang('sortorder_desc', DEFAULT_LANGUAGE); + + $setorderstatus_title = $this->install_lang('setorderstatus_title', DEFAULT_LANGUAGE); + $setorderstatus_desc = $this->install_lang('setorderstatus_desc', DEFAULT_LANGUAGE); + + $proxy_title = $this->install_lang('proxy_title', DEFAULT_LANGUAGE); + $proxy_desc = $this->install_lang('proxy_desc', DEFAULT_LANGUAGE); + + $paymnetzone_title = $this->install_lang('paymnetzone_title', DEFAULT_LANGUAGE); + $paymnetzone_desc = $this->install_lang('paymnetzone_desc', DEFAULT_LANGUAGE); + + $logo_title = $this->install_lang('logo_title', DEFAULT_LANGUAGE); + $logo_desc = $this->install_lang('logo_desc', DEFAULT_LANGUAGE); + + + /* $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$allowed_title."','MODULE_PAYMENT_NOVALNET_PREPAYMENT_ALLOWED', '','".$allowed_desc."', '6', '0', now())"); */ + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('" . $enable_title . "', 'MODULE_PAYMENT_NOVALNET_PREPAYMENT_STATUS', 'True', '" . $enable_desc . "', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('" . $test_title . "', 'MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEST_MODE', 'True', '" . $test_desc . "', '6', '1', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $vendor_title . "', 'MODULE_PAYMENT_NOVALNET_PREPAYMENT_VENDOR_ID', '', '" . $vendor_desc . "', '6', '2', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $auth_title . "', 'MODULE_PAYMENT_NOVALNET_PREPAYMENT_AUTH_CODE', '', '" . $auth_desc . "', '6', '3', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $product_title . "', 'MODULE_PAYMENT_NOVALNET_PREPAYMENT_PRODUCT_ID', '', '" . $product_desc . "', '6', '4', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $tariff_title . "', 'MODULE_PAYMENT_NOVALNET_PREPAYMENT_TARIFF_ID', '', '" . $tariff_desc . "', '6', '5', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $enduser_title . "', 'MODULE_PAYMENT_NOVALNET_PREPAYMENT_INFO', '', '" . $enduser_desc . "', '6', '6', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $sortorder_title . "', 'MODULE_PAYMENT_NOVALNET_PREPAYMENT_SORT_ORDER', '0', '" . $sortorder_desc . "', '6', '7', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('" . $setorderstatus_title . "', 'MODULE_PAYMENT_NOVALNET_PREPAYMENT_ORDER_STATUS_ID', '0', '" . $setorderstatus_desc . "', '6', '8', 'zen_cfg_pull_down_order_statuses(', 'zen_get_order_status_name', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('" . $paymnetzone_title . "', 'MODULE_PAYMENT_NOVALNET_PREPAYMENT_ZONE', '0', '" . $paymnetzone_desc . "', '6', '9', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $proxy_title . "', 'MODULE_PAYMENT_NOVALNET_PREPAYMENT_PROXY', '', '" . $proxy_desc . "', '6', '10', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('" . $logo_title . "', 'MODULE_PAYMENT_NOVALNET_PREPAYMENT_LOGO_STATUS', 'True', '" . $logo_desc . "', '6', '11', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + } + + ### Remove the module and all its settings ### + + function remove() { + global $db; + if ($this->blnDebug) { + $this->debug2(__FUNCTION__); + } + $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); + } + + ### Internal list of configuration keys used for configuration of the module ### + // @return array + + function keys() { + if ($this->blnDebug) { + $this->debug2(__FUNCTION__); + } + return array('MODULE_PAYMENT_NOVALNET_PREPAYMENT_LOGO_STATUS','MODULE_PAYMENT_NOVALNET_PREPAYMENT_STATUS', 'MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEST_MODE', + 'MODULE_PAYMENT_NOVALNET_PREPAYMENT_VENDOR_ID', 'MODULE_PAYMENT_NOVALNET_PREPAYMENT_AUTH_CODE', 'MODULE_PAYMENT_NOVALNET_PREPAYMENT_PRODUCT_ID', + 'MODULE_PAYMENT_NOVALNET_PREPAYMENT_TARIFF_ID', 'MODULE_PAYMENT_NOVALNET_PREPAYMENT_INFO', 'MODULE_PAYMENT_NOVALNET_PREPAYMENT_SORT_ORDER', + 'MODULE_PAYMENT_NOVALNET_PREPAYMENT_ORDER_STATUS_ID', 'MODULE_PAYMENT_NOVALNET_PREPAYMENT_ZONE', 'MODULE_PAYMENT_NOVALNET_PREPAYMENT_PROXY'); + } + + function html_to_utf8($data) { + return preg_replace("/\\&\\#([0-9]{3,10})\\;/e", '$this->_html_to_utf8("\\1")', $data); + } + + function _html_to_utf8($data) { + if ($data > 127) { + $i = 5; + while (($i--) > 0) { + if ($data != ($a = $data % ($p = pow(64, $i)))) { + $ret = chr(base_convert(str_pad(str_repeat(1, $i + 1), 8, "0"), 2, 10) + (($data - $a) / $p)); + for ($i; $i > 0; $i--) + $ret .= chr(128 + ((($data % pow(64, $i)) - ($data % ($p = pow(64, $i - 1)))) / $p)); + break; + } + } + } else { + $ret = "&#$data;"; + } + return $ret; + } + + function debug2($funcname) { + $fh = fopen('/tmp/debug2.txt', 'a+'); + fwrite($fh, date('H:i:s ') . $funcname . "\n"); + fclose($fh); + } + +} + +/* + order of functions: + selection -> $order-info['total'] wrong, cause shipping_cost is net + pre_confirmation_check -> $order-info['total'] wrong, cause shipping_cost is net + confirmation -> $order-info['total'] right, cause shipping_cost is gross + process_button -> $order-info['total'] right, cause shipping_cost is gross + before_process -> $order-info['total'] wrong, cause shipping_cost is net + after_process -> $order-info['total'] right, cause shipping_cost is gross + */ +?> diff --git a/includes/modules/payment/novalnet_tel.php b/includes/modules/payment/novalnet_tel.php new file mode 100644 index 0000000..6e39977 --- /dev/null +++ b/includes/modules/payment/novalnet_tel.php @@ -0,0 +1,789 @@ +vendor_id = trim(MODULE_PAYMENT_NOVALNET_TEL_VENDOR_ID); + $this->auth_code = trim(MODULE_PAYMENT_NOVALNET_TEL_AUTH_CODE); + $this->product_id = trim(MODULE_PAYMENT_NOVALNET_TEL_PRODUCT_ID); + $this->tariff_id = trim(MODULE_PAYMENT_NOVALNET_TEL_TARIFF_ID); + $this->test_mode = (strtolower(MODULE_PAYMENT_NOVALNET_TEL_TEST_MODE) == 'true' or MODULE_PAYMENT_NOVALNET_TEL_TEST_MODE == '1')? 1: 0; + + $this->code = 'novalnet_tel'; + $this->title = MODULE_PAYMENT_NOVALNET_TEL_TEXT_TITLE; + $this->public_title = MODULE_PAYMENT_NOVALNET_TEL_TEXT_PUBLIC_TITLE; + $this->description = MODULE_PAYMENT_NOVALNET_TEL_TEXT_DESCRIPTION; + $this->sort_order = MODULE_PAYMENT_NOVALNET_TEL_SORT_ORDER; + $this->enabled = ((MODULE_PAYMENT_NOVALNET_TEL_STATUS == 'True') ? true : false); + $this->proxy = MODULE_PAYMENT_NOVALNET_TEL_PROXY; + + + + if(MODULE_PAYMENT_NOVALNET_TEL_LOGO_STATUS == 'True'){ + $this->public_title = ' Novalnet '.MODULE_PAYMENT_NOVALNET_TEL_TEXT_PUBLIC_TITLE; + } + $this->checkConfigure(); + + if ((int)MODULE_PAYMENT_NOVALNET_TEL_ORDER_STATUS_ID > 0) { + $this->order_status = MODULE_PAYMENT_NOVALNET_TEL_ORDER_STATUS_ID; + } + +//echo "ya"; exit; + if (is_object($order)) $this->update_status(); + } + + function checkConfigure() { + if (IS_ADMIN_FLAG == true) { + $this->title = MODULE_PAYMENT_NOVALNET_TEL_TEXT_TITLE; // Payment module title in Admin + if ($this->enabled == 'true' && (!$this->vendor_id || !$this->auth_code || !$this->product_id || !$this->tariff_id )) { + $this->title .= ''.MODULE_PAYMENT_NOVALNET_TEL_NOT_CONFIGURED.''; + } elseif ($this->test_mode == '1') { + $this->title .= ''.MODULE_PAYMENT_NOVALNET_TEL_IN_TEST_MODE.''; + } + + } + } + + ### calculate zone matches and flag settings to determine whether this module should display to customers or not ### + function update_status() { + global $order, $db; + + if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_NOVALNET_TEL_ZONE > 0) ) { + $check_flag = false; + $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_NOVALNET_TEL_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id"); + while (!$check->EOF) { + if ($check->fields['zone_id'] < 1) { + $check_flag = true; + break; + } elseif ($check->fields['zone_id'] == $order->billing['zone_id']) { + $check_flag = true; + break; + } + $check->MoveNext(); + } + + if ($check_flag == false) { + $this->enabled = false; + } + } + } + + ### JS validation which does error-checking of data-entry if this module is selected for use ### + ### the fields to be cheked are (Bank Owner, Bank Account Number and Bank Code Lengths) ### + ### currently this function is not in use ### + // @return string + function javascript_validation() { + return false; + } + + ### Builds set of input fields for collecting Bankdetail info ### + // @return array + function selection() { + global $order, $order_total_modules, $currencies; + /* + require_once (DIR_WS_CLASSES.'shipping.php');echo'hihi'; + $shipping_modules = new shipping($_SESSION['shipping']); + $order_total_modules->process(); + $_SESSION['nn_total'] = sprintf('%0.2f', trim($order->info['total'])); + */ + $onFocus = ''; + + + + $_SESSION['nn_total'] = sprintf('%0.2f', trim($order->info['total'])); +// $amount = $_SESSION['nn_total']; + + if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status_add_tax_ot'] == 1) { + $totalamount=$order->info['total'] + $order->info['tax']; + } else { + $totalamount=$order->info['total']; + } + $amount =sprintf('%.2f', $totalamount); + $err = ''; + if (preg_match('/[^\d\.]/', $amount) or !$amount){ + ### $amount contains some unallowed chars or empty ### + $err = '$amount ('.$amount.') is empty or has a wrong format'; + $order->info['comments'] .= '. Novalnet Error Message : '.$err; + $payment_error_return = 'payment_error='.$this->code; + $messageStack->add_session('checkout_payment', $err . '', 'error'); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + $amount = preg_replace('/^0+/', '', $amount); + $orig_amount = $amount; + #$amount = sprintf('%0.2f', $amount); + $amount = str_replace('.', '', $amount); + #echo''.__CLASS__.$order->info['total']." <=> $amount
"; + if($amount>90 && $amount<=1000000000) + { + if(!isset($_SESSION['tid']) or empty($_SESSION['tid'])) + { + ### FIRST CALL ### + $selection = array('id' => $this->code, + 'module' => $this->public_title, + 'fields' => array(array('title' => '', + 'field' => MODULE_PAYMENT_NOVALNET_TEL_INFO) + )); + } + else + { + ### SECOND CALL ### + $sess_tel = trim($_SESSION['novaltel_no']); + + if($sess_tel) + { + $aryTelDigits = str_split($sess_tel, 4); + $count = 0; + $str_sess_tel = ''; + foreach ($aryTelDigits as $ind=>$digits) + { + $count++; + $str_sess_tel .= $digits; + if($count==1) $str_sess_tel .= '-'; + else $str_sess_tel .= ' '; + } + $str_sess_tel=trim($str_sess_tel); + if($str_sess_tel) $sess_tel=$str_sess_tel; + } + + $selection = array('id' => $this->code, + 'module' => $this->public_title, + 'fields' => array( + array('title' => '', + 'field' => "
".MODULE_PAYMENT_NOVALNET_TEL_TEXT_STEP_INFO."
"), + array('title' => MODULE_PAYMENT_NOVALNET_TEL_TEXT_STEP1, + 'field' => MODULE_PAYMENT_NOVALNET_TEL_TEXT_STEP1_DESC." $sess_tel
".MODULE_PAYMENT_NOVALNET_TEL_TEXT_COST_INFO.$orig_amount.MODULE_PAYMENT_NOVALNET_TEL_TEXT_TAX_INFO), + array('title' => MODULE_PAYMENT_NOVALNET_TEL_TEXT_STEP2, + 'field' => MODULE_PAYMENT_NOVALNET_TEL_TEXT_STEP2_DESC) + )); + } + /*if(function_exists('get_percent')) + { + $selection['module_cost'] = $GLOBALS['ot_payment']->get_percent($this->code); + }*/ + }#end of if($amount>90 && $amount<=1000) + else{ }#phonepayment not allowed because of amount beeing too large + + return $selection; + } + + ### Precheck to Evaluate the Bank Datas ### + function pre_confirmation_check() { + global $order, $currencies, $customer_id, $db; + $error = ''; + $focus_on = ''; + + /* if(!MODULE_PAYMENT_NOVALNET_TEL_VENDOR_ID || !MODULE_PAYMENT_NOVALNET_TEL_AUTH_CODE || !MODULE_PAYMENT_NOVALNET_TEL_PRODUCT_ID || !MODULE_PAYMENT_NOVALNET_TEL_TARIFF_ID) + { + $error = MODULE_PAYMENT_NOVALNET_TEL_TEXT_JS_NN_MISSING; + }*/ + if (!function_exists('curl_init') && ($this->_code=='novalnet_tel')){ + ini_set('display_errors', 1); + ini_set('error_reporting', E_ALL); + + $error = MODULE_PAYMENT_NOVALNET_TEL_CURL_MESSAGE; + } + + + if(!$this->vendor_id || !$this->auth_code || !$this->product_id || !$this->tariff_id) + { + $error = MODULE_PAYMENT_NOVALNET_TEL_TEXT_JS_NN_MISSING; + } + elseif(!$_SESSION['tid']) + { + #Get the required additional customer details from DB + $nn_customer_id = (isset($_SESSION['customer_id'])) ? $_SESSION['customer_id'] : ''; + $customer = $db->Execute("SELECT customers_gender, customers_dob, customers_fax FROM ". TABLE_CUSTOMERS . " WHERE customers_id='". (int)$nn_customer_id."'"); + + if ($customer->RecordCount() > 0){ + $customer = $customer->fields; + } + list($customer['customers_dob'], $extra) = explode(' ', $customer['customers_dob']); + + ### Process the payment to paygate ## + $url = 'https://payport.novalnet.de/paygate.jsp'; + + // $amount = $_SESSION['nn_total']; + if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status_add_tax_ot'] == 1) { + $totalamount=$_SESSION['nn_total'] + $order->info['tax']; + } else { + $totalamount=$_SESSION['nn_total']; + } + + $totalamount = number_format($totalamount * $currencies->get_value($order->info['currency']),2); + $amount = str_replace(',', '', $totalamount); + $amount = intval(round($amount*100)); + + //$amount =sprintf('%.2f', $totalamount); + + if (preg_match('/[^\d\.]/', $amount) or !$amount){ + ### $amount contains some unallowed chars or empty ### + $err = '$amount ('.$amount.') is empty or has a wrong format'; + $order->info['comments'] .= '. Novalnet Error Message : '.$err; + $payment_error_return = 'payment_error='.$this->code.'&error='.$err; + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + //$amount = preg_replace('/^0+/', '', $amount); + $orig_amount = $amount; + //$amount = sprintf('%0.2f', $amount); + //$amount = str_replace('.', '', $amount); + #echo''.__CLASS__.$order->info['total']." <=> $amount
"; + + $vendor_id = $this->vendor_id; + $auth_code = $this->auth_code; + $product_id = $this->product_id; + $tariff_id = $this->tariff_id; + $test_mode = (strtolower(MODULE_PAYMENT_NOVALNET_TEL_TEST_MODE) == 'true' or MODULE_PAYMENT_NOVALNET_TEL_TEST_MODE == '1')? 1: 0; + + $user_ip = $this->getRealIpAddr(); + + $firstname = !empty($order->customer['firstname']) ? $order->customer['firstname'] : $order->billing['firstname']; + $lastname = !empty($order->customer['lastname']) ? $order->customer['lastname'] : $order->billing['lastname']; + $email_address = !empty($order->customer['email_address']) ? $order->customer['email_address'] : $order->billing['email_address']; + $street_address = !empty($order->customer['street_address']) ? $order->customer['street_address'] : $order->billing['street_address']; + $city = !empty($order->customer['city']) ? $order->customer['city'] : $order->billing['city']; + $postcode = !empty($order->customer['postcode']) ? $order->customer['postcode'] : $order->billing['postcode']; + $country_iso_code_2 = !empty($order->customer['country']['iso_code_2']) ? $order->customer['country']['iso_code_2'] : $order->billing['country']['iso_code_2']; + $customer_no = ($customer['customers_status'] != 1) ? $nn_customer_id : MODULE_PAYMENT_NOVALNET_TEL_GUEST_USER; + + ### Process the payment to paygate ## + $url = 'https://payport.novalnet.de/paygate.jsp'; + $urlparam = 'vendor='.$vendor_id.'&product='.$product_id.'&key='.$this->payment_key.'&tariff='.$tariff_id; + $urlparam .= '&auth_code='.$auth_code.'¤cy='.$order->info['currency']; + $urlparam .= '&amount='.$amount.'&first_name='.$this->html_to_utf8($firstname).'&last_name='.$this->html_to_utf8($lastname); + $urlparam .= '&street='.$this->html_to_utf8($street_address).'&city='.$this->html_to_utf8($city); + $urlparam .= '&zip='.$postcode; + $urlparam .= '&country='.$country_iso_code_2.'&email='.$email_address; + $urlparam .= '&search_in_street=1&tel='.$order->customer['telephone'].'&remote_ip='.$user_ip; + $urlparam .= '&gender='.$customer['customers_gender'].'&birth_date='.$customer['customers_dob'].'&fax='.$customer['customers_fax']; + $urlparam .= '&language='.MODULE_PAYMENT_NOVALNET_TEL_TEXT_LANG; + $urlparam .= '&lang='.MODULE_PAYMENT_NOVALNET_TEL_TEXT_LANG; + $urlparam .= '&customer_no='.$customer_no; + $urlparam .= '&use_utf8=1'; + $urlparam .= '&test_mode='.$test_mode; + + + list($errno, $errmsg, $data) = $this->perform_https_request($url, $urlparam); + + $aryPaygateResponse = array(); + #capture the result and message and other parameters from response data '$data' in an array + $aryPaygateResponse = explode('&', $data); + foreach($aryPaygateResponse as $key => $value) + { + if($value!="") + { + $aryKeyVal = explode("=",$value); + $aryResponse[$aryKeyVal[0]] = $aryKeyVal[1]; + } + } + + +//print_r($aryResponse); exit; + + if($aryResponse['status']==100 && $aryResponse['tid']) + { + $_SESSION['t_id']=$aryResponse['tid']; + if( $this->order_status ) { + $order->info['order_status'] = $this->order_status; + } + $aryResponse['status_desc']=''; + if(!$_SESSION['tid']) + { + $_SESSION['tid'] = $aryResponse['tid']; + $_SESSION['novaltel_no'] = $aryResponse['novaltel_number']; + } + } + elseif($aryResponse['status']==18){} + elseif($aryResponse['status']==19) + { + $_SESSION['tid'] = ''; + $_SESSION['novaltel_no'] = ''; + } + else $status = $aryResponse['status']; + if($aryResponse['status']==100){ + $_SESSION['t_id']=$aryResponse['tid']; + $error=' ';$focus_on='#novalnet_tel';} + else{$error=$aryResponse['status_desc'];} + } + + if($error!='') { + // $payment_error_return = 'payment_error='.$this->code.'&error='.urlencode($error); + $error_value=substr($error,0,43); + $payment_error_return="payment_error=".$this->code."&error=".$error_value; + + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + +// zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + + } + + ### Display Bank Information on the Checkout Confirmation Page ### + // @return array + function confirmation() { + + $confirmation = array('fields' => array(array('title' => '', 'field' => ''))); + + return $confirmation; + } + + ### Build the data and actions to process when the "Submit" button is pressed on the order-confirmation screen. ### + ### These are hidden fields on the checkout confirmation page ### + // @return string + function process_button() { + $process_button_string = ''; + + return $process_button_string; + } + + ### This sends the data to the payment gateway for processing and Evaluates the Payment for acceptance and the validity of the Telephone Details ### + function before_process() { + global $order, $currencies, $customer_id, $db; + + // $test_mode = (strtolower(MODULE_PAYMENT_NOVALNET_TEL_TEST_MODE) == 'true' or MODULE_PAYMENT_NOVALNET_TEL_TEST_MODE == '1')? 1: 0; + // if ($test_mode){ + // $order->info['comments'] .= 'TESTBESTELLUNG
'; + // } + + #Get the required additional customer details from DB + $customer = $db->Execute("SELECT customers_gender, customers_dob, customers_fax FROM ". TABLE_CUSTOMERS . " WHERE customers_id='". (int)$_SESSION['customer_id']."'"); + + if ($customer->RecordCount() > 0){ + $customer = $customer->fields; + } + list($customer['customers_dob'], $extra) = explode(' ', $customer['customers_dob']); + + ### Process the payment to paygate ## + $url = 'https://payport.novalnet.de/paygate.jsp'; + +// $amount = $_SESSION['nn_total']; + + if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status_add_tax_ot'] == 1) { + $totalamount=$_SESSION['nn_total'] + $order->info['tax']; + } else { + $totalamount=$_SESSION['nn_total']; + } + $amount =sprintf('%.2f', $totalamount); + + if(!$amount)$amount = $order->info['total']; + if(preg_match('/[,.]$/', $amount)) + { + $amount = $amount . '00'; + } + else if(preg_match('/[,.][0-9]$/', $amount)) + { + $amount = $amount . '0'; + } + $amount = preg_replace('/^0+/', '', $amount); + $amount = str_replace('.', '', $amount); + $amount = str_replace(',', '', $amount); + + $product_id = MODULE_PAYMENT_NOVALNET_TEL_PRODUCT_ID; + $tariff_id = MODULE_PAYMENT_NOVALNET_TEL_TARIFF_ID; + + $user_ip = $this->getRealIpAddr(); + $aryPaygateResponse = array(); + + if($_SESSION['tid']) + { + ### Process the payment to payport ## + $url = 'https://payport.novalnet.de/nn_infoport.xml'; + + $urlparam = ''.$this->vendor_id.''; + $urlparam .= ''.$this->auth_code.''; + $urlparam .= 'NOVALTEL_STATUS'.$_SESSION['tid'].''; + $urlparam .= ''.MODULE_PAYMENT_NOVALNET_TEL_TEXT_LANG.''; + + list($errno, $errmsg, $data) = $this->perform_https_request($url, $urlparam); + + if(strstr($data, '')) + { + preg_match('/novaltel_status>?([^<]+)/i', $data, $matches); + $aryResponse['status'] = $matches[1]; + + preg_match('/novaltel_status_message>?([^<]+)/i', $data, $matches); + $aryResponse['status_desc'] = $matches[1]; + } + } + #var_dump($aryResponse); exit; + if($_SESSION['tid'] && $aryResponse['status']==100) #### On successful payment #### + { + #### Redirecting the user to the checkout page #### + $order->info['comments'] .= '. Novalnet Transaction ID : '.$_SESSION['tid']; + $_SESSION['tid'] = ''; + $_SESSION['novaltel_no'] = ''; + } + else #### On payment failure #### + { + ### Passing the Error Response from Novalnet's paygate to payment error ### + $status = ''; + if($wrong_amount==1){$status = '1';$aryResponse['status_desc'] = MODULE_PAYMENT_NOVALNET_TEL_TEXT_AMOUNT_ERROR1;} + elseif($aryResponse['status']==18){} + elseif($aryResponse['status']==19) + { + $_SESSION['tid'] = ''; + $_SESSION['novaltel_no'] = ''; + } + else $status = $aryResponse['status']; + + ### Passing through the Error Response from Novalnet's paygate into order-info ### + #$order->info['comments'] .= '. Novalnet Error Code : '.$aryResponse['status'].', Novalnet Error Message : '.$aryResponse['status_desc']; + + $payment_error_return = 'payment_error=' . $this->code . '&error1=' . substr(urlencode($aryResponse['status_desc']),0,43); + + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); + } + + } + + ### Realtime accesspoint for communication to the Novalnet paygate ### + function perform_https_request($nn_url, $urlparam) + { + $debug = 0;#set it to 1 if you want to activate the debug mode + + if($debug) print "
perform_https_request: $nn_url
\n\r\n"; + if($debug) print "perform_https_request: $urlparam
\n\r\n"; + + ## some prerquisites for the connection + $ch = curl_init($nn_url); + curl_setopt($ch, CURLOPT_POST, 1); // a non-zero parameter tells the library to do a regular HTTP post. + curl_setopt($ch, CURLOPT_POSTFIELDS, $urlparam); // add POST fields + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); // don't allow redirects + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // decomment it if you want to have effective ssl checking + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // decomment it if you want to have effective ssl checking + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable + curl_setopt($ch, CURLOPT_TIMEOUT, 240); // maximum time, in seconds, that you'll allow the CURL functions to take + if ($this->proxy) {curl_setopt($ch, CURLOPT_PROXY, $this->proxy); } + + ## establish connection + $data = curl_exec($ch); + $data = utf8_decode($this->ReplaceSpecialGermanChars($data)); + #print "$data"; exit; + + ## determine if there were some problems on cURL execution + $errno = curl_errno($ch); + $errmsg = curl_error($ch); + + ###bug fix for PHP 4.1.0/4.1.2 (curl_errno() returns high negative value in case of successful termination) + if($errno < 0) $errno = 0; + ##bug fix for PHP 4.1.0/4.1.2 + + if($debug) + { + print_r(curl_getinfo($ch)); + echo "\n

\n\n\nperform_https_request: cURL error number:" . $errno . "\n
\n\n"; + echo "\n\n\nperform_https_request: cURL error:" . $errmsg . "\n
\n\n"; + } + + #close connection + curl_close($ch); + + ## read and return data from novalnet paygate + if($debug) print "
\n\n" . $data . "\n
\n\n"; + + return array ($errno, $errmsg, $data); + } + + function isPublicIP($value) + { + if(!$value || count(explode('.',$value))!=4) return false; + return !preg_match('~^((0|10|172\.16|192\.168|169\.254|255|127\.0)\.)~', $value); + } + + ### get the real Ip Adress of the User ### + function getRealIpAddr() + { + if($this->isPublicIP($_SERVER['HTTP_X_FORWARDED_FOR'])) return $_SERVER['HTTP_X_FORWARDED_FOR']; + if($iplist=explode(',', $_SERVER['HTTP_X_FORWARDED_FOR'])) + { + if($this->isPublicIP($iplist[0])) return $iplist[0]; + } + if ($this->isPublicIP($_SERVER['HTTP_CLIENT_IP'])) return $_SERVER['HTTP_CLIENT_IP']; + if ($this->isPublicIP($_SERVER['HTTP_X_CLUSTER_CLIENT_IP'])) return $_SERVER['HTTP_X_CLUSTER_CLIENT_IP']; + if ($this->isPublicIP($_SERVER['HTTP_FORWARDED_FOR']) ) return $_SERVER['HTTP_FORWARDED_FOR']; + + return $_SERVER['REMOTE_ADDR']; + } + + ### replace the Special German Charectors ### + function ReplaceSpecialGermanChars($string) + { + $what = array("ä", "ö", "ü", "Ä", "Ö", "Ãœ", "ß"); + $how = array("ae", "oe", "ue", "Ae", "Oe", "Ue", "ss"); + + $string = str_replace($what, $how, $string); + + return $string; + } + + ### Send the order detail to Novalnet ### + function after_process() { + global $order, $customer_id, $insert_id,$db; + + $order->info['comments'] .= '. Novalnet Transaction ID : '.$_SESSION['t_id']; + $db->Execute("update ".TABLE_ORDERS_STATUS_HISTORY." set comments = '".$order->info['comments']."' , orders_status_id= '".$this->order_status."' where orders_id = '".$insert_id."'"); + $db->Execute("update ".TABLE_ORDERS." set orders_status = '".$this->order_status."' where orders_id = '".$insert_id."'"); + if($_SESSION['tid']){ + ### Pass the Order Reference to paygate ## + $url = 'https://payport.novalnet.de/paygate.jsp'; + $urlparam = 'vendor='.$this->vendor_id.'&product='.$this->product_id.'&key=27&tariff='.$this->tariff_id; + $urlparam .= '&auth_code='.$this->auth_code.'&status=100&tid='.$_SESSION['tid'].'&reference=BNR-'.$insert_id.'&vwz2='.MODULE_PAYMENT_NOVALNET_TEL_TEXT_ORDERNO.''.$insert_id.'&vwz3='.MODULE_PAYMENT_NOVALNET_TEL_TEXT_ORDERDATE.''.date('Y-m-d H:i:s'); + $urlparam .= '&order_no='.$insert_id; + list($errno, $errmsg, $data) = $this->perform_https_request($url, $urlparam); + } + + unset($_SESSION['tid']); + unset($_SESSION['novaltel_no']); + + return false; + } + + ### Used to display error message details ### + // @return array + function get_error() { + global $HTTP_GET_VARS, $_GET; + if(count($HTTP_GET_VARS)==0 || $HTTP_GET_VARS=='') $HTTP_GET_VARS = $_GET; + + $error = array('title' => MODULE_PAYMENT_NOVALNET_TEL_TEXT_ERROR, + 'error' => stripslashes(urldecode($HTTP_GET_VARS['error']))); + + return $error; + } + + ### Check to see whether module is installed ### + // @return boolean + function check() { + global $db; + if (!isset($this->_check)) { + $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_NOVALNET_TEL_STATUS'"); + $this->_check = $check_query->RecordCount(); + } + return $this->_check; + } + + function install_lang($field_text,$lang) + { + + #Allowed Zones + $install_text['allowed_title'] = array('en' => "Allowed zones", + 'de' => "erlaubte Zonen"); + $install_text['allowed_desc'] = array('en' => "Please enter the desired zones separated by comma (Eg: AT, DE) or leave it blank", + 'de' => "Bitte die gewünschten Zonen durch Komma getrennt eingeben (z.B: AT,DE) oder einfach leer lassen"); + #Enable Module + $install_text['enable_title'] = array('en' => "Enable Module", + 'de' => "Modul aktivieren"); + $install_text['enable_desc'] = array('en' => "Do you want to activate the Credit Card of Novalnet AG?", + 'de' => "Wollen Sie das Kreditkarten Modul des Novalnet AG aktivieren?"); + #Test Mode + $install_text['test_title'] = array('en' => "Enable Test Mode:", + 'de' => "Testmodus einschalten"); + $install_text['test_desc'] = array('en' => "Do you want to activate test mode?", + 'de' => "Wollen Sie den Test-Modus aktivieren?"); + #Vendor id + $install_text['vendor_title'] = array('en' => "Novalnet Merchant ID", + 'de' => "Novalnet Händler ID"); + $install_text['vendor_desc'] = array('en' => "Enter your Novalnet Merchant ID ", + 'de' => "Geben Sie Ihre Novalnet Händler-ID ein "); + #Auth Code + $install_text['auth_title'] = array('en' => "Novalnet Merchant Authorisation Code", + 'de' => "Novalnet Authorisierungsschlüssel"); + $install_text['auth_desc'] = array('en' => "Enter your Novalnet Merchant Authorisation code ", + 'de' => "Geben Sie Ihren Novalnet-Authorisierungsschlüssel ein"); + + #Product id + $install_text['product_title'] = array('en' => "Novalnet Product ID", + 'de' => "Novalnet Produkt ID"); + $install_text['product_desc'] = array('en' => "Enter your Novalnet Product ID", + 'de' => "Geben Sie Ihre Novalnet Produkt-ID ein"); + + #Tariff id + $install_text['tariff_title'] = array('en' => "Novalnet Tariff ID", + 'de' => "Novalnet Tarif ID"); + $install_text['tariff_desc'] = array('en' => "Enter your Novalnet Tariff ID ", + 'de' => "Geben Sie Ihre Novalnet Tarif-ID ein"); + + + #Enduser info + $install_text['enduser_title'] = array('en' => "Information to the end customer", + 'de' => "Informationen für den Endkunden"); + $install_text['enduser_desc'] = array('en' => "will appear in the payment form", + 'de' => "wird im Bezahlformular erscheinen"); + + #Sortorder display + $install_text['sortorder_title'] = array('en' => "Sort order of display", + 'de' => "Sortierung nach"); + $install_text['sortorder_desc'] = array('en' => "Sort order of display. Lowest is displayed first.", + 'de' => "Sortierung der Anzeige. Der niedrigste Wert wird zuerst angezeigt."); + + #Setorder status display + $install_text['setorderstatus_title'] = array('en' => "Set Order Status", + 'de' => "Bestellungsstatus setzen"); + $install_text['setorderstatus_desc'] = array('en' => "Set the status of orders made with this payment module to this value.", + 'de' => "Setzen Sie den Status von über dieses Zahlungsmodul durchgeführten Bestellungen auf diesen Wert."); + + #Proxy + $install_text['proxy_title'] = array('en' => "Proxy-Server", + 'de' => "Proxy-Server"); + $install_text['proxy_desc'] = array('en' => " If you use a Proxy Server, enter the Proxy Server IP with port here (e.g. www.proxy.de:80).", + 'de' => "Wenn Sie einen Proxy-Server einsetzen, tragen Sie hier Ihre Proxy-IP und den Port ein (z.B. www.proxy.de:80)."); + + #Payment Zone + $install_text['paymnetzone_title'] = array('en' => "Payment Zone", + 'de' => "Zahlungsgebiet"); + $install_text['paymnetzone_desc'] = array('en' => "If a zone is selected then this module is activated only for Selected zone. ", + 'de' => "Wird ein Bereich ausgewählt, dann wird dieses Modul nur für den ausgewählten Bereich aktiviert."); + + + #Activate Logo Mode + $install_text['logo_title'] = array('en' => "Activate logo mode:", + 'de' => "Aktivieren Sie Logo Modus:"); + $install_text['logo_desc'] = array('en' => "Do you want to activate logo mode?", + 'de' => "Wollen Sie Logo-Modus zu aktivieren?"); + + return $install_text[$field_text][$lang]; + } + + + ### Install the payment module and its configuration settings ### + function install() { + global $db; + + $allowed_title = $this->install_lang('allowed_title', DEFAULT_LANGUAGE); + $allowed_desc = $this->install_lang('allowed_desc', DEFAULT_LANGUAGE); + + $enable_title = $this->install_lang('enable_title', DEFAULT_LANGUAGE); + $enable_desc = $this->install_lang('enable_desc', DEFAULT_LANGUAGE); + + $test_title = $this->install_lang('test_title', DEFAULT_LANGUAGE); + $test_desc = $this->install_lang('test_desc', DEFAULT_LANGUAGE); + + $vendor_title = $this->install_lang('vendor_title', DEFAULT_LANGUAGE); + $vendor_desc = $this->install_lang('vendor_desc', DEFAULT_LANGUAGE); + + $auth_title = $this->install_lang('auth_title', DEFAULT_LANGUAGE); + $auth_desc = $this->install_lang('auth_desc', DEFAULT_LANGUAGE); + + $product_title = $this->install_lang('product_title', DEFAULT_LANGUAGE); + $product_desc = $this->install_lang('product_desc', DEFAULT_LANGUAGE); + + $tariff_title = $this->install_lang('tariff_title', DEFAULT_LANGUAGE); + $tariff_desc = $this->install_lang('tariff_desc', DEFAULT_LANGUAGE); + + $enduser_title = $this->install_lang('enduser_title', DEFAULT_LANGUAGE); + $enduser_desc = $this->install_lang('enduser_desc', DEFAULT_LANGUAGE); + + $sortorder_title = $this->install_lang('sortorder_title', DEFAULT_LANGUAGE); + $sortorder_desc = $this->install_lang('sortorder_desc', DEFAULT_LANGUAGE); + + $setorderstatus_title = $this->install_lang('setorderstatus_title', DEFAULT_LANGUAGE); + $setorderstatus_desc = $this->install_lang('setorderstatus_desc', DEFAULT_LANGUAGE); + + $proxy_title = $this->install_lang('proxy_title', DEFAULT_LANGUAGE); + $proxy_desc = $this->install_lang('proxy_desc', DEFAULT_LANGUAGE); + + $paymnetzone_title = $this->install_lang('paymnetzone_title', DEFAULT_LANGUAGE); + $paymnetzone_desc = $this->install_lang('paymnetzone_desc', DEFAULT_LANGUAGE); + + $logo_title = $this->install_lang('logo_title', DEFAULT_LANGUAGE); + $logo_desc = $this->install_lang('logo_desc', DEFAULT_LANGUAGE); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$allowed_title."','MODULE_PAYMENT_NOVALNET_TEL_ALLOWED', '','".$allowed_desc."', '6', '0', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('".$enable_title."', 'MODULE_PAYMENT_NOVALNET_TEL_STATUS', 'True', '".$enable_desc."', '6', '1', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('".$test_title."', 'MODULE_PAYMENT_NOVALNET_TEL_TEST_MODE', 'True', '".$test_desc."', '6', '2', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$vendor_title."', 'MODULE_PAYMENT_NOVALNET_TEL_VENDOR_ID', '', '".$vendor_desc."', '6', '3', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$auth_title."', 'MODULE_PAYMENT_NOVALNET_TEL_AUTH_CODE', '', '".$auth_desc."', '6', '4', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$product_title."', 'MODULE_PAYMENT_NOVALNET_TEL_PRODUCT_ID', '', '".$product_desc."', '6', '5', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$tariff_title."', 'MODULE_PAYMENT_NOVALNET_TEL_TARIFF_ID', '', '".$tariff_desc."', '6', '6', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$enduser_title."', 'MODULE_PAYMENT_NOVALNET_TEL_INFO', '', '".$enduser_desc."', '6', '7', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$sortorder_title."', 'MODULE_PAYMENT_NOVALNET_TEL_SORT_ORDER', '0', '".$sortorder_desc."', '6', '8', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('".$setorderstatus_title."', 'MODULE_PAYMENT_NOVALNET_TEL_ORDER_STATUS_ID', '0', '".$setorderstatus_desc."', '6', '9', 'zen_cfg_pull_down_order_statuses(', 'zen_get_order_status_name', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('".$paymnetzone_title."', 'MODULE_PAYMENT_NOVALNET_TEL_ZONE', '0', '".$paymnetzone_desc."', '6', '10', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".$proxy_title."', 'MODULE_PAYMENT_NOVALNET_TEL_PROXY', '', '".$proxy_desc."', '6', '11', now())"); + + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('".$logo_title."', 'MODULE_PAYMENT_NOVALNET_TEL_LOGO_STATUS', 'True', '".$logo_desc."', '6', '12', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + + } + + ### Remove the module and all its settings ### + function remove() { + global $db; + $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); + } + + ### Internal list of configuration keys used for configuration of the module ### + // @return array + function keys() { + return array('MODULE_PAYMENT_NOVALNET_TEL_LOGO_STATUS','MODULE_PAYMENT_NOVALNET_TEL_ALLOWED','MODULE_PAYMENT_NOVALNET_TEL_STATUS', /* 'MODULE_PAYMENT_NOVALNET_TEL_TEST_MODE',*/ 'MODULE_PAYMENT_NOVALNET_TEL_VENDOR_ID', 'MODULE_PAYMENT_NOVALNET_TEL_AUTH_CODE', 'MODULE_PAYMENT_NOVALNET_TEL_PRODUCT_ID', 'MODULE_PAYMENT_NOVALNET_TEL_TARIFF_ID', 'MODULE_PAYMENT_NOVALNET_TEL_INFO', 'MODULE_PAYMENT_NOVALNET_TEL_SORT_ORDER', 'MODULE_PAYMENT_NOVALNET_TEL_ORDER_STATUS_ID', 'MODULE_PAYMENT_NOVALNET_TEL_ZONE','MODULE_PAYMENT_NOVALNET_TEL_PROXY'); + } + function html_to_utf8 ($data) + { + return preg_replace("/\\&\\#([0-9]{3,10})\\;/e", '$this->_html_to_utf8("\\1")', $data); + } + + function _html_to_utf8 ($data) + { + if ($data > 127) + { + $i = 5; + while (($i--) > 0) + { + if ($data != ($a = $data % ($p = pow(64, $i)))) + { + $ret = chr(base_convert(str_pad(str_repeat(1, $i + 1), 8, "0"), 2, 10) + (($data - $a) / $p)); + for ($i; $i > 0; $i--) + $ret .= chr(128 + ((($data % pow(64, $i)) - ($data % ($p = pow(64, $i - 1)))) / $p)); + break; + } + } + } + else + { + $ret = "&#$data;"; + } + return $ret; + } +} +?> diff --git a/includes/modules/payment/novalnet_version.txt b/includes/modules/payment/novalnet_version.txt new file mode 100644 index 0000000..2850b20 --- /dev/null +++ b/includes/modules/payment/novalnet_version.txt @@ -0,0 +1,11 @@ + diff --git a/includes/templates/template_default/templates/tpl_checkout_novalnet_confirmation_default.php b/includes/templates/template_default/templates/tpl_checkout_novalnet_confirmation_default.php new file mode 100644 index 0000000..6cff17b --- /dev/null +++ b/includes/templates/template_default/templates/tpl_checkout_novalnet_confirmation_default.php @@ -0,0 +1,32 @@ + + +
+
+ $v) print ""; + ?> + +
+
\ No newline at end of file