Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Need to change url's from protxy to sagepay ?


dreamer12

Recommended Posts

Hi i have received the following email from sagepay below

 

"We’ve noticed you’re still using the old Protx URLs to send transaction information details to Sage Pay. As part of our system upgrade we now need you to make a minor change to your system by starting to use the Sage Pay URLs as soon as possible".

 

I never installed the module myself it was installed by my site builders, so could some one tell me which files i need to alter / change to sagepays new url

The Sage Pay URL looks like this: https://live.sagepay.com/gateway/....

 

i have little knowledge of payment modules so any help would be great :)

Link to comment
Share on other sites

I think you can easy modify it, simply open the module file find the Protx URL and replace it with new one.

Please read this line: Do you want to find all the answers to your questions? click here. As for contribution database it's located here!

8 people out of 10 don't bother to read installation manuals. I can recommend: if you can't read the installation manual, don't bother to install any contribution yourself.

Before installing contribution or editing/updating/deleting any files, do the full backup, it will save to you & everyone here on the forum time to fix your issues.

Any issues with oscommerce, I am here to help you.

Link to comment
Share on other sites

I think you can easy modify it, simply open the module file find the Protx URL and replace it with new one.

 

Hi,

thanks for the reply this is the proxty form from INC/ MODULES (protxy_form.php) below.

 

can you take a look to see Which i need to change please ??

 

<?php
/*
 $Id$

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2004 osCommerce

 Released under the GNU General Public License
*/

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

// class constructor
   function protx_form() {
     global $order;
     $this->code = 'protx_form';
     $this->title = MODULE_PAYMENT_PROTX_FORM_TEXT_TITLE;
     $this->description = MODULE_PAYMENT_PROTX_FORM_TEXT_DESCRIPTION;
     $this->sort_order = MODULE_PAYMENT_PROTX_FORM_SORT_ORDER;
     $this->enabled = ((MODULE_PAYMENT_PROTX_FORM_STATUS == 'True') ? true : false);

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

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

     if (MODULE_PAYMENT_PROTX_FORM_TEST_STATUS == 'true') {
       $this->form_action_url = 'https://ukvpstest.protx.com/vspgateway/service/vspform-register.vsp';
	//$this->form_action_url = 'https://ukvpstest.protx.com/showpost/showpost.asp';
	//$this->form_action_url = 'https://ukvpstest.protx.com/VSPSimulator/VSPFormGateway.asp';
       //$this->form_action_url = '../../decrypt_protx.php';

     } else {
       $this->form_action_url = 'https://ukvps.protx.com/vspgateway/service/vspform-register.vsp ';
     }
   }

