Skip to content

Commit 93f40b6

Browse files
Merge pull request #11 from youngl-docusign/FLOW-432-support-signing-groups
FLOW-432 support signing groups
2 parents 1522d2e + e73b758 commit 93f40b6

File tree

2 files changed

+186
-26
lines changed

2 files changed

+186
-26
lines changed

certified-connectors/DocuSignDemo/apiDefinition.swagger.json

Lines changed: 128 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1803,6 +1803,7 @@
18031803
"name": "accountId",
18041804
"in": "path",
18051805
"description": "Account id",
1806+
"x-ms-visibility": "important",
18061807
"required": true,
18071808
"x-ms-summary": "Account",
18081809
"x-ms-test-value": "insert account id",
@@ -1814,6 +1815,20 @@
18141815
},
18151816
"type": "string"
18161817
},
1818+
{
1819+
"name": "status",
1820+
"in": "query",
1821+
"description": "Envelope status",
1822+
"required": true,
1823+
"x-ms-summary": "Envelope status",
1824+
"x-ms-test-value": "Created",
1825+
"x-ms-visibility": "important",
1826+
"type": "string",
1827+
"enum": [
1828+
"Sent",
1829+
"Created"
1830+
]
1831+
},
18171832
{
18181833
"name": "templateId",
18191834
"in": "query",
@@ -1835,20 +1850,6 @@
18351850
},
18361851
"type": "string"
18371852
},
1838-
{
1839-
"name": "status",
1840-
"in": "query",
1841-
"description": "Envelope status",
1842-
"required": true,
1843-
"x-ms-summary": "Envelope status",
1844-
"x-ms-test-value": "Created",
1845-
"x-ms-visibility": "important",
1846-
"type": "string",
1847-
"enum": [
1848-
"Sent",
1849-
"Created"
1850-
]
1851-
},
18521853
{
18531854
"name": "signers",
18541855
"in": "body",
@@ -2883,6 +2884,25 @@
28832884
"x-ms-visibility": "advanced",
28842885
"type": "integer"
28852886
},
2887+
{
2888+
"name": "signingGroupId",
2889+
"in": "query",
2890+
"description": "Signing Group",
2891+
"x-ms-summary": "Signing Group",
2892+
"x-ms-visibility": "advanced",
2893+
"type": "string",
2894+
"x-ms-dynamic-values": {
2895+
"operationId": "GetSigningGroups",
2896+
"parameters": {
2897+
"accountId": {
2898+
"parameter": "accountId"
2899+
}
2900+
},
2901+
"value-collection": "groups",
2902+
"value-path": "signingGroupId",
2903+
"value-title": "groupName"
2904+
}
2905+
},
28862906
{
28872907
"name": "signatureType",
28882908
"in": "query",
@@ -3208,6 +3228,25 @@
32083228
"x-ms-visibility": "advanced",
32093229
"type": "integer"
32103230
},
3231+
{
3232+
"name": "signingGroupId",
3233+
"in": "query",
3234+
"description": "Signing Group",
3235+
"x-ms-summary": "Signing Group",
3236+
"x-ms-visibility": "advanced",
3237+
"type": "string",
3238+
"x-ms-dynamic-values": {
3239+
"operationId": "GetSigningGroups",
3240+
"parameters": {
3241+
"accountId": {
3242+
"parameter": "accountId"
3243+
}
3244+
},
3245+
"value-collection": "groups",
3246+
"value-path": "signingGroupId",
3247+
"value-title": "groupName"
3248+
}
3249+
},
32113250
{
32123251
"name": "additionalRecipientParams",
32133252
"in": "body",
@@ -3513,6 +3552,50 @@
35133552
"x-ms-visibility": "important"
35143553
}
35153554
},
3555+
"/accounts/{accountId}/signing_groups": {
3556+
"get": {
3557+
"tags": [
3558+
"DocuSign"
3559+
],
3560+
"x-ms-summary": "List signing groups",
3561+
"description": "List signing groups for a specific account.",
3562+
"operationId": "GetSigningGroups",
3563+
"consumes": [],
3564+
"produces": [
3565+
"application/json",
3566+
"text/json",
3567+
"application/xml",
3568+
"text/xml"
3569+
],
3570+
"parameters": [
3571+
{
3572+
"name": "accountId",
3573+
"in": "path",
3574+
"description": "Account id",
3575+
"required": true,
3576+
"x-ms-summary": "Account",
3577+
"x-ms-test-value": "insert account id",
3578+
"x-ms-dynamic-values": {
3579+
"operationId": "GetLoginAccounts",
3580+
"value-collection": "loginAccounts",
3581+
"value-path": "accountIdGuid",
3582+
"value-title": "name"
3583+
},
3584+
"type": "string"
3585+
}
3586+
],
3587+
"responses": {
3588+
"200": {
3589+
"description": "OK",
3590+
"schema": {
3591+
"$ref": "#/definitions/ListSigningGroupResponse"
3592+
}
3593+
}
3594+
},
3595+
"deprecated": false,
3596+
"x-ms-visibility": "important"
3597+
}
3598+
},
35163599
"/accounts/{accountId}/account_custom_fields": {
35173600
"get": {
35183601
"tags": [
@@ -6127,6 +6210,37 @@
61276210
}
61286211
}
61296212
},
6213+
"ListSigningGroupResponse": {
6214+
"type": "object",
6215+
"properties": {
6216+
"signingGroups": {
6217+
"description": "List of all signing groups",
6218+
"type": "array",
6219+
"items": {
6220+
"$ref": "#/definitions/SigningGroup"
6221+
},
6222+
"x-ms-summary": "Signing Groups"
6223+
}
6224+
}
6225+
},
6226+
"SigningGroup": {
6227+
"required": [
6228+
"signingGroupId"
6229+
],
6230+
"type": "object",
6231+
"properties": {
6232+
"signingGroupId": {
6233+
"description": "The ID of the signing group.",
6234+
"type": "string",
6235+
"x-ms-summary": "Signing Group ID"
6236+
},
6237+
"groupName": {
6238+
"description": "The name of the signing group.",
6239+
"type": "string",
6240+
"x-ms-summary": "Signing Group Name"
6241+
}
6242+
}
6243+
},
61306244
"ListTemplatesResponse": {
61316245
"type": "object",
61326246
"properties": {

certified-connectors/DocuSignDemo/script.csx

Lines changed: 58 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1598,15 +1598,15 @@ public class Script : ScriptBase
15981598
response["schema"]["properties"]["signerName"] = new JObject
15991599
{
16001600
["type"] = "string",
1601-
["x-ms-summary"] = "* Signer name"
1601+
["x-ms-summary"] = "* Signer or signing group name"
16021602
};
16031603
}
16041604
else if (recipientType.Equals("signers", StringComparison.OrdinalIgnoreCase))
16051605
{
16061606
response["schema"]["properties"]["name"] = new JObject
16071607
{
16081608
["type"] = "string",
1609-
["x-ms-summary"] = "* Signer name"
1609+
["x-ms-summary"] = "* Signer or signing group name"
16101610
};
16111611
response["schema"]["properties"]["email"] = new JObject
16121612
{
@@ -1637,12 +1637,12 @@ public class Script : ScriptBase
16371637
response["schema"]["properties"]["name"] = new JObject
16381638
{
16391639
["type"] = "string",
1640-
["x-ms-summary"] = "* Name"
1640+
["x-ms-summary"] = "* Recipient or signing group name"
16411641
};
16421642
response["schema"]["properties"]["email"] = new JObject
16431643
{
16441644
["type"] = "string",
1645-
["x-ms-summary"] = "Email"
1645+
["x-ms-summary"] = "Recipient email (leave empty if there’s a signing group)"
16461646
};
16471647
}
16481648
}
@@ -2135,6 +2135,13 @@ public class Script : ScriptBase
21352135
templateRoles.Add(signer);
21362136
signer = new JObject();
21372137
}
2138+
2139+
if (key.Contains(" Signing Group"))
2140+
{
2141+
signer["signingGroupId"] = value;
2142+
templateRoles.Add(signer);
2143+
signer = new JObject();
2144+
}
21382145
}
21392146

