using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using com.hitrust.trustpay.client;
|
|
|
|
namespace Bwp.ABCClient2.Market
|
|
{
|
|
public class PaymentResult : TrxResponse
|
|
{
|
|
// Methods
|
|
public PaymentResult init(string aMessage)
|
|
{
|
|
LogWriter writer = null;
|
|
try
|
|
{
|
|
writer = new LogWriter();
|
|
writer.logNewLine("TrustPayClient ASP V3.0.0 交易开始==========================");
|
|
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), false);
|
|
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());
|
|
}
|
|
return this;
|
|
}
|
|
|
|
}
|
|
}
|