Example #1
0
        /// <summary>
        /// 生成差错退款账单
        /// </summary>
        internal NormalRefundBill MakeErrorRefundBill(Refund.ErrorRefundInfo refundInfo, string remark)
        {
            var refundBill = new NormalRefundBill(OrderId, refundInfo.ApplyformId)
            {
                PayBill = this,
                Remark  = remark
            };
            var tradeRoleRefundBills = new List <Refund.Normal.NormalRefundRoleBill>();

            refundBill.Purchaser = Purchaser.MakeErrorRefundBill(refundInfo, getPurchaserRefundedBill(refundInfo.ApplyformId));
            tradeRoleRefundBills.Add(refundBill.Purchaser);
            refundBill.Provider = Provider.MakeErrorRefundBill(refundInfo, getProviderRefundedBill(refundInfo.ApplyformId));
            tradeRoleRefundBills.Add(refundBill.Provider);
            var platform = new Role.Platform(Platform.Account);

            refundBill.Platform  = platform.MakeErrorRefundBill(Platform.Deduction, refundInfo, getPlatformRefundedBill(refundInfo.ApplyformId), tradeRoleRefundBills);
            refundBill.Tradement = Tradement.MakeRefundment(Math.Abs(refundBill.Purchaser.Amount), getRefundedTradeFee(), refundInfo.ApplyformId.ToString());
            _refundBillsLoader.AppendData(refundBill);
            return(refundBill);
        }
Example #2
0
        /// <summary>
        /// 生成退款账单
        /// </summary>
        internal NormalRefundBill MakeRefundBill(decimal applyformId, Refund.RefundInfo refundInfo, string remark)
        {
            //if(!this.Success)
            //    throw new InvalidOperationException("未支付成功的订单,不能退款");
            var refundBill = new NormalRefundBill(OrderId, applyformId)
            {
                PayBill = this,
                Remark  = remark
            };
            var tradeRoleRefundBills = new List <Refund.Normal.NormalRefundRoleBill>();

            refundBill.Purchaser = Purchaser.MakeRefundBill(refundInfo, getPurchaserRefundedBill(applyformId));
            tradeRoleRefundBills.Add(refundBill.Purchaser);
            if (Provider != null)
            {
                refundBill.Provider = Provider.MakeRefundBill(refundInfo, getProviderRefundedBill(applyformId));
                tradeRoleRefundBills.Add(refundBill.Provider);
            }
            if (Supplier != null)
            {
                refundBill.Supplier = Supplier.MakeRefundBill(refundInfo, getSupplierRefundedBill(applyformId));
                tradeRoleRefundBills.Add(refundBill.Supplier);
            }
            if (_royalties != null)
            {
                foreach (var royalty in _royalties)
                {
                    var royaltyRefundBill = royalty.MakeRefundBill(refundInfo, getRoyaltyRefundedBill(applyformId, royalty.Owner.Id));
                    refundBill.AddRoyalty(royaltyRefundBill);
                    tradeRoleRefundBills.Add(royaltyRefundBill);
                }
            }
            var platform = new Role.Platform(Platform.Account);

            refundBill.Platform  = platform.MakeRefundBill(Platform.Deduction, refundInfo, getPlatformRefundedBill(applyformId), tradeRoleRefundBills);
            refundBill.Tradement = Tradement.MakeRefundment(Math.Abs(refundBill.Purchaser.Amount), getRefundedTradeFee(), applyformId.ToString());
            _refundBillsLoader.AppendData(refundBill);
            return(refundBill);
        }
Example #3
0
        internal PostponeRefundBill MakeRefundBill(string remark)
        {
            if (!Succeed)
            {
                throw new InvalidOperationException("改期费未成功支付,不能退款");
            }
            if (RefundBill != null)
            {
                throw new Core.CustomException("改期费是一次性退完,不能重复退");
            }

            var refundBill = new PostponeRefundBill(ApplyformId)
            {
                PayBill = this,
                Remark  = remark,
                Applier = Applier.MakeRefundBill()
            };
            var accepter = new Role.Platform(Accepter.Account);

            refundBill.Accepter  = accepter.MakeRefundBill(Accepter.Deduction, new[] { refundBill.Applier });
            refundBill.Tradement = Tradement.MakeRefundment(Math.Abs(Applier.Amount), 0, ApplyformId.ToString());
            return(refundBill);
        }