示例#1
0
 void initLazyLoaders(bool newOrder)
 {
     _OemInfoLoader = new LazyLoader <OEMInfo>(() => OEMService.QueryOEMById(OEMID.Value));
     if (newOrder)
     {
         _applyformLoader    = new EnumerableLazyLoader <BaseApplyform>();
         _operationLoader    = new EnumerableLazyLoader <Log.Domain.OrderLog>();
         _coordinationLoader = new EnumerableLazyLoader <Coordination>();
     }
     else
     {
         _applyformLoader = new EnumerableLazyLoader <BaseApplyform>(() => {
             return(ApplyformQueryService.QueryApplyforms(this.Id));
         });
         _operationLoader = new EnumerableLazyLoader <Log.Domain.OrderLog>(() => {
             return(LogService.QueryOrderLog(this.Id));
         });
         _coordinationLoader = new EnumerableLazyLoader <Coordination>(() => {
             return(CoordinationService.QueryOrderCoordinations(this.Id));
         });
     }
     _associateOrderLoader   = new LazyLoader <Order>();
     _distributionBillLoader = new LazyLoader <Service.Distribution.Domain.OrderBill>(() => {
         return(DistributionQueryService.QueryOrderBill(this.Id));
     });
 }
示例#2
0
        internal static void ProcessPostponeRefundment(RefundFailedRecord refundInfo)
        {
            var refundBill = DistributionQueryService.QueryPostponeRefundBill(refundInfo.ApplyformId);

            if (refundBill != null)
            {
                var refundResult = Refund(refundInfo.OrderId, refundBill);
                if (refundResult.Success)
                {
                    DistributionProcessService.PostponeRefundSuccess(refundBill, refundResult.RefundTime.Value);
                    using (var command = Order.Repository.Factory.CreateCommand()) {
                        command.BeginTransaction();
                        try {
                            var distributionRepository = Order.Repository.Factory.CreateDistributionRepository(command);
                            distributionRepository.UpdateRefundBillForRefundSuccess(refundBill);
                            command.CommitTransaction();
                        } catch (Exception ex) {
                            command.RollbackTransaction();
                            LogService.SaveExceptionLog(ex, "申请单退款");
                            throw;
                        }
                    }
                }
            }
        }
示例#3
0
        internal static void ProcessOrderRefundment(RefundFailedRecord refundInfo)
        {
            var refundBill = DistributionQueryService.QueryNormalRefundBill(refundInfo.ApplyformId);

            if (refundBill != null)
            {
                var refundResults = Refund(refundBill, refundInfo.BusinessType);
                if (refundResults.Any(item => item.Success))
                {
                    var purchaserSucceed = refundBill.Purchaser.Success;
                    DistributionProcessService.NormalRefundSuccess(refundBill, refundResults);
                    using (var command = Order.Repository.Factory.CreateCommand()) {
                        command.BeginTransaction();
                        try {
                            var distributionRepository = Order.Repository.Factory.CreateDistributionRepository(command);
                            distributionRepository.UpdateRefundBillForRefundSuccess(refundBill);
                            command.CommitTransaction();
                        } catch (Exception ex) {
                            command.RollbackTransaction();
                            LogService.SaveExceptionLog(ex, "交易分润退款");
                            throw;
                        }
                    }
                    if (!purchaserSucceed && refundBill.Purchaser.Success)
                    {
                        var applyform = ApplyformQueryService.QueryRefundOrScrapApplyform(refundInfo.ApplyformId);
                        var notifier  = new Order.Notify.RefundApplyformNotifier(applyform);
                        notifier.RefundSuccess();
                    }
                }
            }
        }
