Skip to content

Commit

Permalink
feat: Add redirect_url and declined_redirect_url to Sign Request (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
congminh1254 authored Aug 26, 2022
1 parent 74b9104 commit 5ef2f18
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 6 deletions.
21 changes: 19 additions & 2 deletions Box.V2.Test/BoxSignRequestsManagerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public async Task CreateSignRequest_RequiredParams_Success()
new BoxSignRequestSignerCreate()
{
Email = "[email protected]",
Role = BoxSignRequestSignerRole.signer,
Role = BoxSignRequestSignerRole.signer
}
};

Expand Down Expand Up @@ -110,7 +110,10 @@ public async Task CreateSignRequest_OptionalParams_Success()
{
new BoxSignRequestSignerCreate()
{
Email = "[email protected]"
Email = "[email protected]",
Role = BoxSignRequestSignerRole.signer,
RedirectUrl = new Uri("https://box.com/redirect_url_signer_1"),
DeclinedRedirectUrl = new Uri("https://box.com/declined_redirect_url_signer_1")
}
};

Expand All @@ -132,6 +135,8 @@ public async Task CreateSignRequest_OptionalParams_Success()
SourceFiles = sourceFiles,
Signers = signers,
ParentFolder = parentFolder,
RedirectUrl = new Uri("https://box.com/redirect_url"),
DeclinedRedirectUrl = new Uri("https://box.com/declined_redirect_url"),
PrefillTags = new List<BoxSignRequestPrefillTag>
{
new BoxSignRequestPrefillTag
Expand All @@ -156,6 +161,8 @@ public async Task CreateSignRequest_OptionalParams_Success()
Assert.AreEqual("12345", response.SourceFiles[0].Id);
Assert.AreEqual(1, response.Signers.Count);
Assert.AreEqual("[email protected]", response.Signers[0].Email);
Assert.AreEqual("https://box.com/redirect_url_signer_1", response.Signers[0].RedirectUrl.ToString());
Assert.AreEqual("https://box.com/declined_redirect_url_signer_1", response.Signers[0].DeclinedRedirectUrl.ToString());
Assert.AreEqual(1, response.Signers[0].Inputs.Count);
Assert.IsTrue(response.Signers[0].Inputs[0].CheckboxValue.Value);
Assert.AreEqual(BoxSignRequestSingerInputContentType.checkbox, response.Signers[0].Inputs[0].ContentType);
Expand All @@ -171,6 +178,8 @@ public async Task CreateSignRequest_OptionalParams_Success()
Assert.AreEqual("1234", response.PrefillTags[0].DocumentTagId);
Assert.AreEqual("text", response.PrefillTags[0].TextValue);
Assert.AreEqual(DateTimeOffset.Parse("2021-04-26T08:12:13.982Z"), response.PrefillTags[0].DateValue);
Assert.AreEqual("https://box.com/redirect_url", response.RedirectUrl.ToString());
Assert.AreEqual("https://box.com/declined_redirect_url", response.DeclinedRedirectUrl.ToString());
}

[TestMethod]
Expand Down Expand Up @@ -200,6 +209,8 @@ public async Task GetSignRequest_Success()
Assert.AreEqual("12345", response.Entries[0].SourceFiles[0].Id);
Assert.AreEqual(1, response.Entries[0].Signers.Count);
Assert.AreEqual("[email protected]", response.Entries[0].Signers[0].Email);
Assert.AreEqual("https://box.com/redirect_url_signer_1", response.Entries[0].Signers[0].RedirectUrl.ToString());
Assert.AreEqual("https://box.com/declined_redirect_url_signer_1", response.Entries[0].Signers[0].DeclinedRedirectUrl.ToString());
Assert.AreEqual("12345", response.Entries[0].ParentFolder.Id);
Assert.IsTrue(response.Entries[0].IsDocumentPreparationNeeded);
Assert.IsTrue(response.Entries[0].AreRemindersEnabled);
Expand All @@ -213,6 +224,8 @@ public async Task GetSignRequest_Success()
Assert.AreEqual("text", response.Entries[0].PrefillTags[0].TextValue);
Assert.IsTrue(response.Entries[0].PrefillTags[0].CheckboxValue.Value);
Assert.AreEqual(DateTimeOffset.Parse("2021-04-26T08:12:13.982Z"), response.Entries[0].PrefillTags[0].DateValue);
Assert.AreEqual("https://box.com/redirect_url", response.Entries[0].RedirectUrl.ToString());
Assert.AreEqual("https://box.com/declined_redirect_url", response.Entries[0].DeclinedRedirectUrl.ToString());
}

