示例#1
0
        public static string Notify(ColoPay.Model.Pay.Order orderInfo)
        {
            //进行异步通知了,说明是已经支付成功了。
            orderInfo.PaymentStatus = 2;
            var           request = (HttpWebRequest)WebRequest.Create(orderInfo.AppNotifyUrl);
            StringBuilder builder = new StringBuilder();

            builder.Append(CreateField("appid", orderInfo.AppId));
            builder.Append(CreateField("secrit", orderInfo.AppSecrit));
            builder.Append(CreateField("order_no", orderInfo.EnterOrder));
            builder.Append(CreateField("amount", orderInfo.Amount.ToString()));
            builder.Append(CreateField("sdorder_no", orderInfo.OrderCode));
            builder.Append(CreateField("paytype", orderInfo.PaymentGateway));
            builder.Append(CreateField("status", orderInfo.PaymentStatus.ToString()));
            string postData = builder.ToString().Substring(1);
            var    data     = Encoding.UTF8.GetBytes(postData);

            request.Method        = "POST";
            request.ContentType   = "application/x-www-form-urlencoded";
            request.ContentLength = data.Length;
            using (var stream = request.GetRequestStream())
            {
                stream.Write(data, 0, data.Length);
            }
            var    response       = (HttpWebResponse)request.GetResponse();
            string responseString = new System.IO.StreamReader(response.GetResponseStream()).ReadToEnd();

            if (responseString == "success")//如果是返回成功,则说明已经异步通知了,需要更新本地的订单状态
            {
                ColoPay.BLL.Pay.Order orderBll = new ColoPay.BLL.Pay.Order();
                //更新同步状态
                orderBll.HasNotify(orderInfo.OrderId);
            }
            return(responseString);
        }
示例#2
0
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        //public DataSet GetList(int PageSize,int PageIndex,string strWhere)
        //{
        //return dal.GetList(PageSize,PageIndex,strWhere);
        //}

        #endregion  BasicMethod
        #region  ExtensionMethod
        public bool AgentBalance(ColoPay.Model.Pay.Order orderInfo)
        {
            if (orderInfo.Agentd <= 0)
            {
                return(false);
            }
            //获取代理商的费率比例
            ColoPay.BLL.Pay.AgentPayFee     feeBll     = new AgentPayFee();
            ColoPay.Model.Pay.AgentPayFee   payFeeInfo = feeBll.GetModel(orderInfo.Agentd, orderInfo.PaymentTypeId);
            ColoPay.Model.Pay.BalanceDetail detail     = new Model.Pay.BalanceDetail();
            if (payFeeInfo != null)
            {
                detail.AgentId      = orderInfo.Agentd;
                detail.PaymentFee   = orderInfo.Amount * (orderInfo.FeeRate - payFeeInfo.FeeRate) / 100;
                detail.Amount       = detail.Amount;
                detail.OrderAmount  = detail.PaymentFee;
                detail.CreatedTime  = DateTime.Now;
                detail.EnterpriseID = orderInfo.EnterpriseID;
                detail.Type         = 1;
                detail.PayType      = 0;
                detail.OriginalId   = orderInfo.OrderId;
                detail.OriginalCode = orderInfo.OrderCode;
            }
            return(dal.AgentBalance(detail));
        }
示例#3
0
文件: Order.cs 项目: dmhai/ColoPay
        public bool CompleteOrder(ColoPay.Model.Pay.Order orderInfo)
        {
            bool isSuccess = dal.CompleteOrder(orderInfo);

            if (orderInfo.Agentd > 0)//处理代理商佣金
            {
                ColoPay.BLL.Pay.BalanceDetail detailBll = new BalanceDetail();
                detailBll.AgentBalance(orderInfo);
            }
            return(isSuccess);
        }
示例#4
0
文件: Order.cs 项目: dmhai/ColoPay
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(ColoPay.Model.Pay.Order model)
 {
     return(dal.Update(model));
 }
示例#5
0
文件: Order.cs 项目: dmhai/ColoPay
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(ColoPay.Model.Pay.Order model)
 {
     return(dal.Add(model));
 }