//private int InsertPayInfo(OrderItem orderItem, int payInfoId, PayInfoItem payInfoItem) //{ // payInfoId = PayInfoDao.Insert(payInfoItem); // orderItem.PayInfoId = payInfoId; // OrderDao.UpdatePayInfo(orderItem); // if (payInfoItem.PointPaid > 0) // { // SubtractPoint(orderItem, payInfoItem); // } // return payInfoId; //} //private void SubtractPoint(OrderItem orderItem, PayInfoItem payInfoItem) //{ // string title = "[" + orderItem.Code + "]ポイント支払い"; // PointService.SubtractPoint(title, payInfoItem.PointPaid, orderItem.UserId); //} internal PayInfoItem GetPayInfoItem(OrderItem orderItem, int pointPaid, string payType, string bankType, string bankUserName, int shippingCharge) { PayInfoItem item = new PayInfoItem(); item.ProductCharge = OrderService.GetTaxAddedPrice(orderItem.Id); item.ShippingCharge = shippingCharge; item.PayType = payType; if (item.PayType.Equals("MAN")) { item.ManPaidCharge = TradeUtil.ManPaidCharge(item.ProductCharge + item.ShippingCharge - pointPaid); } item.PointPaid = pointPaid; item.TelegramCommision = TradeUtil.GetTelegramCommision(item.PayType, item.TotalChargeBanTelegramCommision); item.CashPrice = item.TotalCharge - pointPaid; if (item.PayType.Equals("BANK")) { item.BankType = bankType; string modifiedBankUserName; if (item.BankType.Equals("1")) { modifiedBankUserName = TradeUtil.HalfToFull(bankUserName); } else { modifiedBankUserName = TradeUtil.FullToHalf(bankUserName); } item.BankUserName = modifiedBankUserName; } item.UserId = orderItem.UserId; return(item); }
//public int ChangePrintPriorityByOrderCode(string orderCode, string priority) //{ // return PrintMadeOrderDao.ChangePrintPriorityByOrderCode(orderCode, priority); //} //#endregion HighPrint - 우선출력 //private void RollBackPrintMadeStatus(int orderId) //{ // IList<PrintMadeOrderItem> printMadeList = PrintMadeOrderDao.FindByOrderId(orderId); // foreach (PrintMadeOrderItem item in printMadeList) // { // OrderHistoryService.RollbackPrintMadeStatus(item.Id); // } //} //private void RollBackReadyMadeStatus(int orderId) //{ // IList<ReadyMadeOrderItem> readyMadeList = ReadyMadeOrderDao.FindByOrderId(orderId); // foreach (ReadyMadeOrderItem item in readyMadeList) // { // OrderHistoryService.RollbackReadyMadeStatus(item.Id); // } //} //public int InsertOrder(string userId) //{ // OrderItem orderItem = new OrderItem(); // orderItem.UserId = userId; // int orderId = OrderDao.Insert(orderItem); // return orderId; //} //public string GetOrderCode(int orderId) //{ // OrderItem item = OrderDao.FindById(orderId); // return item.Code; //} //public OrderItem CreateNewOrderItem(string userId) //{ // OrderItem orderItem = new OrderItem(); // orderItem.UserId = userId; // int orderId = OrderDao.Insert(orderItem); // return OrderDao.FindById(orderId); //} //public BasicOrderParam GetBasicOrderParam(int orderId) //{ // return GetBasicOrderParamByType(orderId, "LIVING"); //} //public BasicOrderParam GetBasicOrderParamWithComplete(int orderId) //{ // return GetBasicOrderParamByType(orderId, "ALL"); //} //private BasicOrderParam GetBasicOrderParamByType(int orderId, string type) //{ // IList<ReadyMadeOrderItem> readyMadeOrderList = GetReaderMadeOrderListByType(orderId, type); // IList<PrintMadeOrderItem> printMadeOrderList = GetPrintMadeOrderListByType(orderId, type); // OrderItem orderItem = OrderDao.FindById(orderId); // BasicOrderParam basicOrderParam = new BasicOrderParam(); // basicOrderParam.PrintMadeOrderList = printMadeOrderList; // basicOrderParam.ReadyMadeOrderList = readyMadeOrderList; // basicOrderParam.OrderItem = orderItem; // return basicOrderParam; //} //private IList<ReadyMadeOrderItem> GetReaderMadeOrderListByType(int orderId, string type) //{ // if (type.Equals("LIVING")) return ReadyMadeOrderDao.FindLivingByOrderId(orderId); // return ReadyMadeOrderDao.FindCompleteListByOrderId(orderId); //} //private IList<PrintMadeOrderItem> GetPrintMadeOrderListByType(int orderId, string type) //{ // if (type.Equals("LIVING")) return PrintMadeOrderDao.FindLivingByOrderId(orderId); // return PrintMadeOrderDao.FindCompleteListByOrderId(orderId); //} //public int GetTaxAddedPrice(int orderId) //{ // IList<ReadyMadeOrderItem> readyMadeOrderList = ReadyMadeOrderDao.FindValidByOrderId(orderId); // IList<PrintMadeOrderItem> printMadeOrderList = PrintMadeOrderDao.FindValidByOrderId(orderId); // int readyMadeOrderPrice = readyMadeOrderList.Sum(item => item.TaxAddedTotalPrice); // int printMadeOrderPrice = printMadeOrderList.Sum(item => item.TaxAddedTotalPrice); // return readyMadeOrderPrice + printMadeOrderPrice; //} //public int GetTotalPrice(int orderId) //{ // PayInfoParam param = new PayInfoParam(); // IList<ReadyMadeOrderItem> readyMadeOrderList = ReadyMadeOrderDao.FindValidByOrderId(orderId); // IList<PrintMadeOrderItem> printMadeOrderList = PrintMadeOrderDao.FindValidByOrderId(orderId); // int readyMadeOrderPrice = readyMadeOrderList.Sum(item => item.TotalPrice); // int printMadeOrderPrice = printMadeOrderList.Sum(item => item.TotalPrice); // return readyMadeOrderPrice + printMadeOrderPrice; //} //public void SetPriceInPayInfoParam(int orderId, PayInfoParam param) //{ // IList<ReadyMadeOrderItem> readyMadeOrderList = ReadyMadeOrderDao.FindValidByOrderId(orderId); // IList<PrintMadeOrderItem> printMadeOrderList = PrintMadeOrderDao.FindValidByOrderId(orderId); // int readyMadeOrderPriceWithTax = readyMadeOrderList.Sum(item => item.TaxAddedTotalPrice); // int printMadeOrderPriceWithTax = printMadeOrderList.Sum(item => item.TaxAddedTotalPrice); // param.TaxAddedPrice = readyMadeOrderPriceWithTax + printMadeOrderPriceWithTax; // int readyMadeOrderPrice = readyMadeOrderList.Sum(item => item.TaxAddedTotalPrice - item.Tax); // int printMadeOrderPrice = printMadeOrderList.Sum(item => item.TaxAddedTotalPrice - item.Tax); // param.GoodsPrice = readyMadeOrderPrice + printMadeOrderPrice; //} //[Transaction()] //public void ResetCanProductDateToMinDate(int id) //{ // OrderDao.UpdateCanProductDateToMinDate(id); // PrintMadeOrderDao.UpdateProductRequestDateToMinDate(id); // ReadyMadeOrderDao.UpdateProductRequestDateToMinDate(id); //} //public bool CanProduct(int id) //{ // IList<PrintMadeOrderItem> printMadeOrderList = PrintMadeOrderDao.FindLivingByOrderId(id); // foreach (PrintMadeOrderItem item in printMadeOrderList) // { // if (!item.FileChecked()) return false; // } // OrderItem orderItem = OrderDao.FindById(id); // if (!orderItem.PayStatus.Equals("PAID")) return false; // return true; //} //[Transaction()] //public bool UpdateOrderStatusToProduct(int id) //{ // if (!CanProduct(id)) return false; // OrderDao.UpdateOrderStatusToProduct(id); // PrintMadeOrderDao.UpdateWorkStatusToGoodsOrderRequestByOrderId(id); // ReadyMadeOrderDao.UpdateWorkStatusToGoodsOrderRequestByOrderId(id); // UpdateOrderExpectDate.DoAction(id); // OrderItem orderItem = OrderDao.FindById(id); // string title = orderItem.Code + "の商品をただ今より出力に入らせていただきます。"; // MailService.SendOrderMailWithPhoneMail(orderItem, title); // return true; //} //public OrderItem FindByMadeOrder(int madeOrderId, string orderType) //{ // if (orderType.Equals("PRINTMADE")) // { // return GetOrderItemByPrintMadeOrderId(madeOrderId); // } // return GetOrderItemByReadyMadeOrderId(madeOrderId); //} //private OrderItem GetOrderItemByPrintMadeOrderId(int printMadeOrderId) //{ // PrintMadeOrderItem item = PrintMadeOrderDao.FindById(printMadeOrderId); // return OrderDao.FindById(item.OrderId); //} //private OrderItem GetOrderItemByReadyMadeOrderId(int readyMadeOrderId) //{ // ReadyMadeOrderItem item = ReadyMadeOrderDao.FindById(readyMadeOrderId); // return OrderDao.FindById(item.OrderId); //} //public void UpdateOrderStatusByPrintMadeFileType(int id) //{ // UpdateOrderStatusByPrintMadeFileTypeUpdate.DoAction(id); //} //[Transaction()] //public void CancleOrder(int id) //{ // string workStatus = "CANCEL"; // OrderDao.UpdateOrderStatus(id, workStatus); // PrintMadeOrderDao.UpdateWorkStatusByOrderId(id, workStatus); // ReadyMadeOrderDao.UpdateWorkStatusByOrderId(id, workStatus); // OrderItem orderItem = OrderDao.FindById(id); // if (orderItem.PayInfoId == 0) return; // PayInfoItem payInfoItem = PayInfoDao.FindById(orderItem.PayInfoId); // SetCancelOrderProc(orderItem.Code, orderItem, payInfoItem, payInfoItem.TotalCharge); //} //[Transaction()] //public void CancleOrderWithTelegram(int id) //{ // var paygentRequestItem = PaygentRequestDao.RetrievePaymentRequestLatestItemByOrderId(id, "MK"); // Paygent_TELEGRAM_KIND telegramKind = Paygent_TELEGRAM_KIND.TELEGRAM_CARD_REQUEST; // if (!Enum.TryParse<Paygent_TELEGRAM_KIND>(paygentRequestItem.Telegram_kind_code, out telegramKind)) // { // CancleOrder(id); // return; // } // if (telegramKind != Paygent_TELEGRAM_KIND.TELEGRAM_CARD_REQUEST) // { // CancleOrder(id); // return; // } // var telegram = new PaygentTelegramRequest_DEFAULT(); // // Paygent로 부터 현재 상태 조회 // PaygentResult Result = PaygentService.ProcPaygentTelegramRequestManual(paygentRequestItem, Paygent_TELEGRAM_KIND.TELEGRAM_GENERAL_PAYMENT_INFO_SEARCH, telegram.ToRequestDictionary()); // if (Result.Result != PaygentResultStatus.SUCCESS) // { // if ("13001".Equals(Result.Response?.RESPONSE_HEADER_CODE)) // 해당 결제 정보가 존재하지 않습니다. // { // // 전표처리 하지 않는다. // CancleOrder(id); // return; // } // else // { // throw BizException.CreateMakumakuServiceException("エラーが発生しました。", "PG社から決済システムの応答がありません。\nしばらくお待ちになってから、もう一度行なってください。\nこの問題が続く場合、お手数ですが顧客センターまでご連絡お願いいたします。\n顧客センター(050-8882-5225)" + (Result.Response?.RESPONSE_HEADER_CODE ?? ".")); // } // } // PaygentResult cancelResult = null; // string pg_payment_status = (Result.Response?.RESPONSE_DICTIONARY_LIST.FirstOrDefault()?["payment_status"] ?? "").ToString(); // switch (paygentRequestItem.LatestPaymentStatus) // { // case "": // throw BizException.CreateMakumakuServiceException("エラーが発生しました。", "決済代行会社からお支払い情報を確認しています。しばらくお待ち頂いてから、再度お試しください。"); // case "10": // case "11": // // 전표처리 하지 않는다. // break; // case "20": // if (!pg_payment_status.Equals(paygentRequestItem.LatestPaymentStatus)) throw BizException.CreateMakumakuServiceException("ORDCAN0004", "決済代行会社からお支払い情報を確認しています。しばらくお待ち頂いてから、再度お試しください。"); // cancelResult = PaygentService.ProcPaygentTelegramRequestManual(paygentRequestItem, Paygent_TELEGRAM_KIND.TELEGRAM_CARD_CANCEL, telegram.ToRequestDictionary()); // break; // case "40": // if (!pg_payment_status.Equals(paygentRequestItem.LatestPaymentStatus)) throw BizException.CreateMakumakuServiceException("ORDCAN0004", "決済代行会社からお支払い情報を確認しています。しばらくお待ち頂いてから、再度お試しください。"); // cancelResult = PaygentService.ProcPaygentTelegramRequestManual(paygentRequestItem, Paygent_TELEGRAM_KIND.TELEGRAM_CARD_SALES_CANCEL, telegram.ToRequestDictionary()); // break; // default: // // 그 외, 취소할 수 없는 상태 상세 메시지를 얻기 위해서 PG사로 전표 취소요청후 메시지를 응답 받는다. // cancelResult = PaygentService.ProcPaygentTelegramRequestManual(paygentRequestItem, Paygent_TELEGRAM_KIND.TELEGRAM_CARD_SALES_CANCEL, telegram.ToRequestDictionary()); // break; // } // if (cancelResult != null && cancelResult.Result != PaygentResultStatus.SUCCESS) // { // string addMsg = cancelResult.Result.ToString(); // if (cancelResult.ManagedException != null) { addMsg += cancelResult.ManagedException.Message; } // if (cancelResult.Response != null) { addMsg += cancelResult.Response.RESPONSE_HEADER_CODE; } // throw BizException.CreateMakumakuServiceException("エラーが発生しました。", "PG社から決済システムの応答がありません。\nしばらくお待ちになってから、もう一度行なってください。\nこの問題が続く場合、お手数ですが顧客センターまでご連絡お願いいたします。\n顧客センター(050-8882-5225)" + addMsg); // } // CancleOrder(id); //} //public void SetUserWriteInfo(int id) //{ // OrderItem item = OrderDao.FindById(id); // if (item.IsCustomerWriteStatus()) return; // item.UserWriteDate = DateTime.Now; // item.CommentWriteStatus = "CUSTOMER"; // OrderDao.Update(item); //} //public void SetManagerWriteInfo(int id) //{ // OrderItem item = OrderDao.FindById(id); // item.ManagerWriteDate = DateTime.Now; // item.CommentWriteStatus = "MANAGER"; // item.UserReadStatus = "NEW"; // item.UserReadDate = SqlDateTime.MinValue; // OrderDao.Update(item); //} //public void ClearManagerWriteInfo(int id) //{ // OrderItem item = OrderDao.FindById(id); // item.ManagerWriteDate = DateTime.Now; // item.CommentWriteStatus = "MANAGER"; // item.UserReadStatus = "READ"; // item.UserReadDate = SqlDateTime.MinValue; // OrderDao.Update(item); //} //public ListParam<OrderItem> GetOrderCommentListParam(string fieldName, string searchValue, int page, int pageSize, string type) //{ // int startNum = (page - 1) * pageSize + 1; // int endNum = page * pageSize; // int itemCount = OrderDao.GetTotalCountByCommentWriteStatus(fieldName, searchValue, type); // ListParam<OrderItem> param = new ListParam<OrderItem>(); // param.ItemList = OrderDao.FindByCommentWriteStatus(fieldName, searchValue, type, startNum, endNum); // param.FieldSelectList = GetFieldSelectList(fieldName); // param.SearchValue = searchValue; // param.Type = type; // IPager pager = new ButtonPager() { TotalCount = itemCount, CurrentPage = page, PageSize = pageSize, CountOfListPage = BoardUtil.countOfPageList }; // param.Pager = pager; // return param; //} //private SelectList GetFieldSelectList(string fieldName) //{ // IList<ListItem> list = new List<ListItem>(); // list.Add(new ListItem() { Value = "code", Text = "주문번호" }); // list.Add(new ListItem() { Value = "userName", Text = "주문자명" }); // return new SelectList(list, "Value", "Text", fieldName); //} //public OrderItem InsertReproductOrderItem(int id) //{ // OrderItem prevOrderItem = OrderDao.FindById(id); // OrderItem newOrderItem = GetReProductOrderItem(prevOrderItem); // int newOrderId = OrderDao.Insert(newOrderItem); // newOrderItem = OrderDao.FindById(newOrderId); // return newOrderItem; //} //private OrderItem GetReProductOrderItem(OrderItem prevOrderItem) //{ // OrderItem item = new OrderItem(); // item.UserId = prevOrderItem.UserId; // item.DeliveryInfoId = GetDeliveryInfoIdForReRroduct(prevOrderItem.DeliveryInfoId); // item.PayInfoId = GetPayInfoIdForReProduct(prevOrderItem.PayInfoId); // item.OrderDate = DateTime.Now; // return item; //} //private int GetDeliveryInfoIdForReRroduct(int prevDeliveryInfoId) //{ // DeliveryInfoItem item = DeliveryInfoDao.FindById(prevDeliveryInfoId); // item.Id = 0; // return DeliveryInfoDao.Insert(item); //} //private int GetPayInfoIdForReProduct(int prevPayInfoId) //{ // PayInfoItem item = PayInfoDao.FindById(prevPayInfoId); // item.Id = 0; // item.ProductCharge = 0; // item.ShippingCharge = 0; // item.ManPaidCharge = 0; // item.CashPrice = 0; // item.PointPaid = 0; // item.BankUserName = ""; // item.PayType = "MAN"; // item.BankType = ""; // return PayInfoDao.Insert(item); //} //[Transaction()] //public void DeletePrintMadeOrder(int id, int printMadeOrderId) //{ // PrintMadeOrderItem printMadeOrderItem = PrintMadeOrderDao.FindById(printMadeOrderId); // OrderItem orderItem = OrderDao.FindById(id); // PayInfoItem payInfoItem = PayInfoDao.FindById(orderItem.PayInfoId); // int madeOrderPrice = printMadeOrderItem.TaxAddedTotalPrice; // if (HasLivingMadeOrder(id)) // { // SetCancelOrderProc(printMadeOrderItem.Code, orderItem, payInfoItem, madeOrderPrice); // } // PrintMadeOrderDao.UpdateWorkStatus(printMadeOrderId, "CANCEL"); // if (!HasLivingMadeOrder(id)) // { // OrderDao.UpdateOrderStatus(id, "CANCEL"); // } // else // { // UpdateOrderStatusToProduct(id); // } //} //[Transaction()] //public void DeletePrintMadeOrderByManager(int id, int printMadeOrderId) //{ // GoodsOrderInfo orderInfo = GetLivingGoodsOrderInfo(id); // if (orderInfo.HasSingleGoods()) return; // PrintMadeOrderItem printMadeOrderItem = PrintMadeOrderDao.FindById(printMadeOrderId); // OrderItem orderItem = OrderDao.FindById(id); // PayInfoItem payInfoItem = PayInfoDao.FindById(orderItem.PayInfoId); // int madeOrderPrice = printMadeOrderItem.TaxAddedTotalPrice; // SetCancelOrderProc(printMadeOrderItem.Code, orderItem, payInfoItem, madeOrderPrice); // PrintMadeOrderDao.UpdateWorkStatus(printMadeOrderId, "CANCEL"); //} private void SetCancelOrderProc(string code, OrderItem orderItem, PayInfoItem payInfoItem, int reducePrice) { int returnPoint = 0; if (payInfoItem.IsBank() && orderItem.IsPaid()) { returnPoint = PayInfoService.ReducePayInfoWhenDepositChecked(payInfoItem, reducePrice); } else if (payInfoItem.PayType.StartsWith("TELEGRAM")) { if (payInfoItem.PayType.Equals("TELEGRAM_CARD_REQUEST") && orderItem.IsPaid()) { returnPoint = payInfoItem.PointPaid; } else { returnPoint = orderItem.IsPaid() ? payInfoItem.CashPrice : payInfoItem.PointPaid; } } else { returnPoint = PayInfoService.ReducePayInfoWhenDepositUnChecked(payInfoItem, reducePrice); } PayInfoDao.Update(payInfoItem); if (returnPoint > 0) { string title = "[" + code + "]注文取り消しによる返金ポイント"; PointService.AddPoint(title, returnPoint, orderItem.UserId); } }
private void UpdatePayInfo(OrderItem orderItem, int payInfoId, PayInfoItem payInfoItem) { PayInfoItem prevPayInfoItem = PayInfoDao.FindById(payInfoId); if (prevPayInfoItem.PointPaid > 0) { string title = "[" + orderItem.Code + "]支払方法変更による返金ポイント"; PointService.AddPoint(title, prevPayInfoItem.PointPaid, orderItem.UserId); } payInfoItem.Id = payInfoId; if (!orderItem.OrderStatus.Equals("ORDER_CONFIRM")) { OrderDao.UpdateOrderStatus(orderItem.Id, "PAY_INFO"); } if (payInfoItem.IsMan() || (payInfoItem.PayType.Equals("TELEGRAM_CARD_REQUEST") && orderItem.IsPaid())) { OrderDao.UpdatePayStatus(orderItem.Id, "PAID"); } else if (payInfoItem.IsBank() && (prevPayInfoItem.IsMan() || prevPayInfoItem.IsBank() || (payInfoItem.PayType.Equals("TELEGRAM_CARD_REQUEST") && !orderItem.IsPaid()))) { OrderDao.UpdatePayStatus(orderItem.Id, "UNPAID"); } PayInfoDao.Update(payInfoItem); if (payInfoItem.PointPaid > 0) { SubtractPoint(orderItem, payInfoItem); } OrderService.UpdateOrderStatusToProduct(orderItem.Id); }
/// <summary> /// 购买商店物品 /// </summary> /// <param name="mData"></param> /// <param name="_type"></param> public void SendPayInfo(RechargeData mData, int _payType) { string appName = Application.productName; if (mData.type == ePropType.golds) { desc = mData.cost + "金币"; v = "金币"; } else { desc = mData.cost + "房卡"; v = "房卡"; } string ip = GetIP();//ip地址 string appInfo = "小熊字牌|com.xftd.xiaoxiongzipai"; #if UNITY_IPHONE appInfo = "小熊游戏|com.xftd.xiaoxiongzipai"; #endif PayItemId req = new PayItemId(); req.id = mData.id; req.subject = v; req.body = desc; req.appinfo = appInfo; //支付方式 req.payChannelId = _payType == 1 ? "wechat" : "alipay"; #if UNITY_ANDROID req.version = "android_v2_0_1"; #elif UNITY_IPHONE req.version = "ios_v2_0_1"; #endif NetProcess.SendRequest <PayItemId>(req, ProtoIdMap.CMD_SendPayInfo, (msg) => { PayInfoBack data = msg.Read <PayInfoBack>(); if (data.code == 1) { PayInfoItem pdata = data.data.payData; //*@param appKey 签名 //*@param ip ip //*@param subject 商品名称 //*@param amount 订单总金额,单位分 //*@param body 商品描述 //*@param orderNo 订单号 //*@param notifyUrl 支付结果通知地址 //*@param cpChannel 渠道,(非必填) //*@param description 订单附加描述(非必填) //*@param extra 附加数据(非必填) //*@param paySytle 支付方式 1:微信 2:支付宝 //* @param appInfo APP信息 应用名 | 包名 SixqinSDKManager.Inst.SendMsg(SixqinSDKManager.RECHARGE, pdata.appKey, pdata.ip, v, int.Parse(pdata.amount), desc, pdata.orderNo, pdata.notifyUrl, "", "", "", _payType.ToString(), appInfo); } else { GameUtils.ShowErrorTips(data.code); } }); }