close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Protx Help

Thread begun 6/25/2009 7:23 am by Suggs | Last modified 6/29/2009 12:28 pm by sales356151 | 8352 views | 12 replies |

Suggs

Protx Help

Hi Folks,
Can anyone help as im hitting a brick wall with configuring Protx (SagePay) using eCart.
Ive spent an absolute fortune with Webassist having bought practically every extension they do and all technical support did was a 1 line reply referring me to the debugging eCart transactions pdf which left me a bit disappointed with them.

Ive followed the guide to "Using Protx as your eCart Payment Gateway (PDF)" exactly and all it is doing is sending me to the checkout_failure page instead of the VSP Server page.
When i debug it, it says VPSProtocol=2.23 Status=INVALID StatusDetail=The data in the BillingSurname field you supplied is an invalid length. Max is 20 characters. The guide says you can leave this blank and even if I fill it in, it still returns the same error message.

Can anyone advise where im going wrong.?

Any help will be greatly received and appreciated.

Cheers

Paul

Sign in to reply to this post

Ray BorduinWebAssist

Drag and drop the "full request" and "full response" variables onto the page.

Post back with those values and I'll see if I can spot the issue.

Sign in to reply to this post
Did this help? Tips are appreciated...

sales356151

Im also having endless problems with the sagepay, I get errors on every field missing that is stored in the Crypt and also had no response from support in 4 days apart from we need more time to look into it.

There was a update to ecart which didn't solve the issue.

Most of my clients are using protx so am unable to finish the sites Im now having to pay programmers who know how the system works to do a job that I paid alot of money for a software that should do it.

I hope this issues is resolved soon as its costing me alot of money now.

Here is the code from my confirm.php page and the paymentscript from ecart folder.

CONFIRM.PHP form CODE.


<div class="eC_CheckoutFormWrapper">
<form name="checkout_Protx_VSPForm" action="https://test.sagepay.com/gateway/service/vspserver-register.vsp" method="post">
<div class="eC_PurchaserInfoWrapper">
<div class="eC_CheckoutFormBody">

</div>
</div>
<table class="eC_ButtonWrapper" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="hidden" name="Vendor" id="Vendor" value="theaudioworksuk" />
<input type="hidden" name="VPSProtocol" id="VPSProtocol" value="2.23" />
<input type="hidden" name="TxType" id="TxType" value="PAYMENT" />
<input type="hidden" name="Crypt" id="Crypt" value="<?php echo WA_Protx_VSPFormHash($ecommerce, "by2DE6GWXJ5yFsKa", "".WAEC_getTimestamp() ."", "".$ecommerce->GrandTotal() ."", "GBP", "".WAEC_getTimestamp() ."", "http://localhost/AudioWorks/checkout_success.php", "http://localhost/AudioWorks/checkout_failure.php", "".((isset($_POST["email"]))?$_POST["email"]:"") ."", "", "".((isset($_POST["shipping_lastname"]))?$_POST["shipping_lastname"]:"") ."", "".((isset($_POST["shipping_firstname"]))?$_POST["shipping_firstname"]:"") ."", "".((isset($_POST["shipping_street1"]))?$_POST["shipping_street1"]:"") ."", "".((isset($_POST["shipping_postcode"]))?$_POST["shipping_postcode"]:"") ."", "".((isset($_POST["shipping_city"]))?$_POST["shipping_city"]:"") ."", "".((isset($_POST["shipping_country"]))?$_POST["shipping_country"]:"") ."", "".((isset($_POST["lastname"]))?$_POST["lastname"]:"") ."", "".((isset($_POST["firstname"]))?$_POST["firstname"]:"") ."", "".((isset($_POST["street1"]))?$_POST["street1"]:"") ."", "".((isset($_POST["postcode"]))?$_POST["postcode"]:"") ."", "".((isset($_POST["city"]))?$_POST["city"]:"") ."", "".((isset($_POST["country"]))?$_POST["country"]:"") ."", "".((isset($_POST["phone"]))?$_POST["phone"]:"") ."", "".((isset($_POST["fax"]))?$_POST["fax"]:"") ."", "0", "0", "0", ""); ?>" />
<input type="button" value="Modify information" onclick="history.back();return false;"/><input type="submit" name="Submit_order" id="Submit_order" value="Checkout" />

Sign in to reply to this post

sales356151

CODE FROM THE PAYMENT SCRIPT



CODE FROM THE PAYMENT SCRIPT



<?php
$Protx_EncryptionPassword = "XXXXXXXXXXXXXXXXX";
$Protx_VSPForm_Bindings = WA_Protx_GetVSPFormBindings($Protx_EncryptionPassword);
$ProTX_VSPForm_Bindings = WA_Protx_GetVSPFormBindings($Protx_EncryptionPassword);

