从复合模板创建和发送信封失败 ONESIGNALLSIGN_NOT_SATISFIED

Create and send envelope from composite template fails with ONESIGNALLSIGN_NOT_SATISFIED

我想创建并发送一个由模板组成的信封。 服务器上的模板预定义了一对 signer rolessubjecttext电子邮件。

我在内联部分添加:

目的是将签名字段“customer_1*”分配给第一个收件人(必须与第一个角色相关联),以及“customer_2*" 给第二个收件人(分配给第二个角色)。

创建 API 失败并响应:

{"errorCode":"ONESIGNALLSIGN_NOT_SATISFIED",
 "message":"Freeform signing is not allowed for your account because it conflicts
            with other settings, please place signing tabs for each signer."}

我不明白为什么它会抱怨“自由格式签名”,而我为每个签名归档组设置选项卡(基于通用前缀)。

这是执行尝试的日志:

TraceToken: 3c6f2283-f8bd-4c2e-8fd6-f596536cb3bc
Timestamp: 2021-11-19T14:00:17.8398210Z

POST https://demo.docusign.net:7802/restapi/v2.1/accounts/72b8c45f-0720-4141-ab3d-efdb95122e64/envelopes
Content-Type: application/json
Content-Length: 315096
Connection: keep-alive
Transfer-Encoding: chunked
Accept: application/json
Authorization: Bearer [omitted]
Host: demo.docusign.net
User-Agent: Swagger-Codegen/3.15.0/java
X-DocuSign-SDK: Java
X-SecurityProtocol-Version: TLSv1.2
X-SecurityProtocol-CipherSuite: ECDHE-RSA-AES256-GCM-SHA384
x-forwarded-for: 93.34.232.152

{
  "compositeTemplates": [
    {
      "compositeTemplateId": "1",
      "inlineTemplates": [
        {
          "documents": [
            {
              "documentBase64": "<pdf document encoded in BASE64>",
              "documentId": "1",
              "fileExtension": "pdf",
              "name": "sample2",
              "transformPdfFields": "true"
            }
          ],
          "recipients": {
            "signers": [
              {
                "email": "hilbert@xxxxx.it",
                "fullName": "Mick Hilbert",
                "name": "Mick Hilbert",
                "recipientId": "00016005",
                "recipientSignatureProviders": [
                  {
                    "signatureProviderName": "intesa_tsp_aes",
                    "signatureProviderOptions": {
                      "sms": "+39xxxxxxxxxx"
                    }
                  }
                ],
                "roleName": "CLIENTE2",
                "tabs": {
                  "signHereTabs": [
                    {
                      "anchorString": "firmatario_00016005*"
                    }
                  ]
                }
              },
              {
                "email": "hilbertsmike@xxxxx.it",
                "fullName": "Smike Hilbert",
                "name": "Smike Hilbert",
                "recipientId": "00028471",
                "recipientSignatureProviders": [
                  {
                    "signatureProviderName": "intesa_tsp_aes",
                    "signatureProviderOptions": {
                      "sms": "+39xxxxxxxxxx"
                    }
                  }
                ],
                "roleName": "CLIENTE1",
                "tabs": {
                  "signHereTabs": [
                    {
                      "anchorString": "firmatario_00028471*"
                    }
                  ]
                }
              }
            ]
          },
          "sequence": "2"
        }
      ],
      "serverTemplates": [
        {
          "sequence": "1",
          "templateId": "2c9f039a-1306-4116-9083-096d9b68203b"
        }
      ]
    }
  ],
  "status": "sent"
}

400 BadRequest

Content-Type: application/json; charset=utf-8
Content-Length: 190
X-DocuSign-TraceToken: 3c6f2283-f8bd-4c2e-8fd6-f596536cb3bc

{"errorCode":"ONESIGNALLSIGN_NOT_SATISFIED","message":"Freeform signing is not allowed for your account because it conflicts with other settings, please place signing tabs for each signer."}

我还想指出,DocuSign 无意插入签名标签,但原始文档中已经存在签名标签;我只想根据选项卡的标识符前缀为每个签名者分配正确的选项卡。

我试过在不参考模板的情况下使用完全相同的数据创建信封,并且效果很好,所以看起来问题与模板的使用密切相关。

我尝试了两种情况(有和没有模板)作为草稿,而不是从 DocuSign 网站完成工作流程(基本上是发送信封)。在第一种情况下,签名字段从文档中消失了,它迫使我添加一些(对于每个签名者)以便让我发送。在第二种情况下,签名字段在那里,我可以直接发送它,不需要做任何其他事情。

我也试过从模板中删除收件人,并在运行时填写他们的所有信息(而不是依赖角色),但结果根本没有改变(标签从文档中删除),所以应该有我发送的通过复合模板创建信封的信息有问题。但是我从 DocuSign howto.

复制了它们

那么现在的问题是:为什么通过复合模板创建信封会导致签名字段(制表符)从文档中删除?

从表面上看,该错误意味着没有为至少一位收件人放置标签。由于您使用锚字符串来放置标签,因此您需要确认您的文档是机器可读的。最直接的方法是使用您的文档在 Web 控制台中启动草稿,然后尝试 to create auto-place tags 使用您在 API 调用中使用的相同字符串。

您可以执行的另一个测试是将 "status":"sent" 更改为 "status":"created" 以生成草稿,然后在 Web 控制台中检查该草稿以查看哪个收件人缺少标签。

最后,我不确定它是否会导致您描述的问题,但我注意到您定义了 RecipientIds 和 RoleName。在某些情况下,定义收件人 ID 可能会阻止收件人角色与模板正确匹配 - 您可以尝试删除收件人 ID 以查看行为是否发生变化。

我在的评论中找到了答案。但是我没有任何官方文档说明它。

有 2 个问题导致请求无法成功处理:

    必须使用
  • tabLabel 属性 而不是 anchorString (它也接受通配符)。
  • 文档必须分配给 CompositeTemplate 的 属性 document,而不是在 InlineTemplate 中的文档列表。

注意,由于CompositeTemplate只能包含一个文档,所以需要定义多个CompositeTemplate,每个文档一个,每个包含ServerTemplate 块和 InlineTemplate 中的收件人列表。这样收件人信息就被复制了。

这是一个包含 3 个文档和 2 个收件人的请求日志示例:

TraceToken: d95c99fa-e05e-4c89-8801-00363b210a87
Timestamp: 2021-12-06T07:19:11.7302866Z

POST https://demo.docusign.net:7802/restapi/v2.1/accounts/xxxxxx/envelopes
Content-Type: application/json
Content-Length: 731974
Connection: keep-alive
Transfer-Encoding: chunked
Accept: application/json
Authorization: Bearer [omitted]
Host: demo.docusign.net
User-Agent: Swagger-Codegen/3.15.0/java
X-DocuSign-SDK: Java
X-SecurityProtocol-Version: TLSv1.2
X-SecurityProtocol-CipherSuite: ECDHE-RSA-AES256-GCM-SHA384
x-forwarded-for: 93.34.238.73

{
  "compositeTemplates": [
    {
      "compositeTemplateId": "0",
      "document": {
        "documentBase64": "<base64-encoded-pdf>",
        "documentId": "1",
        "fileExtension": "pdf",
        "name": "sample0",
        "transformPdfFields": "true"
      },
      "inlineTemplates": [
        {
          "recipients": {
            "signers": [
              {
                "email": "hilbertsmike@xxx.it",
                "name": "Smike Hilbert",
                "recipientId": "00028471",
                "recipientSignatureProviders": [
                  {
                    "signatureProviderName": "intesa_tsp_aes",
                    "signatureProviderOptions": {
                      "sms": "+393201744869"
                    }
                  }
                ],
                "roleName": "CLIENTE",
                "tabs": {
                  "signHereTabs": [
                    {
                      "anchorAllowWhiteSpaceInCharacters": "true",
                      "tabLabel": "firmatario_00028471\*"
                    }
                  ]
                }
              },
              {
                "email": "hilbert@xxx.it",
                "name": "Mick Hilbert",
                "recipientId": "00016005",
                "recipientSignatureProviders": [
                  {
                    "signatureProviderName": "intesa_tsp_aes",
                    "signatureProviderOptions": {
                      "sms": "+393201744869"
                    }
                  }
                ],
                "roleName": "CLIENTE",
                "tabs": {
                  "signHereTabs": [
                    {
                      "anchorAllowWhiteSpaceInCharacters": "true",
                      "tabLabel": "firmatario_00016005\*"
                    }
                  ]
                }
              }
            ]
          },
          "sequence": "2"
        }
      ],
      "serverTemplates": [
        {
          "sequence": "1",
          "templateId": "7e82f2b4-0a1d-4145-b748-3a90eb001e5d"
        }
      ]
    },
    {
      "compositeTemplateId": "0",
      "document": {
        "documentBase64": "<base64-encoded-pdf>",
        "documentId": "2",
        "fileExtension": "pdf",
        "name": "sample2a",
        "transformPdfFields": "true"
      },
      "inlineTemplates": [
        {
          "recipients": {
            "signers": [
              {
                "email": "hilbertsmike@xxx.it",
                "name": "Smike Hilbert",
                "recipientId": "00028471",
                "recipientSignatureProviders": [
                  {
                    "signatureProviderName": "intesa_tsp_aes",
                    "signatureProviderOptions": {
                      "sms": "+393201744869"
                    }
                  }
                ],
                "roleName": "CLIENTE",
                "tabs": {
                  "signHereTabs": [
                    {
                      "anchorAllowWhiteSpaceInCharacters": "true",
                      "tabLabel": "firmatario_00028471\*"
                    }
                  ]
                }
              },
              {
                "email": "hilbert@xxx.it",
                "name": "Mick Hilbert",
                "recipientId": "00016005",
                "recipientSignatureProviders": [
                  {
                    "signatureProviderName": "intesa_tsp_aes",
                    "signatureProviderOptions": {
                      "sms": "+393201744869"
                    }
                  }
                ],
                "roleName": "CLIENTE",
                "tabs": {
                  "signHereTabs": [
                    {
                      "anchorAllowWhiteSpaceInCharacters": "true",
                      "tabLabel": "firmatario_00016005\*"
                    }
                  ]
                }
              }
            ]
          },
          "sequence": "2"
        }
      ],
      "serverTemplates": [
        {
          "sequence": "1",
          "templateId": "7e82f2b4-0a1d-4145-b748-3a90eb001e5d"
        }
      ]
    },
    {
      "compositeTemplateId": "0",
      "document": {
        "documentBase64": "<base64-encoded-pdf>",
        "documentId": "3",
        "fileExtension": "pdf",
        "name": "sample2b",
        "transformPdfFields": "true"
      },
      "inlineTemplates": [
        {
          "recipients": {
            "signers": [
              {
                "email": "hilbertsmike@xxx.it",
                "name": "Smike Hilbert",
                "recipientId": "00028471",
                "recipientSignatureProviders": [
                  {
                    "signatureProviderName": "intesa_tsp_aes",
                    "signatureProviderOptions": {
                      "sms": "+393201744869"
                    }
                  }
                ],
                "roleName": "CLIENTE",
                "tabs": {
                  "signHereTabs": [
                    {
                      "anchorAllowWhiteSpaceInCharacters": "true",
                      "tabLabel": "firmatario_00028471\*"
                    }
                  ]
                }
              },
              {
                "email": "hilbert@xxx.it",
                "name": "Mick Hilbert",
                "recipientId": "00016005",
                "recipientSignatureProviders": [
                  {
                    "signatureProviderName": "intesa_tsp_aes",
                    "signatureProviderOptions": {
                      "sms": "+393201744869"
                    }
                  }
                ],
                "roleName": "CLIENTE",
                "tabs": {
                  "signHereTabs": [
                    {
                      "anchorAllowWhiteSpaceInCharacters": "true",
                      "tabLabel": "firmatario_00016005\*"
                    }
                  ]
                }
              }
            ]
          },
          "sequence": "2"
        }
      ],
      "serverTemplates": [
        {
          "sequence": "1",
          "templateId": "7e82f2b4-0a1d-4145-b748-3a90eb001e5d"
        }
      ]
    }
  ],
  "status": "sent"
}

201 Created

Content-Type: application/json; charset=utf-8
Content-Length: 173
X-DocuSign-TraceToken: d95c99fa-e05e-4c89-8801-00363b210a87

{"envelopeId":"2b54207d-c9cf-4b8b-ab11-5325c1b118aa","uri":"/envelopes/xxx","statusDateTime":"2021-12-06T07:19:11.1530000Z","status":"sent"}