Transaction Data Feed

rchurch22rchurch22 Member
in Help edited October 2013
I am trying to get my transaction data feed to receive the data feed from foxycart's transaction data feed but I am getting errors. Any clues?

DataFeed Failed: (153768861) 2013-10-28 14:03:33 Datafeed Returned: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">; <html xmlns="http://www.w3.org/1999/xhtml">; <head id="ctl00_Head1"><meta http-equiv="X-UA-Compatible" content="IE=7,8,9" /><meta name="keywords" content="GTS" /><title> </title><link href="../App_Themes/Tempranillo/BaseStyles.css" type="text/css" rel="stylesheet" /><link href="../App_Themes/Tempranillo/Styles.css" type="text/css" rel="stylesheet" /></head>

POST Values:

fcsid=2a0m78skb9qg784c6c1f86oe90 ThisAction=checkout customer_id=a9c166d2ecb9cd62cc74c85d4b8ca998 fc_csrf_form=ujEZU2bYu91EjE3U8jHI5GXSQ17nGNr1XZUHWVAgY fc_csrf_id=form customer_email=rchurch22@hotmail.com is_anonymous=0 email_found=true customer_country=US customer_country_name=United States customer_first_name=Robert customer_last_name=Church customer_company= customer_address1=9413 Medford Falls Ave customer_address2= customer_city=Las Vegas customer_state=NV customer_state_name=Nevada customer_postal_code=89149 customer_phone=702-591-0774 shipping_country=US shipping_country_name=United States shipping_first_name= shipping_last_name= shipping_company= shipping_address1= shipping_address2= shipping_city= shipping_state= shipping_state_name= shipping_postal_code= shipping_phone= subtotal=37.58 shipping_cost=6.95 tax=3.60693 order_total=48.13693 fc_payment_method=plastic c_card=saved cc_issue_number= cc_start_date_month= cc_start_date_year= cc_exp_month= cc_exp_year= save_cc=1 cc_number_masked=xxxxxxxxxxxx6838

URL: https://gtsromanceboutique.foxycart.com/checkout.php

The code I am using on the "ProcessTransactions.aspx page is:

#region "Using statements"

using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BaseClasses;
using BaseClasses.Utils;
using BaseClasses.Data;
using BaseClasses.Data.SqlProvider;
using BaseClasses.Web.UI.WebControls;

using GTS.Business;
using GTS.Data;
#endregion


namespace GTS.UI
{
public partial class ProcessTransaction : BaseApplicationPage
{
private string API_KEY = "rQvreiJc4TZ7gPjkZzDFBSLwYv9hNY99EyuMG4TASJBYtQ9ifHSKqvbiUary";

protected void Page_Load(object sender, EventArgs e)
{
try
{
string foxyFeed = Request.Form["FoxyData"];
byte[] ffBytes = Encoding.ASCII.GetBytes(foxyFeed);
string unencodedFeed = HttpUtility.UrlDecode(ffBytes, Encoding.GetEncoding(1252));
string transaction = RC4.Decrypt(API_KEY, unencodedFeed, false);

//Process the XML string "transaction" as desired.

Response.Write("foxy");
}
catch (Exception) { } //Just eat all exceptions. You can log this internally if you'd like.
}

/**
* RC4.NET 1.0
*
* RC4.NET is a petite library that allows you to use RC4
* encryption easily in the .NET Platform. It's OO and can
* produce outputs in binary and hex.
*
* (C) Copyright 2006 Mukul Sabharwal [http://mjsabby.com]
* All Rights Reserved
*
* @link http://rc4dotnet.devhome.org
* @author Mukul Sabharwal <mjsabby@gmail.com>
* @version $Id: RC4.cs,v 1.0 2006/03/19 15:35:24 mukul Exp $
* @copyright Copyright © 2006 Mukul Sabharwal
* @license http://www.gnu.org/copyleft/lesser.html
* @package RC4.NET
*/
public class RC4
{


private static int ord(char ch)
{
return (int)(Encoding.GetEncoding(1252).GetBytes(ch + "")[0]);
}
static char chr(int i)
{
byte[] bytes = new byte[1];
bytes[0] = (byte)i;
return Encoding.GetEncoding(1252).GetString(bytes)[0];
}

private static string pack(string packtype, string datastring)
{
int i, j, datalength, packsize;
byte[] bytes;
char[] hex;
string tmp;

datalength = datastring.Length;
packsize = (datalength / 2) + (datalength % 2);
bytes = new byte[packsize];
hex = new char[2];

for (i = j = 0; i < datalength; i += 2)
{
hex[0] = datastring;
if (datalength - i == 1)
hex[1] = '0';
else
hex[1] = datastring[i + 1];
tmp = new string(hex, 0, 2);
try { bytes[j++] = byte.Parse(tmp, System.Globalization.NumberStyles.HexNumber); }
catch { } /* grin */
}
return Encoding.GetEncoding(1252).GetString(bytes);
}

public static string bin2hex(string bindata)
{
int i;
byte[] bytes = Encoding.GetEncoding(1252).GetBytes(bindata);
string hexString = "";
for (i = 0; i < bytes.Length; i++)
{
hexString += bytes.ToString("x2");
}
return hexString;
}

public static string Encrypt(string pwd, string data, bool ispwdHex)
{
int a, i, j, k, tmp, pwd_length, data_length;
int[] key, box;
byte[] cipher;
//string cipher;

if (ispwdHex)
pwd = pack("H*", pwd); // valid input, please!
pwd_length = pwd.Length;
data_length = data.Length;
key = new int[256];
box = new int[256];
cipher = new byte[data.Length];
//cipher = "";

for (i = 0; i < 256; i++)
{
key = ord(pwd[i % pwd_length]);
box = i;
}
for (j = i = 0; i < 256; i++)
{
j = (j + box + key) % 256;
tmp = box;
box = box[j];
box[j] = tmp;
}
for (a = j = i = 0; i < data_length; i++)
{
a = (a + 1) % 256;
j = (j + box[a]) % 256;
tmp = box[a];
box[a] = box[j];
box[j] = tmp;
k = box[((box[a] + box[j]) % 256)];
cipher = (byte)(ord(data) ^ k);
//cipher += chr(ord(data) ^ k);
}
return Encoding.GetEncoding(1252).GetString(cipher);
//return cipher;
}

public static string Decrypt(string pwd, string data, bool ispwdHex)
{
return Encrypt(pwd, data, ispwdHex);
}
}
}
}
Sign In or Register to comment.