Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support sign request signer group ID #521

Merged
merged 4 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/sign-requests.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ OPTIONS
--signer=signer
(required) A signer for the sign request. 35 is the max number of signers permitted. Can be added multiple times.
Allowed (recommended) properties:
email,role,is-in-person,order,embed-url-external-user-id,redirect-url,declined-redirect-url but snake case is also
supported for: is_in_person,order,embed_url_external_user_id,redirect_url,declined_redirect_url
email,role,is-in-person,order,embed-url-external-user-id,redirect-url,declined-redirect-url,group-id but snake case is also
supported for: is_in_person,order,embed_url_external_user_id,redirect_url,declined_redirect_url,group_id

--source-files=source-files
(required) Comma separated list of files to create a signing document from. This is currently limited to 10 files,
Expand Down
10 changes: 8 additions & 2 deletions src/commands/sign-requests/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ SignRequestsCreateCommand.flags = {
required: true,
description:
'A signer for the sign request. 35 is the max number of signers permitted. Can be added multiple times. ' +
'Allowed (recommended) properties: email,role,is-in-person,order,embed-url-external-user-id,redirect-url,declined-redirect-url ' +
'but snake case is also supported for: is_in_person,order,embed_url_external_user_id,redirect_url,declined_redirect_url',
'Allowed (recommended) properties: email,role,is-in-person,order,embed-url-external-user-id,redirect-url,declined-redirect-url,group-id ' +
'but snake case is also supported for: is_in_person,order,embed_url_external_user_id,redirect_url,declined_redirect_url,group_id',
multiple: true,
parse(input) {
const signer = {
Expand Down Expand Up @@ -107,6 +107,12 @@ SignRequestsCreateCommand.flags = {
signer.declined_redirect_url = value;
break;

case 'signer-group-id':
case 'signer_group_id':
case 'group-id':
case 'group_id':
signer.signer_group_id = value;
break;
default:
throw new BoxCLIError(`Unknown property for signer: ${key}`);
}
Expand Down
14 changes: 9 additions & 5 deletions test/commands/sign-requests.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ describe('Sign requests', () => {
documentTag2Id = '4567',
fixture = getFixture('sign-requests/post_sign_requests'),
redirectUrl = 'https://box.com/redirect_url',
declinedRedirectUrl = 'https://box.com/declined_redirect_url';
declinedRedirectUrl = 'https://box.com/declined_redirect_url',
signerGroupId = 'signers';

test
.nock(TEST_API_ROOT, api => api
Expand All @@ -69,7 +70,8 @@ describe('Sign requests', () => {
email: signerEmail,
is_in_person: true,
redirect_url: signerRedirectUrl,
declined_redirect_url: signerDeclinedRedirectUrl
declined_redirect_url: signerDeclinedRedirectUrl,
signer_group_id: signerGroupId
},
],
source_files: [
Expand Down Expand Up @@ -104,7 +106,7 @@ describe('Sign requests', () => {
.stdout()
.command([
'sign-requests:create',
`--signer=email=${signerEmail},role=approver,is_in_person=1,redirect_url=${signerRedirectUrl},declined_redirect_url=${signerDeclinedRedirectUrl}`,
`--signer=email=${signerEmail},role=approver,is_in_person=1,redirect_url=${signerRedirectUrl},declined_redirect_url=${signerDeclinedRedirectUrl},group_id=${signerGroupId}`,
`--source-files=${fileId},${fileId2}`,
`--parent-folder=${parentFolderId}`,
`--prefill-tag=id=${documentTag1Id},text=${documentTag1Value}`,
Expand All @@ -127,7 +129,8 @@ describe('Sign requests', () => {
email: signerEmail,
is_in_person: true,
redirect_url: signerRedirectUrl,
declined_redirect_url: signerDeclinedRedirectUrl
declined_redirect_url: signerDeclinedRedirectUrl,
signer_group_id: signerGroupId
},
],
source_files: [
Expand Down Expand Up @@ -162,7 +165,7 @@ describe('Sign requests', () => {
.stdout()
.command([
'sign-requests:create',
`--signer=email=${signerEmail},role=approver,is-in-person=1,redirect-url=${signerRedirectUrl},declined-redirect-url=${signerDeclinedRedirectUrl}`,
`--signer=email=${signerEmail},role=approver,is-in-person=1,redirect-url=${signerRedirectUrl},declined-redirect-url=${signerDeclinedRedirectUrl},group-id=${signerGroupId}`,
`--source-files=${fileId},${fileId2}`,
`--parent-folder=${parentFolderId}`,
`--prefill-tag=id=${documentTag1Id},text=${documentTag1Value}`,
Expand All @@ -175,6 +178,7 @@ describe('Sign requests', () => {
.it('should create a sign request with kebab case', ctx => {
assert.equal(ctx.stdout, fixture);
});

});

describe('sign-requests:cancel', () => {
Expand Down
Loading