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.
 

54 lines
1.9 KiB

using System;
using BWP.ABCClient.Businesses.Type;
using BWP.ABCClient.Exceptions;
using BWP.ABCClient.Market;
namespace BWP.ABCClient.Businesses
{
public class MarketReceivingPayment : BusinessBase<PayRequest, MarketResponse>
{
public MarketReceivingPayment()
: base(BusinessTypes.Market)
{
RequestObj = PayRequest.New();
}
public string CustomerSignInfo { get; set; }
public string CustomerNo { get; set; }
public string OrderMessage { 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("客户签名不能为空,CustomerSignInfo");
}
if (string.IsNullOrEmpty(CustomerNo)) {
throw new Exception("客户号不能为空,CustomerSignInfo");
}
RequestObj.Message.Control.MerchantID = MerchantID;
RequestObj.Message.Control.MerchantTrxNo = SequenceNo;
RequestObj.Message.Parameters.CustomerNo = CustomerNo;
RequestObj.Message.Parameters.CustSignInfo = CustomerSignInfo;
RequestObj.Message.Parameters.CustSignInfo2 = CustomerSignInfo;
RequestObj.Message.Parameters.PayAmount = Amount.ToString("f2");
RequestObj.Message.Parameters.OrderMg = OrderMessage;
}
}
}