using System; using BWP.ABCClient.Businesses.Type; using BWP.ABCClient.Exceptions; using BWP.ABCClient.Market; namespace BWP.ABCClient.Businesses { public class MarketSignUp : BusinessBase { public MarketSignUp() : base(BusinessTypes.Market) { RequestObj = SignUpRequest.New(); NeedTwoCheck = null; } public string MerchantName { get; set; } public string CustomerSignInfo { get; set; } public string CustomerName { get; set; } public string NeedTwoCheck { get; set; } protected override void AfterRequest() { var errorMessage = ResponseObj.Message.Control.ReturnMessage ?? string.Empty + ResponseObj.Message.Control.ErrorMessage ?? string.Empty; Log.AddNewLine(string.Format("交易结果:[{0}]", ResponseObj.Message.Control.ReturnCode)); Log.AddNewLine(string.Format("返回信息:[{0}]", errorMessage)); if (ResponseObj.Message.Control.ReturnCode != "0000") { Log.Commit(); throw new ResponseException(ResponseObj.Message.Control.ReturnCode, errorMessage + MsgUtil.MsgToBareXml(RequestObj)); } Log.Commit(); } protected override void BeforeRequest() { if (string.IsNullOrEmpty(SequenceNo)) { throw new Exception("交易流水号不能为空,SequenceNo"); } if (string.IsNullOrEmpty(CustomerSignInfo)) { throw new Exception("客户签名不能为空,CustmerSignInfo"); } if (string.IsNullOrEmpty(MerchantName)) { throw new Exception("商户名不能为空,MerchantName"); } RequestObj.Message.Control.MerchantID = MerchantID; RequestObj.Message.Control.MerchantTrxNo = SequenceNo; RequestObj.Message.Parameters.CustName = CustomerName; RequestObj.Message.Parameters.CustSignInfo = CustomerSignInfo; RequestObj.Message.Parameters.NeedTwoCheck = NeedTwoCheck; RequestObj.Message.Parameters.MerchantName = MerchantName; } } }