Example #1
0
        public void BatchDealException(HttpContext context)
        {
            string idList = context.Request["RefundIds"].ToNullString();

            idList = Globals.GetSafeIDList(idList, ',', true);
            if (string.IsNullOrEmpty(idList))
            {
                throw new HidistroAshxException("请选择要退款的ID");
            }
            IList <RefundInfo> list = OrderHelper.GetRefundListOfRefundIds(idList);

            if (list != null && list.Count > 0)
            {
                string Operator = HiContext.Current.Manager.UserName;
                Task.Factory.StartNew(delegate
                {
                    int num = 0;
                    foreach (RefundInfo item in list)
                    {
                        OrderInfo orderInfo = OrderHelper.GetOrderInfo(item.OrderId);
                        if (orderInfo != null && RefundHelper.IsBackReturn(orderInfo.Gateway) && item.RefundType == RefundTypes.BackReturn && !TradeHelper.AlipayCanRefundGateway.Contains(orderInfo.Gateway) && item.HandleStatus == RefundStatus.Applied)
                        {
                            MemberInfo user = Users.GetUser(orderInfo.UserId);
                            string text     = RefundHelper.SendRefundRequest(orderInfo, item.RefundAmount, item.RefundOrderId, true);
                            if (text == "")
                            {
                                if (OrderHelper.CheckRefund(orderInfo, item, item.RefundAmount, Operator, item.AdminRemark, true, false))
                                {
                                    VShopHelper.AppPushRecordForOrder(orderInfo.OrderId, "", EnumPushOrderAction.OrderRefund);
                                    Messenger.OrderRefund(user, orderInfo, "");
                                }
                                num++;
                            }
                            else
                            {
                                TradeHelper.SaveRefundErr(item.RefundId, text, true);
                            }
                            Thread.Sleep(5000);
                        }
                    }
                    base.ReturnSuccessResult(context, "退款自动处理提交成功,请稍后刷新页面", 0, true);
                });
                return;
            }
            throw new HidistroAshxException("未找到退款记录");
        }
