|
|
|
@ -6,9 +6,14 @@ using BWP.B3Frameworks.BL; |
|
|
|
using BWP.B3Frameworks.Utils; |
|
|
|
using BWP.B3QingDaoWanFu.BO; |
|
|
|
using BWP.B3QingDaoWanFu.BO.NamedValueTemplate; |
|
|
|
using BWP.B3QingDaoWanFu.Tasks; |
|
|
|
using BWP.B3QingDaoWanFu.Utils; |
|
|
|
using BWP.B3Sale.BL; |
|
|
|
using BWP.B3Sale.BO; |
|
|
|
using BWP.BWPTrustPayClient.TrustPayRequests; |
|
|
|
using Forks.EnterpriseServices.BusinessInterfaces; |
|
|
|
using TSingSoft.WebPluginFramework; |
|
|
|
using TSingSoft.WebPluginFramework.QueueTasks; |
|
|
|
|
|
|
|
namespace BWP.B3QingDaoWanFu.BL { |
|
|
|
[BusinessInterface(typeof(TrustPayBL))] |
|
|
|
@ -16,6 +21,7 @@ namespace BWP.B3QingDaoWanFu.BL { |
|
|
|
long CreateRequest(TrustPay dmo); |
|
|
|
void ABCPayRequest(TrustPay dmo); |
|
|
|
void ABCPaySuccess(TrustPay dmo); |
|
|
|
void CreateGathering(TrustPay dmo, out long gatheringID); |
|
|
|
} |
|
|
|
|
|
|
|
public class TrustPayBL : EntityBL<TrustPay>, ITrustPayBL { |
|
|
|
@ -24,7 +30,7 @@ namespace BWP.B3QingDaoWanFu.BL { |
|
|
|
get { |
|
|
|
var list = base.MinDmoProperties; |
|
|
|
list.Add("PayState"); |
|
|
|
list.Add("Money"); |
|
|
|
list.Add("Money"); |
|
|
|
list.Add("ABCPay_PaymentURL"); |
|
|
|
return list; |
|
|
|
} |
|
|
|
@ -36,7 +42,7 @@ namespace BWP.B3QingDaoWanFu.BL { |
|
|
|
base.doInsert(dmo); |
|
|
|
} |
|
|
|
|
|
|
|
public long CreateRequest(TrustPay dmo) { |
|
|
|
public long CreateRequest(TrustPay dmo) { |
|
|
|
Insert(dmo); |
|
|
|
return dmo.ID; |
|
|
|
} |
|
|
|
@ -49,16 +55,17 @@ namespace BWP.B3QingDaoWanFu.BL { |
|
|
|
req.Money = dmo.Money.Value; |
|
|
|
req.ResultNotifyURL = HttpContext.Current.Request.Url.ToString(); |
|
|
|
req.Time = DateTime.Now; |
|
|
|
//#if DEBUG
|
|
|
|
// req.Money = 0.51m;
|
|
|
|
//#endif
|
|
|
|
|
|
|
|
var res = req.Submit(); |
|
|
|
if (res.IsSuccess) { |
|
|
|
dmo.ABCPay_No = req.OrderNo; |
|
|
|
dmo.ABCPay_PaymentURL = res.PaymentURL; |
|
|
|
dmo.ABCPay_ResultNotifyURL = req.ResultNotifyURL; |
|
|
|
dmo.PayState = 付款状态.请求支付; |
|
|
|
InnerBLUtil.UpdateEntityProperties(Session, dmo, "PayState", "ABCPay_No", "ABCPay_PaymentURL", "ABCPay_ResultNotifyURL"); |
|
|
|
dmo.ReqTime = BLContext.Now; |
|
|
|
dmo.ReCheckTime = BLContext.Now.AddMinutes(2); |
|
|
|
InnerBLUtil.UpdateEntityProperties(Session, dmo, "PayState", "ABCPay_No", "ABCPay_PaymentURL", "ABCPay_ResultNotifyURL", "ReqTime", "ReCheckTime"); |
|
|
|
|
|
|
|
} else { |
|
|
|
throw new Exception(res.ErrorMessage); |
|
|
|
} |
|
|
|
@ -77,15 +84,35 @@ namespace BWP.B3QingDaoWanFu.BL { |
|
|
|
} |
|
|
|
dmo.PayState = 付款状态.付款成功; |
|
|
|
InnerBLUtil.UpdateEntityProperties(Session, dmo, "PayState"); |
|
|
|
AfterFinishPay(dmo); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void AfterFinishPay(TrustPay dmo) { |
|
|
|
|
|
|
|
//创建收款单
|
|
|
|
|
|
|
|
|
|
|
|
public void CreateGathering(TrustPay dmo, out long gatheringID) { |
|
|
|
gatheringID = 0; |
|
|
|
if (dmo.Gathering_ID > 0) |
|
|
|
return; |
|
|
|
if (dmo.PayState != 付款状态.付款成功) |
|
|
|
return; |
|
|
|
var conf = new WanFuOnlineConfig(); |
|
|
|
var bl = BIFactory.Create<IGatheringBL>(Session); |
|
|
|
var ho = InnerBLUtil.GetSingleDmo<Customer>(Session, "ID", dmo.AccountCustomer_ID, "Department_ID", "Employee_ID", "Department_Name", "Employee_Name"); |
|
|
|
var bill = new Gathering { |
|
|
|
GatheringAccount_ID = conf.GatheringAccountID.Value, |
|
|
|
AccountCustomer_ID = dmo.AccountCustomer_ID, |
|
|
|
AccountingUnit_ID = conf.AccID.Value, |
|
|
|
Remark = "手机客户端支付", |
|
|
|
ReceiptType_ID = conf.ReceiptTypeID.Value, |
|
|
|
Department_ID = ho.Department_ID, |
|
|
|
Employee_ID = ho.Employee_ID, |
|
|
|
GatheringTime = BLContext.Now, |
|
|
|
CreateUser_ID = BLContext.User.ID |
|
|
|
}; |
|
|
|
bill.Department_Name = ho.Department_Name; |
|
|
|
bill.Employee_Name = ho.Employee_Name; |
|
|
|
bill.GatheringMoney = dmo.Money; |
|
|
|
bill.Domain_ID = dmo.Domain_ID; |
|
|
|
bl.Insert(bill); |
|
|
|
bl.Check(bill); |
|
|
|
gatheringID = bill.ID; |
|
|
|
} |
|
|
|
} |
|
|
|
} |