Sagepay 2.23至3.00。需要更新到AES

时间:2015-04-17 11:23:38

标签: c# asp.net sagepay

以下代码是我们的结帐付款页面的一部分,该页面用sagepay服务器注册付款。我只需要在post之前更改编码,并在get响应之后解码以符合AES要求。

我是否认为我的strPost需要分解为非加密部分和Crypt部分? 在这种情况下,我有一些工作要做。

//** The full transaction registration POST has now been built **
    System.Text.UTF8Encoding objUTFEncode = new System.Text.UTF8Encoding();
    Uri objUri = new Uri(SagePay.SystemURL(SagePay.ConnectTo, "purchase"));

    System.Net.HttpWebRequest objHttpRequest = (HttpWebRequest)WebRequest.Create(objUri.ToString());
    objHttpRequest.KeepAlive = false;
    objHttpRequest.Method = "POST";

    objHttpRequest.ContentType = "application/x-www-form-urlencoded";
    byte[] arrRequest = objUTFEncode.GetBytes(strPost);
    objHttpRequest.ContentLength = arrRequest.Length;

    Stream objStreamReq = objHttpRequest.GetRequestStream();
    objStreamReq.Write(arrRequest, 0, arrRequest.Length);
    objStreamReq.Close();

    //Get response
    HttpWebResponse objHttpResponse = (HttpWebResponse)objHttpRequest.GetResponse();
    StreamReader objStreamRes = new StreamReader(objHttpResponse.GetResponseStream(), System.Text.Encoding.ASCII);

    strResponse = objStreamRes.ReadToEnd();
    objStreamRes.Close();

    //** No transport level errors, so the message got the SagePay **
    //** Analyse the response from VSP Direct to check that everything is okay **
    //** Registration results come back in the Status and StatusDetail fields **
    strStatus = SagePay.FindField("Status", strResponse);
    strStatusDetail = SagePay.FindField("StatusDetail", strResponse);

1 个答案:

答案 0 :(得分:0)

AES要求仅适用于使用表单集成方法。看起来您正在发布Sage Pay的Direct API。所以你可能没什么可做的: - )