使用DocuSign创建信封时提示收件人用户名无效的问题求助
DocuSign创建信封时提示收件人用户名无效的问题求助
大家好,我最近在用DocuSign API对接业务时遇到了一个奇怪的问题:明明已经传递了收件人的用户名,但调用接口时却收到错误提示:
The user name for the recipient is invalid. Envelope definition is missing a UserName for recipientId
我把相关代码贴出来,麻烦各位帮忙排查一下问题所在:
第一个函数:获取签名人姓名并调用发送方法
public function validate(Request $request) { $valideur = User::find($devi->id_assigne); $signer2 = array( "firstname" => $valideur->firstname, "lastname" => $valideur->lastname, ); $name = $signer2["firstname"]; $this->sends($name); }
第二个函数:创建DocuSign信封及收件人视图
public function sends($name) { $this->args = $this->getTemplateArgs(); $args = $this->args; $envelope_args = $args["envelope_args"]; $envelope_definition = $this->makeEnvelopeFileObject($args["envelope_args"],$name); $apiClient = new ApiClient(); $apiClient->getOAuth()->setOAuthBasePath(config('app.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() . config('app.sufix')); $apiClient->getConfig()->addDefaultHeader('Authorization', 'Bearer ' . $args['ds_access_token']); $envelopeApi = new EnvelopesApi($apiClient); $results = $envelopeApi->createEnvelope($accountInfo[0]->getAccountId(), $envelope_definition); $envelope_id = $results->getEnvelopeId(); $authentication_method = 'None'; # How is this application authenticating $recipient_view_request = new \DocuSign\eSign\Model\RecipientViewRequest([ 'authentication_method' => $authentication_method, 'client_user_id' => '1000', 'recipient_id' => '1', 'return_url' => $envelope_args['ds_return_url'], 'user_name' => $name , 'email' =>'' ]); $results = $envelopeApi->createRecipientView($accountInfo[0]->getAccountId(), $envelope_id, $recipient_view_request); }
我已经dump过$name变量,能得到正确的名(firstname),但就是搞不懂为什么会触发这个错误。希望有经验的朋友能帮我看看哪里处理错了!
备注:内容来源于stack exchange,提问作者Rubyjane
相关产品推荐
相关产品推荐