Example #2
0
        private void btnAcceptReturn_Click(object sender, EventArgs e)
        {
            int        num            = this.Page.Request["ReturnId"].ToInt(0);
            string     text           = Globals.StripAllTags(this.txtAdminShipAddress.Text);
            string     adminShipTo    = Globals.StripAllTags(this.txtAdminShipTo.Text);
            string     adminCellPhone = Globals.StripAllTags(this.txtAdminCellPhone.Text);
            ReturnInfo returnInfo     = TradeHelper.GetReturnInfo(num);
            string     adminRemark    = Globals.StripAllTags(this.txtAdminRemark.Text);
            string     text2          = "退货";

            if (returnInfo == null)
            {
                this.ShowMsg("售后信息错误!", false);
            }
            else
            {
                bool flag = false;
                if (returnInfo.AfterSaleType == AfterSaleTypes.OnlyRefund)
                {
                    text2 = "退款";
                    flag  = true;
                }
                string    skuId     = returnInfo.SkuId;
                OrderInfo orderInfo = TradeHelper.GetOrderInfo(returnInfo.OrderId);
                if (orderInfo == null)
                {
                    this.ShowMsg("订单不存在!", false);
                }
                else if (!orderInfo.LineItems.ContainsKey(skuId))
                {
                    this.ShowMsg("订单中不存在要退货的商品!", false);
                }
                else
                {
                    LineItemInfo lineItemInfo = orderInfo.LineItems[skuId];
                    decimal      num2         = default(decimal);
                    if (lineItemInfo.Status != LineItemStatus.ReturnApplied)
                    {
                        this.ShowMsg(text2 + "状态不正确.", false);
                    }
                    else if (!decimal.TryParse(this.txtRefundMoney.Text, out num2))
                    {
                        this.ShowMsg("退款金额需为数字格式!", false);
                    }
                    else if (num2 < decimal.Zero)
                    {
                        this.ShowMsg("退款金额必须大于等于0", false);
                    }
                    else
                    {
                        if (this.UserStoreId != returnInfo.StoreId && returnInfo.StoreId >= 0)
                        {
                            if (flag)
                            {
                                if (orderInfo.IsStoreCollect && this.UserStoreId == 0)
                                {
                                    this.ShowMsg("门店收的款,只能由门店进行退款确认处理!", false);
                                    return;
                                }
                            }
                            else if (this.UserStoreId > 0)
                            {
                                this.ShowMsg("同意" + text2 + "只能由发货的店铺或者平台进行处理!", false);
                                return;
                            }
                        }
                        if (!flag && string.IsNullOrEmpty(text))
                        {
                            this.ShowMsg("请输入平台收货地址,告之用户发货的地址和联系方式", false);
                        }
                        else
                        {
                            GroupBuyInfo groupbuy = null;
                            if (orderInfo.GroupBuyId > 0)
                            {
                                groupbuy = ProductBrowser.GetGroupBuy(orderInfo.GroupBuyId);
                            }
                            decimal canRefundAmount = orderInfo.GetCanRefundAmount(skuId, groupbuy, 0);
                            if (num2 > canRefundAmount)
                            {
                                this.ShowMsg("退款金额不能大于退货订单或者商品的金额!", false);
                            }
                            else if (flag)
                            {
                                RefundTypes refundType = returnInfo.RefundType;
                                string      userRemark = returnInfo.UserRemark;
                                MemberInfo  user       = Users.GetUser(orderInfo.UserId);
                                string      text3      = "";
                                if (RefundHelper.IsBackReturn(orderInfo.Gateway) && returnInfo.RefundType == RefundTypes.BackReturn)
                                {
                                    text3 = RefundHelper.SendRefundRequest(orderInfo, num2, returnInfo.RefundOrderId, false);
                                    if (text3 == "")
                                    {
                                        if (OrderHelper.AgreedReturns(num, num2, adminRemark, orderInfo, returnInfo.SkuId, text, adminShipTo, adminCellPhone, flag, false))
                                        {
                                            if (flag)
                                            {
                                                VShopHelper.AppPushRecordForOrder(orderInfo.OrderId, returnInfo.SkuId, EnumPushOrderAction.OrderReturnConfirm);
                                            }
                                            else
                                            {
                                                VShopHelper.AppPushRecordForOrder(orderInfo.OrderId, returnInfo.SkuId, EnumPushOrderAction.OrderRefund);
                                            }
                                            Messenger.OrderRefund(user, orderInfo, returnInfo.SkuId);
                                            this.ShowMsg("成功的完成退款并且已成功原路退回退款金额!", true, HttpContext.Current.Request.Url.ToString());
                                        }
                                    }
                                    else
                                    {
                                        TradeHelper.SaveRefundErr(num, text3, false);
                                        this.ShowMsg("退款原路返回错误,错误信息" + text3 + ",请重新尝试!", false);
                                    }
                                }
                                else if (OrderHelper.AgreedReturns(num, num2, adminRemark, orderInfo, returnInfo.SkuId, text, adminShipTo, adminCellPhone, flag, returnInfo.RefundType == RefundTypes.InBalance))
                                {
                                    if (flag)
                                    {
                                        VShopHelper.AppPushRecordForOrder(orderInfo.OrderId, returnInfo.SkuId, EnumPushOrderAction.OrderReturnConfirm);
                                    }
                                    else
                                    {
                                        VShopHelper.AppPushRecordForOrder(orderInfo.OrderId, returnInfo.SkuId, EnumPushOrderAction.OrderRefund);
                                    }
                                    Messenger.OrderRefund(user, orderInfo, returnInfo.SkuId);
                                    if (returnInfo.RefundType == RefundTypes.InBalance)
                                    {
                                        this.ShowMsg("成功确定了退款,退款金额已退回用户预付款帐号!", true, HttpContext.Current.Request.Url.ToString());
                                    }
                                    else
                                    {
                                        this.ShowMsg("成功的完成了退款,请即时给用户退款", true, HttpContext.Current.Request.Url.ToString());
                                    }
                                }
                            }
                            else if (OrderHelper.AgreedReturns(num, num2, adminRemark, orderInfo, returnInfo.SkuId, text, adminShipTo, adminCellPhone, flag, false))
                            {
                                VShopHelper.AppPushRecordForOrder(orderInfo.OrderId, returnInfo.SkuId, EnumPushOrderAction.OrderReturnConfirm);
                                this.ShowMsg("成功的确认了售后", true, HttpContext.Current.Request.Url.ToString());
                            }
                            else
                            {
                                this.ShowMsg("确认售后失败!", false);
                            }
                        }
                    }
                }
            }
        }
