private bool GetSubsriptions(string clientId, out List <string> subscriptionIds)
        {
            Log.Info("GetSubscriptions init...");
            Log.Debug("Getting subscriptions for client id " + clientId);
            var success = true;

            subscriptionIds = new List <string>();
            var clientsProducts = new GetClientsProductsRequest(clientId);

            try
            {
                var     request           = ResolveRequest(clientsProducts);
                var     response          = _restClient.Execute(request) as RestResponse;
                dynamic processedResponse = ProcessResponse(response);

                if (!IsSuccess(processedResponse))
                {
                    throw new Exception("API returns error.");
                }
                foreach (var prod in processedResponse.products.product)
                {
                    subscriptionIds.Add(prod.id.ToString());
                    Log.Debug("Product with id " + prod.id + "found.");
                }
            }
            catch (Exception ex)
            {
                Log.Error("Error getting products for client " + clientId + ": " + ex.Message);
                success = false;
            }

            Log.Info("GetSubscriptions end.");
            return(success);
        }
Example #2
0
 public async Task <GetClientsProductsResponse> BrowseProducts(GetClientsProductsRequest request = null)
 {
     request = request ?? new GetClientsProductsRequest();
     return(await Client.Execute <GetClientsProductsRequest, GetClientsProductsResponse>(request));
 }