function WA_Protx_GetVSPFormBindings($Protx_EncryptionPassword) {
$retArray = array("VendorTxCode" => "", "Status" => "", "VPSTxId" => "", "TxAuthNo" => "", "AVSCV2" => "", "Amount" => "", "AddressResult" => "", "PostCodeResult" => "", "CV2Result" => "", "GiftAid" => "", "SecureStatus3D" => "", "CAVV" => "", "FullResponse" => "");
if (isset($_GET) && isset($_GET["crypt"]) && $_GET["crypt"] != "") {
$decodedStr = WA_Protx_VSPForm_SimpleXor(WA_Protx_VSPForm_Base64Decode($_GET["crypt"]), $Protx_EncryptionPassword);
$retArray["FullResponse"] = $decodedStr;
$retArray["VendorTxCode"] = WA_Protx_VSPForm_GetToken($decodedStr, "VendorTxCode");
$retArray["Status"] = WA_Protx_VSPForm_GetToken($decodedStr, "Status");
$retArray["StatusDetail"] = WA_Protx_VSPForm_GetToken($decodedStr, "StatusDetail");
$retArray["VPSTxId"] = WA_Protx_VSPForm_GetToken($decodedStr, "VPSTxId");
$retArray["TxAuthNo"] = WA_Protx_VSPForm_GetToken($decodedStr, "TxAuthNo");
$retArray["AVSCV2"] = WA_Protx_VSPForm_GetToken($decodedStr, "AVSCV2");
$retArray["Amount"] = WA_Protx_VSPForm_GetToken($decodedStr, "Amount");
$retArray["AddressResult"] = WA_Protx_VSPForm_GetToken($decodedStr, "AddressResult");
$retArray["PostCodeResult"] = WA_Protx_VSPForm_GetToken($decodedStr, "PostCodeResult");
$retArray["CV2Result"] = WA_Protx_VSPForm_GetToken($decodedStr, "CV2Result");
$retArray["GiftAid"] = WA_Protx_VSPForm_GetToken($decodedStr, "GiftAid");
$retArray["SecureStatus3D"] = WA_Protx_VSPForm_GetToken($decodedStr, "3DSecureStatus");
$retArray["CAVV"] = WA_Protx_VSPForm_GetToken($decodedStr,"CAVV");
}
return $retArray;
}