Example #3
0
        protected void btnAcceptRefund_Click(object sender, EventArgs e)
        {
            bool       flag        = true;
            string     userName    = HiContext.Current.Manager.UserName;
            string     adminRemark = Globals.StripAllTags(this.txtAdminRemark.Text);
            int        refundId    = this.Page.Request.QueryString["RefundId"].ToInt(0);
            RefundInfo refundInfo  = TradeHelper.GetRefundInfo(refundId);

            if (refundInfo == null)
            {
                this.ShowMsg("错误的退款申请信息", false);
            }
            else
            {
                OrderInfo orderInfo = OrderHelper.GetOrderInfo(refundInfo.OrderId);
                if (orderInfo == null)
                {
                    this.ShowMsg("错误的订单信息", false);
                }
                else
                {
                    decimal num = this.txtRefundMoney.Text.ToDecimal(0);
                    if (num < decimal.Zero)
                    {
                        this.ShowMsg("退款金额必须大于等于0", false);
                    }
                    else
                    {
                        if (!refundInfo.IsServiceProduct)
                        {
                            GroupBuyInfo groupbuy = null;
                            if (orderInfo.GroupBuyId > 0)
                            {
                                groupbuy = ProductBrowser.GetGroupBuy(orderInfo.GroupBuyId);
                            }
                            if (num > orderInfo.GetCanRefundAmount("", groupbuy, 0))
                            {
                                this.ShowMsg("退款金额不能大于订单/商品最大金额", false);
                                return;
                            }
                        }
                        else if (num > refundInfo.RefundAmount)
                        {
                            this.ShowMsg("退款金额不能大于可退款总额", false);
                            return;
                        }
                        if (refundInfo.HandleStatus != 0)
                        {
                            this.ShowMsg("退款状态不正确", false);
                        }
                        else if (refundInfo.IsServiceProduct || (!refundInfo.IsServiceProduct && OrderHelper.CanFinishRefund(orderInfo, refundInfo, num, false)))
                        {
                            RefundTypes refundType = refundInfo.RefundType;
                            string      userRemark = refundInfo.UserRemark;
                            MemberInfo  user       = Users.GetUser(orderInfo.UserId);
                            string      text       = "";
                            if (RefundHelper.IsBackReturn(orderInfo.Gateway) && refundInfo.RefundType == RefundTypes.BackReturn)
                            {
                                text = RefundHelper.SendRefundRequest(orderInfo, num, refundInfo.RefundOrderId, true);
                                if (text == "")
                                {
                                    if (OrderHelper.CheckRefund(orderInfo, refundInfo, num, userName, adminRemark, true, false))
                                    {
                                        VShopHelper.AppPushRecordForOrder(orderInfo.OrderId, "", EnumPushOrderAction.OrderRefund);
                                        Messenger.OrderRefund(user, orderInfo, "");
                                        this.ShowMsg("成功的完成退款并且已成功原路退回退款金额!", true, HttpContext.Current.Request.Url.ToString());
                                    }
                                }
                                else
                                {
                                    TradeHelper.SaveRefundErr(refundInfo.RefundId, text, true);
                                    this.ShowMsg("退款原路返回错误,错误信息" + text + ",请重新尝试!", false);
                                }
                            }
                            else if (OrderHelper.CheckRefund(orderInfo, refundInfo, num, userName, adminRemark, true, false))
                            {
                                Messenger.OrderRefund(user, orderInfo, "");
                                VShopHelper.AppPushRecordForOrder(orderInfo.OrderId, "", EnumPushOrderAction.OrderRefund);
                                if (refundInfo.RefundType == RefundTypes.InBalance)
                                {
                                    this.ShowMsg("成功确定了退款,退款金额已退回用户预付款帐号!", true, HttpContext.Current.Request.Url.ToString());
                                }
                                else
                                {
                                    this.ShowMsg("成功的完成了退款,请即时给用户退款", true, HttpContext.Current.Request.Url.ToString());
                                }
                            }
                        }
                    }
                }
            }
        }
        public void ProcessorOrderVerificationItemsExpire()
        {
            StringBuilder stringBuilder = new StringBuilder();

            try
            {
                Database          obj = this.database;
                ProductSaleStatus productSaleStatus = ProductSaleStatus.UnSale;
                object            arg  = productSaleStatus.GetHashCode();
                object            arg2 = DateTime.Now;
                productSaleStatus = ProductSaleStatus.OnSale;
                obj.ExecuteNonQuery(CommandType.Text, string.Format("UPDATE Hishop_StoreProducts SET SaleStatus = {0} WHERE SaleStatus = {2} AND ProductId IN(SELECT ProductId FROM Hishop_Products WHERE ProductType = 1  AND ValidStartDate IS NOT NULL AND ValidEndDate IS NOT NULL AND ValidEndDate <= '{1}')", arg, arg2, productSaleStatus.GetHashCode()));
                StringBuilder stringBuilder2 = stringBuilder;
                productSaleStatus = ProductSaleStatus.UnSale;
                object arg3 = productSaleStatus.GetHashCode();
                object arg4 = DateTime.Now;
                productSaleStatus = ProductSaleStatus.OnSale;
                stringBuilder2.AppendLine(string.Format("UPDATE Hishop_StoreProducts SET SaleStatus = {0} WHERE SaleStatus = {2} AND ProductId IN(SELECT ProductId FROM Hishop_Products WHERE ProductType = 1  AND ValidStartDate IS NOT NULL AND ValidEndDate IS NOT NULL AND ValidEndDate <= '{1}')", arg3, arg4, productSaleStatus.GetHashCode()));
                this.database.ExecuteNonQuery(CommandType.Text, $"DELETE FROM Hishop_StoreSKUs WHERE  ProductId IN(SELECT ProductId FROM Hishop_Products WHERE ProductType = 1  AND ValidStartDate IS NOT NULL AND ValidEndDate IS NOT NULL AND ValidEndDate <= '{DateTime.Now}')");
                stringBuilder.AppendLine($"DELETE FROM Hishop_StoreSKUs WHERE  ProductId IN(SELECT ProductId FROM Hishop_Products WHERE ProductType = 1  AND ValidStartDate IS NOT NULL AND ValidEndDate IS NOT NULL AND ValidEndDate <= '{DateTime.Now}')");
                Database obj2 = this.database;
                productSaleStatus = ProductSaleStatus.UnSale;
                object arg5 = productSaleStatus.GetHashCode();
                object arg6 = DateTime.Now;
                productSaleStatus = ProductSaleStatus.OnSale;
                obj2.ExecuteNonQuery(CommandType.Text, string.Format("UPDATE Hishop_Products SET SaleStatus = {0} WHERE ProductType = 1 AND SaleStatus = {2} AND IsValid = 0 AND ValidStartDate IS NOT NULL AND ValidEndDate IS NOT NULL AND ValidEndDate <= '{1}'", arg5, arg6, productSaleStatus.GetHashCode()));
                StringBuilder stringBuilder3 = stringBuilder;
                productSaleStatus = ProductSaleStatus.UnSale;
                stringBuilder3.AppendLine($"UPDATE Hishop_Products SET SaleStatus = {productSaleStatus.GetHashCode()} WHERE ProductType = 1 AND ValidStartDate IS NOT NULL AND ValidEndDate IS NOT NULL AND ValidEndDate <= '{DateTime.Now}'");
                DbCommand sqlStringCommand = this.database.GetSqlStringCommand("UPDATE Hishop_OrderVerificationItems SET VerificationStatus = " + 3 + " WHERE OrderId IN(SELECT OrderId FROM Hishop_OrderItems WHERE(IsValid = 0 OR IsValid IS NULL)  AND ValidEndDate IS NOT NULL AND ValidEndDate < @Now) AND VerificationStatus = " + 0);
                this.database.AddInParameter(sqlStringCommand, "Now", DbType.DateTime, DateTime.Now);
                this.database.ExecuteNonQuery(sqlStringCommand);
                stringBuilder.AppendLine(string.Format("UPDATE Hishop_OrderVerificationItems SET VerificationStatus = " + 3 + " WHERE OrderId IN(SELECT OrderId FROM Hishop_OrderItems WHERE(IsValid = 0 OR IsValid IS NULL)  AND ValidEndDate IS NOT NULL AND ValidEndDate < '@Now') AND VerificationStatus = " + 0).Replace("@Now", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")));
                StringBuilder stringBuilder4 = new StringBuilder();
                StringBuilder stringBuilder5 = stringBuilder4;
                object[]      obj3           = new object[4];
                OrderStatus   orderStatus    = OrderStatus.Finished;
                obj3[0] = orderStatus.GetHashCode();
                OrderType orderType = OrderType.ServiceOrder;
                obj3[1] = orderType.GetHashCode();
                VerificationStatus verificationStatus = VerificationStatus.Expired;
                obj3[2]     = verificationStatus.GetHashCode();
                orderStatus = OrderStatus.BuyerAlreadyPaid;
                obj3[3]     = orderStatus.GetHashCode();
                stringBuilder5.Append(string.Format("UPDATE Hishop_Orders SET OrderStatus = {0} WHERE OrderStatus = {3} AND OrderType = {1} AND OrderId IN(SELECT OrderId FROM Hishop_OrderItems oi WHERE oi.Quantity = (SELECT COUNT(Id) FROM Hishop_OrderVerificationItems WHERE VerificationStatus =  {2} AND OrderId = oi.OrderId))", obj3));
                StringBuilder stringBuilder6 = stringBuilder4;
                object[]      obj4           = new object[4];
                orderStatus        = OrderStatus.Closed;
                obj4[0]            = orderStatus.GetHashCode();
                orderType          = OrderType.ServiceOrder;
                obj4[1]            = orderType.GetHashCode();
                verificationStatus = VerificationStatus.Expired;
                obj4[2]            = verificationStatus.GetHashCode();
                orderStatus        = OrderStatus.BuyerAlreadyPaid;
                obj4[3]            = orderStatus.GetHashCode();
                stringBuilder6.Append(string.Format("UPDATE Hishop_Orders SET OrderStatus = {0} WHERE OrderStatus = {3} AND OrderType = {1} AND OrderId IN(SELECT OrderId FROM Hishop_OrderItems oi WHERE oi.Quantity = (SELECT COUNT(Id) FROM Hishop_OrderVerificationItems WHERE (VerificationStatus =  {2}) AND OrderId = oi.OrderId AND oi.IsOverRefund = 0))", obj4));
                StringBuilder stringBuilder7 = stringBuilder4;
                object[]      obj5           = new object[6];
                orderStatus        = OrderStatus.Finished;
                obj5[0]            = orderStatus.GetHashCode();
                orderType          = OrderType.ServiceOrder;
                obj5[1]            = orderType.GetHashCode();
                verificationStatus = VerificationStatus.Expired;
                obj5[2]            = verificationStatus.GetHashCode();
                verificationStatus = VerificationStatus.Finished;
                obj5[3]            = verificationStatus.GetHashCode();
                orderStatus        = OrderStatus.BuyerAlreadyPaid;
                obj5[4]            = orderStatus.GetHashCode();
                verificationStatus = VerificationStatus.Refunded;
                obj5[5]            = verificationStatus.GetHashCode();
                stringBuilder7.Append(string.Format("UPDATE Hishop_Orders SET OrderStatus = {0} WHERE OrderStatus = {4} AND OrderType = {1} AND OrderId IN(SELECT OrderId FROM Hishop_OrderItems oi WHERE oi.Quantity = (SELECT COUNT(Id) FROM Hishop_OrderVerificationItems WHERE (VerificationStatus =  {2} OR VerificationStatus =  {3} OR VerificationStatus =  {5}) AND OrderId = oi.OrderId))", obj5));
                stringBuilder.AppendLine(stringBuilder4.ToString());
                this.database.ExecuteNonQuery(CommandType.Text, stringBuilder4.ToString());
                DbCommand sqlStringCommand2 = this.database.GetSqlStringCommand("SELECT oi.Quantity, oi.OrderId,oi.ProductId,StoreId,VerificationStatus,UserName,VerificationPassword FROM [Hishop_OrderItems] oi INNER JOIN Hishop_OrderVerificationItems ov ON ov.OrderId = oi.OrderId  WHERE (IsValid = 0 OR IsValid IS NULL) AND IsOverRefund = 1 AND VerificationStatus =" + 3 + ";");
                stringBuilder.AppendLine("SELECT oi.Quantity, oi.OrderId,oi.ProductId,StoreId,VerificationStatus,UserName FROM [Hishop_OrderItems] oi INNER JOIN Hishop_OrderVerificationItems ov ON ov.OrderId = oi.OrderId  WHERE (IsValid = 0 OR IsValid IS NULL) AND IsOverRefund = 1 AND VerificationStatus =" + 3 + ";");
                using (IDataReader objReader = this.database.ExecuteReader(sqlStringCommand2))
                {
                    IList <VerificationItemsExipreInfo> list = DataHelper.ReaderToList <VerificationItemsExipreInfo>(objReader);
                    if (list != null && list.Count > 0)
                    {
                        List <string> list2 = (from o in list
                                               select o.OrderId).Distinct().ToList();
                        foreach (string item in list2)
                        {
                            OrderInfo orderInfo = OrderHelper.GetOrderInfo(item);
                            if (orderInfo != null)
                            {
                                MemberInfo user = Users.GetUser(orderInfo.UserId);
                                if (user != null)
                                {
                                    IList <VerificationItemsExipreInfo> list3 = (from v in list
                                                                                 where v.OrderId == item
                                                                                 select v).ToList();
                                    decimal    num        = ((decimal)list3.Count * (orderInfo.GetTotal(false) / (decimal)orderInfo.GetBuyQuantity() * 1.0m) * 1.0m).F2ToString("f2").ToDecimal(0);
                                    string     generateId = Globals.GetGenerateId();
                                    RefundInfo refund     = new RefundInfo
                                    {
                                        UserRemark      = "",
                                        RefundReason    = "核销码过期自动退款",
                                        RefundType      = ((orderInfo.Gateway.ToNullString().ToLower() == EnumDescription.GetEnumDescription((Enum)(object)EnumPaymentType.AdvancePay, 1) || orderInfo.BalanceAmount > decimal.Zero) ? RefundTypes.InBalance : RefundTypes.BackReturn),
                                        RefundGateWay   = orderInfo.Gateway,
                                        RefundOrderId   = generateId,
                                        RefundAmount    = num,
                                        StoreId         = orderInfo.StoreId,
                                        ApplyForTime    = DateTime.Now,
                                        BankName        = "",
                                        BankAccountName = "",
                                        BankAccountNo   = "",
                                        OrderId         = item,
                                        HandleStatus    = RefundStatus.Applied,
                                        ValidCodes      = string.Join(",", from ii in list3
                                                                      select ii.VerificationPassword),
                                        IsServiceProduct = true,
                                        Quantity         = list3.Count
                                    };
                                    try
                                    {
                                        int num2 = TradeHelper.ServiceOrderApplyForRefund(refund);
                                        if (num2 > 0)
                                        {
                                            refund = TradeHelper.GetRefundInfo(num2);
                                            if (refund.Quantity == orderInfo.GetAllQuantity(true))
                                            {
                                                OrderHelper.UpdateOrderStatus(orderInfo, OrderStatus.ApplyForRefund);
                                            }
                                            SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                                            if (masterSettings.IsAutoDealRefund)
                                            {
                                                if (orderInfo.GetTotal(false) == decimal.Zero)
                                                {
                                                    if (OrderHelper.CheckRefund(orderInfo, refund, decimal.Zero, "", "自动退款", true, true))
                                                    {
                                                        VShopHelper.AppPushRecordForOrder(orderInfo.OrderId, "", EnumPushOrderAction.OrderRefund);
                                                        Messenger.OrderRefund(user, orderInfo, "");
                                                    }
                                                    else
                                                    {
                                                        TradeHelper.SetOrderVerificationItemStatus(item, refund.ValidCodes, VerificationStatus.ApplyRefund);
                                                    }
                                                }
                                                else if (refund.RefundType == RefundTypes.InBalance)
                                                {
                                                    if (OrderHelper.CheckRefund(orderInfo, refund, num, "", "自动退款", true, true))
                                                    {
                                                        VShopHelper.AppPushRecordForOrder(orderInfo.OrderId, "", EnumPushOrderAction.OrderRefund);
                                                        Messenger.OrderRefund(user, orderInfo, "");
                                                    }
                                                    else
                                                    {
                                                        TradeHelper.SetOrderVerificationItemStatus(item, refund.ValidCodes, VerificationStatus.ApplyRefund);
                                                    }
                                                }
                                                else
                                                {
                                                    string text = TradeHelper.SendWxRefundRequest(orderInfo, num, refund.RefundOrderId);
                                                    if (text == "")
                                                    {
                                                        if (OrderHelper.CheckRefund(orderInfo, refund, num, "", "自动退款", true, true))
                                                        {
                                                            VShopHelper.AppPushRecordForOrder(orderInfo.OrderId, "", EnumPushOrderAction.OrderRefund);
                                                            Messenger.OrderRefund(user, orderInfo, "");
                                                        }
                                                        else
                                                        {
                                                            TradeHelper.SetOrderVerificationItemStatus(item, refund.ValidCodes, VerificationStatus.ApplyRefund);
                                                        }
                                                    }
                                                    else
                                                    {
                                                        TradeHelper.SaveRefundErr(num2, text, true);
                                                        TradeHelper.SetOrderVerificationItemStatus(item, refund.ValidCodes, VerificationStatus.ApplyRefund);
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                TradeHelper.SetOrderVerificationItemStatus(orderInfo.OrderId, refund.ValidCodes, VerificationStatus.ApplyRefund);
                                            }
                                            if (orderInfo.StoreId > 0)
                                            {
                                                VShopHelper.AppPsuhRecordForStore(orderInfo.StoreId, orderInfo.OrderId, "", EnumPushStoreAction.StoreOrderRefundApply);
                                            }
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        Globals.WriteExceptionLog_Page(ex, null, "O2OAutoRefundError");
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex2)
            {
                IDictionary <string, string> dictionary = new Dictionary <string, string>();
                dictionary.Add("Sql", stringBuilder.ToString());
                Globals.WriteExceptionLog(ex2, dictionary, "ProcessorOrderVerificationItemsExpire");
            }
        }