Example #1
0
        /// <summary>
        /// 生成支付账单
        /// </summary>
        internal PostponePayRoleBill MakePayBill(IEnumerable <Order.Domain.Applyform.PostponeFlight> flights, IEnumerable <Order.Domain.Passenger> passengers)
        {
            _rate = 0;
            var totalTradeFee = Utility.Calculator.Round(GetPostponeTradeFee(), -2);

            var billSerial  = 1;
            var detailBills = new List <PostponePayDetailBill>();

            foreach (var flight in flights)
            {
                foreach (var passenger in passengers)
                {
                    var detailBill = makePayDetailBill(passenger.Id, flight);
                    if (billSerial == 1)
                    {
                        detailBill.TradeFee = Math.Abs(totalTradeFee) * -1;
                    }
                    detailBills.Add(detailBill);
                    billSerial++;
                }
            }
            var roleBill = new PostponePayRoleBill(this)
            {
                Source = new PostponePayRoleBillSource {
                    Details = detailBills
                }
            };

            return(roleBill);
        }
Example #2
0
        /// <summary>
        /// 生成退款账单
        /// </summary>
        internal PostponeRefundRoleBill MakeRefundBill(PostponePayRoleBill payBill)
        {
            var bill = new PostponeRefundRoleBill(this)
            {
                PayRoleBill = payBill,
                Source      = new PostponeRefundRoleBillSource {
                    Details = payBill.Source.Details.Select(makeRefundDetailBill).ToList()
                }
            };

            return(bill);
        }
Example #3
0
 private PostponeRefundRoleBill makeDeductionProfit(PostponePayRoleBill payBill)
 {
     return(payBill == null ? null : payBill.MakeRefundBill());
 }
Example #4
0
        private decimal getPremiumProfit(IEnumerable <PostponePayRoleBill> tradeRoleBills, PostponePayRoleBill deductionBill)
        {
            decimal tradeRoleBalance = 0;

            if (tradeRoleBills != null)
            {
                var userRoleBalance   = tradeRoleBills.Sum(item => item.Source.Anticipation);
                var platformDeduction = deductionBill == null ? 0 : deductionBill.Source.Anticipation;
                tradeRoleBalance = userRoleBalance + platformDeduction;
            }
            return(tradeRoleBalance * -1);
        }
Example #5
0
        /// <summary>
        /// 生成退款账单
        /// </summary>
        internal PlatformBill <PostponeRefundRoleBill, PostponeRefundRoleBillSource, PostponeRefundDetailBill> MakeRefundBill(PostponePayRoleBill payBill, IEnumerable <PostponeRefundRoleBill> tradeRoleRefundBills)
        {
            var refundBill = new PlatformBill <PostponeRefundRoleBill, PostponeRefundRoleBillSource, PostponeRefundDetailBill> {
                Deduction = makeDeductionProfit(payBill)
            };

            refundBill.Premium  = getPremiumProfit(tradeRoleRefundBills, refundBill.Deduction);
            refundBill.TradeFee = makeTradeFeeProfit(tradeRoleRefundBills);
            refundBill.Account  = Account;
            return(refundBill);
        }