[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

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

   1  <?php
   2  /*
   3    $Id: callback.php 1739 2007-12-20 00:52:16Z user $
   4  
   5    osCMax Power E-Commerce
   6    http://oscdox.com
   7  
   8    Copyright 2008 osCMax
   9    Copyright (c) 2006 - 2007 Henri Schmidhuber (http://www.in-solution.de)
  10  
  11    Released under the GNU General Public License
  12  */
  13  
  14    chdir('../../../../');
  15    require  ('includes/application_top.php');
  16  
  17    $order_id = $customer_id = $pw = $betrag_integer = '';
  18  
  19    if (isset($HTTP_GET_VARS['kunden_var_0'])) {
  20      $order_id = $HTTP_GET_VARS['kunden_var_0'];
  21    } elseif (isset($HTTP_POST_VARS['kunden_var_0'])) {
  22      $order_id = $HTTP_POST_VARS['kunden_var_0'];
  23    }
  24  
  25    if (isset($HTTP_GET_VARS['kunden_var_1'])) {
  26      $customer_id = $HTTP_GET_VARS['kunden_var_1'];
  27    } elseif (isset($HTTP_POST_VARS['kunden_var_1'])) {
  28      $customer_id = $HTTP_POST_VARS['kunden_var_1'];
  29    }
  30  
  31    if (isset($HTTP_GET_VARS['pw'])) {
  32      $pw = $HTTP_GET_VARS['pw'];
  33    } elseif (isset($HTTP_POST_VARS['pw'])) {
  34      $pw = $HTTP_POST_VARS['pw'];
  35    }
  36  
  37    if (isset($HTTP_GET_VARS['betrag_integer'])) {
  38      $betrag_integer = $HTTP_GET_VARS['betrag_integer'];
  39    } elseif (isset($HTTP_POST_VARS['betrag_integer'])) {
  40      $betrag_integer = $HTTP_POST_VARS['betrag_integer'];
  41    }
  42  
  43    // Check if Order exists
  44    if (empty($order_id) || empty($customer_id) || empty($pw)) {
  45      exit();
  46    }
  47  
  48    $comment = '';
  49  
  50    if ($pw != MODULE_PAYMENT_SOFORTUEBERWEISUNG_DIRECT_BNA_PASSWORT) {
  51      $comment = 'ungültiges Benachrichtigung Passwort' . "\n";
  52    }
  53  
  54    // check if order exists
  55    $order_query = tep_db_query("select * from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "' and customers_id = '" . (int)$customer_id . "'");
  56    if (tep_db_num_rows($order_query) > 0) {
  57      $order = tep_db_fetch_array($order_query);
  58  
  59      if ($order['orders_status'] == MODULE_PAYMENT_SOFORTUEBERWEISUNG_DIRECT_PREPARE_ORDER_STATUS_ID) {
  60        $total_query = tep_db_query("select value from " . TABLE_ORDERS_TOTAL . " where orders_id = '" .  (int)$order_id . "' and class = 'ot_total' limit 1");
  61        $total = tep_db_fetch_array($total_query);
  62  
  63        $order_total_integer = number_format($total['value'] * $currencies->get_value('EUR'), 2, '.','')*100;
  64        if ($order_total_integer < 1) {
  65          $order_total_integer = '000';
  66        } elseif ($order_total_integer < 10) {
  67          $order_total_integer = '00' . $order_total_integer;
  68        } elseif ($order_total_integer < 100) {
  69          $order_total_integer = '0' . $order_total_integer;
  70        }
  71  
  72        if ((int)$betrag_integer == (int)$order_total_integer) {
  73          $comment = 'Zahlung durch Sofortüberweisung Benachrichtigung bestätigt!';
  74        } else {
  75          $comment = "Sofortüberweisungs Transaktionscheck fehlgeschlagen. Bitte manuell überprüfen\n" . ($betrag_integer/100) . '!=' . ($order_total_integer/100);
  76        }
  77  
  78        if (MODULE_PAYMENT_SOFORTUEBERWEISUNG_DIRECT_STORE_TRANSACTION_DETAILS == 'True') {
  79          $comment .= "\n" . serialize($HTTP_GET_VARS) . "\n" . serialize($HTTP_POST_VARS);
  80        }
  81  
  82        $order_status = (MODULE_PAYMENT_SOFORTUEBERWEISUNG_DIRECT_ORDER_STATUS_ID > 0 ? (int)MODULE_PAYMENT_SOFORTUEBERWEISUNG_DIRECT_ORDER_STATUS_ID : (int)DEFAULT_ORDERS_STATUS_ID);
  83  
  84        $sql_data_array = array('orders_id' => (int)$order_id,
  85                                'orders_status_id' => $order_status,
  86                                'date_added' => 'now()',
  87                                'customer_notified' => '0',
  88                                'comments' => $comment);
  89  
  90        tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
  91  
  92        tep_db_query("update " . TABLE_ORDERS . " set orders_status = '" . $order_status . "', last_modified = now() where orders_id = '" . (int)$order_id . "'");
  93      }
  94    }
  95  ?>


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