namespace com.hitrust.b2b.trustpay.client.b2b
|
|
{
|
|
using com.hitrust.b2b.trustpay.client;
|
|
using System;
|
|
using System.Text;
|
|
|
|
public class PartFreezeTransferRequest : TrxRequest
|
|
{
|
|
public const int ACCOUNT_BANK_URL_LEN = 50;
|
|
public const int ACCOUNT_DB_BANK_URL_LEN = 50;
|
|
public const int ACCOUNT_DB_NAME_URL_LEN = 50;
|
|
public const int ACCOUNT_DB_NO_URL_LEN = 20;
|
|
public const int ACCOUNT_NAME_URL_LEN = 50;
|
|
public const int ACCOUNT_NO_URL_LEN = 20;
|
|
public const int CORPOR_CUSTOMER_URL_LEN = 100;
|
|
private string iAccountBank;
|
|
private string iAccountDBBank;
|
|
private string iAccountDBName;
|
|
private string iAccountDBNo;
|
|
private string iAccountName;
|
|
private string iAccountNo;
|
|
private string iCorporationCustomerNo;
|
|
private string iMerchantRemarks;
|
|
private string iMerchantTrnxNo;
|
|
private string iOrginalFreezeNo;
|
|
private string iOrginalTrnxSN;
|
|
private string iResultNotifyURL;
|
|
private double iTrnxAmount;
|
|
private string iTrnxDate;
|
|
private com.hitrust.b2b.trustpay.client.b2b.TrnxInfo iTrnxInfo;
|
|
private string iTrnxTime;
|
|
public const int MERCHANT_REMARKS_LEN = 200;
|
|
public const int MERCHANT_TRNX_URL_LEN = 20;
|
|
public const int ORGINAL_FREEZE_NO_URL_LEN = 6;
|
|
public const int ORGINAL_TRNX_SN_URL_LEN = 20;
|
|
public const int RESULT_NOTIFY_URL_LEN = 200;
|
|
|
|
public PartFreezeTransferRequest() : base("B2B")
|
|
{
|
|
this.iTrnxInfo = null;
|
|
this.iCorporationCustomerNo = "";
|
|
this.iMerchantTrnxNo = "";
|
|
this.iTrnxDate = "";
|
|
this.iTrnxAmount = 0.0;
|
|
this.iTrnxTime = "";
|
|
this.iAccountNo = "";
|
|
this.iAccountName = "";
|
|
this.iAccountBank = "";
|
|
this.iAccountDBNo = "";
|
|
this.iAccountDBName = "";
|
|
this.iAccountDBBank = "";
|
|
this.iOrginalTrnxSN = "";
|
|
this.iOrginalFreezeNo = "";
|
|
this.iResultNotifyURL = "";
|
|
this.iMerchantRemarks = "";
|
|
}
|
|
|
|
public PartFreezeTransferRequest(XMLDocument aXMLDocument) : base("B2B")
|
|
{
|
|
this.iTrnxInfo = null;
|
|
this.iCorporationCustomerNo = "";
|
|
this.iMerchantTrnxNo = "";
|
|
this.iTrnxDate = "";
|
|
this.iTrnxAmount = 0.0;
|
|
this.iTrnxTime = "";
|
|
this.iAccountNo = "";
|
|
this.iAccountName = "";
|
|
this.iAccountBank = "";
|
|
this.iAccountDBNo = "";
|
|
this.iAccountDBName = "";
|
|
this.iAccountDBBank = "";
|
|
this.iOrginalTrnxSN = "";
|
|
this.iOrginalFreezeNo = "";
|
|
this.iResultNotifyURL = "";
|
|
this.iMerchantRemarks = "";
|
|
this.TrnxInfo = new com.hitrust.b2b.trustpay.client.b2b.TrnxInfo(aXMLDocument);
|
|
this.CorporationCustomerNo = aXMLDocument.getValueNoNull("CorporationCustomerNo");
|
|
this.MerchantTrnxNo = aXMLDocument.getValueNoNull("MerchantTrnxNo");
|
|
try
|
|
{
|
|
this.TrnxAmount = double.Parse(aXMLDocument.getValueNoNull("TrnxAmount"));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
}
|
|
this.TrnxDate = aXMLDocument.getValueNoNull("TrnxDate");
|
|
this.TrnxTime = aXMLDocument.getValueNoNull("TrnxTime");
|
|
this.OrginalTrnxSN = aXMLDocument.getValueNoNull("OrginalTrnxSN");
|
|
this.OrginalFreezeNo = aXMLDocument.getValueNoNull("OrginalFreezeNo");
|
|
this.AccountNo = aXMLDocument.getValueNoNull("AccountNo");
|
|
this.AccountName = aXMLDocument.getValueNoNull("AccountName");
|
|
this.AccountBank = aXMLDocument.getValueNoNull("AccountBank");
|
|
this.AccountDBNo = aXMLDocument.getValueNoNull("AccountDBNo");
|
|
this.AccountDBName = aXMLDocument.getValueNoNull("AccountDBName");
|
|
this.AccountDBBank = aXMLDocument.getValueNoNull("AccountDBBank");
|
|
this.ResultNotifyURL = aXMLDocument.getValueNoNull("ResultNotifyURL");
|
|
this.MerchantRemarks = aXMLDocument.getValueNoNull("MerchantRemarks");
|
|
}
|
|
|
|
protected internal override void checkRequest()
|
|
{
|
|
if (this.iTrnxInfo == null)
|
|
{
|
|
throw new TrxException("1100", "商户提交的交易资料不完整", "未设定交易详细信息!");
|
|
}
|
|
if (this.iCorporationCustomerNo == null)
|
|
{
|
|
throw new TrxException("1100", "商户提交的交易资料不完整", "未设定企业客户代码!");
|
|
}
|
|
if (this.iMerchantTrnxNo == null)
|
|
{
|
|
throw new TrxException("1100", "商户提交的交易资料不完整", "未设定商户交易编号!");
|
|
}
|
|
if (this.iTrnxAmount <= 0.0)
|
|
{
|
|
throw new TrxException("1100", "商户提交的交易资料不完整", "未设定交易金额!");
|
|
}
|
|
if (this.iTrnxDate == null)
|
|
{
|
|
throw new TrxException("1100", "商户提交的交易资料不完整", "未设定交易日期!");
|
|
}
|
|
if (this.iTrnxTime == null)
|
|
{
|
|
throw new TrxException("1100", "商户提交的交易资料不完整", "未设定交易时间!");
|
|
}
|
|
if (this.iOrginalTrnxSN == null)
|
|
{
|
|
throw new TrxException("1100", "商户提交的交易资料不完整", "未设定交易流水号!");
|
|
}
|
|
if (this.iOrginalFreezeNo == null)
|
|
{
|
|
throw new TrxException("1100", "商户提交的交易资料不完整", "未设定原冻结序号!");
|
|
}
|
|
if (this.iAccountNo == null)
|
|
{
|
|
throw new TrxException("1100", "商户提交的交易资料不完整", "未设定付款方账号!");
|
|
}
|
|
if (this.iAccountName == null)
|
|
{
|
|
throw new TrxException("1100", "商户提交的交易资料不完整", "未设定付款方账户名!");
|
|
}
|
|
if (this.iAccountBank == null)
|
|
{
|
|
throw new TrxException("1100", "商户提交的交易资料不完整", "未设定付款方账户开户行!");
|
|
}
|
|
if (this.iAccountDBNo == null)
|
|
{
|
|
throw new TrxException("1100", "商户提交的交易资料不完整", "未设定收款方账号!");
|
|
}
|
|
if (this.iAccountDBName == null)
|
|
{
|
|
throw new TrxException("1100", "商户提交的交易资料不完整", "未设定收款方账户名!");
|
|
}
|
|
if (this.iAccountDBBank == null)
|
|
{
|
|
throw new TrxException("1100", "商户提交的交易资料不完整", "未设定收款方账户开户行!");
|
|
}
|
|
if (this.iResultNotifyURL == null)
|
|
{
|
|
throw new TrxException("1100", "商户提交的交易资料不完整", "未设定交易结果回传网址!");
|
|
}
|
|
if (!this.iTrnxInfo.Valid)
|
|
{
|
|
throw new TrxException("1101", "商户提交的交易资料不合法", "交易详细信息不合法!");
|
|
}
|
|
if (this.iCorporationCustomerNo.Length == 0)
|
|
{
|
|
throw new TrxException("1101", "商户提交的交易资料不合法", "企业客户代码不合法!");
|
|
}
|
|
if (SupportClass.ToSByteArray(SupportClass.ToByteArray(this.iCorporationCustomerNo)).Length > 100)
|
|
{
|
|
throw new TrxException("1101", "商户提交的交易资料不合法", "企业客户代码不合法!");
|
|
}
|
|
if (this.iMerchantTrnxNo.Length == 0)
|
|
{
|
|
throw new TrxException("1101", "商户提交的交易资料不合法", "商户交易编号不合法!");
|
|
}
|
|
if (SupportClass.ToSByteArray(SupportClass.ToByteArray(this.iMerchantTrnxNo)).Length > 20)
|
|
{
|
|
throw new TrxException("1101", "商户提交的交易资料不合法", "商户交易编号不合法!");
|
|
}
|
|
if (this.iOrginalTrnxSN.Length == 0)
|
|
{
|
|
throw new TrxException("1101", "商户提交的交易资料不合法", "交易流水号不合法!");
|
|
}
|
|
if (SupportClass.ToSByteArray(SupportClass.ToByteArray(this.iOrginalTrnxSN)).Length > 20)
|
|
{
|
|
throw new TrxException("1101", "商户提交的交易资料不合法", "交易流水号不合法!");
|
|
}
|
|
if (this.iOrginalFreezeNo.Length == 0)
|
|
{
|
|
throw new TrxException("1101", "商户提交的交易资料不合法", "原冻结序号不合法!");
|
|
}
|
|
if (SupportClass.ToSByteArray(SupportClass.ToByteArray(this.iOrginalFreezeNo)).Length > 6)
|
|
{
|
|
throw new TrxException("1101", "商户提交的交易资料不合法", "原冻结序号不合法!");
|
|
}
|
|
if (this.iAccountNo.Length == 0)
|
|
{
|
|
throw new TrxException("1101", "商户提交的交易资料不合法", "付款方账号不合法!");
|
|
}
|
|
if (SupportClass.ToSByteArray(SupportClass.ToByteArray(this.iAccountNo)).Length > 20)
|
|
{
|
|
throw new TrxException("1101", "商户提交的交易资料不合法", "付款方账号不合法!");
|
|
}
|
|
if (this.iAccountName.Length == 0)
|
|
{
|
|
throw new TrxException("1101", "商户提交的交易资料不合法", "付款方账户名不合法!");
|
|
}
|
|
if (SupportClass.ToSByteArray(SupportClass.ToByteArray(this.iAccountName)).Length > 50)
|
|
{
|
|
throw new TrxException("1101", "商户提交的交易资料不合法", "付款方账户名不合法!");
|
|
}
|
|
if (this.iAccountBank.Length == 0)
|
|
{
|
|
throw new TrxException("1101", "商户提交的交易资料不合法", "付款方账户开户行不合法!");
|
|
}
|
|
if (SupportClass.ToSByteArray(SupportClass.ToByteArray(this.iAccountBank)).Length > 50)
|
|
{
|
|
throw new TrxException("1101", "商户提交的交易资料不合法", "付款方账户开户行不合法!");
|
|
}
|
|
if (this.iAccountDBNo.Length == 0)
|
|
{
|
|
throw new TrxException("1101", "商户提交的交易资料不合法", "收款方账号不合法!");
|
|
}
|
|
if (SupportClass.ToSByteArray(SupportClass.ToByteArray(this.iAccountDBNo)).Length > 20)
|
|
{
|
|
throw new TrxException("1101", "商户提交的交易资料不合法", "收款方账号不合法!");
|
|
}
|
|
if (this.iAccountDBName.Length == 0)
|
|
{
|
|
throw new TrxException("1101", "商户提交的交易资料不合法", "收款方账户名不合法!");
|
|
}
|
|
if (SupportClass.ToSByteArray(SupportClass.ToByteArray(this.iAccountDBName)).Length > 50)
|
|
{
|
|
throw new TrxException("1101", "商户提交的交易资料不合法", "收款方账户名不合法!");
|
|
}
|
|
if (this.iAccountDBBank.Length == 0)
|
|
{
|
|
throw new TrxException("1101", "商户提交的交易资料不合法", "收款方账户开户行不合法!");
|
|
}
|
|
if (SupportClass.ToSByteArray(SupportClass.ToByteArray(this.iAccountDBBank)).Length > 50)
|
|
{
|
|
throw new TrxException("1101", "商户提交的交易资料不合法", "收款方账户开户行不合法!");
|
|
}
|
|
if (!DataVerifier.isValidDate(this.iTrnxDate))
|
|
{
|
|
throw new TrxException("1101", "商户提交的交易资料不合法", "交易日期不合法!");
|
|
}
|
|
if (!DataVerifier.isValidTime(this.iTrnxTime))
|
|
{
|
|
throw new TrxException("1101", "商户提交的交易资料不合法", "交易时间不合法!");
|
|
}
|
|
if (!DataVerifier.isValidAmount(this.iTrnxAmount, 2))
|
|
{
|
|
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", "商户提交的交易资料不合法", "商户备注信息不合法!");
|
|
}
|
|
}
|
|
|
|
protected internal override TrxResponse constructResponse(XMLDocument aResponseMessage)
|
|
{
|
|
return new TrxResponse(aResponseMessage);
|
|
}
|
|
|
|
public virtual string AccountBank
|
|
{
|
|
get
|
|
{
|
|
return this.iAccountBank;
|
|
}
|
|
set
|
|
{
|
|
this.iAccountBank = value.Trim();
|
|
}
|
|
}
|
|
|
|
public virtual string AccountDBBank
|
|
{
|
|
get
|
|
{
|
|
return this.iAccountDBBank;
|
|
}
|
|
set
|
|
{
|
|
this.iAccountDBBank = value.Trim();
|
|
}
|
|
}
|
|
|
|
public virtual string AccountDBName
|
|
{
|
|
get
|
|
{
|
|
return this.iAccountDBName;
|
|
}
|
|
set
|
|
{
|
|
this.iAccountDBName = value.Trim();
|
|
}
|
|
}
|
|
|
|
public virtual string AccountDBNo
|
|
{
|
|
get
|
|
{
|
|
return this.iAccountDBNo;
|
|
}
|
|
set
|
|
{
|
|
this.iAccountDBNo = value.Trim();
|
|
}
|
|
}
|
|
|
|
public virtual string AccountName
|
|
{
|
|
get
|
|
{
|
|
return this.iAccountName;
|
|
}
|
|
set
|
|
{
|
|
this.iAccountName = value.Trim();
|
|
}
|
|
}
|
|
|
|
public virtual string AccountNo
|
|
{
|
|
get
|
|
{
|
|
return this.iAccountNo;
|
|
}
|
|
set
|
|
{
|
|
this.iAccountNo = value.Trim();
|
|
}
|
|
}
|
|
|
|
public virtual string CorporationCustomerNo
|
|
{
|
|
get
|
|
{
|
|
return this.iCorporationCustomerNo;
|
|
}
|
|
set
|
|
{
|
|
this.iCorporationCustomerNo = value.Trim();
|
|
}
|
|
}
|
|
|
|
public virtual string MerchantRemarks
|
|
{
|
|
get
|
|
{
|
|
return this.iMerchantRemarks;
|
|
}
|
|
set
|
|
{
|
|
this.iMerchantRemarks = value.Trim();
|
|
}
|
|
}
|
|
|
|
public virtual string MerchantTrnxNo
|
|
{
|
|
get
|
|
{
|
|
return this.iMerchantTrnxNo;
|
|
}
|
|
set
|
|
{
|
|
this.iMerchantTrnxNo = value.Trim();
|
|
}
|
|
}
|
|
|
|
public virtual string OrginalFreezeNo
|
|
{
|
|
get
|
|
{
|
|
return this.iOrginalFreezeNo;
|
|
}
|
|
set
|
|
{
|
|
this.iOrginalFreezeNo = value.Trim();
|
|
}
|
|
}
|
|
|
|
public virtual string OrginalTrnxSN
|
|
{
|
|
get
|
|
{
|
|
return this.iOrginalTrnxSN;
|
|
}
|
|
set
|
|
{
|
|
this.iOrginalTrnxSN = value.Trim();
|
|
}
|
|
}
|
|
|
|
protected internal override XMLDocument RequestMessage
|
|
{
|
|
get
|
|
{
|
|
StringBuilder builder = new StringBuilder();
|
|
builder.Append("<Corporation>").Append("<CorporationCustomerNo>" + this.iCorporationCustomerNo + "</CorporationCustomerNo>").Append("</Corporation>").Append("<TrxRequest>").Append("<TrxType>PartFreezeTransfer</TrxType>").Append("<MerchantTrnxNo>" + this.iMerchantTrnxNo + "</MerchantTrnxNo>").Append("<TrnxAmount>" + DataVerifier.Double2String(this.iTrnxAmount) + "</TrnxAmount>").Append("<TrnxDate>" + this.iTrnxDate + "</TrnxDate>").Append("<TrnxTime>" + this.iTrnxTime + "</TrnxTime>").Append("<OrginalTrnxSN>" + this.iOrginalTrnxSN + "</OrginalTrnxSN>").Append("<OrginalFreezeNo>" + this.iOrginalFreezeNo + "</OrginalFreezeNo>").Append("<Account>").Append("<AccountNo>" + this.iAccountNo + "</AccountNo>").Append("<AccountName>" + this.iAccountName + "</AccountName>").Append("<AccountBank>" + this.iAccountBank + "</AccountBank>").Append("</Account>").Append("<AccountDB>").Append("<AccountDBNo>" + this.iAccountDBNo + "</AccountDBNo>").Append("<AccountDBName>" + this.iAccountDBName + "</AccountDBName>").Append("<AccountDBBank>" + this.iAccountDBBank + "</AccountDBBank>").Append("</AccountDB>").Append(this.iTrnxInfo.XMLDocument.ToString()).Append("<ResultNotifyURL>" + this.iResultNotifyURL + "</ResultNotifyURL>").Append("<MerchantRemarks>" + this.iMerchantRemarks + "</MerchantRemarks>").Append("</TrxRequest>");
|
|
return new XMLDocument(builder.ToString());
|
|
}
|
|
}
|
|
|
|
public virtual string ResultNotifyURL
|
|
{
|
|
get
|
|
{
|
|
return this.iResultNotifyURL;
|
|
}
|
|
set
|
|
{
|
|
this.iResultNotifyURL = value.Trim();
|
|
}
|
|
}
|
|
|
|
public virtual double TrnxAmount
|
|
{
|
|
get
|
|
{
|
|
return this.iTrnxAmount;
|
|
}
|
|
set
|
|
{
|
|
this.iTrnxAmount = value;
|
|
}
|
|
}
|
|
|
|
public virtual string TrnxDate
|
|
{
|
|
get
|
|
{
|
|
return this.iTrnxDate;
|
|
}
|
|
set
|
|
{
|
|
this.iTrnxDate = value.Trim();
|
|
}
|
|
}
|
|
|
|
public virtual com.hitrust.b2b.trustpay.client.b2b.TrnxInfo TrnxInfo
|
|
{
|
|
get
|
|
{
|
|
return this.iTrnxInfo;
|
|
}
|
|
set
|
|
{
|
|
this.iTrnxInfo = value;
|
|
}
|
|
}
|
|
|
|
public virtual string TrnxTime
|
|
{
|
|
get
|
|
{
|
|
return this.iTrnxTime;
|
|
}
|
|
set
|
|
{
|
|
this.iTrnxTime = value.Trim();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|