示例#1
0
        public override object Execute()
        {
            decimal refundMoney  = decimal.Parse(getParame("refundMoney").ToString());
            string  remark       = getParame("remark").ToString();
            string  operatorName = getParame("operatorName").ToString();
            string  platformCode = getParame("platformCode").ToString();

            if (refundMoney > order.OrderPay.PayMoney || refundMoney < 0)
            {
                throw new OrderCommException("订单(" + order.OrderId + ")退款金额(¥" + refundMoney + ")超出范围!");
            }
            if (order.OrderStatus == EnumOrderStatus.RepelIssueRefunding)
            {
                throw new OrderCommException("订单(" + order.OrderId + ")正在退款中。。。");
            }
            string cashbagCode         = getParame("cashbagCode").ToString();
            string cashbagKey          = getParame("cashbagKey").ToString();
            IPaymentClientProxy client = new CashbagPaymentClientProxy();
            string payType             = order.OrderPay.PayMethod.ToEnumDesc();
            string serialNum           = order.OrderPay.PaySerialNumber;
            string BuyDesc             = (order.CreateTime < DateTime.Parse("2014/07/19 04:10:00")) ? OldGetRefundDetail(order, refundMoney) : GetRefundDetail(order, refundMoney);

            Logger.WriteLog(LogType.INFO, "退款分润 时间:" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + " OrderId=" + order.OrderId + " ProfitDetail=" + BuyDesc + "\r\n");
            if (payType == EnumPayMethod.Bank.ToEnumDesc() || payType == EnumPayMethod.Platform.ToEnumDesc())
            {
                client.Reimburse(cashbagCode, cashbagKey, serialNum, refundMoney, order.OrderId, "REFUND", BuyDesc);
                //修改为拒绝出票,退款中
                order.ChangeStatus(EnumOrderStatus.RepelIssueRefunding);
                order.WriteLog(new OrderLog()
                {
                    OperationContent  = string.Format("退款状态:退款中,订单号:{0},退款金额:{1},退款方式:{2},备注:{3}", order.OrderId, refundMoney, payType, remark),
                    OperationDatetime = System.DateTime.Now,
                    OperationPerson   = string.IsNullOrEmpty(operatorName) ? "系统" : operatorName
                    ,
                    IsShowLog = true
                });
            }
            else
            {
                client.Reimburse(cashbagCode, cashbagKey, serialNum, refundMoney, order.OrderId, "退款", BuyDesc, string.Format("PNR:{0},乘机人:【{1}】", this.order.PnrCode, string.Join("|", this.order.Passengers.Select(x => x.PassengerName).ToArray())));
                //修改为拒绝出票,订单完成
                order.ChangeStatus(EnumOrderStatus.RepelIssueAndCompleted);
                order.WriteLog(new OrderLog()
                {
                    OperationContent  = string.Format("拒绝出票【退款状态:退款完成,订单号:{0},退款金额:{1},退款方式:{2},备注:{3}】", order.OrderId, refundMoney, payType, remark),
                    OperationDatetime = System.DateTime.Now,
                    OperationPerson   = string.IsNullOrEmpty(operatorName) ? "系统" : operatorName
                    ,
                    IsShowLog = true
                });
            }

            //修改保险状态
            var insuranceFac = StructureMap.ObjectFactory.GetInstance <InsuranceDomainService>();

            insuranceFac.ReturnInsurance(this.order);
            return(null);
        }
示例#2
0
        private void AutoRefund(Order order)
        {
            IPaymentClientProxy client = new CashbagPaymentClientProxy();
            var    businessman         = this.businessmanRepository.FindAll(x => x.Code == order.BusinessmanCode).FirstOrDefault();
            string payType             = order.OrderPay.PayMethod.ToEnumDesc();
            string BuyDesc             = (order.CreateTime < DateTime.Parse("2014/07/19 04:10:00")) ? OldGetRefundDetail(order, order.OrderMoney) : GetRefundDetail(order, order.OrderMoney);

            if (payType == EnumPayMethod.Bank.ToEnumDesc() || payType == EnumPayMethod.Platform.ToEnumDesc())
            {
                client.Reimburse(businessman.CashbagCode, businessman.CashbagKey, order.OrderPay.PaySerialNumber, order.OrderMoney, order.OrderId, "REFUND", BuyDesc);
            }
            else
            {
                client.Reimburse(businessman.CashbagCode, businessman.CashbagKey, order.OrderPay.PaySerialNumber, order.OrderMoney, order.OrderId, "退款", BuyDesc);
            }
        }