Unhandled Server Error
Monday, April 5, 2021 at 09:16amHi,
Hi, I have download code from onespan "esignlive", i already replaced my sandbox key but code not work now. i can't understand what is issue with that. can you help me
Hi,
Hi, I have download code from onespan "esignlive", i already replaced my sandbox key but code not work now. i can't understand what is issue with that. can you help me
Reply to: Unhandled Server Error
Monday, April 5, 2021 at 09:46amHi Yogesh,
I don't have a problem signing the contract and redirect to stripe.html. Hence could you elaborate a bit more about the issue you are facing, a screenshot of the error trace could be helpful?
Duo
Reply to: Unhandled Server Error
Monday, April 5, 2021 at 09:52amBTW, if you want to navigate the page only when signing has completed, you can register a javascript notifier and monitor "ESL:MESSAGE:SUCCESS:SIGNER_COMPLETE" event, instead of invoking an server side API everytime.
Duo
Reply to: BTW, if you want to navigate…
Wednesday, April 7, 2021 at 01:06amCan you let me know what operating system was used?. because i tryied Ubuntu.
Reply to: Unhandled Server Error
Wednesday, April 7, 2021 at 01:12ami was checked in in linux and window but same issue with both, please check screenshoot
I have uploaded new code, can you let me know what is wrong with that.
Reply to: Unhandled Server Error
Wednesday, April 7, 2021 at 01:40amCode
Reply to: Unhandled Server Error
Wednesday, April 7, 2021 at 01:42am'PACKAGE', 'status' => 'DRAFT', 'roles' => array( array( 'id' => 'Signer1', 'type' => 'SIGNER', 'signers' => array( array( 'email' => $email, 'firstName' => $firstName, 'lastName' => $lastName, 'id' => 'Signer1', ) ) , ) , array( 'id' => 'Sender1', 'type' => 'SENDER', 'signers' => array( array( 'email' => '[email protected]', 'firstName' => 'Haris', 'lastName' => 'Haidary', 'id' => 'Sender1', ) ) , ) , ) , 'name' => 'PHP Application Example', ); $packageJSON = json_encode($build); $packageId = json_decode($this->sendRequest($this->packageAppend, $packageJSON, NULL, NULL), true); return $packageId; } //Upload document public function buildDocument($packageId) { $build = array( 'extract' => true, 'name' => 'Sample Contract', 'id' => 'contract' ); $doc = file_get_contents("documents/purchase_order.pdf"); $documentJSON = json_encode($build); $status = $this->sendRequest($this->packageAppend . $packageId['id'] . '/documents', $documentJSON, $doc, 'multipart/form-data'); return $status; } //Send Package public function buildSend($packageId) { $build = array( 'status' => 'SENT' ); $sendJSON = json_encode($build); $this->sendRequest($this->packageAppend . $packageId['id'], $sendJSON, NULL, 'application/json'); return NULL; } //Sender signs consent and contract documents public function buildSign($packageId) { $build = array( 'documents' => array( array( 'id' => 'default-consent', 'name' => 'Electronic Disclosures and Signatures Consent' ) , array( 'id' => 'contract', 'name' => 'Sample Contract' ) ) ); $signJSON = json_encode($build); $signatureAppend = $this->packageAppend . $packageId['id'] . '/documents/signed_documents'; $see = $this->sendRequest($signatureAppend, $signJSON, NULL, 'application/json'); return NULL; } //Get a session token public function buildToken($packageId) { $build = array( 'packageId' => $packageId['id'], 'signerId' => 'Signer1' ); $tokenJSON = json_encode($build); $token = json_decode($this->sendRequest($this->tokenAppend, $tokenJSON, NULL, 'application/json'), true); return $token; } //cURL function to send requests to eSignLive private function sendRequest($type, $json, $document, $contentType) { if (is_null($document) && is_null($contentType)) { $postfields = array( "payload" => $json ); } else if (is_null($document) && !is_null($contentType)) { $postfields = $json; } else if (!is_null($document) && $contentType == 'multipart/form-data') { $postfields = array( "file" => $document, "payload" => $json ); } $headerOptions = array( 'Authorization: Basic ' . $this->key ); if (!is_null($contentType)) { $headerOptions[] = "Content-Type: $contentType"; } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $this->url . $type); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_FAILONERROR, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT ,0); curl_setopt($ch, CURLOPT_TIMEOUT, 400); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); if (!is_null($postfields)) { curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields); if (!is_array($postfields)) { $headerOptions[] = 'Content-Length: ' . strlen($postfields); } } curl_setopt($ch, CURLOPT_HTTPHEADER, $headerOptions); $response = curl_exec($ch); $err = curl_error($ch); curl_close($ch); if ($err) { return $err; } else { return $response; }; } } ?>
Reply to: Unhandled Server Error
Wednesday, April 7, 2021 at 08:36amHi Yogesh,
I was testing on Windows machine, XAMPP stack. Just a quick confirmation first, you did have replaced the API Key with your own at line 8, ESLPackageCreation.php, right?
If so, could you console log below variables in contract.php? - $packageId, $value
Duo