[TestMethod]
Expand Down Expand Up @@ -242,6 +255,8 @@ public async Task GetSignRequestById_Success()
Assert.AreEqual("12345", response.SourceFiles[0].Id);
Assert.AreEqual(1, response.Signers.Count);
Assert.AreEqual("[email protected]", response.Signers[0].Email);
Assert.AreEqual("https://box.com/redirect_url_signer_1", response.Signers[0].RedirectUrl.ToString());
Assert.AreEqual("https://box.com/declined_redirect_url_signer_1", response.Signers[0].DeclinedRedirectUrl.ToString());
Assert.AreEqual(1, response.Signers[0].Inputs.Count);
Assert.IsTrue(response.Signers[0].Inputs[0].CheckboxValue.Value);
Assert.AreEqual(BoxSignRequestSingerInputContentType.checkbox, response.Signers[0].Inputs[0].ContentType);
Expand All @@ -258,6 +273,8 @@ public async Task GetSignRequestById_Success()
Assert.AreEqual("text", response.PrefillTags[0].TextValue);
Assert.IsTrue(response.PrefillTags[0].CheckboxValue.Value);
Assert.AreEqual(DateTimeOffset.Parse("2021-04-26T08:12:13.982Z"), response.PrefillTags[0].DateValue);
Assert.AreEqual("https://box.com/redirect_url", response.RedirectUrl.ToString());
Assert.AreEqual("https://box.com/declined_redirect_url", response.DeclinedRedirectUrl.ToString());
}

[TestMethod]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
}
],
"prepare_url": "https://prepareurl.com",
"redirect_url": "https://box.com/redirect_url",
"declined_redirect_url": "https://box.com/declined_redirect_url",
"sign_files": {
"files": [
{
Expand Down Expand Up @@ -66,7 +68,9 @@
"content_type": "checkbox"
}
],
"embed_url": "https://example.com"
"embed_url": "https://example.com",
"redirect_url": "https://box.com/redirect_url_signer_1",
"declined_redirect_url": "https://box.com/declined_redirect_url_signer_1"
}
],
"signing_log": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
}
],
"prepare_url": "https://prepareurl.com",
"redirect_url": "https://box.com/redirect_url",
"declined_redirect_url": "https://box.com/declined_redirect_url",
"sign_files": {
"files": [
{
Expand Down Expand Up @@ -66,7 +68,9 @@
"content_type": "checkbox"
}
],
"embed_url": "https://example.com"
"embed_url": "https://example.com",
"redirect_url": "https://box.com/redirect_url_signer_1",
"declined_redirect_url": "https://box.com/declined_redirect_url_signer_1"
}
],
"signing_log": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
"content_type": "checkbox"
}
],
"embed_url": "https://example.com"
"embed_url": "https://example.com",
"redirect_url": "https://box.com/redirect_url_signer_1",
"declined_redirect_url": "https://box.com/declined_redirect_url_signer_1"
}
],
"source_files": [
Expand Down Expand Up @@ -73,6 +75,8 @@
"type": "sign-request",
"id": "12345",
"prepare_url": "https://prepareurl.com",
"redirect_url": "https://box.com/redirect_url",
"declined_redirect_url": "https://box.com/declined_redirect_url",
"signing_log": {
"id": "12345",
"etag": "1",
Expand Down
6 changes: 5 additions & 1 deletion Box.V2.Test/Fixtures/BoxSignRequest/GetSignRequest200.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
}
],
"prepare_url": "https://prepareurl.com",
"redirect_url": "https://box.com/redirect_url",
"declined_redirect_url": "https://box.com/declined_redirect_url",
"sign_files": {
"files": [
{
Expand Down Expand Up @@ -66,7 +68,9 @@
"content_type": "checkbox"
}
],
"embed_url": "https://example.com"
"embed_url": "https://example.com",
"redirect_url": "https://box.com/redirect_url_signer_1",
"declined_redirect_url": "https://box.com/declined_redirect_url_signer_1"
}
],
"signing_log": {
Expand Down
14 changes: 14 additions & 0 deletions Box.V2/Models/BoxSignRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public class BoxSignRequest : BoxEntity
public const string FieldSigningLog = "signing_log";
public const string FieldSourceFiles = "source_files";
public const string FieldStatus = "status";
public const string FieldDeclinedRedirectUrl = "declined_redirect_url";
public const string FieldRedirectUrl = "redirect_url";

/// <summary>
/// Reminds signers to sign a document on day 3, 8, 13 and 18. Reminders are only sent to outstanding signers.
Expand Down Expand Up @@ -128,6 +130,18 @@ public class BoxSignRequest : BoxEntity
[JsonProperty(PropertyName = FieldStatus)]
[JsonConverter(typeof(StringEnumConverter))]
public virtual BoxSignRequestStatus Status { get; private set; }

/// <summary>
/// URL to redirect the signer to if they decline to sign the document.
/// </summary>
[JsonProperty(PropertyName = FieldDeclinedRedirectUrl)]
public virtual Uri DeclinedRedirectUrl { get; private set; }

/// <summary>
/// URL to redirect the signer to after they sign the document.
/// </summary>
[JsonProperty(PropertyName = FieldRedirectUrl)]
public virtual Uri RedirectUrl { get; private set; }
}

