private function _getSignContractUrl() { $this->load->library('My_hellosign'); $credentials = $this->Applicants_mod->getApplicantCredentials($this->session->userdata('id_app')); $client = new HelloSign\Client('91edca53ee57216dfb2f2831344e74071fde8841230e990446669a2cb5550da6'); $request = new HelloSign\TemplateSignatureRequest(); $request->enableTestMode(true); $request->setTemplateId('d36e1118b0b361619e2537758ce7bcbdf56a6253'); $request->setSubject($credentials->fullname . ' Contract'); $request->setMessage('Thanks For your sign.'); $request->setSigner('Buyback Agent', $credentials->email, $credentials->fullname); $client_id = 'b8e5c9c56f7b8104c74d5c58dbaaf39f'; // Turn it into an embedded request $embedded_request = new HelloSign\EmbeddedSignatureRequest($request, $client_id); // Send it to HelloSign $response = $client->createEmbeddedSignatureRequest($embedded_request); // Grab the signature ID for the signature page that will be embedded in the $signatures = $response->getSignatures(); $signature_id = $signatures[0]->getId(); //I have just one but can be more // Retrieve the URL to sign the document $response = $client->getEmbeddedSignUrl($signature_id); // Store it to use with the embedded.js HelloSign.open() call $sign_url = $response->getSignUrl(); return $sign_url; }
/** * @group embedded */ public function testCreateUnclaimedDraftEmbeddedWithTemplate() { $client_id = $_ENV['CLIENT_ID']; $templates = $this->client->getTemplates(); $template = $templates[0]; $templateId = $template->getId(); $baseReq = new \HelloSign\TemplateSignatureRequest(); $baseReq->setTemplateId($templateId); $baseReq->setSigner('Signer', '*****@*****.**', 'Harry Potter'); $baseReq->setSigningRedirectUrl('http://hogwarts.edu/success'); $baseReq->setRequestingRedirectUrl('http://hogwarts.edu'); $baseReq->setRequesterEmailAddress('*****@*****.**'); $baseReq->addMetadata('House', 'Griffyndor'); $request = new \HelloSign\EmbeddedSignatureRequest($baseReq); $request->setClientId($client_id); $request->enableTestMode(); $request->setEmbeddedSigning(); $response = $this->client->createUnclaimedDraftEmbeddedWithTemplate($request); $this->assertTrue($response instanceof \HelloSign\UnclaimedDraft); }