Skip to content

Commit

Permalink
Merge pull request #1 from arvinsingla/feature/recipient-types-and-cl…
Browse files Browse the repository at this point in the history
…ient-id

Feature/recipient types and client
  • Loading branch information
arvinsingla committed Apr 7, 2014
2 parents d3d9533 + 710ac6a commit 3b4027c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 9 deletions.
35 changes: 28 additions & 7 deletions src/service/DocuSign_RequestSignatureService.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,15 @@ public function createEnvelopeFromDocument( $emailSubject
if( isset($recipients) && sizeof($recipients) > 0 ) {
$recipientsList = array();
foreach( $recipients as $recipient ) {
array_push($recipientsList, array (
$recipientsList[$recipient->getType()][] = array (
"routingOrder" => $recipient->getRoutingOrder(),
"recipientId" => $recipient->getId(),
"name" => $recipient->getName(),
"email" => $recipient->getEmail()
));
"recipientId" => $recipient->getId(),
"name" => $recipient->getName(),
"email" => $recipient->getEmail(),
"clientUserId" => $recipient->getClientId(),
);
}
$data['recipients'] = array( "signers" => $recipientsList);
$data['recipients'] = $recipientsList;
}
if( isset($eventNotifications) && sizeof($eventNotifications) > 0 ){
$data['eventNotification'] = $eventNotifications->toArray();
Expand Down Expand Up @@ -161,12 +162,28 @@ class DocuSign_Recipient extends DocuSign_Model {
private $id;
private $name;
private $email;
private $clientId;
private $type;

public function __construct($routingOrder, $id, $name, $email) {
public function __construct($routingOrder, $id, $name, $email, $clientId = NULL, $type = 'signers') {
if( isset($routingOrder) ) $this->routingOrder = $routingOrder;
if( isset($id) ) $this->id = $id;
if( isset($name) ) $this->name = $name;
if( isset($email) ) $this->email = $email;
if( isset($type) ) $this->type = $type;
// Ensure that a client id only gets assigned to allowed recipient types.
if (isset($clientId)) {
switch ($type) {
case 'signers':
case 'agents':
case 'intermediaries':
case 'editors':
case 'certifiedDeliveries':
$this->clientId = $clientId;
break;
}
}

}

public function setRoutingOrder($routingOrder) { $this->routingOrder = $routingOrder; }
Expand All @@ -177,6 +194,10 @@ public function setName($name) { $this->name = $name; }
public function getName() { return $this->name; }
public function setEmail($email) { $this->email = $email; }
public function getEmail() { return $this->email; }
public function setClientId($clientId) { $this->clientId = $clientId; }
public function getClientId() { return $this->clientId; }
public function setType($type) { $this->type = $type; }
public function getType() { return $this->type; }
}


Expand Down
5 changes: 3 additions & 2 deletions src/service/DocuSign_ViewsService.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,14 @@ public function getSenderView($returnUrl, $envelopeId) {
}


public function getRecipientView($returnUrl, $envelopeId, $userName, $email) {
public function getRecipientView($returnUrl, $envelopeId, $userName, $email, $clientUserId = NULL) {
$url = $this->client->getBaseURL() . '/envelopes/' . $envelopeId . '/views/recipient';
$data = array (
'returnUrl' => $returnUrl,
'authenticationMethod' => 'email',
'userName' => $userName,
'email' => $email
'email' => $email,
'clientUserId' => $clientUserId,
);
return $this->curl->makeRequest($url, 'POST', $this->client->getHeaders(), array(), json_encode($data));
}
Expand Down

0 comments on commit 3b4027c

Please sign in to comment.