/// <summary>
Expand Down
14 changes: 14 additions & 0 deletions Box.V2/Models/BoxSignRequestSigner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public class BoxSignRequestSigner
public const string FieldOrder = "order";
public const string FieldRole = "role";
public const string FieldSignerDecision = "signer_decision";
public const string FieldDeclinedRedirectUrl = "declined_redirect_url";
public const string FieldRedirectUrl = "redirect_url";

/// <summary>
/// Email address of the signer.
Expand Down Expand Up @@ -76,6 +78,18 @@ public class BoxSignRequestSigner
/// </summary>
[JsonProperty(PropertyName = FieldSignerDecision)]
public virtual BoxSignRequestSignerDecision SignerDecision { get; private set; }

/// <summary>
/// URL to redirect the signer to if they decline to sign the document.
/// </summary>
[JsonProperty(PropertyName = FieldDeclinedRedirectUrl)]
public virtual Uri DeclinedRedirectUrl { get; private set; }

/// <summary>
/// URL to redirect the signer to after they sign the document.
/// </summary>
[JsonProperty(PropertyName = FieldRedirectUrl)]
public virtual Uri RedirectUrl { get; private set; }
}

/// <summary>
Expand Down
25 changes: 25 additions & 0 deletions Box.V2/Models/Request/BoxSignRequestCreateRequest.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
Expand Down Expand Up @@ -78,6 +79,18 @@ public class BoxSignRequestCreateRequest
/// </summary>
[JsonProperty(PropertyName = "source_files")]
public List<BoxSignRequestCreateSourceFile> SourceFiles { get; set; }

/// <summary>
/// URL to redirect the signer to if they decline to sign the document.
/// </summary>
[JsonProperty(PropertyName = "declined_redirect_url")]
public Uri DeclinedRedirectUrl { get; set; }

/// <summary>
/// URL to redirect the signer to after they sign the document.
/// </summary>
[JsonProperty(PropertyName = "redirect_url")]
public Uri RedirectUrl { get; set; }
}

/// <summary>
Expand Down Expand Up @@ -159,5 +172,17 @@ public class BoxSignRequestSignerCreate
[JsonProperty(PropertyName = "role")]
[JsonConverter(typeof(StringEnumConverter))]
public BoxSignRequestSignerRole? Role { get; set; }

/// <summary>
/// The URL to redirect the signer to if they decline to sign the document.
/// </summary>
[JsonProperty(PropertyName = "declined_redirect_url")]
public Uri DeclinedRedirectUrl { get; set; }

/// <summary>
/// The URL to redirect the signer to after they sign the document.
/// </summary>
[JsonProperty(PropertyName = "redirect_url")]
public Uri RedirectUrl { get; set; }
}
}

0 comments on commit 5ef2f18

Please sign in to comment.