Author Topic: Intabill payment gateway problem  (Read 2619 times)

SenecaPharm

  • Beginner
  • *
  • Posts: 27
    • Golf Training Aids
Intabill payment gateway problem
« on: September 09, 2008, 12:32:18 pm »
Hey,

I'm having a major problem with my payment gateway, my thought is that it not up to Virtuemart 1.12 standards. At first I was getting the problem "Direct Access to this location is not allowed" whenever I even tried to create the payment module.
I had to comment out line two of the payment script and then it went through fine. Until I tested a transaction, and it wouldn't redirect to Intabill's sales page. I'm attaching two files from the payment module and i'm wondering whether or not the code just needs to be updated or not.

Any help or insight is appreciated, this could also help others update their old payment processors in the future also!

Notice: I had to comment out line 2 to get it to even work on the back end
ps_intabill.php
Code: [Select]
<?php
defined
'_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
/**
*
* @version $Id: ps_intabill.php 617 2007-01-04 19:43:08Z soeren_nb $
* @package VirtueMart
* @subpackage payment
* @copyright Copyright (C) 2004-2005 Soeren Eberhardt. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
*
* http://virtuemart.net
*/

/**
* The ps_intabill class for transactions with 2Checkout 
 */
class ps_intabill {

    var 
$payment_code "INTABILL";
    var 
$classname "ps_intabill";
  
    
/**
    * Show all configuration parameters for this payment method
    * @returns boolean False when the Payment method has no configration
    */
    
function show_configuration() { 
    
      global 
$VM_LANG;
      
$database = new ps_DB();
      
/** Read current Configuration ***/
      
require_once(CLASSPATH ."payment/".$this->classname.".cfg.php");
    
?>

      <table>
        <tr>
            <td><strong>Intabill SiteID (not MerchantID)</strong></td>
            <td>
                <input type="text" name="INTABILL_SITEID" class="inputbox" value="<?php echo INTABILL_SITEID ?>" />
            </td>
            <td>Your SiteID for this Shopping Site as configured/retrieved from the Intabill Administration Interfaces' websites management section.
            </td>
       </table>
   <?php
      
// return false if there's no configuration
      
return true;
   }
   
    function 
has_configuration() {
      
// return false if there's no configuration
      
return true;
   }
   
  
/**
* Returns the "is_writeable" status of the configuration file
* @param void
* @returns boolean True when the configuration file is writeable, false when not
*/
   
function configfile_writeable() {
      return 
is_writeableCLASSPATH."payment/".$this->classname.".cfg.php" );
   }
   
  
/**
* Returns the "is_readable" status of the configuration file
* @param void
* @returns boolean True when the configuration file is writeable, false when not
*/
   
function configfile_readable() {
      return 
is_readableCLASSPATH."payment/".$this->classname.".cfg.php" );
   }   
  
/**
* Writes the configuration file for this payment method
* @param array An array of objects
* @returns boolean True when writing was successful
*/
   
function write_configuration( &$d ) {
      
      
$my_config_array = array("INTABILL_SITEID" => $d['INTABILL_SITEID']);
      
$config "<?php\n";
      
$config .= "defined('_VALID_MOS') or die('Direct Access to this location is not allowed.'); \n\n";
      foreach( 
$my_config_array as $key => $value ) {
        
$config .= "define ('$key', '$value');\n";
      }
      
      
$config .= "?>
";
 
      if ($fp = fopen(CLASSPATH ."payment/".$this->classname.".cfg.php", "w")) {
          fputs($fp, $config, strlen($config));
          fclose ($fp);
          return true;
     }
     else
        return false;
   }
   
  /**************************************************************************
  ** name: process_payment()
  ** created by: soeren
  ** description:
  ** parameters: $order_number, the number of the order, we're processing here
  **            $order_total, the total $ of the order
  ** returns:
  ***************************************************************************/
   function process_payment($order_number, $order_total, &$d) {

      return true;

   }
   
   
}

intabill.php
Code: [Select]
<?php 
/**
* Intacard Incoming Sale Handler
*
* @version $Id: notify.php 618 2007-01-04 20:10:54Z soeren_nb $
* @package VirtueMart
* @subpackage core
* @copyright Copyright (C) 2004-2005 Soeren Eberhardt. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
*
* http://virtuemart.net
*/
$messages = Array();

if (
$_POST) {
    
header("Status: 200 OK");
    
define('_VALID_MOS''1');
    global 
$mosConfig_absolute_path$mosConfig_live_site$mosConfig_lang$database,
    
$mosConfig_mailfrom$mosConfig_fromname;
    
    
/*** access Joomla's configuration file ***/
        
$my_path dirname(__FILE__);
        
        if( 
file_exists($my_path."/../../../configuration.php")) {
            require_once(
$my_path."/../../../configuration.php");
        }
        elseif( 
file_exists($my_path."/../../configuration.php")){
            require_once(
$my_path."/../../configuration.php");
        }
        elseif( 
file_exists($my_path."/configuration.php")){
            require_once( 
$my_path."/configuration.php" );
        }
        else
            die( 
"Joomla Configuration File not found!" );
        
        include_once( 
$my_path.'/compat.joomla1.5.php' );
        
        if( 
class_exists'jconfig')) {
define'_JEXEC');
define('JPATH_BASE'$mosConfig_absolute_path );

