Esempio n. 1
0
        /// <summary>
        /// 冻结
        /// </summary>
        /// <returns></returns>
        public CurrentFundFreezeResponse Freeze(OrderPaidFreeze orderPaidRecharge)
        {
            CurrentFundFreezeRequest request = new CurrentFundFreezeRequest();

            request.Head.ReqJnlNo = GuidHelper.GenUniqueId();

            request.Body.CoPatrnerJnlNo = orderPaidRecharge.SerialNumber;
            request.Body.TrsDate        = DateTime.Now.ToString("yyyyMMdd");
            request.Body.CifClientId    = orderPaidRecharge.OrderPaid.Member.ClientId;
            request.Body.FreezeType     = "0";
            request.Body.Currency       = "CNY";
            request.Body.CEFlag         = "0";
            request.Body.ThawDate       = orderPaidRecharge.UnFreezeDate.ToString("yyyyMMdd");
            request.Body.Amount         = orderPaidRecharge.Amount.ToString();
            request.Body.ProtocolNo     = "";
            request.Body.GroupNo        = "";
            request.Body.TravelStartDay = "";
            request.Body.TravelEndDay   = "";
            request.Body.ProtocolDate   = "";
            request.Body.Remark         = "";
            request.Body.Reserve1       = "";
            request.Body.Reserve2       = "";
            request.Body.Reserve3       = "";
            request.Body.Reserve4       = "";
            request.Body.Reserve5       = "";

            var result = guangDaExec.Exec(request) as CurrentFundFreezeResponse;

            return(result);
        }
Esempio n. 2
0
        public void Freeze(OrderPaid orderPaid)
        {
            if (orderPaid.Status != OrderPaidStatusOption.RechargeSuccess.ToInt())
            {
                throw new Exception("当前状态不可冻结(" + orderPaid.StatusDesc + ")");
            }


            var iOrderPaidFreezeService = DIFactory.GetContainer().Resolve <IOrderPaidFreezeService>();
            var iGuangDaAPIService      = DIFactory.GetContainer().Resolve <IGuangDaAPIService>();
            //var iOrderPaidService = DIFactory.GetContainer().Resolve<IOrderPaidService>();

            OrderPaidFreeze orderPaidFreeze = new OrderPaidFreeze();

            orderPaidFreeze.OrderPaid    = orderPaid;
            orderPaidFreeze.Amount       = orderPaid.TransactionAmount;
            orderPaidFreeze.UnFreezeDate = DateTime.Now.AddMonths(orderPaid.Project.GuaranteeMonth);

            iOrderPaidFreezeService.Save(orderPaidFreeze);
            iOrderPaidFreezeService.Commit();

            var freezeResponse = iGuangDaAPIService.Freeze(orderPaidFreeze);

            orderPaidFreeze.ResponseCode    = freezeResponse.Head.ResCode;
            orderPaidFreeze.ResponseMessage = freezeResponse.Head.ResMsg;

            if (freezeResponse.IsOK && freezeResponse.Body?.FreezeState == "S")
            {
                FreezeSuccess(orderPaidFreeze, freezeResponse.Body.Balance);

                Commit();
            }
            else if (freezeResponse.IsWait || freezeResponse.Body?.FreezeState == "U")
            {
                //orderPaid.Status = OrderPaidStatusOption.FrozenWait.ToInt();
                //Save(orderPaid);

                //orderPaidFreeze.Status = OrderPaidFreezeStatusOption.Wait.ToInt();
                //iOrderPaidFreezeService.Save(orderPaidFreeze);

                //当失败处理
                orderPaidFreeze.Status = OrderPaidFreezeStatusOption.Fail.ToInt();
                iOrderPaidFreezeService.Save(orderPaidFreeze);

                Commit();

                throw new APIException("冻结失败中:" + freezeResponse.Head.ResMsg);
            }
            else if (freezeResponse.IsFail || freezeResponse.Body?.FreezeState == "F")
            {
                orderPaidFreeze.Status = OrderPaidFreezeStatusOption.Fail.ToInt();
                iOrderPaidFreezeService.Save(orderPaidFreeze);

                Commit();

                throw new APIException("冻结失败:" + freezeResponse.Head.ResMsg);
            }
        }
Esempio n. 3
0
        private void FreezeSuccess(OrderPaidFreeze orderPaidFreeze, decimal balance)
        {
            var iOrderPaidFreezeService = DIFactory.GetContainer().Resolve <IOrderPaidFreezeService>();
            var iMemberService          = DIFactory.GetContainer().Resolve <IMemberService>();

            orderPaidFreeze.OrderPaid.Status = OrderPaidStatusOption.FrozenSuccess.ToInt();
            Save(orderPaidFreeze.OrderPaid);

            orderPaidFreeze.Balance   = balance;
            orderPaidFreeze.Status    = OrderPaidFreezeStatusOption.Success.ToInt();
            orderPaidFreeze.TransTime = DateTime.Now;
            iOrderPaidFreezeService.Save(orderPaidFreeze);

            iMemberService.BalanceChange(orderPaidFreeze.OrderPaid.Member, orderPaidFreeze.Amount * -1, MemberBalanceHistoryTypeOption.Freeze, (AccountBankOption)orderPaidFreeze.OrderPaid.Merchant.AccountBank, orderPaidFreeze.Amount, remark: orderPaidFreeze.SerialNumber);
        }