55 lines
2.4 KiB
C#
55 lines
2.4 KiB
C#
using Knoks.Core.Entities;
|
|
using Knoks.Framework.Services;
|
|
using Microsoft.Extensions.Logging;
|
|
using Newtonsoft.Json;
|
|
using Newtonsoft.Json.Linq;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Threading.Tasks;
|
|
using Xunit;
|
|
|
|
namespace Knoks.Test.Integrations.Framework
|
|
{
|
|
public class DocuSigneSignatureTests
|
|
{
|
|
static DocuSigneSignatureService _docuSigneSignatureService = new DocuSigneSignatureService(new Logger<DocuSigneSignatureService>(new LoggerFactory()),
|
|
new DocuSigneSignatureSettings
|
|
{
|
|
Username = "d52f8286-2fd7-46e4-94a7-d32c72d0f841",
|
|
Password = "8c2bec326b",
|
|
IntegratorKey = "48f93e3f-00be-4e5c-88d8-aa6cf6d74164",
|
|
EndpointUrl = "https://demo.docusign.net/restapi/v2/",
|
|
EventNotificationUrl = "http://ngrok/v1/Services/DocuSign/EventNotification/{loanRequestAndUserUid}"
|
|
});
|
|
|
|
[Fact(DisplayName = "DocuSigne.GetBaseUrl - Ok", Skip = "Should be confirmed if will need to use")]
|
|
public async Task GetBaseUrl()
|
|
{
|
|
var result = await _docuSigneSignatureService.GetBaseUrl();
|
|
Assert.True(Uri.IsWellFormedUriString(result, UriKind.Absolute));
|
|
}
|
|
|
|
[Fact(DisplayName = "DocuSigne.RequestSignature - Ok", Skip = "Should be confirmed if will need to use")]
|
|
public async Task RequestSignature()
|
|
{
|
|
var signatureEntityInput = JsonConvert.DeserializeObject<SignatureEntityInput>(File.ReadAllText(@".\Framework\DocuSigneEntity.json"));
|
|
var signatureEntityOutput = await _docuSigneSignatureService.RequestSignature(signatureEntityInput, new JObject
|
|
{
|
|
["LoanRequestAndUserUid"] = Uid.LoanRequestAndUser(12345, null),
|
|
["JsonPlacement"] = new JObject
|
|
{
|
|
["emailSubject"] = "Please sign the Loan Contruct",
|
|
["recipients.signers[0].email"] = "markusshumate@mailinator.com", //-- check the email by on link: https://www.mailinator.com/inbox2.jsp?public_to=markusshumate
|
|
["recipients.signers[0].name"] = "Markus Shumate"
|
|
}
|
|
});
|
|
|
|
var jObj = signatureEntityOutput.Output as JObject;
|
|
await Task.Delay(5000);
|
|
Assert.NotNull(jObj);
|
|
Assert.NotNull(jObj["envelopeId"]);
|
|
}
|
|
}
|
|
}
|