Skip to content

Commit fc52909

Browse files
authored
Merge pull request #150 from signnow/fix-missing-model-props
Fix missing model props
2 parents fd17024 + 9c424f7 commit fc52909

File tree

8 files changed

+97
-10
lines changed

8 files changed

+97
-10
lines changed

.github/workflows/build_and_test.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,8 @@ jobs:
3030
matrix:
3131
include:
3232
# Ubuntu
33-
- { name: 'Linux .NET Core 3', os: ubuntu-22.04, framework: 'netcoreapp3.1' }
3433
- { name: 'Linux .NET 5', os: ubuntu-22.04, framework: 'net5' }
3534
# macOs
36-
- { name: 'macOS .NET Core 3', os: macOS-latest, framework: 'netcoreapp3.1' }
3735
- { name: 'macOS .NET 5', os: macOS-latest, framework: 'net5' }
3836
# Windows
3937
- { name: 'Windows .NET Core 3', os: windows-latest, framework: 'netcoreapp3.1' }
@@ -68,7 +66,6 @@ jobs:
6866
}
6967
7068
- name: Setup .NET SDK
71-
if: (runner.os == 'macOS' || runner.os == 'Linux')
7269
uses: actions/setup-dotnet@v3
7370
with:
7471
dotnet-version: ${{ env.DOTNET_SDK_VERSION }}

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org).
66

77
## [Unreleased] - TBD
88

9+
## [1.1.1] - 2023-05-02
10+
### Added
11+
- 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.
12+
- Add support for field type `stamp` [#149](https://github.com/signnow/SignNow.NET/issues/149)
913

1014
## [1.1.0] - 2023-01-23
1115
### Added

SignNow.Net.Test/UnitTests/Models/SignInviteTest.RoleBased.cs

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,25 @@ public void ShouldCreateRoleBasedInviteContent()
4545
var document = new SignNowDocumentFaker()
4646
.RuleFor(o => o.Roles, new RoleFaker().Generate(2));
4747

48-
var roleBasedInvite = new RoleBasedInvite(document);
48+
var roleBasedInvite = new RoleBasedInvite(document)
49+
{
50+
Message = "test-message",
51+
Subject = "test-subject"
52+
};
4953
// Set user to documents' role
5054
var roles = roleBasedInvite.DocumentRoles();
5155

5256
Assert.AreEqual(2, roles.Count);
5357

54-
var signer1Options = new SignerOptions("[email protected]", roles.First());
58+
var signer1Options = new SignerOptions("[email protected]", roles.First())
59+
{
60+
AllowToReassign = false,
61+
DeclineBySignature = true,
62+
SignatureNamePrefill = "User-signature-name",
63+
SignatureNameRequiredPreset = "required-signature-preset",
64+
ForceNewSignature = false
65+
};
66+
5567
var signer2Options = new SignerOptions("[email protected]", roles.Last())
5668
{
5769
ExpirationDays = 15
@@ -71,7 +83,12 @@ public void ShouldCreateRoleBasedInviteContent()
7183
'email':'[email protected]',
7284
'role':'Signer 1',
7385
'role_id':'{roles.First().Id}',
74-
'order':1
86+
'order':1,
87+
'prefill_signature_name': 'User-signature-name',
88+
'required_preset_signature_name': 'required-signature-preset',
89+
'force_new_signature': 0,
90+
'reassign': 0,
91+
'decline_by_signature': 1
7592
}},
7693
{{
7794
'email':'[email protected]',
@@ -83,8 +100,8 @@ public void ShouldCreateRoleBasedInviteContent()
83100
'expiration_days':15
84101
}}
85102
],
86-
'subject':null,
87-
'message':null,
103+
'subject': 'test-subject',
104+
'message': 'test-message',
88105
'cc':[],
89106
90107
}}";

SignNow.Net/Model/Field.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ public enum FieldType
8686
[EnumMember(Value = "signature")]
8787
Signature,
8888

