【发布时间】:2018-11-27 18:28:27
【问题描述】:
目前使用: Laravel 5.5
"tucker-eric/docusign-rest-client": "^1.0",
"tucker-eric/laravel-docusign": "^0.1.1"
目的是生成一个 URL,以便所有客户/代理当场签名
这是我目前所拥有的
我先创建客户端
$client = new DocuSign\Rest\Client([
'username' => env('DOCUSIGN_USERNAME'),
'password' => env('DOCUSIGN_PASSWORD'),
'integrator_key' => env('DOCUSIGN_INTEGRATOR_KEY'),
'host' => env('DOCUSIGN_HOST')
]);
我为每个签名者指定他们的姓名和电子邮件
$templateRole1 = $client->templateRole([
'email' => 'abc@gmail.com',
'name' => 'abc',
'role_name' => 'Agent'
]);
$templateRole2 = $client->templateRole([
'email' => 'abc123@gmail.com',
'name' => 'abc',
'role_name' => 'Purchaser 1'
]);
$templateRole3 = $client->templateRole([
'email' => 'abc124@gmail.com',
'name' => 'abc124',
'role_name' => 'Purchaser 2'
]);
$templateRole4 = $client->templateRole([
'email' => 'abc125@gmail.com',
'name' => 'abc125',
'role_name' => 'Seller'
]);
我创建了信封(不知道为什么要发送它,我还不想发送它
$envelopeDefinition = $client->envelopeDefinition([
'status' => 'sent',
'email_subject' => '[DocuSign PHP SDK] - Signature Request Sample',
'template_id' => '***abc-123-',
'template_roles' => [
$templateRole1,
$templateRole2,
$templateRole3,
$templateRole4,
],
]);
信封选项只是因为即使我没有任何
$envelopeOptions = $client->envelopes->createEnvelopeOptions([]);
创建最终信封
$envelopeSummary = $client->envelopes->createEnvelope($envelopeDefinition, $envelopeOptions);
准备嵌入,以便我可以提取 URL
$envelopeApi = $client->envelopes;
$recipient_view_request = new \DocuSign\eSign\Model\RecipientViewRequest();
$recipient_view_request->setReturnUrl('https://www.example.net/callback/docusign');
$recipient_view_request->setClientUserId((string) $client->getAccountId());
$recipient_view_request->setAuthenticationMethod("None");
try {
$signingView = $envelopeApi->createRecipientView($client->getAccountId(), $envelopeSummary->getEnvelopeId(), $recipient_view_request);
} catch (DocuSign\eSign\ApiException $e){
echo "Error connecting Docusign : " . $e->getResponseBody()->errorCode . " " . $e->getResponseBody()->message;
}
返回:
object(DocuSign\eSign\Model\ErrorDetails)#419 (1) { ["container":protected]=> array(2) { ["error_code"]=> string(20) "INVALID_REQUEST_BODY" ["message"]=> string(94) "The request body is missing or improperly formatted. Input string was not in a correct format." } } Error connecting Docusign : INVALID_REQUEST_BODY The request body is missing or improperly formatted. Input string was not in a correct format.done
我的问题是我做错了什么才能返回此错误,为什么它会将电子邮件发送给签名的人,因为我没有明确告诉它
谢谢
【问题讨论】:
-
嘿,$envelopeDefinition 中的状态参数是“已发送”,这可能是导致发送的原因吗?还有哪些可用的选项。至于您的错误,您发送的请求不是它期望的格式,请查看此方法 createRecipientView 的 API,并确保您发送所有正确的参数。
-
是的,我为你找到了这个github.com/docusign/docusign-php-client/blob/master/test/… 看看第 95 行还有一些代码可能会有所帮助。
标签: php laravel docusignapi