Jump to content
Sign in to follow this  
obaluba

Protx / Sagepay 'Direct' URL help!

Recommended Posts

Hi all,

 

I'm hoping someone can help me. I'm no genius at PHP or OsCommerce really, but I've been asked to upgrade the URL's. I didnt build the original site and I have no way of getting in touch with those that did.

 

In my Includes/Modules/Payment folder i have a file called 'protx_direct.php' which when i view it has none of the URL's listed?

 

However in the root of the webserver there is a file called 'protx_process.php' this does have the URL's in.

 

Could someone tell me where to add the URL's for Direct? I can only find instructions for PROTX_Form.

 

Is it just a case of matching up the 'direct' URL's from here https://www.sagepay.com/help/faq/new_sage_pay_urls and replacing the PROTX ones in the protx_process.php?

 

Any help would be massively well received!

 

thanks

Share this post


Link to post
Share on other sites

They are in the protx_direct.php file in the payment module folder, look for likes that start with $this->url

 

Its probably easier to update the payment module - the latest version has the correct strings. (its as simple as overwriting the protx_direct.php file)

Edited by markg@dpie.com

Share this post


Link to post
Share on other sites

Thanks for your reply. I'm still really struggling with this, even after several calls to Sagepay...

 

I have updated the URLS as best I can but were using an old version of PROTX (v2.22-v4.3) which i dont really want to change as i think it could be a nightmare to upgrade!

 

In the modules/payments folder i have a file called 'protx_direct.php' which calls 'protx_process.php' from the root folder.. In there I can find the URLS but there all 'test'?

 

Could someone take a look at my code and hopefully point me in the right direction?

 

I'm at my wits end!

 

PROTX_Direct.php

 

<?php
//
// +----------------------------------------------------------------------+
// + osCommerce, Open Source E-Commerce Solutions                         +
// +----------------------------------------------------------------------+
// | Copyright (c) 2004 Jason LeBaron                                     |
// |           (c) 2006-2007 Tom Hodges-Hoyland                           |
// |                                                                      |
// | Portions Copyright (c) 2003 osCommerce                               |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the GPL license,       |
// | that is bundled with this package in the file LICENSE, and is        |
// | available through the world-wide-web at the following url:           |
// | http://www.gnu.org/copyleft/gpl.html.                                |
// +----------------------------------------------------------------------+
// | includes/modules/payment/protx_direct.php                            |
// | Released under GPL                                                   |
// | Created by Jason LeBaron - jason@networkdad.com                      |
// | Modified for v2.22-v4.3 by Thomas Hodges-Hoyland (perfectpassion):   |
// |                                             osc@hodges-hoyland.me.uk |
// +----------------------------------------------------------------------+
// $Id: protx_direct.php 2 2004-12-24 07:49:00Z networkdad $

class protx_direct {
 var $code, $title, $description, $enabled;

// Class constructor
function protx_direct() {
   global $order;

   $this->code = 'protx_direct';
   $this->title = MODULE_PAYMENT_PROTX_DIRECT_TEXT_TITLE; // Payment module title
   $this->description = MODULE_PAYMENT_PROTX_DIRECT_TEXT_DESCRIPTION; // Descriptive Info about module in Admin
   $this->enabled = ((MODULE_PAYMENT_PROTX_DIRECT_STATUS == 'True') ? true : false); // Whether the module is installed or not
   $this->sort_order = MODULE_PAYMENT_PROTX_DIRECT_SORT_ORDER; // Sort Order of this payment option on the customer payment page
   $this->form_action_url = tep_href_link('protx_process.php', 'action=process', 'SSL');    

   if ((int)MODULE_PAYMENT_PROTX_DIRECT_ORDER_STATUS_ID > 0) {
     $this->order_status = MODULE_PAYMENT_PROTX_DIRECT_ORDER_STATUS_ID;
   }

   if (is_object($order)) $this->update_status();
}

//Class functions
function update_status() {
     global $order;

     // Check if a zone is specified for Protx Direct, if so if not current zone then disable module
     if (($this->enabled == true) && ((int)MODULE_PAYMENT_PROTX_DIRECT_ZONE > 0)) {
       $check_flag = false;
       $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_PROTX_DIRECT_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id");
       while ($check = tep_db_fetch_array($check_query)) {
         if ($check['zone_id'] < 1) {
           $check_flag = true;
           break;
         } elseif ($check['zone_id'] == $order->billing['zone_id']) {
           $check_flag = true;
           break;
         }
       }

       if ($check_flag == false) {
         $this->enabled = false;
       }
     }
}

function javascript_validation() {
     $js =  '  if (payment_value == "' . $this->code . '") {' . "\n" .
            '    var cc_owner = document.checkout_payment.protx_direct_cc_owner.value;' . "\n" .
            '    var cc_number = document.checkout_payment.protx_direct_cc_number.value;' . "\n" .
            '    var cc_cvv = document.checkout_payment.protx_direct_cc_cvv.value;' . "\n" .
            '    if (cc_owner == "" || cc_owner.length < ' . CC_OWNER_MIN_LENGTH . ') {' . "\n" .
            '      error_message = error_message + "' . MODULE_PAYMENT_PROTX_DIRECT_TEXT_JS_CC_OWNER . '";' . "\n" .
            '      error = 1;' . "\n" .
            '    }' . "\n" .
            '    if (cc_number == "" || cc_number.length < ' . CC_NUMBER_MIN_LENGTH . ') {' . "\n" .
            '      error_message = error_message + "' . MODULE_PAYMENT_PROTX_DIRECT_TEXT_JS_CC_NUMBER . '";' . "\n" .
            '      error = 1;' . "\n" .
            '    }' . "\n" .
 	         '    if (cc_cvv == "" || cc_cvv.length < "3" || cc_cvv.length > "4") {' . "\n".
            '      error_message = error_message + "' . MODULE_PAYMENT_PROTX_DIRECT_TEXT_JS_CC_CVV . '";' . "\n" .
            '      error = 1;' . "\n" .
            '    }' . "\n" .
            '  }' . "\n";

     return $js;
}

function selection() {
     global $order;

// Create Card types
if (MODULE_PAYMENT_PROTX_DIRECT_USE_VISA != 'False') { $cc_type[] = array('id' => 'VISA', 'text' => 'Visa'); }
if (MODULE_PAYMENT_PROTX_DIRECT_USE_MC != 'False') { $cc_type[] = array('id' => 'MC', 'text' => 'Mastercard'); }
if (MODULE_PAYMENT_PROTX_DIRECT_USE_DELTA != 'False') { $cc_type[] = array('id' => 'DELTA', 'text' => 'Visa Delta'); }
if (MODULE_PAYMENT_PROTX_DIRECT_USE_SWITCH != 'False') { $cc_type[] = array('id' => 'SWITCH', 'text' => 'Switch / Maestro'); }
if (MODULE_PAYMENT_PROTX_DIRECT_USE_UKE != 'False') { $cc_type[] = array('id' => 'UKE', 'text' => 'Electron'); }
if (MODULE_PAYMENT_PROTX_DIRECT_USE_SOLO != 'False') { $cc_type[] = array('id' => 'SOLO', 'text' => 'Solo'); }
if (MODULE_PAYMENT_PROTX_DIRECT_USE_AMEX != 'False') { $cc_type[] = array('id' => 'AMEX', 'text' => 'American Express'); }
if (MODULE_PAYMENT_PROTX_DIRECT_USE_DC != 'False') { $cc_type[] = array('id' => 'DC', 'text' => 'Diners Club'); }
if (MODULE_PAYMENT_PROTX_DIRECT_USE_JCB != 'False') { $cc_type[] = array('id' => 'JCB', 'text' => 'JCB'); }


// Expiry date array for drop down list
     $expires_month[] = array('id' => '', 'text' => '');  // Add a blank month or year to expiry & start to prompt people to select
     for ($i=1; $i<13; $i++) {
       $expires_month[] = array('id' => sprintf('%02d', $i), 'text' => sprintf('%02d', $i));
     }

     $today = getdate();
     $expires_year[] = array('id' => '', 'text' => '');
     for ($i=$today['year']; $i < $today['year']+10; $i++) {
       $expires_year[] = array('id' => strftime('%y',mktime(0,0,0,1,1,$i)), 'text' => strftime('%Y',mktime(0,0,0,1,1,$i)));
     }

// Start Date Arrays for drop down list
     $start_month[] = array('id' => '', 'text' => '');
     for ($i=1; $i<13; $i++) {
       $start_month[] = array('id' => sprintf('%02d', $i), 'text' => sprintf('%02d', $i));
     }

     $today = getdate();
     $start_year[] = array('id' => '', 'text' => '');
     for ($i=$today['year']-4; $i <= $today['year']; $i++) {
       $start_year[] = array('id' => strftime('%y',mktime(0,0,0,1,1,$i)), 'text' => strftime('%Y',mktime(0,0,0,1,1,$i)));
     }

// create card detail entry form
  $selection = array('id' => $this->code,
                        'module' => MODULE_PAYMENT_PROTX_DIRECT_TEXT_TITLE,
					 'fields' => array(array('title' => MODULE_PAYMENT_PROTX_DIRECT_TEXT_CREDIT_CARD_TYPE,
                                                'field' => tep_image(DIR_WS_IMAGES. 'card-options.gif') . '<br />' . tep_draw_pull_down_menu('protx_direct_cc_type', $cc_type,'','style="width: 150px;"')),
                                          array('title' => MODULE_PAYMENT_PROTX_DIRECT_TEXT_CREDIT_CARD_OWNER,
                                                'field' => tep_draw_input_field('protx_direct_cc_owner', $order->billing['firstname'] . ' ' . $order->billing['lastname'])),
                                          array('title' => MODULE_PAYMENT_PROTX_DIRECT_TEXT_CREDIT_CARD_NUMBER,
                                                'field' => tep_draw_input_field('protx_direct_cc_number','',' autocomplete="off"')),
                                          array('title' => MODULE_PAYMENT_PROTX_DIRECT_TEXT_CREDIT_CARD_START_DATE,
                                                'field' => tep_draw_pull_down_menu('protx_direct_cc_start_month', $start_month) . ' ' . tep_draw_pull_down_menu('protx_direct_cc_start_year', $start_year)),
                                          array('title' => MODULE_PAYMENT_PROTX_DIRECT_TEXT_CREDIT_CARD_EXPIRES,
                                                'field' => tep_draw_pull_down_menu('protx_direct_cc_expires_month', $expires_month) . ' ' . tep_draw_pull_down_menu('protx_direct_cc_expires_year', $expires_year)),
                                          array('title' => MODULE_PAYMENT_PROTX_DIRECT_TEXT_CREDIT_CARD_ISSUE_NUMBER,
                                                'field' => tep_draw_input_field('protx_direct_cc_issue', '', "size=2, maxlength=2 autocomplete=off")),
                                          array('title' => MODULE_PAYMENT_PROTX_DIRECT_TEXT_CVV,
                                                'field' => tep_draw_input_field('protx_direct_cc_cvv','',"size=4, maxlength=4 autocomplete=off"))));
      return $selection;
}

function pre_confirmation_check() {
     global $HTTP_POST_VARS;

     include(DIR_WS_CLASSES . 'protx_cc_validation.php');

     $cc_validation = new cc_validation();
     $result = $cc_validation->validate($HTTP_POST_VARS['protx_direct_cc_number'], $HTTP_POST_VARS['protx_direct_cc_expires_month'], $HTTP_POST_VARS['protx_direct_cc_expires_year']);
     $error = '';
     switch ($result) {
       case -1:
         $error = sprintf(TEXT_CCVAL_ERROR_UNKNOWN_CARD, substr($cc_validation->cc_number, 0, 4));
         break;
       case -2:
       case -3:
       case -4:
         $error = TEXT_CCVAL_ERROR_INVALID_DATE;
         break;
       case false:
         $error = TEXT_CCVAL_ERROR_INVALID_NUMBER;
         break;
     }

     if (($result == false) || ($result < 1)) {
       $payment_error_return = 'payment_error=' . $this->code . '&error=' . urlencode($error) . '&protx_direct_cc_owner=' . urlencode($HTTP_POST_VARS['protx_direct_cc_owner']) . '&protx_direct_cc_expires_month=' . $HTTP_POST_VARS['protx_direct_cc_expires_month'] . '&protx_direct_cc_expires_year=' . $HTTP_POST_VARS['protx_direct_cc_expires_year'];
       tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false));
     }

     $this->cc_card_type = $HTTP_POST_VARS['protx_direct_cc_type'];
     $this->cc_card_number = $cc_validation->cc_number;
     $this->cc_expiry_month = $cc_validation->cc_expiry_month;
     $this->cc_expiry_year = $cc_validation->cc_expiry_year;
}

