Ejemplo n.º 1
0
        /// <summary>
        /// 联锁端请求微信支付的结果
        /// </summary>
        /// <param name="dicPar"></param>
        public void UpdateWxPay(Dictionary <string, object> dicPar)
        {
            bllTB_BillPay bllPay = new bllTB_BillPay();
            //要检测的参数信息
            List <string> pra = new List <string>()
            {
                "buscode", "stocode", "payno"
            };

            //检测方法需要的参数
            if (!CheckActionParameters(dicPar, pra))
            {
                return;
            }
            //获取参数信息
            string GUID    = "";
            string USER_ID = "";
            string BusCode = dicPar["buscode"].ToString();
            string StoCode = dicPar["stocode"].ToString();
            string PKCode  = dicPar["payno"].ToString();

            TB_BillPayEntity UEntity = bllPay.GetEntitySigInfo(" where pkcode='" + PKCode + "'");

            UEntity.TStatus = "1";
            bllPay.Update(GUID, USER_ID, UEntity);
            string type = bllPay.oResult.Code;

            if (type != "1")
            {
                ErrorLog.WriteErrorMessage(ErrorLog.LogType.baselog, "支付单号:" + PKCode + "支付回调失败");
            }
            ReturnResultJson(bll.oResult.Code, bll.oResult.Msg);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 取消支付
        /// </summary>
        /// <param name="dicPar"></param>
        public void CancelPay(Dictionary <string, object> dicPar)
        {
            //要检测的参数信息
            List <string> pra = new List <string>()
            {
                "key", "buscode", "stocode", "billcode", "memcode"
            };

            //检测方法需要的参数
            if (!CheckActionParameters(dicPar, pra))
            {
                return;
            }
            string buscode  = dicPar["buscode"].ToString();
            string stocode  = dicPar["stocode"].ToString();
            string billcode = dicPar["billcode"].ToString();
            string memcode  = dicPar["memcode"].ToString();
            //检查账单的状态,是否能进行反结
            TB_BillEntity billEntity = new bllTB_Bill().GetEntitySigInfo(" where PKCode='" + billcode + "' and StoCode='" + stocode + "'");

            if (billEntity == null || billEntity.TStatus != "2")
            {
                ReturnResultJson("1", "账单无法取消支付!");
                return;
            }
            //获取改账单的支付方式
            int       nums      = 0;
            string    filter    = " where BillCode='" + billcode + "' and PayMethodCode='7'  and TStatus='1' ";
            DataTable dtBillPay = new bllTB_BillPay().GetPagingListInfo("", "", int.MaxValue, 1, filter, "", out nums, out nums);
            //反结
            string msg = "反结成功";

            if (dtBillPay != null && dtBillPay.Rows.Count > 0)
            {
                foreach (DataRow dr in dtBillPay.Rows)
                {
                    string PKCode        = "";
                    string PayMoney      = dr["PayMoney"].ToString();
                    string Remar         = dr["Remar"].ToString();
                    string OutOrderCode  = "";
                    string PPKCode       = dr["PKCode"].ToString();
                    string PayMethodCode = "";
                    string memcard       = dr["MemberCard"].ToString();

                    new bllTB_BillPay().Back("", "", buscode, stocode, memcode, "小程序", "2", out PKCode, PayMoney, Remar, out OutOrderCode, PPKCode, out PayMethodCode);
                    if (PKCode.Length > 4)
                    {
                        string        MemUrl     = Helper.GetAppSettings("ServiceUrl") + "/memcardpay/memcardreturn.ashx";
                        StringBuilder memPostStr = new StringBuilder();
                        memPostStr.Append("actionname=cardpayreturnnew&parameters={" +
                                          string.Format("'GUID':'{0}'", memcode) +
                                          string.Format(",'USER_ID': '{0}'", memcode) +
                                          string.Format(",'buscode': '{0}'", buscode) +      //商户编号
                                          string.Format(",'stocode': '{0}'", stocode) +      //门店编号
                                          string.Format(",'terminalType': '{0}'", "App") +   //终端编号
                                          string.Format(",'ucode': '{0}'", memcode) +        //操作人编号
                                          string.Format(",'uname': '{0}'", "小程序") +          //操作人姓名
                                          string.Format(",'paycode': '{0}'", billcode) +     //主支付编号
                                          string.Format(",'vicepaycode': '{0}'", PKCode) +   //副支付编号
                                          string.Format(",'rvicepaycode': '{0}'", PPKCode) + //待反结副支付编号
                                          string.Format(",'couponcode': '{0}'", "") +        //优惠券编号(多个以英文逗号分隔)
                                          string.Format(",'cardcode': '{0}'", memcard) +     //卡号
                                          string.Format(",'expend': '{0}'", PayMoney) +      //消费金额
                                          string.Format(",'isopen': '{0}'", "0") +           //是否开票
                                          string.Format(",'invamount': '{0}'", "0") +        //开票金额
                                          string.Format(",'addint': '{0}'", "0") +           //可积积分
                                          string.Format(",'deductionint': '{0}'", "0") +     //抵扣积分
                                          "}");                                              //键值对
                        string memResultJson = Helper.HttpWebRequestByURL(MemUrl, memPostStr.ToString());
                        string memPayStatus  = JsonHelper.GetJsonValByKey(memResultJson, "status");
                        if (memPayStatus != "0")
                        {
                            msg = "有支付反结失败,请重试";
                            new bllTB_BillPay().Delete(memcode, memcode, PKCode, stocode);
                            break;
                        }
                    }
                }
            }
            RefreshBill(billcode, stocode, msg);
        }