Exemplo n.º 1
0
 public function testCreate()
 {
     $json = '{
       "embeddedCode": "<script type=\'text/javascript\' language=\'JavaScript\' src=\'https://poweresq.echosign.com/embed/account/sendProgress?aid=XJ28WY42H5E2T6M&noChrome=true\'></script>",
       "libraryDocumentId": "2AAABLblqZhCLqOm1s_gWpTxax3wK6csrs22iQOYyLOZHLLnOl2FeL3IxFEkgO09JYWczAt_57Lw*",
       "url": "https://test.echosign.com/account/sendProgress?aid=XJ28WY42H5E2T6M"
     }';
     $transport = new \Echosign\Transports\GuzzleTransport();
     $client = $transport->getClient();
     $stream = Stream::factory($json);
     $mock = new Mock([new Response(200, ['content-type' => 'application/json'], $stream)]);
     $client->getEmitter()->attach($mock);
     $doc = new LibraryDocuments('1234', $transport);
     $fileInfo = new \Echosign\RequestBuilders\Agreement\FileInfo();
     $fileInfo->setLibraryDocumentId("balls");
     $docCreationinfo = new \Echosign\RequestBuilders\LibraryDocument\LibraryDocumentCreationInfo('test', 'DOCUMENT', $fileInfo, 'USER');
     $docCreate = new \Echosign\RequestBuilders\LibraryCreationInfo($docCreationinfo, new \Echosign\RequestBuilders\Agreement\InteractiveOptions());
     $response = $doc->create($docCreate);
     $this->assertInstanceOf('Echosign\\Responses\\LibraryDocumentCreationResponse', $response);
     $this->assertEquals("2AAABLblqZhCLqOm1s_gWpTxax3wK6csrs22iQOYyLOZHLLnOl2FeL3IxFEkgO09JYWczAt_57Lw*", $response->getLibraryDocumentid());
 }
Exemplo 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());
 }