namespace com.hitrust.trustpay.client.b2c
|
|
{
|
|
using com.hitrust.trustpay.client;
|
|
using System;
|
|
|
|
public class RefundRequest : TrxRequest
|
|
{
|
|
private string iOrderNo;
|
|
private double iTrxAmount;
|
|
|
|
public RefundRequest() : base("B2C")
|
|
{
|
|
this.iOrderNo = "";
|
|
this.iTrxAmount = 0.0;
|
|
}
|
|
|
|
protected internal override void checkRequest()
|
|
{
|
|
if (this.iOrderNo.Length == 0)
|
|
{
|
|
throw new TrxException("1100", "商户提交的交易资料不完整", "未设定订单号!");
|
|
}
|
|
if (SupportClass.ToSByteArray(SupportClass.ToByteArray(this.iOrderNo)).Length > 50)
|
|
{
|
|
throw new TrxException("1101", "商户提交的交易资料不合法", "订单号不合法!");
|
|
}
|
|
if (this.iTrxAmount <= 0.0)
|
|
{
|
|
throw new TrxException("1101", "商户提交的交易资料不合法", "交易金额不合法!");
|
|
}
|
|
if (!DataVerifier.isValidAmount(this.iTrxAmount, 2))
|
|
{
|
|
throw new TrxException("1101", "商户提交的交易资料不合法", "交易金额不合法!");
|
|
}
|
|
}
|
|
|
|
protected internal override TrxResponse constructResponse(XMLDocument aResponseMessage)
|
|
{
|
|
return new TrxResponse(aResponseMessage);
|
|
}
|
|
|
|
public virtual string OrderNo
|
|
{
|
|
get
|
|
{
|
|
return this.iOrderNo;
|
|
}
|
|
set
|
|
{
|
|
this.iOrderNo = value.Trim();
|
|
}
|
|
}
|
|
|
|
protected internal override XMLDocument RequestMessage
|
|
{
|
|
get
|
|
{
|
|
return new XMLDocument(string.Concat(new object[] { "<TrxRequest><TrxType>Refund</TrxType><OrderNo>", this.iOrderNo, "</OrderNo><TrxAmount>", this.iTrxAmount, "</TrxAmount></TrxRequest>" }));
|
|
}
|
|
}
|
|
|
|
public virtual double TrxAmount
|
|
{
|
|
get
|
|
{
|
|
return this.iTrxAmount;
|
|
}
|
|
set
|
|
{
|
|
this.iTrxAmount = value;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|