// class methods
   function update_status() {
     global $order;

     if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_PROTX_FORM_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_FORM_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() {
     return false;
   }

   function simpleXor($InString, $Key) {
     $KeyList = array();
     $output = "";

     for($i = 0; $i < strlen($Key); $i++){
       $KeyList[$i] = ord(substr($Key, $i, 1));
     }

     for($i = 0; $i < strlen($InString); $i++) {
       $output.= chr(ord(substr($InString, $i, 1)) ^ ($KeyList[$i % strlen($Key)]));
     }

     return $output;
   }

   function getToken($thisString) {

     $Tokens = array("Status","StatusDetail","VendorTxCode","VPSTxID","TxAuthNo","Amount","AVSCV2");

     $output = array();
     $resultArray = array();

     for ($i = count($Tokens)-1; $i >= 0 ; $i--){
       $start = strpos($thisString, $Tokens[$i]);
       if ($start !== false){
         $resultArray[$i]->start = $start;
         $resultArray[$i]->token = $Tokens[$i];
       }
     }

     sort($resultArray);

     for ($i = 0; $i<count($resultArray); $i++){
       $valueStart = $resultArray[$i]->start + strlen($resultArray[$i]->token) + 1;
       if ($i==(count($resultArray)-1)) {
         $output[$resultArray[$i]->token] = substr($thisString, $valueStart);
       } else {
         $valueLength = $resultArray[$i+1]->start - $resultArray[$i]->start - strlen($resultArray[$i]->token) - 2;
         $output[$resultArray[$i]->token] = substr($thisString, $valueStart, $valueLength);
       }
     }

     return $output;
   }

   function selection() {
     return array('id' => $this->code,
                  'module' => $this->title);
   }

   function pre_confirmation_check() {
     return false;
   }

   function confirmation() {
     return false;
   }

   function process_button() {
     global $order, $currencies, $currency, $customer_id;

     switch (MODULE_PAYMENT_PROTX_FORM_CURRENCY) {
       case 'Default Currency':
         $protx_currency = DEFAULT_CURRENCY;
         break;
       case 'Any Currency':
       default:
         $protx_currency = $currency;
         break;
     }

     $plain = "VendorTxCode=" . MODULE_PAYMENT_PROTX_FORM_VENDOR_NAME . date('YmdHis') . $customer_id . "&";
     $plain .= "Amount=" . number_format($order->info['total'] * $currencies->get_value($protx_currency), $currencies->get_decimal_places($protx_currency), '.', '') . "&";
     $plain .= "Currency=" . $protx_currency . "&";
  $plain .= "Description=" . "Goods bought from " . STORE_NAME . "&";
     $plain .= "SuccessURL=" . tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL', true) . "&";
     $plain .= "FailureURL=" . tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL', true) . "&";
     $plain .= "CustomerName=" . $order->billing['firstname'] . ' ' . $order->billing['lastname'] . "&";
     $plain .= "CustomerEmail=" . $order->customer['email_address'] . "&";
     $plain .= "VendorEMail=" . STORE_OWNER_EMAIL_ADDRESS . "&";

     $delivery_address = $order->delivery['street_address'];
     if (ACCOUNT_SUBURB == 'true') {
       $delivery_address .= ',' . $order->delivery['suburb'];
     }

     $delivery_address .= ',' . $order->delivery['city'];

     if (ACCOUNT_STATE == 'true') {
       $delivery_address .= ',' . $order->delivery['state'];
     }

     $delivery_address .= ',' . $order->delivery['country']['title'];

     $billing_address = $order->billing['street_address'];

     if (ACCOUNT_SUBURB == 'true') {
       $billing_address .= ',' . $order->billing['suburb'];
     }

     $billing_address .= ',' . $order->billing['city'];

     if (ACCOUNT_STATE == 'true') {
       $billing_address .= ',' . $order->billing['state'];
     }

     $billing_address .= ',' . $order->billing['country']['title'];

     $plain .= "DeliveryAddress=" . $delivery_address . "&";
     $plain .= "DeliveryPostCode=" . $order->delivery['postcode'] . "&";
     $plain .= "BillingAddress=" . $billing_address . "&";
     $plain .= "BillingPostCode=" . $order->billing['postcode'] . "";

if (MODULE_PAYMENT_PROTX_FORM_SHOPCART == 'true') {
	$plain .= "&";
	global $cart, $order;
	$Shipping = $order->info['shipping_cost'];
	$Shipping = number_format($Shipping, 2, '.', '');
		$products = $cart->get_products();
	$No_lines = sizeof($products);
	$No_lines = $No_lines + 1;  // Don't forget the shipping as an item!
	$cart_string = "Basket=".$No_lines;
   	for ($i=0, $n=sizeof($products); $i<$n; $i++) {
  				$Description = $products[$i]['name'];
			$Description  = str_replace(":", "", $Description);
			$Qty = $products[$i]['quantity'];
			$Price = $products[$i]['price'] + $cart->attributes_price($products[$i]['id']);
			$Tax = $Price/100 * tep_get_tax_rate($products[$i]['tax_class_id']);
			$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;
	$cart_string = str_replace("\n", "", $cart_string);
	$cart_string = str_replace("\r", "", $cart_string);
	$plain .= $cart_string;

}

     $crypt = base64_encode($this->SimpleXor($plain, MODULE_PAYMENT_PROTX_FORM_PASSWORD));

   if (MODULE_PAYMENT_PROTX_FORM_PREAUTH == 'true') {
       $transaction_type = 'AUTHENTICATE';
   } else {
       $transaction_type = 'PAYMENT';
   }

     $process_button_string = tep_draw_hidden_field('VPSProtocol', '2.22') .
                              tep_draw_hidden_field('TxType', $transaction_type) .
                              tep_draw_hidden_field('Vendor', MODULE_PAYMENT_PROTX_FORM_VENDOR_NAME) .
                              tep_draw_hidden_field('crypt', $crypt);

     return $process_button_string;
   }


   function before_process() {
     global $HTTP_GET_VARS, $crypt;
     $crypt = $_REQUEST['crypt'];
     $process_button_string = str_replace(" ", "+", $process_button_string);
     $Decoded = $this->SimpleXor(base64_decode(str_replace(" ", "+", $crypt)),MODULE_PAYMENT_PROTX_FORM_PASSWORD);
     $values = $this->getToken($Decoded);

     $StatusDetail = $values['StatusDetail'];

     switch ($values['Status']) { 
       case "OK":
       case "AUTHENTICATED":
       case "REGISTERED":
         $Status = true;
       break;

       default:
         $Status = false;
       break;
     }

     if ($Status !== true) {
       $sessionName = tep_session_name();
       $sessionId = $HTTP_GET_VARS[$sessionName];
       $hrefLink = tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode($StatusDetail), 'SSL', true, false);
       tep_redirect( $hrefLink );
     }
   }

   function after_process() {
     return false;
   }

   function get_error() {
     global $HTTP_GET_VARS;

     if (isset($HTTP_GET_VARS['message']) && (strlen($HTTP_GET_VARS['message']) > 0)) {
       $error = stripslashes(urldecode($HTTP_GET_VARS['message']));
     } else {
       $error = MODULE_PAYMENT_PROTX_FORM_TEXT_ERROR_MESSAGE;
     }

     return array('title' => MODULE_PAYMENT_PROTX_FORM_TEXT_ERROR,
                  'error' => $error);
   }

   function check() {
     if (!isset($this->_check)) {
       $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_PROTX_FORM_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 Form Module', 'MODULE_PAYMENT_PROTX_FORM_STATUS', 'True', 'Do you want to accept Protx Form payments?', '6', '1', '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 ('Merchant ID', 'MODULE_PAYMENT_PROTX_FORM_VENDOR_NAME', 'TestVendor', 'Vendor Name to use with the Protx Form service', '6', '2', now())");
     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Password', 'MODULE_PAYMENT_PROTX_FORM_PASSWORD', 'testvendor', 'Password to use with the Protx Form service', '6', '2', 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 Currency', 'MODULE_PAYMENT_PROTX_FORM_CURRENCY', 'Any Currency', 'The currency to use for credit card transactions', '6', '3', 'tep_cfg_select_option(array(\'Any Currency\', \'Default Currency\'), ', 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_FORM_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_FORM_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, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_PROTX_FORM_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())");
     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 ('Test Mode', 'MODULE_PAYMENT_PROTX_FORM_TEST_STATUS', 'true', 'Use Test Mode?', '6', '4', '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 ('Use Pre-Authorisation', 'MODULE_PAYMENT_PROTX_FORM_PREAUTH', 'true', 'Use Pre-Authorisation for all transactions?', '6', '5', '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 ('Shopping cart', 'MODULE_PAYMENT_PROTX_FORM_SHOPCART', 'true', 'Send shopping cart details to Protx?', '6', '6', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now())");
   }

   function remove() {
     $keys = '';
     $keys_array = $this->keys();
     for ($i=0; $i<sizeof($keys_array); $i++) {
       $keys .= "'" . $keys_array[$i] . "',";
     }
     $keys = substr($keys, 0, -1);

     tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in (" . $keys . ")");
   }

   function keys() {
    return array('MODULE_PAYMENT_PROTX_FORM_STATUS', 'MODULE_PAYMENT_PROTX_FORM_VENDOR_NAME', 'MODULE_PAYMENT_PROTX_FORM_PASSWORD', 'MODULE_PAYMENT_PROTX_FORM_CURRENCY', 'MODULE_PAYMENT_PROTX_FORM_ZONE', 'MODULE_PAYMENT_PROTX_FORM_ORDER_STATUS_ID', 'MODULE_PAYMENT_PROTX_FORM_SORT_ORDER', 'MODULE_PAYMENT_PROTX_FORM_TEST_STATUS', 'MODULE_PAYMENT_PROTX_FORM_PREAUTH', 'MODULE_PAYMENT_PROTX_FORM_SHOPCART');
   }
 }
?>

Link to comment
Share on other sites

if (MODULE_PAYMENT_PROTX_FORM_TEST_STATUS == 'true') {
       $this->form_action_url = 'https://ukvpstest.protx.com/vspgateway/service/vspform-register.vsp';
               //$this->form_action_url = 'https://ukvpstest.protx.com/showpost/showpost.asp';
               //$this->form_action_url = 'https://ukvpstest.protx.com/VSPSimulator/VSPFormGateway.asp';
       //$this->form_action_url = '../../decrypt_protx.php';

     } else {
       $this->form_action_url = 'https://ukvps.protx.com/vspgateway/service/vspform-register.vsp';
     }

 

The URLs that are in green.

 

Hi thanks for your reply, i have change the following to the links below : Does this look right to you..

 

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

     if (MODULE_PAYMENT_PROTX_FORM_TEST_STATUS == 'true') {
       $this->form_action_url = 'https://test.sagepay.com/gateway/service/vspform-register.vsp';
	//$this->form_action_url = 'https://ukvpstest.protx.com/showpost/showpost.asp';
	//$this->form_action_url = 'https://ukvpstest.protx.com/VSPSimulator/VSPFormGateway.asp';
       //$this->form_action_url = '../../decrypt_protx.php';

     } else {
       $this->form_action_url = 'https://live.sagepay.com/gateway/service/vspform-register.vsp ';
     }
   }

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...