Example #1
0
 function payment($module = '')
 {
     global $payment, $language, $PHP_SELF;
     if (defined('MODULE_PAYMENT_INSTALLED') && tep_not_null(MODULE_PAYMENT_INSTALLED)) {
         $this->modules = explode(';', MODULE_PAYMENT_INSTALLED);
         $include_modules = array();
         if (tep_not_null($module) && in_array($module . '.' . substr($PHP_SELF, strrpos($PHP_SELF, '.') + 1), $this->modules)) {
             $this->selected_module = $module;
             $include_modules[] = array('class' => $module, 'file' => $module . '.php');
         } else {
             reset($this->modules);
             while (list(, $value) = each($this->modules)) {
                 $class = substr($value, 0, strrpos($value, '.'));
                 $include_modules[] = array('class' => $class, 'file' => $value);
             }
         }
         for ($i = 0, $n = sizeof($include_modules); $i < $n; $i++) {
             include DIR_WS_LANGUAGES . $language . '/modules/payment/' . $include_modules[$i]['file'];
             include DIR_WS_MODULES . 'payment/' . $include_modules[$i]['file'];
             $GLOBALS[$include_modules[$i]['class']] = new $include_modules[$i]['class']();
         }
         // if there is only one payment method, select it as default because in
         // checkout_confirmation.php the $payment variable is being assigned the
         // $HTTP_POST_VARS['payment'] value which will be empty (no radio button selection possible)
         if (tep_count_payment_modules() == 1 && (!isset($GLOBALS[$payment]) || isset($GLOBALS[$payment]) && !is_object($GLOBALS[$payment]))) {
             $payment = $include_modules[0]['class'];
         }
         if (tep_not_null($module) && in_array($module, $this->modules) && isset($GLOBALS[$module]->form_action_url)) {
             $this->form_action_url = $GLOBALS[$module]->form_action_url;
         }
     }
 }
Example #2
0
 function payment($module = '')
 {
     global $payment, $language, $PHP_SELF;
     if (defined('MODULE_PAYMENT_INSTALLED') && tep_not_null(MODULE_PAYMENT_INSTALLED)) {
         // BOF Separate Pricing Per Customer, next line original code
         //       $this->modules = explode(';', MODULE_PAYMENT_INSTALLED);
         global $sppc_customer_group_id, $customer_id;
         if (!tep_session_is_registered('sppc_customer_group_id')) {
             $customer_group_id = '0';
         } else {
             $customer_group_id = $sppc_customer_group_id;
         }
         $customer_payment_query = tep_db_query("select IF(c.customers_payment_allowed <> '', c.customers_payment_allowed, cg.group_payment_allowed) as payment_allowed from " . TABLE_CUSTOMERS . " c, " . TABLE_CUSTOMERS_GROUPS . " cg where c.customers_id = '" . $customer_id . "' and cg.customers_group_id =  '" . $customer_group_id . "'");
         if ($customer_payment = tep_db_fetch_array($customer_payment_query)) {
             if (tep_not_null($customer_payment['payment_allowed'])) {
                 $temp_payment_array = explode(';', $customer_payment['payment_allowed']);
                 $installed_modules = explode(';', MODULE_PAYMENT_INSTALLED);
                 for ($n = 0; $n < sizeof($installed_modules); $n++) {
                     // check to see if a payment method is not de-installed
                     if (in_array($installed_modules[$n], $temp_payment_array)) {
                         $payment_array[] = $installed_modules[$n];
                     }
                 }
                 // end for loop
                 $this->modules = $payment_array;
             } else {
                 $this->modules = explode(';', MODULE_PAYMENT_INSTALLED);
             }
         } else {
             // default
             $this->modules = explode(';', MODULE_PAYMENT_INSTALLED);
         }
         // EOF Separate Pricing Per Customer
         $include_modules = array();
         if (tep_not_null($module) && in_array($module . '.' . substr($PHP_SELF, strrpos($PHP_SELF, '.') + 1), $this->modules)) {
             $this->selected_module = $module;
             $include_modules[] = array('class' => $module, 'file' => $module . '.php');
         } else {
             reset($this->modules);
             while (list(, $value) = each($this->modules)) {
                 $class = substr($value, 0, strrpos($value, '.'));
                 $include_modules[] = array('class' => $class, 'file' => $value);
             }
         }
         for ($i = 0, $n = sizeof($include_modules); $i < $n; $i++) {
             include DIR_WS_LANGUAGES . $language . '/modules/payment/' . $include_modules[$i]['file'];
             include DIR_WS_MODULES . 'payment/' . $include_modules[$i]['file'];
             $GLOBALS[$include_modules[$i]['class']] = new $include_modules[$i]['class']();
         }
         // if there is only one payment method, select it as default because in
         // checkout_confirmation.php the $payment variable is being assigned the
         // $_POST['payment'] value which will be empty (no radio button selection possible)
         if (tep_count_payment_modules() == 1 && (!isset($GLOBALS[$payment]) || isset($GLOBALS[$payment]) && !is_object($GLOBALS[$payment]))) {
             $payment = $include_modules[0]['class'];
         }
         if (tep_not_null($module) && in_array($module, $this->modules) && isset($GLOBALS[$module]->form_action_url)) {
             $this->form_action_url = $GLOBALS[$module]->form_action_url;
         }
     }
 }