function confirmation() {
     global $HTTP_POST_VARS;

  $confirmation = array('title' => MODULE_PAYMENT_PROTX_DIRECT_TEXT_TITLE,
				 	    'fields' => array(array('title' => MODULE_PAYMENT_PROTX_DIRECT_TEXT_CREDIT_CARD_TYPE,
                                                   'field' => $this->cc_card_type),
                                             array('title' => MODULE_PAYMENT_PROTX_DIRECT_TEXT_CREDIT_CARD_OWNER,
                                                   'field' => $HTTP_POST_VARS['protx_direct_cc_owner']),
                                             array('title' => MODULE_PAYMENT_PROTX_DIRECT_TEXT_CREDIT_CARD_NUMBER,
                                                   'field' => substr($this->cc_card_number, 0, 4) . str_repeat('X', (strlen($this->cc_card_number) - 8)) . substr($this->cc_card_number, -4)),
                                             array('title' => MODULE_PAYMENT_PROTX_DIRECT_TEXT_CREDIT_CARD_START_DATE,
                                                   'field' => $HTTP_POST_VARS['protx_direct_cc_start_month'] . '/' . $HTTP_POST_VARS['protx_direct_cc_start_year']),
                                             array('title' => MODULE_PAYMENT_PROTX_DIRECT_TEXT_CREDIT_CARD_EXPIRES,
                                                   'field' => $HTTP_POST_VARS['protx_direct_cc_expires_month'] . '/' . $HTTP_POST_VARS['protx_direct_cc_expires_year']),
                                             array('title' => MODULE_PAYMENT_PROTX_DIRECT_TEXT_CREDIT_CARD_ISSUE_NUMBER,
                                                   'field' => $HTTP_POST_VARS['protx_direct_cc_issue']),
                                             array('title' => MODULE_PAYMENT_PROTX_DIRECT_TEXT_CVV,
                                                   'field' => $HTTP_POST_VARS['protx_direct_cc_cvv']),
										  array('title' => MODULE_PAYMENT_PROTX_DIRECT_3D_SECURE,
										        'field' => MODULE_PAYMENT_PROTX_DIRECT_3D_SECURE_DETAILS)));

     return $confirmation;
}

function process_button() {
     global $HTTP_POST_VARS, $order;

     // These are hidden fields on the checkout confirmation page
$process_button_string = tep_draw_hidden_field('cc_owner', $HTTP_POST_VARS['protx_direct_cc_owner']) .
                              tep_draw_hidden_field('cc_expires', $this->cc_expiry_month . substr($this->cc_expiry_year, -2)) .
                              tep_draw_hidden_field('cc_type', $this->cc_card_type) .
                              tep_draw_hidden_field('protx_direct_cc_number', $this->cc_card_number) .
                              tep_draw_hidden_field('cc_cvv', $HTTP_POST_VARS['protx_direct_cc_cvv']) .
                              tep_draw_hidden_field('cc_start', $HTTP_POST_VARS['protx_direct_cc_start_month'] . $HTTP_POST_VARS['protx_direct_cc_start_year']) .
                              tep_draw_hidden_field('cc_issue', $HTTP_POST_VARS['protx_direct_cc_issue']) .
                              tep_draw_hidden_field(tep_session_name(), tep_session_id()) .
                              tep_draw_hidden_field('shipping_total', $order->info['shipping_cost']) .
                              tep_draw_hidden_field('ord_total', $order->info['total']);
     return $process_button_string;
}

function before_process() {

}

function after_process() {
 global $insert_id, $customer_id;
 tep_db_query("UPDATE protx_direct SET order_id='".$insert_id."' WHERE id='".tep_db_input($_GET['protx_id'])."' AND customer_id='".$customer_id."'");
}

function get_error() {
     global $HTTP_GET_VARS;
     $error = array('title' => MODULE_PAYMENT_PROTX_DIRECT_TEXT_ERROR,
                    'error' => stripslashes(urldecode($HTTP_GET_VARS['error'])));
     return $error;
}

function check() {
     if (!isset($this->_check)) {
       $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_PROTX_DIRECT_STATUS'");
       $this->_check = tep_db_num_rows($check_query);
     }
     return $this->_check;
}

