private Hashtable ShowUserPage(Hashtable request, string baseUrl, FreeMoneyTransaction txn, string error_message)
{
string url = m_ppprotocol+"://" + m_ppurl + m_pprequesturi+"?cmd=_xclick" + "&business=" +
HttpUtility.UrlEncode (txn.SellersEmail) + "&item_name=" + HttpUtility.UrlEncode (txn.Description) +
"&item_number=" + HttpUtility.UrlEncode (txn.TxID.ToString ()) + "&amount=" +
HttpUtility.UrlEncode (String.Format ("{0:0.00}", ConvertAmountToCurrency (txn.Amount))) +
"&page_style=" + HttpUtility.UrlEncode ("Paypal") + "&no_shipping=" +
HttpUtility.UrlEncode ("1") + "&return=" + HttpUtility.UrlEncode ("http://" + baseUrl + "/") +
"&cancel_return=" + HttpUtility.UrlEncode ("http://" + baseUrl + "/") + "¬ify_url=" +
HttpUtility.UrlEncode ("http://" + baseUrl + "/ppipn/") + "&no_note=" +
HttpUtility.UrlEncode ("1") + "¤cy_code=" + HttpUtility.UrlEncode (m_gridCurrencyCode) + "&lc=" +
HttpUtility.UrlEncode ("US") + "&bn=" + HttpUtility.UrlEncode ("PP-BuyNowBF") + "&charset=" +
HttpUtility.UrlEncode ("UTF-8") + "";
// The URL for Bitcoin will be modelled on the FreeMoney one.
// This will allow us use a common Bitcoin page handler whether or not we've hacked this.
// It'll just throw away arguments it doesn't need.
//string btcurl = m_btcprotocol+"://" + m_btcurl + m_btcrequesturi+"?cmd=_xclick";
string btcurl = "/btcgo/";
string btcfields = ""
+ "<input type=\"hidden\" name=\"txn\" value=\""+HttpUtility.HtmlEncode (txn.TxID.ToString ())+"\" />"
+ "<input type=\"hidden\" name=\"btc_session_id\" value=\""+HttpUtility.HtmlEncode ( GetSessionKey( txn.From ).ToString() )+"\" />";
Dictionary<string, string> replacements = new Dictionary<string, string> ();
replacements.Add ("{ITEM}", HttpUtility.HtmlEncode(txn.Description));
replacements.Add ("{AMOUNT}", HttpUtility.HtmlEncode(String.Format ("{0:0.00}", ConvertAmountToCurrency (txn.Amount))));
replacements.Add ("{AMOUNTOS}", HttpUtility.HtmlEncode(txn.Amount.ToString ()));
replacements.Add ("{CURRENCYCODE}", HttpUtility.HtmlEncode(m_gridCurrencyText));
replacements.Add ("{BILLINGLINK}", url);
replacements.Add ("{BTCBILLINGLINK}", btcurl);
replacements.Add ("{BTCBILLINGHIDDENFIELDS}", btcfields);
replacements.Add ("{OBJECTID}", HttpUtility.HtmlEncode(txn.ObjectID.ToString ()));
replacements.Add ("{SELLEREMAIL}", HttpUtility.HtmlEncode(txn.SellersEmail));
replacements.Add ("{BTC_ERRORS}", error_message);
string template;
try {
template = File.ReadAllText ("freemoney-template.htm");
} catch (IOException) {
template = "Error: freemoney-template.htm does not exist.";
m_log.Error ("[FreeMoney] Unable to load template file.");
}
foreach (KeyValuePair<string, string> pair in replacements) {
template = template.Replace (pair.Key, pair.Value);
}
Hashtable reply = new Hashtable ();
reply["int_response_code"] = 200;
// 200 OK
reply["str_response_string"] = template;
reply["content_type"] = "text/html";
return reply;
}