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.
 
 

169 lines
3.6 KiB

namespace com.hitrust.trustpay.client
{
using System;
public class TrxResponse
{
protected internal string iErrorMessage;
protected internal XMLDocument iResponseMessage;
protected internal string iReturnCode;
public const string RC_SUCCESS = "0000";
protected internal TrxResponse()
{
this.iReturnCode = "";
this.iErrorMessage = "";
this.InitBlock();
}
public TrxResponse(XMLDocument aXMLDocument)
{
this.iReturnCode = "";
this.iErrorMessage = "";
this.InitBlock();
this.init(aXMLDocument);
}
public TrxResponse(string aReturnCode, string aErrorMessage)
{
this.iReturnCode = "";
this.iErrorMessage = "";
this.InitBlock();
this.setReturnCode(aReturnCode);
this.setErrorMessage(aErrorMessage);
}
public virtual XMLDocument getOriginalResponseMessage()
{
return this.iResponseMessage;
}
public virtual string getValue(string aTag)
{
return this.iResponseMessage.getValueNoNull(aTag);
}
protected internal virtual void init(XMLDocument aXMLDocument)
{
XMLDocument tReturnCode = aXMLDocument.getValue("ReturnCode");
if (tReturnCode == null) {
throw new TrxException("1303", "无法辨识网上支付平台的交易结果", "无法取得[ReturnCode]!");
}
this.setReturnCode(tReturnCode.ToString());
XMLDocument tErrorMessage = aXMLDocument.getValue("ReturnMessage");
if (tErrorMessage != null) {
this.setErrorMessage(tErrorMessage.ToString());
}
if (this.ReturnCode.Equals("0000")) {
this.iResponseMessage = aXMLDocument;
}
}
private void InitBlock()
{
this.iResponseMessage = new XMLDocument("");
}
public virtual bool isSuccess()
{
return this.iReturnCode.Equals("0000");
}
public virtual TrxResponse setErrorMessage(string aErrorMessage)
{
this.iErrorMessage = aErrorMessage.Trim();
return this;
}
public virtual TrxResponse setReturnCode(string aReturnCode)
{
this.iReturnCode = aReturnCode.Trim();
return this;
}
public virtual string AccInfo
{
get { return this.getValue("AccInfo"); }
}
public virtual string BuyerAmount
{
get { return this.getValue("BuyerAmount"); }
}
public virtual string ContractID
{
get { return this.getValue("ContractID"); }
}
public virtual string CustomerNo
{
get { return this.getValue("CustomerNo"); }
}
public virtual string EntryFlag
{
get { return this.getValue("EntryFlag"); }
}
public virtual string EntryFlagDate
{
get { return this.getValue("EntryFlagDate"); }
}
public virtual string ErrorMessage
{
get { return this.iErrorMessage; }
}
public virtual string FunctionID
{
get { return this.getValue("FunctionID"); }
}
public virtual string HostDate
{
get { return this.getValue("HostDate"); }
}
public virtual string HostTime
{
get { return this.getValue("HostTime"); }
}
public virtual string InterBankFee
{
get { return this.getValue("InterBankFee"); }
}
public virtual string KeyNext
{
get { return this.getValue("KeyNext"); }
}
public virtual string MerchantID
{
get { return this.getValue("MerchantID"); }
}
public virtual string OrderDate
{
get { return this.getValue("OrderDate"); }
}
public virtual string ReturnCode
{
get { return this.iReturnCode; }
}
public virtual string ReturnURL
{
get { return this.getValue("ReturnURL"); }
}
public virtual string SalerFee
{
get { return this.getValue("SalerFee"); }
}
}
}