[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/includes/modules/payment/ -> paypal_ipn.php (source)

   1  <?php
   2  /*

   3  $Id: paypal_ipn.php 14 2006-07-28 17:42:07Z user $

   4  

   5    osCMax Power E-Commerce

   6    http://oscdox.com

   7  

   8    Copyright 2006 osCMax

   9  

  10    Released under the GNU General Public License

  11  */
  12  
  13    class paypal_ipn {
  14      var $code, $title, $description, $enabled, $identifier;
  15  
  16  // class constructor

  17      function paypal_ipn() {
  18        global $order;
  19  
  20        $this->code = 'paypal_ipn';
  21        $this->title = MODULE_PAYMENT_PAYPAL_IPN_TEXT_TITLE;
  22        $this->description = MODULE_PAYMENT_PAYPAL_IPN_TEXT_DESCRIPTION;
  23        $this->sort_order = MODULE_PAYMENT_PAYPAL_IPN_SORT_ORDER;
  24        $this->enabled = ((MODULE_PAYMENT_PAYPAL_IPN_STATUS == 'True') ? true : false);
  25        $this->email_footer = MODULE_PAYMENT_PAYPAL_IPN_TEXT_EMAIL_FOOTER;
  26        $this->identifier = 'osCommerce PayPal IPN v2.3.3';
  27        // BOF Additional show text added by AlexStudio

  28        $this->show = MODULE_PAYMENT_PAYPAL_IPN_TEXT_SELECTION;
  29        $this->last_confirm = MODULE_PAYMENT_PAYPAL_IPN_TEXT_LAST_CONFIRM;
  30        // EOF Additional show text added by AlexStudio

  31  
  32        if ((int)MODULE_PAYMENT_PAYPAL_IPN_PREPARE_ORDER_STATUS_ID > 0) {
  33          $this->order_status = MODULE_PAYMENT_PAYPAL_IPN_PREPARE_ORDER_STATUS_ID;
  34        }
  35  
  36        if (is_object($order)) $this->update_status();
  37  
  38        if (MODULE_PAYMENT_PAYPAL_IPN_GATEWAY_SERVER == 'Live') {
  39          $this->form_action_url = 'https://www.paypal.com/cgi-bin/webscr';
  40        } else {
  41          $this->form_action_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
  42        }
  43      }
  44  
  45  // class methods

  46      function update_status() {
  47        global $order;
  48  
  49        if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_PAYPAL_IPN_ZONE > 0) ) {
  50          $check_flag = false;
  51          $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_PAYPAL_IPN_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id");
  52          while ($check = tep_db_fetch_array($check_query)) {
  53            if ($check['zone_id'] < 1) {
  54              $check_flag = true;
  55              break;
  56            } elseif ($check['zone_id'] == $order->billing['zone_id']) {
  57              $check_flag = true;
  58              break;
  59            }
  60          }
  61  
  62          if ($check_flag == false) {
  63            $this->enabled = false;
  64          }
  65        }
  66      }
  67  
  68      function javascript_validation() {
  69        return false;
  70      }
  71  
  72      function selection() {
  73        return array('id' => $this->code,
  74                     'module' => $this->show);
  75      }
  76  
  77      function pre_confirmation_check() {
  78        return false;
  79      }
  80  
  81      function confirmation() {
  82        global $cartID, $cart_PayPal_IPN_ID, $customer_id, $languages_id, $order, $order_total_modules;
  83  
  84       // if (tep_session_is_registered('cartID')) {

  85       if (array_key_exists('cartID', $_SESSION)) {
  86          $insert_order = false;
  87  
  88          if (tep_session_is_registered('cart_PayPal_IPN_ID')) {
  89            $order_id = substr($cart_PayPal_IPN_ID, strpos($cart_PayPal_IPN_ID, '-')+1);
  90  
  91            $curr_check = tep_db_query("select currency from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'");
  92            $curr = tep_db_fetch_array($curr_check);
  93  
  94             //if ( ($curr['currency'] != $order->info['currency']) || ($cartID != substr($cart_PayPal_IPN_ID, 0, strlen($cartID))) ) {

  95              //$check_query = tep_db_query('select orders_id from ' . TABLE_ORDERS_STATUS_HISTORY . ' where orders_id = "' . (int)$order_id . '" limit 1'); 

  96              $check_query = tep_db_query('select orders_id from ' . TABLE_ORDERS_STATUS_HISTORY . ' where orders_id = "' . (int)$order_id . '" limit 2');  //1.4

  97  
  98              $update_order = false;//1.4

  99              
 100              //if (tep_db_num_rows($check_query) < 1) {

 101                //tep_db_query('delete from ' . TABLE_ORDERS . ' where orders_id = "' . (int)$order_id . '"');

 102              if (tep_db_num_rows($check_query) == 1) { //1.4
 103                $update_order = true; //1.4

 104                tep_db_query('delete from ' . TABLE_ORDERS_TOTAL . ' where orders_id = "' . (int)$order_id . '"');
 105                tep_db_query('delete from ' . TABLE_ORDERS_STATUS_HISTORY . ' where orders_id = "' . (int)$order_id . '"');
 106                tep_db_query('delete from ' . TABLE_ORDERS_PRODUCTS . ' where orders_id = "' . (int)$order_id . '"');
 107                tep_db_query('delete from ' . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . ' where orders_id = "' . (int)$order_id . '"');
 108                tep_db_query('delete from ' . TABLE_ORDERS_PRODUCTS_DOWNLOAD . ' where orders_id = "' . (int)$order_id . '"');
 109              }
 110  
 111              $insert_order = true;
 112            //}    

 113          } else {
 114            $insert_order = true;
 115          }
 116  
 117          if ($insert_order == true) {
 118            $order_totals = array();
 119            if (is_array($order_total_modules->modules)) {
 120              reset($order_total_modules->modules);
 121              while (list(, $value) = each($order_total_modules->modules)) {
 122                $class = substr($value, 0, strrpos($value, '.'));
 123                if ($GLOBALS[$class]->enabled) {
 124                  for ($i=0, $n=sizeof($GLOBALS[$class]->output); $i<$n; $i++) {
 125                    if (tep_not_null($GLOBALS[$class]->output[$i]['title']) && tep_not_null($GLOBALS[$class]->output[$i]['text'])) {
 126                      $order_totals[] = array('code' => $GLOBALS[$class]->code,
 127                                              'title' => $GLOBALS[$class]->output[$i]['title'],
 128                                              'text' => $GLOBALS[$class]->output[$i]['text'],
 129                                              'value' => $GLOBALS[$class]->output[$i]['value'],
 130                                              'sort_order' => $GLOBALS[$class]->sort_order);
 131                    }
 132                  }
 133                }
 134              }
 135            }
 136  
 137            $sql_data_array = array('customers_id' => $customer_id,
 138                                    'customers_name' => $order->customer['firstname'] . ' ' . $order->customer['lastname'],
 139                                    'customers_company' => $order->customer['company'],
 140                                    'customers_street_address' => $order->customer['street_address'],
 141                                    'customers_suburb' => $order->customer['suburb'],
 142                                    'customers_city' => $order->customer['city'],
 143                                    'customers_postcode' => $order->customer['postcode'],
 144                                    'customers_state' => $order->customer['state'],
 145                                    'customers_country' => $order->customer['country']['title'],
 146                                    'customers_telephone' => $order->customer['telephone'],
 147                                    'customers_email_address' => $order->customer['email_address'],
 148                                    'customers_address_format_id' => $order->customer['format_id'],
 149                                    'delivery_name' => $order->delivery['firstname'] . ' ' . $order->delivery['lastname'],
 150                                    'delivery_company' => $order->delivery['company'],
 151                                    'delivery_street_address' => $order->delivery['street_address'],
 152                                    'delivery_suburb' => $order->delivery['suburb'],
 153                                    'delivery_city' => $order->delivery['city'],
 154                                    'delivery_postcode' => $order->delivery['postcode'],
 155                                    'delivery_state' => $order->delivery['state'],
 156                                    'delivery_country' => $order->delivery['country']['title'],
 157                                    'delivery_address_format_id' => $order->delivery['format_id'],
 158                                    'billing_name' => $order->billing['firstname'] . ' ' . $order->billing['lastname'],
 159                                    'billing_company' => $order->billing['company'],
 160                                    'billing_street_address' => $order->billing['street_address'],
 161                                    'billing_suburb' => $order->billing['suburb'],
 162                                    'billing_city' => $order->billing['city'],
 163                                    'billing_postcode' => $order->billing['postcode'],
 164                                    'billing_state' => $order->billing['state'],
 165                                    'billing_country' => $order->billing['country']['title'],
 166                                    'billing_address_format_id' => $order->billing['format_id'],
 167                                    'payment_method' => $order->info['payment_method'],
 168                                    'cc_type' => $order->info['cc_type'],
 169                                    'cc_owner' => $order->info['cc_owner'],
 170                                    'cc_number' => $order->info['cc_number'],
 171                                    'cc_expires' => $order->info['cc_expires'],
 172                                    'date_purchased' => 'now()',
 173                                    'orders_status' => $order->info['order_status'],
 174                                    'currency' => $order->info['currency'],
 175                                    'currency_value' => $order->info['currency_value']);
 176  
 177            //+1.4

 178            if ( $update_order ){  
 179              tep_db_perform(TABLE_ORDERS, $sql_data_array, 'update', 'orders_id = "' . (int)$order_id . '"');
 180              $insert_id = (int)$order_id;
 181            } else { 
 182            //-1.4

 183            tep_db_perform(TABLE_ORDERS, $sql_data_array);
 184  
 185            $insert_id = tep_db_insert_id();
 186            }//1.4

 187  
 188            for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
 189              $sql_data_array = array('orders_id' => $insert_id,
 190                                      'title' => $order_totals[$i]['title'],
 191                                      'text' => $order_totals[$i]['text'],
 192                                      'value' => $order_totals[$i]['value'],
 193                                      'class' => $order_totals[$i]['code'],
 194                                      'sort_order' => $order_totals[$i]['sort_order']);
 195  
 196              tep_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array);
 197            }
 198            //+1.4

 199            $sql_data_array = array('orders_id' => $insert_id, 
 200                                      'orders_status_id' => $order->info['order_status'], 
 201                                      'date_added' => 'now()', 
 202                           'customer_notified' => '0', 
 203                                      'comments' => $order->info['comments']);
 204            tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
 205            //-1.4

 206  
 207            for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
 208              $sql_data_array = array('orders_id' => $insert_id,
 209                                      'products_id' => tep_get_prid($order->products[$i]['id']),
 210                                      'products_model' => $order->products[$i]['model'],
 211                                      'products_name' => $order->products[$i]['name'],
 212                                      'products_price' => $order->products[$i]['price'],
 213                                      'final_price' => $order->products[$i]['final_price'],
 214                                      'products_tax' => $order->products[$i]['tax'],
 215                                      'products_quantity' => $order->products[$i]['qty']);
 216  
 217              tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);
 218  
 219              $order_products_id = tep_db_insert_id();
 220  
 221              $attributes_exist = '0';
 222              if (isset($order->products[$i]['attributes'])) {
 223                $attributes_exist = '1';
 224                for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {
 225                  if (DOWNLOAD_ENABLED == 'true') {
 226                    $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename
 227                                         from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
 228                                         left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
 229                                         on pa.products_attributes_id=pad.products_attributes_id
 230                                         where pa.products_id = '" . $order->products[$i]['id'] . "'
 231                                         and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "'
 232                                         and pa.options_id = popt.products_options_id
 233                                         and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "'
 234                                         and pa.options_values_id = poval.products_options_values_id
 235                                         and popt.language_id = '" . $languages_id . "'
 236                                         and poval.language_id = '" . $languages_id . "'";
 237                    $attributes = tep_db_query($attributes_query);
 238                  } else {
 239                    $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'");
 240                  }
 241                  $attributes_values = tep_db_fetch_array($attributes);
 242  
 243                  $sql_data_array = array('orders_id' => $insert_id,
 244                                          'orders_products_id' => $order_products_id,
 245                                          'products_options' => $attributes_values['products_options_name'],
 246                                          'products_options_values' => $attributes_values['products_options_values_name'],
 247                                          'options_values_price' => $attributes_values['options_values_price'],
 248                                          'price_prefix' => $attributes_values['price_prefix']);
 249  
 250                  tep_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array);
 251  
 252                  if ((DOWNLOAD_ENABLED == 'true') && isset($attributes_values['products_attributes_filename']) && tep_not_null($attributes_values['products_attributes_filename'])) {
 253                    $sql_data_array = array('orders_id' => $insert_id,
 254                                            'orders_products_id' => $order_products_id,
 255                                            'orders_products_filename' => $attributes_values['products_attributes_filename'],
 256                                            'download_maxdays' => $attributes_values['products_attributes_maxdays'],
 257                                            'download_count' => $attributes_values['products_attributes_maxcount']);
 258  
 259                    tep_db_perform(TABLE_ORDERS_PRODUCTS_DOWNLOAD, $sql_data_array);
 260                  }
 261                }
 262              }
 263            }
 264  
 265            tep_session_register('cart_PayPal_IPN_ID');
 266            $_SESSION['cart_PayPal_IPN_ID'] = $cartID . '-' . $insert_id;
 267          }
 268        }
 269        // BOF Confirmation Info added by AlexStudio

 270        $confirmation = array('title' => MODULE_PAYMENT_PAYPAL_IPN_TEXT_LAST_CONFIRM, 'fields' => array());
 271        return $confirmation;
 272        // EOF Confirmation Info added by AlexStudio

 273      }
 274  
 275      function process_button() {
 276        global $customer_id, $order, $languages_id, $currencies, $currency, $cart_PayPal_IPN_ID, $shipping, $order_total_modules;
 277  
 278        if (MODULE_PAYMENT_PAYPAL_IPN_CURRENCY == 'Selected Currency') {
 279          $my_currency = $currency;
 280        } else {
 281          $my_currency = substr(MODULE_PAYMENT_PAYPAL_IPN_CURRENCY, 5);
 282        }
 283        
 284        if (!in_array($my_currency, array('AUD', 'CAD', 'CHF', 'CZK', 'DKK', 'EUR', 'GBP', 'HKD', 'HUF', 'JPY', 'NOK', 'NZD', 'PLN', 'SEK', 'SGD', 'USD'))) {
 285          $my_currency = 'USD';
 286        }
 287  
 288        // BOF Per Item mode fix by alexstudio

 289        $order_totals = array();
 290        if (is_array($order_total_modules->modules)) {
 291          reset($order_total_modules->modules);
 292          while (list(, $value) = each($order_total_modules->modules)) {
 293            $class = substr($value, 0, strrpos($value, '.'));
 294            if ($GLOBALS[$class]->enabled) {
 295              for ($i=0, $n=sizeof($GLOBALS[$class]->output); $i<$n; $i++) {
 296                if (tep_not_null($GLOBALS[$class]->output[$i]['title']) && tep_not_null($GLOBALS[$class]->output[$i]['text'])) {
 297                  $order_totals[] = array('code' => $GLOBALS[$class]->code,
 298                                          'title' => $GLOBALS[$class]->output[$i]['title'],
 299                                          'text' => $GLOBALS[$class]->output[$i]['text'],
 300                                          'value' => $GLOBALS[$class]->output[$i]['value'],
 301                                          'sort_order' => $GLOBALS[$class]->sort_order);
 302                }
 303              }
 304            }
 305          }
 306        }
 307        foreach ($order_totals as $ot) {
 308          $order_total[$ot['code']] = $ot['value'];
 309        }
 310        $subtotal = $order_total['ot_subtotal'];
 311        if (DISPLAY_PRICE_WITH_TAX == 'true') $subtotal -= $order->info['tax'];
 312        // EOF Per Item mode fix by alexstudio

 313        
 314        $parameters = array();
 315  
 316        if ( (MODULE_PAYMENT_PAYPAL_IPN_TRANSACTION_TYPE == 'Per Item')/* && (MODULE_PAYMENT_PAYPAL_IPN_EWP_STATUS == 'False') // removed by AlexStudio*/) {
 317          $parameters['cmd'] = '_cart';
 318          $parameters['upload'] = '1';
 319  
 320          // Decide how many items are virtual (no shipping)

 321          $shipping_count = 0;
 322          $shipping_added = 0;
 323          $handling_added = 0;
 324          $item_tax = 0;
 325          $virtual_items = 0;
 326          for ($y=0; $y<sizeof($order->products); $y++) {
 327            if (is_array($order->products[$y]['attributes'])) {
 328              while (list($key, $value) = each($order->products[$y]['attributes'])) {
 329                $z = $key;
 330                $attributes_query = "select pad.products_attributes_filename
 331                                     from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval,
 332                                     " . TABLE_PRODUCTS_ATTRIBUTES . " pa left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
 333                                     on pa.products_attributes_id=pad.products_attributes_id
 334                                     where pa.products_id = '" . $order->products[$y]['id'] . "'
 335                                     and pa.options_id = '" . $order->products[$y]['attributes'][$z]['option_id'] . "'
 336                                     and pa.options_id = popt.products_options_id
 337                                     and pa.options_values_id = '" . $order->products[$y]['attributes'][$z]['value_id'] . "'
 338                                     and pa.options_values_id = poval.products_options_values_id";
 339                $attributes = tep_db_query($attributes_query);
 340                $attributes_values = tep_db_fetch_array($attributes);
 341                if (tep_not_null($attributes_values['products_attributes_filename'])) $virtual_items++;
 342              }
 343            }
 344          }
 345          
 346          for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
 347            $item = $i+1;
 348  
 349            $tax_value = ($order->products[$i]['tax'] / 100) * $order->products[$i]['final_price'];
 350  
 351            $parameters['item_name_' . $item] = $order->products[$i]['name'];
 352            $parameters['item_number_' . $item] = $order->products[$i]['model'];
 353            // BOF Tax pre item fix by AlexStudio

 354            if(MOVE_TAX_TO_TOTAL_AMOUNT == 'True') $parameters['amount_' . $item] = number_format(($order->products[$i]['final_price'] + $tax_value) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));
 355            else {
 356              $parameters['amount_' . $item] = number_format($order->products[$i]['final_price'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));
 357              $parameters['tax_' . $item] = number_format($tax_value * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));
 358            }
 359            $item_tax += number_format($tax_value * $order->products[$i]['qty'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));
 360            // EOF Tax pre item fix by AlexStudio

 361            $parameters['quantity_' . $item] = $order->products[$i]['qty'];
 362  
 363            // BOF shipping & handling fix by AlexStudio

 364            $item_has_shipping = true;
 365            // EOF shipping & handling fix by AlexStudio

 366            if (isset($order->products[$i]['attributes'])) {
 367              for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {
 368                if (DOWNLOAD_ENABLED == 'true') {
 369                  $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename
 370                                       from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
 371                                       left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
 372                                       on pa.products_attributes_id=pad.products_attributes_id
 373                                       where pa.products_id = '" . $order->products[$i]['id'] . "'
 374                                       and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "'
 375                                       and pa.options_id = popt.products_options_id
 376                                       and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "'
 377                                       and pa.options_values_id = poval.products_options_values_id
 378                                       and popt.language_id = '" . $languages_id . "'
 379                                       and poval.language_id = '" . $languages_id . "'";
 380                  $attributes = tep_db_query($attributes_query);
 381                } else {
 382                  $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'");
 383                }
 384                $attributes_values = tep_db_fetch_array($attributes);
 385                // BOF shipping & handling fix by AlexStudio

 386                if (tep_not_null($attributes_values['products_attributes_filename'])) $item_has_shipping = false;
 387                // EOF shipping & handling fix by AlexStudio

 388  
 389  // Unfortunately PayPal only accepts two attributes per product, so the

 390  // third attribute onwards will not be shown at PayPal

 391                $parameters['on' . $j . '_' . $item] = $attributes_values['products_options_name'];
 392                $parameters['os' . $j . '_' . $item] = $attributes_values['products_options_values_name'];
 393              }
 394            }
 395            // BOF shipping & handling fix by AlexStudio

 396            $handling = $order_total['ot_loworderfee'];
 397            if ($n == 1 || $item < $n) {
 398              $parameters['handling_' . $item] = number_format($handling/$n * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));
 399              $handling_added += $parameters['handling_' . $item];
 400            } else {
 401              $parameters['handling_' . $item] = number_format($handling * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency)) - $handling_added;
 402            }
 403            if ($item_has_shipping) {
 404              $shipping_count++;
 405              $shipping_items = $n - $virtual_items;
 406              if ($shipping_items == 1 || $shipping_count < $shipping_items) {
 407                $parameters['shipping_' . $item] = number_format(($order_total['ot_shipping']/$shipping_items) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));
 408                $shipping_added += $parameters['shipping_' . $item];
 409              } else {
 410                $parameters['shipping_' . $item] = number_format($order_total['ot_shipping'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency)) - $shipping_added;
 411              }
 412            }
 413            // EOF shipping & handling fix by AlexStudio

 414          }
 415          // BOF Tax pre item fix by AlexStudio

 416          $tax_total = number_format($order->info['tax'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));
 417          if ($tax_total > $item_tax && DISPLAY_PRICE_WITH_TAX != 'true') {
 418            $item++;
 419            $parameters['item_name_' . $item] = 'Shipping Tax';
 420            $parameters['amount_' . $item] = $tax_total - $item_tax;
 421            $parameters['quantity_' . $item] = 1;
 422          }
 423          // EOF Tax pre item fix by AlexStudio

 424  
 425          if(MOVE_TAX_TO_TOTAL_AMOUNT == 'True') {
 426            // BOF Tax pre item fix by AlexStudio

 427            $parameters['amount'] = number_format(($subtotal + $order->info['tax']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));
 428          } else {
 429            // default

 430            $parameters['amount'] = number_format($subtotal * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));
 431            // EOF Tax pre item fix by AlexStudio

 432          }
 433  
 434        } else {
 435          $parameters['cmd'] = '_ext-enter';
 436          $parameters['redirect_cmd'] = '_xclick';
 437          $parameters['item_name'] = STORE_NAME;
 438          // BOF shipping & handling fix by AlexStudio

 439          if(MOVE_TAX_TO_TOTAL_AMOUNT == 'True') {
 440            $parameters['amount'] = number_format(($subtotal + $order->info['tax']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));
 441          } else {
 442            // default

 443            $parameters['amount'] = number_format($subtotal * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));
 444            $parameters['tax'] = number_format($order->info['tax'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));
 445          }
 446          if ($order->content_type != 'virtual') {
 447            $parameters['shipping'] = number_format($order_total['ot_shipping'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));
 448          }
 449          $parameters['handling'] = number_format($order_total['ot_loworderfee'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));
 450          // EOF shipping & handling fix by AlexStudio

 451        }
 452  
 453        // BOF billing address fix by AlexStudio

 454        if ($order->content_type != 'virtual') {
 455          $state_abbr = tep_get_zone_code($order->delivery['country']['id'], $order->delivery['zone_id'], $order->delivery['state']);
 456        } else {
 457          $state_abbr = tep_get_zone_code($order->billing['country']['id'], $order->billing['zone_id'], $order->billing['state']);
 458        }
 459        // EOF billing address fix by AlexStudio

 460  
 461        $parameters['business'] = MODULE_PAYMENT_PAYPAL_IPN_ID;
 462        
 463        // let's check what has been defined in the shop admin for the shipping address

 464  // BOF parameters fix by AlexStudio

 465        if ($order->content_type != 'virtual') {
 466          $parameters['address_override'] = '1';
 467          $parameters['no_shipping'] = '2';
 468          $parameters['night_phone_b'] = $order->customer['telephone'];
 469          $parameters['first_name'] = $order->delivery['firstname'];
 470          $parameters['last_name'] = $order->delivery['lastname'];
 471          $parameters['address1'] = $order->delivery['street_address'];
 472          $parameters['address2'] = $order->delivery['suburb'];
 473          $parameters['city'] = $order->delivery['city'];
 474          $parameters['zip'] = $order->delivery['postcode'];
 475          $parameters['state'] = $state_abbr;
 476          $parameters['country'] = $order->delivery['country']['iso_code_2'];
 477          $parameters['email'] = $order->customer['email_address'];
 478        } else {
 479          $parameters['no_shipping'] = '1';
 480          $parameters['night_phone_b'] = $order->customer['telephone'];
 481          $parameters['first_name'] = $order->billing['firstname'];
 482          $parameters['last_name'] = $order->billing['lastname'];
 483          $parameters['address1'] = $order->billing['street_address'];
 484          $parameters['address2'] = $order->billing['suburb'];
 485          $parameters['city'] = $order->billing['city'];
 486          $parameters['zip'] = $order->billing['postcode'];
 487          $parameters['state'] = $state_abbr;
 488          $parameters['country'] = $order->billing['country']['iso_code_2'];
 489          $parameters['email'] = $order->customer['email_address'];
 490        }
 491        /*********************************************************************************************

 492        *    Currently these are the supported charsets:                                             *

 493        *    big5, euc-jp, euc-kr, euc-tw, gb2312, hz-gb-2312, ibm-862, iso-2022-cn, iso-2022-jp,    *

 494        *    iso-2022-kr, iso-8859-1, iso-8859-2, iso-8859-3, iso-8859-4, iso-8859-5, iso-8859-6,    *

 495        *    iso-8859-7, iso-8859-8, iso-8859-9, iso-8859-13, iso-8859-15, ko18-r, shift_jis,        *

 496        *    utf-7, utf-8, utf-16, utf-16be, utf-16le, utf-16_platformendian, utf-16_oppositeendian, *

 497        *    utf-32, utf-32be, utf-32le, utf-32_platformendian, utf-32_oppositeendian, usa-ascii,    *

 498        *    windows-1250, windows-1251, windows-1252, windows-1253, windows-1254, windows-1255,     *

 499        *    windows-1256, windows-1257, windows-1258, windows-874, windows-949, x-mac-greek,        *

 500        *    x-mac-turkish, x-mac-centraleurroman, x-mac-cyrillic, ebcdic-cp-us, ibm-1047            *

 501        **********************************************************************************************/
 502        $parameters['charset'] = "utf-8"; // Modify this line if you have problems with the character set.

 503  // EOF parameters fix by AlexStudio

 504        
 505        $parameters['currency_code'] = $my_currency;
 506        $parameters['invoice'] = substr($cart_PayPal_IPN_ID, strpos($cart_PayPal_IPN_ID, '-')+1);
 507        $parameters['custom'] = $customer_id;
 508        $parameters['no_note'] = '1';
 509        $parameters['notify_url'] = tep_href_link('ext/modules/payment/paypal_ipn/ipn.php', 'language=' . $_SESSION['language'], 'SSL', false, false);
 510        $parameters['cbt'] = CONFIRMATION_BUTTON_TEXT;  
 511        $parameters['return'] = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL');
 512        $parameters['cancel_return'] = tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL');
 513        $parameters['bn'] = $this->identifier;
 514        $parameters['lc'] = $order->customer['country']['iso_code_2'];
 515        
 516        if (tep_not_null(MODULE_PAYMENT_PAYPAL_IPN_PAGE_STYLE)) {
 517          $parameters['page_style'] = MODULE_PAYMENT_PAYPAL_IPN_PAGE_STYLE;
 518        }
 519  
 520        if (MODULE_PAYMENT_PAYPAL_IPN_EWP_STATUS == 'True') {
 521          $parameters['cert_id'] = MODULE_PAYMENT_PAYPAL_IPN_EWP_CERT_ID;
 522  
 523          $random_string = rand(100000, 999999) . '-' . $customer_id . '-';
 524  
 525          $data = '';
 526          reset($parameters);
 527          while (list($key, $value) = each($parameters)) {
 528            $data .= $key . '=' . $value . "\n";
 529          }
 530  
 531          $fp = fopen(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'data.txt', 'w');
 532          fwrite($fp, $data);
 533          fclose($fp);
 534  
 535          unset($data);
 536  
 537          if (function_exists('openssl_pkcs7_sign') && function_exists('openssl_pkcs7_encrypt')) {
 538            openssl_pkcs7_sign(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'data.txt', MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt', file_get_contents(MODULE_PAYMENT_PAYPAL_IPN_EWP_PUBLIC_KEY), file_get_contents(MODULE_PAYMENT_PAYPAL_IPN_EWP_PRIVATE_KEY), array('From' => MODULE_PAYMENT_PAYPAL_IPN_ID), PKCS7_BINARY);
 539  
 540            unlink(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'data.txt');
 541  
 542  // remove headers from the signature

 543            $signed = file_get_contents(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt');
 544            $signed = explode("\n\n", $signed);
 545            $signed = base64_decode($signed[1]);
 546  
 547            $fp = fopen(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt', 'w');
 548            fwrite($fp, $signed);
 549            fclose($fp);
 550  
 551            unset($signed);
 552  
 553            openssl_pkcs7_encrypt(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt', MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt', file_get_contents(MODULE_PAYMENT_PAYPAL_IPN_EWP_PAYPAL_KEY), array('From' => MODULE_PAYMENT_PAYPAL_IPN_ID), PKCS7_BINARY);
 554  
 555            unlink(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt');
 556  
 557  // remove headers from the encrypted result

 558            $data = file_get_contents(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt');
 559            $data = explode("\n\n", $data);
 560            $data = '-----BEGIN PKCS7-----' . "\n" . $data[1] . "\n" . '-----END PKCS7-----';
 561  
 562            unlink(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt');
 563          } else {
 564            exec(MODULE_PAYMENT_PAYPAL_IPN_EWP_OPENSSL . ' smime -sign -in ' . MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'data.txt -signer ' . MODULE_PAYMENT_PAYPAL_IPN_EWP_PUBLIC_KEY . ' -inkey ' . MODULE_PAYMENT_PAYPAL_IPN_EWP_PRIVATE_KEY . ' -outform der -nodetach -binary > ' . MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt');
 565            unlink(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'data.txt');
 566  
 567            exec(MODULE_PAYMENT_PAYPAL_IPN_EWP_OPENSSL . ' smime -encrypt -des3 -binary -outform pem ' . MODULE_PAYMENT_PAYPAL_IPN_EWP_PAYPAL_KEY . ' < ' . MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt > ' . MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt');
 568            unlink(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt');
 569  
 570            $fh = fopen(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt', 'rb');
 571            $data = fread($fh, filesize(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt'));
 572            fclose($fh);
 573  
 574            unlink(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt');
 575          }
 576  
 577          $process_button_string = tep_draw_hidden_field('cmd', '_s-xclick') .
 578                                   tep_draw_hidden_field('encrypted', $data);
 579  
 580          unset($data);
 581        } else {
 582          reset($parameters);
 583          while (list($key, $value) = each($parameters)) {
 584            $process_button_string .= tep_draw_hidden_field($key, $value);
 585          }
 586        }
 587  
 588        return $process_button_string;
 589      }
 590  
 591      function before_process() {
 592        global $cart;
 593  
 594        $cart->reset(true);
 595  
 596  // unregister session variables used during checkout

 597        tep_session_unregister('sendto');
 598        tep_session_unregister('billto');
 599        tep_session_unregister('shipping');
 600        tep_session_unregister('payment');
 601        tep_session_unregister('comments');
 602  
 603        tep_session_unregister('cart_PayPal_IPN_ID');
 604  
 605        tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL'));
 606      }
 607  
 608      function after_process() {
 609        return false;
 610      }
 611  
 612      function output_error() {
 613        return false;
 614      }
 615  
 616      function check() {
 617        if (!isset($this->_check)) {
 618          $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_PAYPAL_IPN_STATUS'");
 619          $this->_check = tep_db_num_rows($check_query);
 620        }
 621        return $this->_check;
 622      }
 623  
 624      function install() {
 625        $check_query = tep_db_query("select orders_status_id from " . TABLE_ORDERS_STATUS . " where orders_status_name = 'Preparing [PayPal IPN]' limit 1");
 626  
 627        if (tep_db_num_rows($check_query) < 1) {
 628          $status_query = tep_db_query("select max(orders_status_id) as status_id from " . TABLE_ORDERS_STATUS);
 629          $status = tep_db_fetch_array($status_query);
 630  
 631          $status_id = $status['status_id']+1;
 632  
 633          $languages = tep_get_languages();
 634  
 635          foreach ($languages as $lang) {
 636            tep_db_query("insert into " . TABLE_ORDERS_STATUS . " (orders_status_id, language_id, orders_status_name) values ('" . $status_id . "', '" . $lang['id'] . "', 'Preparing [PayPal IPN]')");
 637          }
 638        } else {
 639          $check = tep_db_fetch_array($check_query);
 640  
 641          $status_id = $check['orders_status_id'];
 642        }
 643  
 644        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable PayPal IPN Module', 'MODULE_PAYMENT_PAYPAL_IPN_STATUS', 'False', 'Do you want to accept PayPal IPN payments?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
 645        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Gateway Server', 'MODULE_PAYMENT_PAYPAL_IPN_GATEWAY_SERVER', 'Testing', 'Use the testing (sandbox) or live gateway server for transactions?', '6', '2', 'tep_cfg_select_option(array(\'Testing\',\'Live\'), ', now())");
 646        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_PAYPAL_IPN_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '3', now())");            
 647        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('E-Mail Address', 'MODULE_PAYMENT_PAYPAL_IPN_ID', '', 'The e-mail address to use for the PayPal IPN service', '6', '5', now())");
 648        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Transaction Currency', 'MODULE_PAYMENT_PAYPAL_IPN_CURRENCY', 'Selected Currency', 'The currency to use for transactions', '6', '10', 'tep_cfg_select_option(array(\'Selected Currency\',\'Only USD\',\'Only GBP\',\'Only AUD\',\'Only CAD\',\'Only CHF\',\'Only CZK\',\'Only DKK\',\'Only EUR\',\'Only HKD\',\'Only HUF\',\'Only JPY\',\'Only NOK\',\'Only NZD\',\'Only PLN\',\'Only SEK\',\'Only SGD\'), ', now())");
 649        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_PAYPAL_IPN_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '11', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");
 650        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Preparing Order Status', 'MODULE_PAYMENT_PAYPAL_IPN_PREPARE_ORDER_STATUS_ID', '" . $status_id . "', 'Set the status of prepared orders made with this payment module to this value', '6', '12', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())");
 651        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set PayPal Acknowledged Order Status', 'MODULE_PAYMENT_PAYPAL_IPN_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '13', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())");
 652        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set PayPal Completed Order Status', 'MODULE_PAYMENT_PAYPAL_IPN_COMP_ORDER_STATUS_ID', '0', 'Set the status of orders which are confirmed as paid (completed) to this value', '6', '13', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())");
 653        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Transaction Type', 'MODULE_PAYMENT_PAYPAL_IPN_TRANSACTION_TYPE', 'Aggregate', 'Send individual items to PayPal or aggregate all as one total item?', '6', '14', 'tep_cfg_select_option(array(\'Per Item\',\'Aggregate\'), ', now())");
 654        // bof PandA.nl move tax to total amount

 655        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Move tax to total amount', 'MOVE_TAX_TO_TOTAL_AMOUNT', 'True', 'Do you want to move the tax to the total amount? If true PayPal will allways show the total amount including tax. (needs Aggregate instead of Per Item to function)', '6', '15', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
 656        // eof PandA.nl move tax to total amount      

 657        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Page Style', 'MODULE_PAYMENT_PAYPAL_IPN_PAGE_STYLE', '', 'The page style to use for the transaction procedure (defined at your PayPal Profile page)', '6', '20', now())");
 658        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Debug E-Mail Address', 'MODULE_PAYMENT_PAYPAL_IPN_DEBUG_EMAIL', '', 'All parameters of an Invalid IPN notification will be sent to this email address if one is entered.', '6', '21', now())");
 659        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('cURL Proxy server', 'MODULE_PAYMENT_PAYPAL_IPN_PROXY_SERVER', '', 'If curl transactions need to go through a proxy, type the address here starting with http://. Otherwise, leave it blank. The current GoDaddy proxy address is http://proxy.shr.secureserver.net:3128', '6', '22', now())");
 660        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Encrypted Web Payments', 'MODULE_PAYMENT_PAYPAL_IPN_EWP_STATUS', 'False', 'Do you want to enable Encrypted Web Payments?', '6', '30', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
 661        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Your Private Key', 'MODULE_PAYMENT_PAYPAL_IPN_EWP_PRIVATE_KEY', '', 'The location of your Private Key to use for signing the data. (*.pem)', '6', '31', now())");
 662        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Your Public Certificate', 'MODULE_PAYMENT_PAYPAL_IPN_EWP_PUBLIC_KEY', '', 'The location of your Public Certificate to use for signing the data. (*.pem)', '6', '32', now())");
 663        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('PayPals Public Certificate', 'MODULE_PAYMENT_PAYPAL_IPN_EWP_PAYPAL_KEY', '', 'The location of the PayPal Public Certificate for encrypting the data.', '6', '33', now())");
 664        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Your PayPal Public Certificate ID', 'MODULE_PAYMENT_PAYPAL_IPN_EWP_CERT_ID', '', 'The Certificate ID to use from your PayPal Encrypted Payment Settings Profile.', '6', '34', now())");
 665        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Working Directory', 'MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY', '', 'The working directory to use for temporary files. (trailing slash needed)', '6', '35', now())");
 666        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('OpenSSL Location', 'MODULE_PAYMENT_PAYPAL_IPN_EWP_OPENSSL', '/usr/bin/openssl', 'The location of the openssl binary file.', '6', '36', now())");
 667  
 668      }
 669  
 670      function remove() {
 671        tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
 672      }
 673  
 674      function keys() {
 675      // Bugfix #47 added ", 'MOVE_TAX_TO_TOTAL_AMOUNT'"

 676       return array('MODULE_PAYMENT_PAYPAL_IPN_STATUS', 'MODULE_PAYMENT_PAYPAL_IPN_GATEWAY_SERVER', 'MODULE_PAYMENT_PAYPAL_IPN_ID', 'MODULE_PAYMENT_PAYPAL_IPN_SORT_ORDER', 'MODULE_PAYMENT_PAYPAL_IPN_CURRENCY', 'MODULE_PAYMENT_PAYPAL_IPN_ZONE', 'MODULE_PAYMENT_PAYPAL_IPN_PREPARE_ORDER_STATUS_ID', 'MODULE_PAYMENT_PAYPAL_IPN_ORDER_STATUS_ID', 'MODULE_PAYMENT_PAYPAL_IPN_COMP_ORDER_STATUS_ID', 'MODULE_PAYMENT_PAYPAL_IPN_TRANSACTION_TYPE', 'MOVE_TAX_TO_TOTAL_AMOUNT', 'MODULE_PAYMENT_PAYPAL_IPN_PAGE_STYLE', 'MODULE_PAYMENT_PAYPAL_IPN_DEBUG_EMAIL', 'MODULE_PAYMENT_PAYPAL_IPN_PROXY_SERVER', 'MODULE_PAYMENT_PAYPAL_IPN_EWP_STATUS', 'MODULE_PAYMENT_PAYPAL_IPN_EWP_PRIVATE_KEY', 'MODULE_PAYMENT_PAYPAL_IPN_EWP_PUBLIC_KEY', 'MODULE_PAYMENT_PAYPAL_IPN_EWP_PAYPAL_KEY', 'MODULE_PAYMENT_PAYPAL_IPN_EWP_CERT_ID', 'MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY', 'MODULE_PAYMENT_PAYPAL_IPN_EWP_OPENSSL');
 677      }
 678    }
 679  ?>


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