Ejemplo n.º 1
0
        /// <summary>
        /// 生成退款账单
        /// </summary>
        /// <param name="refundInfo">退款信息</param>
        /// <param name="remark">退款备注</param>
        public static Distribution.Domain.Bill.Refund.NormalRefundBill ProduceNormalRefundBill(Distribution.Domain.Bill.Refund.RefundInfo refundInfo, string remark)
        {
            if (refundInfo == null)
            {
                throw new ArgumentNullException("refundInfo");
            }
            if (!refundInfo.Passengers.Any())
            {
                throw new CustomException("缺少乘机人信息");
            }
            if (!refundInfo.Flights.Any())
            {
                throw new CustomException("缺少航段信息");
            }
            var payBill = DistributionQueryService.QueryNormalPayBill(refundInfo.OrderId);

            if (payBill == null)
            {
                throw new NotFoundException("无 " + refundInfo.OrderId + " 的支付账单记录");
            }
            var oldRefundBill = DistributionQueryService.QueryNormalRefundBill(refundInfo.ApplyformId);

            if (oldRefundBill != null && oldRefundBill.Succeed)
            {
                throw new RepeatedItemException("该单子已经退款");
            }
            return(payBill.MakeRefundBill(refundInfo.ApplyformId, refundInfo, remark));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 删除退款账单
        /// </summary>
        public static Distribution.Domain.Bill.Refund.NormalRefundBill DeleteRefundBill(decimal refundApplyformId)
        {
            var refundBill = DistributionQueryService.QueryNormalRefundBill(refundApplyformId);

            if (refundBill != null && refundBill.HasRefunded)
            {
                throw new InvalidOperationException("该账单已退款");
            }
            return(refundBill);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 生成退款账单
        /// 全退原订单
        /// </summary>
        /// <param name="orderId">订单号</param>
        public static Distribution.Domain.Bill.Refund.NormalRefundBill ProduceNormalRefundBill(decimal orderId)
        {
            var payBill = DistributionQueryService.QueryNormalPayBill(orderId);

            if (payBill == null)
            {
                throw new NotFoundException("无 " + orderId + " 的支付账单记录");
            }
            if (DistributionQueryService.QueryNormalRefundBill(orderId) != null)
            {
                throw new RepeatedItemException("退款账单已存在");
            }
            return(ProduceNormalRefundBill(payBill, "出票失败"));
        }