taitai42 / docusign
Laravel 5 的 DocuSign Rest API 包装器
Requires
- php: >=5.4.0
- guzzlehttp/guzzle: ~6.0
- illuminate/support: ~6.8
- laravel/framework: 6.*
Requires (Dev)
- phpunit/phpunit: 4.*
This package is not auto-updated.
Last update: 2024-09-23 07:09:48 UTC
README
- 此包是为了在基于 Laravel 的 CRM 中直接利用电子合同/签名而开发的。
安装
将以下内容添加到您的 composer.json 文件中。
"tjphippen/docusign": "0.3.*@dev"
然后运行 composer install 或 composer update 下载并安装。
接下来,您需要将服务提供者在您的 config/app.php 文件中的 providers 部分注册。
'providers' => array( Tjphippen\Docusign\DocusignServiceProvider::class, )
DocuSign 包含一个自动注册的 facade,它提供了管理信封、收件人等的静态语法。如果遇到问题,请手动将其添加到您的别名数组中
'aliases' => array( 'Docusign' => Tjphippen\Docusign\Facades\Docusign::class, )
使用 artisan 创建配置文件
$ php artisan vendor:publish
配置文件将被发布到 config/docusign.php,它必须完成才能连接到 API。
/** * The DocuSign Integrator's Key */ 'integrator_key' => '', /** * The Docusign Account Email */ 'email' => '', /** * The Docusign Account Password */ 'password' => '', ...
示例
获取用户列表
Docusign::getUsers();
获取单个用户
Docusign::getUser($userId); Docusign::getUser($userId, true); // When true, the full list of user information is returned for the user.
获取文件夹
Docusign::getFolders(); // By default only the list of template folders are returned Docusign::getFolders(true); // Will return normal folders plus template folders
获取文件夹信封列表
Docusign::getFolderEnvelopes($folderId);
查看:[此方法的所有参数](https://www.docusign.com/p/RESTAPIGuide/RESTAPIGuide.htm#REST%20API%20References/Get%20Folder%20Envelope%20List.htm%3FTocPath%3DREST%2520API%2520References%7C_____97)
Docusign::getFolderEnvelopes($folderId, array( 'start_position' => 1, // Integer 'from_date' => '', // date/Time 'to_date' => '', // date/Time 'search_text' => '', // String 'status' => 'created', // Status 'owner_name' => '', // username 'owner_email' => '', // email );
获取模板列表
Docusign::getTemplates();
或者通过 附加参数。
Docusign::getTemplates(array( 'folder' => 1, // String (folder name or folder ID) 'folder_ids' => '', // Comma separated list of folder ID GUIDs. 'include' => '', // Comma separated list of additional template attributes ... );
获取模板
Docusign::getTemplate($templateId);
获取多个信封
$envelopes = array('49d91fa5-1259-443f-85fc-708379fd7bbe', '8b2d44a-41dc-4698-9233-4be0678c345c'); Docusign::getEnvelopes($envelopes);
获取单个信封
Docusign::getEnvelope($envelopeId);
获取信封收件人
Docusign::getEnvelopeRecipients($envelopeId);
要包括标签,只需将第二个参数设置为 true
Docusign::getEnvelopeRecipients($envelopeId, true);
获取信封自定义字段
Docusign::getEnvelopeCustomFields($envelopeId);
获取收件人的标签信息
查看:[标签参数](https://www.docusign.com/p/RESTAPIGuide/RESTAPIGuide.htm#REST%20API%20References/Tab%20Parameters.htm%3FTocPath%3DREST%2520API%2520References%7CSend%2520an%2520Envelope%2520or%2520Create%2520a%2520Draft%2520Envelope%7CTab%2520Parameters%7C_____0)
Docusign::getEnvelopeTabs($envelopeId, $recipientId);
修改收件人的标签
这个有点棘手。需要 tabId,并且它必须在数组集中。查看:[标签类型和参数](https://www.docusign.com/p/RESTAPIGuide/RESTAPIGuide.htm#REST%20API%20References/Tab%20Parameters.htm)
$tabs = ['textTabs' => [['tabId' => '270269f6-4a84-4ff9-86db-2a572eb73d99', 'value' => '123 Fake Street']]]; Docusign::updateRecipientTabs($envelopeId, $recipientId, $tabs);
从模板创建/发送信封
查看:[发送信封或创建草稿信封](https://www.docusign.com/p/RESTAPIGuide/RESTAPIGuide.htm#REST%20API%20References/Send%20an%20Envelope.htm%3FTocPath%3DREST%2520API%2520References%7CSend%2520an%2520Envelope%2520or%2520Create%2520a%2520Draft%2520Envelope%7C_____0) 以获取参数/选项的完整列表。
Docusign::createEnvelope(array( 'templateId' => 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', // Template ID 'emailSubject' => 'Demo Envelope Subject', // Subject of email sent to all recipients 'status' => 'created', // created = draft ('sent' will send the envelope!) 'templateRoles' => array( ['name' => 'TJ Phippen', 'email' => 'tj@tjphippen.com', 'roleName' => 'Contractor', 'clientUserId' => 1], ['name' => 'Jane Someone', 'email' => 'demo@demo.com', 'roleName' => 'Customer']), ));
修改草稿信封的电子邮件主题和消息
可以使用 updateEnvelope 方法以多种方式使用。
Docusign::updateEnvelope($envelopeId, array( 'emailSubject' => 'New Email Subject', // Required 'emailBlurb' => 'Email message body text' ));
发布收件人视图
返回嵌入式签名 URL。[参考](https://www.docusign.com/p/RESTAPIGuide/RESTAPIGuide.htm#REST%20API%20References/Post%20Recipient%20View.htm)
Docusign::createRecipientView($envelopeId, array( 'userName' => 'TJ Phippen', 'email' => 'tj@tjphippen.com', 'AuthenticationMethod' => 'email', 'clientUserId' => 1, // Must create envelope with this ID 'returnUrl' => 'http://your-site.tdl/returningUrl' ));
发送草稿信封
Docusign::updateEnvelope($envelopeId, ['status' => 'sent']);
取消信封
Docusign::updateEnvelope($envelopeId, array( 'status' => 'voided', 'voidedReason' => 'Just Testing' ));
删除信封
Docusign::deleteEnvelope($envelopeId);
变更日志
v0.2.0
- 更新 Guzzle 依赖关系及命名空间
v0.2.0
- 添加 trait
v0.1.0
- 发布