function WA_Protx_VSPFormHash($theCart, $tPassword, $tVendorTxCode, $tAmount, $tCurrency, $tDescription, $tSuccessURL, $tFailureURL, $tCustomerEmail, $tVendorEmail, $tDeliverySurname, $tDeliveryFirstnames, $tDeliveryAddress1, $tDeliveryPostCode, $tDeliveryCity, $tDeliveryCountry, $tBillingSurname, $tBillingFirstnames, $tBillingAddress1, $tBillingPostCode, $tBillingCity, $tBillingCountry, $tContactNumber, $tContactFax, $tAllowGiftAid, $tApplyAVSCV2, $tApply3DSecure, $tEMailMessage) {
$Protx_EncryptionPassword = $tPassword;
WA_Protx_GetVSPFormBindings($Protx_EncryptionPassword);
$retStr = "VendorTxCode=" . $tVendorTxCode . "&";
$retStr .= "Amount=" . $tAmount . "&";
$retStr .= "Currency=" . $tCurrency . "&";
$retStr .= "Description=" . $tDescription . "&";
$retStr .= "SuccessURL=" . $tSuccessURL . "&";
$retStr .= "FailureURL=" . $tFailureURL . "&";
if ($tCustomerEmail) {
$retStr .= "CustomerEmail=" . $tCustomerEmail . "&";
}
if ($tVendorEmail) {
$retStr .= "VendorEmail=" . $tVendorEmail . "&";
}
if ($tDeliverySurname) {
$retStr .= "DeliverySurname=" . $tDeliverySurname . "&";
}
if ($tDeliveryFirstnames) {
$retStr .= "DeliveryFirstnames=" . $tDeliveryFirstnames . "&";
}
if ($tDeliveryAddress1) {
$retStr .= "DeliveryAddress1=" . $tDeliveryAddress1 . "&";
}
if ($tDeliveryPostCode) {
$retStr .= "DeliveryPostCode=" . $tDeliveryPostCode . "&";
}
if ($tDeliveryCity) {
$retStr .= "DeliveryCity=" . $tDeliveryCity . "&";
}
if ($tDeliveryCountry) {
$retStr .= "DeliveryCountry=" . $tDeliveryCountry . "&";
}
if ($tBillingSurname) {
$retStr .= "BillingSurname=" . $tBillingSurname . "&";
}
if ($tBillingFirstnames) {
$retStr .= "BillingFirstnames=" . $tBillingFirstnames . "&";
}
if ($tBillingAddress1) {
$retStr .= "BillingAddress1=" . $tBillingAddress1 . "&";
}
if ($tBillingPostCode) {
$retStr .= "BillingPostCode=" . $tBillingPostCode . "&";
}
if ($tBillingCity) {
$retStr .= "BillingCity=" . $tBillingCity . "&";
}
if ($tBillingCountry) {
$retStr .= "BillingCountry=" . $tBillingCountry . "&";
}
if ($tContactNumber) {
$retStr .= "ContactNumber=" . $tContactNumber . "&";
}
if ($tContactFax) {
$retStr .= "ContactFax=" . $tContactFax . "&";
}
if ($tAllowGiftAid) {
$retStr .= "AllowGiftAid=" . $tAllowGiftAid . "&";
}
if ($tApplyAVSCV2) {
$retStr .= "ApplyAVSCV2=" . $tApplyAVSCV2 . "&";
}
if ($tApply3DSecure) {
$retStr .= "Apply3DSecure=" . $tApply3DSecure . "&";
}
if ($tEMailMessage) {
$retStr .= "EMailMessage=" . $tEMailMessage . "&";
}
$theBasket = "";
$basketCount = 0;
while (!$theCart->EOF()) {
$theBasket .= ":".$theCart->DisplayInfo("Name").":".$theCart->DisplayInfo("Quantity").":".WA_eCart_DisplayMoney($theCart, $theCart->DisplayInfo("Price"))."::".WA_eCart_DisplayMoney($theCart, $theCart->DisplayInfo("TotalPrice")).":".WA_eCart_DisplayMoney($theCart, $theCart->DisplayInfo("TotalPrice"));
$theCart->MoveNext();
$basketCount++;
}
$theCart->MoveFirst();
if (!$theCart->Rules_EOF("Discounts")) {
while (!$theCart->Rules_EOF("Discounts")) {
if ($theCart->RuleLooperValue("Discounts") > 0) {
$theBasket .= ":".$theCart->RuleLooperName("Discounts").":::::-".WA_eCart_DisplayMoney($theCart, $theCart->RuleLooperValue("Discounts"));
$theCart->MoveNext();
$basketCount++;
}
$theCart->Rules_MoveNext("Discounts");
}
$theCart->Rules_MoveFirst("Discounts");
}
if (!$theCart->Rules_EOF("Charges")) {
while (!$theCart->Rules_EOF("Charges")) {
if ($theCart->RuleLooperValue("Charges") > 0) {
$theBasket .= ":".$theCart->RuleLooperName("Charges").":::::".WA_eCart_DisplayMoney($theCart, $theCart->RuleLooperValue("Charges"));
$theCart->MoveNext();
$basketCount++;
}
$theCart->Rules_MoveNext("Charges");
}
$theCart->Rules_MoveFirst("Charges");
}
$tempParam = "Tax";
if ($theCart->ShippingIsTaxed) {
$tempParam = "Shipping";
}
if (!$theCart->Rules_EOF($tempParam)) {
while (!$theCart->Rules_EOF($tempParam)) {
if ($theCart->RuleLooperValue($tempParam) > 0) {
$theBasket .= ":".$theCart->RuleLooperName($tempParam).":::::".WA_eCart_DisplayMoney($theCart, $theCart->RuleLooperValue($tempParam));
$theCart->MoveNext();
$basketCount++;
}
$theCart->Rules_MoveNext($tempParam);
}
$theCart->Rules_MoveFirst($tempParam);
}
$tempParam = "Shipping";
if ($theCart->ShippingIsTaxed) {
$tempParam = "Tax";
}
if (!$theCart->Rules_EOF($tempParam)) {
while (!$theCart->Rules_EOF($tempParam)) {
if ($theCart->RuleLooperValue($tempParam) > 0) {
$theBasket .= ":".$theCart->RuleLooperName($tempParam).":::::".WA_eCart_DisplayMoney($theCart, $theCart->RuleLooperValue($tempParam));
$theCart->MoveNext();
$basketCount++;
}
$theCart->Rules_MoveNext($tempParam);
}
$theCart->Rules_MoveFirst($tempParam);
}
$theBasket = $basketCount.$theBasket;
$retStr .= "Basket=" . $theBasket;
$cryptStr = WA_Protx_VSPForm_Base64Encode(WA_Protx_VSPForm_SimpleXor($retStr, $tPassword));
return $cryptStr;
}

function WA_Protx_VSPForm_Base64Encode($plain) {
$output = "";
$output = base64_encode($plain);
return $output;
}

function WA_Protx_VSPForm_Base64Decode($scrambled) {
$output = "";
$scrambled = str_replace(" ","+",$scrambled);
$output = base64_decode($scrambled);
return $output;
}

