Zen Cart Logo
Forums / Addon Payment Modules / Protx Form for 1.2.7 - not pulling Delivery details for 1.3.7

Protx Form for 1.2.7 - not pulling Delivery details for 1.3.7

Locked

Views: 1,885

Results 1 to 10 of 10
This thread is locked. New replies are disabled.
6 May 2007, 7:11 PM
#1
scrat avatar

scrat

Zen Follower

Join Date:
Dec 2005
Posts:
451
Plugin Contributions:
0

Protx Form for 1.2.7 - not pulling Delivery details for 1.3.7

I am trying to fix the Protx Form for 1.2.7 to work on 1.3.7

From my testing the Delivery address, postcode fields are not being pulled from the $order string, I have looked at the other payment modules and they are still using the same field names.

But yet all the other fields and working fine eg billing.
I don't know what has changed in the checkout process from 1.2.7 to 1.3.7, Any advice would be appreciated or pointers in the right direction.

<?php
//
// +----------------------------------------------------------------------+
// |zen-cart Open Source E-commerce                                       |
// +----------------------------------------------------------------------+
// | Copyright (c) 2003 The zen-cart developers                           |
// |                                                                      |
// | http://www.zen-cart.com/index.php                                    |
// |                                                                      |
// | 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.zen-cart.com/license/2_0.txt.                             |
// | If you did not receive a copy of the zen-cart license and are unable |
// | to obtain it through the world-wide-web, please send a note to       |
// | [email protected] so we can mail you a copy immediately.          |
// +----------------------------------------------------------------------+
// $Id: protx_form.php,v 1.1 2004/08/11 20:45:00 networkdad Exp $
//

  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->enabled = ((MODULE_PAYMENT_PROTX_FORM_STATUS == 'True') ? true : false);
      $this->sort_order = MODULE_PAYMENT_PROTX_FORM_SORT_ORDER;

      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/vps2form/submit.asp';
      } else {
        $this->form_action_url = 'https://ukvps.protx.com/vps2form/submit.asp';
      }
    }

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

      if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_PROTX_FORM_ZONE > 0) ) {
        $check_flag = false;
        $check = $db->Execute("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->EOF) {
          if ($check->fields['zone_id'] < 1) {
            $check_flag = true;
            break;
          } elseif ($check->fields['zone_id'] == $order->billing['zone_id']) {
            $check_flag = true;
            break;
          }
          $check->MoveNext();
        }

        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;

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

      $plain = "VendorTxCode=" . date('Ymdhis') . "&";
      $plain .= "Amount=" . number_format($order->info['total'] * $currencies->get_value($protx_currency), 

$currencies->get_decimal_places($protx_currency)) . "&";
      $plain .= "Currency=" . $protx_currency . "&";
      $plain .= "Description='' &";
      $plain .= "SuccessURL=" . zen_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL', true) . "&";
      $plain .= "FailureURL=" . zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL', true) . "&";
      $plain .= "CustomerName=" . $order->billing['firstname'] . ' ' . $order->billing['lastname'] . "&";
      $plain .= "CustomerEmail=" . $order->customer['email_address'] . "&";
      $plain .= "VendorEMail=" . STORE_OWNER_EMAIL_ADDRESS . "& \n";
//    $plain .= "eMailMessage=''&";
      $plain .= "DeliveryAddress=" . $order->delivery['street_address']. "\n" .
                                     $order->delivery['suburb'] . "\n" .
                                     $order->delivery['city'] . "\n" .
                                     $order->delivery['state'] . "\n" .
                                     $order->delivery['country']['title'] . "&";
      $plain .= "DeliveryPostCode=" . $order->delivery['postcode'] . "&";
      $plain .= "BillingAddress=" . $order->billing['street_address'] . "\n" .
                                    $order->billing['suburb'] . "\n" .
                                    $order->billing['city'] . "\n" .
                                    $order->billing['state'] . "\n" .
                                    $order->billing['country']['title'] ."&";
      $plain .= "BillingPostCode=" . $order->billing['postcode'] . "&";


      

      $plain .= "ContactNumber=" . $order->customer['telephone'] . "&";
      $plain .= "ContactFax=" . $order->customer['telephone'] . "&";
      $plain .= "AllowGiftAid='0'&";
      $plain .= "ApplyAVSCV2='0'&";
      $plain .= "Apply3DSecure='0'&";

// For Testing to print file format to txt file
      $file_loco = "protx.txt";
      $file_handle = fopen($file_loco,'w');
      fwrite($file_handle,$plain);
      fclose($file_handle);
// eof testing      
  

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


    

//// PA Evers Added for Pre-Authorisation selection
    if (MODULE_PAYMENT_PROTX_FORM_PREAUTH == 'true') {
        $transaction_type = 'PREAUTH';
    } else {
        $transaction_type = 'PAYMENT';
    }
//// EOF: PA Evers Added for Pre-Authorisation selection

      $process_button_string = zen_draw_hidden_field('VPSProtocol', '2.22') .
//                             zen_draw_hidden_field('TxType', 'PAYMENT') . // CHANGED FOR PRE-AUTH BELOW
                               zen_draw_hidden_field('TxType', $transaction_type) .
                               zen_draw_hidden_field('Vendor', MODULE_PAYMENT_PROTX_FORM_VENDOR_NAME) .
                               zen_draw_hidden_field('Crypt', $crypt);

      return $process_button_string;
    }

    function before_process() {
      global $_POST, $crypt;
if (is_null($crypt)) {
   $crypt = $_GET['crypt'];
  }
      $Decoded = $this->SimpleXor(base64_decode($crypt),MODULE_PAYMENT_PROTX_FORM_PASSWORD);
      $values = $this->getToken($Decoded);

      $Status = $values['Status'];
      $StatusDetail = $values['StatusDetail'];

      if ($Status != 'OK') {
        zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, zen_session_name() . '=' . $_POST[zen_session_name()] . 

'&error_message=' . urlencode($StatusDetail), 'SSL', false, false));
      }
    }

    function after_process() {
      return false;
    }

    function get_error() {
      global $_GET;

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

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

    function check() {
    global $db;
      if (!isset($this->_check)) {
        $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 

'MODULE_PAYMENT_PROTX_FORM_STATUS'");
        $this->_check = $check_query->RecordCount();
      }
      return $this->_check;
    }

    function install() {
    global $db;
      $db->Execute("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', 

'zen_cfg_select_option(array(\'True\', \'False\'), ', now())");
      $db->Execute("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())");
      $db->Execute("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())");
      $db->Execute("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_FORM_TEST_STATUS', 'true', 'Use Test Mode?', '6', '4', 'zen_cfg_select_option(array(\'true\', 

\'false\'), ', now())");
      $db->Execute("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', 

'zen_cfg_select_option(array(\'true\', \'false\'), ', now())");
      $db->Execute("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', 

'zen_cfg_select_option(array(\'Any Currency\', \'Default Currency\'), ', now())");
      $db->Execute("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())");
      $db->Execute("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', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', now())");
      $db->Execute("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', 'zen_cfg_pull_down_order_statuses(', 'zen_get_order_status_name', now())");
    }

    function remove() {
    global $db;
      $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->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_TEST_STATUS', 'MODULE_PAYMENT_PROTX_FORM_PREAUTH', 

'MODULE_PAYMENT_PROTX_FORM_CURRENCY', 'MODULE_PAYMENT_PROTX_FORM_SORT_ORDER', 'MODULE_PAYMENT_PROTX_FORM_ZONE', 

'MODULE_PAYMENT_PROTX_FORM_ORDER_STATUS_ID');
    }
  }
