mpp/universign-bundle
最新稳定版本:v5.0.1
Composer 安装命令:
composer require mpp/universign-bundle
包简介
Symfony Universign Bundle
README 文档
README
Installation:
To install this bundle, simply run the following command:
$ composer require mpp/universign-bundle
How to run:
Before run, you need to add UNIVERSIGN_ENTRYPOINT_SIGN and UNIVERSIGN_ENTRYPOINT_RA variables in the .env file of your project with the url and the credentials of the universign account.
###> mpp/unviversign-bundle ###
UNIVERSIGN_ENTRYPOINT_SIGN=https://<LOGIN>:<PASSWORD>@sign.test.cryptolog.com/sign/rpc/
UNIVERSIGN_ENTRYPOINT_RA=https://<LOGIN>:<PASSWORD>@sign.test.cryptolog.com/ra/rpc/
###< mpp/unviversign-bundle ###
After this you can use this bundle with your Symfony Project.
How to use:
Here is a presentation of the Universign workflow:
Requests a signature
First, you have to send a transaction to Universign services.
Transaction Request
Here is an example:
... use Mpp\UniversignBundle\Requester\SignerInterface; ... /** * @var SignerInterface; */ private $requester; public function __construct(SignerInterface $requester) { $this->requester = $requester; } ... $transactionRequest = $this->requester->initiateTransactionRequest([ 'signers' => [ [ 'firstname' => 'john', 'lastname' => 'doe', 'organization' => 'dummy company', 'emailAddress' => 'john.doe@dummy-company.com', 'phoneNum' => '+0122334455', 'language' => 'fr', 'birthDate' => new \DateTime::createFromFormat('Y-m-d', '2000-01-01'), ], ], 'documents' => [ 'mpp_contract' => [ 'fileName' => $document->getFileName(), 'content' => $this->storage->resolvePath($document), 'signatureFields' => [ [ 'name' => 'Signature:', 'page' => 18, 'signerIndex' => 0, ], ], ], ], 'finalDocSent' => true, ]); $transactionResponse = $this->requester->requestTransaction($transactionRequest);
Once you have send the request transaction, you will get a TransactionResponse object in which you will find the transaction ID and an URL.
Transaction Response
Here is an example of the TransactionResponse object:
{
'id' => "bde1e661-a217-4d2b-a3ec-160c2e266ff4"
'url' => "https://sign.test.universign.eu/sig/#/?id=7d161638-9fb7-42c9-bb56-c902ea491404"
}
The id value identify the transaction, it allow you to get more information about the transaction, retrieve the signed documents.
The url value is used to sign the documents by the signers.
Requests the signed document
After you have send your transaction request and it has been signed, send a request to get the signed documents with the previous transaction id:
$documents = $this->requester->getDocuments($transactionId);
You will get an array of Document object:
[
0 => [
'id' => 'http.example.com',
'documentType' => 'pdf',
'content' => "JVBERi0xLj[...]UKJb4",
'fileName' => 'contract_test',
'signatureFields' => [
[
'name' => 'Client:',
'page' => 1,
'x' => 100,
'y' => 200,
'signerIndex' => 0,
],
]
'checkBoxTexts' => null,
'metaData' => null,
'title' => null,
'sepaData' => [
'rum' => '87654345678765'
'ics' => 'FR12ZZZ123456'
'iban' => 'FR7630006000011234567890189'
'bic' => 'BREDFRPPXXX'
'recuring' => false
'debtor' => [
'name' => 'Victor Vidal'
'address' => '805, boulevard Richard'
'postalCode' => '32 082'
'city' => 'Ruiz-sur-Dos Santos'
'country' => 'Christmas (Île)'
]
]
'creditor' => [
'name' => 'Marie Pierre'
'address' => 'rue Roger Marie'
'postalCode' => '71 625'
'city' => 'Deschamps-sur-Dupre'
'country' => 'Bosnie-Herzégovine'
]
]
]
The content parameters is your signed document base64 encoded. Simply decode it to get the file.
More Informations:
- Advanced documentation:
- Object Structure:
- Others:
统计信息
- 总下载量: 11.56k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-07-29
