public object BackgroundPayment([FromBody] BackgroundPaymentRequest requestParams) { var pay = PaymentFactory.Factory( requestParams.CID, requestParams.StoreId, requestParams.MachineSn, requestParams.DeviceSn, requestParams.Mode, new PayDetails() { CardNo = requestParams.CardNo, CardPassword = requestParams.CardPassword, Amount = requestParams.Amount }, requestParams.Amount); if (pay is IBackgroundPayment) { return(((IBackgroundPayment)pay).RequestPay()); } else if (pay is IBackgroundPaymentWithoutWait) { return(((IBackgroundPaymentWithoutWait)pay).RequestPay()); } return(null); }
private object DoPay(int companyId, string storeId, string machineSn, string deviceSn, string orderSn, PayRequest requestParams, DateTime createDt, Action <IPay> callback) { PayMode payMode; if (requestParams.Payway.Count() > 1) { payMode = PayMode.Multiply; } else { payMode = (PayMode)requestParams.Payway.FirstOrDefault().Type; } List <PayDetails> payway = new List <PayDetails>(); IPay pay; foreach (var item in requestParams.Payway) { payway.Add(new PayDetails() { Amount = item.Amount, ApiOrderSn = item.PayOrderSn, PaySn = orderSn, CardNo = item.CardNo, WipeZero = item.WipeZero, Change = item.Change, Receive = item.Receive, CreateDt = createDt, Mode = (PayMode)item.Type }); } pay = PaymentFactory.Factory(companyId, storeId, machineSn, deviceSn, payMode, payway, requestParams.Receivable, callback); pay.SavePayInfomactions(); return(createDt); }
public ThirdPartyPaymentStatus GetBackgroundPaymentState([FromBody] BackgroundPaymentRequest requestParams) { var pay = PaymentFactory.Factory( requestParams.CID, requestParams.StoreId, requestParams.MachineSn, requestParams.DeviceSn, requestParams.Mode, new PayDetails() { CardNo = requestParams.CardNo, CardPassword = requestParams.CardPassword, Amount = requestParams.Amount }, requestParams.Amount); if (pay is IBackgroundPayment) { return(((IBackgroundPayment)pay).GetPayStatus()); } return(ThirdPartyPaymentStatus.Unknown); }