private void HiPOSOrderConfirm(HttpContext context) { string text = context.Request["code"].ToNullString(); string value = context.Request["sign"].ToNullString().ToLower(); string text2 = context.Request["device_id"].ToNullString(); string text3 = context.Request["method"].ToNullString(); StringBuilder stringBuilder = new StringBuilder(); if (!string.IsNullOrEmpty(text) && !string.IsNullOrEmpty(text2)) { string text4 = this.SetSHA1(context).ToLower(); if (!text4.Equals(value)) { HiShopJsonResult obj = new HiShopJsonResult { error = new Error { code = 0, message = "签名错误" } }; stringBuilder.Append(JsonHelper.GetJson(obj)); } else { string takeCode = text.Replace(Globals.HIPOSTAKECODEPREFIX, string.Empty).Trim(); OrderInfo orderInfo = OrderHelper.ValidateTakeCode(takeCode, text2); if (orderInfo != null) { if (orderInfo.FightGroupId > 0 && orderInfo.FightGroupStatus != FightGroupStatus.FightGroupSuccess) { HiShopJsonResult obj2 = new HiShopJsonResult { error = new Error { code = 0, message = "该订单是火拼团订单,但是组团还没未成功,不能提货!" } }; stringBuilder.Append(JsonHelper.GetJson(obj2)); } else { orderInfo.HiPOSUseName = "HiPOS系统"; if (OrderHelper.ConfirmTakeGoods(orderInfo, true)) { ConfirmingResult confirmingResult = new ConfirmingResult(); confirmingResult.confirming_response = new ConfirmingResponse(); confirmingResult.confirming_response.result = "ok"; stringBuilder.Append(JsonHelper.GetJson(confirmingResult)); new OrderDao().UpdateOrderPaymentType(orderInfo.OrderId, "HiPOS支付"); if (!string.IsNullOrEmpty(text3)) { bool isStoreCollect = false; switch (text3.Trim().ToLower()) { case "cash": isStoreCollect = true; break; case "weixin": isStoreCollect = false; break; case "alipay": isStoreCollect = false; break; } new OrderDao().UpdateOrderIsStoreCollect(orderInfo.OrderId, isStoreCollect); } } else { HiShopJsonResult obj3 = new HiShopJsonResult { error = new Error { code = 0, message = "确认提货失败" } }; stringBuilder.Append(JsonHelper.GetJson(obj3)); } } } else { HiShopJsonResult obj4 = new HiShopJsonResult { error = new Error { code = 0, message = "提货码失效" } }; stringBuilder.Append(JsonHelper.GetJson(obj4)); } } } else { HiShopJsonResult obj5 = new HiShopJsonResult { error = new Error { code = 0, message = "提货码失效" } }; stringBuilder.Append(JsonHelper.GetJson(obj5)); } context.Response.Write(stringBuilder.ToString()); }
private void HiPOSOrderStatus(HttpContext context) { string text = context.Request["code"].ToNullString(); string text2 = context.Request["device_id"].ToNullString(); StringBuilder stringBuilder = new StringBuilder(); if (!string.IsNullOrEmpty(text) && !string.IsNullOrEmpty(text2)) { string takeCode = text.Replace(Globals.HIPOSTAKECODEPREFIX, string.Empty).Trim(); OrderInfo orderInfo = OrderHelper.ValidateTakeCode(takeCode, text2); if (orderInfo != null) { OrderStatus orderStatus = orderInfo.OrderStatus; int num; if (!orderStatus.Equals(OrderStatus.WaitBuyerPay)) { orderStatus = orderInfo.OrderStatus; num = (orderStatus.Equals(OrderStatus.BuyerAlreadyPaid) ? 1 : 0); } else { num = 1; } if (num != 0) { OrderInfoResult orderInfoResult = new OrderInfoResult(); orderInfoResult.order_info_response = new OrderInfoResponse(); orderInfoResult.order_info_response.amount = orderInfo.GetTotal(false).F2ToString("f2"); orderInfoResult.order_info_response.id = orderInfo.OrderId; OrderInfoResponse order_info_response = orderInfoResult.order_info_response; orderStatus = orderInfo.OrderStatus; order_info_response.paid = orderStatus.Equals(OrderStatus.BuyerAlreadyPaid).ToString().ToLower(); orderInfoResult.order_info_response.detail = ((orderInfo.HiPOSOrderDetails.Length > 30) ? (orderInfo.HiPOSOrderDetails.Substring(0, 30) + "等等") : orderInfo.HiPOSOrderDetails); stringBuilder.Append(JsonHelper.GetJson(orderInfoResult)); } else { HiShopJsonResult obj = new HiShopJsonResult { error = new Error { code = 0, message = "提货码失效" } }; stringBuilder.Append(JsonHelper.GetJson(obj)); } } else { HiShopJsonResult obj2 = new HiShopJsonResult { error = new Error { code = 0, message = "订单不存在" } }; stringBuilder.Append(JsonHelper.GetJson(obj2)); } } context.Response.Write(stringBuilder.ToString()); }