Exemplo n.º 1
0
        public bool Build(string templateId, string username, string password, out IResponse returnResponse)
        {
            returnResponse = new Response();
            try
            {
                string accountId = _api.GetAccountId(username, password);

                string uri = $"{_config.ApiUrl}/v2/accounts/{accountId}/templates/{templateId}";

                JObject        returnedContent;
                HttpStatusCode status = _api.SendDocuSignRequest(HttpMethod.Get, uri, username, password, out returnedContent);
                if (status != HttpStatusCode.OK)
                {
                    string message = "Get Document Fields failed. Check TemplateID passed in querystring and retry.";
                    _logger.Error($"Build() {message}");
                    throw new SigSvcTemplateIdFailure(message);
                }

                AddTemplateTabsToResponse(returnedContent, returnResponse);
                return(true);
            }
            catch (Exception exc)
            {
                _logger.Error(exc, "Build()");
                returnResponse.InsertExceptionIntoMeta(exc);
                return(false);
            }
        }
Exemplo n.º 2
0
        private void CreateEnvelopeFromTemplate(string emailAddress, SignatureRequest request, string username, string password, JArray returnDataArray, string uri, Models.Document[] documents = null)
        {
            JObject        returnContent;
            HttpStatusCode status = _api.SendDocuSignRequest(HttpMethod.Post, uri, username, password, out returnContent, FormatCreateEnvelopeBody(_sent, emailAddress, request, documents));

            if (status != HttpStatusCode.Created)
            {
                throw new SigSvcDocuSignAPICallFailure("Error creating envelope.  Check URI and body of Signature request.");
            }
            else
            {
                string envelopeId = returnContent.SelectToken(@"envelopeId").ToString();
                FillReturnDataArray(returnDataArray, envelopeId, emailAddress, returnContent);
                WriteToRepository(envelopeId, username, password, _sent, request, returnContent);
            }
        }
Exemplo n.º 3
0
        public bool Build(string envelopeId, string username, string password, out IResponse response)
        {
            Response returnResponse = new Response();

            string accountId = _api.GetAccountId(username, password);
            string uri       = $"{_config.ApiUrl}/v2/accounts/{accountId}/envelopes/{envelopeId}";

            JObject        result;
            HttpStatusCode status = _api.SendDocuSignRequest(HttpMethod.Get, uri, username, password, out result);

            if (status != HttpStatusCode.OK)
            {
                string message = "Get Envelope status failed. Check envelopeId and Account header information and retry.";
                _logger.Error($"Build() {message}");
                throw new SigSvcDocuSignAPICallFailure(message);
            }
            else
            {
                returnResponse.Data = new EnvelopeStatus(result["status"].Value <string>());
            }
            response = returnResponse;
            return(true);
        }