我想从Docusign API响应中获取recipient_signing_uri,但它返回null。

huangapple go评论63阅读模式
英文:

I want to get recipient_signing_uri from the Docusign API response but it returns null

问题

我要翻译的部分:

Here is the code

public function send(Request $request): object
{
   
    $apiClient = new ApiClient();
    $apiClient->getOAuth()->setOAuthBasePath(env('DS_AUTH_SERVER'));
    try {
        $accessToken = $this->getToken($apiClient);
    } catch (\Throwable $th) {
        return back()->withError($th->getMessage())->withInput();
    }
   
    $userInfo = $apiClient->getUserInfo($accessToken);
    $accountInfo = $userInfo[0]->getAccounts();
    $apiClient->getConfig()->setHost($accountInfo[0]->getBaseUri() . env('DS_ESIGN_URI_SUFFIX'));
    
    $envelopeDefenition = $this->buildEnvelope($request);
    try {
        $envelopeApi = new EnvelopesApi($apiClient);
        $result = $envelopeApi->createEnvelope($accountInfo[0]->getAccountId(), $envelopeDefenition);
        dd($result);
    } catch (\Throwable $th) {
        return back()->withError($th->getMessage())->withInput();
    }
    return view('backend.response')->with('result', $result);
}

When I print $result variable it returns a response like this

container: array:8 [
    "bulk_envelope_status" => null
    "envelope_id" => "b634f8c5-96c5-4a18-947f-59418d8c4e03"
    "error_details" => null
    "recipient_signing_uri" => null
    "recipient_signing_uri_error" => null
    "status" => "sent"
    "status_date_time" => "2023-02-16T07:24:39.1570000Z"
    "uri" => "/envelopes/b634f8c5-96c5-4a18-947f-59418d8c4e03"
  ]

I want to get the value of recipient signing uri in response but in my case it returns null

如何实现这一目标?有人会提出建议吗?

英文:

Here is the code

public function send(Request $request): object
    {
       
        $apiClient = new ApiClient();
        $apiClient->getOAuth()->setOAuthBasePath(env('DS_AUTH_SERVER'));
        try {
            $accessToken = $this->getToken($apiClient);
        } catch (\Throwable $th) {
            return back()->withError($th->getMessage())->withInput();
        }
       
        $userInfo = $apiClient->getUserInfo($accessToken);
        $accountInfo = $userInfo[0]->getAccounts();
        $apiClient->getConfig()->setHost($accountInfo[0]->getBaseUri() . env('DS_ESIGN_URI_SUFFIX'));
        
        $envelopeDefenition = $this->buildEnvelope($request);
        try {
            $envelopeApi = new EnvelopesApi($apiClient);
            $result = $envelopeApi->createEnvelope($accountInfo[0]->getAccountId(), $envelopeDefenition);
            dd($result);
        } catch (\Throwable $th) {
            return back()->withError($th->getMessage())->withInput();
        }
        return view('backend.response')->with('result', $result);
    }

When I print $result variable it returns a response like this

container: array:8 [
    "bulk_envelope_status" => null
    "envelope_id" => "b634f8c5-96c5-4a18-947f-59418d8c4e03"
    "error_details" => null
    "recipient_signing_uri" => null
    "recipient_signing_uri_error" => null
    "status" => "sent"
    "status_date_time" => "2023-02-16T07:24:39.1570000Z"
    "uri" => "/envelopes/b634f8`your text`c5-96c5-4a18-947f-59418d8c4e03"
  ]

I want to get the value of recipient signing uri in response but in my case it returns null

How I can achieve this? Will anyone suggests?

答案1

得分: 1

createEnvelope 创建信封。它不会提供嵌入式接收者视图(签署仪式)的URL。要获取该URL,您需要额外调用 EnvelopeViews:createRecipient/

查看此 页面 获取更多信息。

另外

$apiClient->getConfig()->setHost($accountInfo[0]->getBaseUri() . env('DS_ESIGN_URI_SUFFIX'));

您正在使用 UserInfo 返回数据中 accountInfo 数组中的第一个条目。这不是一个好主意。相反,寻找用户默认帐户的条目。

或者,如果您的应用程序设计用于与特定的电子签名帐户一起工作,请确保用户有权访问该帐户。

对于DocuSign的客户来说,访问多个帐户是很常见的。

英文:

createEnvelope creates the envelope. It does not give you an URL for an embedded recipient view (signing ceremony). In order to get that URL, you need to make an additional call to

EnvelopeViews:createRecipient/

See this page for more info.

Also

$apiClient->getConfig()->setHost($accountInfo[0]->getBaseUri() . env('DS_ESIGN_URI_SUFFIX'));

You are using the first entry in the UserInfo returned data's accountInfo array. That's not a good idea. Instead, look for the entry that is the user's default account.

Or if your application is designed to work with a specific eSign account, then make sure the user has access to that account.

It is very common for DocuSign customers to have access to more than one account.

答案2

得分: 1

由于您未使用嵌入式签名,您无法获取签署URL。用户将收到自动发送的电子邮件,其中包含他们用于签署文件的链接。

英文:

Since you are not using embedded signing, you can not get the signing URL. Users will receive automated emails which they will use to sign the documents.

huangapple
  • 本文由 发表于 2023年2月16日 16:25:47
  • 转载请务必保留本文链接:https://go.coder-hub.com/75469531.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定