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.
 

51 lines
1.7 KiB

using System;
using BWP.ABCClient.Businesses.Type;
using BWP.ABCClient.Exceptions;
using BWP.ABCClient.Market;
namespace BWP.ABCClient.Businesses
{
public class MarketSignOff : BusinessBase<SignOffRequest, MarketResponse>
{
public MarketSignOff() : base(BusinessTypes.Market)
{
RequestObj = SignOffRequest.New();
}
public string MerchantName { get; set; }
public string CustomerSignInfo { get; set; }
public string CustomerName { get; set; }
public string CustomerNo { 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);
}
Log.Commit();
}
protected override void BeforeRequest()
{
if (string.IsNullOrEmpty(SequenceNo)) {
throw new Exception("交易流水号不能为空,SequenceNo");
}
if (string.IsNullOrEmpty(CustomerSignInfo)) {
throw new Exception("客户签名不能为空,CustmerSignInfo");
}
RequestObj.Message.Control.MerchantID = MerchantID;
RequestObj.Message.Control.MerchantTrxNo = SequenceNo;
RequestObj.Message.Parameters.CustName = CustomerName;
RequestObj.Message.Parameters.CustSignInfo = CustomerSignInfo;
RequestObj.Message.Parameters.MerchantName = MerchantName;
RequestObj.Message.Parameters.CustomerNo = CustomerNo;
}
}
}