Esempio n. 1
0
         break;
         //If job status Postponed throw exception with error
     } elseif ($jobInfo->result->job_status == "Postponed") {
         throw new Exception("Job is failed");
     }
 }
 if ($jobInfo->result->job_status == "Pending") {
     throw new Exception("Job is pending");
 }
 //Get file guid
 $guid = $jobInfo->result->inputs[0]->outputs[0]->guid;
 $envelop = $signatureApi->CreateSignatureEnvelope($clientId, $jobInfo->result->inputs[0]->outputs[0]->name);
 if ($envelop->status == "Ok") {
     sleep(5);
     //Add uploaded document to envelope
     $addDocument = $signatureApi->AddSignatureEnvelopeDocument($clientId, $envelop->result->envelope->id, $guid, null, true);
     if ($addDocument->status == "Ok") {
         //Get role list for curent user
         $recipient = $signatureApi->GetRolesList($clientId);
         if ($recipient->status == "Ok") {
             //Get id of role which can sign
             for ($i = 0; $i < count($recipient->result->roles); $i++) {
                 if ($recipient->result->roles[$i]->name == "Signer") {
                     $roleId = $recipient->result->roles[$i]->id;
                 }
             }
             //Add recipient to envelope
             $addRecipient = $signatureApi->AddSignatureEnvelopeRecipient($clientId, $envelop->result->envelope->id, $email, $name, $lastName, $roleId, null);
             if ($addRecipient->status == "Ok") {
                 //Get recipient id
                 $getRecipient = $signatureApi->GetSignatureEnvelopeRecipients($clientId, $envelop->result->envelope->id);
Esempio n. 2
0
         }
     } catch (Exception $e) {
         $error = 'ERROR: ' . $e->getMessage() . "\n";
         F3::set('error', $error);
     }
 }
 //Create SignatureApi object
 $signature = new SignatureApi($apiClient);
 $signature->setBasePath($basePath);
 //Create envilope using user id and entered by user name
 try {
     $envelop = $signature->CreateSignatureEnvelope($clientID, $name);
     if ($envelop->status == "Ok") {
         sleep(5);
         //Add uploaded document to envelope
         $addDocument = $signature->AddSignatureEnvelopeDocument($clientID, $envelop->result->envelope->id, $fileGuId, null, true);
         try {
             if ($addDocument->status == "Ok") {
                 //Get role list for curent user
                 try {
                     $recipient = $signature->GetRolesList($clientID);
                     if ($recipient->status == "Ok") {
                         //Get id of role which can sign
                         for ($i = 0; $i < count($recipient->result->roles); $i++) {
                             if ($recipient->result->roles[$i]->name == "Signer") {
                                 $roleId = $recipient->result->roles[$i]->id;
                             }
                         }
                         //Add recipient to envelope
                         try {
                             $addRecipient = $signature->AddSignatureEnvelopeRecipient($clientID, $envelop->result->envelope->id, $email, $signName, $lastName, $roleId, null);