lbccanada | Posts: 4

Package Create - Cannot send package without approvals.

0 votes

Hi Team,

We are trying to integrate One Span Sign into our PHP Laravel application. We got the sample from the support team. But we are getting the following error when we try to create the package. Here we are using PHP CURL functionality to initiate the REST API calls.

Array ( [messageKey] => error.validation.sendPackage.noApprovals [message] => Cannot send package without approvals. [code] => 400 [name] => Validation Error )

Please suggest where we are wrong and let us know do we need to enable any settings.

Attached are the files for your reference. Please help us to proceed further.


Approved Answer
Duo_Liang | Posts: 3776

Reply to: Package Create - Cannot send package without approvals.

0 votes

Hi there,

 

Thanks for your post! Can you share the JSON and the document in use? As the error message suggested, you should at least define one approval under "documents" > "approvals" in your JSON.

 

Duo


lbccanada | Posts: 4

Reply to: Package Create - Cannot send package without approvals.

0 votes

Hi Duo,

Please find our JSON 

$json = array(
            'type' => 'PACKAGE',
            'status' => 'SENT',
            'roles' => array(
                array(
                    'id' => '12345',
                    'type' => 'SIGNER',
                    'signers' => array(
                        array(
                            'email' => '[email protected]',
                            'firstName' => 'John',
                            'lastName' => 'Smith',
                            'id' => '12345',
                        )
                    ) ,
                ) ,
                array(
                    'id' => 'Sender1',
                    'type' => 'SIGNER',
                    'signers' => array(
                        array(
                            'email' => '[email protected]',
                            'firstName' => 'Mike',
                            'lastName' => 'Smith',
                            'id' => 'Sender1',
                        )
                    ) ,
                ) ,
            ) ,
            'name' => 'PHP Application Example',
            'documents' => array(
                        array(
                            'name' => 'sample',
                            'id' => 'contract',
                            'extract' => 'true'
                        )
                    )
        );
 


Duo_Liang | Posts: 3776

Reply to: Package Create - Cannot send package without approvals.

0 votes

Hi there,

 

You have document > extract:true in your JSON, which means the signatures and fields will be extracted automatically and OSS doc engine expects either text tags or PDF forms in your PDF.

Can I also have the PDF you uploaded?

 

Duo

 

 


lbccanada | Posts: 4

Reply to: Package Create - Cannot send package without approvals.

0 votes

Please find the document also


Attachments
sample.pdf2.96 KB
Duo_Liang | Posts: 3776

Reply to: Package Create - Cannot send package without approvals.

0 votes

Try to use this PDF instead.

You can find text tags like {{esl:12345:capture:size(200,50)}}, where "12345" matches the role > name. (I didn't see it in your JSON, it's better to set it explicitly)

 

Duo

 

 


Attachments
lbccanada | Posts: 4

Reply to: Package Create - Cannot send package without approvals.

0 votes

Hi Duo,

The new document with the tag also gets the same error. 

 

<?php
    error_reporting(1);
    define("API_URL", "https://sandbox.esignlive.com/api/packages");
    define("MULTIPART_BOUNDARY", "----WebKitFormBoundary7MA4YWxkTrZu0gW"); 

    $api_headers = array(
        "Authorization: Basic XXXXXXXXXXXXXXXXXXXXXXXXXXXXXNg==",
        "Accept: application/json; esl-api-version=11.0",
        "Content-Type: multipart/form-data; boundary=\"" . MULTIPART_BOUNDARY . "\"",
    );

    $json = array(
            'type' => 'PACKAGE',
            'status' => 'SENT',
            'roles' => array(
                array(
                    'id' => 'Borrower',
                    'type' => 'SIGNER',
                    'name'=> 'Borrower',
                    'signers' => array(
                        array(
                        'name'=> 'Borrower',
                            'email' => '[email protected]',
                            'firstName' => 'John',
                            'lastName' => 'Smith',
                            'id' => 'Borrower',
                        )
                    ) ,
                ) ,
                array(
                    'id' => 'Lender',
                    'type' => 'SIGNER',
                    'name'=> 'Lender',
                    'signers' => array(
                        array(
                        'name'=> 'Lender',
                            'email' => '[email protected]',
                            'firstName' => 'Mike',
                            'lastName' => 'Smith',
                            'id' => 'Lender',
                        )
                    ) ,
                ) ,
            ) ,
            'name' => 'PHP Application Example',
            'documents' => array(
                        array(
                            'name' => 'SampleTextTags',
                            'id' => 'contract',
                            'extract' => 'true'
                        )
                    )
        );

    $postdata = "--" . MULTIPART_BOUNDARY . "\r\n";
    $postdata .= "Content-Disposition: form-data; name=\"file\"; filename=\"SampleTextTags.pdf\"\r\n\r\n";
    $postdata .= file_get_contents("SampleTextTags.pdf");
    $postdata .= "\r\n\r\n";
    $postdata .= "--" . MULTIPART_BOUNDARY . "\r\n";
    $postdata .= "Content-Disposition: form-data; name=\"payload\"\r\n\r\n";
    $postdata .= json_encode($json);
    $postdata .= "\r\n\r\n";
    $postdata .= "--" . MULTIPART_BOUNDARY . "--\r\n";

    $curl = curl_init(API_URL);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_POST          , true);
    curl_setopt($curl, CURLOPT_POSTFIELDS    , $postdata);
    curl_setopt($curl, CURLOPT_HTTPHEADER    , $api_headers);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
    curl_exec($curl);
    $response = curl_multi_getcontent($curl);
    curl_close($curl);

    echo mb_convert_encoding(print_r(json_decode($response, true), true), 'CP932', 'UTF-8'); 

?>
 


talk2bks | Posts: 34

Reply to: Package Create - Cannot send package without approvals.

0 votes

I found that is you set your status = 'DRAFT', then the documents will upload to the sandbox's draft folder and you can see what's missing without hitting this error. Once you have it all ready, change it back to 'SENT'.


Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off