public function testCreate()
 {
     $fileInfo = new FileInfo();
     $fileInfo->setDocumentURL('test.pdf', 'http://www.yahoo.com', 'application/pdf');
     $doc = new DocumentCreationInfo($fileInfo, 'test', 'ESIGN', 'SENDER_SIGNATURE_NOT_REQUIRED');
     $doc->setCallBackInfo('http://localhost');
     $output = $doc->toArray();
     $this->assertEquals('test', $output['name']);
     $this->assertEquals('http://localhost', $output['callbackInfo']);
     $this->assertEquals(1, count($output['fileInfos']));
 }
示例#2
0
 /**
  * Create an agreement from a file hosted on a remote server, for specified signerEmail with message. You can use
  * $this->getResponse() to get created agreement. If successful it returns the agreementId.
  * @param $signerEmail
  * @param $message
  * @param $fileName
  * @param $url
  * @param $agreementName
  * @return bool|string
  * @internal param $signatureType
  * @internal param $signatureFlow
  */
 public function createFromUrl($signerEmail, $message, $fileName, $url, $agreementName)
 {
     $this->agreement = new Agreements($this->getToken(), $this->getTransport());
     $fileInfo = new FileInfo();
     $fileInfo->setDocumentURL($fileName, $url);
     $docCreationInfo = new DocumentCreationInfo($fileInfo, $agreementName, $this->getSignatureType(), $this->getSignatureFlow());
     $docCreationInfo->setMessage($message)->addRecipient('SIGNER', $signerEmail);
     $agreementCreationInfo = new AgreementCreationInfo($docCreationInfo, new InteractiveOptions());
     try {
         $this->response = $this->agreement->create($agreementCreationInfo);
     } catch (JsonApiResponseException $e) {
         $this->errorMessages[$e->getCode()] = sprintf('%s - %s', $e->getApiCode(), $e->getMessage());
         return false;
     } catch (\Exception $e) {
         $this->errorMessages[$e->getCode()] = $e->getMessage();
         return false;
     }
     return $this->response->getAgreementId();
 }