?>

File output to Protx before encryption

VendorTxCode=20070506080217&Amount=109.82&Currency=GBP&Description=''
&SuccessURL=http://localhost/zen-cart-v1.3.7-full-fileset-12302006/index.php?main_page=checkout_process
&FailureURL=http://localhost/zen-cart-v1.3.7-full-fileset-12302006/index.php?main_page=checkout_payment&
CustomerName=jjj kkk&CustomerEmail=[email protected]&VendorEMail=[email protected]&
DeliveryAddress=

&DeliveryPostCode=&BillingAddress=100 high street

town
county
United Kingdom&BillingPostCode=dn1 5pu&ContactNumber=0123456789&ContactFax=0123456789
&AllowGiftAid='0'&ApplyAVSCV2='0'&Apply3DSecure='0'&

7 May 2007, 12:19 AM
#2
ryk avatar

ryk

Totally Zenned

Join Date:
Oct 2004
Location:
Southport, UK
Posts:
3,644
Plugin Contributions:
6

Re: Protx Form for 1.2.7 - not pulling Delivery details for 1.3.7

You can do it the hard way....or go and get the version for 1.3.x from http://dev.ceon.net/web/zen-cart/protx_form/

7 May 2007, 8:44 PM
#3
scrat avatar

scrat

Zen Follower

