Hej
BEMÆRK AT jeg er i gang med at udarbejdet til min hjemmeside så det er kun beta både kode osv..Det er sådan at jeg fandt
denne side til at omskrive vb.net til c# men det er sådan at jeg er kommet frem til at når jeg spørger om adgang til quickpay så bliver jeg omlyst disse her ting som bliver vist på billedet:
http://billedeupload.dk/?v=PWNbK.pngansøger om gang til de andre filer også:
- var datoIdag = DateTime.Today.ToString("dd/MM/yyyy");
-
- var chars = "123456789";
- var randomA = new Random();
- var result = new string(
- Enumerable.Repeat(chars, 3)
- .Select(s => s[randomA.Next(s.Length)])
- .ToArray());
-
- var chars2 = "abcdefghijklmno";
- var randomA2 = new Random();
- var result2 = new string(
- Enumerable.Repeat(chars2, 2)
- .Select(s => s[randomA2.Next(s.Length)])
- .ToArray());
-
- Session["orderId"] = result2 + result + "-" + datoIdag;
-
-
- string protocol_value = "1";
- string msgtype_value = "authorize";
- string language_value = "da";
- string autocapture_value = "0";
- string ordernum_value = Session["orderId"].ToString();
- //generate an arbitrary ordernumber
- string merchant_value = "89898978";
- string amount_value = readerPriser["priser"].ToString();
- string qp_currency_value = "DKK";
- //[check available parameters on quickpay.net]
- string okpage_value = "~/handelsbetingelserContinue.aspx";
- string errorPage_value = "~/handelsbetingelserCallback.aspx";
- string resultpage_value = "~/handelsbetingelserError.aspx";
- string md5secret_value = "29p61DveBZ79c3144LW61lVz1qrwk2gfAFCxPyi5sn49m3Y3IRK5M6SN5d8a68u7";
- string md5check_value = GenerateHash(string.Concat(protocol_value.ToString(), msgtype_value, merchant_value, language_value, ordernum_value, amount_value.ToString(), qp_currency_value, okpage_value, errorPage_value, resultpage_value,
- autocapture_value.ToString(), md5secret_value));
-
- protocol.Value = protocol_value;
- msgtype.Value = msgtype_value;
- language.Value = language_value;
- autocapture.Value = autocapture_value;
- ordernumber.Value = ordernum_value;
- merchant.Value = merchant_value;
- amount.Value = amount_value;
- currency.Value = qp_currency_value;
- continueurl.Value = okpage_value;
- cancelurl.Value = errorPage_value;
- callbackurl.Value = resultpage_value;
- md5check.Value = md5check_value;
Callback.aspx
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Data;
- using System.Diagnostics;
-
- public partial class handelsbetingelserCallback : System.Web.UI.Page
- {
- /// <summary>
- /// generates a md5 hash
- /// </summary>
- /// <param name="Input">data that should be hashed</param>
- /// <returns>a hash of the input</returns>
- /// <remarks></remarks>
- private string GenerateHash(string Input)
- {
- System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
- byte[] bs = System.Text.Encoding.UTF8.GetBytes(Input);
- bs = x.ComputeHash(bs);
- System.Text.StringBuilder s = new System.Text.StringBuilder();
- foreach (byte b in bs) {
- s.Append(b.ToString("x2").ToLower());
- }
- dynamic outstr = s.ToString();
- return outstr;
- }
-
-
-
- protected void Page_Load(object sender, System.EventArgs e)
- {
- //NOTE: You cannot display the data in a browser, since the resultpage is called in the background
- //Collect return values and store them in a file, database, send them by email etc.
- //EXAMPLE: Send an e-mail with data
- //Set keys we wish to read from $_POST array
-
- dynamic requestFieldNames = new string[] {
- "msgtype",
- "ordernumber",
- "amount",
- "currency",
- "time",
- "state",
- "qpstat",
- "qpstatmsg",
- "chstat",
- "chstatmsg",
- "merchant",
- "merchantemail",
- "transaction",
- "cardtype",
- "cardnumber",
- "cardexpire",
- "acquirer",
- "splitpayment",
- "fraudprobability",
- "fraudremarks",
- "fraudreport",
- "fee"
- };
-
- string md5 = "";
-
- //build str for md5 check
- foreach (object fieldName_loopVariable in requestFieldNames) {
- fieldName = fieldName_loopVariable;
- md5 = md5 + fieldName.ToString();
- }
-
- string md5secret = "29p61DveBZ79c3144LW61lVz1qrwk2gfAFCxPyi5sn49m3Y3IRK5M6SN5d8a68u7";
- //md5 secret - taken from Quickpay manager
-
- //check the value if it matches
- if (GenerateHash(md5 + md5secret) == Request.Form["md5check"]) {
- if (Request.Form["qpstat"] == "000") {
- string sql1 = "[sql for updating transaction with transaction id and eventually cardtype]";
- //execute sql
- } else {
- //Transaction failed
- //concanate values and notify administrator
- string message = "";
- foreach (object Field_loopVariable in Request.Form.AllKeys) {
- Field = Field_loopVariable;
- message = message + Field + "<br />";
- }
- }
- } else {
- //md5check failed
- //an adminstrator should probably be notified
- }
- }
-
-
- public handelsbetingelserCallback()
- {
- Load += Page_Load;
- }
-
- public object fieldName { get; set; }
-
- public object Field { get; set; }
- }
Continue.aspx
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
-
- public partial class handelsbetingelserContinue : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
-
- }
- public handelsbetingelserContinue()
- {
- Load += Page_load;
- }
- private void Page_load(object sender, EventArgs e)
- {
- throw new NotImplementedException();
- }
-
- }
Error.aspx
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
-
- public partial class handelsbetingelserError : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
-
- }
- public handelsbetingelserError()
- {
- Load += Page_Load;
- }
- }
Den kommer frem til at ingen af disse her filer som den søger adgang til vil den giv mig lov til at komme i gennem til. så det bliver
NULL hele vejen.
Når jeg forsøger at købe så kommer det her:
Message Error Detected
An unrecoverable message error has been detected with the following information:
Missing/Invalid QuickpayId
Please correct the problem and re-submit.