package status change to SENT issue
Tuesday, August 21, 2018 at 10:17amHello,
I am trying to fill PDF form and upload and then change status to SENT to publish it. But Status SENT is not working. I am facing issue with that. It give error "The requested URL returned error: 400 Bad Request".
I am able to fill PDF form and create a package with a draft in the account. below is my code.
//Create package
public function buildPackage($application_id)
{
$build = array(
'type' => 'PACKAGE',
'status' => 'DRAFT',
'roles' => array(
array(
'id' => 'Signer1',
'type' => 'SIGNER',
'signers' => array(
array(
'email' => '[email protected]',
'firstName' => 'NEXTZ',
'lastName' => 'Software',
'id' => 'Signer1',
)
) ,
) ,
array(
'id' => 'Sender1',
'type' => 'SIGNER',
'signers' => array(
array(
'email' => '[email protected]',
'firstName' => 'Rohit',
'lastName' => 'patil',
'id' => 'Sender1',
)
) ,
) ,
) ,
'name' => 'Application Form',
);
$packageJSON = json_encode($build);
$packageId = json_decode($this->sendRequest($this->packageAppend, $packageJSON, NULL, NULL), true);
return $packageId;
}
//Upload document
public function buildDocument($packageId,$application_id)
{
$application = Application::find($application_id);
$build = array(
'fields' => array(
array(
'value' => $application->entity_name,
'name' => 'customer_name',
) ,
array(
'value' => $application->address,
'name' => 'customer_address',
) ,
array(
'value' => $application->abn_number,
'name' => 'abn_number',
)
) ,
'extract' => true,
'name' => 'Application Form',
'id' => 'contract'
);
$documentJSON = json_encode($build);
$postdata = "--" . $this->MULTIPART_BOUNDARY . "\r\n";
$postdata .= "Content-Disposition: form-data; name=\"file\"; filename=\"application_pdf_form.pdf\"\r\n";
$postdata .= "Content-Type: application/pdf" . "\r\n\r\n";
$postdata .= file_get_contents(asset('upload\application_pdf_form.pdf'));
$postdata .= "\r\n\r\n";
$postdata .= "--" . $this->MULTIPART_BOUNDARY . "\r\n";
$postdata .= "Content-Disposition: form-data; name=\"payload\"\r\n\r\n";
$postdata .= $documentJSON;
$postdata .= "\r\n\r\n";
$postdata .= "--" . $this->MULTIPART_BOUNDARY . "--\r\n";
$status = $this->sendRequest($this->packageAppend . $packageId . '/documents', $documentJSON, $postdata, 'multipart/form-data; boundary=' . $this->MULTIPART_BOUNDARY);
return $status;
}
//Send Package
public function buildSend($packageId)
{
$build = array(
'status' => 'SENT'
);
$sendJSON = json_encode($build);
$this->sendRequest($this->packageAppend . $packageId, $sendJSON, NULL, 'application/json');
return NULL;
}
Reply to: package status change to SENT issue
Tuesday, August 21, 2018 at 12:19pm[Signer1.Fullname1]Hope this could help you! DuoReply to: package status change to SENT issue
Tuesday, August 21, 2018 at 11:04am//create package $packageId = $package->buildPackage($application->id); //create document $package->buildDocument($packageId['id'],$application->id); //send the package $package->buildSend($packageId['id']); //create for sign $package->buildSign($packageId['id']); //create token for sign session $token = $package->buildToken($packageId['id'], $placeholderId);1. first creating draft package. 2. then uploading PDF with filling it. 3. then trying to make status SENT which gives error.Reply to: package status change to SENT issue
Wednesday, August 22, 2018 at 04:29am