21402147
newBody["templateRoles"] = templateRoles;
@@ -2656,6 +2663,11 @@ public class Script : ScriptBase
26562663
signers[0]["note"] = query.Get("note");
26572664
}
26582665

2666+
if (!string.IsNullOrEmpty(query.Get("signingGroupId")))
2667+
{
2668+
signers[0]["signingGroupId"] = query.Get("signingGroupId");
2669+
}
2670+
26592671
if (!string.IsNullOrEmpty(query.Get("roleName")))
26602672
{
26612673
signers[0]["roleName"] = query.Get("roleName");
@@ -2716,8 +2728,6 @@ public class Script : ScriptBase
27162728
var query = HttpUtility.ParseQueryString(this.Context.Request.RequestUri.Query);
27172729
var recipientType = query.Get("recipientType");
27182730

2719-
var missingInput = false;
2720-
27212731
if (recipientType.Equals("inPersonSigners"))
27222732
{
27232733
signers[0]["hostName"] = body["hostName"];
@@ -2735,18 +2745,21 @@ public class Script : ScriptBase
27352745
signers[0]["name"] = body["name"];
27362746
if (body["email"] == null)
27372747
{
2738-
signers[0]["email"] = "power_automate_dummy_recipient@dsxtr.com";
2739-
if (string.IsNullOrEmpty(query.Get("phoneNumber")))
2748+
if (string.IsNullOrEmpty(query.Get("signingGroupId")))
27402749
{
2741-
missingInput = true;
2750+
if (string.IsNullOrEmpty(query.Get("phoneNumber")))
2751+
{
2752+
return true;
2753+
}
2754+
signers[0]["email"] = "power_automate_dummy_recipient@dsxtr.com";
27422755
}
27432756
}
27442757
else
27452758
{
27462759
signers[0]["email"] = body["email"];
27472760
}
27482761
}
2749-
return missingInput;
2762+
return false;
27502763
}
27512764

