Beispiel #1
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());
 }