Contributions
Protx Form Payment Module
This is a payment module for the protx form system.
This module will work only for CVS versions after the 01 November 2002.
Expand All / Collapse All
Correction for case sensitivity in decrypt_protx.php line 88, so that the submitted data is correctly deciphered for debugging purposes only.
Corrected an extra .= that somehow accidentally got added.
DO NOT USE v1.18, it will not allow more than one product to be purchased.
protx_form-v1.18
Adjusted the handling of adding items to the Basket variable so as to restrict
its size to 7495 characters. Protx v2.22 states maximum size of this field is
7500 characters.
Fixed issue with before_process() not returning the $Status variable.
Consumed the change suggested by vitaliy on Aug 7, 2007.
This fix for correct redirection with 'failure' status from 'checkout_process' to 'checkout_payment'.
protx_form-v1.17 - Added AUTHENTICATE AND AUTHORISE return code to replace PREAUTH also removed previous comment marks.
Please see osCommerce forum thread for details of code changes
http://forums.oscommerce.com/index.php?showtopic=272122
If it needs fixed, well.....ehhhmmmm?
Always backup before installing
protx_form-V1.16 - Change to VendorTxCode to produce extra uniqueness
*all suggestions courtesy of theINtoy*
The changes to the code here are minor, but to take care of any issues on non-uniqueness
1. The store name is now taken from the PROTX form as this has to be unique
(oscommerce stores have the potential to be named the same)
2. The customers ID has been added to the end of this string,so that it will reduce the potential
for 2 seperate customers buying something at EXACTLY the same second.
Now their ID added will make the extra difference required
Line 130 - added $customer_id to the global line to fetch it.
Changed global $order, $currencies, $currency;
to global $order, $currencies, $currency, $customer_id;
Line 142 - changed the STORE_NAME reference to be the same as PROTX STORE NAME, added $customer_id after the date/time
this will keep the references in order still as it is only the customers ID at the end for uniqueness.
Changed $plain = "VendorTxCode=" . STORE_NAME . date('YmdHis') . "&";
to $plain = "VendorTxCode=" . MODULE_PAYMENT_PROTX_FORM_VENDOR_NAME . date('YmdHis') . $customer_id . "&";
NOTE: You could change this to include some kind of dividers between each part of the reference
seperating "store name_datetime_customerid"
e.g. $plain = "VendorTxCode=" . MODULE_PAYMENT_PROTX_FORM_VENDOR_NAME ."_" . date('YmdHis') . "_" . $customer_id . "&";
protx_form-V1.15 - Fix for VendorTxCode to add store name automatically
Changed the VendorTxCode so that it now adds your store name to the VendorTxCode automatically
to make your code unique as suggested by theINtoy.
Line 142
Changed $plain = "VendorTxCode=" . date('YmdHis') . "&";
to $plain = "VendorTxCode=" . STORE_NAME . date('YmdHis') . "&";
01 Aug 2007
------------
protx_form-V1.14 - Fix for VendorTxCode
Changed the VendorTxCode so that it now uses a 24 hour clock for the hours.
Changed $plain = "VendorTxCode=" . date('Ymdhis') . "&";
to $plain = "VendorTxCode=" . date('YmdHis') . "&";
NB. I personally believe that the VendoTxCode should have a unique identifier
either prepended or appended to this date to make it unique in the protx
system. As things stand the VendorTxCode has a chance of not being unique in
within Protx if 2 protx clients attempt to submit at the same second. This
could happen.
** Big credit goes to sofaking who has brought this submission on over the past few weeks...
Line 17 global $order added
Line 31-39 were changed to NEW URL's also added a line to include a reference to the OLD URLs
Line 31-39 used to be
if (MODULE_PAYMENT_PROTX_FORM_TEST_STATUS == 'true') {
$this->form_action_url = 'https://ukvpstest.protx.com/vps2form/submit.asp';
//$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/vps2form/submit.asp';
}
}
Line 31-42 now is
if (MODULE_PAYMENT_PROTX_FORM_TEST_STATUS == 'true') {
$this->form_action_url = 'https://ukvpstest.protx.com/vspgateway/service/vspform-register.vsp';
//old LIVE URL was https://ukvpstest.protx.com/vps2form/submit.asp
//$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 ';
//old LIVE URL was https://ukvps.protx.com/vps2form/submit.asp
}
}
25 July 2007
------------
protx_form-v1.12 Fixed 'C' and 'c' problem as Protx Servers have been corrected.
On the LIVE and TEST servers they should now be small 'c' in the CRYPT lines.
Lines 230 and 239 changed back from previous update.
Please NOTE that the url for submiting the forms to will be changed as of 1st Aug.
I will change and post this update when it occurs.
15 July 2007
------------
protx_form-v1.0.11 Fixed Crypt Error, Removed previous Vendor's Tx Code, Removed invalid Test Card info
Please Read ChangeLog.txt for full details of changes.
* this update includes the previous fixes detailed below - I felt this deserved a new version number hence the protx_form-v1.0.11
protx_form-v1.0.10 Fixed Description for Module
* Fixed formatting of module on Admin section and on Customer Payment Section.
Changed line 20 from
$this->description = MODULE_PAYMENT_PROTX_FORM_TEXT_PICTURE;
to
$this->description = MODULE_PAYMENT_PROTX_FORM_TEXT_DESCRIPTION;
* Fix for final order totals that are greater than £999.99.
* Fix removes "," seperator from ie. £1,872.32 -----> £1872.32 (removing it in osAdmin is not enough)
Line 139 altered from
$plain .= "Amount=" . number_format($order->info['total'] * $currencies->get_value($protx_currency), $currencies->get_decimal_places($protx_currency)) . "&";
to
$plain .= "Amount=" . number_format($order->info['total'] * $currencies->get_value($protx_currency), $currencies->get_decimal_places($protx_currency), '.', '') . "&";
As per usual - always back up
Hi.
When testing this submission I discovered that the redirect back from Protx when the user hit Cancel failed.
The reason turned out to be the use of HTTP_POST_VARS as the redirect back from Protx is a GET.
Simply replace the function before_process with this:
----8<---------------
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);
$Status = $values['Status'];
$StatusDetail = $values['StatusDetail'];
if ($Status != 'OK')
{
// CWS Fix start
$sessionName = tep_session_name();
$sessionId = $HTTP_GET_VARS[$sessionName];
$hrefLink = tep_href_link(FILENAME_CHECKOUT_PAYMENT, tep_session_name() . '=' . $sessionId . '&error_message=' . urlencode($StatusDetail), 'SSL', false, false);
tep_redirect( $hrefLink );
// CWS fix end
}
}
---8<------------------------
I have also included an enhancement I need when testing live to the decrypt_protx.php script to allow the decrypt to be logged in a file rather than shown on the browser.
04 January 2007
-----------------
protx_form-V1.0.9 Intermediate
The following version contains all the following intermediate updates:
Fix for success redirect error - 2 - 26 Dec 2006
Miss VAT on selected options - 27 Jul 2006
Protx redirect to checkout_process.php problem - 11 May 2006
Fix for success redirect error - 08 Nov 2005
It should save people the time making the changes
It is not my code. There is one line missing at "Fix for success redirect error "
I just added that line.
So i call this contribition "Fix for success redirect error -2"
I hope it helps
If you are selling 1GB and 2GB version of a MP3 player on the same page, and the customer ordered the 2GB option instead of the defaulted 1GB version. When protx send the customer a payment receipt, the order details will only show the VAT amount of 1GB version instead of the selected 2GB version although the total paid is still correct.
To sort this problem, simply change the tax calculation at ~ line 196:
$Tax = $products[$i]['price'] /100 * tep_get_tax_rate($products[$i]['tax_class_id']);
to:
$Tax = $Price/100 * tep_get_tax_rate($products[$i]['tax_class_id']);
and the customer's receipt will show the correct VAT.
Please note this is not the total package, it is just the core protx_form.php file under catalog/includes/modules/payment
Your order something in your shop, you enter payment details, but when you click proceed, the payment is taken, but the customer is not shown the "checkout_process.php" page which confirms the success of the transaction. The reason for this is that the path of your own OS commerce success page is not transferred properly to the Protx payment page.
The only thing that's transferred together with customer id, payment amount etc. is the filename "checkout_process.php" and not the full path
such as http://www.mysite.com/shop/checkout_process.php - which is what Protx requires.
The txt file explains the workaround I use in my shop which works fine.
These are the code changes you need to implement in protx_form.php to fix this error and is verified to work in this contribution using VPS protocol 2.21.
See this thread on the forums: http://forums.oscommerce.com/index.php?showtopic=179007&st=0&p=735763
This Contribution will return an error when being passed back from a successfull transaction from Protx to your store where your OsCommerce store is located on a server with new versions of PHP istalled.
Although the order will be be recorded the customer may thinks that it didn't as they recieved an error so they may try to gernerate another order thereby costing you in refund payments. Also the customer will not likely purchase from you again using your online store.
Protx states that:
Essentially, the problem seems to stem from the php upgrade which is causing plusses () to be replaced with spaces in the encrypted string which gets sent to Protx. Thus, when Protx returns the encrypted string to the OSCommerce success url, and it is decrypted by OSCommerce, the returned string is incorrect.
To fix this we recommend replacing spaces in the encrypted string with plusses to restore the original string syntax.
You do this just before calling the url decoding routine.
Although I have no idea how to implement this fix, I thought it needed bringing to the attenttion of the people who kindly contribute to this contribution, and also those who may be considering implementing it.
Oops! I left some files out of the last upload of this version. Please use this upload.
A bug fix: If the product description contained colons (:), or the cart string contained
carriage returns or line-feeds it caused an invalid transaction with PROTX.
This version fixes these bugs.
Allows you to send the shopping cart contents to Protx. These will then appear on the customers confirmation email from Protx and the 'Protx VSP SUCCESS notification' email to the shop owner. It works for me but I may have not used all of the tep functions available and I have not tested it with free shipping. It is also updated to VPSProtocol 2.22 Note this is based on v1.06 not v1.07
This is my first contribution, and I am no programmer, so I appologies if this does not work for you.
This module has been reworked from Protx Form v1.06 to include Deferred payment, instead of Pre-Authorisation. Users can choose whether or not to use Deferred payment from the payment module in Admin.
Only use this if you are using Deferred payments.
Use V1.06 if you want Pre-Authorisation
All credits go to original authors
This module had been updated from Protx Form V 1.05 to include Pre-Authorisation. Users can choose whether or not to use pre-authorisation from the payment module in Admin.
Module updated to the latest version of the Protx VPS protocol and tested with MS-1 and MS-2.
A small bug fix where the wrong transaction amout was being sent to protx.
This is an updated protx form module to work with osCommerce 2.2-MS1.
The module is now self contained and so is easier to install.
This module should not be used for versions of osCommerce other than the offical MS-1.
This updates the protx for module to work with snapshots post 1 Feb 2003 and adds the functionality of a sort order and also a default order status.
Note: This will not work for snapshots prior to 1 Feb 2003.
This version fixes the problem when the customer hits the cancel button on the protx screen.
This is a payment module for the protx form system.
This module will work only for CVS versions after the 01 November 2002.
Note: Contributions are used at own risk.