public TransientDocument PostTransientDocument(byte[] fileBytes, string fileName) { //string url = @"http://localhost:51201/api/AdobeSign"; //var client = new RestClient(Url); var request = new RestRequest("PostTransientDocument", Method.POST); request.AddHeader("Content-Type", "multipart/form-data"); request.AddFileBytes("file", fileBytes, fileName); //request.AddParameter("fileName", fileName); request.AddQueryParameter("fileName", fileName); IRestResponse <TransientDocument> result = client.Execute <TransientDocument>(request); //log repository.AddAdobeSignLog("PostTransientDocument", fileName, result.Data.ToJson()); return(result.Data); }
public Task <bool> UpdateCreditApplicationStatus([FromBody] WebHookInfo webHookInfo) { using (var context = new CreditAppContext()) { var creditDataEntity = context.CreditData.SingleOrDefault(x => x.AdobeSignAgreementId == webHookInfo.agreement.id); if (creditDataEntity != null) { creditDataEntity.Status = webHookInfo.Event; context.Update(creditDataEntity); context.SaveChanges(); } } //log repository.AddAdobeSignLog("UpdateCreditApplicationStatus", $"AgreementId={webHookInfo.agreement.id}", webHookInfo.ToJson()); return(Task.FromResult(true)); }
// GET api/AdobeSign/RefreshToken //[HttpGet] //[Route("api/AdobeSign/RefreshToken")] public void RefreshToken(int?creditDataId) { var refreshToken = this.repository.GetKeyValue(RefreshTokenKey); try { var response = client.Authorize(refreshToken); repository.AddAdobeSignLog(creditDataId, "RefreshToken", $"refreshToken={refreshToken}", response); } catch (Exception e) { repository.AddAdobeSignLog(creditDataId, "RefreshToken", $"refreshToken={refreshToken}", e); Console.WriteLine(e); throw; } }