  |
1 | 1 | | <?php |
| |
2 | 2 | | /* |
  |
3 | | - | $Id: payment.php 431 2006-02-15 05:57:09Z hpdl $ |
| |
| 3 | + | $Id: payment.php 432 2006-02-15 07:41:34Z hpdl $ |
|
4 | 4 | | |
| |
5 | 5 | | osCommerce, Open Source E-Commerce Solutions |
| |
6 | 6 | | http://www.oscommerce.com |
| |
|
|
 |
… |
|
13 | 13 | | class osC_Payment { |
| |
14 | 14 | | var $modules, $selected_module; |
| |
15 | 15 | | |
  |
| 16 | + | var $_group = 'payment'; |
| |
| 17 | + | |
|
16 | 18 | | // class constructor |
| |
17 | 19 | | function osC_Payment($module = '') { |
| |
18 | 20 | | global $osC_Database, $osC_Language; |
| |
|
|
 |
… |
|
53 | 55 | | } |
| |
54 | 56 | | |
| |
55 | 57 | | // class methods |
  |
| 58 | + | function getCode() { |
| |
| 59 | + | return $this->_code; |
| |
| 60 | + | } |
| |
| 61 | + | |
| |
| 62 | + | function getTitle() { |
| |
| 63 | + | return $this->_title; |
| |
| 64 | + | } |
| |
| 65 | + | |
| |
| 66 | + | function getDescription() { |
| |
| 67 | + | return $this->_description; |
| |
| 68 | + | } |
| |
| 69 | + | |
| |
| 70 | + | function getStatus() { |
| |
| 71 | + | return $this->_status; |
| |
| 72 | + | } |
| |
| 73 | + | |
| |
| 74 | + | function getSortOrder() { |
| |
| 75 | + | return $this->_sort_order; |
| |
| 76 | + | } |
| |
| 77 | + | |
|
56 | 78 | | /* The following method is needed in the checkout_confirmation.php page |
| |
57 | 79 | | due to a chicken and egg problem with the payment class and order class. |
| |
58 | 80 | | The payment modules needs the order destination data for the dynamic status |
| |
|
|
 |
… |
|
94 | 116 | | ' }' . "\n\n"; |
| |
95 | 117 | | |
| |
96 | 118 | | foreach ($this->modules as $module) { |
  |
97 | | - | if ($GLOBALS['osC_Payment_' . $module]->enabled) { |
| |
| 119 | + | if ($GLOBALS['osC_Payment_' . $module]->getStatus() === true) { |
|
98 | 120 | | $js .= $GLOBALS['osC_Payment_' . $module]->javascript_validation(); |
| |
99 | 121 | | } |
| |
100 | 122 | | } |
| |
|
|
 |
… |
|
120 | 142 | | $selection_array = array(); |
| |
121 | 143 | | |
| |
122 | 144 | | foreach ($this->modules as $module) { |
  |
123 | | - | if ($GLOBALS['osC_Payment_' . $module]->enabled) { |
| |
| 145 | + | if ($GLOBALS['osC_Payment_' . $module]->getStatus() === true) { |
|
124 | 146 | | $selection = $GLOBALS['osC_Payment_' . $module]->selection(); |
| |
125 | 147 | | if (is_array($selection)) $selection_array[] = $selection; |
| |
126 | 148 | | } |
| |
|
|
 |
… |
|
131 | 153 | | |
| |
132 | 154 | | function pre_confirmation_check() { |
| |
133 | 155 | | if (is_array($this->modules)) { |
  |
134 | | - | if (is_object($GLOBALS[$this->selected_module]) && ($GLOBALS[$this->selected_module]->enabled) ) { |
| |
| 156 | + | if (is_object($GLOBALS[$this->selected_module]) && ($GLOBALS[$this->selected_module]->getStatus() === true) ) { |
|
135 | 157 | | $GLOBALS[$this->selected_module]->pre_confirmation_check(); |
| |
136 | 158 | | } |
| |
137 | 159 | | } |
| |
138 | 160 | | } |
| |
139 | 161 | | |
| |
140 | 162 | | function confirmation() { |
| |
141 | 163 | | if (is_array($this->modules)) { |
  |
142 | | - | if (is_object($GLOBALS[$this->selected_module]) && ($GLOBALS[$this->selected_module]->enabled) ) { |
| |
| 164 | + | if (is_object($GLOBALS[$this->selected_module]) && ($GLOBALS[$this->selected_module]->getStatus() === true) ) { |
|
143 | 165 | | return $GLOBALS[$this->selected_module]->confirmation(); |
| |
144 | 166 | | } |
| |
145 | 167 | | } |
| |
146 | 168 | | } |
| |
147 | 169 | | |
| |
148 | 170 | | function process_button() { |
| |
149 | 171 | | if (is_array($this->modules)) { |
  |
150 | | - | if (is_object($GLOBALS[$this->selected_module]) && ($GLOBALS[$this->selected_module]->enabled) ) { |
| |
| 172 | + | if (is_object($GLOBALS[$this->selected_module]) && ($GLOBALS[$this->selected_module]->getStatus() === true) ) { |
|
151 | 173 | | return $GLOBALS[$this->selected_module]->process_button(); |
| |
152 | 174 | | } |
| |
153 | 175 | | } |
| |
154 | 176 | | } |
| |
155 | 177 | | |
| |
156 | 178 | | function before_process() { |
| |
157 | 179 | | if (is_array($this->modules)) { |
  |
158 | | - | if (is_object($GLOBALS[$this->selected_module]) && ($GLOBALS[$this->selected_module]->enabled) ) { |
| |
| 180 | + | if (is_object($GLOBALS[$this->selected_module]) && ($GLOBALS[$this->selected_module]->getStatus() === true) ) { |
|
159 | 181 | | return $GLOBALS[$this->selected_module]->before_process(); |
| |
160 | 182 | | } |
| |
161 | 183 | | } |
| |
162 | 184 | | } |
| |
163 | 185 | | |
| |
164 | 186 | | function after_process() { |
| |
165 | 187 | | if (is_array($this->modules)) { |
  |
166 | | - | if (is_object($GLOBALS[$this->selected_module]) && ($GLOBALS[$this->selected_module]->enabled) ) { |
| |
| 188 | + | if (is_object($GLOBALS[$this->selected_module]) && ($GLOBALS[$this->selected_module]->getStatus() === true) ) { |
|
167 | 189 | | return $GLOBALS[$this->selected_module]->after_process(); |
| |
168 | 190 | | } |
| |
169 | 191 | | } |
| |
170 | 192 | | } |
| |
171 | 193 | | |
| |
172 | 194 | | function get_error() { |
| |
173 | 195 | | if (is_array($this->modules)) { |
  |
174 | | - | if (is_object($GLOBALS[$this->selected_module]) && ($GLOBALS[$this->selected_module]->enabled) ) { |
| |
| 196 | + | if (is_object($GLOBALS[$this->selected_module]) && ($GLOBALS[$this->selected_module]->getStatus() === true) ) { |
|
175 | 197 | | return $GLOBALS[$this->selected_module]->get_error(); |
| |
176 | 198 | | } |
| |
177 | 199 | | } |
| |
|
|
 |
… |
|
184 | 206 | | $has_active = false; |
| |
185 | 207 | | |
| |
186 | 208 | | foreach ($this->modules as $module) { |
  |
187 | | - | if ($GLOBALS['osC_Payment_' . $module]->enabled) { |
| |
| 209 | + | if ($GLOBALS['osC_Payment_' . $module]->getStatus() === true) { |
|
188 | 210 | | $has_active = true; |
| |
189 | 211 | | break; |
| |
190 | 212 | | } |
| |
|
|
 |
… |
|
201 | 223 | | $active = 0; |
| |
202 | 224 | | |
| |
203 | 225 | | foreach ($this->modules as $module) { |
  |
204 | | - | if ($GLOBALS['osC_Payment_' . $module]->enabled) { |
| |
| 226 | + | if ($GLOBALS['osC_Payment_' . $module]->getStatus() === true) { |
|
205 | 227 | | $active++; |
| |
206 | 228 | | } |
| |
207 | 229 | | } |
| |
|
|
 |
… |
|
290 | 312 | | } |
| |
291 | 313 | | |
| |
292 | 314 | | function _usortModules($a, $b) { |
  |
293 | | - | if ($GLOBALS['osC_Payment_' . $a]->sort_order == $GLOBALS['osC_Payment_' . $b]->sort_order) { |
| |
294 | | - | return strnatcasecmp($GLOBALS['osC_Payment_' . $a]->title, $GLOBALS['osC_Payment_' . $a]->title); |
| |
| 315 | + | if ($GLOBALS['osC_Payment_' . $a]->getSortOrder() == $GLOBALS['osC_Payment_' . $b]->getSortOrder()) { |
| |
| 316 | + | return strnatcasecmp($GLOBALS['osC_Payment_' . $a]->getTitle(), $GLOBALS['osC_Payment_' . $a]->getTitle()); |
|
295 | 317 | | } |
| |
296 | 318 | | |
  |
297 | | - | return ($GLOBALS['osC_Payment_' . $a]->sort_order < $GLOBALS['osC_Payment_' . $b]->sort_order) ? -1 : 1; |
| |
| 319 | + | return ($GLOBALS['osC_Payment_' . $a]->getSortOrder() < $GLOBALS['osC_Payment_' . $b]->getSortOrder()) ? -1 : 1; |
  |
298 | 320 | | } |
| |
299 | 321 | | } |
| |
300 | 322 | | ?> |