-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Support sign request signer group ID (#938)
* feat: Support sign request signer group ID * feat: Support sign request signer group ID * Update code
- Loading branch information
1 parent
fb59489
commit 096a098
Showing
7 changed files
with
157 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,19 @@ public async Task CreateSignRequestAsync_ForCorrectSignRequestCreateRequest_Shou | |
Email = "[email protected]", | ||
RedirectUrl = new Uri("https://www.box.com/redirect_url_signer_1"), | ||
DeclinedRedirectUrl = new Uri("https://www.box.com/declined_redirect_url_singer_1"), | ||
EmbedUrlExternalUserId = UserId | ||
EmbedUrlExternalUserId = UserId, | ||
SignerGroupId = "SignerGroup", | ||
Password = "password", | ||
LoginRequired = false, | ||
}, | ||
new BoxSignRequestSignerCreate() | ||
{ | ||
Email = "[email protected]", | ||
RedirectUrl = new Uri("https://www.box.com/redirect_url_signer_2"), | ||
DeclinedRedirectUrl = new Uri("https://www.box.com/declined_redirect_url_singer_2"), | ||
SignerGroupId = "SignerGroup", | ||
Password = "password", | ||
LoginRequired = false, | ||
} | ||
}, | ||
ParentFolder = new BoxRequestEntity() | ||
|
@@ -55,10 +67,23 @@ 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); | ||
// first signer is the sender with role final_copy_reader, second and third is the recipient with role signer | ||
Assert.AreEqual(3, signRequest.Signers.Count); | ||
Assert.IsNotNull(signRequest.Signers[1].IframeableEmbedUrl); | ||
|
||
var signerGroupId = ""; | ||
foreach (var signer in signRequest.Signers) | ||
{ | ||
if (signer.Role == BoxSignRequestSignerRole.signer) | ||
{ | ||
if (string.IsNullOrEmpty(signerGroupId)) | ||
{ | ||
signerGroupId = signer.SignerGroupId; | ||
} | ||
Assert.AreEqual(signerGroupId, signer.SignerGroupId); | ||
} | ||
} | ||
|
||
await UserClient.SignRequestsManager.CancelSignRequestAsync(signRequest.Id); | ||
|
||
signRequest = await UserClient.SignRequestsManager.GetSignRequestByIdAsync(signRequest.Id); | ||
|
@@ -68,7 +93,7 @@ public async Task CreateSignRequestAsync_ForCorrectSignRequestCreateRequest_Shou | |
[TestMethod] | ||
public async Task GetSignRequestAsync_ForExistingSignRequest_ShouldReturnSignRequest() | ||
{ | ||
var signRequest = await CreateSignRequest(); | ||
var signRequest = await CreateSignRequest("[email protected]", FolderId); | ||
var fetchedSignRequest = await UserClient.SignRequestsManager.GetSignRequestByIdAsync(signRequest.Id); | ||
|
||
Assert.AreEqual(signRequest.Id, fetchedSignRequest.Id); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,7 +85,7 @@ public async Task DeleteWebhookAsync_ForExistingWebhook_ShouldDeleteWebhookAndEx | |
[TestMethod] | ||
public async Task AddWebhook_ForSignRequest_ShouldCreateSuccess() | ||
{ | ||
var signRequest = await CreateSignRequest(); | ||
var signRequest = await CreateSignRequest("[email protected]", FolderId); | ||
var signFileId = signRequest.SignFiles.Files[0].Id; | ||
var webhookRequest = new BoxWebhookRequest() | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -389,10 +389,10 @@ public static async Task Retry(Func<Task> action, int retries = 5, int sleep = 5 | |
} | ||
} | ||
|
||
public static async Task<BoxSignRequest> CreateSignRequest(string signerEmail = "[email protected]") | ||
public static async Task<BoxSignRequest> CreateSignRequest(string signerEmail = "[email protected]", string folderId = "0") | ||
{ | ||
var file = await CreateSmallFile(); | ||
var createSignRequestCommand = new CreateSignRequestCommand(signerEmail, file.Id); | ||
var createSignRequestCommand = new CreateSignRequestCommand(signerEmail, file.Id, folderId); | ||
await ExecuteCommand(createSignRequestCommand); | ||
return createSignRequestCommand.SignRequest; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,7 +48,12 @@ public async Task CreateSignRequest_RequiredParams_Success() | |
{ | ||
Email = "[email protected]", | ||
Role = BoxSignRequestSignerRole.signer | ||
} | ||
}, | ||
new BoxSignRequestSignerCreate() | ||
{ | ||
Email = "[email protected]", | ||
Role = BoxSignRequestSignerRole.signer | ||
}, | ||
}; | ||
|
||
var parentFolder = new BoxRequestEntity() | ||
|
@@ -77,7 +82,7 @@ public async Task CreateSignRequest_RequiredParams_Success() | |
// Response check | ||
Assert.AreEqual(1, response.SourceFiles.Count); | ||
Assert.AreEqual("12345", response.SourceFiles[0].Id); | ||
Assert.AreEqual(1, response.Signers.Count); | ||
Assert.AreEqual(2, response.Signers.Count); | ||
Assert.AreEqual("[email protected]", response.Signers[0].Email); | ||
Assert.AreEqual("12345", response.ParentFolder.Id); | ||
Assert.AreEqual(1, response.Signers[0].Inputs.Count); | ||
|
@@ -113,7 +118,19 @@ public async Task CreateSignRequest_OptionalParams_Success() | |
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") | ||
DeclinedRedirectUrl = new Uri("https://box.com/declined_redirect_url_signer_1"), | ||
LoginRequired = false, | ||
Password = "abcdefg", | ||
SignerGroupId = "SignerGroup", | ||
VerificationPhoneNumber = "1234567890", | ||
}, new BoxSignRequestSignerCreate() | ||
{ | ||
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"), | ||
SignerGroupId = "SignerGroup", | ||
VerificationPhoneNumber = "1234567890", | ||
} | ||
}; | ||
|
||
|
@@ -145,7 +162,7 @@ public async Task CreateSignRequest_OptionalParams_Success() | |
"text" | ||
) | ||
}, | ||
TemplateId = "12345" | ||
TemplateId = "12345", | ||
}; | ||
|
||
/*** Act ***/ | ||
|
@@ -160,7 +177,7 @@ public async Task CreateSignRequest_OptionalParams_Success() | |
// Response check | ||
Assert.AreEqual(1, response.SourceFiles.Count); | ||
Assert.AreEqual("12345", response.SourceFiles[0].Id); | ||
Assert.AreEqual(1, response.Signers.Count); | ||
Assert.AreEqual(2, 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()); | ||
|
@@ -183,6 +200,14 @@ public async Task CreateSignRequest_OptionalParams_Success() | |
Assert.AreEqual("https://box.com/redirect_url", response.RedirectUrl.ToString()); | ||
Assert.AreEqual("https://box.com/declined_redirect_url", response.DeclinedRedirectUrl.ToString()); | ||
Assert.AreEqual("12345", response.TemplateId); | ||
Assert.AreEqual("cd4ff89-8fc1-42cf-8b29-1890dedd26d7", response.Signers[0].SignerGroupId); | ||
Assert.AreEqual("1234567890", response.Signers[0].VerificationPhoneNumber); | ||
Assert.AreEqual("cd4ff89-8fc1-42cf-8b29-1890dedd26d7", response.Signers[1].SignerGroupId); | ||
Assert.AreEqual("1234567890", response.Signers[1].VerificationPhoneNumber); | ||
Assert.IsFalse(response.Signers[0].LoginRequired); | ||
Assert.AreEqual("abcdefg", response.Signers[0].Password); | ||
Assert.IsFalse(response.Signers[1].LoginRequired); | ||
Assert.AreEqual("abcdefg", response.Signers[1].Password); | ||
} | ||
|
||
[TestMethod] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,7 +71,42 @@ | |
"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", | ||
"iframeable_embed_url": "https://app.box.com/embed/sign/document/bf7aaac6/" | ||
"iframeable_embed_url": "https://app.box.com/embed/sign/document/bf7aaac6/", | ||
"login_required": false, | ||
"password": "abcdefg", | ||
"signer_group_id": "cd4ff89-8fc1-42cf-8b29-1890dedd26d7", | ||
"verification_phone_number": "1234567890" | ||
}, | ||
{ | ||
"email": "[email protected]", | ||
"role": "signer", | ||
"is_in_person": true, | ||
"order": 2, | ||
"embed_url_external_user_id": 1234, | ||
"has_viewed_document": true, | ||
"signer_decision": { | ||
"type": "signed", | ||
"finalized_at": "2021-04-26T08:12:13.982Z" | ||
}, | ||
"inputs": [ | ||
{ | ||
"document_tag_id": 1234, | ||
"text_value": "text", | ||
"checkbox_value": true, | ||
"date_value": "2021-04-26T08:12:13.982Z", | ||
"type": "text", | ||
"page_index": 4, | ||
"content_type": "checkbox" | ||
} | ||
], | ||
"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", | ||
"iframeable_embed_url": "https://app.box.com/embed/sign/document/bf7aaac6/", | ||
"login_required": false, | ||
"password": "abcdefg", | ||
"signer_group_id": "cd4ff89-8fc1-42cf-8b29-1890dedd26d7", | ||
"verification_phone_number": "1234567890" | ||
} | ||
], | ||
"signing_log": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters