Пример #1
0
        public SubscriptionDetail GetSubscriptionDetail(int pageNo)
        {
            SubscriptionDetail subscriptionDetail = new SubscriptionDetail();

            List <UserService> userServices = _userServiceRepository.GetPagedUserService(pageNo);

            subscriptionDetail.ServiceList = userServices;

            subscriptionDetail.SubscriptionType       = "MONTHLY";
            subscriptionDetail.SubscriptionTotalPrice = 26.8500;
            subscriptionDetail.PackageModel           = false;
            subscriptionDetail.PackageName            = "";
            subscriptionDetail.BillingDate            = "18";
            subscriptionDetail.PartnerBilled          = false;
            subscriptionDetail.IsBusinessUser         = false;
            subscriptionDetail.AutoRenewTrialPeriod   = false;
            subscriptionDetail.IsSSOUser = false;
            subscriptionDetail.ReacceptTermsAndConditions = false;
            subscriptionDetail.AssociationText            = "Provided By";
            subscriptionDetail.ProvidedByName             = "EZShield";



            subscriptionDetail.HasError = false;
            subscriptionDetail.Errors   = null;
            subscriptionDetail.CaseId   = "0000000-0000-0000-0000";

            return(subscriptionDetail);
        }
Пример #2
0
        public async Task <Guid> CreateSubscription(Subscription subscription)
        {
            decimal orderTotal = 0;

            var cartItems = await GetCartItems();

            // Iterate over the items in the cart, adding the order details for each
            foreach (var item in cartItems)
            {
                var journal = await _context.Journals.SingleAsync(a => a.JournalId == item.JournalId);

                var subscriptionDetail = new SubscriptionDetail
                {
                    JournalId      = item.JournalId,
                    SubscriptionId = subscription.SubscriptionId
                };

                // Set the order total of the shopping cart
                orderTotal += (item.Count * journal.Price);

                _context.SubscriptionDetails.Add(subscriptionDetail);
            }

            // Set the order's total to the orderTotal count
            subscription.Total = orderTotal;

            // Empty the shopping cart
            await EmptyCart();

            // Return the OrderId as the confirmation number
            return(subscription.SubscriptionId);
        }
        public void MockARBGetSubscriptionListTest()
        {
            //define all mocked objects as final
            var mockController = GetMockController <ARBGetSubscriptionListRequest, ARBGetSubscriptionListResponse>();
            var mockRequest    = new ARBGetSubscriptionListRequest
            {
                merchantAuthentication = new merchantAuthenticationType {
                    name = "mocktest", Item = "mockKey", ItemElementName = ItemChoiceType.transactionKey
                },
                refId      = RefId,
                searchType = ARBGetSubscriptionListSearchTypeEnum.subscriptionActive,
                paging     = new Paging {
                    limit = 100, offset = 1
                },
                sorting = new ARBGetSubscriptionListSorting
                {
                    orderBy         = ARBGetSubscriptionListOrderFieldEnum.id,
                    orderDescending = false
                },
            };
            var subscriptionDetail = new SubscriptionDetail
            {
                id            = 1234,
                accountNumber = "1234",
                amount        = SetValidTransactionAmount(Counter) / 100,
            };
            var subscriptionDetails = new List <SubscriptionDetail> {
                subscriptionDetail
            };
            var mockResponse = new ARBGetSubscriptionListResponse
            {
                refId               = "1234",
                sessionToken        = "sessiontoken",
                subscriptionDetails = subscriptionDetails.ToArray(),
                totalNumInResultSet = subscriptionDetails.Count,
            };

            var errorResponse = new ANetApiResponse();
            var results       = new List <String>();
            const messageTypeEnum messageTypeOk = messageTypeEnum.Ok;

            SetMockControllerExpectations <ARBGetSubscriptionListRequest, ARBGetSubscriptionListResponse, ARBGetSubscriptionListController>(
                mockController.MockObject, mockRequest, mockResponse, errorResponse, results, messageTypeOk);
            mockController.MockObject.Execute(AuthorizeNet.Environment.CUSTOM);
            //mockController.MockObject.Execute();
            // or var controllerResponse = mockController.MockObject.ExecuteWithApiResponse(AuthorizeNet.Environment.CUSTOM);
            var controllerResponse = mockController.MockObject.GetApiResponse();

            Assert.IsNotNull(controllerResponse);

            Assert.IsNotNull(controllerResponse.subscriptionDetails);
            LogHelper.info(Logger, "ARBGetSubscriptionList: Count:{0}, Details:{1}", controllerResponse.totalNumInResultSet, controllerResponse.subscriptionDetails);
        }
Пример #4
0
        private async Task InvokeEventHandler(SubscriptionDetail subscription, IDomainEvent @event)
        {
            if (!subscription.EventHandlers.ContainsKey(@event.GetType()))
            {
                return;
            }

            using (var scope = _services.CreateScope())
            {
                var handler  = subscription.EventHandlers[@event.GetType()];
                var instance = scope.ServiceProvider.GetRequiredService(subscription.Type);
                _statistics.LastProcessesTime = DateTime.UtcNow;

                try
                {
                    await handler(instance, @event);
                }
                finally
                {
                    _statistics.IncrementEventsProcessed();
                }
            }
        }
Пример #5
0
 public static void subscriptionDetail(SubscriptionDetail request)
 {
 }