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
3 changes: 0 additions & 3 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ jobs:
matrix:
include:
# Ubuntu
- { name: 'Linux .NET Core 3', os: ubuntu-22.04, framework: 'netcoreapp3.1' }
- { name: 'Linux .NET 5', os: ubuntu-22.04, framework: 'net5' }
# macOs
- { name: 'macOS .NET Core 3', os: macOS-latest, framework: 'netcoreapp3.1' }
- { name: 'macOS .NET 5', os: macOS-latest, framework: 'net5' }
# Windows
- { name: 'Windows .NET Core 3', os: windows-latest, framework: 'netcoreapp3.1' }
Expand Down Expand Up @@ -68,7 +66,6 @@ jobs:
}

- name: Setup .NET SDK
if: (runner.os == 'macOS' || runner.os == 'Linux')
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_SDK_VERSION }}
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org).

## [Unreleased] - TBD

## [1.1.1] - 2023-05-02
### Added
- Properties for sign invite that allows you to prefill text in the Signature field, allows for signers to use their saved signature, allows recipients reassign this invite to another email address, allow recipients decline the invite.
- Add support for field type `stamp` [#149](https://github.com/signnow/SignNow.NET/issues/149)

## [1.1.0] - 2023-01-23
### Added
Expand Down
27 changes: 22 additions & 5 deletions SignNow.Net.Test/UnitTests/Models/SignInviteTest.RoleBased.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,25 @@ public void ShouldCreateRoleBasedInviteContent()
var document = new SignNowDocumentFaker()
.RuleFor(o => o.Roles, new RoleFaker().Generate(2));

var roleBasedInvite = new RoleBasedInvite(document);
var roleBasedInvite = new RoleBasedInvite(document)
{
Message = "test-message",
Subject = "test-subject"
};
// Set user to documents' role
var roles = roleBasedInvite.DocumentRoles();

Assert.AreEqual(2, roles.Count);

var signer1Options = new SignerOptions("signer1@signnow.com", roles.First());
var signer1Options = new SignerOptions("signer1@signnow.com", roles.First())
{
AllowToReassign = false,
DeclineBySignature = true,
SignatureNamePrefill = "User-signature-name",
SignatureNameRequiredPreset = "required-signature-preset",
ForceNewSignature = false
};

var signer2Options = new SignerOptions("signer2@signnow.com", roles.Last())
{
ExpirationDays = 15
Expand All @@ -71,7 +83,12 @@ public void ShouldCreateRoleBasedInviteContent()
'email':'signer1@signnow.com',
'role':'Signer 1',
'role_id':'{roles.First().Id}',
'order':1
'order':1,
'prefill_signature_name': 'User-signature-name',
'required_preset_signature_name': 'required-signature-preset',
'force_new_signature': 0,
'reassign': 0,
'decline_by_signature': 1
}},
{{
'email':'signer2@signnow.com',
Expand All @@ -83,8 +100,8 @@ public void ShouldCreateRoleBasedInviteContent()
'expiration_days':15
}}
],
'subject':null,
'message':null,
'subject': 'test-subject',
'message': 'test-message',
'cc':[],
'from':'sender@signnow.com'
}}";
Expand Down
6 changes: 6 additions & 0 deletions SignNow.Net/Model/Field.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ public enum FieldType
[EnumMember(Value = "signature")]
Signature,

/// <summary>
/// Stamp fields.
/// </summary>
[EnumMember(Value = "stamp")]
Stamp,

/// <summary>
/// Initials fields.
/// </summary>
Expand Down
37 changes: 37 additions & 0 deletions SignNow.Net/Model/SignerOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Newtonsoft.Json;
using SignNow.Net.Internal.Extensions;
using SignNow.Net.Internal.Helpers;
using SignNow.Net.Internal.Helpers.Converters;
using SignNow.Net.Internal.Model;

namespace SignNow.Net.Model
Expand Down Expand Up @@ -47,6 +48,42 @@ public sealed class SignerOptions
[JsonProperty("order")]
public int SigningOrder => SignerRole.SigningOrder;

/// <summary>
/// Prefilled text in the Signature field, available for editing by signer.
/// </summary>
[JsonProperty("prefill_signature_name", NullValueHandling = NullValueHandling.Ignore)]
public string SignatureNamePrefill { get; set; }

/// <summary>
/// PPrefilled text in the Signature field, disabled for editing by signer.
/// </summary>
[JsonProperty("required_preset_signature_name", NullValueHandling = NullValueHandling.Ignore)]
public string SignatureNameRequiredPreset { get; set; }

/// <summary>
/// Whether or not the signer can use their saved signature.
/// Possible values:
/// `false` - signer can use a saved signature,
/// `true` - signer has to add a new signature.
/// </summary>
[JsonProperty("force_new_signature", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(BoolToIntJsonConverter))]
public bool? ForceNewSignature { get; set; }

/// <summary>
/// Whether or not to allow recipients reassign this invite to another email address.
/// </summary>
[JsonProperty("reassign", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(BoolToIntJsonConverter))]
public bool? AllowToReassign { get; set; }

/// <summary>
/// Whether or not to allow recipients decline the invite.
/// </summary>
[JsonProperty("decline_by_signature", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(BoolToIntJsonConverter))]
public bool? DeclineBySignature { get; set; }

/// <summary>
/// Authentication type for case, when password used to open the Document.
/// </summary>
Expand Down
26 changes: 26 additions & 0 deletions SignNow.Net/_Internal/Helpers/Converters/BoolToIntJsonConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System;
using Newtonsoft.Json;

namespace SignNow.Net.Internal.Helpers.Converters
{
/// <summary>
/// Converts <see cref="System.Boolean"/> to <see cref="int"/>
/// </summary>
internal class BoolToIntJsonConverter : JsonConverter
{
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
writer.WriteValue(((bool)value) ? 1 : 0);
}

public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
return reader.Value.ToString() == "1";
}

public override bool CanConvert(Type objectType)
{
return objectType == typeof(bool);
}
}
}
2 changes: 1 addition & 1 deletion SignNow.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>

<Version>1.1.0</Version>
<Version>1.1.1</Version>
<Authors>signNow</Authors>
<Company>signNow</Company>
<Description>signNow.Net is a .NET 4.5+ and .NET standard class library for the signNow API. (Official Library)
Expand Down
2 changes: 1 addition & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
codecov:
notify:
require_ci_to_pass: yes # require the build to pass before submitting notifications
after_n_builds: 7 # how many build to wait for before submitting notifications, therefore skipping status checks
after_n_builds: 5 # how many build to wait for before submitting notifications, therefore skipping status checks

coverage:
precision: 2
Expand Down