Skip to content

Commit aa2093d

Browse files
Merge pull request #32 from release-docusign/dev
reverse integrate from release-docusign->dev to sriharip-docusign->dev
2 parents a8bbc4f + d2ea455 commit aa2093d

File tree

2 files changed

+201
-2
lines changed

2 files changed

+201
-2
lines changed

certified-connectors/DocuSignDemo/apiDefinition.swagger.json

Lines changed: 166 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@
624624
}
625625
}
626626
},
627-
"x-ms-summary": "Tab"
627+
"x-ms-summary": "Tab"
628628
}
629629
}
630630
],
@@ -690,6 +690,58 @@
690690
"x-ms-visibility": "advanced"
691691
}
692692
},
693+
"/accounts/{accountId}/envelopes/{envelopeId}/documents/{documentId}/fields": {
694+
"get": {
695+
"summary": "Get envelope document custom fields",
696+
"description": "Get envelope document custom fields.",
697+
"operationId": "GetEnvelopeDocumentFields",
698+
"parameters": [
699+
{
700+
"name": "accountId",
701+
"in": "path",
702+
"description": "Account id",
703+
"required": true,
704+
"x-ms-summary": "Account",
705+
"x-ms-test-value": "insert account id",
706+
"x-ms-dynamic-values": {
707+
"operationId": "GetLoginAccounts",
708+
"value-collection": "loginAccounts",
709+
"value-path": "accountIdGuid",
710+
"value-title": "name"
711+
},
712+
"type": "string"
713+
},
714+
{
715+
"name": "envelopeId",
716+
"in": "path",
717+
"description": "Envelope id",
718+
"required": true,
719+
"x-ms-summary": "Envelope",
720+
"x-ms-test-value": "insert envelope id",
721+
"type": "string"
722+
},
723+
{
724+
"name": "documentId",
725+
"in": "path",
726+
"description": "Document id",
727+
"required": true,
728+
"x-ms-summary": "Document id",
729+
"x-ms-test-value": "insert document id",
730+
"type": "string"
731+
}
732+
],
733+
"responses": {
734+
"200": {
735+
"description": "default",
736+
"schema": {
737+
"$ref": "#/definitions/ListEnvelopeDocumentFieldsResponse"
738+
}
739+
}
740+
},
741+
"deprecated": false,
742+
"x-ms-visibility": "advanced"
743+
}
744+
},
693745
"/trigger/accounts/{accountId}/envelopes": {
694746
"get": {
695747
"tags": [
@@ -3250,6 +3302,91 @@
32503302
"deprecated": false,
32513303
"x-ms-no-generic-test": true,
32523304
"x-ms-visibility": "advanced"
3305+
},
3306+
"put": {
3307+
"tags": [
3308+
"DocuSign"
3309+
],
3310+
"summary": "Update envelope recipient tabs values",
3311+
"description": "Updates one or more tabs for a recipient in a draft envelope.",
3312+
"operationId": "UpdateRecipientTabsValues",
3313+
"parameters": [
3314+
{
3315+
"name": "accountId",
3316+
"in": "path",
3317+
"description": "Account id",
3318+
"required": true,
3319+
"x-ms-summary": "Account",
3320+
"x-ms-test-value": "insert account id",
3321+
"x-ms-dynamic-values": {
3322+
"operationId": "GetLoginAccounts",
3323+
"value-collection": "loginAccounts",
3324+
"value-path": "accountIdGuid",
3325+
"value-title": "name"
3326+
},
3327+
"type": "string"
3328+
},
3329+
{
3330+
"name": "envelopeId",
3331+
"in": "path",
3332+
"required": true,
3333+
"type": "string",
3334+
"description": "Envelope id",
3335+
"x-ms-summary": "Envelope",
3336+
"x-ms-test-value": "insert envelope id"
3337+
},
3338+
{
3339+
"name": "recipientId",
3340+
"in": "path",
3341+
"required": true,
3342+
"type": "string",
3343+
"description": "Recipient id",
3344+
"x-ms-summary": "Recipient",
3345+
"x-ms-test-value": "insert recipient id"
3346+
},
3347+
{
3348+
"name": "body",
3349+
"in": "body",
3350+
"required": true,
3351+
"schema": {
3352+
"type": "array",
3353+
"items": {
3354+
"type": "object",
3355+
"properties": {
3356+
"tabType": {
3357+
"enum": [
3358+
"Text",
3359+
"Note"
3360+
],
3361+
"type": "string",
3362+
"description": "Tab type",
3363+
"x-ms-summary": "Type",
3364+
"x-ms-test-value": "select tab type"
3365+
},
3366+
"tabId": {
3367+
"type": "string",
3368+
"x-ms-summary": "Id",
3369+
"description": "Id"
3370+
},
3371+
"value": {
3372+
"type": "string",
3373+
"x-ms-summary": "Value",
3374+
"description": "Value"
3375+
}
3376+
}
3377+
},
3378+
"x-ms-summary": "Tab"
3379+
}
3380+
}
3381+
],
3382+
"responses": {
3383+
"200": {
3384+
"description": "OK"
3385+
}
3386+
},
3387+
"deprecated": false,
3388+
"x-ms-visibility": "important",
3389+
"x-ms-no-generic-test": true
32533390
}
32543391
},
32553392
"/accounts/{accountId}/envelopes/{envelopeId}/recipients/{recipientId}/recipientTabs": {
@@ -4600,6 +4737,19 @@
46004737
}
46014738
}
46024739
},
4740+
"ListEnvelopeDocumentFieldsResponse": {
4741+
"type": "object",
4742+
"properties": {
4743+
"envelopeDocumentFields": {
4744+
"description": "Document Custom Fields",
4745+
"type": "array",
4746+
"items": {
4747+
"$ref": "#/definitions/EnvelopeDocumentField"
4748+
},
4749+
"x-ms-summary": "Custom Field"
4750+
}
4751+
}
4752+
},
46034753
"DocGenFormFieldsResponse": {
46044754
"type": "object",
46054755
"properties": {
@@ -4981,6 +5131,21 @@
49815131
}
49825132
}
49835133
},
5134+
"EnvelopeDocumentField": {
5135+
"type": "object",
5136+
"properties": {
5137+
"name": {
5138+
"description": "The name of the custom field.",
5139+
"type": "string",
5140+
"x-ms-summary": "Name"
5141+
},
5142+
"value": {
5143+
"description": "The value of the custom field.",
5144+
"type": "string",
5145+
"x-ms-summary": "Value"
5146+
}
5147+
}
5148+
},
49845149
"DeclineReasonWithoutType": {
49855150
"x-ms-summary": "Decline Reason",
49865151
"x-ms-visibility": "advanced"

certified-connectors/DocuSignDemo/script.csx

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1417,6 +1417,35 @@ public class Script : ScriptBase
14171417

14181418
body["documents"] = documents;
14191419
return body;
1420+
}
1421+
1422+
private async Task UpdateRecipientTabsValuesBodyTransformation()
1423+
{
1424+
var body = ParseContentAsJArray(await this.Context.Request.Content.ReadAsStringAsync().ConfigureAwait(false), true);
1425+
var tabs = new JObject();
1426+
1427+
var tabsMap = new Dictionary<string, string>() {
1428+
{ "Text", "textTabs" },
1429+
{ "Note", "noteTabs" },
1430+
};
1431+
1432+
foreach (var tab in body)
1433+
{
1434+
var tabType = tab["tabType"].ToString();
1435+
tabType = tabsMap.ContainsKey(tabType) ? tabsMap[tabType] : tabType;
1436+
var tabsForType = tabs[tabType] as JArray ?? new JArray();
1437+
1438+
tabsForType.Add(new JObject
1439+
{
1440+
["tabId"] = tab["tabId"],
1441+
["value"] = tab["value"]
1442+
});
1443+
1444+
tabs[tabType] = tabsForType;
1445+
}
1446+
1447+
var newBody = tabs;
1448+
this.Context.Request.Content = CreateJsonContent(newBody.ToString());
14201449
}
14211450

14221451
private JObject AddRecipientTabsBodyTransformation(JObject body)
@@ -1633,6 +1662,11 @@ public class Script : ScriptBase
16331662
await this.TransformRequestJsonBody(this.AddRecipientTabsBodyTransformation).ConfigureAwait(false);
16341663
}
16351664

1665+
if ("UpdateRecipientTabsValues".Equals(this.Context.OperationId, StringComparison.OrdinalIgnoreCase))
1666+
{
1667+
await this.UpdateRecipientTabsValuesBodyTransformation().ConfigureAwait(false);
1668+
}
1669+
16361670
if ("UpdateEnvelopePrefillTabs".Equals(this.Context.OperationId, StringComparison.OrdinalIgnoreCase))
16371671
{
16381672
await this.UpdateEnvelopePrefillTabsBodyTransformation().ConfigureAwait(false);
@@ -1984,7 +2018,7 @@ public class Script : ScriptBase
19842018
{
19852019
foreach(var signer in body[signerTypes[i]])
19862020
{
1987-
if (recipientEmailId != null && recipientEmailId.ToString().Equals(signer["email"].ToString()))
2021+
if (recipientEmailId?.ToString() == signer.SelectToken("email")?.ToString())
19882022
{
19892023
matchingSigner = signer as JObject;
19902024
break;

0 commit comments

Comments
 (0)