Beispiel #1
0
        /// <summary>
        /// 获取银联支付信息
        /// </summary>
        /// <param name="request"></param>
        /// <param name="isPrePay">是否预授权支付</param>
        /// <returns></returns>
        private AppResponse <string> GetUnionpayPayParameterCore(GetPayStringRequest request, bool isPrePay)
        {
            AppResponse <string> response = new AppResponse <string>();
            string paymentNo = Guid.NewGuid().ToString();
            //获取订单价格(业务可通过订单号获取)
            decimal payAmount = 0.01m;
            string  payParam  = "";
            //支付参数串
            UniionpayResult payResult = UnionpayUtils.GetPayString(paymentNo, "支付订单-[" + request.OrderNo + "]", payAmount, isPrePay, out payParam);

            if (payResult.respcode != "00")
            {
                response.MsgCode = "10012";
                if (!string.IsNullOrEmpty(payResult.respMsg))
                {
                    response.MsgContent = payResult.respMsg;
                }
                return(response);
            }

            //添加待支付的付款记录
            PaymentRecordInfo payment = new PaymentRecordInfo()
            {
                ID           = Guid.NewGuid().ToString(),
                PaymentNo    = paymentNo,
                OrderNo      = request.OrderNo,
                PayParameter = payParam,
                PayAmount    = payAmount,
                PayChannel   = PayChannelConst.Unionpay,
                PayStatus    = PaymentStatusConst.WaitPay,
                IsPaid       = false,
                CreateTime   = DateTime.Now
            };

            //OrderService.Insert<PaymentRecordInfo>(payment)
            if (true)
            {
                response.IsOk       = true;
                response.MsgCode    = "10000";
                response.ReturnData = payResult.tn;
                return(response);
            }
            else
            {
                return(response);
            }
        }
Beispiel #2
0
        public AppResponse <string> GetAlipayPayParameter(GetPayStringRequest request)
        {
            AppResponse <string> response = new AppResponse <string>();
            //生成业务付款单号
            string paymentNo = DateTime.Now.ToString("yyyyMMddHHmmsss");
            //获取订单价格(业务可通过订单号获取)
            decimal payAmount = 0.01m;
            //支付参数串
            string payString = AlipayUtils.GetPayString(paymentNo, "支付订单", "支付订单-[" + request.OrderNo + "]", payAmount);

            if (string.IsNullOrEmpty(payString))
            {
                response.MsgCode = "10001";
                return(response);
            }

            //添加待支付的付款记录
            PaymentRecordInfo payment = new PaymentRecordInfo()
            {
                ID           = Guid.NewGuid().ToString(),
                PaymentNo    = paymentNo,
                OrderNo      = request.OrderNo,
                PayParameter = payString,
                PayAmount    = payAmount,
                PayChannel   = PayChannelConst.WeixinPay,
                PayStatus    = PaymentStatusConst.WaitPay,
                IsPaid       = false,
                CreateTime   = DateTime.Now
            };

            //Insert<PaymentRecordInfo>(payment);
            if (true)
            {
                response.IsOk       = true;
                response.MsgCode    = "10000";
                response.ReturnData = payString;
                return(response);
            }
            return(response);
        }
Beispiel #3
0
 public AppResponse <string> GetUnionpayPayParameter(GetPayStringRequest request)
 {
     return(GetUnionpayPayParameterCore(request, false));
 }
Beispiel #4
0
        public AppResponse <SortedDictionary <string, object> > GetWeixinPayParameter(GetPayStringRequest request)
        {
            AppResponse <SortedDictionary <string, object> > response = new AppResponse <SortedDictionary <string, object> >();
            string paymentNo = Guid.NewGuid().ToString();
            //获取订单价格(业务可通过订单号获取)
            decimal payAmount = 0.01m;
            string  payParam  = "";
            //支付参数串
            SortedDictionary <string, object> payString = WxPayUtils.GetAppPayString(paymentNo, "支付订单", "支付订单-[" + request.OrderNo + "]", payAmount * 100, out payParam);

            if (payString == null || payString.Count == 0)
            {
                response.MsgCode = "10001";
                return(response);
            }

            //添加待支付的付款记录
            PaymentRecordInfo payment = new PaymentRecordInfo()
            {
                ID           = Guid.NewGuid().ToString(),
                PaymentNo    = paymentNo,
                OrderNo      = request.OrderNo,
                PayParameter = payParam,
                PayAmount    = payAmount,
                PayChannel   = PayChannelConst.WeixinPay,
                PayStatus    = PaymentStatusConst.WaitPay,
                IsPaid       = false,
                CreateTime   = DateTime.Now
            };

            //OrderService.Insert<PaymentRecordInfo>(payment)
            if (true)
            {
                response.IsOk       = true;
                response.MsgCode    = "10000";
                response.ReturnData = payString;
                return(response);
            }
            else
            {
                return(response);
            }
        }