public async Task <LoanDocumentResponse> uploadForgivenessDocument(string requestName, string requestDocument_type, string etran_loan, string document) { LoanDocumentResponse loanDocument = await sbaLoanDocuments.uploadForgivenessDocument(requestName, requestDocument_type, etran_loan, document, pppLoanDocuments); return(loanDocument); }
public async Task <LoanDocumentResponse> uploadForgivenessDocument(string requestName, string requestDocument_type, string etran_loan, string document, string loanDocumentsUrl) { try { RestClient restClient = new RestClient($"{baseUri}/{loanDocumentsUrl}/"); restClient.Timeout = -1; RestRequest restRequest = new RestRequest(Method.POST); restRequest.AddHeader("Authorization", apiToken); restRequest.AddHeader(VENDOR_KEY, vendorKey); restRequest.AddParameter("name", requestName); restRequest.AddParameter("document_type", requestDocument_type); restRequest.AddParameter("etran_loan", etran_loan); restRequest.AddFile("document", document); IRestResponse response = await restClient.ExecuteAsync(restRequest); if (response.IsSuccessful) { LoanDocumentResponse loanDocument = JsonConvert.DeserializeObject <LoanDocumentResponse>(response.Content); return(loanDocument); } throw new Exception($"Did not receive success code. please investigate. \nresponse code: {response.StatusCode}.\n response:{response.Content}"); } catch (Exception exception) { Console.WriteLine($"{Environment.NewLine}{exception.Message}{Environment.NewLine}"); Console.WriteLine("------------------------------------------------------------------------"); return(null); } }
public async Task uploadForgivenessDocument() { LoanDocumentResponse response = await cSharpClientTest.uploadForgivenessDocument("<file name>", "1", "<slug>", @"<path to file>"); Assert.IsNotNull(response); string serialized = JsonConvert.SerializeObject(response, new JsonSerializerSettings { DateFormatHandling = DateFormatHandling.IsoDateFormat }); Assert.IsNotNull(serialized); }
public async Task uploadForgivenessDocument() { LoanDocumentResponse response = await cSharpClientTest.uploadForgivenessDocument("Ppdf.pdf", "1", "e1805069-9e05-4bc3-9daf-c40159036003", @"C:\Users\Administrator\Desktop\Ppdf.pdf"); Assert.IsNotNull(response); string serialized = JsonConvert.SerializeObject(response, new JsonSerializerSettings { DateFormatHandling = DateFormatHandling.IsoDateFormat }); Assert.IsNotNull(serialized); }