| Total Complexity | 43 |
| Total Lines | 492 |
| Duplicated Lines | 0 % |
| Changes | 4 | ||
| 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 | ); |
||
| 49 | |||
| 50 | /** |
||
| 51 | * Constructor |
||
| 52 | */ |
||
| 53 | public function __construct() |
||
| 54 | { |
||
| 55 | $this->version = '8.0.0'; |
||
|
|
|||
| 56 | $this->code = 'pagantis'; |
||
| 57 | $this->sort_order = 0; |
||
| 58 | |||
| 59 | if (strpos($_SERVER[REQUEST_URI], "checkout_payment.php") <= 0) { |
||
| 60 | $this->title = MODULE_PAYMENT_PAGANTIS_TEXT_ADMIN_TITLE; // Payment module title in Admin |
||
| 61 | } else { |
||
| 62 | $this->title = MODULE_PAYMENT_PAGANTIS_TEXT_CATALOG_TITLE; // Payment module title in Catalog |
||
| 63 | } |
||
| 64 | |||
| 65 | $this->enabled = ((MODULE_PAYMENT_PAGANTIS_STATUS == 'True') ? true : false); |
||
| 66 | |||
| 67 | $this->extraConfig = $this->getExtraConfig(); |
||
| 68 | |||
| 69 | $this->base_url = dirname( |
||
| 70 | sprintf( |
||
| 71 | "%s://%s%s%s", |
||
| 72 | isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http', |
||
| 73 | $_SERVER['SERVER_NAME'], |
||
| 74 | isset($_SERVER['SERVER_PORT']) ? ":".$_SERVER['SERVER_PORT'] : '', |
||
| 75 | $_SERVER['REQUEST_URI'] |
||
| 76 | ) |
||
| 77 | ); |
||
| 78 | |||
| 79 | $this->form_action_url = $this->base_url . '/ext/modules/payment/pagantis/bypass.php'; |
||
| 80 | } |
||
| 81 | |||
| 82 | /*************** |
||
| 83 | * |
||
| 84 | * CLASS METHODS |
||
| 85 | * |
||
| 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, $payment, $comments, $customer_default_address_id, $cartID; |
||
| 159 | $global_vars = array(); |
||
| 160 | $global_vars['customer_id'] = serialize($customer_id); |
||
| 161 | $global_vars['sendTo'] = serialize($sendto); |
||
| 162 | $global_vars['billTo'] = serialize($billto); |
||
| 163 | $global_vars['cart'] = serialize($cart); |
||
| 164 | $global_vars['languages_id'] = serialize($languages_id); |
||
| 165 | $global_vars['currency'] = serialize($currency); |
||
| 166 | $global_vars['currencies'] = serialize($currencies); |
||
| 167 | $global_vars['shipping'] = serialize($shipping); |
||
| 168 | $global_vars['payment'] = serialize($payment); |
||
| 169 | $global_vars['comments'] = serialize($comments); |
||
| 170 | $global_vars['$customer_default_address_id'] = serialize($customer_default_address_id); |
||
| 171 | $global_vars['cartID'] = serialize($cartID); |
||
| 172 | $global_vars['sessiontoken'] = serialize($_SESSION['sessiontoken']); |
||
| 173 | |||
| 174 | if (!isset($order)) { |
||
| 175 | throw new UnknownException("Order not found"); |
||
| 176 | } |
||
| 177 | |||
| 178 | $id_hash = time().serialize($order->products).''.serialize($order->customer).''.serialize($order->delivery); |
||
| 179 | $this->os_order_reference = md5($id_hash); |
||
| 180 | $_SESSION['order_id'] = $this->os_order_reference; |
||
| 181 | |||
| 182 | $userAddress = new Address(); |
||
| 183 | $userAddress |
||
| 184 | ->setZipCode($order->billing['postcode']) |
||
| 185 | ->setFullName($order->billing['firstname'].' '.$order->billing['lastname']) |
||
| 186 | ->setCountryCode('ES') |
||
| 187 | ->setCity($order->billing['city']) |
||
| 188 | ->setAddress($order->billing['street_address']) |
||
| 189 | ->setFixPhone($order->customer['telephone']) |
||
| 190 | ->setMobilePhone($order->customer['telephone']); |
||
| 191 | |||
| 192 | $orderBillingAddress = $userAddress; |
||
| 193 | |||
| 194 | $orderShippingAddress = new Address(); |
||
| 195 | $orderShippingAddress |
||
| 196 | ->setZipCode($order->delivery['postcode']) |
||
| 197 | ->setFullName($order->billing['firstname'].' '.$order->billing['lastname']) |
||
| 198 | ->setCountryCode('ES') |
||
| 199 | ->setCity($order->delivery['city']) |
||
| 200 | ->setAddress($order->delivery['street_address']) |
||
| 201 | ->setFixPhone($order->customer['telephone']) |
||
| 202 | ->setMobilePhone($order->customer['telephone']); |
||
| 203 | |||
| 204 | $orderUser = new \Pagantis\OrdersApiClient\Model\Order\User(); |
||
| 205 | $orderUser |
||
| 206 | ->setAddress($userAddress) |
||
| 207 | ->setFullName($order->billing['firstname'].' '.$order->billing['lastname']) |
||
| 208 | ->setBillingAddress($orderBillingAddress) |
||
| 209 | ->setEmail($order->customer['email_address']) |
||
| 210 | ->setFixPhone($order->customer['telephone']) |
||
| 211 | ->setMobilePhone($order->customer['telephone']) |
||
| 212 | ->setShippingAddress($orderShippingAddress); |
||
| 213 | |||
| 214 | $previousOrders = $this->getOrders(); |
||
| 215 | foreach ((array)$previousOrders as $k => $previousOrder) { |
||
| 216 | $orderHistory = new \Pagantis\OrdersApiClient\Model\Order\User\OrderHistory(); |
||
| 217 | $orderHistory |
||
| 218 | ->setAmount(intval(100 * $previousOrder['value'])) |
||
| 219 | ->setDate(new \DateTime($previousOrder['date_purchased'])) |
||
| 220 | ; |
||
| 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 | foreach ($order->products as $item) { |
||
| 228 | $product = new \Pagantis\OrdersApiClient\Model\Order\ShoppingCart\Details\Product(); |
||
| 229 | $product |
||
| 230 | ->setAmount(intval(100 * number_format(($item['final_price'] * $item['qty']), 2))) |
||
| 231 | ->setQuantity(intval($item['qty'])) |
||
| 232 | ->setDescription($item['name']); |
||
| 233 | $details->addProduct($product); |
||
| 234 | } |
||
| 235 | |||
| 236 | $orderShoppingCart = new \Pagantis\OrdersApiClient\Model\Order\ShoppingCart(); |
||
| 237 | $orderShoppingCart |
||
| 238 | ->setDetails($details) |
||
| 239 | ->setOrderReference($this->os_order_reference) |
||
| 240 | ->setPromotedAmount(0) |
||
| 241 | ->setTotalAmount(intval($order->info['total'] * 100)); |
||
| 242 | |||
| 243 | $callback_url = $this->base_url.'/ext/modules/payment/pagantis/notify.php'; |
||
| 244 | $checkoutProcessUrl = htmlspecialchars_decode( |
||
| 245 | tep_href_link(FILENAME_CHECKOUT_PROCESS, "order_id=$this->os_order_reference&from=order", 'SSL', true, false) |
||
| 246 | ); |
||
| 247 | $cancelUrl = trim(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL', false)); |
||
| 248 | $orderConfigurationUrls = new \Pagantis\OrdersApiClient\Model\Order\Configuration\Urls(); |
||
| 249 | $orderConfigurationUrls |
||
| 250 | ->setCancel($cancelUrl) |
||
| 251 | ->setKo($cancelUrl) |
||
| 252 | ->setAuthorizedNotificationCallback($callback_url) |
||
| 253 | ->setRejectedNotificationCallback($callback_url) |
||
| 254 | ->setOk($checkoutProcessUrl); |
||
| 255 | |||
| 256 | |||
| 257 | $orderChannel = new \Pagantis\OrdersApiClient\Model\Order\Configuration\Channel(); |
||
| 258 | $orderChannel |
||
| 259 | ->setAssistedSale(false) |
||
| 260 | ->setType(\Pagantis\OrdersApiClient\Model\Order\Configuration\Channel::ONLINE); |
||
| 261 | $orderConfiguration = new \Pagantis\OrdersApiClient\Model\Order\Configuration(); |
||
| 262 | $orderConfiguration |
||
| 263 | ->setChannel($orderChannel) |
||
| 264 | ->setUrls($orderConfigurationUrls); |
||
| 265 | |||
| 266 | $metadataOrder = new \Pagantis\OrdersApiClient\Model\Order\Metadata(); |
||
| 267 | $metadata = array( |
||
| 268 | 'oscommerce' => PROJECT_VERSION, |
||
| 269 | 'pagantis' => $this->version, |
||
| 270 | 'php' => phpversion() |
||
| 271 | ); |
||
| 272 | foreach ($metadata as $key => $metadatum) { |
||
| 273 | $metadataOrder->addMetadata($key, $metadatum); |
||
| 274 | } |
||
| 275 | $orderApiClient = new \Pagantis\OrdersApiClient\Model\Order(); |
||
| 276 | $orderApiClient |
||
| 277 | ->setConfiguration($orderConfiguration) |
||
| 278 | ->setMetadata($metadataOrder) |
||
| 279 | ->setShoppingCart($orderShoppingCart) |
||
| 280 | ->setUser($orderUser); |
||
| 281 | |||
| 282 | $publicKey = trim(MODULE_PAYMENT_PAGANTIS_PK); |
||
| 283 | $secretKey = trim(MODULE_PAYMENT_PAGANTIS_SK); |
||
| 284 | $orderClient = new \Pagantis\OrdersApiClient\Client($publicKey, $secretKey); |
||
| 285 | $pagantisOrder = $orderClient->createOrder($orderApiClient); |
||
| 286 | if ($pagantisOrder instanceof \Pagantis\OrdersApiClient\Model\Order) { |
||
| 287 | $url = $pagantisOrder->getActionUrls()->getForm(); |
||
| 288 | $this->insertRow($this->os_order_reference, $pagantisOrder->getId(), serialize($global_vars)); |
||
| 289 | } else { |
||
| 290 | throw new OrderNotFoundException(); |
||
| 291 | } |
||
| 292 | |||
| 293 | if ($url == "") { |
||
| 294 | throw new UnknownException(_("No ha sido posible obtener una respuesta de Pagantis")); |
||
| 295 | } else { //if ($this->extraConfig['PAGANTIS_FORM_DISPLAY_TYPE'] == '0') { |
||
| 296 | $output = "\n"; |
||
| 297 | $output.= tep_draw_hidden_field("formUrl", $url) . "\n"; |
||
| 298 | $output.= tep_draw_hidden_field("cancelUrl", $cancelUrl) . "\n"; |
||
| 299 | return $output; |
||
| 300 | } //TODO IFRAME |
||
| 301 | } catch (\Exception $exception) { |
||
| 302 | tep_redirect($cancelUrl); |
||
| 303 | return; |
||
| 304 | } |
||
| 305 | } |
||
| 306 | |||
| 307 | /** |
||
| 308 | * |
||
| 309 | */ |
||
| 310 | public function before_process() |
||
| 311 | { |
||
| 312 | include_once('./ext/modules/payment/pagantis/notifyController.php'); |
||
| 313 | $this->pgNotify = new notifyController(); |
||
| 314 | $this->pgNotify->setOscommerceOrderId($_GET['order_id']); |
||
| 315 | $this->pgNotify->setOrigin(isset($_GET['from']) ? ($_GET['from']) : 'order'); |
||
| 316 | $this->pgNotify->processInformation(); |
||
| 317 | } |
||
| 318 | |||
| 319 | /** |
||
| 320 | * Post-processing activities |
||
| 321 | * |
||
| 322 | * @return boolean |
||
| 323 | */ |
||
| 324 | public function after_process() |
||
| 325 | { |
||
| 326 | $this->pgNotify->confirmInformation(); |
||
| 327 | } |
||
| 328 | |||
| 329 | public function output_error() |
||
| 330 | { |
||
| 331 | return false; |
||
| 332 | } |
||
| 333 | |||
| 334 | public function check() |
||
| 335 | { |
||
| 336 | if (!isset($this->_check)) { |
||
| 337 | $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_PAGANTIS_STATUS'"); |
||
| 338 | $this->_check = tep_db_num_rows($check_query); |
||
| 339 | } |
||
| 340 | $this->installPagantisTables(); |
||
| 341 | return $this->_check; |
||
| 342 | } |
||
| 343 | |||
| 344 | /* |
||
| 345 | * This is where you define module's configurations (displayed in admin). |
||
| 346 | */ |
||
| 347 | public function install() |
||
| 360 | } |
||
| 361 | |||
| 362 | /** |
||
| 363 | * Create the neccesary tables for the module |
||
| 364 | */ |
||
| 365 | private function installPagantisTables() |
||
| 366 | { |
||
| 367 | $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_LOG . " ( |
||
| 368 | id int NOT NULL AUTO_INCREMENT, |
||
| 369 | log text NOT NULL, |
||
| 370 | createdAt timestamp DEFAULT CURRENT_TIMESTAMP, |
||
| 371 | UNIQUE KEY id (id))"; |
||
| 372 | tep_db_query($sql); |
||
| 373 | |||
| 374 | $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_CONFIG . " ( |
||
| 375 | id int NOT NULL AUTO_INCREMENT, |
||
| 376 | config varchar(60) NOT NULL, |
||
| 377 | value varchar(200) NOT NULL, |
||
| 378 | UNIQUE KEY id(id))"; |
||
| 379 | tep_db_query($sql); |
||
| 380 | foreach ((array)$this->defaultConfigs as $configKey => $configValue) { |
||
| 381 | $query = "INSERT INTO " . TABLE_PAGANTIS_CONFIG . " (config, value) values ('$configKey', '$configValue')"; |
||
| 382 | tep_db_query($query); |
||
| 383 | } |
||
| 384 | |||
| 385 | $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_ORDERS . " ( |
||
| 386 | id int NOT NULL AUTO_INCREMENT, |
||
| 387 | os_order_id varchar(50), |
||
| 388 | os_order_reference varchar(50) NOT NULL, |
||
| 389 | pagantis_order_id varchar(50) NOT NULL, |
||
| 390 | globals text, |
||
| 391 | UNIQUE KEY id(id))"; |
||
| 392 | tep_db_query($sql); |
||
| 393 | |||
| 394 | $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_CONCURRENCY . " ( |
||
| 395 | id varchar(50) NOT NULL, |
||
| 396 | `timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, |
||
| 397 | UNIQUE KEY id(id))"; |
||
| 398 | tep_db_query($sql); |
||
| 399 | } |
||
| 400 | |||
| 401 | /* |
||
| 402 | * Standard functionality to uninstall the module. |
||
| 403 | */ |
||
| 404 | public function remove() |
||
| 405 | { |
||
| 406 | $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_LOG."'"); |
||
| 407 | if (tep_db_num_rows($checkTable) > 0) { |
||
| 408 | tep_db_query("drop table " . TABLE_PAGANTIS_LOG); |
||
| 409 | } |
||
| 410 | |||
| 411 | $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_CONFIG."'"); |
||
| 412 | if (tep_db_num_rows($checkTable) > 0) { |
||
| 413 | tep_db_query("drop table " . TABLE_PAGANTIS_CONFIG); |
||
| 414 | } |
||
| 415 | |||
| 416 | $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_ORDERS."'"); |
||
| 417 | if (tep_db_num_rows($checkTable) > 0) { |
||
| 418 | tep_db_query("drop table " . TABLE_PAGANTIS_ORDERS); |
||
| 419 | } |
||
| 420 | |||
| 421 | $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_CONCURRENCY."'"); |
||
| 422 | if (tep_db_num_rows($checkTable) > 0) { |
||
| 423 | tep_db_query("drop table " . TABLE_PAGANTIS_CONCURRENCY); |
||
| 424 | } |
||
| 425 | |||
| 426 | $query = "delete from ".TABLE_ORDERS_STATUS." where orders_status_id='6'"; |
||
| 427 | tep_db_query($query); |
||
| 428 | } |
||
| 429 | |||
| 430 | /** |
||
| 431 | * Internal list of configuration keys used for configuration of the module |
||
| 432 | * |
||
| 433 | * @return array |
||
| 434 | */ |
||
| 435 | public function keys() |
||
| 436 | { |
||
| 437 | return array('MODULE_PAYMENT_PAGANTIS_STATUS', |
||
| 438 | 'MODULE_PAYMENT_PAGANTIS_PK', |
||
| 439 | 'MODULE_PAYMENT_PAGANTIS_SK' |
||
| 440 | ); |
||
| 441 | } |
||
| 442 | |||
| 443 | /** |
||
| 444 | * @return array |
||
| 445 | */ |
||
| 446 | private function getOrders() |
||
| 447 | { |
||
| 448 | $this->is_guest = 'true'; |
||
| 449 | if (trim($_SESSION['customer_id']) != '') { |
||
| 450 | $this->is_guest = 'false'; |
||
| 451 | $query = sprintf( |
||
| 452 | "select orders_total.value, orders.date_purchased from orders |
||
| 453 | JOIN orders_status_history ON orders.orders_id=orders_status_history.orders_id |
||
| 454 | JOIN orders_total ON orders.orders_id=orders_total.orders_id |
||
| 455 | where orders.customers_id='%s' and orders_status_history.orders_status_id in ('2','3') and orders_total.class='ot_total'", |
||
| 456 | $_SESSION['customer_id'] |
||
| 457 | ); |
||
| 458 | |||
| 459 | $response = array(); |
||
| 460 | $resultsSelect = tep_db_query($query); |
||
| 461 | while ($orderRow = tep_db_fetch_array($resultsSelect)) { |
||
| 462 | $response[] = $orderRow; |
||
| 463 | } |
||
| 464 | } |
||
| 465 | |||
| 466 | return $response; |
||
| 467 | } |
||
| 468 | |||
| 469 | /** |
||
| 470 | * @param $orderId |
||
| 471 | * @param $pagantisOrderId |
||
| 472 | * @param $globalVars |
||
| 473 | */ |
||
| 474 | private function insertRow($orderId, $pagantisOrderId, $globalVars) |
||
| 485 | } |
||
| 486 | |||
| 487 | /** |
||
| 488 | * @return array |
||
| 489 | */ |
||
| 490 | private function getExtraConfig() |
||
| 505 | } |
||
| 506 | } |
||
| 507 |