27522765
private void AddParamsForSelectedSignatureType(JArray signers, JObject body)
@@ -3923,8 +3936,41 @@ public class Script : ScriptBase
39233936
foreach (var signer in signers)
39243937
{
39253938
var roleName = signer["roleName"];
3926-
itemProperties[roleName + " Name"] = basePropertyDefinition.DeepClone();
3927-
itemProperties[roleName + " Email"] = basePropertyDefinition.DeepClone();
3939+
itemProperties[roleName + " Name"] = new JObject
3940+
{
3941+
["type"] = "string",
3942+
["x-ms-keyOrder"] = 0,
3943+
["x-ms-keyType"] = "none",
3944+
["x-ms-sort"] = "none",
3945+
["x-ms-summary"] = roleName + " Recipient Or Signing Group Name"
3946+
};
3947+
itemProperties[roleName + " Email"] = new JObject
3948+
{
3949+
["type"] = "string",
3950+
["x-ms-keyOrder"] = 0,
3951+
["x-ms-keyType"] = "none",
3952+
["x-ms-sort"] = "none",
3953+
["x-ms-summary"] = roleName + " Recipient Email (Leave empty if there’s a signing group)"
3954+
};
3955+
itemProperties[roleName + " Signing Group"] = new JObject
3956+
{
3957+
["type"] = "string",
3958+
["x-ms-summary"] = roleName + " Signing Group",
3959+
["x-ms-dynamic-values"] = new JObject
3960+
{
3961+
["operationId"] = "GetSigningGroups",
3962+
["value-collection"] = "groups",
3963+
["value-path"] = "signingGroupId",
3964+
["value-title"] = "groupName",
3965+
["parameters"] = new JObject
3966+
{
3967+
["accountId"] = new JObject
3968+
{
3969+
["parameter"] = "accountId"
3970+
}
3971+
}
3972+
}
3973+
};
39283974
}
39293975

39303976
var newBody = new JObject

0 commit comments

Comments
 (0)