Exemplo n.º 1
0
        public async Task <AEvent_EventLogList> GetEventLogsAsync(string unitOfWork, string source)
        {
            using var log = BeginFunction(nameof(EventAdminService), nameof(GetEventLogsAsync), unitOfWork);
            try
            {
                await Assert(SecurityPolicy.IsPrivileged).ConfigureAwait(false);

                var eventLogs = new AEvent_EventLogList()
                {
                    MFunderEventLogs          = await FundingMicroService.GetFunderEventLogSummariesAsync(null, unitOfWork, source).ConfigureAwait(false),
                    MFundableEventLogs        = await FundingMicroService.GetFundableEventLogSummariesAsync(null, unitOfWork, source).ConfigureAwait(false),
                    MFulfillableEventLogs     = await FulfillmentMicroService.GetFulfillableEventLogSummariesAsync(null, unitOfWork, source).ConfigureAwait(false),
                    MShipmentRequestEventLogs = await FulfillmentMicroService.GetShipmentRequestEventLogSummariesAsync(null, unitOfWork, source).ConfigureAwait(false),
                    MShipmentEventLogs        = await FulfillmentMicroService.GetShipmentEventLogSummariesAsync(null, unitOfWork, source).ConfigureAwait(false),
                    MReturnRequestTrnsactions = await FulfillmentMicroService.GetReturnRequestEventLogSummariesAsync(null, unitOfWork, source).ConfigureAwait(false),
                    MReturnEventLogs          = await FulfillmentMicroService.GetReturnEventLogSummariesAsync(null, unitOfWork, source).ConfigureAwait(false),
                    MOrderEventLogs           = await OrderMicroService.GetOrderEventLogSummariesAsync(null, unitOfWork, source).ConfigureAwait(false),
                    MSquarePaymentEventLogs   = await SquareMicroService.GetPaymentEventLogSummariesAsync(null, unitOfWork, source).ConfigureAwait(false),
                    MSquareRefundEventLogs    = await SquareMicroService.GetRefundEventLogSummariesAsync(null, null, unitOfWork, source).ConfigureAwait(false)
                };

                var result = eventLogs;

                log.Result(result);

                return(result);
            }
            catch (Exception ex)
            {
                log.Exception(ex);
                throw;
            }
        }
Exemplo n.º 2
0
        public async Task <AOrder_Order> GetOrderAsync(long orderId)
        {
            using var log = BeginFunction(nameof(OrderAdminService), nameof(GetOrderAsync), orderId);
            try
            {
                await Assert(SecurityPolicy.IsPrivileged).ConfigureAwait(false);

                var mOrder = await OrderMicroService.GetOrderAsync(orderId).ConfigureAwait(false);

                var mTransactions = await OrderMicroService.GetOrderTransactionSummariesAsync(orderId, null, null);

                var mEvents = await OrderMicroService.GetOrderEventLogSummariesAsync(orderId, null, null);

                var fulfillableReference = CreateFulfillableReference.FromOrderId(orderId);
                var fulfillableId        = await FulfillmentMicroService.LookupFulfillableAsync(fulfillableReference);

                var mFulfillable = fulfillableId != null
                    ? await FulfillmentMicroService.GetFulfillableAsync(fulfillableId.Value).ConfigureAwait(false)
                    : null;

                var fundableReference = CreateFundableReference.FromOrderId(orderId);
                var fundableId        = await FundingMicroService.LookupFundableAsync(fundableReference);

                var mFundable = fundableId != null
                    ? await FundingMicroService.GetFundableAsync(fundableId.Value).ConfigureAwait(false)
                    : null;

                var mUser = TryParseUserId.FromOrdererReference(mOrder.OrdererReference, out string userId)
                    ? await UserMicroService.GetUserAsync(userId)
                    : null;

                var result = Create.AOrder_Order(mOrder, mTransactions, mEvents, mFulfillable, mFundable, mUser);

                log.Result(result);

                return(result);
            }
            catch (Exception ex)
            {
                log.Exception(ex);
                throw;
            }
        }