Example #1
0
        public async Task <IEnumerable <Subscription> > GetSubscription(SubscriptionFilterCriteria criteria)
        {
            IEnumerable <Subscription> ret = null;

            try
            {
                RestRequestSpecification req = new RestRequestSpecification();
                req.Verb       = HttpMethod.Get;
                req.RequestUri = $"/apps/Subscription.do?method=view&id={criteria.AccountId}";
                //req.Headers = Headers;
                req.ContentType = "application/json";
                //var returnPost = await asyncRestClientZuora.ExecuteAsync<IEnumerable<Persistence.Subscription>>(req);
                var returnPost = await asyncRestClientZuora.ExecuteAsync <string>(req);

                if (returnPost.Success)
                {
                    ret = JsonSerializer.Deserialize <IEnumerable <Subscription> >(returnPost.Value.ToString());
                }
                else
                {
                    ret = null;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                ret = null;
            }
            return(ret);
        }
Example #2
0
        public async Task <int> EnrollSingleOwner(EnrollmentParameters iep)
        {
            int ret = 0;
            RestRequestSpecification request = null;

            try
            {
                request             = new RestRequestSpecification();
                request.Verb        = HttpMethod.Post;
                request.RequestUri  = $"Enrollment/EnrollmentParameters/FullEnrollOwner";
                request.ContentType = "application/json";
                request.Content     = JsonSerializer.Serialize(iep);

                var returnPost = await asyncRestClientQALib.ExecuteAsync <RestResult <EnrollmentParameters> >(request);

                ret = int.Parse(returnPost.Value.ToString());
            }
            catch (Exception ex)
            {
                BillingTestCommon.log.Fatal(ex);
            }
            return(ret);
        }
        public async Task <Account> GetAccountById(string billingAccountId)
        {
            Account ret = null;

            try
            {
                RestRequestSpecification req = new RestRequestSpecification();
                req.Verb        = HttpMethod.Get;
                req.RequestUri  = $"v2/accounts/{billingAccountId}";
                req.Headers     = Headers;
                req.ContentType = "application/json";
                var returnPost = await asyncRestClientBilling.ExecuteAsync <string>(req);

                if (string.IsNullOrEmpty(returnPost?.Message))
                {
                    ret = JsonSerializer.Deserialize <Account>(returnPost.Value);
                }
            }
            catch (Exception ex)
            {
                log.Fatal(ex);
            }
            return(ret);
        }