// src/EventSubscriber/PreSignSubscriber.php
$envelopeBuilder->addAnchorSignatureZone(
string $anchorString,
array $offsets = ["x_offset" => 1, "y_offset" => 3],
?bool $isNotMandatory = false,
?int $recipientId = null
)
// src/Controller/MyController.php
return $this->redirectToRoute(
'docusign_sign_name',
[
'paths' => [$filename,$filename2],
'urls' => [
$this->docusignUploadTmpDirectory.'/'.$filename,
$this->docusignUploadTmpDirectory.'/'.$filename2
],
'customIds' => [
"custom1" => "custom data",
"custom2" => $id // for callback
],
'signerName' => "John doe",
'signerEmail' => "email@example.com",
],
);
# config/packages/docusign.yml
demo: "%kernel.debug%"
mode: clickwrap
auth_jwt:
private_key: "Your private key"
integration_key: "Your integration key%"
user_guid: "Your user id%"
auth_clickwrap:
api_account_id: "Your api account id %"
clickwrap_id: "YourClickwrapId" // facultative
user_guid: "Your user id"
The different methods to implement are as follows:
// src/Service/AnyService.php
$infos = [
"name" => $filename,
"path" => $documentPath
];
$params = [
// display_settings
'consent_button_text', // optional
'display_name', // optional
'downloadable', // optional
'format', // optional
'has_decline_button', // optional
'must_read', // optional
'require_accept', // optional
'document_display', // optional
// document
'document_name', // optional
'order' // optional
];
$response = $clickwrapRequester->createClickwrap($infos, $params);
$myObject
->setClickwrapId($response["clickwrapId"])
->setClickwrapVersionId($response["versionId"])
;
Updating an existing clickwrap
// src/Service/AnyService.php
$infos = [
"name" => $filename,
"path" => $documentPath
];
$params = [
// display_settings
'consent_button_text', // optional
'display_name', // optional
'downloadable', // optional
'format', // optional
'has_decline_button', // optional
'must_read', // optional
'require_accept', // optional
'document_display', // optional
// document
'document_name', // optional
'order' // optional
];
$clickwrapId = $myObject->getClickwrapId();
$response = $clickwrapRequest->updateClickwrap($clickwrapId, $infos, ["display_name" => "Document name"])
$myObject
->setClickwrapId($response["clickwrapId"])
->setClickwrapVersionId($response["versionId"])
;
Remove an existing clickwrap
// src/Service/AnyService.php
$clickwrapId = $myObject->getClickwrapId();
$response = $clickwrapRequest->deleteClickwrap($clickwrapId)
return $response["status"] === "Deleted"
// src/Service/AnyService.php
$params = [
"fullname" => "Pierre Kiroul", // mandatory
"email" => "Pierre-kiroul@example.com", // mandatory
"clickwrapId" => "Here a clickwrap id", // mandatory
'company' => "Your company", // optional
'title' => "Your title", // optional
"returnUrl" => "redirection url after signing", // optional
];
$response = $clickwrapRequester->signClickwrap($params);
if(null !== $response){
//If the response is not null, everything went well, and you will find a URL in the response.
//You will need to redirect to this URL to continue the signing process on DocuSign.
}
// src/Service/AnyService.php
$response = $this->clickwrapRequester->getClickwrapAgreement(
(string) $agreementId,
(string) $clickwrapId
);
try {
$fileContent = '';
while (!$fileObject->eof()) {
$fileContent .= $fileObject->fgets();
}
// Create response to view PDF
$fileResponse = new Response($fileContent);
$fileResponse->headers->set('Content-Type', 'application/pdf');
$fileResponse->headers->set('Content-Disposition', 'inline; filename="document.pdf"');
return $fileResponse;
}
catch(Exception $e){
throw new \RuntimeException("Error while retrieving the agreement : ".$e);
}
How can I help you explore Laravel packages today?