Skip to content

Commit

Permalink
Merge pull request #12 from vivait/feature/DOC-19-signable
Browse files Browse the repository at this point in the history
Add support for new Signable routes on DocBuild
  • Loading branch information
leightonthomas authored Jun 26, 2018
2 parents e68c82a + 9f9ff20 commit e1e15b4
Showing 1 changed file with 86 additions and 1 deletion.
87 changes: 86 additions & 1 deletion src/Vivait/DocBuild/DocBuild.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ public function setClientId($clientId)
{
$this->clientId = $clientId;
}

/**
* @param string $source
* @param array $emailAddresses
Expand Down Expand Up @@ -352,4 +352,89 @@ public function adobeSign(
]
);
}

/**
* Request signatures on a Document via Signable.
*
* @param string $source
* @param string $signableKey
* @param string $envelopeTitle
* @param string $documentTitle
* @param array $recipients
* @param null $callback
*
* @return array|mixed|resource|string
*/
public function signable(
$source,
$signableKey,
$envelopeTitle,
$documentTitle,
array $recipients,
$callback = null
) {
foreach ($recipients as $recipient) {
if ( ! array_key_exists('name', $recipient)) {
throw new \InvalidArgumentException("Recipient is missing a name.");
}

if ( ! array_key_exists('email', $recipient)) {
throw new \InvalidArgumentException("Recipient is missing an email.");
}

if ( ! array_key_exists('templateId', $recipient)) {
throw new \InvalidArgumentException("Recipient is missing a templateId.");
}
}

return $this->post(
'signable',
[
'signableKey' => $signableKey,
'recipients' => $recipients,
'envelopeTitle' => $envelopeTitle,
'documentTitle' => $documentTitle,
'callback' => $callback,
'source' => $source,
]
);
}

/**
* Send a reminder about a Document that's out for Signable signatures.
*
* @param string $source
* @param string $signableKey
*
* @return array|mixed|resource|string
*/
public function signableReminder($source, $signableKey)
{
return $this->post(
'signable/remind',
[
'signableKey' => $signableKey,
'source' => $source,
]
);
}

/**
* Cancel a Document that's out for Signable signatures.
*
* @param string $source
* @param string $signableKey
*
* @return array|mixed|resource|string
*/
public function signableCancel($source, $signableKey)
{
return $this->post(
'signable/cancel',
[
'signableKey' => $signableKey,
'source' => $source,
]
);
}
}

0 comments on commit e1e15b4

Please sign in to comment.