From a06911be8ff0bb14bb812bae7d6f3806ed07d8e4 Mon Sep 17 00:00:00 2001 From: AlexNDRmac Date: Tue, 2 May 2023 16:56:41 +0300 Subject: [PATCH 1/5] Add signature properties --- .../Models/SignInviteTest.RoleBased.cs | 27 +++++++++++--- SignNow.Net/Model/SignerOptions.cs | 37 +++++++++++++++++++ .../Converters/BoolToIntJsonConverter.cs | 26 +++++++++++++ 3 files changed, 85 insertions(+), 5 deletions(-) create mode 100644 SignNow.Net/_Internal/Helpers/Converters/BoolToIntJsonConverter.cs diff --git a/SignNow.Net.Test/UnitTests/Models/SignInviteTest.RoleBased.cs b/SignNow.Net.Test/UnitTests/Models/SignInviteTest.RoleBased.cs index ca1a41ea..2b5ff9bf 100644 --- a/SignNow.Net.Test/UnitTests/Models/SignInviteTest.RoleBased.cs +++ b/SignNow.Net.Test/UnitTests/Models/SignInviteTest.RoleBased.cs @@ -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 @@ -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', @@ -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' }}"; diff --git a/SignNow.Net/Model/SignerOptions.cs b/SignNow.Net/Model/SignerOptions.cs index 513d610b..f7329336 100644 --- a/SignNow.Net/Model/SignerOptions.cs +++ b/SignNow.Net/Model/SignerOptions.cs @@ -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 @@ -47,6 +48,42 @@ public sealed class SignerOptions [JsonProperty("order")] public int SigningOrder => SignerRole.SigningOrder; + /// + /// Prefilled text in the Signature field, available for editing by signer. + /// + [JsonProperty("prefill_signature_name", NullValueHandling = NullValueHandling.Ignore)] + public string SignatureNamePrefill { get; set; } + + /// + /// PPrefilled text in the Signature field, disabled for editing by signer. + /// + [JsonProperty("required_preset_signature_name", NullValueHandling = NullValueHandling.Ignore)] + public string SignatureNameRequiredPreset { get; set; } + + /// + /// 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. + /// + [JsonProperty("force_new_signature", NullValueHandling = NullValueHandling.Ignore)] + [JsonConverter(typeof(BoolToIntJsonConverter))] + public bool? ForceNewSignature { get; set; } + + /// + /// Whether or not to allow recipients reassign this invite to another email address. + /// + [JsonProperty("reassign", NullValueHandling = NullValueHandling.Ignore)] + [JsonConverter(typeof(BoolToIntJsonConverter))] + public bool? AllowToReassign { get; set; } + + /// + /// Whether or not to allow recipients decline the invite. + /// + [JsonProperty("decline_by_signature", NullValueHandling = NullValueHandling.Ignore)] + [JsonConverter(typeof(BoolToIntJsonConverter))] + public bool? DeclineBySignature { get; set; } + /// /// Authentication type for case, when password used to open the Document. /// diff --git a/SignNow.Net/_Internal/Helpers/Converters/BoolToIntJsonConverter.cs b/SignNow.Net/_Internal/Helpers/Converters/BoolToIntJsonConverter.cs new file mode 100644 index 00000000..7841ee67 --- /dev/null +++ b/SignNow.Net/_Internal/Helpers/Converters/BoolToIntJsonConverter.cs @@ -0,0 +1,26 @@ +using System; +using Newtonsoft.Json; + +namespace SignNow.Net.Internal.Helpers.Converters +{ + /// + /// Converts to + /// + 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); + } + } +} From 3a89abbe39f2e553f048eccd91e151d13b7040ad Mon Sep 17 00:00:00 2001 From: AlexNDRmac Date: Tue, 2 May 2023 17:50:28 +0300 Subject: [PATCH 2/5] Add filed stamp --- CHANGELOG.md | 4 +++- SignNow.Net/Model/Field.cs | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25150065..366b8eda 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +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 +- 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 diff --git a/SignNow.Net/Model/Field.cs b/SignNow.Net/Model/Field.cs index 682f6d22..235ea528 100644 --- a/SignNow.Net/Model/Field.cs +++ b/SignNow.Net/Model/Field.cs @@ -86,6 +86,12 @@ public enum FieldType [EnumMember(Value = "signature")] Signature, + /// + /// Stamp fields. + /// + [EnumMember(Value = "stamp")] + Stamp, + /// /// Initials fields. /// From 4e6c926446c823d0d48e03eb6d491be9dd7e9486 Mon Sep 17 00:00:00 2001 From: AlexNDRmac Date: Tue, 2 May 2023 17:51:55 +0300 Subject: [PATCH 3/5] Update changelog and version --- CHANGELOG.md | 2 ++ SignNow.props | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 366b8eda..0a86f696 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com) 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) diff --git a/SignNow.props b/SignNow.props index c468c97e..35044302 100644 --- a/SignNow.props +++ b/SignNow.props @@ -2,7 +2,7 @@ - 1.1.0 + 1.1.1 signNow signNow signNow.Net is a .NET 4.5+ and .NET standard class library for the signNow API. (Official Library) From 10c440863c65b99d3b2406426e9118d70618fa55 Mon Sep 17 00:00:00 2001 From: AlexNDRmac Date: Tue, 2 May 2023 18:05:44 +0300 Subject: [PATCH 4/5] Add dotnet SDK setup for win instances --- .github/workflows/build_and_test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index b9f571e4..2a5ce821 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -68,7 +68,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 }} From 9c424f77d313866eaf7e7047bc296f5539a9943f Mon Sep 17 00:00:00 2001 From: AlexNDRmac Date: Tue, 2 May 2023 18:13:50 +0300 Subject: [PATCH 5/5] Drop support for netstandard 1.2 tests on Unix-like OS [skip ci] --- .github/workflows/build_and_test.yml | 2 -- codecov.yml | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 2a5ce821..152e160a 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -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' } diff --git a/codecov.yml b/codecov.yml index ec1d6bc9..f4d7aab2 100644 --- a/codecov.yml +++ b/codecov.yml @@ -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