Join Date:
Dec 2005
Posts:
451
Plugin Contributions:
0

Re: Protx Form for 1.2.7 - not pulling Delivery details for 1.3.7

I was wanting to have a go myself,
As I look into this the Authorizenet module is very similar to the protx, so I will look closer into that to see how that functions. Any pointers would be helpful. Thanks

6 Jun 2007, 12:35 PM
#4
hairydog avatar

hairydog

Zen Follower

Join Date:
Sep 2006
Posts:
165
Plugin Contributions:
0

Re: Protx Form for 1.2.7 - not pulling Delivery details for 1.3.7

Ryk:

You can do it the hard way....or go and get the version for 1.3.x from http://dev.ceon.net/web/zen-cart/protx_form/

I can't find anywhere to download it from there. Yes, it talks about the 1.3.x version, and mentions there will be a v2.0 costing $50 but there seems to be no download link for the free version or any information about the paid-for version either!

Is there somewhere else I should look?

8 Jun 2007, 9:30 PM
#5
conor avatar

conor

Passed

Join Date:
Aug 2004
Location:
Belfast, Northern Ireland
Posts:
2,480
Plugin Contributions:
4

Re: Protx Form for 1.2.7 - not pulling Delivery details for 1.3.7

Hi,

hairydog:

I can't find anywhere to download it from there. Yes, it talks about the 1.3.x version, and mentions there will be a v2.0 costing $50 but there seems to be no download link for the free version or any information about the paid-for version either!

Protx Form will be re-released under a commercial license on Monday, but you can use the much better Protx Direct if you like... we highly recommend it over Protx Form as it keeps customers on your site and therefore lets your store look every bit as good as the "big ones"... You can get a free version to try out here...

http://dev.ceon.net/web/zen-cart/protx_direct/

Anyone who is paying Protx for the Protx Form service is also paying for the Protx Direct service... the only difference is the way they work.

Hope that helps!

All the best...

Conor

8 Jun 2007, 10:24 PM
#6
hairydog avatar

hairydog

Zen Follower

Join Date:
Sep 2006
Posts:
165
Plugin Contributions:
0

Re: Protx Form for 1.2.7 - not pulling Delivery details for 1.3.7

So it's a choice between paying for the Form version or getting a free Direct version that doesn't support 3D Secure?

Not a great pair of alternatives. Why have you pulled to old free version of Forms?

I don't think that Forms looks any less professional, as long as you customise the templates, but there is the odd transaction (around 0.1%, it seems) where the result doesn't get passed back. That's the reason for using Direct.

10 Jun 2007, 10:20 AM
#7
conor avatar

conor

Passed

Join Date:
Aug 2004
Location:
Belfast, Northern Ireland
Posts:
2,480
Plugin Contributions:
4

Re: Protx Form for 1.2.7 - not pulling Delivery details for 1.3.7

Hi,

hairydog:

So it's a choice between paying for the Form version or getting a free Direct version that doesn't support 3D Secure?

Obviously we don't see it that way, but see it as being a choice between getting a free version of Protx Direct or paying for a version of Protx Direct or Protx Form which is fully supported and up to date.

hairydog:

Not a great pair of alternatives. Why have you pulled to old free version of Forms?

Possibly because three full weeks of development work is a lot to put in to then go ahead and keep a module supported for free? :)

By charging for the modules we are able to support them. Without charging Protx Direct and Protx Form simply couldn't exist, it would be too much work, especially given the number of changes that have had to be made this year, to keep them up to date and compliant with the changing payment scenarios that are occurring.