Example #3
0
 function __construct($module = '')
 {
     global $PHP_SELF;
     $this->lang = Registry::get('Language');
     if (defined('MODULE_PAYMENT_INSTALLED') && tep_not_null(MODULE_PAYMENT_INSTALLED)) {
         $this->modules = explode(';', MODULE_PAYMENT_INSTALLED);
         $include_modules = array();
         if (tep_not_null($module) && (in_array($module . '.' . substr($PHP_SELF, strrpos($PHP_SELF, '.') + 1), $this->modules) || in_array($module, $this->modules))) {
             $this->selected_module = $module;
             if (strpos($module, '\\') !== false) {
                 $class = Apps::getModuleClass($module, 'Payment');
                 $include_modules[] = ['class' => $module, 'file' => $class];
             } else {
                 $include_modules[] = array('class' => $module, 'file' => $module . '.php');
             }
         } else {
             foreach ($this->modules as $value) {
                 if (strpos($value, '\\') !== false) {
                     $class = Apps::getModuleClass($value, 'Payment');
                     $include_modules[] = ['class' => $value, 'file' => $class];
                 } else {
                     $class = basename($value, '.php');
                     $include_modules[] = array('class' => $class, 'file' => $value);
                 }
             }
         }
         for ($i = 0, $n = sizeof($include_modules); $i < $n; $i++) {
             if (strpos($include_modules[$i]['class'], '\\') !== false) {
                 Registry::set('Payment_' . str_replace('\\', '_', $include_modules[$i]['class']), new $include_modules[$i]['file']());
             } else {
                 $this->lang->loadDefinitions('modules/payment/' . pathinfo($include_modules[$i]['file'], PATHINFO_FILENAME));
                 include 'includes/modules/payment/' . $include_modules[$i]['file'];
                 $GLOBALS[$include_modules[$i]['class']] = new $include_modules[$i]['class']();
             }
         }
         // if there is only one payment method, select it as default because in
         // checkout_confirmation.php the $_SESSION['payment'] variable is being assigned the
         // $_POST['payment'] value which will be empty (no radio button selection possible)
         if (tep_count_payment_modules() == 1 && (!isset($_SESSION['payment']) || $_SESSION['payment'] != $include_modules[0]['class'])) {
             $_SESSION['payment'] = $include_modules[0]['class'];
         }
         if (tep_not_null($module) && (in_array($module . '.' . substr($PHP_SELF, strrpos($PHP_SELF, '.') + 1), $this->modules) || in_array($module, $this->modules))) {
             if (strpos($module, '\\') !== false) {
                 $OSCOM_PM = Registry::get('Payment_' . str_replace('\\', '_', $module));
                 if (isset($OSCOM_PM->form_action_url)) {
                     $this->form_action_url = $OSCOM_PM->form_action_url;
                 }
             } elseif (isset($GLOBALS[$module]->form_action_url)) {
                 $this->form_action_url = $GLOBALS[$module]->form_action_url;
             }
         }
     }
 }
