namespace com.hitrust.trustpay.client.b2c
|
|
{
|
|
using com.hitrust.trustpay.client;
|
|
using System;
|
|
|
|
public class FundPaymentRequest : TrxRequest
|
|
{
|
|
private string iBankCardNo;
|
|
private string iCertificateNo;
|
|
private string iCertificateType;
|
|
private string iMerchantRemarks;
|
|
private string iNotifyType;
|
|
private com.hitrust.trustpay.client.b2c.Order iOrder;
|
|
private string iPaymentType;
|
|
private string iProductType;
|
|
private string iResultNotifyURL;
|
|
private string iTrxSubType;
|
|
public const int MERCHANT_REMARKS_LEN = 200;
|
|
public const string NOTIFY_TYPE_SERVER = "1";
|
|
public const string NOTIFY_TYPE_URL = "0";
|
|
public const string PAY_TYPE_ABC = "1";
|
|
public const string PAY_TYPE_INT = "2";
|
|
public const string PRD_TYPE_ONE = "1";
|
|
public const string PRD_TYPE_TWO = "2";
|
|
public const int RESULT_NOTIFY_URL_LEN = 200;
|
|
private string TRX_BUY_FUND;
|
|
private string TRX_OPEN_ACCOUNT;
|
|
|
|
public FundPaymentRequest() : base("B2C")
|
|
{
|
|
this.iOrder = null;
|
|
this.iProductType = "1";
|
|
this.iNotifyType = "0";
|
|
this.iPaymentType = "1";
|
|
this.iResultNotifyURL = "";
|
|
this.iMerchantRemarks = "";
|
|
this.iTrxSubType = "";
|
|
this.iCertificateNo = "";
|
|
this.iCertificateType = "";
|
|
this.iBankCardNo = "";
|
|
this.TRX_OPEN_ACCOUNT = "1";
|
|
this.TRX_BUY_FUND = "2";
|
|
}
|
|
|
|
public FundPaymentRequest(XMLDocument aXMLDocument) : base("B2C")
|
|
{
|
|
this.iOrder = null;
|
|
this.iProductType = "1";
|
|
this.iNotifyType = "0";
|
|
this.iPaymentType = "1";
|
|
this.iResultNotifyURL = "";
|
|
this.iMerchantRemarks = "";
|
|
this.iTrxSubType = "";
|
|
this.iCertificateNo = "";
|
|
this.iCertificateType = "";
|
|
this.iBankCardNo = "";
|
|
this.TRX_OPEN_ACCOUNT = "1";
|
|
this.TRX_BUY_FUND = "2";
|
|
this.Order = new com.hitrust.trustpay.client.b2c.Order(aXMLDocument);
|
|
this.ProductType = aXMLDocument.getValueNoNull("ProductType");
|
|
this.PaymentType = aXMLDocument.getValueNoNull("PaymentType");
|
|
this.NotifyType = aXMLDocument.getValueNoNull("NotifyType");
|
|
this.ResultNotifyURL = aXMLDocument.getValueNoNull("ResultNotifyURL");
|
|
this.MerchantRemarks = aXMLDocument.getValueNoNull("MerchantRemarks");
|
|
this.BankCardNo = aXMLDocument.getValueNoNull("BankCardNo");
|
|
this.TrxSubType = aXMLDocument.getValueNoNull("TrxSubType");
|
|
this.CertificateNo = aXMLDocument.getValueNoNull("CertificateNo");
|
|
this.CertificateType = aXMLDocument.getValueNoNull("CertificateType");
|
|
}
|
|
|
|
protected internal override void checkRequest()
|
|
{
|
|
if (this.iOrder == null)
|
|
{
|
|
throw new TrxException("1100", "商户提交的交易资料不完整", "未设定订单信息!");
|
|
}
|
|
if (this.iProductType == null)
|
|
{
|
|
throw new TrxException("1100", "商户提交的交易资料不完整", "未设定商品种类!");
|
|
}
|
|
if (this.iResultNotifyURL == null)
|
|
{
|
|
throw new TrxException("1100", "商户提交的交易资料不完整", "未设定支付结果回传网址!");
|
|
}
|
|
string str = this.iOrder.isValid();
|
|
if (str.Length != 0)
|
|
{
|
|
throw new TrxException("1101", "商户提交的交易资料不合法", "订单信息不合法![" + str + "]");
|
|
}
|
|
if (!this.iProductType.Equals("1") && !this.iProductType.Equals("2"))
|
|
{
|
|
throw new TrxException("1101", "商户提交的交易资料不合法", "商品种类不合法!");
|
|
}
|
|
if (!this.iPaymentType.Equals("1") && !this.iPaymentType.Equals("2"))
|
|
{
|
|
throw new TrxException("1101", "商户提交的交易资料不合法", "支付类型不合法!");
|
|
}
|
|
if (!this.iNotifyType.Equals("0") && !this.iNotifyType.Equals("1"))
|
|
{
|
|
throw new TrxException("1101", "商户提交的交易资料不合法", "支付通知类型不合法!");
|
|
}
|
|
if (!DataVerifier.isValidURL(this.iResultNotifyURL))
|
|
{
|
|
throw new TrxException("1101", "商户提交的交易资料不合法", "支付结果回传网址不合法!");
|
|
}
|
|
if (this.iResultNotifyURL.Length == 0)
|
|
{
|
|
throw new TrxException("1101", "商户提交的交易资料不合法", "支付结果回传网址不合法!");
|
|
}
|
|
if (SupportClass.ToSByteArray(SupportClass.ToByteArray(this.iResultNotifyURL)).Length > 200)
|
|
{
|
|
throw new TrxException("1101", "商户提交的交易资料不合法", "支付结果回传网址不合法!");
|
|
}
|
|
if (SupportClass.ToSByteArray(SupportClass.ToByteArray(this.iMerchantRemarks)).Length > 200)
|
|
{
|
|
throw new TrxException("1101", "商户提交的交易资料不合法", "商户备注信息不合法!");
|
|
}
|
|
if (!this.iTrxSubType.Equals(this.TRX_OPEN_ACCOUNT) && !this.iTrxSubType.Equals(this.TRX_BUY_FUND))
|
|
{
|
|
throw new TrxException("1101", "商户提交的交易资料不合法", "交易子类型不合法!");
|
|
}
|
|
if (this.iTrxSubType.Equals(this.TRX_OPEN_ACCOUNT) && ((this.iCertificateNo.Trim().Length == 0) || (this.iCertificateType.Trim().Length == 0)))
|
|
{
|
|
throw new TrxException("1101", "商户提交的交易资料不合法", "证件类型和证件号不合法!");
|
|
}
|
|
if (this.iBankCardNo.Trim().Length == 0)
|
|
{
|
|
throw new TrxException("1101", "商户提交的交易资料不合法", "账户号不合法!");
|
|
}
|
|
}
|
|
|
|
protected internal override TrxResponse constructResponse(XMLDocument aResponseMessage)
|
|
{
|
|
return new TrxResponse(aResponseMessage);
|
|
}
|
|
|
|
public virtual string BankCardNo
|
|
{
|
|
get
|
|
{
|
|
return this.iBankCardNo;
|
|
}
|
|
set
|
|
{
|
|
this.iBankCardNo = value.Trim();
|
|
}
|
|
}
|
|
|
|
public virtual string CertificateNo
|
|
{
|
|
get
|
|
{
|
|
return this.iCertificateNo;
|
|
}
|
|
set
|
|
{
|
|
this.iCertificateNo = value.Trim();
|
|
}
|
|
}
|
|
|
|
public virtual string CertificateType
|
|
{
|
|
get
|
|
{
|
|
return this.iCertificateType;
|
|
}
|
|
set
|
|
{
|
|
this.iCertificateType = value.Trim();
|
|
}
|
|
}
|
|
|
|
public virtual string MerchantRemarks
|
|
{
|
|
get
|
|
{
|
|
return this.iMerchantRemarks;
|
|
}
|
|
set
|
|
{
|
|
this.iMerchantRemarks = value.Trim();
|
|
}
|
|
}
|
|
|
|
public virtual string NotifyType
|
|
{
|
|
get
|
|
{
|
|
return this.iNotifyType;
|
|
}
|
|
set
|
|
{
|
|
this.iNotifyType = value.Trim();
|
|
}
|
|
}
|
|
|
|
public virtual com.hitrust.trustpay.client.b2c.Order Order
|
|
{
|
|
get
|
|
{
|
|
return this.iOrder;
|
|
}
|
|
set
|
|
{
|
|
this.iOrder = value;
|
|
}
|
|
}
|
|
|
|
public virtual string PaymentType
|
|
{
|
|
get
|
|
{
|
|
return this.iPaymentType;
|
|
}
|
|
set
|
|
{
|
|
this.iPaymentType = value.Trim();
|
|
}
|
|
}
|
|
|
|
public virtual string ProductType
|
|
{
|
|
get
|
|
{
|
|
return this.iProductType;
|
|
}
|
|
set
|
|
{
|
|
this.iProductType = value.Trim();
|
|
}
|
|
}
|
|
|
|
protected internal override XMLDocument RequestMessage
|
|
{
|
|
get
|
|
{
|
|
return new XMLDocument("<TrxRequest><TrxType>FundPayReq</TrxType>" + this.iOrder.getXMLDocument(1).ToString() + "<ProductType>" + this.iProductType + "</ProductType><PaymentType>" + this.iPaymentType + "</PaymentType><NotifyType>" + this.iNotifyType + "</NotifyType><ResultNotifyURL>" + this.iResultNotifyURL + "</ResultNotifyURL><MerchantRemarks>" + this.iMerchantRemarks + "</MerchantRemarks><TrxSubType>" + this.iTrxSubType + "</TrxSubType><CertificateType>" + this.iCertificateType + "</CertificateType><CertificateNo>" + this.iCertificateNo + "</CertificateNo><BankCardNo>" + this.iBankCardNo + "</BankCardNo></TrxRequest>");
|
|
}
|
|
}
|
|
|
|
public virtual string ResultNotifyURL
|
|
{
|
|
get
|
|
{
|
|
return this.iResultNotifyURL;
|
|
}
|
|
set
|
|
{
|
|
this.iResultNotifyURL = value.Trim();
|
|
}
|
|
}
|
|
|
|
public virtual string TrxSubType
|
|
{
|
|
get
|
|
{
|
|
return this.iTrxSubType;
|
|
}
|
|
set
|
|
{
|
|
this.iTrxSubType = value.Trim();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|