You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

40 lines
1.7 KiB

namespace com.hitrust.trustpay.client.b2c
{
using com.hitrust.trustpay.client;
using System;
using System.Text;
public class PaymentResult : TrxResponse
{
public PaymentResult init(string aMessage)
{
LogWriter writer = null;
try
{
writer = new LogWriter();
writer.logNewLine("TrustPayClient ASP V2.0.1 交易开始==========================");
writer.logNewLine("接收到的支付结果通知:\n[" + aMessage + "]");
Base64 base2 = new Base64();
string aXMLString = Encoding.GetEncoding("gb2312").GetString(base2.decode(aMessage));
writer.logNewLine("经过Base64解码后的支付结果通知:\n[" + aXMLString + "]");
writer.logNewLine("验证支付结果通知的签名:");
XMLDocument aXMLDocument = MerchantConfig.verifySign(new XMLDocument(aXMLString));
writer.logNewLine("验证通过!\n 经过验证的支付结果通知:\n[" + aXMLDocument.ToString() + "]");
base.init(aXMLDocument);
}
catch (TrxException exception)
{
this.setReturnCode(exception.Code);
this.setErrorMessage(exception.Message + "-" + exception.DetailMessage);
writer.log("验证失败!\n");
}
if (writer != null)
{
writer.logNewLine("交易结束==================================================");
writer.closeWriter(MerchantConfig.getTrxLogFile("PayResultLog"));
}
return this;
}
}
}