Example #4
0
 function payment($module = '')
 {
     // LINE CHANGED: MOD - Downloads Controller - Added $cart
     global $payment, $language, $PHP_SELF, $cart;
     // Start - CREDIT CLASS Gift Voucher Contribution
     if (defined('MODULE_PAYMENT_INSTALLED') && tep_not_null(MODULE_PAYMENT_INSTALLED) && $module != 'credit_covers') {
         // End - CREDIT CLASS Gift Voucher Contribution
         // BOF: MOD - Separate Pricing Per Customer, next line original code
         //      $this->modules = explode(';', MODULE_PAYMENT_INSTALLED);
         global $sppc_customer_group_id, $customer_id;
         if (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] != '0') {
             $customer_group_id = $_SESSION['sppc_customer_group_id'];
         } else {
             $customer_group_id = '0';
         }
         $customer_payment_query = tep_db_query("select IF(c.customers_payment_allowed <> '', c.customers_payment_allowed, cg.group_payment_allowed) as payment_allowed from " . TABLE_CUSTOMERS . " c, " . TABLE_CUSTOMERS_GROUPS . " cg where c.customers_id = '" . $customer_id . "' and cg.customers_group_id =  '" . $customer_group_id . "'");
         if ($customer_payment = tep_db_fetch_array($customer_payment_query)) {
             if (tep_not_null($customer_payment['payment_allowed'])) {
                 $temp_payment_array = explode(';', $customer_payment['payment_allowed']);
                 $installed_modules = explode(';', MODULE_PAYMENT_INSTALLED);
                 for ($n = 0; $n < sizeof($installed_modules); $n++) {
                     // check to see if a payment method is not de-installed
                     if (in_array($installed_modules[$n], $temp_payment_array)) {
                         $payment_array[] = $installed_modules[$n];
                     }
                 }
                 // end for loop
                 $this->modules = $payment_array;
             } else {
                 $this->modules = explode(';', MODULE_PAYMENT_INSTALLED);
             }
         } else {
             // default
             $this->modules = explode(';', MODULE_PAYMENT_INSTALLED);
         }
         // EOF: MOD - Separate Pricing Per Customer
         $include_modules = array();
         if (tep_not_null($module) && in_array($module . '.' . substr($PHP_SELF, strrpos($PHP_SELF, '.') + 1), $this->modules)) {
             $this->selected_module = $module;
             $include_modules[] = array('class' => $module, 'file' => $module . '.php');
         } else {
             reset($this->modules);
             // BOF: MOD - Downloads Controller - Free Shipping and Payments
             // Show either normal payment modules or free payment module when Free Shipping Module is On
             // Free Payment Only
             if (tep_get_configuration_key_value('MODULE_PAYMENT_FREECHARGER_STATUS') && ($cart->show_total() == 0 && $cart->show_weight() == 0)) {
                 $this->selected_module = $module;
                 $include_modules[] = array('class' => 'freecharger', 'file' => 'freecharger.php');
             } else {
                 // All Other Payment Modules
                 while (list(, $value) = each($this->modules)) {
                     $class = substr($value, 0, strrpos($value, '.'));
                     // Don't show Free Payment Module
                     if ($class != 'freecharger') {
                         $include_modules[] = array('class' => $class, 'file' => $value);
                     }
                 }
                 // EOF: MOD - Downloads Controller
             }
         }
         for ($i = 0, $n = sizeof($include_modules); $i < $n; $i++) {
             include DIR_WS_LANGUAGES . $language . '/' . $include_modules[$i]['file'];
             include DIR_WS_MODULES . 'payment/' . $include_modules[$i]['file'];
             $GLOBALS[$include_modules[$i]['class']] = new $include_modules[$i]['class']();
         }
         // if there is only one payment method, select it as default because in
         // checkout_confirmation.php the $payment variable is being assigned the
         // $_POST['payment'] value which will be empty (no radio button selection possible)
         if (tep_count_payment_modules() == 1 && (!isset($GLOBALS[$payment]) || isset($GLOBALS[$payment]) && !is_object($GLOBALS[$payment]))) {
             $payment = $include_modules[0]['class'];
         }
         if (tep_not_null($module) && in_array($module, $this->modules) && isset($GLOBALS[$module]->form_action_url)) {
             $this->form_action_url = $GLOBALS[$module]->form_action_url;
         }
     }
 }