hairydog:

I don't think that Forms looks any less professional, as long as you customise the templates, but there is the odd transaction (around 0.1%, it seems) where the result doesn't get passed back. That's the reason for using Direct.

You say 0.1% but unfortunately our experience doesn't represent that. If you are going to pay the amount of money it costs to have a merchant account and a protx account we honestly think it's so much better to use Protx Direct that we have deliberately set it to cost less than Protx Form.

It does mean that you have to have a SSL certificate, but it means that customers don't have to leave your site to go to an external payment gateway.

In our experience, not least with a client running a site that turns over 100s of thousands of pounds, keeping the customer on your site within the checkout process stops them from getting cold feet and leaving at the "last hurdle".

Although you and I may be happy and confident enough to shop online, many are still wary and a small thing like being redirected to an external site, which doesn't look the same as the rest of the checkout, can be enough to have them get cold feet and stop their progression through the checkout process. For that reason alone we recommend using Protx Direct over Protx Form.

Protx Direct takes a lot more to develop for but we are charging less for it because we want to encourage Zen Cart users to take the more professional approach and keep their sales volumes up. Admittedly it's a bizarre way to price things, but the motivation behind these modules was never to create a product, but to help the Zen Cart community out and in a strange way, providing the more complicated, but better, module for a lower price does encourage people to use the better option and, in the end, benefits all.

Anyway... :cool:

All the best..

Conor

10 Jun 2007, 4:08 PM
#8
javier avatar

javier

New Zenner

Join Date:
Jun 2007
Posts:
79
Plugin Contributions:
0

Re: Protx Form for 1.2.7 - not pulling Delivery details for 1.3.7

conor:

Hi,

Obviously we don't see it that way, but see it as being a choice between getting a free version of Protx Direct or paying for a version of Protx Direct or Protx Form which is fully supported and up to date.

You say 0.1% but unfortunately our experience doesn't represent that. If you are going to pay the amount of money it costs to have a merchant account and a protx account we honestly think it's so much better to use Protx Direct that we have deliberately set it to cost less than Protx Form.

It does mean that you have to have a SSL certificate, but it means that customers don't have to leave your site to go to an external payment gateway.

Please excuse the ignorance as I am just starting to look at this for a relative that wants to sell online. IIRC Protx imply that using using the external gateway increases security as it is all done on their secure servers, whereas any other way keeping the process on the sellers site places all security onus on them. In your experience, how many folk back off once being redirected to Protx's secure servers for payment (as opposed to those who just go so far to see e.g. what final total cost would be) ?

BTW - is it possible to get hold of the old, free, version of Protx Form purely for test purposes - I have no problem with paying for the commercial product if we decide that is the way for us (and we'd need to for 3D).

Best regards.

29 Jun 2007, 10:46 PM
#9
mikeyg avatar

mikeyg

Totally Zenned

Join Date:
May 2005
Posts:
515
Plugin Contributions:
0

Re: Protx Form for 1.2.7 - not pulling Delivery details for 1.3.7

Conor

I am a very small business still in start up mode and disappointed to see you start charging for this form.

I do not have the IT systems , knowledge or expertise to make sure the security is there using the direct system and therefore rely on the knowledge expertise and security that protx provide with using the form approach. It is now 30th June and I have to get my site up and running with 3D secure to make sure I can take payment from my customers.

I have chosen to use opensource software for a number of reasons and now my business is being held to ransom because the open source is no longer open source.

I am disappointed with your decision.

30 Jun 2007, 10:31 AM
#10
conor avatar

conor

Passed

Join Date:
Aug 2004
Location:
Belfast, Northern Ireland
Posts:
2,480
Plugin Contributions:
4

Re: Protx Form for 1.2.7 - not pulling Delivery details for 1.3.7

Hi,

MikeyG:

I am disappointed with your decision.

I'm very sorry that you feel that way but Protx isn't a solution used by very small businesses as you are paying both Merchant Account and Payment Gateway fees so you should possibly look at using worldpay, paypal or google checkout instead.

In no way are you being held to "ransom", the very idea is almost comical! You can use any of the above payment methods or you can download protx's integration kit and make the necessary updates yourself.

All the best...

Conor