ets / echosign-bundle
EchoSign Bundle 包含与 EchoSign WebServices 交互的方法
0.2.5
2016-08-23 14:45 UTC
Requires
- php: >=5.3.3
- ext-openssl: *
- ext-soap: *
- symfony/framework-bundle: >=2.1
README
ETSEchoSignBundle 为 EchoSign API 提供封装:https://secure.echosign.com/public/docs/EchoSignDocumentService16
安装
您可以使用 composer 安装此扩展包。
composer.phar require ets/echosign-bundle
当询问安装哪个版本时,请使用 dev-master。
## 启用扩展包
在内核中启用扩展包
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new ETS\EchoSignBundle\ETSEchoSignBundle() ); }
配置
该扩展包需要一些必填参数,在您的 config.yml 中
ets_echo_sign:
api:
key: YOUR_API_KEY
gateway: ECHOSIGN_API_GATEWAY #e.g: https://secure.echosign.com/services/EchoSignDocumentService16
wsdl: ECHOSIGN_API_WSDL_URL #e.g: https://secure.echosign.com/services/EchoSignDocumentService16?wsdl
您还可以激活调试选项
ets_echo_sign:
debug:
prefix: YOUR_PREFIX
它所做的只是在上传文件时添加前缀。由于 EchoSign 没有提供组织文件的方式,前缀可以帮助您以更“干净”的方式分类上传的文件。例如,您可以为本地开发使用前缀 "DEV_",为预生产环境使用 "PREPROD_"。
并且您必须指定一个电子邮件地址列表,用作收件人
ets_echo_sign:
recipients: [email1@corp.com]
可用的 API
客户端服务提供了对最常用方法的封装
- sendDocument
- getDocumentInfo
- removeDocument
- getMyDocuments
发送文档
$recipients = new RecipientInfoCollection('recipient@test.com');
$fileCollections = new FileInfoCollection();
$fileCollections->addFileInfo(new FileInfo('file.pdf', 'file.pdf'));
$documentCreationInfo = new DocumentCreationInfo($recipients, 'Test document', $fileCollections);
$this->getContainer()->get('ets.echo.sign.client')->sendDocument($documentCreationInfo);
此方法返回新上传文件的文档密钥
获取文档信息
$this->getContainer()->get('ets.echo_sign.client')->getDocumentInfo($documentKey);
如果文档不存在,它将返回 null 而不是原始 API 实现的 SoapFault 异常。
删除文档
$this->getContainer()->get('ets.echo_sign.client')->removeDocument($documentKey);
检索所有文档
$this->getContainer()->get('ets.echo_sign.client')->getMyDocuments();