public void CreateTemplateTest() { try { AuthenticationApiTests authTests = new AuthenticationApiTests(); authTests.LoginTest(); EnvelopeTemplate templateDef = Utils.CreateDefaultTemplate(); TemplatesApi templatesApi = new TemplatesApi(); TemplateSummary tempSummary = templatesApi.CreateTemplate(TestConfig.AccountId, templateDef); Assert.IsNotNull(tempSummary); Assert.IsNotNull(tempSummary.TemplateId); Trace.WriteLine("TemplateSummary: " + tempSummary.ToJson()); } catch (DocuSign.eSign.Client.ApiException apiEx) { // FAILS - API-3002 submitted. Assert.IsNotNull(apiEx.ErrorCode); Assert.IsTrue(!string.IsNullOrWhiteSpace(apiEx.Message)); Assert.IsTrue(false, "Failed with ErrorCode: " + apiEx.ErrorCode + ", Message: " + apiEx.Message); } }
public void RequestSignatureViaTemplateTest() { try { // upload template if one doesn't exist // FAILED - CANT UPLOAD A TEMPLATE - API-3002 submitted // use predefined template AuthenticationApiTests authTests = new AuthenticationApiTests(); authTests.LoginTest(); // get pre-existing template with Signer1 role // since I can't upload a template right now TemplatesApi templatesApi = new TemplatesApi(); EnvelopeTemplateResults templateResults = templatesApi.ListTemplates(TestConfig.AccountId); Assert.IsNotNull(templateResults); Assert.IsNotNull(templateResults.EnvelopeTemplates); string templateId = null; foreach (EnvelopeTemplateResult et in templateResults.EnvelopeTemplates) { if (et.Name == "Test Template") { templateId = et.TemplateId; break; } } Assert.IsNotNull(templateId); EnvelopeDefinition envDef = new EnvelopeDefinition(); envDef.TemplateId = templateId; envDef.TemplateRoles = new List<TemplateRole>(); TemplateRole templateRole = new TemplateRole(); templateRole.Email = TestConfig.DefaultEmail; templateRole.Name = TestConfig.DefaultName; templateRole.RoleName = "Signer1"; envDef.TemplateRoles.Add(templateRole); envDef.Status = "sent"; // trigger the envelope to be sent (vs. Draft/Created) // send envelope using template roles EnvelopesApi envelopesApi = new EnvelopesApi(); EnvelopeSummary es = envelopesApi.CreateEnvelope(TestConfig.AccountId, envDef); Assert.IsNotNull(es); Assert.IsNotNull(es.EnvelopeId); Trace.WriteLine("Envelope: " + es.ToJson()); } catch (DocuSign.eSign.Client.ApiException apiEx) { Assert.IsNotNull(apiEx.ErrorCode); Assert.IsTrue(!string.IsNullOrWhiteSpace(apiEx.Message)); Assert.IsTrue(false, "Failed with ErrorCode: " + apiEx.ErrorCode + ", Message: " + apiEx.Message); } }