function WA_Protx_VSPForm_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 WA_Protx_VSPForm_GetToken($thisString, $thisToken) {
$Tokens = array( "Status", "StatusDetail", "VendorTxCode", "VPSTxId", "TxAuthNo", "AVSCV2", "Amount", "AddressResult", "PostCodeResult", "CV2Result", "GiftAid", "3DSecureStatus", "CAVV" );
$retStr = "";
if (strpos($thisString, $thisToken."=") === false || (strpos($thisString, $thisToken."=") > 0 && strpos($thisString, "&".$thisToken."=") === false)) {
return "";
}
else {
for ($n=0; $n<sizeof($Tokens); $n++) {
if ($Tokens[$n] == $thisToken) {
if (strpos($thisString, $thisToken."=") !== false && strpos($thisString, $thisToken."=") == 0) {
$retStr = substr($thisString, strlen($thisToken)+1);
}
else {
$retStr = substr($thisString, strpos($thisString, "&".$thisToken."=") + strlen("&".$thisToken."="));
}
if (strpos($retStr, "&") !== false) {
$retStr = substr($retStr, 0, strpos($retStr, "&"));
}
}
}
}
return $retStr;
}

function WA_Protx_VSPForm_Randomise() {
list($usec, $sec) = explode(' ', microtime());
return (float) $sec + ((float) $usec * 100000);
}
?>

Sign in to reply to this post

Ray BorduinWebAssist

I'm looking for the "Full Request" and "Full Response" when you have issues. The code is difficult to debug on its own without the context and values that are passed in the request and error in the response.

Sign in to reply to this post
Did this help? Tips are appreciated...

sales356151

Im not actually getting any reponse just an error at Sagepay.

The Post values are:

<input type="hidden" name="Vendor" id="Vendor" value="theaudioworksuk" />
<input type="hidden" name="VPSProtocol" id="VPSProtocol" value="2.23" />
<input type="hidden" name="TxType" id="TxType" value="PAYMENT" />
<input type="hidden" name="Crypt" id="Crypt" value="NBxcICpEEy8bJVEce0J5VVdAB3d0A3RuaWx0FCkGJRVfTgZ9awZ3cRs/RwsjHSgYXz5wFGNyIiQ7OFwJMhokD19IAHBwD3JkaX8GQHdVGBQBGlc3NmMVG2UiQQ02SWRODhZRJSleKCQsZXQMIhokNg0LWTdqVS8yOyFaDDIsOBQBGlc3Nhg3PyhscxgvHz4TByxgCHheMyMocBpWKhwoAA4RXTcxGQYiPCNaLikBIBJNGlohJl0oIiwVUxgvHz4TB1dCLDUQBTYrIVANe0JxLSdZfwUMYhUSeAdjKmYjGS5CMXMeAGR9ZmJsRRYzHS9aVU0LanUGfW1+OloMKBdwVlZAHHR1DGEnNz9bHX1Ef1hMSQI=" />
<input type="button" value="Modify information" onclick="history.back();return false;"/><input type="submit" name="Submit_order" id="Submit_order" value="Checkout" />

</td>




THE ERROR AT SAGEPAY IS
VPSProtocol=2.23
Status=MALFORMED
StatusDetail=3045 : The Currency field is missing.


I added the currency field as a hidden form value and cleared the error but each time I did this asked for something else like description, amount etc, basically everything that should be included in the Crypt is missing

Sign in to reply to this post

sales356151

Ive waited well over a week from support no reply, no help on here either.
Anyway I have written a script that works so i will post it in another thread so hope it helps someone else to avoid the massive waste of time ive gone through this week.

Sign in to reply to this post

Justin Nemeth

With the protx updates, they now require some more information to be sent to them. These are new variables that can be set. Earlier versions of eCart that used earlier versions of protx might be the problem here. With protx 2.23, you will likely have to re-apply the checkout behavior, or make sure to update all the variables protx now requires.

Sign in to reply to this post

sales356151

I have managed to write a new script that works using protocol 2.22, when will an update to ecart be available to do the integration.

I should be able to use what I wrote for this site to work with other sites but Im sure this will become a problem for others trying to integrate sagepay

Sign in to reply to this post

Ray BorduinWebAssist

Our testing implies that it does work currently. I'm unsure what the precise issue you were running into is but I have brought your incident to the attention of the head of support so hopefully we can find the original cause.

Most people are actually not haveing problems with it... only two or three are reporting issues at all and we still don't know the cause or what it is we need to fix. Once we figure out what is happenning then we will make the necessary updates. Right now we still don't have an official bug open since we can't seem to see what to do to reproduce the problem.

Sign in to reply to this post
Did this help? Tips are appreciated...
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...