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']));
 }
Ejemplo n.º 2
0
 public function testCreate()
 {
     $transport = new \Echosign\Transports\GuzzleTransport();
     $client = $transport->getClient();
     $json = '{
         "embeddedCode": "<script type=\'text/javascript\' language=\'JavaScript\' src=\'https://secure.echosign.com/embed/public/apiLogin?aalc=2AAABLblqZhCLSCUdCzl12KADeV4p7qZdJGbvZxslHruG00s8isauKjnQGAWd1jHq2d67jT_A8nI1Rha9ijWRxjBcIUZuL3m5dPAPyFKBD8wAB0goNmv1E-NVtpSgKhuZ2PBiVp6BlNI*&noChrome=true\'></script>",
         "expiration": "2014-07-07T08:39:24-07:00",
         "agreementId": "2AAABLblqZhBXIFwsI6hzV5IzticsCNYH2wZFgfEdo8mhhpOMZR261g3d5tR9RHpg6ckTZFftG2o*",
         "url": "https://secure.echosign.com/public/apiLogin?aalc=2AAABLblqZhCLSCUdCzl12KADeV4p7qZdJGbvZxslHruG00s8isauKjnQGAWd1jHq2d67jT_A8nI1Rha9ijWRxjBcIUZuL3m5dPAPyFKBD8wAB0goNmv1E-NVtpSgKhuZ2PBiVp6BlNI*"
     }';
     $stream = Stream::factory($json);
     $mock = new Mock([new Response(200, ['content-type' => 'application/json'], $stream)]);
     $client->getEmitter()->attach($mock);
     $agreement = new Agreements('12335', $transport);
     $fileInfo = new \Echosign\RequestBuilders\Agreement\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');
     $creation = new \Echosign\RequestBuilders\AgreementCreationInfo($doc, new \Echosign\RequestBuilders\Agreement\InteractiveOptions());
     $response = $agreement->create($creation);
     $this->assertInstanceOf('Echosign\\Responses\\AgreementCreationResponse', $response);
     $this->assertEquals("2014-07-07T08:39:24-07:00", $response->getExpiration());
     $this->assertEquals("2AAABLblqZhBXIFwsI6hzV5IzticsCNYH2wZFgfEdo8mhhpOMZR261g3d5tR9RHpg6ckTZFftG2o*", $response->getAgreementId());
 }
Ejemplo n.º 3
0
 /**
  * @return array
  */
 public function toArray()
 {
     return ['documentCreationInfo' => $this->documentCreationInfo->toArray(), 'options' => $this->interactiveOptions->toArray()];
 }
Ejemplo n.º 4
0
 /**
  * Create an agreement from a transientDocumentId, 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 $transientDocumentId
  * @param $agreementName
  * @return bool|string
  * @internal param $signatureType
  * @internal param $signatureFlow
  */
 public function createFromTransientDocumentId($signerEmail, $message, $transientDocumentId, $agreementName)
 {
     $this->agreement = new Agreements($this->getToken(), $this->getTransport());
     $fileInfo = new FileInfo();
     $fileInfo->transientDocumentId = $transientDocumentId;
     $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();
 }