From e9de994cea97afcc1c3bc52ddf1cc023b9ee731c Mon Sep 17 00:00:00 2001 From: Minh Nguyen Cong Date: Mon, 25 Sep 2023 12:07:21 +0200 Subject: [PATCH] feat: Support `iframeable_embed_url` for sign request (#925) --- .../BoxSignRequestManagerIntegrationTest.cs | 7 ++++++- Box.V2.Test/BoxSignRequestsManagerTest.cs | 3 +++ .../Fixtures/BoxSignRequest/CancelSignRequest200.json | 3 ++- .../Fixtures/BoxSignRequest/CreateSignRequest200.json | 3 ++- .../Fixtures/BoxSignRequest/GetAllSignRequests200.json | 3 ++- Box.V2.Test/Fixtures/BoxSignRequest/GetSignRequest200.json | 3 ++- Box.V2/Models/BoxSignRequestSigner.cs | 7 +++++++ 7 files changed, 24 insertions(+), 5 deletions(-) diff --git a/Box.V2.Test.Integration/BoxSignRequestManagerIntegrationTest.cs b/Box.V2.Test.Integration/BoxSignRequestManagerIntegrationTest.cs index 6fae49bed..8f40470bd 100644 --- a/Box.V2.Test.Integration/BoxSignRequestManagerIntegrationTest.cs +++ b/Box.V2.Test.Integration/BoxSignRequestManagerIntegrationTest.cs @@ -35,7 +35,8 @@ public async Task CreateSignRequestAsync_ForCorrectSignRequestCreateRequest_Shou { Email = "sdk_integration_test@boxdemo.com", RedirectUrl = new Uri("https://www.box.com/redirect_url_signer_1"), - DeclinedRedirectUrl = new Uri("https://www.box.com/declined_redirect_url_singer_1") + DeclinedRedirectUrl = new Uri("https://www.box.com/declined_redirect_url_singer_1"), + EmbedUrlExternalUserId = UserId } }, ParentFolder = new BoxRequestEntity() @@ -54,6 +55,10 @@ public async Task CreateSignRequestAsync_ForCorrectSignRequestCreateRequest_Shou Assert.AreEqual(signRequestCreateRequest.DeclinedRedirectUrl.ToString(), signRequest.DeclinedRedirectUrl.ToString()); Assert.AreEqual(signRequestCreateRequest.ParentFolder.Id, signRequest.ParentFolder.Id); + // first signer is the sender with role final_copy_reader, second is the recipient with role signer + Assert.AreEqual(2, signRequest.Signers.Count); + Assert.IsNotNull(signRequest.Signers[1].IframeableEmbedUrl); + await UserClient.SignRequestsManager.CancelSignRequestAsync(signRequest.Id); signRequest = await UserClient.SignRequestsManager.GetSignRequestByIdAsync(signRequest.Id); diff --git a/Box.V2.Test/BoxSignRequestsManagerTest.cs b/Box.V2.Test/BoxSignRequestsManagerTest.cs index 3b4b3b7fb..64eb1e55e 100644 --- a/Box.V2.Test/BoxSignRequestsManagerTest.cs +++ b/Box.V2.Test/BoxSignRequestsManagerTest.cs @@ -164,6 +164,7 @@ public async Task CreateSignRequest_OptionalParams_Success() Assert.AreEqual("example@gmail.com", 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("https://app.box.com/embed/sign/document/bf7aaac6/", response.Signers[0].IframeableEmbedUrl); 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); @@ -213,6 +214,7 @@ public async Task GetSignRequest_Success() Assert.AreEqual("example@gmail.com", 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("https://app.box.com/embed/sign/document/bf7aaac6/", response.Entries[0].Signers[0].IframeableEmbedUrl); Assert.AreEqual("12345", response.Entries[0].ParentFolder.Id); Assert.IsTrue(response.Entries[0].IsDocumentPreparationNeeded); Assert.IsTrue(response.Entries[0].AreRemindersEnabled); @@ -259,6 +261,7 @@ public async Task GetSignRequestById_Success() Assert.AreEqual("example@gmail.com", 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("https://app.box.com/embed/sign/document/bf7aaac6/", response.Signers[0].IframeableEmbedUrl); 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); diff --git a/Box.V2.Test/Fixtures/BoxSignRequest/CancelSignRequest200.json b/Box.V2.Test/Fixtures/BoxSignRequest/CancelSignRequest200.json index f8383479a..959d3d4a2 100644 --- a/Box.V2.Test/Fixtures/BoxSignRequest/CancelSignRequest200.json +++ b/Box.V2.Test/Fixtures/BoxSignRequest/CancelSignRequest200.json @@ -70,7 +70,8 @@ ], "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" + "declined_redirect_url": "https://box.com/declined_redirect_url_signer_1", + "iframeable_embed_url": "https://app.box.com/embed/sign/document/bf7aaac6/" } ], "signing_log": { diff --git a/Box.V2.Test/Fixtures/BoxSignRequest/CreateSignRequest200.json b/Box.V2.Test/Fixtures/BoxSignRequest/CreateSignRequest200.json index 57b43b48f..69a076924 100644 --- a/Box.V2.Test/Fixtures/BoxSignRequest/CreateSignRequest200.json +++ b/Box.V2.Test/Fixtures/BoxSignRequest/CreateSignRequest200.json @@ -70,7 +70,8 @@ ], "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" + "declined_redirect_url": "https://box.com/declined_redirect_url_signer_1", + "iframeable_embed_url": "https://app.box.com/embed/sign/document/bf7aaac6/" } ], "signing_log": { diff --git a/Box.V2.Test/Fixtures/BoxSignRequest/GetAllSignRequests200.json b/Box.V2.Test/Fixtures/BoxSignRequest/GetAllSignRequests200.json index 3409ce225..65542e38c 100644 --- a/Box.V2.Test/Fixtures/BoxSignRequest/GetAllSignRequests200.json +++ b/Box.V2.Test/Fixtures/BoxSignRequest/GetAllSignRequests200.json @@ -36,7 +36,8 @@ ], "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" + "declined_redirect_url": "https://box.com/declined_redirect_url_signer_1", + "iframeable_embed_url": "https://app.box.com/embed/sign/document/bf7aaac6/" } ], "source_files": [ diff --git a/Box.V2.Test/Fixtures/BoxSignRequest/GetSignRequest200.json b/Box.V2.Test/Fixtures/BoxSignRequest/GetSignRequest200.json index 57b43b48f..69a076924 100644 --- a/Box.V2.Test/Fixtures/BoxSignRequest/GetSignRequest200.json +++ b/Box.V2.Test/Fixtures/BoxSignRequest/GetSignRequest200.json @@ -70,7 +70,8 @@ ], "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" + "declined_redirect_url": "https://box.com/declined_redirect_url_signer_1", + "iframeable_embed_url": "https://app.box.com/embed/sign/document/bf7aaac6/" } ], "signing_log": { diff --git a/Box.V2/Models/BoxSignRequestSigner.cs b/Box.V2/Models/BoxSignRequestSigner.cs index fd3433c9c..818253bdc 100644 --- a/Box.V2/Models/BoxSignRequestSigner.cs +++ b/Box.V2/Models/BoxSignRequestSigner.cs @@ -21,6 +21,7 @@ public class BoxSignRequestSigner public const string FieldSignerDecision = "signer_decision"; public const string FieldDeclinedRedirectUrl = "declined_redirect_url"; public const string FieldRedirectUrl = "redirect_url"; + public const string FieldIframeableEmbedUrl = "iframeable_embed_url"; /// /// Email address of the signer. @@ -90,6 +91,12 @@ public class BoxSignRequestSigner /// [JsonProperty(PropertyName = FieldRedirectUrl)] public virtual Uri RedirectUrl { get; private set; } + + /// + /// This URL is specifically designed for signing documents within an HTML iframe tag. + /// + [JsonProperty(PropertyName = FieldIframeableEmbedUrl)] + public virtual string IframeableEmbedUrl { get; private set; } } ///