Beispiel #1
0
        /// <summary>
        /// 查询申请单支付状态,补单
        /// </summary>
        /// <param name="applyformId"></param>
        /// <returns></returns>
        public string QueryPaymentInfo(decimal applyformId)
        {
            bool paySuccess = false;
            var  applyform  = ApplyformQueryService.QueryApplyform(applyformId) as PostponeApplyform;

            if (applyform == null)
            {
                return("改期申请单不存在");
            }
            if (applyform.Status != PostponeApplyformStatus.Agreed)
            {
                return("OK");
            }
            try
            {
#if (DEBUG)
                var tradeResult = AccountTradeService.PayTradeQuery(applyformId.ToString());
                if (tradeResult == null)
                {
                    return("查询支付信息失败");
                }
                if (tradeResult.Status != PayStatus.PaySuccess)
                {
                    return("没有查询到支付成功信息");
                }
                var paramArray = tradeResult.CustomParameter.Split('|');
                if (paramArray.Length >= 3)
                {
                    var operatorAccount = paramArray[2];
                    ChinaPay.B3B.DataTransferObject.Common.PayInterface   payInterface   = ChinaPay.B3B.Service.Tradement.NotifyService.ParsePayInterface(tradeResult.payInterface);
                    ChinaPay.B3B.DataTransferObject.Common.PayAccountType payAccountType = ChinaPay.B3B.Service.Tradement.NotifyService.ParsePayAccountType(tradeResult.payAccountType);
                    ApplyformProcessService.PostponeFeePaySuccess(
                        applyform.Id,
                        tradeResult.AccountNo,
                        tradeResult.TradeNo,
                        tradeResult.FillChargeId.ToString(),//channelTradeNo
                        tradeResult.PayTime.Value,
                        payInterface,
                        payAccountType,
                        operatorAccount);
                    paySuccess = true;
                }
                LogService.SaveTradementLog(new TradementLog()
                {
                    OrderId     = applyform.OrderId,
                    ApplyformId = applyformId,
                    Type        = TradementBusinessType.SubPay,
                    Request     = string.Empty,
                    Response    = string.Empty,
                    Remark      = "改期支付补单",
                    Time        = DateTime.Now
                });
#else
                QueryPaymentProcess queryPayment = new QueryPaymentProcess(applyformId.ToString());
                if (queryPayment.Execute() && queryPayment.PaySuccess)
                {
                    var paramArray = queryPayment.ExtraParams.Split('|');
                    if (paramArray.Length >= 3)
                    {
                        var operatorAccount = paramArray[2];
                        ApplyformProcessService.PostponeFeePaySuccess(
                            applyform.Id,
                            queryPayment.PayAccount,
                            queryPayment.PayTradeNo,
                            queryPayment.ChannelTradeNo,
                            queryPayment.PayTime,
                            queryPayment.PayChannel,
                            queryPayment.PayAccountType,
                            operatorAccount);
                        paySuccess = true;
                    }
                    LogService.SaveTradementLog(new TradementLog()
                    {
                        OrderId     = applyform.OrderId,
                        ApplyformId = applyformId,
                        Type        = TradementBusinessType.SubPay,
                        Request     = string.Empty,
                        Response    = queryPayment.ExtraParams,
                        Remark      = "改期支付补单",
                        Time        = DateTime.Now
                    });
                }
                else
                {
                    return("查询支付信息失败");
                }
#endif
            }
            catch (Exception ex)
            {
                LogService.SaveExceptionLog(ex, "补单");
                paySuccess = false;
            }
            return(paySuccess?"OK":"ERROR");
        }