Example #5
0
 function payment($module = '')
 {
     global $order, $payment, $language, $PHP_SELF, $shipping, $customer_id, $sendto;
     if (defined('MODULE_PAYMENT_INSTALLED') && tep_not_null(MODULE_PAYMENT_INSTALLED)) {
         $shipping_codes = explode('_', $shipping['id']);
         if (sizeof($shipping_codes) > 4) {
             $shipping_code = $shipping_codes[0] . '_' . $shipping_codes[1] . '_' . $shipping_codes[2];
         } elseif (sizeof($shipping_codes) > 2) {
             $shipping_code = $shipping_codes[0] . '_' . $shipping_codes[1];
         } else {
             $shipping_code = $shipping_codes[0];
         }
         $shipping_to_payment_query = tep_db_query("select payments from " . TABLE_SHIPPING_TO_PAYMENT . " where shipping = '" . tep_db_input($shipping_code) . "' and status = '1'");
         $shipping_to_payment = tep_db_fetch_array($shipping_to_payment_query);
         if (tep_not_null($shipping_to_payment['payments'])) {
             $this->modules = explode(';', $shipping_to_payment['payments']);
         } else {
             $this->modules = explode(';', MODULE_PAYMENT_INSTALLED);
         }
         $delivery_zone_query = tep_db_query("select entry_zone_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int) $customer_id . "' and address_book_id = '" . (int) $sendto . "'");
         $delivery_zone = tep_db_fetch_array($delivery_zone_query);
         $payment_modules = array();
         reset($this->modules);
         while (list(, $payment_module) = each($this->modules)) {
             $geo_zone_check_query = tep_db_query("select count(*) as total from " . TABLE_PAYMENT_TO_GEO_ZONES . " where payment = '" . tep_db_input($payment_module) . "'");
             $geo_zone_check = tep_db_fetch_array($geo_zone_check_query);
             if ($geo_zone_check['total'] < 1) {
                 $payment_modules[] = $payment_module;
             } else {
                 $payment_to_zones_check_query = tep_db_query("select count(*) as total from " . TABLE_ZONES_TO_GEO_ZONES . " z2gz, " . TABLE_PAYMENT_TO_GEO_ZONES . " p2gz where p2gz.status = '1' and z2gz.zone_id = '" . (int) $delivery_zone['entry_zone_id'] . "' and z2gz.geo_zone_id = p2gz.geo_zone_id and p2gz.payment = '" . tep_db_input($payment_module) . "'");
                 $payment_to_zones_check = tep_db_fetch_array($payment_to_zones_check_query);
                 if ($payment_to_zones_check['total'] > 0) {
                     $payment_modules[] = $payment_module;
                 }
             }
         }
         if (sizeof($payment_modules) > 0) {
             $this->modules = $payment_modules;
         }
         $include_modules = array();
         if (tep_not_null($module) && in_array($module . '.' . substr($PHP_SELF, strrpos($PHP_SELF, '.') + 1), $this->modules)) {
             $this->selected_module = $module;
             $include_modules[] = array('class' => $module, 'file' => $module . '.php');
         } else {
             reset($this->modules);
             while (list(, $value) = each($this->modules)) {
                 $class = substr($value, 0, strrpos($value, '.'));
                 $include_modules[] = array('class' => $class, 'file' => $value);
             }
         }
         for ($i = 0, $n = sizeof($include_modules); $i < $n; $i++) {
             include DIR_WS_LANGUAGES . $language . '/modules/payment/' . $include_modules[$i]['file'];
             include DIR_WS_MODULES . 'payment/' . $include_modules[$i]['file'];
             $GLOBALS[$include_modules[$i]['class']] = new $include_modules[$i]['class']();
         }
         // if there is only one payment method, select it as default because in
         // checkout_confirmation.php the $payment variable is being assigned the
         // $HTTP_POST_VARS['payment'] value which will be empty (no radio button selection possible)
         if (tep_count_payment_modules() == 1 && (!isset($GLOBALS[$payment]) || isset($GLOBALS[$payment]) && !is_object($GLOBALS[$payment]))) {
             $payment = $include_modules[0]['class'];
         }
         if (tep_not_null($module) && in_array($module, $this->modules) && isset($GLOBALS[$module]->form_action_url)) {
             $this->form_action_url = $GLOBALS[$module]->form_action_url;
         }
     }
 }