Ejemplo n.º 1
0
        public async Task <SbaPPPLoanMessagesResponse> getForgivenessMessagesBySlug(string slug)
        {
            SbaPPPLoanMessagesResponse forgivenessMessagesBySlug =
                await sbaLoanForgivenessMessageController.getForgivenessMessagesBySlug(slug, pppLoanForgivenessMessages);

            return(forgivenessMessagesBySlug);
        }
        public async Task <SbaPPPLoanMessagesResponse> getForgivenessMessagesBySlug(string slug, string loanForgivenessMessageUrl)
        {
            try
            {
                string baseUrl = $"{baseUri}/{loanForgivenessMessageUrl}/{slug}/";

                RestClient restClient = new RestClient(baseUrl);
                restClient.Timeout = -1;
                RestRequest restRequest = new RestRequest(Method.GET);
                restRequest.AddHeader("Authorization", apiToken);
                restRequest.AddHeader(VENDOR_KEY, vendorKey);
                restRequest.AddHeader("Content-Type", "application/json");
                IRestResponse restResponse = await restClient.ExecuteAsync(restRequest);

                if (restResponse.IsSuccessful)
                {
                    SbaPPPLoanMessagesResponse sbaPPPLoanMessagesResponse = JsonConvert.DeserializeObject <SbaPPPLoanMessagesResponse>(restResponse.Content);
                    return(sbaPPPLoanMessagesResponse);
                }
                throw new Exception($"Did not receive success code. please investigate. received response: {Environment.NewLine}StatusCode - {restResponse.StatusCode}{Environment.NewLine}Response - {restResponse.Content}");
            }
            catch (Exception exception)
            {
                Console.WriteLine($"{Environment.NewLine}{exception.Message}{Environment.NewLine}");
                Console.WriteLine("------------------------------------------------------------------------");
                return(null);
            }
        }
Ejemplo n.º 3
0
        public async Task <SbaPPPLoanMessagesResponse> getForgivenessMessagesBySbaNumber(int page, String sbaNumber, bool isComplete)
        {
            SbaPPPLoanMessagesResponse sbaPppLoanMessagesResponse =
                await sbaLoanForgivenessMessageController.getForgivenessMessagesBySbaNumber(page, sbaNumber, isComplete,
                                                                                            pppLoanForgivenessMessages);

            return(sbaPppLoanMessagesResponse);
        }
        public async Task getForgivenessMessagesBySlug()
        {
            SbaPPPLoanMessagesResponse response = await cSharpClientTest.getForgivenessMessagesBySlug("<slug>");

            Assert.IsNotNull(response);

            string serialized = JsonConvert.SerializeObject(response,
                                                            new JsonSerializerSettings {
                DateFormatHandling = DateFormatHandling.IsoDateFormat
            });

            Assert.IsNotNull(serialized);
        }