Total Complexity | 54 |
Total Lines | 670 |
Duplicated Lines | 0 % |
Changes | 10 | ||
Bugs | 0 | Features | 0 |
Complex classes like pagantis often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use pagantis, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
13 | class pagantis |
||
14 | { |
||
15 | /** @var String $is_guest */ |
||
16 | public $is_guest; |
||
17 | |||
18 | /** @var Array $extraConfig */ |
||
19 | public $extraConfig; |
||
20 | |||
21 | /** @var String $form_action_url */ |
||
22 | public $form_action_url; |
||
23 | |||
24 | /** @var String $base_url */ |
||
25 | public $base_url; |
||
26 | |||
27 | /** @var String $os_order_reference */ |
||
28 | public $os_order_reference; |
||
29 | |||
30 | /** @var notifyController $pgNotify */ |
||
31 | public $pgNotify; |
||
32 | |||
33 | public $defaultConfigs = array('PAGANTIS_TITLE'=>'Instant Financing', |
||
34 | 'PAGANTIS_SIMULATOR_DISPLAY_TYPE'=>'pgSDK.simulator.types.SIMPLE', |
||
35 | 'PAGANTIS_SIMULATOR_DISPLAY_SKIN'=>'pgSDK.simulator.skins.BLUE', |
||
36 | 'PAGANTIS_SIMULATOR_DISPLAY_POSITION'=>'hookDisplayProductButtons', |
||
37 | 'PAGANTIS_SIMULATOR_START_INSTALLMENTS'=>3, |
||
38 | 'PAGANTIS_SIMULATOR_MAX_INSTALLMENTS'=>12, |
||
39 | 'PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR'=>'default', |
||
40 | 'PAGANTIS_SIMULATOR_DISPLAY_CSS_POSITION'=>'pgSDK.simulator.positions.INNER', |
||
41 | 'PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'=>'default', |
||
42 | 'PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR'=>'default', |
||
43 | 'PAGANTIS_FORM_DISPLAY_TYPE'=>0, |
||
44 | 'PAGANTIS_DISPLAY_MIN_AMOUNT'=>1, |
||
45 | 'PAGANTIS_URL_OK'=>'', |
||
46 | 'PAGANTIS_URL_KO'=>'', |
||
47 | 'PAGANTIS_TITLE_EXTRA' => 'Paga hasta en 12 cómodas cuotas con Paga+Tarde. Solicitud totalmente online y sin papeleos,¡y la respuesta es inmediata!', |
||
48 | 'PAGANTIS_PROMOTION' => '' |
||
49 | ); |
||
50 | |||
51 | /** |
||
52 | * Constructor |
||
53 | */ |
||
54 | public function __construct() |
||
55 | { |
||
56 | $this->version = '8.0.0'; |
||
|
|||
57 | $this->code = 'pagantis'; |
||
58 | $this->sort_order = 0; |
||
59 | $this->description = $this->getDescription(); |
||
60 | $this->extraConfig = $this->getExtraConfig(); |
||
61 | |||
62 | if (strpos($_SERVER[REQUEST_URI], "checkout_payment.php") <= 0) { |
||
63 | $this->title = MODULE_PAYMENT_PAGANTIS_TEXT_ADMIN_TITLE; // Payment module title in Admin |
||
64 | } else { |
||
65 | $this->title = $this->extraConfig['PAGANTIS_TITLE']; // Payment module title in Catalog |
||
66 | } |
||
67 | |||
68 | $this->enabled = ((MODULE_PAYMENT_PAGANTIS_STATUS == 'True') ? true : false); |
||
69 | |||
70 | $this->base_url = dirname( |
||
71 | sprintf( |
||
72 | "%s://%s%s%s", |
||
73 | isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http', |
||
74 | $_SERVER['SERVER_NAME'], |
||
75 | isset($_SERVER['SERVER_PORT']) ? ":" . $_SERVER['SERVER_PORT'] : '', |
||
76 | $_SERVER['REQUEST_URI'] |
||
77 | ) |
||
78 | ); |
||
79 | |||
80 | $this->form_action_url = $this->base_url . '/ext/modules/payment/pagantis/bypass.php'; |
||
81 | } |
||
82 | |||
83 | /*************** |
||
84 | * |
||
85 | * CLASS METHODS |
||
86 | * |
||
87 | **************/ |
||
88 | /** |
||
89 | * Here you can implement using payment zones (refer to standard PayPal module as reference) |
||
90 | */ |
||
91 | public function update_status() |
||
92 | { |
||
93 | |||
94 | } |
||
95 | |||
96 | /* |
||
97 | * Here you may define client side javascript that will verify any input fields you use in the payment method |
||
98 | * selection page. Refer to standard cc module as reference (cc.php). |
||
99 | */ |
||
100 | public function javascript_validation() |
||
101 | { |
||
102 | return false; |
||
103 | } |
||
104 | |||
105 | /* |
||
106 | * Llamada cuando el usuario esta en la pantalla de eleccion de tipo de pago |
||
107 | * This function outputs the payment method title/text and if required, the input fields. |
||
108 | * |
||
109 | * Si hay un pedido generado previamente y no confirmado, se borra |
||
110 | * Caso de uso: |
||
111 | * - el usuario llega a la pantalla de confirmacion |
||
112 | * - se genera el pedido (pero no se genera entrada en orders_status_history) |
||
113 | * - el usuario decide realizar algun cambio en su compra antes de pasar a pagantis |
||
114 | * - entra de nuevo en la pantalla de seleccion de tipo de pago (puede elegir otra forma de pago) |
||
115 | * - se comprueba que no exista el pedido generado anteriormente |
||
116 | * - se borra el pedido que se habia generado inicialmente. Ya no es valido |
||
117 | * |
||
118 | */ |
||
119 | public function selection() |
||
120 | { |
||
121 | return array('id' => $this->code, 'module' => $this->title); |
||
122 | } |
||
123 | |||
124 | /* |
||
125 | * Use this function implement any checks of any conditions after payment method has been selected. You most probably |
||
126 | * don't need to implement anything here. |
||
127 | */ |
||
128 | public function pre_confirmation_check() |
||
131 | } |
||
132 | |||
133 | /* |
||
134 | * Implement any checks or processing on the order information before proceeding to payment confirmation. You most |
||
135 | probably don't need to implement anything here. |
||
136 | * Llamada cuando el usuario entra en la pantalla de confirmacion |
||
137 | * |
||
138 | * Se genera el pedido: |
||
139 | * - con el estado predefinido para el modulo pagantis |
||
140 | * - sin notificacion a cliente ni administrador |
||
141 | * - no se borra el carrito asociado al pedido |
||
142 | * |
||
143 | */ |
||
144 | public function confirmation() |
||
147 | } |
||
148 | |||
149 | /** |
||
150 | * Build the data and actions to process when the "Submit" button is pressed on the order-confirmation screen. |
||
151 | * This sends the data to the payment gateway for processing. |
||
152 | * (These are hidden fields on the checkout confirmation page) |
||
153 | */ |
||
154 | public function process_button() |
||
155 | { |
||
156 | try { |
||
157 | include_once('./ext/modules/payment/pagantis/vendor/autoload.php'); |
||
158 | global $order, $customer_id, $sendto, $billto, $cart, $languages_id, $currency, $currencies, $shipping, |
||
159 | $payment, $comments, $customer_default_address_id, $cartID; |
||
160 | $global_vars = array(); |
||
161 | $global_vars['customer_id'] = serialize($customer_id); |
||
162 | $global_vars['sendTo'] = serialize($sendto); |
||
163 | $global_vars['billTo'] = serialize($billto); |
||
164 | $global_vars['cart'] = serialize($cart); |
||
165 | $global_vars['languages_id'] = serialize($languages_id); |
||
166 | $global_vars['currency'] = serialize($currency); |
||
167 | $global_vars['currencies'] = serialize($currencies); |
||
168 | $global_vars['shipping'] = serialize($shipping); |
||
169 | $global_vars['payment'] = serialize($payment); |
||
170 | $global_vars['comments'] = serialize($comments); |
||
171 | $global_vars['$customer_default_address_id'] = serialize($customer_default_address_id); |
||
172 | $global_vars['cartID'] = serialize($cartID); |
||
173 | $global_vars['sessiontoken'] = serialize($_SESSION['sessiontoken']); |
||
174 | |||
175 | if (!isset($order)) { |
||
176 | throw new UnknownException("Order not found"); |
||
177 | } |
||
178 | |||
179 | $id_hash = time() . serialize($order->products) . '' . serialize($order->customer) . '' . serialize($order->delivery); |
||
180 | $this->os_order_reference = md5($id_hash); |
||
181 | $_SESSION['order_id'] = $this->os_order_reference; |
||
182 | |||
183 | $userAddress = new Address(); |
||
184 | $userAddress |
||
185 | ->setZipCode($order->billing['postcode']) |
||
186 | ->setFullName($order->billing['firstname'] . ' ' . $order->billing['lastname']) |
||
187 | ->setCountryCode('ES') |
||
188 | ->setCity($order->billing['city']) |
||
189 | ->setAddress($order->billing['street_address']) |
||
190 | ->setFixPhone($order->customer['telephone']) |
||
191 | ->setMobilePhone($order->customer['telephone']); |
||
192 | |||
193 | $orderBillingAddress = $userAddress; |
||
194 | |||
195 | $orderShippingAddress = new Address(); |
||
196 | $orderShippingAddress |
||
197 | ->setZipCode($order->delivery['postcode']) |
||
198 | ->setFullName($order->billing['firstname'] . ' ' . $order->billing['lastname']) |
||
199 | ->setCountryCode('ES') |
||
200 | ->setCity($order->delivery['city']) |
||
201 | ->setAddress($order->delivery['street_address']) |
||
202 | ->setFixPhone($order->customer['telephone']) |
||
203 | ->setMobilePhone($order->customer['telephone']); |
||
204 | |||
205 | $orderUser = new \Pagantis\OrdersApiClient\Model\Order\User(); |
||
206 | $orderUser |
||
207 | ->setAddress($userAddress) |
||
208 | ->setFullName($order->billing['firstname'] . ' ' . $order->billing['lastname']) |
||
209 | ->setBillingAddress($orderBillingAddress) |
||
210 | ->setEmail($order->customer['email_address']) |
||
211 | ->setFixPhone($order->customer['telephone']) |
||
212 | ->setMobilePhone($order->customer['telephone']) |
||
213 | ->setShippingAddress($orderShippingAddress); |
||
214 | |||
215 | $previousOrders = $this->getOrders(); |
||
216 | foreach ((array)$previousOrders as $k => $previousOrder) { |
||
217 | $orderHistory = new \Pagantis\OrdersApiClient\Model\Order\User\OrderHistory(); |
||
218 | $orderHistory |
||
219 | ->setAmount(intval(100 * $previousOrder['value'])) |
||
220 | ->setDate(new \DateTime($previousOrder['date_purchased'])); |
||
221 | $orderUser->addOrderHistory($orderHistory); |
||
222 | } |
||
223 | |||
224 | $details = new \Pagantis\OrdersApiClient\Model\Order\ShoppingCart\Details(); |
||
225 | $shippingCost = number_format($order->info['shipping_cost'], 2, '.', ''); |
||
226 | $details->setShippingCost(intval(strval(100 * $shippingCost))); |
||
227 | |||
228 | $promotedAmount = 0; |
||
229 | foreach ($order->products as $item) { |
||
230 | $promotedProduct = $this->isPromoted($item); |
||
231 | $product = new \Pagantis\OrdersApiClient\Model\Order\ShoppingCart\Details\Product(); |
||
232 | $product |
||
233 | ->setAmount(intval(100 * number_format(($item['final_price'] * $item['qty']), 2))) |
||
234 | ->setQuantity(intval($item['qty'])) |
||
235 | ->setDescription($item['name']); |
||
236 | if ($promotedProduct) { |
||
237 | $promotedAmount+=$product->getAmount(); |
||
238 | } |
||
239 | $details->addProduct($product); |
||
240 | } |
||
241 | |||
242 | $orderShoppingCart = new \Pagantis\OrdersApiClient\Model\Order\ShoppingCart(); |
||
243 | $orderShoppingCart |
||
244 | ->setDetails($details) |
||
245 | ->setOrderReference($this->os_order_reference) |
||
246 | ->setPromotedAmount(0) |
||
247 | ->setTotalAmount(intval($order->info['total'] * 100)) |
||
248 | ->setPromotedAmount($promotedAmount); |
||
249 | |||
250 | $callback_url = $this->base_url.'/ext/modules/payment/pagantis/notify.php'; |
||
251 | $checkoutProcessUrl = htmlspecialchars_decode( |
||
252 | tep_href_link(FILENAME_CHECKOUT_PROCESS, "order_id=$this->os_order_reference&from=order", 'SSL', true) |
||
253 | ); |
||
254 | |||
255 | $cancelUrl = trim(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL', false)); |
||
256 | if ($this->extraConfig['PAGANTIS_URL_KO']!='') { |
||
257 | $koUrl = $this->extraConfig['PAGANTIS_URL_KO']; |
||
258 | } else { |
||
259 | $koUrl = $cancelUrl; |
||
260 | } |
||
261 | |||
262 | $orderConfigurationUrls = new \Pagantis\OrdersApiClient\Model\Order\Configuration\Urls(); |
||
263 | $orderConfigurationUrls |
||
264 | ->setCancel($cancelUrl) |
||
265 | ->setKo($koUrl) |
||
266 | ->setAuthorizedNotificationCallback($callback_url) |
||
267 | ->setRejectedNotificationCallback($callback_url) |
||
268 | ->setOk($checkoutProcessUrl); |
||
269 | |||
270 | |||
271 | $orderChannel = new \Pagantis\OrdersApiClient\Model\Order\Configuration\Channel(); |
||
272 | $orderChannel |
||
273 | ->setAssistedSale(false) |
||
274 | ->setType(\Pagantis\OrdersApiClient\Model\Order\Configuration\Channel::ONLINE); |
||
275 | $orderConfiguration = new \Pagantis\OrdersApiClient\Model\Order\Configuration(); |
||
276 | $orderConfiguration |
||
277 | ->setChannel($orderChannel) |
||
278 | ->setUrls($orderConfigurationUrls); |
||
279 | |||
280 | $metadataOrder = new \Pagantis\OrdersApiClient\Model\Order\Metadata(); |
||
281 | $metadata = array( |
||
282 | 'oscommerce' => PROJECT_VERSION, |
||
283 | 'pagantis' => $this->version, |
||
284 | 'php' => phpversion() |
||
285 | ); |
||
286 | foreach ($metadata as $key => $metadatum) { |
||
287 | $metadataOrder->addMetadata($key, $metadatum); |
||
288 | } |
||
289 | $orderApiClient = new \Pagantis\OrdersApiClient\Model\Order(); |
||
290 | $orderApiClient |
||
291 | ->setConfiguration($orderConfiguration) |
||
292 | ->setMetadata($metadataOrder) |
||
293 | ->setShoppingCart($orderShoppingCart) |
||
294 | ->setUser($orderUser); |
||
295 | |||
296 | $publicKey = trim(MODULE_PAYMENT_PAGANTIS_PK); |
||
297 | $secretKey = trim(MODULE_PAYMENT_PAGANTIS_SK); |
||
298 | $orderClient = new \Pagantis\OrdersApiClient\Client($publicKey, $secretKey); |
||
299 | $pagantisOrder = $orderClient->createOrder($orderApiClient); |
||
300 | if ($pagantisOrder instanceof \Pagantis\OrdersApiClient\Model\Order) { |
||
301 | $url = $pagantisOrder->getActionUrls()->getForm(); |
||
302 | $this->insertRow($this->os_order_reference, $pagantisOrder->getId(), serialize($global_vars)); |
||
303 | } else { |
||
304 | throw new OrderNotFoundException(); |
||
305 | } |
||
306 | |||
307 | if ($url == "") { |
||
308 | throw new UnknownException(_("No ha sido posible obtener una respuesta de Pagantis")); |
||
309 | } else { |
||
310 | $output = "\n"; |
||
311 | $output .= tep_draw_hidden_field("formUrl", $url) . "\n"; |
||
312 | $output .= tep_draw_hidden_field("cancelUrl", $cancelUrl) . "\n"; |
||
313 | return $output; |
||
314 | |||
315 | } //TODO IFRAME |
||
316 | } catch (\Exception $exception) { |
||
317 | tep_redirect($cancelUrl); |
||
318 | return; |
||
319 | } |
||
320 | } |
||
321 | |||
322 | /** |
||
323 | * @throws Exception |
||
324 | */ |
||
325 | public function before_process() |
||
326 | { |
||
327 | include_once('./ext/modules/payment/pagantis/notifyController.php'); |
||
328 | $this->pgNotify = new notifyController(); |
||
329 | $this->pgNotify->setOscommerceOrderId($_GET['order_id']); |
||
330 | $this->pgNotify->setOrigin(isset($_GET['from']) ? ($_GET['from']) : 'order'); |
||
331 | $this->pgNotify->processInformation(); |
||
332 | } |
||
333 | |||
334 | /** |
||
335 | * Post-processing activities |
||
336 | * |
||
337 | * @return boolean |
||
338 | */ |
||
339 | public function after_process() |
||
340 | { |
||
341 | $this->pgNotify->confirmInformation(); |
||
342 | } |
||
343 | |||
344 | /** |
||
345 | * @return bool |
||
346 | */ |
||
347 | public function output_error() |
||
348 | { |
||
349 | return false; |
||
350 | } |
||
351 | |||
352 | /** |
||
353 | * @return mixed |
||
354 | */ |
||
355 | public function check() |
||
356 | { |
||
357 | if (!isset($this->_check)) { |
||
358 | $query = "select * from ".TABLE_CONFIGURATION." where configuration_key = 'MODULE_PAYMENT_PAGANTIS_STATUS'"; |
||
359 | $check_query = tep_db_query($query); |
||
360 | $this->_check = tep_db_num_rows($check_query); |
||
361 | } |
||
362 | $this->installPagantisTables(); |
||
363 | return $this->_check; |
||
364 | } |
||
365 | |||
366 | /** |
||
367 | * This is where you define module's configurations (displayed in admin). |
||
368 | */ |
||
369 | public function install() |
||
445 | } |
||
446 | |||
447 | /** |
||
448 | * Create the neccesary tables for the module |
||
449 | */ |
||
450 | private function installPagantisTables() |
||
451 | { |
||
452 | $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_LOG . " ( |
||
453 | id int NOT NULL AUTO_INCREMENT, |
||
454 | log text NOT NULL, |
||
455 | createdAt timestamp DEFAULT CURRENT_TIMESTAMP, |
||
456 | UNIQUE KEY id (id))"; |
||
457 | tep_db_query($sql); |
||
458 | |||
459 | $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_CONFIG . " ( |
||
460 | id int NOT NULL AUTO_INCREMENT, |
||
461 | config varchar(60) NOT NULL, |
||
462 | value varchar(200) NOT NULL, |
||
463 | UNIQUE KEY id(id))"; |
||
464 | tep_db_query($sql); |
||
465 | |||
466 | // check if table has records |
||
467 | $check_query = tep_db_query("select value from " . TABLE_PAGANTIS_CONFIG); |
||
468 | if (tep_db_num_rows($check_query) === 0) { |
||
469 | foreach ((array)$this->defaultConfigs as $configKey => $configValue) { |
||
470 | $query = "INSERT INTO " . TABLE_PAGANTIS_CONFIG . " |
||
471 | ( |
||
472 | config, |
||
473 | value |
||
474 | ) |
||
475 | values |
||
476 | ( |
||
477 | '$configKey', |
||
478 | '$configValue' |
||
479 | )"; |
||
480 | tep_db_query($query); |
||
481 | } |
||
482 | } |
||
483 | |||
484 | $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_ORDERS . " ( |
||
485 | id int NOT NULL AUTO_INCREMENT, |
||
486 | os_order_id varchar(50), |
||
487 | os_order_reference varchar(50) NOT NULL, |
||
488 | pagantis_order_id varchar(50) NOT NULL, |
||
489 | globals text, |
||
490 | UNIQUE KEY id(id))"; |
||
491 | tep_db_query($sql); |
||
492 | |||
493 | $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_CONCURRENCY . " ( |
||
494 | id varchar(50) NOT NULL, |
||
495 | `timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, |
||
496 | UNIQUE KEY id(id))"; |
||
497 | tep_db_query($sql); |
||
498 | } |
||
499 | |||
500 | /** |
||
501 | * Standard functionality to uninstall the module. |
||
502 | */ |
||
503 | public function remove() |
||
504 | { |
||
505 | $checkTable = tep_db_query("SHOW TABLES LIKE '" . TABLE_PAGANTIS_LOG . "'"); |
||
506 | if (tep_db_num_rows($checkTable) > 0) { |
||
507 | tep_db_query("drop table " . TABLE_PAGANTIS_LOG); |
||
508 | } |
||
509 | |||
510 | $checkTable = tep_db_query("SHOW TABLES LIKE '" . TABLE_PAGANTIS_CONFIG . "'"); |
||
511 | if (tep_db_num_rows($checkTable) > 0) { |
||
512 | tep_db_query("drop table " . TABLE_PAGANTIS_CONFIG); |
||
513 | } |
||
514 | |||
515 | $checkTable = tep_db_query("SHOW TABLES LIKE '" . TABLE_PAGANTIS_ORDERS . "'"); |
||
516 | if (tep_db_num_rows($checkTable) > 0) { |
||
517 | tep_db_query("drop table " . TABLE_PAGANTIS_ORDERS); |
||
518 | } |
||
519 | |||
520 | $checkTable = tep_db_query("SHOW TABLES LIKE '" . TABLE_PAGANTIS_CONCURRENCY . "'"); |
||
521 | if (tep_db_num_rows($checkTable) > 0) { |
||
522 | tep_db_query("drop table " . TABLE_PAGANTIS_CONCURRENCY); |
||
523 | } |
||
524 | |||
525 | tep_db_query("DELETE FROM ". TABLE_CONFIGURATION ." where configuration_key in ('MODULE_PAYMENT_PAGANTIS_STATUS','MODULE_PAYMENT_PAGANTIS_PK','MODULE_PAYMENT_PAGANTIS_SK')"); |
||
526 | |||
527 | $query = "delete from " . TABLE_CONFIGURATION . " where configuration_key like '%_PAGANTIS_%'"; |
||
528 | tep_db_query($query); |
||
529 | |||
530 | $this->uninstallSimulator(); |
||
531 | } |
||
532 | |||
533 | /** |
||
534 | * Internal list of configuration keys used for configuration of the module |
||
535 | * |
||
536 | * @return array |
||
537 | */ |
||
538 | public function keys() |
||
539 | { |
||
540 | return array('MODULE_PAYMENT_PAGANTIS_STATUS', |
||
541 | 'MODULE_PAYMENT_PAGANTIS_PK', |
||
542 | 'MODULE_PAYMENT_PAGANTIS_SK' |
||
543 | ); |
||
544 | } |
||
545 | |||
546 | /** |
||
547 | * @return array |
||
548 | */ |
||
549 | private function getOrders() |
||
550 | { |
||
551 | $this->is_guest = 'true'; |
||
552 | if (trim($_SESSION['customer_id']) != '') { |
||
553 | $this->is_guest = 'false'; |
||
554 | $query = sprintf( |
||
555 | "select orders_total.value, orders.date_purchased from orders |
||
556 | JOIN orders_status_history ON orders.orders_id=orders_status_history.orders_id |
||
557 | JOIN orders_total ON orders.orders_id=orders_total.orders_id |
||
558 | where orders.customers_id='%s' and orders_status_history.orders_status_id in ('2','3') |
||
559 | and orders_total.class='ot_total'", |
||
560 | $_SESSION['customer_id'] |
||
561 | ); |
||
562 | |||
563 | $response = array(); |
||
564 | $resultsSelect = tep_db_query($query); |
||
565 | while ($orderRow = tep_db_fetch_array($resultsSelect)) { |
||
566 | $response[] = $orderRow; |
||
567 | } |
||
568 | } |
||
569 | |||
570 | return $response; |
||
571 | } |
||
572 | |||
573 | /** |
||
574 | * @param $orderId |
||
575 | * @param $pagantisOrderId |
||
576 | * @param $globalVars |
||
577 | */ |
||
578 | private function insertRow($orderId, $pagantisOrderId, $globalVars) |
||
591 | } |
||
592 | |||
593 | /** |
||
594 | * @return array |
||
595 | */ |
||
596 | private function getExtraConfig() |
||
610 | } |
||
611 | |||
612 | /** |
||
613 | * @param $item |
||
614 | * |
||
615 | * @return bool |
||
616 | */ |
||
617 | private function isPromoted($item) |
||
618 | { |
||
619 | $productId = explode('{', $item['id'], 1); |
||
620 | $productId = $productId['0']; |
||
621 | |||
622 | if ($this->extraConfig['PAGANTIS_PROMOTION'] == '') { |
||
623 | $promotedProducts = array(); |
||
624 | } else { |
||
625 | $promotedProducts = array_values((array)unserialize($this->extraConfig['PAGANTIS_PROMOTION'])); |
||
626 | } |
||
627 | |||
628 | return (in_array($productId, $promotedProducts)); |
||
629 | } |
||
630 | |||
631 | /** |
||
632 | * @return string |
||
633 | */ |
||
634 | private function getDescription() |
||
646 | } |
||
647 | |||
648 | |||
649 | /** |
||
650 | * @return bool |
||
651 | */ |
||
652 | private function installSimulator() |
||
653 | { |
||
666 | } |
||
667 | |||
668 | private function uninstallSimulator() |
||
685 |