Exemplo n.º 1
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();
                    }
                }
            }
        }
Exemplo n.º 2
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();
                    }
                }
            }
        }
Exemplo n.º 3
0
 private void initLazyLoaders()
 {
     _applyformLoader  = new LazyLoader <RefundOrScrapApplyform>(() => ApplyformQueryService.QueryRefundOrScrapApplyform(AssociateApplyformId));
     _refundBillLoader = new LazyLoader <NormalRefundBill>(() => DistributionQueryService.QueryNormalRefundBill(AssociateApplyformId));
 }
Exemplo n.º 4
0
 void initLazyLoader()
 {
     _refundBillLoader = new LazyLoader <NormalRefundBill>(() => DistributionQueryService.QueryNormalRefundBill(this.Id));
 }