public Startup(IConfiguration configuration) { Configuration = configuration; if (Configuration["ASPNETCORE_YAML_CONFIG"] == null) { throw new Exception("ASPNETCORE_YAML_CONFIG need to be passed"); } var reader = new StreamReader(Configuration["ASPNETCORE_YAML_CONFIG"]); var deserializer = new DeserializerBuilder().Build(); var yamlObject = deserializer.Deserialize(reader); var serializer = new SerializerBuilder() .JsonCompatible() .Build(); var json = serializer.Serialize(yamlObject); LingkFile.Create(LingkConst.TempSettingsPath, json); var builder = new ConfigurationBuilder().AddJsonFile(LingkConst.TempSettingsPath); this.Configuration = builder.Build(); var lingkConfig = new LingkConfig(); Configuration.Bind(lingkConfig); LingkYaml.LingkYamlConfig = lingkConfig; File.Delete(LingkConst.TempSettingsPath); LingkFile.Create(LingkConst.LingkFileSystemPath, ""); }
public string CreateURL(string signerEmail, string signerName, string ccEmail, string ccName) { var lingkEnvelopeFilePath = LingkConst.LingkFileSystemPath; var envResp = LingkFile.CheckEnvelopeExists(lingkEnvelopeFilePath, new LingkEnvelope { accountId = accountId, templateId = templateId }); if (envResp != null) { return(envResp.recipientUrl); } var apiClient = new ApiClient(lingkCredentials.credentialsJson.isSandbox ? LingkConst.DocusignDemoUrl : LingkConst.DocusignProdUrl); apiClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " + this.lingkCredentials.docuSignToken.access_token); Tabs tabs = GetValidTabs(); TemplateRole signer = new TemplateRole { Email = signerEmail, Name = signerName, RoleName = "signer", ClientUserId = signerClientId, // Change the signer to be embedded Tabs = tabs //Set tab values }; TemplateRole cc = new TemplateRole { Email = ccEmail, Name = ccName, RoleName = "cc" }; // Step 4: Create the envelope definition EnvelopeDefinition envelopeAttributes = new EnvelopeDefinition { // Uses the template ID received from example 08 TemplateId = templateId, Status = "Sent", TemplateRoles = new List <TemplateRole> { signer, cc } }; var envelopesApi = new EnvelopesApi(apiClient); EnvelopeSummary results = envelopesApi.CreateEnvelope(accountId, envelopeAttributes); RecipientViewRequest viewRequest = new RecipientViewRequest(); viewRequest.ReturnUrl = selectedEnvelope.DocusignReturnUrl; viewRequest.AuthenticationMethod = "none"; viewRequest.Email = signerEmail; viewRequest.UserName = signerName; viewRequest.ClientUserId = signerClientId; var envelopeId = results.EnvelopeId; ViewUrl results1 = envelopesApi.CreateRecipientView(accountId, envelopeId, viewRequest); string redirectUrl = results1.Url; LingkFile.AddDocusignEnvelope(lingkEnvelopeFilePath, new LingkEnvelope { envelopeId = envelopeId, accountId = accountId, recipientUrl = redirectUrl, templateId = templateId }); return(redirectUrl); }