function install() {
     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 Protx Direct Module', 'MODULE_PAYMENT_PROTX_DIRECT_STATUS', 'True', 'Do you want to accept Protx payments via the Direct Method?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Vendor Name', 'MODULE_PAYMENT_PROTX_DIRECT_VENDOR_NAME', 'testvendor', 'The login vendor name for the Protx service.', '6', '0', now())");
     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 Mode', 'MODULE_PAYMENT_PROTX_DIRECT_TRANSACTION_MODE', 'Test', 'Transaction mode used for processing orders.<br /><br /><strong>Server IP Test</strong> is used to gain the IP address of your server which Protx will need to get you live.', '6', '0', 'tep_cfg_select_option(array(\'Test\', \'Server IP Test\', \'Simulator\', \'Production\'), ', now())");
     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 ('Authorisation Type', 'MODULE_PAYMENT_PROTX_DIRECT_AUTHORIZATION_TYPE', 'AUTHENTICATE', 'Do you want submitted credit card transactions to us authenticate & authorise, deferred, or immediately charged? - Contact Protx for explanation.', '6', '0', 'tep_cfg_select_option(array(\'PAYMENT\', \'DEFERRED\', \'AUTHENTICATE\'), ', now())");
     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 ('Merchant Account', 'MODULE_PAYMENT_PROTX_DIRECT_MERCHANT_ACCOUNT', 'E', 'Which merchant account is to be used?<br />E = E-commerce<br />C = Continuous Authority<br />M = Mail Order / Telephone Order', '6', '0', 'tep_cfg_select_option(array(\'E\', \'C\', \'M\'), ', now())");
  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 ('Send Shopping Cart', 'MODULE_PAYMENT_PROTX_DIRECT_SHOPCART', 'True', 'Do you want details of the customer\'s cart to be sent to Protx?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
     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 ('Debug', 'MODULE_PAYMENT_PROTX_DIRECT_DEBUG', 'False', '<strong>Do Not</strong> enable this unless instructed to do so.', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
     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_PROTX_DIRECT_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
     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_PROTX_DIRECT_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");
     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 ('Allow Mastercard', 'MODULE_PAYMENT_PROTX_DIRECT_USE_MC', 'True', '', '6', '0', 'tep_cfg_select_option(array(\'True - with 3D-Secure\',\'True\', \'False\'), ', now())");
     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 ('Allow Visa', 'MODULE_PAYMENT_PROTX_DIRECT_USE_VISA', 'True', '', '6', '0', 'tep_cfg_select_option(array(\'True - with 3D-Secure\',\'True\', \'False\'), ', now())");
     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 ('Allow Solo', 'MODULE_PAYMENT_PROTX_DIRECT_USE_SOLO', 'True', '', '6', '0', 'tep_cfg_select_option(array(\'True - with 3D-Secure\',\'True\', \'False\'), ', now())");
     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 ('Allow Electron', 'MODULE_PAYMENT_PROTX_DIRECT_USE_UKE', 'True', '', '6', '0', 'tep_cfg_select_option(array(\'True - with 3D-Secure\',\'True\', \'False\'), ', now())");
     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 ('Allow Visa Delta', 'MODULE_PAYMENT_PROTX_DIRECT_USE_DELTA', 'True', '', '6', '0', 'tep_cfg_select_option(array(\'True - with 3D-Secure\',\'True\', \'False\'), ', now())");
     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 ('Allow Switch/Maestro', 'MODULE_PAYMENT_PROTX_DIRECT_USE_SWITCH', 'True - with 3D-Secure', '', '6', '0', 'tep_cfg_select_option(array(\'True - with 3D-Secure\',\'True\', \'False\'), ', now())");
     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 ('Allow AMEX', 'MODULE_PAYMENT_PROTX_DIRECT_USE_AMEX', 'False', '', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
     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 ('Allow Diners', 'MODULE_PAYMENT_PROTX_DIRECT_USE_DC', 'False', '', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
     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 ('Allow JCB', 'MODULE_PAYMENT_PROTX_DIRECT_USE_JCB', 'False', '', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
     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 Order Status', 'MODULE_PAYMENT_PROTX_DIRECT_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value.', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())");
}

function remove() {
     tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
}

function keys() {
   return array(
'MODULE_PAYMENT_PROTX_DIRECT_STATUS',
'MODULE_PAYMENT_PROTX_DIRECT_VENDOR_NAME',
'MODULE_PAYMENT_PROTX_DIRECT_TRANSACTION_MODE',
   'MODULE_PAYMENT_PROTX_DIRECT_AUTHORIZATION_TYPE',
'MODULE_PAYMENT_PROTX_DIRECT_MERCHANT_ACCOUNT',
'MODULE_PAYMENT_PROTX_DIRECT_SHOPCART',
'MODULE_PAYMENT_PROTX_DIRECT_DEBUG',
'MODULE_PAYMENT_PROTX_DIRECT_SORT_ORDER',
'MODULE_PAYMENT_PROTX_DIRECT_ZONE',
'MODULE_PAYMENT_PROTX_DIRECT_ORDER_STATUS_ID',
   'MODULE_PAYMENT_PROTX_DIRECT_USE_MC',
   'MODULE_PAYMENT_PROTX_DIRECT_USE_VISA',
   'MODULE_PAYMENT_PROTX_DIRECT_USE_SOLO',
   'MODULE_PAYMENT_PROTX_DIRECT_USE_DELTA',
   'MODULE_PAYMENT_PROTX_DIRECT_USE_UKE',
   'MODULE_PAYMENT_PROTX_DIRECT_USE_JCB',
   'MODULE_PAYMENT_PROTX_DIRECT_USE_AMEX',
   'MODULE_PAYMENT_PROTX_DIRECT_USE_SWITCH',
   'MODULE_PAYMENT_PROTX_DIRECT_USE_DC');
}

}
?>

 

and now Protx_process.php

 

<?php
//
// +----------------------------------------------------------------------+
// | osCommerce, Open Source E-Commerce Solutions                         |
// +----------------------------------------------------------------------+
// | Copyright (c) 2007 Tom Hodges-Hoyland                                |
// |                                                                      |
// | Portions Copyright (c) 2003 osCommerce                               |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the GPL license,       |
// | that is bundled with this package in the file LICENSE, and is        |
// | available through the world-wide-web at the following url:           |
// | http://www.gnu.org/copyleft/gpl.html.                                |
// +----------------------------------------------------------------------+
// | protx_process.php - v4.4                                             |
// | Released under GPL                                                   |
// | Created by Thomas Hodges-Hoyland (perfectpassion):                   |
// |                                             osc@hodges-hoyland.me.uk |
// +----------------------------------------------------------------------+
// 

// Extra Configuration Options
$use_iframe = true;  // Set to true to use iframe for 3D-Secure page

$disable_curl_ssl_check = false;    // Set to true (no quotes)
                                   // if you are having problems connecting to the protx servers

$use_more_accurate_order_id = true;  // May not work for everyone (depending upon database permission
                                    // Set to false to use less accurate method
$timeout = 90;  // Number of seconds to wait for Protx response

$protocol = '2.22';  // Shouldn't need changing

// End of extra configuration options


require('includes/application_top.php');

// if the customer is not logged on, redirect them to the login page
 if (!tep_session_is_registered('customer_id')) {
   $navigation->set_snapshot(array('mode' => 'SSL', 'page' => FILENAME_CHECKOUT_PAYMENT));
   tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
 }

if ($_GET['action'] == '3Dreturn') {
 if ($_GET['iframe'] == 'Y') {  // Returned from bank's 3D-secure page and need to break out of iframe back to store
   $loc = tep_href_link('protx_process.php', tep_get_all_get_params(Array('iframe' => 'iframe')), 'SSL');
   echo '<html><head><title>3D-Secure Complete</title></head><body style="font-size: 11px; font-family: \'Lucida Grande\', Verdana, Arial, sans-serif;" onload="document.getElementById(\'theform\').submit();">
         <form id="theform" action="'.$loc.'" target="_top" method="post">
	  <input type="hidden" name="MD" value="'.$_POST['MD'].'" />
	  <input type="hidden" name="PaRes" value="'.urlencode($_POST['PaRes']).'" />
         <p style="font: 12px Tahoma, Arial, Verdana, sans-serif;" align="center">Your payment is being processed</p>
	  <p style="font: 12px Tahoma, Arial, Verdana, sans-serif;" align="center">Please wait a few seconds.</p>
         <div align="center">' . tep_image(DIR_WS_IMAGES . 'loading.gif', 'Checkout timer', '50px', '50px') . '</div>
	  <noscript><center><p><b>3D-Secure Card Authorisation Complete</b></p><p>Please click the button ONCE to complete your order.</p></center>
	  <center><input type="submit" value="Complete Order" /></center></noscript></form>
	  </body></html>';
   exit();
 }

 $data = 'MD=' . $_POST['MD'] . '&PARes='. $_POST['PaRes'];
 $url ='';
  if (MODULE_PAYMENT_PROTX_DIRECT_TRANSACTION_MODE == 'Test') {
         $url = 'https://test.sagepay.com/gateway/service/direct3dcallback.vsp';
       } elseif (MODULE_PAYMENT_PROTX_DIRECT_TRANSACTION_MODE == 'Server IP Test') {
         $url = 'https://test.sagepay.com/showpost/showpost.asp';
       } elseif (MODULE_PAYMENT_PROTX_DIRECT_TRANSACTION_MODE == 'Simulator') {
      $url = 'https://test.sagepay.com/VSPSimulator/VSPDirectCallback.asp';
       } else {
      $url = 'https://live.sagepay.com/gateway/service/direct3dcallback.vsp';
    }

     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_HEADER, 0);
     curl_setopt($ch, CURLOPT_POST, true);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);

     if ($disable_curl_ssl_check === true) 
  {
      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
      curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
     }

     $response = curl_exec($ch);
     $curl_error = curl_error($ch);

     curl_close ($ch);

 // parse Protx response string
     $responses = Array();
     $response_array = explode("\r\n", $response);
     for ($i=0; $i < sizeof($response_array); $i++) {
       $key = substr($response_array[$i],0, strpos($response_array[$i], '='));
       $responses[$key] = substr(strstr($response_array[$i], '='), 1);
     }

     // Begin Debug Section
  if (MODULE_PAYMENT_PROTX_DIRECT_DEBUG == 'True'){
     echo '<pre>Request URL=' . $url . "\r\n" .
       'Data string sent=' . $data . "\r\n" .
          'Protx response=' . $response . "\r\n" .
	   'Response array='. print_r($responses,true) ."\r\n".
       'curl_error= ' . $curl_error . '</pre>';
       exit();
  }
     // End Debug Section

 // Save transaction details to DB
     $data = Array('status' => $responses['Status'],
				'statusdetail' => $responses['StatusDetail'],
				'vpstxid' => $responses['VPSTxId'],
				'txauthno' => $responses['TxAuthNo'],
				'securitykey' => $responses['SecurityKey'],
				'avscv2' => $responses['AVSCV2'],
				'address_result' => $responses['AddressResult'],
				'postcode_result' => $responses['PostCodeResult'],
				'CV2_result' => $responses['CV2Result'],
				'3DSecureStatus' => $responses['3DSecureStatus'],
				'CAVV' => $responses['CAVV'],
				'txtime' => date('Y-m-d H:i:s'));

  tep_db_perform(TABLE_PROTX_DIRECT, $data, 'update', "id = '".tep_db_input($_GET['ProtxID']) . "'");			
  $protx_id = tep_db_insert_id();

 // Check response and proceed appropriately
     $response_code = substr($responses['StatusDetail'],0,4);
  $authorised = false;  // Default to transaction failed
  $error_detail = '';

  switch ($responses['Status']) {
    case "OK":
	case "REGISTERED":
	case "AUTHENTICATED":
	  // OK to proceed
         $authorised = true;
	  break;

	case "REJECTED":
	case "NOTAUTHED":
	  if ($response_code == '2001') {
	    if (stristr($responses['AVSCV2'], 'NO DATA MATCHES')) {
	      $error_detail = MODULE_PAYMENT_PROTX_DIRECT_TEXT_AVS_CVV_ERROR;
		} elseif (stristr($responses['AVSCV2'], 'SECURITY CODE MATCH ONLY')) {
 		      $error_detail = MODULE_PAYMENT_PROTX_DIRECT_TEXT_ADDRESS_ERROR;
		} elseif (stristr($responses['AVSCV2'], 'ADDRESS MATCH ONLY')) {
	      $error_detail = MODULE_PAYMENT_PROTX_DIRECT_TEXT_CVV_ERROR;
		} else {
		  $error_detail = MODULE_PAYMENT_PROTX_DIRECT_TEXT_DECLINED_MESSAGE .' (' . $responses['StatusDetail'] . ')';			
		}  
	  } elseif ($response_code == '4026') {
 		    $error_detail = MODULE_PAYMENT_PROTX_DIRECT_TEXT_3D_DECLINED;			
	  } else {
	    $error_detail = MODULE_PAYMENT_PROTX_DIRECT_TEXT_DECLINED_MESSAGE .' (' . $responses['StatusDetail'] . ')';		
	  }
	  break;

	case "MALFORMED":
	  $error_detail = MODULE_PAYMENT_PROTX_DIRECT_TEXT_PROTX_MALFORMED . ' (' . $responses['StatusDetail'] . ')';
	  break;	

	case "INVALID":
	  if ($response_code == '5015') {
	    if (stristr($responses['StatusDetail'],'Issue')) { 
  		      $error_detail = MODULE_PAYMENT_PROTX_DIRECT_TEXT_INVALID_ISSUE;
		} elseif (stristr($responsed['StatusDetail'],'Start')) {
		  $error_detail = MODULE_PAYMENT_PROTX_DIRECT_TEXT_INVALID_START;
		}
	  } elseif ($response_code == '4002') {
		$error_detail = MODULE_PAYMENT_PROTX_DIRECT_TEXT_INVALID_CARDTYPE;
	  }  else {
	    $error_detail = MODULE_PAYMENT_PROTX_DIRECT_TEXT_PROTX_INVALID . ' (' . $responses['StatusDetail'] . ')';
	  }
	  break;

	case "ERROR":
	  // There's a fault with module or Protx
         $error_detail = MODULE_PAYMENT_PROTX_DIRECT_TEXT_PROTX_ERROR . ' (' . $responses['StatusDetail'] . ')';
	  break;		 

	default:
	  // Just in case we haven't caught any other response, assume failed
         $error_detail = MODULE_PAYMENT_PROTX_DIRECT_TEXT_PROTX_ERROR . ' (' . $responses['StatusDetail'] . ')';
	  break;
  }

  if ($authorised === true) {
       tep_redirect(tep_href_link(FILENAME_CHECKOUT_PROCESS, 'protx_id='.$protx_id, 'SSL'));
  } else {
       tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=protx_direct&error=' . urlencode($error_detail), 'SSL', true, false));	
  }	

} elseif ($_GET['action'] == 'process') {

global $_POST, $order, $cart, $currency, $currencies;

 require(DIR_WS_CLASSES . 'order.php');
 $order = new order;

// Calculate expected order id to use as order description (note can be inaccurate if a previous order has been deleted)
if ($use_more_accurate_order_id === true) {
 // More Accurate way of getting expected order id but may not work for everyone - if not change setting at top of file
   $last_order_id_query = tep_db_query("SHOW TABLE STATUS from " . DB_DATABASE . " like '" . TABLE_ORDERS . "'");
$last_order_id = tep_db_fetch_array($last_order_id_query);
$new_order_id = $last_order_id['Auto_increment'];
} else {
   $last_order_query = "SELECT `orders_id` from `" . TABLE_ORDERS . "` ORDER BY `orders_id` DESC LIMIT 1";
   $last_order = tep_db_fetch_array(tep_db_query($last_order_query));
   $new_order_id = (int)$last_order['orders_id'] + 1;  
}     
  $order_description = 'Order Number: ' . $new_order_id;

// DATA PREPARATION SECTION
       unset($submit_data);  // Cleans out any previous data stored in the variable

  // Populate an array that contains all of the data to be sent to Protx
       $delivery_add = '';
       if ($order->delivery['street_address']) {
	  $delivery_add = $order->delivery['street_address'];
	}
       if(ACCOUNT_SUBURB == 'true' && tep_not_null($order->delivery['suburb'])) {
	  $delivery_add .= ",\r\n" . $order->delivery['suburb'];
	    }
       if (tep_not_null($order->delivery['city'])) {
	  $delivery_add .= ",\r\n" . $order->delivery['city'];
       }
       if (ACCOUNT_STATE == 'true' && tep_not_null($order->delivery['state'])) {
	  $delivery_add .= ",\r\n" . $order->delivery['state'];
       }
       if (tep_not_null($order->delivery['country']['title'])) {
	  $delivery_add .= ",\r\n" . $order->delivery['country']['title'];
       }

	$billing_add = '';
       $billing_add = $order->billing['street_address'];
       if (ACCOUNT_SUBURB == 'true') {
         $billing_add .= ",\r\n" . $order->billing['suburb'];
       }
       $billing_add .= ",\r\n" . $order->billing['city'];
       if (ACCOUNT_STATE == 'true') {
         $billing_add .= ",\r\n" . $order->billing['state'];
       }
       $billing_add .= ",\r\n" . $order->delivery['country']['title'];

// Cart details (adapted from Mike Jackson's code for Protx Form)
       $basketlist='';
    if (MODULE_PAYMENT_PROTX_DIRECT_SHOPCART == 'True') {
        if (tep_not_null($_POST['shipping_total'])) { 
          $Shipping=$_POST['shipping_total']; 
        } else { 
          $Shipping='---'; 
        }
        $products = $cart->get_products();
	 $No_lines = sizeof($products);
	 $No_lines = $No_lines + 1;  // Don't forget the shipping as an item!
	 $cart_string = $No_lines;
   	 for ($i=0, $n=sizeof($products); $i<$n; $i++) {
  				$Description = $products[$i]['name'];
			$Description  = str_replace(":", "", $Description); // Make sure that there are no colons (:) since we are producing a colon delimited list
			$Qty = $products[$i]['quantity'];
			$Price = number_format($products[$i]['price'] + $cart->attributes_price($products[$i]['id']), 2, '.', '');
			$Tax = number_format($products[$i]['price'] / 100 *  tep_get_tax_rate($products[$i]['tax_class_id']), 2, '.', '');
			$Tax = number_format($Tax, 2, '.', '');
			$final_price = $Price + $Tax;
			$final_price = number_format($final_price, 2, '.', '');
			$Line_Total = $Qty * $final_price;
			$Line_Total = number_format($Line_Total, 2, '.', '');
			$cart_string .= ":".$Description.":".$Qty.":".$Price.":".$Tax.":".$final_price.":".$Line_Total;
  		 }
   	 $cart_string .= ":Shipping:1:".$Shipping.":----:".$Shipping.":".$Shipping;
  // Remove any newlines and carrige returns - PROTX protocol does not allow these in the shopping basket.
	 $cart_string = str_replace("\n", "", $cart_string);
	 $cart_string = str_replace("\r", "", $cart_string);
        $cart_string = str_replace ("&", "and", $cart_string);
     $basketlist = substr($cart_string,0,7500); // just in case someone orders a lot!
       }

if (constant('MODULE_PAYMENT_PROTX_DIRECT_USE_'.$_POST['cc_type']) == 'True - with 3D-Secure'){
 $use_3D_Secure = 0;
} else {
 $use_3D_Secure = 2;
}

// set as MOTO transaction if using the telephone tool
if ((int)$administrator_login > 0) {
	$account_type = 'M';
} else {
	$account_type = 'E';
}

// create a random id for the transaction
     $uid = tep_create_random_value(32, 'digits');
     $VendorTxCode = $new_order_id . '-' . $uid;
  $submit_data = array(
    VPSProtocol => $protocol, // Protocol Version (Should be 2.22 for this release)
    TxType => MODULE_PAYMENT_PROTX_DIRECT_AUTHORIZATION_TYPE, // Transaction Type
    Vendor => MODULE_PAYMENT_PROTX_DIRECT_VENDOR_NAME, // Vendor Login ID
    VendorTxCode => $VendorTxCode,  // Unique Transaction ID
       Amount => number_format($_POST['ord_total'] * $currencies->get_value($currency), 2,'.',''),
    Currency => $currency,
    Description => $order_description,
       CardHolder => substr($_POST['cc_owner'],0,50),
    CardNumber => $_POST['protx_direct_cc_number'],
    StartDate => $_POST['cc_start'],
    ExpiryDate => $_POST['cc_expires'],
    IssueNumber => $_POST['cc_issue'],
    CV2 => $_POST['cc_cvv'],
    CardType => $_POST['cc_type'],
    BillingAddress => substr($billing_add,0,200),
    BillingPostCode => substr($order->billing['postcode'],0,10),
    DeliveryAddress => substr($delivery_add,0,200),
    DeliveryPostCode => substr($order->delivery['postcode'],0,200),
    CustomerName => substr($order->customer['firstname'].' '.$order->customer['lastname'],0,100),
    ContactNumber => substr($order->customer['telephone'],0,20),
    CustomerEMail => substr($order->customer['email_address'],0,255),
    ClientIPAddress => tep_get_ip_address(),
    Basket => $basketlist,
    AccountType => $account_type,
	Apply3DSecure =>$use_3D_Secure);

  // concatenate the submission data and put into variable $data
  while(list($key, $value) = each($submit_data)) {
    $data .= $key . '=' . urlencode($value) . '&';
  }

     // Strip final &
     $data = substr($data, 0, -1);

// SEND DATA BY CURL SECTION
  // Post order info data to Protx, make sure you have curl installed
       // Unset $response to make sure nothing left over from previous module calls
    unset($response);
       unset($responses);

  if (MODULE_PAYMENT_PROTX_DIRECT_TRANSACTION_MODE == 'Test') {
         $url = 'https://test.sagepay.com/gateway/service/vspdirect-register.vsp';
       } elseif (MODULE_PAYMENT_PROTX_DIRECT_TRANSACTION_MODE == 'Server IP Test') {
         $url = 'https://test.sagepay.com/showpost/showpost.asp';
       } elseif (MODULE_PAYMENT_PROTX_DIRECT_TRANSACTION_MODE == 'Simulator') {
      $url = 'https://test.sagepay.com/VSPSimulator/VSPDirectGateway.asp';
       } else {
      $url = 'https://live.sagepay.com/gateway/service/vspdirect-register.vsp';
    }

     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_HEADER, 0);
     curl_setopt($ch, CURLOPT_POST, true);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);

     if ($disable_curl_ssl_check === true) {
      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
      curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  }

     $response = curl_exec($ch);
  $curl_error = curl_error($ch);

     curl_close ($ch);



     // Begin Debug Section
  if (MODULE_PAYMENT_PROTX_DIRECT_TRANSACTION_MODE == 'Server IP Test'){
       echo $response;
       echo $data;
       exit();
  }
     // End Debug Section

     // parse Protx response string
     $responses = Array();
     $response_array = explode("\r\n", $response);
     for ($i=0; $i < sizeof($response_array); $i++) {
       $key = substr($response_array[$i],0, strpos($response_array[$i], '='));
       $responses[$key] = substr(strstr($response_array[$i], '='), 1);
     }

     // Begin Debug Section
  if (MODULE_PAYMENT_PROTX_DIRECT_DEBUG == 'True'){
     echo '<pre>Request URL=' . $url . "\r\n" .
       'Data string sent=' . $data . "\r\n" .
          'Protx response=' . $response . "\r\n" .
	   'Response array='. print_r($responses,true) ."\r\n".
       'curl_error= ' . $curl_error . '</pre>';
       exit();
  }
     // End Debug Section

     $data = Array('id' => '',
                'customer_id' => (int)$customer_id,
				'order_id' => $new_order_id,
				'vendortxcode' => $VendorTxCode,
				'txtype' => MODULE_PAYMENT_PROTX_DIRECT_AUTHORIZATION_TYPE,
				'value' => number_format($_POST['ord_total'] * $currencies->get_value($currency), 2, '.', ''),
				'vpstxid' => $responses['VPSTxId'],
				'status' => $responses['Status'],
				'statusdetail' => $responses['StatusDetail'],
				'txauthno' => $responses['TxAuthNo'],
				'securitykey' => $responses['SecurityKey'],
				'avscv2' => $responses['AVSCV2'],
				'address_result' => $responses['AddressResult'],
				'postcode_result' => $responses['PostCodeResult'],
				'CV2_result' => $responses['CV2Result'],
				'3DSecureStatus' => $responses['3DSecureStatus'],
				'CAVV' => $responses['CAVV'],
				'txtime' => date('Y-m-d H:i:s'));

  tep_db_perform(TABLE_PROTX_DIRECT, $data);
     $protx_id = tep_db_insert_id();

     // Check response and proceed appropriately
     $response_code = substr($responses['StatusDetail'],0,4);
  $authorised = false;  // Default to transaction failed
  $error_detail = '';

  switch ($responses['Status']) {
    case "3DAUTH":
	  // Redirect to card issuing bank for 3D-Secure authorisation
	if ($use_iframe === true) {

	  tep_session_register('protx_PAReq');
	  $_SESSION['protx_PAReq'] = $responses['PAReq'];

	  tep_session_register('protx_MD');
	  $_SESSION['protx_MD'] = $responses['MD'];

	  tep_session_register('protx_ACSURL');
	  $_SESSION['protx_ACSURL'] = $responses['ACSURL'];
	  ?> 

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body>
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
	<div id="main">
		<div id="brea"><?php echo $breadcrumb->trail(' » '); ?></div>
  			<h1>Payment Information</h1>
 			<center>
 				<iframe src="<?php echo tep_href_link('protx_process.php' ,'action=iframe&termurl='.urlencode(tep_href_link('protx_process.php','action=3Dreturn&iframe=Y&ProtxID='.$protx_id, 'SSL', 'true')), 'SSL', 'true'); ?>" width="450px" height="450px" frameborder="0" scrolling="auto"></iframe>
 			</center>
		</div>
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

<?php  } else {  // i.e. $use_iframe !== true
	  echo '<script LANGUAGE="Javascript"> 
                 function OnLoadEvent() { document.getElementById(\'theform\').submit(); } 
               </SCRIPT>
               <html><head><title>3D Secure Verification</title></head> 
               <body OnLoad="OnLoadEvent();">
               <FORM id="theform" action="'.$responses['ACSURL'].'" method="POST" /> 
                 <input type="hidden" name="PaReq" value="'.$responses['PAReq'].'" /> 
                 <input type="hidden" name="TermUrl" value="'. tep_href_link('protx_process.php','action=3Dreturn&ProtxID='.$protx_id,'SSL','true'),'" /> 
                 <input type="hidden" name="MD" value="'.$responses['MD'].'" /> 
                 <NOSCRIPT> 
                   <center><p>Please click button below to Authenticate your card</p><p><input type="submit" value="Go" /></p></center> 
                 </NOSCRIPT> 
               </form></body></html>';
	 }
	  exit();
	  break;

    case "OK":
	case "REGISTERED":
	case "AUTHENTICATED":
	  // OK to proceed
         $authorised = true;
	  break;

	case "REJECTED":
	case "NOTAUTHED":
	  if ($response_code == '2001') {
	    if (stristr($responses['AVSCV2'], 'NO DATA MATCHES')) {
	      $error_detail = MODULE_PAYMENT_PROTX_DIRECT_TEXT_AVS_CVV_ERROR;
		} elseif (stristr($responses['AVSCV2'], 'SECURITY CODE MATCH ONLY')) {
 		      $error_detail = MODULE_PAYMENT_PROTX_DIRECT_TEXT_ADDRESS_ERROR;
		} elseif (stristr($responses['AVSCV2'], 'ADDRESS MATCH ONLY')) {7B
		$error_detail = MODULE_PAYMENT_PROTX_DIRECT_TEXT_INVALID_CARDTYPE;
	  }  else {
	    $error_detail = MODULE_PAYMENT_PROTX_DIRECT_TEXT_PROTX_INVALID . ' (' . $responses['StatusDetail'] . ')';
	  }
	  break;

	case "ERROR":
	  // There's a fault with module or Protx
         $error_detail = MODULE_PAYMENT_PROTX_DIRECT_TEXT_PROTX_ERROR . ' (' . $responses['StatusDetail'] . ')';
	  break;		 

	default:
	  // Just in case we haven't caught any other response, assume failed
         $error_detail = MODULE_PAYMENT_PROTX_DIRECT_TEXT_PROTX_ERROR . ' (' . $responses['StatusDetail'] . ')';
	  break;
  }	  

  if ($authorised === true) {
       tep_redirect(tep_href_link(FILENAME_CHECKOUT_PROCESS, 'protx_id='.$protx_id, 'SSL'));
  } else {
       tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=protx_direct&error=' . urlencode($error_detail), 'SSL', true, false));	
  }		  


} elseif ($_GET['action'] == 'iframe') {
echo '<html>
   <head>7B
		$error_detail = MODULE_PAYMENT_PROTX_DIRECT_TEXT_INVALID_CARDTYPE;
	  }  else {
	    $error_detail = MODULE_PAYMENT_PROTX_DIRECT_TEXT_PROTX_INVALID . ' (' . $responses['StatusDetail'] . ')';
	  }
	  break;

	case "ERROR":
	  // There's a fault with module or Protx
         $error_detail = MODULE_PAYMENT_PROTX_DIRECT_TEXT_PROTX_ERROR . ' (' . $responses['StatusDetail'] . ')';
	  break;		 

	default:
	  // Just in case we haven't caught any other response, assume failed
         $error_detail = MODULE_PAYMENT_PROTX_DIRECT_TEXT_PROTX_ERROR . ' (' . $responses['StatusDetail'] . ')';
	  break;
  }	  

  if ($authorised === true) {
       tep_redirect(tep_href_link(FILENAME_CHECKOUT_PROCESS, 'protx_id='.$protx_id, 'SSL'));
  } else {
       tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=protx_direct&error=' . urlencode($error_detail), 'SSL', true, false));	
  }		  


} elseif ($_GET['action'] == 'iframe') {
echo '<html>
   <head>
<title>3D-Secure Validation</title>
<script LANGUAGE="Javascript"> 
    function OnLoadEvent() { document.getElementById(\'theform\').submit(); } 
   </SCRIPT>
</head>
<body OnLoad="OnLoadEvent();">
   <form id="theform" action="'.$_SESSION['protx_ACSURL'].'" method="POST" onsubmit="document.getElementById(\'submit_go\').disabled=true;" /> 
   <input type="hidden" name="PaReq" value="'.$_SESSION['protx_PAReq'].'" /> 
   <input type="hidden" name="TermUrl" value="'.urldecode($_GET['termurl']).'" /> 
   <input type="hidden" name="MD" value="'.$_SESSION['protx_MD'].'" /> 
   <NOSCRIPT> 
     <center>
    <p>Please click button below to Authenticate your card</p>
	<p><input type="submit" value="Go" id="submit_go" /></p>
  </center> 
   </NOSCRIPT> 
 </form>
 </body>
 </html>'; 
// unregister protx 3D-secure session variables in case process is repeated due to failure  
tep_session_unregister('protx_ACSURL');
tep_session_unregister('protx_PAReq');
tep_session_unregister('protx_MD');
}
 exit();
?>

 

 

any help would be hugely appreciated!

 

thanks for looking

Share this post


Link to post
Share on other sites

There are 2 live urls

 

 $url = 'https://live.sagepay.com/gateway/service/vspdirect-register.vsp';

 

I have this and it works fine

 

      if (MODULE_PAYMENT_PROTX_DIRECT_TRANSACTION_MODE == 'Test') {
         $url = 'https://ukvpstest.protx.com/vspgateway/service/vspdirect-register.vsp';
       } elseif (MODULE_PAYMENT_PROTX_DIRECT_TRANSACTION_MODE == 'Server IP Test') {
         $url = 'https://ukvpstest.protx.com/showpost/showpost.asp';
       } elseif (MODULE_PAYMENT_PROTX_DIRECT_TRANSACTION_MODE == 'Simulator') {
         $url = 'https://ukvpstest.protx.com/VSPSimulator/VSPDirectGateway.asp';
       } else {
       //$url = 'https://ukvps.protx.com/vspgateway/service/vspdirect-register.vsp';
       // new sagepay url
       $url = 'https://live.sagepay.com/gateway/service/vspdirect-register.vsp';
       }

 

HTH

 

G


Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Share this post


Link to post
Share on other sites

Thanks for that, Are you using PROTX Direct and the same version?

 

I dont understand why theres 2 versions of the URLS in my code?

 

Were there two in yours?

 

thanks for looking

Share this post


Link to post
Share on other sites

Yes there are 2 places in the code that have the new url.

 

You can see in the above code the original url and the replacement.

 

Have you changed it in both places as well?

 

Installing the sagepay payment module would probably be quicker than trying to debug the protx one.

 

HTH

 

G


Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Share this post


Link to post
Share on other sites

Thanks for your reply Geoffrey. I've tried to change the URL to no avail so i'm thinking i now have to add the Sagepay.

 

I've downloaded version 5.1 - would you say it was a tough upgrade to complete?

 

thanks

Share this post


Link to post
Share on other sites

No, if I remember correctly it is drop 2 files onto your site.

 

Still you have downloaded it, have a read of the install instructions and go for it.

 

G


Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Share this post


Link to post
Share on other sites

Hi again,

 

So i put 5.1 on with very little success. I could get it to go through but when in the admin panel was unable to 'authorise' orders..

 

So ive switched back to 4.4 which is OK and i've nearly cracked it but for the authorising bit!

 

I think the file i need to edit is 'orders_protx.php' which is in the admin

 

I've got this:

 

admin/orders_protx.php

 

<?php 
//
// +----------------------------------------------------------------------+
// | osCommerce, Open Source E-Commerce Solutions                         |
// +----------------------------------------------------------------------+
// | Copyright (c) 2007 Tom Hodges-Hoyland                                |
// |                                                                      |
// | Portions Copyright (c) 2003 osCommerce                               |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the GPL license,       |
// | that is bundled with this package in the file LICENSE, and is        |
// | available through the world-wide-web at the following url:           |
// | http://www.gnu.org/copyleft/gpl.html.                                |
// +----------------------------------------------------------------------+
// | orders_protx.php - v4.3                                              |
// | Released under GPL                                                   |
// | Created by Thomas Hodges-Hoyland (perfectpassion):                   |
// |                                             osc@hodges-hoyland.me.uk |
// +----------------------------------------------------------------------+
// 

if ((($_GET['process'] == 'release') || ($_GET['process'] == 'refund') || ($_GET['process'] == 'authorise') || ($_GET['process'] == 'cancel') || ($_GET['process'] == 'void') || ($_GET['process'] == 'abort') || ($_GET['process'] == 'repeat')) && ($_GET['id'] > 0)) {
include ('includes/application_top.php');



$disable_curl_ssl_check = true;    // Set to true (no quotes)
                                   // if you are having problems connecting to the protx servers



$oID = $_GET['oID'];
$transaction = tep_db_fetch_array(tep_db_query("SELECT * FROM protx_direct WHERE id='".$_GET['id']."'"));

switch ($_GET['process']) {  
case 'release':
 $data  =  'VPSProtocol=2.22' .
           '&TxType=RELEASE' .
		'&Vendor=' . MODULE_PAYMENT_PROTX_DIRECT_VENDOR_NAME . 
		'&VendorTxCode=' . $transaction['vendortxcode'] .
		'&VPSTxID=' . $transaction['vpstxid'] . 
		'&SecurityKey=' . $transaction['securitykey'] . 
		'&TxAuthNo=' . $transaction['txauthno'];
 $service = 'VendorReleaseTX';
 $tUrl = 'https://test.sagepay.com/gateway/service/release.vsp';
break;

case 'refund':
 require_once(DIR_WS_CLASSES . 'order.php');
 $order = new Order($oID);
 $uid = tep_create_random_value(32, 'digits');
 $VendorTxCode = $oID . '-'. $uid;
 $data = 'VPSProtocol=2.22' .
         '&TxType=REFUND' . 
	  '&Vendor=' . MODULE_PAYMENT_PROTX_DIRECT_VENDOR_NAME . 
	  '&VendorTxCode=' . $VendorTxCode .
	  '&Amount=' . $_GET['value'] . 
	  '&Currency=' . $order->info['currency'] .
	  '&Description=' . urlencode('Refund via osC Admin Area') .
	  '&RelatedVPSTxId=' . $transaction['vpstxid'] .
	  '&RelatedVendorTxCode=' . $transaction['vendortxcode'] .
	  '&RelatedSecurityKey=' . $transaction['securitykey'] . 
	  '&RelatedTxAuthNo=' . $transaction['txauthno'];
 $service = 'VendorRefundTX';
 $tUrl = 'https://test.sagepay.com/gateway/service/refund.vsp';

break;			

case 'authorise':
  $uid = tep_create_random_value(32, 'digits');
  $VendorTxCode = $oID . '-'. $uid;
  $data = 'VPSProtocol=2.22' .
         '&TxType=AUTHORISE' .
	  '&Vendor=' . MODULE_PAYMENT_PROTX_DIRECT_VENDOR_NAME .
	  '&VendorTxCode=' . $VendorTxCode .
	  '&Amount=' . $_GET['value'] .
	  '&Description=' . urlencode('Authorise via osC admin area') .
	  '&RelatedVPSTxId=' . $transaction['vpstxid'] .
	  '&RelatedVendorTxCode=' . $transaction['vendortxcode'] .
	  '&RelatedSecurityKey='. $transaction['securitykey'];
$service = 'VendorAuthoriseTX';
   $tUrl = 'https://test.sagepay.com/gateway/service/authorise.vsp';
 break;

 case 'cancel':
  $data = 'VPSProtocol=2.22' .
         '&TxType=CANCEL' .
	  '&Vendor=' . MODULE_PAYMENT_PROTX_DIRECT_VENDOR_NAME .
	  '&VendorTxCode=' . $transaction['vendortxcode'] .
	  '&VPSTxId=' . $transaction['vpstxid'] .
	  '&SecurityKey=' . $transaction['securitykey'];
   $service='VendorCancelTX';
   $tUrl = 'https://test.sagepay.com/gateway/service/cancel.vsp';
 break;  	  

 case 'abort':
  $data = 'VPSProtocol=2.22' .
         '&TxType=ABORT' .
	  '&Vendor=' . MODULE_PAYMENT_PROTX_DIRECT_VENDOR_NAME .
	  '&VendorTxCode=' . $transaction['vendortxcode'] .
	  '&VPSTxId=' . $transaction['vpstxid'] .
	  '&SecurityKey=' . $transaction['securitykey'] .
	  '&TxAuthNo=' . $transaction['txauthno'];
   $service='VendorAbortTX';
   $tUrl = 'https://test.sagepay.com/gateway/service/cancel.vsp';
 break; 

 case 'void':
  $data = 'VPSProtocol=2.22' .
         '&TxType=VOID' .
	  '&Vendor=' . MODULE_PAYMENT_PROTX_DIRECT_VENDOR_NAME .
	  '&VendorTxCode=' . $transaction['vendortxcode'] .
	  '&VPSTxId=' . $transaction['vpstxid'] .
	  '&SecurityKey=' . $transaction['securitykey'] .
	  '&TxAuthNo=' . $transaction['txauthno'];
   $service='VendorVoidTX';
   $tUrl = 'https://test.sagepay.com/gateway/service/void.vsp';
 break; 

case 'repeat':
 require_once(DIR_WS_CLASSES . 'order.php');
 $order = new Order($oID);
 $uid = tep_create_random_value(32, 'digits');
 $VendorTxCode = $oID . '-'. $uid;
 $data = 'VPSProtocol=2.22' .
         '&TxType=REPEAT' . 
	  '&Vendor=' . MODULE_PAYMENT_PROTX_DIRECT_VENDOR_NAME . 
	  '&VendorTxCode=' . $VendorTxCode .
	  '&Amount=' . $_GET['value'] . 
	  '&Currency=' . $order->info['currency'] .
	  '&Description=' . urlencode('Repeat via osC Admin Area') .
	  '&RelatedVPSTxId=' . $transaction['vpstxid'] .
	  '&RelatedVendorTxCode=' . $transaction['vendortxcode'] .
	  '&RelatedSecurityKey=' . $transaction['securitykey'] . 
	  '&RelatedTxAuthNo=' . $transaction['txauthno'];
   $service = 'VendorRepeatTX';
   $tUrl = 'https://test.sagepay.com/gateway/service/repeat.vsp';
break;		

}
 unset($response);

 if (MODULE_PAYMENT_PROTX_DIRECT_TRANSACTION_MODE == 'Test') {
   $url = 'https://test.sagepay.com/gateway/service/'.$service.'.vsp';
 } elseif (MODULE_PAYMENT_PROTX_DIRECT_TRANSACTION_MODE == 'Server IP Test') {
   $url = 'https://test.sagepay.com/showpost/showpost.asp';
 } elseif (MODULE_PAYMENT_PROTX_DIRECT_TRANSACTION_MODE == 'Simulator') {
   $url = 'https://test.sagepay.com/Simulator/VSPServerGateway.asp?Service='.$sim_service;
 } else {
$url = 'https://live.sagepay.com/gateway/service/'.$service.'.vsp';
 }

     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_HEADER, 0);
     curl_setopt($ch, CURLOPT_POST, $data);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

     if ($disable_curl_ssl_check === true) {
      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
      curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
     }

     $response = curl_exec($ch);

     curl_close ($ch);

     // Begin Debug Section
  if (MODULE_PAYMENT_PROTX_DIRECT_TRANSACTION_MODE == 'Server IP Test'){
       echo $response;
       echo $data;
       exit();
  }
     // End Debug Section

     // parse Protx response string
     $responses = array();
     $response_array = explode("\r\n", $response);
     for ($i=0; $i < sizeof($response_array); $i++) {
       $key = substr($response_array[$i],0, strpos($response_array[$i], '='));
       $responses[$key] = substr(strstr($response_array[$i], '='), 1);
     }

     // Begin Debug Section
  if (MODULE_PAYMENT_PROTX_DIRECT_DEBUG == 'True'){
     echo '<pre>Request URL=' . $url . "\r\n" .
       'Data string sent=' . $data . "\r\n" .
          'Protx response=' . $response . "\r\n" .
       'curl_error= ' . $curl_error . '</pre>';
       exit();
  }
     // End Debug Section

// Insert response into DB
switch ($_GET['process']) {
 case 'release':
   tep_db_query("INSERT INTO protx_direct (customer_id, order_id, vendortxcode, txtype, value, status, statusdetail, vpstxid, txauthno, securitykey, txtime) 
                 VALUES (".$transaction['customer_id'].",".$oID.",'".$transaction['vendortxcode']."','RELEASE','".$transaction['value']."','".$responses['Status']."','".addslashes(strip_tags($responses['StatusDetail']))."','".$transaction['vpstxid']."','".$transaction['txauthno']."','".$transaction['securitykey']."',CURRENT_TIMESTAMP)");
 break;

 case 'refund':
   tep_db_query("INSERT INTO protx_direct (customer_id, order_id, vendortxcode, txtype, value, status, statusdetail, vpstxid, txauthno, txtime) 
                 VALUES (".$transaction['customer_id'].",".$oID.",'".$VendorTxCode."','REFUND',".tep_db_prepare_input($_GET['value']).",'".$responses['Status']."','".addslashes(strip_tags($responses['StatusDetail']))."','".$responses['VPSTxId']."','".$responses['TxAuthNo']."',CURRENT_TIMESTAMP)");
 break;

 case 'authorise':
   tep_db_query("INSERT INTO protx_direct (customer_id, order_id, vendortxcode, txtype, value, status, statusdetail, vpstxid, txauthno, securitykey, avscv2, address_result, postcode_result, CV2_result, txtime)
              VALUES (".$transaction['customer_id'].",".$oID.",'".$VendorTxCode."','AUTHORISE',".tep_db_prepare_input($_GET['value']).",'".$responses['Status']."','".addslashes(strip_tags($responses['StatusDetail']))."','".$responses['VPSTxId']."','".$responses['TxAuthNo']."','".$responses['SecurityKey']."','".$responses['AVSCV2']."','".$responses['AddressResult']."','".$responses['PostCodeResult']."','".$responses['CV2Result']."',CURRENT_TIMESTAMP)"); 
 break;

 case 'cancel':
   tep_db_query("INSERT INTO protx_direct (customer_id, order_id, txtype, status, statusdetail, txtime)
              VALUES (".$transaction['customer_id'].",".$oID.",'CANCEL','".$responses['Status']."','".addslashes(strip_tags($responses['StatusDetail']))."',CURRENT_TIMESTAMP)");
 break;

 case 'abort':
   tep_db_query("INSERT INTO protx_direct (customer_id, order_id, txtype, status, statusdetail, txtime)
              VALUES (".$transaction['customer_id'].",".$oID.",'CANCEL','".$responses['Status']."','".addslashes(strip_tags($responses['StatusDetail']))."',CURRENT_TIMESTAMP)");
 break;

 case 'void':
   tep_db_query("INSERT INTO protx_direct (customer_id, order_id, txtype, status, statusdetail, txtime)
              VALUES (".$transaction['customer_id'].",".$oID.",'CANCEL','".$responses['Status']."','".addslashes(strip_tags($responses['StatusDetail']))."',CURRENT_TIMESTAMP)");
 break;    

 case 'repeat':
   tep_db_query("INSERT INTO protx_direct (customer_id, order_id, vendortxcode, txtype, value, status, statusdetail, vpstxid, txauthno, securitykey, txtime) 
                 VALUES (".$transaction['customer_id'].",".$oID.",'".$VendorTxCode."','REPEAT',".tep_db_prepare_input($_GET['value']).",'".$responses['Status']."','".addslashes(strip_tags($responses['StatusDetail']))."','".$responses['VPSTxId']."','".$responses['TxAuthNo']."', '".$responses['SecurityKey']."', CURRENT_TIMESTAMP)");
 break;
}

// Reload order detail page

 tep_redirect('orders.php?oID='.$oID.'&action=edit');
 exit();  


} else {
 // Nothing to do so display transactions in a table
?>

<table border="0" width="100%" cellspacing="0" cellpadding="2">
 <tr class="dataTableHeadingRow">
   <td align="center" class="dataTableHeadingContent">Time</td>
   <td align="center" class="dataTableHeadingContent">Payment Type</td>
<td align="center" class="dataTableHeadingContent">Value</td>
<td align="center" class="dataTableHeadingContent">Status</td>
<td align="center" class="dataTableHeadingContent">Status Detail</td>
<td align="center" class="dataTableHeadingContent">AVS/CV2 Check</td>
<td align="center" class="dataTableHeadingContent">Address Check</td>
<td align="center" class="dataTableHeadingContent">Postcode Check</td>
<td align="center" class="dataTableHeadingContent">CV2 Check</td>
<td align="center" class="dataTableHeadingContent">3D Secure</td>
<td align="center" class="dataTableHeadingContent">Action</td>
 </tr>
<?php
$cid = tep_db_fetch_array(tep_db_query("SELECT customers_id FROM ".TABLE_ORDERS." WHERE orders_id='".$oID."'"));
$protx_payment_data_query = tep_db_query("SELECT * FROM protx_direct WHERE order_id='" . $oID . "' AND customer_id='".$cid['customers_id']."' ORDER BY txtime");
while ($transaction = tep_db_fetch_array($protx_payment_data_query)) {  
// BOF PROTX STATUS BAR LIGHTS ====== thewrath1
// STANDARD PROTX BLOCK COMMENTED OUT
// echo '  <tr class="dataTableContent">
//  <td align="center">'.$transaction['txtime'].'</td>
//	<td align="center">'.$transaction['txtype'].' </td>
//	<td align="center">'.$transaction['value'].' </td>
//	<td align="center">'.$transaction['status'].' </td>
//	<td align="center">'.$transaction['statusdetail'].' </td>
//	<td align="center">'.$transaction['avscv2'].' </td>
//	<td align="center">'.$transaction['address_result'].' </td>	
//	<td align="center">'.$transaction['postcode_result'].' </td>
//	<td align="center">'.$transaction['CV2_result'].' </td>
//	<td align="center">'.$transaction['3DSecureStatus'].' </td>';
 echo '  <tr class="dataTableContent">';	
// txtime
  echo '<td class="dataTableContent" align="center">'.$transaction['txtime'].'</td>';
// txtype
  echo '<td class="dataTableContent" align="center">'.$transaction['txtype'].'</td>';
// value
  echo '<td class="dataTableContent" align="center">'.$transaction['value'].'</td>';
// status
if ($transaction['status'] == 'OK') {
  echo '<td class="dataTableContentGreen" align="center">'.$transaction['status'].'</td>';
} elseif (($transaction['status'] == 'NOTAUTHED') || ($transaction['status'] == 'REJECTED') || ($transaction['status'] == '3DAUTH')){
  echo '<td class="dataTableContentRed" align="center">'.$transaction['status'].'</td>';
} else {
  echo '<td class="dataTableContentYellow" align="center">'.$transaction['status'].'</td>';
}
// statusdetail
  echo '<td class="dataTableContent" align="center">'.$transaction['statusdetail'].'</td>';
// avscv2
if ($transaction['avscv2'] == 'ALL MATCH') {
  echo '<td class="dataTableContentGreen" align="center">'.$transaction['avscv2'].'</td>';
} elseif (($transaction['avscv2'] == 'NO DATA MATCHES')){
  echo '<td class="dataTableContentRed" align="center">'.$transaction['avscv2'].'</td>';
} else {
  echo '<td class="dataTableContentYellow" align="center">'.$transaction['avscv2'].'</td>';
}
// address_result
if ($transaction['address_result'] == 'MATCHED') {
  echo '<td class="dataTableContentGreen" align="center">'.$transaction['address_result'].'</td>';
} elseif (($transaction['address_result'] == 'NOTMATCHED')){
  echo '<td class="dataTableContentRed" align="center">'.$transaction['address_result'].'</td>';
} else {
  echo '<td class="dataTableContentYellow" align="center">'.$transaction['address_result'].'</td>';
}
// postcode_result
if ($transaction['postcode_result'] == 'MATCHED') {
  echo '<td class="dataTableContentGreen" align="center">'.$transaction['postcode_result'].'</td>';
} elseif (($transaction['postcode_result'] == 'NOTMATCHED')){
  echo '<td class="dataTableContentRed" align="center">'.$transaction['postcode_result'].'</td>';
} else {
  echo '<td class="dataTableContentYellow" align="center">'.$transaction['postcode_result'].'</td>';
}
// CV2_result
if ($transaction['CV2_result'] == 'MATCHED') {
  echo '<td class="dataTableContentGreen" align="center">'.$transaction['CV2_result'].'</td>';
} elseif (($transaction['CV2_result'] == 'NOTMATCHED')){
  echo '<td class="dataTableContentRed" align="center">'.$transaction['CV2_result'].'</td>';
} else {
  echo '<td class="dataTableContentYellow" align="center">'.$transaction['CV2_result'].'</td>';
}
// 3DSecureStatus
if ($transaction['3DSecureStatus'] == 'OK') {
  echo '<td class="dataTableContentGreen" align="center">'.$transaction['3DSecureStatus'].'</td>';
} elseif (($transaction['3DSecureStatus'] == 'MALFORMED') || ($transaction['3DSecureStatus'] == 'INVALID') || ($transaction['3DSecureStatus'] == 'ERROR') || ($transaction['3DSecureStatus'] == 'NOTAUTHED')){
  echo '<td class="dataTableContentRed" align="center">'.$transaction['3DSecureStatus'].'</td>';
} else {
  echo '<td class="dataTableContentYellow" align="center">'.$transaction['3DSecureStatus'].'</td>';
}
// EOF PROTX STATUS BAR LIGHTS ====== thewrath1
$tid = $transaction['id'];
if ($transaction['txtype'] == 'DEFERRED') {
 echo '<td align="center"><a href="'.tep_href_link('orders_protx.php','process=abort&id='.$tid).'&oID='.$oID.'" style="text-decoration:underline">Abort</a> / <a href="'.tep_href_link('orders_protx.php','process=release&id='.$tid).'&oID='.$oID.'" style="text-decoration:underline">Release</a></td>';
} elseif ($transaction['txtype'] == 'RELEASE') {
 echo '<td align="center"><a href="javascript:disp_prompt(\'refund\', '.$transaction['value'].','.$tid.');" style="text-decoration:underline">Refund</a> / <a href="javascript:disp_prompt(\'repeat\', '.$transaction['value'].','.$tid.');" style="text-decoration:underline">Repeat</a></td>';
} elseif ($transaction['txtype'] == 'PAYMENT') {
 echo '<td align="center"><a href="'.tep_href_link('orders_protx.php','process=void&id='.$transaction['id']).'&oID='.$oID.'" style="text-decoration:underline">Void</a> / <a href="javascript:disp_prompt(\'refund\', '.$transaction['value'].', '.$tid.');" style="text-decoration:underline">Refund</a> / <a href="javascript:disp_prompt(\'repeat\', '.$transaction['value'].','.$tid.');" style="text-decoration:underline">Repeat</a></td>';
} elseif (($transaction['txtype'] == 'AUTHENTICATE') && (($transaction['status'] == 'REGISTERED') || ($transaction['status'] == 'AUTHENTICATED'))) {  
 echo '<td align="center"><a href="javascript:disp_prompt(\'authorise\', '.$transaction['value'].','.$tid.');" style="text-decoration:underline">Authorise</a> / <a href="'.tep_href_link('orders_protx.php','process=cancel&id='.$transaction['id']).'&oID='.$oID.'" style="text-decoration:underline">Cancel</a></td>';
} elseif ($transaction['txtype'] == 'AUTHORISE') {
//  echo '<td align="center"><a href="javascript:disp_prompt(\'repeat\', '.$transaction['value'].', '.$tid.');" style="text-decoration:underline">Repeat</a></td>';
 echo '<td align="center"><a href="'.tep_href_link('orders_protx.php','process=void&id='.$transaction['id']).'&oID='.$oID.'" style="text-decoration:underline">Void</a> / <a href="javascript:disp_prompt(\'refund\', '.$transaction['value'].', '.$tid.');" style="text-decoration:underline">Refund</a> / <a href="javascript:disp_prompt(\'repeat\', '.$transaction['value'].','.$tid.');" style="text-decoration:underline">Repeat</a></td>';
} elseif ($transaction['txtype'] == 'REPEAT') {
 echo '<td align="center"><a href="javascript:disp_prompt(\'refund\', '.$transaction['value'].', '.$tid.');" style="text-decoration:underline">Refund</a></td>';
} else {
 echo '<td align="center"> </td>';
}
echo '  </tr>';
}
}
?>
</table>
<script type="text/javascript">
function disp_prompt(action, defvalue, tid)
 {
 var value=prompt("Enter value of transaction", defvalue)
 if (value!=null && value!="")
   {
   document.location.replace('orders_protx.php?process=' + action + '&id=' + tid + '&value=' + value + '&oID=' + <?php echo $oID; ?>)
   }
 }
</script>

 

 

When i log into sagepay I can see the unauthorised transaction so the other URLS are working in 'Protx_process.php' i just need to crack this now..!

 

Any thoughts anyone?

 

(quite desperate to get this sorted!)

 

thanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×