Last active
February 22, 2018 20:39
-
-
Save JackHowa/0a74bb27512968f8267ae6765c9b9ac1 to your computer and use it in GitHub Desktop.
basic implementation with questions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* questions | |
find file status? better way than checking whether there's a document signed? | |
// best way to identify loans? can do file id and document id. but what about multiple documents? find all the documents that are signed for an individual unit? | |
-is there an id? | |
relevant info | |
Add a basic implementation of sertifi get link, create signature and get status based on file id | |
Add a basic template outline for the show page of sertifi | |
note: routes don't currently take in relevant info. and there's no front-end. but I think this satisfies the given request of getting a sertifi loan status and investigating the api. | |
*/ | |
// AppBundle\Controller\SertifiController.php | |
<?php | |
namespace RLD\AppBundle\Controller; | |
use Symfony\Bundle\FrameworkBundle\Controller\Controller; | |
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; | |
use Symfony\Component\HttpFoundation\JsonResponse; | |
use Symfony\Component\HttpFoundation\Request; | |
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; | |
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; | |
/** | |
* Class SertifiController | |
* @Route("/sertifi") | |
* | |
* @package RLD\AppBundle\Controller | |
*/ | |
class SertifiController extends Controller { | |
/** | |
* this is the get for the page of the status | |
* @Template("@RLDApp/Sertifi/show.html.twig") | |
* @Route("/new") | |
*/ | |
public function newAction() { | |
$wsdl = "https://sandbox.sertifi.net/realnets/Services/Gateway.asmx?WSDL"; | |
$params = array('pstr_APICode' => "", | |
'pstr_SenderEmail' => "[email protected]", | |
'pstr_SenderName' => "Test User", | |
'pstr_FileName' => "Licensing Agreement", | |
'pstr_Signers' => "[email protected]", | |
'pstr_SecondSigners' => "", | |
'pstr_CCs' => "", | |
'pstr_Cosign' => "false", | |
'pstr_SignType' => "both", | |
'pstr_Password' => "", | |
'pstr_Field1' => "", | |
'pstr_Field2' => "", | |
'pstr_Field3' => "", | |
'pstr_Field4' => "", | |
'pstr_EmailMessage' => "hey" | |
); | |
$client = new \SoapClient($wsdl); | |
try { | |
$response = $client->CreateSignatureRequest($params); | |
} catch (Exception $e) { | |
} | |
// Display the result | |
print_r($response); | |
exit; | |
} | |
/** | |
* this is the get for the page of the status | |
* @Template("@RLDApp/Sertifi/show.html.twig") | |
* @Route("/show/{fileId}") | |
*/ | |
public function showAction($fileId) { | |
// via certificate in sertifi | |
$fileId = '.AQCTPsyy15-vnEIzgzHIJXgK0'; | |
$wsdl = "https://sandbox.sertifi.net/realnets/Services/Gateway.asmx?WSDL"; | |
$client = new \SoapClient($wsdl); | |
$apiCode = ""; | |
// via certificate as well but need a doc | |
$documentId = '.AQDLN4U4RSmgL8dIEgFGvTEd0'; | |
// GetLink method call | |
$array_of_link_params = array('LinkParameter' => array('FileId' => $fileId, | |
'DocumentId' => $documentId, | |
'LinkType' => "SigningPageLink", | |
'SignerEmail' => "[email protected]" | |
) | |
); | |
$get_link_parameters = array('p_APICode' => $apiCode, 'parameters' => $array_of_link_params); | |
$iframe_link = $client->GetLink($get_link_parameters); | |
echo "<br/> Link: " . $iframe_link->GetLinkResult->UrlQueryResult->Link . "<br/>"; // debugging info | |
} | |
/** | |
* this is the get for the page of the status | |
* @Template("@RLDApp/Sertifi/show.html.twig") | |
* @Route("/download/{fileId}") | |
*/ | |
public function downloadAction($fileId) { | |
// via certificate in sertifi | |
$fileId = '.AQCTPsyy15-vnEIzgzHIJXgK0'; | |
$wsdl = "https://sandbox.sertifi.net/realnets/Services/Gateway.asmx?WSDL"; | |
$client = new \SoapClient($wsdl); | |
$apiCode = ""; | |
// via certificate as well but need a doc | |
$documentId = '.AQDLN4U4RSmgL8dIEgFGvTEd0'; | |
$download_params = array('pstr_APICode' => $apiCode, | |
'pstr_FileID' => $fileId, | |
'pstr_DocumentID' => $documentId, | |
'includeDocumentDatabaseXML' => false | |
); | |
// if the file is not empty then it's signed | |
// if the file is empty it's either not signed or wrong file id | |
// https://corp.sertifi.com/misc/apidocs/Sertifi%20API_ws~r-GetFileStatus~o-Method.html | |
// $file = $client->DownloadSignedDocument($download_params); | |
$file = $client->GetFileStatus($download_params); | |
dump($file); | |
die; | |
} | |
// via https://bitbucket.org/sertifi/samples/src/5ad50e8da1cfc0fdb4d43636cd620a7c1c0a1dd8/GatewayAPI/PHP/GettingStarted/Sertifi%20php%20Example.php?at=default&fileviewer=file-view-default | |
} | |
-> | |
<?xml version="1.0" encoding="utf-16"?>\n | |
<File>\n | |
<Code>.AQCTPsyy15-vnEIzgzHIJXgK0</Code>\n | |
<Name>file.pdf</Name>\n | |
<Status>1</Status>\n | |
<Signer>\n | |
<Email>[email protected]</Email>\n | |
<Signed>1</Signed>\n | |
<Open>0</Open>\n | |
<SignerType>1</SignerType>\n | |
<DateInvited>1/1/0001 12:00:00 AM</DateInvited>\n | |
<DateLastVisit>02/20/2018 5:18:53PM</DateLastVisit>\n | |
</Signer>\n | |
<Document>\n | |
<DocumentID>.AQDLN4U4RSmgL8dIEgFGvTEd0</DocumentID>\n | |
<Name>fake list of fields - Sheet1</Name>\n | |
<Status>Signed</Status>\n | |
<DateCreated>2/16/2018 4:25:10 PM</DateCreated>\n | |
<DateSigned>2/20/2018 5:19:52 PM</DateSigned>\n | |
<Signatures>\n | |
<Email>[email protected]</Email>\n | |
<NameSigned>jack</NameSigned>\n | |
<IpAddress>50.193.73.185</IpAddress>\n | |
<SignMethod>Electronic</SignMethod>\n | |
<DateSigned>2/20/2018 5:18:52 PM</DateSigned>\n | |
<SignerType>1</SignerType>\n | |
</Signatures>\n | |
</Document>\n | |
</File> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment