【问题标题】:DocuSign EnvelopesApi::CreateRecipient API call does not create tabsDocuSign EnvelopesApi::CreateRecipient API 调用不创建选项卡
【发布时间】:2020-10-01 14:54:04
【问题描述】:

我正在尝试更新现有且未完成的 Docusign 信封,并向其中的文档添加新的签名者。为此,我使用带有 EnvelopesApi::createRecipient 方法的 PHP SDK,框架是 CodeIgniter btw。 API 调用成功创建了收件人(我可以在 DocuSign 管理面板中检查它),但我提供的带有新 SignHere 选项卡的签名并未添加到文档中。我尝试直接通过 Postman 拨打电话,但同样的问题。

我仔细检查了提供的 ID(clientUserId、recipientId、documentId),它们没问题,对于自动放置的 SignHere 锚字符串也是如此。

示例代码:

public function testAddRecipient(Contrat $contrat) {
            $CI = & get_instance();
            $envelopeApi = $this->createEnveloppeApi($CI);      # returns the EnvelopesApi object
            $signer = $this->createSigner($contrat, "test@hotmail.com", 3); # returns a new Signer object with a SignHere tab
            $recipients = new Recipients();
            $recipients->setSigners([$signer]);
            $response = $envelopeApi->createRecipient($this->config['ds_account_id'], $contrat->getDsEnvelopeId(), $recipients);
            var_dump($response);
            exit;
        }

创建签名者方法,返回带有他的 SignHere 选项卡的签名者对象:

public function createSigner($contrat, $recipient, $routingOrder) {
        // # Create the signer recipient model
        $signer = new Signer([# The signer
            'email' => $recipient,
            'name' => $recipient,
            'recipient_id' => $this->getRecipientId($contrat, $recipient),  # This method returns an unique id based on supplied email
            'routing_order' => $routingOrder,
            # Setting the client_user_id marks the signer as embedded
            'client_user_id' => $this->getRecipientId($contrat, $recipient)
        ]);


        // # Create a sign_here tab (field on the document)
        $roles = $contrat->getProfilsUtilisateurByMail($recipient);     #Returns a list of roles (a signer may sign several times)
        $signHereArray = [];
        foreach ($roles as $role) {
            $signHere = new SignHere([
                'document_id' => $contrat->getId(),
                'recipient_id' => $this->getRecipientId($contrat, $recipient),
                'tab_id' => 'sign_' . $role,
                'tab_label' => 'Signer Ici',
                'anchor_string' => '**sign-' . $role . '**',
                'anchor_units' => 'pixels',
                'anchor_x_offset' => '10',
                'anchor_y_offset' => '25',
                'anchor_ignore_if_not_present' => 'false',
            ]);

            $signHereArray[] = $signHere;
        }

        $signer->setTabs(new Tabs(['sign_here_tabs' => $signHereArray]));
        return $signer;
    }

JSON 正文发布到 API 端点:

{
    "signers": [
        {
            "clientUserId": 15,
            "email": "test@hotmail.com",
            "name": "test@hotmail.com",
            "recipientId": 15,
            "routingOrder": 3,
            "tabs": {
                "signHereTabs": [
                    {
                        "anchorIgnoreIfNotPresent": "false",
                        "anchorString": "**sign-souscripteur**",
                        "anchorUnits": "pixels",
                        "anchorXOffset": "10",
                        "anchorYOffset": "25",
                        "documentId": 156,
                        "recipientId": 15,
                        "tabId": "sign_souscripteur",
                        "tabLabel": "Signer Ici"
                    }
                ]
            }
        }
    ]
}

API 响应:

{
    "signers": [
        {
            "creationReason": "sender",
            "requireUploadSignature": "false",
            "name": "test@hotmail.com",
            "email": "test@hotmail.com",
            "recipientId": "15",
            "requireIdLookup": "false",
            "routingOrder": "3",
            "status": "created",
            "completedCount": "0",
            "deliveryMethod": "email",
            "recipientType": "signer"
        }
    ],
    "agents": [],
    "editors": [],
    "intermediaries": [],
    "carbonCopies": [],
    "certifiedDeliveries": [],
    "inPersonSigners": [],
    "seals": [],
    "witnesses": [],
    "recipientCount": "1"
}

响应没有错误,我做错了什么?

我还尝试了其他 SDK 方法,例如 EnvelopesApi::updateRecipients、EnvelopesApi::updateTabs 或 EnvelopesApi::updateDocumentTabs,但没有更多成功

更新 感谢 Inbar Gazit 在下面的回复,正确的端点是

/restapi/v2.1/accounts/{accountId}/envelopes/{envelopeId}/recipients/{recipientId}/tabs

在 SDK 中通过以下方法调用:EnvelopesApi::createTabsWithHttpInfo、EnvelopesApi::updateTabsWithHttpInfo 等。

【问题讨论】:

    标签: php docusignapi


    【解决方案1】:

    您的请求似乎使用锚字符串将标志放置在此处选项卡:

    锚字符串 -> '**sign-' 。 $角色。 '**'

    当您使用锚字符串时,DocuSign 将遍历文档中的文本,并在每次找到锚字符串的实例时放置一个选项卡。如果您的文档不包含该字符串,则不会创建选项卡。

    您可以这样调试问题:

    • 通过 DocuSign 网站手动创建常规信封
    • 上传您在 API 调用中使用的同一文档
    • 添加收件人
    • 转到标记页面并在此处添加一个标志标签
    • 编辑此处标志选项卡中的属性以包含和锚定字符串。在编辑选项卡时,锚字符串值对应于 UI 中选项卡的 Location->Auto Place 属性
    • 检查标签是否已添加到文档中找到锚字符串的位置

    这应该可以帮助您确定该文档中是否存在锚文本。

    如果您只想在固定位置使用常规符号此处选项卡,只需指定 documentId、pageNumber 和 X/Y 坐标即可。

    -亚德里尔

    【讨论】:

    • 实际上,自动放置选项卡已经适用于我的锚字符串,因为我设法将 signHere 选项卡放入信封创建中。此外,我指定了“anchorIgnoreIfNotPresent”:“false”,所以如果找不到该字符串,SDK 会抛出异常
    【解决方案2】:

    很抱歉,这比应该做的要难。 正确的终点是[UpdateRecipientTabs][1] 这是一个看起来像这样的 PUT 调用

    PUT
    /restapi/v2.1/accounts/{accountId}/envelopes/{envelopeId}/recipients/{recipientId}/tabs
    {
      "signHereTabs": [
        {
    .. // fill this out
    }]}
    

    【讨论】:

    • 谢谢!成功了,SDK里面的相关方法其实不是很明确,就是createTabsWithHttpInfo
    • 另见下面 Yadriel 的回答。他指出了另一个可能发生的问题(可能不是您的问题,但很高兴知道)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-01-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多