require_once ( JPATH_BASE .'/includes/defines.php' );
require_once ( JPATH_BASE .'/includes/application.php' );
require_once ( JPATH_BASE'/includes/database.php');
// create the mainframe object
$mainframe = new JSite();

// set the configuration
$mainframe->setConfiguration(JPATH_CONFIGURATION DS 'configuration.php');

// load system plugin group
JPluginHelper::importPlugin'system' );

// trigger the onStart events
$mainframe->triggerEvent'onBeforeStart' );

// create the session
$mainframe->setSession$mainframe->getCfg('live_site').$mainframe->getClientId() );
$database =& JFactory::getDBO();
        }
        else {
        

        
require_once($mosConfig_absolute_path'/includes/database.php');
        
$database = new database$mosConfig_host$mosConfig_user$mosConfig_password$mosConfig_db$mosConfig_dbprefix );
        }
        
        
// load Joomla Language File
        
if (file_exists$mosConfig_absolute_path'/language/'.$mosConfig_lang.'.php' )) {
            require_once( 
$mosConfig_absolute_path'/language/'.$mosConfig_lang.'.php' );
        }
        elseif (
file_exists$mosConfig_absolute_path'/language/english.php' )) {
            require_once( 
$mosConfig_absolute_path'/language/english.php' );
        }
    
/*** END of Joomla config ***/
    
    
    /*** VirtueMart part ***/        
        
require_once($mosConfig_absolute_path.'/administrator/components/com_virtuemart/virtuemart.cfg.php');
        require_once( 
CLASSPATH'ps_main.php');
        
require_once( CLASSPATH"language.class.php" );
require_once(CLASSPATH."Log/Log.php");
$vmLoggerConf = array(
'buffering' => true
);
/**
 * This Log Object will help us log messages and errors
 * See http://pear.php.net/package/Log
 * @global Log vmLogger
 */
$vmLogger = &vmLog::singleton('display'''''$vmLoggerConfPEAR_LOG_TIP);
$GLOBALS['vmLogger'] =& $vmLogger;

        require_once( 
CLASSPATH 'phpmailer/class.phpmailer.php');
        
$mail = new vmPHPMailer();
        
$mail->PluginDir CLASSPATH 'phpmailer/';
        
$mail->SetLanguage("en"CLASSPATH 'phpmailer/language/');
              
        
/* load the VirtueMart Language File */
        
if (file_existsADMINPATH'languages/'.$mosConfig_lang.'.php' ))
          require_once( 
ADMINPATH'languages/'.$mosConfig_lang.'.php' );
        else
          require_once( 
ADMINPATH'languages/english.php' );
        
        
/* Load the VirtueMart database class */
        
require_once( CLASSPATH'ps_database.php' );
        
    // restart session
    require_once(CLASSPATH."ps_session.php");

    // Constructor initializes the session!
    $sess = new ps_session();                        
    
    // Include globals; for this, $db is needed, as is htmlTools.class.php
    $db = new ps_DB;
    require_once( CLASSPATH'htmlTools.class.php' );
    require_once( ADMINPATH'global.php' );
    
/*** END VirtueMart part ***/
    
      // The Order Number
      
$seed =  trim(stripslashes($_POST['seed']));

      
// Get the Order Details from the database
      
$qv "SELECT `order_id`, `order_number`, `user_id`, `order_subtotal`,
                    `order_total`, `order_currency`, `order_tax`,
                    `order_shipping_tax`, `coupon_discount`, `order_discount`
                FROM `#__{vm}_orders`
                WHERE `order_number`='"
.$seed."'"

      
$db = new ps_DB;
      
$db->query($qv);
      
$db->next_record();

      
$order_id $db->f("order_id");      

      
$d['order_id'] = $order_id;         

      if(
$order_id) {

              
$d['order_status'] = 'C';

              require_once ( 
CLASSPATH 'ps_order.php' );
              
$ps_order= new ps_order;
              
$ps_order->order_status_update($d);

                require_once ( 
CLASSPATH 'ps_order.php' );
                
$ps_order= new ps_order;
                
$ps_order->order_status_update($d);
                
$mail->From $mosConfig_mailfrom;
                
$mail->FromName $mosConfig_fromname;
                
$mail->AddAddress($mosConfig_mailfrom);
                
$mail->Subject "Intabill Transaction Confirmed on your site!";
                
$mail->Body "Hello,\n\n";
                
$mail->Body .= "an Intacard transaction for you has been made on your website!\n";
                
$mail->Body .= "--------------------------------------------------------------\n";
                
$mail->Body .= "Transaction ID: $txn_id\n";
                
$mail->Body .= "Order ID: $order_id\n";
                
$mail->Body .= "Order Status Code: ".$d['order_status'];
                
$mail->Send();


    }

}
?>


SenecaPharm

  • Beginner
  • *
  • Posts: 27
    • Golf Training Aids
Re: Intabill payment gateway problem
« Reply #1 on: September 10, 2008, 14:36:22 pm »
Nevermind!

Solved it, commented out the valid mos lines and changed mosRedirect to vmRedirect in the configuration file (not shown).

Maybe this will help the paypal people with their problems? My gateway runs like a Paypal processor on VM (redirects to another website).