Skip to content

Commit

Permalink
Sample DocuSign API App
Browse files Browse the repository at this point in the history
  • Loading branch information
Ergin008 committed Jul 10, 2014
0 parents commit be2ef44
Show file tree
Hide file tree
Showing 144 changed files with 10,772 additions and 0 deletions.
31 changes: 31 additions & 0 deletions Readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
PHP LoanCo Readme
===========================================================================

This project is an example of using the DocuSign webservice client in a web
application. This example demonstrates the following:
- envelope creation / sending
- signing / sending envelopes via DocuSign web interface
- confirmation of sign status
- retrieval of signed PDF

Installation
---------------------------------------------------------------------------

This sample code requires a DocuSign DevCenter account. If you do not
already have a DevCenter account please go to
http://www.docusign.com/devcenter/ and sign up for one. This sample will
not function without a valid DevCenter account.

System requirements for PHP samples:
- PHP Version 5.3+
- mcrypt/2.5.7 libcurl/7.19.4 OpenSSL/0.9.8k zlib/1.2.3

Sample PHP LoanCo solution instructions
---------------------------------------------------------------------------

The IntegratorsKey MUST be set in the api/Credentials.php file for authentication
to succeed. The other values can be entered as part of the online login or in the
Credentials file.

Recursively copy all files to your server and execute the index.php file to
begin.
59 changes: 59 additions & 0 deletions api/APISecurity.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php
require_once("WSASoap.php");
require_once("WSSESoap.php");

private $_username;
private $_password;


public function setCredentials($username, $password)
{
$this->_username = $username;
$this->_password = $password;
}
public $_lastRequest;
function __doRequest($request, $location, $saction, $version, $one_way = 0)
{
include_once 'WSSESoap.php';
include_once 'WSASoap.php';

$dom = new DOMDocument('1.0');
$dom->loadXML($request);
$objWSA = new WSASoap($dom);
$objWSA->addAction($saction);
$objWSA->addTo($location);
$objWSA->addMessageID();
$objWSA->addReplyTo();

$dom = $objWSA->getDoc();

$objWSSE = new WSSESoap($dom);
if (isset($this->_username) && isset($this->_password)) {
$objWSSE->addUserToken($this->_username, $this->_password);

}
/* Sign all headers to include signing the WS-Addressing headers */
$objWSSE->signAllHeaders = TRUE;

$objWSSE->addTimestamp(300);
// if you need to do binary certificate signing you can uncomment this (and provide the path to the cert)
/* create new XMLSec Key using RSA SHA-1 and type is private key */
// $objKey = new XMLSecurityKey(XMLSecurityKey::RSA_SHA1, array('type'=>'private'));

/* load the private key from file - last arg is bool if key in file (TRUE) or is string (FALSE) */
// $objKey->loadKey(PRIVATE_KEY, TRUE);

/* Sign the message - also signs appropraite WS-Security items */
// $objWSSE->signSoapDoc($objKey);

/* Add certificate (BinarySecurityToken) to the message and attach pointer to Signature */
// $token = $objWSSE->addBinaryToken(file_get_contents(CERT_FILE));
// $objWSSE->attachTokentoSig($token);

$request = $objWSSE->saveXML();
$this->_lastRequest = $request;

return parent::__doRequest($request, $location, $saction, $version);
}

?>
Loading

0 comments on commit be2ef44

Please sign in to comment.