PHP code example of mpp / universign-bundle

1. Go to this page and download the library: Download mpp/universign-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mpp / universign-bundle example snippets


...
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' => '[email protected]',
                '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);

{
  'id' => "bde1e661-a217-4d2b-a3ec-160c2e266ff4"
  'url' => "https://sign.test.universign.eu/sig/#/?id=7d161638-9fb7-42c9-bb56-c902ea491404"
}
 

$documents = $this->requester->getDocuments($transactionId);

[
    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'
        ]
    ]
]