89+
/// <summary>
90+
/// Stamp fields.
91+
/// </summary>
92+
[EnumMember(Value = "stamp")]
93+
Stamp,
94+
8995
/// <summary>
9096
/// Initials fields.
9197
/// </summary>

SignNow.Net/Model/SignerOptions.cs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using Newtonsoft.Json;
33
using SignNow.Net.Internal.Extensions;
44
using SignNow.Net.Internal.Helpers;
5+
using SignNow.Net.Internal.Helpers.Converters;
56
using SignNow.Net.Internal.Model;
67

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

51+
/// <summary>
52+
/// Prefilled text in the Signature field, available for editing by signer.
53+
/// </summary>
54+
[JsonProperty("prefill_signature_name", NullValueHandling = NullValueHandling.Ignore)]
55+
public string SignatureNamePrefill { get; set; }
56+
57+
/// <summary>
58+
/// PPrefilled text in the Signature field, disabled for editing by signer.
59+
/// </summary>
60+
[JsonProperty("required_preset_signature_name", NullValueHandling = NullValueHandling.Ignore)]
61+
public string SignatureNameRequiredPreset { get; set; }
62+
63+
/// <summary>
64+
/// Whether or not the signer can use their saved signature.
65+
/// Possible values:
66+
/// `false` - signer can use a saved signature,
67+
/// `true` - signer has to add a new signature.
68+
/// </summary>
69+
[JsonProperty("force_new_signature", NullValueHandling = NullValueHandling.Ignore)]
70+
[JsonConverter(typeof(BoolToIntJsonConverter))]
71+
public bool? ForceNewSignature { get; set; }
72+
73+
/// <summary>
74+
/// Whether or not to allow recipients reassign this invite to another email address.
75+
/// </summary>
76+
[JsonProperty("reassign", NullValueHandling = NullValueHandling.Ignore)]
77+
[JsonConverter(typeof(BoolToIntJsonConverter))]
78+
public bool? AllowToReassign { get; set; }
79+
80+
/// <summary>
81+
/// Whether or not to allow recipients decline the invite.
82+
/// </summary>
83+
[JsonProperty("decline_by_signature", NullValueHandling = NullValueHandling.Ignore)]
84+
[JsonConverter(typeof(BoolToIntJsonConverter))]
85+
public bool? DeclineBySignature { get; set; }
86+
5087
/// <summary>
5188
/// Authentication type for case, when password used to open the Document.
5289
/// </summary>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using System;
2+
using Newtonsoft.Json;
3+
4+
namespace SignNow.Net.Internal.Helpers.Converters
5+
{
6+
/// <summary>
7+
/// Converts <see cref="System.Boolean"/> to <see cref="int"/>
8+
/// </summary>
9+
internal class BoolToIntJsonConverter : JsonConverter
10+
{
11+
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
12+
{
13+
writer.WriteValue(((bool)value) ? 1 : 0);
14+
}
15+
16+
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
17+
{
18+
return reader.Value.ToString() == "1";
19+
}
20+
21+
public override bool CanConvert(Type objectType)
22+
{
23+
return objectType == typeof(bool);
24+
}
25+
}
26+
}

SignNow.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44

5-
<Version>1.1.0</Version>
5+
<Version>1.1.1</Version>
66
<Authors>signNow</Authors>
77
<Company>signNow</Company>
88
<Description>signNow.Net is a .NET 4.5+ and .NET standard class library for the signNow API. (Official Library)

codecov.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
codecov:
22
notify:
33
require_ci_to_pass: yes # require the build to pass before submitting notifications
4-
after_n_builds: 7 # how many build to wait for before submitting notifications, therefore skipping status checks
4+
after_n_builds: 5 # how many build to wait for before submitting notifications, therefore skipping status checks
55

66
coverage:
77
precision: 2

0 commit comments

Comments
 (0)