| [ Index ] |
|
Code source de osCommerce 2.2ms2-060817 |
1 <?php 2 /* 3 $Id: nochex.php,v 1.12 2003/01/29 19:57:15 hpdl Exp $ 4 5 osCommerce, Open Source E-Commerce Solutions 6 http://www.oscommerce.com 7 8 Copyright (c) 2003 osCommerce 9 10 Released under the GNU General Public License 11 */ 12 13 class nochex { 14 var $code, $title, $description, $enabled; 15 16 // class constructor 17 function nochex() { 18 global $order; 19 20 $this->code = 'nochex'; 21 $this->title = MODULE_PAYMENT_NOCHEX_TEXT_TITLE; 22 $this->description = MODULE_PAYMENT_NOCHEX_TEXT_DESCRIPTION; 23 $this->sort_order = MODULE_PAYMENT_NOCHEX_SORT_ORDER; 24 $this->enabled = ((MODULE_PAYMENT_NOCHEX_STATUS == 'True') ? true : false); 25 26 if ((int)MODULE_PAYMENT_NOCHEX_ORDER_STATUS_ID > 0) { 27 $this->order_status = MODULE_PAYMENT_NOCHEX_ORDER_STATUS_ID; 28 } 29 30 if (is_object($order)) $this->update_status(); 31 32 $this->form_action_url = 'https://www.nochex.com/nochex.dll/checkout'; 33 } 34 35 // class methods 36 function update_status() { 37 global $order; 38 39 if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_NOCHEX_ZONE > 0) ) { 40 $check_flag = false; 41 $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_NOCHEX_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id"); 42 while ($check = tep_db_fetch_array($check_query)) { 43 if ($check['zone_id'] < 1) { 44 $check_flag = true; 45 break; 46 } elseif ($check['zone_id'] == $order->billing['zone_id']) { 47 $check_flag = true; 48 break; 49 } 50 } 51 52 if ($check_flag == false) { 53 $this->enabled = false; 54 } 55 } 56 } 57 58 function javascript_validation() { 59 return false; 60 } 61 62 function selection() { 63 return array('id' => $this->code, 64 'module' => $this->title); 65 } 66 67 function pre_confirmation_check() { 68 return false; 69 } 70 71 function confirmation() { 72 return false; 73 } 74 75 function process_button() { 76 global $order, $currencies, $customer_id; 77 78 $process_button_string = tep_draw_hidden_field('cmd', '_xclick') . 79 tep_draw_hidden_field('email', MODULE_PAYMENT_NOCHEX_ID) . 80 tep_draw_hidden_field('amount', number_format($order->info['total'] * $currencies->currencies['GBP']['value'], $currencies->currencies['GBP']['decimal_places'])) . 81 tep_draw_hidden_field('ordernumber', $customer_id . '-' . date('Ymdhis')) . 82 tep_draw_hidden_field('returnurl', tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL')) . 83 tep_draw_hidden_field('cancel_return', tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')); 84 85 return $process_button_string; 86 } 87 88 function before_process() { 89 return false; 90 } 91 92 function after_process() { 93 return false; 94 } 95 96 function output_error() { 97 return false; 98 } 99 100 function check() { 101 if (!isset($this->_check)) { 102 $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_NOCHEX_STATUS'"); 103 $this->_check = tep_db_num_rows($check_query); 104 } 105 return $this->_check; 106 } 107 108 function install() { 109 tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable NOCHEX Module', 'MODULE_PAYMENT_NOCHEX_STATUS', 'True', 'Do you want to accept NOCHEX payments?', '6', '3', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); 110 tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('E-Mail Address', 'MODULE_PAYMENT_NOCHEX_ID', 'you@yourbuisness.com', 'The e-mail address to use for the NOCHEX service', '6', '4', now())"); 111 tep_db_query("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_NOCHEX_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())"); 112 tep_db_query("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_NOCHEX_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())"); 113 tep_db_query("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_NOCHEX_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())"); 114 } 115 116 function remove() { 117 tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); 118 } 119 120 function keys() { 121 return array('MODULE_PAYMENT_NOCHEX_STATUS', 'MODULE_PAYMENT_NOCHEX_ID', 'MODULE_PAYMENT_NOCHEX_ZONE', 'MODULE_PAYMENT_NOCHEX_ORDER_STATUS_ID', 'MODULE_PAYMENT_NOCHEX_SORT_ORDER'); 122 } 123 } 124 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Mon Nov 26 19:48:25 2007 | par Balluche grâce à PHPXref 0.7 |
|