/// <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); }
/// <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); }
private PostponeRefundRoleBill makeDeductionProfit(PostponePayRoleBill payBill) { return(payBill == null ? null : payBill.MakeRefundBill()); }
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); }
/// <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); }