示例#4
0
        internal static void ProcessTradeRefundemnt(RefundFailedRecord refundInfo)
        {
            //if(refundInfo.BusinessType == RefundBusinessType.PayTimeout) {
            //    var order = OrderQueryService.QueryOrder(refundInfo.OrderId);
            //    if(order != null) {
            //        TradeRefund(order, refundInfo.PayTradeNo);
            //    }
            //    return;
            //}
            var refundBill = DistributionQueryService.QueryNormalRefundBill(refundInfo.ApplyformId);

            if (refundBill != null)
            {
                var refundResult = TradeRefund(refundBill, refundInfo.BusinessType);
                if (refundResult != null && refundResult.Success)
                {
                    DistributionProcessService.NormalRefundSuccess(refundBill, new[] { refundResult });
                    using (var command = Order.Repository.Factory.CreateCommand()) {
                        command.BeginTransaction();
                        try {
                            var distributionRepository = Order.Repository.Factory.CreateDistributionRepository(command);
                            distributionRepository.UpdateRefundBillForRefundSuccess(refundBill);
                            command.CommitTransaction();
                        } catch (Exception ex) {
                            command.RollbackTransaction();
                            LogService.SaveExceptionLog(ex, "交易退款");
                            throw;
                        }
                        var order = OrderQueryService.QueryOrder(refundInfo.OrderId);
                        //发取消出票退款成功通知
                        var notifier = new Order.Notify.OrderNotifier(order);
                        notifier.SendRefundSuccessNotify();
                    }
                }
            }
        }
示例#5
0
 private void initLazyLoaders()
 {
     _applyformLoader  = new LazyLoader <RefundOrScrapApplyform>(() => ApplyformQueryService.QueryRefundOrScrapApplyform(AssociateApplyformId));
     _refundBillLoader = new LazyLoader <NormalRefundBill>(() => DistributionQueryService.QueryNormalRefundBill(AssociateApplyformId));
 }
示例#6
0
 internal PostponeRefundBill(decimal applyformId)
     : base(applyformId)
 {
     _payBillLoader = new LazyLoader <PostponePayBill>(() => DistributionQueryService.QueryPostponePayBill(ApplyformId));
 }
示例#7
0
 internal Refundment(Guid id) : base(id)
 {
     _paymentLoader = new LazyLoader <Payment>(() => DistributionQueryService.QueryPayment(TradeNo));
 }
 protected override System.Collections.Generic.IEnumerable <PostponePayDetailBill> GetDetailBills()
 {
     return(DistributionQueryService.QueryPostponePayDetailBills(this.BillId));
 }
示例#9
0
 internal NormalRefundBill(decimal orderId, decimal applyformId)
     : base(applyformId)
 {
     OrderId        = orderId;
     _payBillLoader = new LazyLoader <NormalPayBill>(() => DistributionQueryService.QueryNormalPayBill(OrderId));
 }
示例#10
0
 internal NormalRefundRoleBill(Guid id, TradeRole owner)
     : base(id, owner)
 {
     _payRoleBillLoader = new LazyLoader <NormalPayRoleBill>(() => DistributionQueryService.QueryNormalPayRoleBill(this.Id));
 }
示例#11
0
 internal OrderBill(decimal orderId)
 {
     this.OrderId            = orderId;
     _mainPayBillLoader      = new LazyLoader <NormalPayBill>(() => DistributionQueryService.QueryNormalPayBill(this.OrderId));
     _postponePayBillsLoader = new EnumerableLazyLoader <PostponePayBill>(() => DistributionQueryService.QueryPostponePayBills(this.OrderId));
 }
示例#12
0
 internal NormalPayBill(decimal orderId)
     : base(orderId)
 {
     _refundBillsLoader = new EnumerableLazyLoader <NormalRefundBill>(() => DistributionQueryService.QueryNormalRefundBills(OrderId));
 }
示例#13
0
 void initLazyLoader()
 {
     _payBillLoader = new LazyLoader <PostponePayBill>(() => DistributionQueryService.QueryPostponePayBill(this.Id));
 }
示例#14
0
 void initLazyLoader()
 {
     _refundBillLoader = new LazyLoader <NormalRefundBill>(() => DistributionQueryService.QueryNormalRefundBill(this.Id));
 }
示例#15
0
 protected override System.Collections.Generic.IEnumerable <NormalRefundDetailBill> GetDetailBills()
 {
     return(DistributionQueryService.QueryNormalRefundDetailBills(this.BillId));
 }