Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:

# Set update schedule for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
12 changes: 6 additions & 6 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
# Ubuntu
- { name: 'Linux .NET 5', os: ubuntu-22.04, framework: 'net5' }
# macOs
- { name: 'macOS .NET 5', os: macOS-latest, framework: 'net5' }
- { name: 'macOS .NET 5', os: macos-13, framework: 'net5' }
# Windows
- { name: 'Windows .NET Core 3', os: windows-latest, framework: 'netcoreapp3.1' }
- { name: 'Windows .NET 5', os: windows-latest, framework: 'net5' }
Expand All @@ -53,7 +53,7 @@ jobs:
shell: pwsh

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 1

Expand All @@ -66,12 +66,12 @@ jobs:
}

- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_SDK_VERSION }}

- name: Setup Nuget Cache
uses: actions/cache@v3
uses: actions/cache@v4
id: nuget-cache
with:
path: ~/.nuget
Expand Down Expand Up @@ -103,7 +103,7 @@ jobs:
/p:CollectCoverage=true

- name: Save Code Coverage Results
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: CoverageReports-${{ runner.os }}-${{ matrix.framework }}.zip
path: SignNow.Net.Test/bin/Debug/**/coverage*
Expand All @@ -126,7 +126,7 @@ jobs:

- name: Upload Code Coverage Report (Codecov.io)
continue-on-error: true
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
name: ${{ runner.os }}-codecov-${{ matrix.framework }}
flags: ${{ runner.os }},${{ env.TARGET_FRAMEWORK }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ jobs:
NUGET_XMLDOC_MODE: skip # prevent the download of the XML documentation for the packages

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup .NET 5
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
3.1.x
5.0.x

- name: Setup Nuget Cache
uses: actions/cache@v3
uses: actions/cache@v4
id: nuget-cache
with:
path: ~/.nuget
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com)
and this project adheres to [Semantic Versioning](http://semver.org).

## [Unreleased] - TBD
### Added
- Resend Invite feature [#153](https://github.com/signnow/SignNow.NET/issues/153)
- Options for Embedded invite [#160](https://github.com/signnow/SignNow.NET/issues/160)


## [1.2.3] - 2023-10-15
Expand Down
7 changes: 7 additions & 0 deletions SignNow.Net.Examples/ExamplesRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,13 @@ public async Task CreateRoleBasedInviteToSignTheDocumentTest()
var documentWithInvite = await testContext.Documents.GetDocumentAsync(document.Id).ConfigureAwait(false);
var createdInvite = documentWithInvite.FieldInvites.FirstOrDefault();

var fieldInvite = documentWithInvite.Fields.FirstOrDefault();
Assert.IsNotNull(fieldInvite?.FieldRequestId);

await testContext.Invites
.ResendEmailInviteAsync(fieldInvite?.FieldRequestId)
.ConfigureAwait(false);

Assert.AreEqual("noreply@signnow.com", createdInvite?.SignerEmail);
Assert.AreEqual("Signer 1", createdInvite?.RoleName, "Signer role mismatch.");
Assert.AreEqual(InviteStatus.Pending, createdInvite?.Status);
Expand Down
6 changes: 3 additions & 3 deletions SignNow.Net.Examples/SignNow.Net.Examples.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Import Project="..\netfx.props" />

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>
Expand All @@ -12,11 +12,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="7.0.4">
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
</ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions SignNow.Net.Test/SignNow.Net.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="Moq" Version="4.17.2" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
Expand All @@ -28,7 +28,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Bogus" Version="34.0.2" />
<PackageReference Include="Bogus" Version="35.6.1" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' ">
Expand Down
17 changes: 17 additions & 0 deletions SignNow.Net.Test/TestData/FakeModels/EmbeddedInviteFaker.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using Bogus;
using SignNow.Net.Model;
using SignNow.Net.Model.Requests;
Expand All @@ -17,7 +18,15 @@ public class EmbeddedInviteFaker : Faker<EmbeddedInvite>
/// <code>
/// {
/// "email": "Jesus_Monahan@gmail.com",
/// "language": "en",
/// "auth_method": "none",
/// "first_name": "Jesus",
/// "last_name": "Monahan",
/// "prefill_signature_name": "Jesus Monahan prefill signature",
/// "force_new_signature": "1",
/// "redirect_uri": "https://signnow.com",
/// "decline_redirect_uri": "https://signnow.com",
/// "redirect_target": "self",
/// "role_id": "c376990ca7e1e84ea7f6e252144e435f314bb63b",
/// "order": 1
/// }
Expand All @@ -28,7 +37,15 @@ public EmbeddedInviteFaker()
Rules((f, o) =>
{
o.Email = f.Internet.Email();
o.Language = f.PickRandom<Lang>();
o.AuthMethod = f.PickRandom<EmbeddedAuthType>();
o.Firstname = f.Person.FirstName;
o.Lastname = f.Person.LastName;
o.PrefillSignatureName = $"{f.Person.FirstName} {f.Person.LastName} prefill signature";
o.ForceNewSignature = f.Random.Bool();
o.RedirectUrl = new Uri(f.Internet.Url());
o.DeclineRedirectUrl = new Uri(f.Internet.Url());
o.RedirectTarget = f.PickRandom<RedirectTarget>();
o.RoleId = f.Random.Hash(40);
o.SigningOrder = (uint)f.Random.Number(1, 10);
});
Expand Down
2 changes: 2 additions & 0 deletions SignNow.Net.Test/TestData/FakeModels/FieldFaker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public sealed class FieldFaker : Faker<Field>
/// },
/// "originator": "owner@gmail.com",
/// "fulfiller": "signer1@gmail.com",
/// "field_request_id": "cbf5df90807e41d79bfda22b7ab6f57b2ed51ee3",
/// "element_id": null
/// }
/// </code>
Expand All @@ -57,6 +58,7 @@ public FieldFaker()
});
o.Owner = f.Internet.Email();
o.Signer = f.Internet.Email();
o.FieldRequestId = f.Random.Hash(40);
// A nullable Id? with 80% probability of being null.
o.ElementId = (string)f.Random.Hash(40).OrNull(f, .8f);
})
Expand Down
3 changes: 3 additions & 0 deletions SignNow.Net.Test/UnitTests/Infrastructure/RuntimeInfoTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ public void ShouldProperParseLinuxOsDetails(string kernelStr, string expected)
[DataRow("19.0.0", "10.15", DisplayName = "Catalina")]
[DataRow("20.0.0", "11.0", DisplayName = "Big Sur")]
[DataRow("21.0.0", "12.0", DisplayName = "Monterey")]
[DataRow("22.0.0", "13.0", DisplayName = "Ventura")]
[DataRow("23.0.0", "14.0", DisplayName = "Sonoma")]
[DataRow("24.0.0", "15.0", DisplayName = "Sequoia")]
[DataRow("99.0.0", "", DisplayName = "Unknown")]
public void ShouldProperParseMacOsDetails(string kernelVer, string expected)
{
Expand Down
50 changes: 49 additions & 1 deletion SignNow.Net.Test/UnitTests/Models/EmbeddedInviteTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace UnitTests.Models
{
[TestClass]
public class EmbeddedInviteTest
public class EmbeddedInviteTest : SignNowTestBase
{
[TestMethod]
public void ThrowsExceptionForInvalidEmail()
Expand All @@ -33,5 +33,53 @@ public void ThrowsExceptionForNotAllowedRange()
StringAssert.Contains(exception.Message, "Value cannot be 0");
Assert.AreEqual("SigningOrder", exception.ParamName);
}

[TestMethod]
public void ThrowsExceptionForSignatureFieldCharsMore255Symbols()
{
var invite = new EmbeddedInvite();

var exception = Assert.ThrowsException<ArgumentException>(
() => invite.PrefillSignatureName = Faker.Random.String(300));

StringAssert.Contains(exception.Message, "Prefilled text in the Signature field can be maximum 255 characters.");
Assert.AreEqual("PrefillSignatureName", exception.ParamName);
}

[TestMethod]
public void ThrowsExceptionIfRequiredSignatureNameEnabled()
{
var invite = new EmbeddedInvite
{
RequiredPresetSignatureName = "test"
};

var exception = Assert.ThrowsException<ArgumentException>(
() => invite.PrefillSignatureName = "prefill");

StringAssert.Contains(exception.Message, "Required preset for Signature name is set. Cannot be used together with");
Assert.AreEqual("PrefillSignatureName", exception.ParamName);

exception = Assert.ThrowsException<ArgumentException>(
() => invite.ForceNewSignature = true);

StringAssert.Contains(exception.Message, "Required preset for Signature name is set. Cannot be used together with");
Assert.AreEqual("ForceNewSignature", exception.ParamName);
}

[TestMethod]
public void ThrowsExceptionIfPrefilledSignatureName()
{
var invite = new EmbeddedInvite
{
PrefillSignatureName = "test"
};

var exception = Assert.ThrowsException<ArgumentException>(
() => invite.RequiredPresetSignatureName = "prefill");

StringAssert.Contains(exception.Message, "Prefill for Signature name or Force new signature is set. Cannot be used together with");
Assert.AreEqual("RequiredPresetSignatureName", exception.ParamName);
}
}
}
10 changes: 8 additions & 2 deletions SignNow.Net/Interfaces/ISignInvite.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using SignNow.Net.Model;
Expand Down Expand Up @@ -63,5 +61,13 @@ public interface ISignInvite
/// <param name="cancellationToken">Propagates notification that operations should be canceled.</param>
/// <returns></returns>
Task CancelEmbeddedInviteAsync(string documentId, CancellationToken cancellationToken = default);

/// <summary>
/// Resends an invite to sign a document.
/// </summary>
/// <param name="fieldInviteId">The role identity to resend the invitation to.</param>
/// <param name="cancellationToken">Propagates notification that operations should be canceled.</param>
/// <returns></returns>
Task ResendEmailInviteAsync(string fieldInviteId, CancellationToken cancellationToken = default);
}
}
5 changes: 5 additions & 0 deletions SignNow.Net/Interfaces/ISignNowField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,10 @@ public interface ISignNowField
/// Field attributes: name, label, x/y coordinates, width, height...
/// </summary>
FieldJsonAttributes JsonAttributes { get; }

/// <summary>
/// Field request ID
/// </summary>
string FieldRequestId { get; }
}
}
Loading