[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/ext/modules/payment/chronopay/ -> callback.php (source)

   1  <?php
   2  /*
   3    $Id: callback.php 1808 2008-01-13 03:56:36Z user $
   4  
   5    osCMax Power E-Commerce
   6    http://oscdox.com
   7  
   8    Copyright 2008 osCMax
   9  
  10    Released under the GNU General Public License
  11  */
  12  
  13    chdir('../../../../');
  14    require ('includes/application_top.php');
  15  
  16    $ip_address = tep_get_ip_address();
  17  
  18    if ( ($ip_address == '69.20.58.35') || ($ip_address == '207.97.201.192') ) {
  19      if (isset($HTTP_POST_VARS['cs1']) && is_numeric($HTTP_POST_VARS['cs1']) && isset($HTTP_POST_VARS['cs2']) && is_numeric($HTTP_POST_VARS['cs2']) && isset($HTTP_POST_VARS['cs3']) && !empty($HTTP_POST_VARS['cs3']) && isset($HTTP_POST_VARS['product_id']) && ($HTTP_POST_VARS['product_id'] == MODULE_PAYMENT_CHRONOPAY_PRODUCT_ID) && isset($HTTP_POST_VARS['total']) && !empty($HTTP_POST_VARS['total']) && isset($HTTP_POST_VARS['transaction_type']) && !empty($HTTP_POST_VARS['transaction_type'])) {
  20        if ($HTTP_POST_VARS['cs3'] == md5(MODULE_PAYMENT_CHRONOPAY_PRODUCT_ID . $HTTP_POST_VARS['cs2'] . $HTTP_POST_VARS['cs1'] . $HTTP_POST_VARS['total'] . MODULE_PAYMENT_CHRONOPAY_MD5_HASH)) {
  21          $order_query = tep_db_query("select order_status, currency, currency_value from " . TABLE_ORDERS . " where orders_id = '" . (int)$HTTP_POST_VARS['cs2'] . "' and customers_id = '" . (int)$HTTP_POST_VARS['cs1'] . "'");
  22  
  23          if (tep_db_num_rows($order_query) > 0) {
  24            $order = tep_db_fetch_array($order_query);
  25  
  26            if ($order['order_status'] == MODULE_PAYMENT_CHRONOPAY_PREPARE_ORDER_STATUS_ID) {
  27              $total_query = tep_db_query("select value from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$HTTP_POST_VARS['cs2'] . "' and class = 'ot_total' limit 1");
  28              $total = tep_db_fetch_array($total_query);
  29  
  30              $comment_status = $HTTP_POST_VARS['transaction_type'] . ' (' . $HTTP_POST_VARS['transaction_id'] . '; ' . $currencies->format($HTTP_POST_VARS['total'], false, $HTTP_POST_VARS['currency']) . ')';
  31  
  32              $order_status_id = (MODULE_PAYMENT_CHRONOPAY_ORDER_STATUS_ID > 0 ? (int)MODULE_PAYMENT_CHRONOPAY_ORDER_STATUS_ID : (int)DEFAULT_ORDERS_STATUS_ID);
  33  
  34              tep_db_query("update " . TABLE_ORDERS . " set orders_status = '" . $order_status_id . "', last_modified = now() where orders_id = '" . (int)$HTTP_POST_VARS['cs2'] . "'");
  35  
  36              $sql_data_array = array('orders_id' => $HTTP_POST_VARS['cs2'],
  37                                      'orders_status_id' => $order_status_id,
  38                                      'date_added' => 'now()',
  39                                      'customer_notified' => '0',
  40                                      'comments' => 'ChronoPay Verified [' . $comment_status . ']');
  41  
  42              tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
  43            }
  44          }
  45        }
  46      }
  47    }
  48  
  49    require ('includes/application_bottom.php');
  50  ?>


Generated: Fri Jan 1 13:43:16 2010 Cross-referenced by PHPXref 0.7