Currently Using: Laravel 5.5
"tucker-eric/docusign-rest-client": "^1.0",
"tucker-eric/laravel-docusign": "^0.1.1"
Intention is to generate a URL so all customers / agents sign on the spot
Here is what I have so far
I first create the client
$client = new DocuSign\Rest\Client([
'username' => env('DOCUSIGN_USERNAME'),
'password' => env('DOCUSIGN_PASSWORD'),
'integrator_key' => env('DOCUSIGN_INTEGRATOR_KEY'),
'host' => env('DOCUSIGN_HOST')
]);
For each signer I assign their name and email
$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'
]);
I create the envelope (not sure why it sends it, I dont want it sent yet
$envelopeDefinition = $client->envelopeDefinition([
'status' => 'sent',
'email_subject' => '[DocuSign PHP SDK] - Signature Request Sample',
'template_id' => '***abc-123-',
'template_roles' => [
$templateRole1,
$templateRole2,
$templateRole3,
$templateRole4,
],
]);
Envelope options just because even tho I don't have any
$envelopeOptions = $client->envelopes->createEnvelopeOptions([]);
Creates the final envelope
$envelopeSummary = $client->envelopes->createEnvelope($envelopeDefinition, $envelopeOptions);
Prepare the embedding so I can extract the 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;
}
Which returns:
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
My question is what I'm doing wrong to get this error returned, and why is it sending the email to the people signing as I didn't explicitly tell it
Thanks