Ejemplo n.º 1
0
function getClientCallbackURLS()
{
    $ClientURLS = new RequestRecipientTokenClientURLs();
    $ClientURLs->OnViewingComplete = getCallbackURL("pop.html?id=2");
    $ClientURLs->OnCancel = getCallbackURL("pop.html?id=3");
    $ClientURLs->OnDecline = getCallbackURL("pop.html?id=4");
    $ClientURLs->OnSessionTimeout = getCallbackURL("pop.html?id=5");
    $ClientURLs->OnTTLExpired = getCallbackURL("pop.html?id=6");
    $ClientURLs->OnException = getCallbackURL("pop.html?id=7");
    $ClientURLs->OnAccessCodeFailed = getCallbackURL("pop.html?id=8");
    $ClientURLs->OnSigningComplete = getCallbackURL("pop.html?id=9");
    $ClientURLs->OnIdCheckFailed = getCallbackURL("pop.html?id=1");
    return $ClientURLs;
}
function makeRequestRecipientToken($Recipient)
{
    $RequestRecipientTokenparam = new RequestRecipientToken();
    $RequestRecipientTokenparam->EnvelopeID = $_SESSION["EnvelopeID"];
    $RequestRecipientTokenparam->ClientUserID = "1";
    $RequestRecipientTokenparam->Username = $Recipient->UserName;
    $RequestRecipientTokenparam->Email = $Recipient->Email;
    $RequestRecipientTokenparam->AuthenticationAssertion->AssertionID = time();
    $m = date("m");
    $d = date("Y") . "-" . $m . "-" . date("d") . "T00:00:00.00";
    $RequestRecipientTokenparam->AuthenticationAssertion->AuthenticationInstant = $d;
    $RequestRecipientTokenparam->AuthenticationAssertion->AuthenticationMethod = "Password";
    $RequestRecipientTokenparam->AuthenticationAssertion->SecurityDomain = $_SERVER['HTTP_HOST'];
    $RequestRecipientTokenparam->ClientURLs->OnViewingComplete = getCallbackURL("pop.html") . "?id=2";
    $RequestRecipientTokenparam->ClientURLs->OnCancel = getCallbackURL("pop.html") . "?id=3";
    $RequestRecipientTokenparam->ClientURLs->OnDecline = getCallbackURL("pop.html") . "?id=4";
    $RequestRecipientTokenparam->ClientURLs->OnSessionTimeout = getCallbackURL("pop.html") . "?id=5";
    $RequestRecipientTokenparam->ClientURLs->OnTTLExpired = getCallbackURL("pop.html") . "?id=6";
    $RequestRecipientTokenparam->ClientURLs->OnException = getCallbackURL("pop.html") . "?id=7";
    $RequestRecipientTokenparam->ClientURLs->OnAccessCodeFailed = getCallbackURL("pop.html") . "?id=8";
    $RequestRecipientTokenparam->ClientURLs->OnSigningComplete = getCallbackURL("pop.html") . "?id=9";
    $RequestRecipientTokenparam->ClientURLs->OnIdCheckFailed = getCallbackURL("pop.html") . "?id=1";
    return $RequestRecipientTokenparam;
}
Ejemplo n.º 3
0
function embedSending($templateReferences, $envelopeInfo, $recipients)
{
    $api = getAPI();
    $ceParams = new CreateEnvelopeFromTemplates();
    $ceParams->EnvelopeInformation = $envelopeInfo;
    $ceParams->Recipients = $recipients;
    $ceParams->TemplateReferences = $templateReferences;
    $ceParams->ActivateEnvelope = false;
    try {
        $status = $api->CreateEnvelopeFromTemplates($ceParams)->CreateEnvelopeFromTemplatesResult;
        if ($status->Status == EnvelopeStatusCode::Created) {
            $rstParam = new RequestSenderToken();
            $rstParam->AccountID = $envelopeInfo->AccountId;
            $rstParam->EnvelopeID = $status->EnvelopeID;
            $rstParam->ReturnURL = getCallbackURL("getstatusanddocs.php");
            addEnvelopeID($status->EnvelopeID);
            $_SESSION["embedToken"] = $api->RequestSenderToken($rstParam)->RequestSenderTokenResult;
            header("Location: embedsending.php?envelopid=" . $status->EnvelopeID . "&accountID=" . $envelope->AccountId . "&source=Document");
        }
    } catch (SoapFault $e) {
        $_SESSION["errorMessage"] = $e;
        header("Location: error.php");
    }
}
Ejemplo n.º 4
0
function embedSending($envelope)
{
    $api = getAPI();
    $ceParams = new CreateEnvelope();
    $ceParams->Envelope = $envelope;
    try {
        $status = $api->CreateEnvelope($ceParams)->CreateEnvelopeResult;
        if ($status->Status == EnvelopeStatusCode::Created) {
            $rstParam = new RequestSenderToken();
            $rstParam->AccountID = $envelope->AccountId;
            $rstParam->EnvelopeID = $status->EnvelopeID;
            $rstParam->ReturnURL = getCallbackURL("getstatusanddocs.php");
            addEnvelopeID($status->EnvelopeID);
            $_SESSION["embedToken"] = $api->RequestSenderToken($rstParam)->RequestSenderTokenResult;
            header("Location: embedsending.php?envelopid=" . $status->EnvelopeID . "&accountID=" . $envelope->AccountId . "&source=Document");
        }
    } catch (SoapFault $e) {
        $_SESSION["errorMessage"] = $e;
        header("Location: error.php");
    }
}
Ejemplo n.º 5
0
function getToken($status, $clientID)
{
    global $_oneSigner;
    $token = null;
    $_SESSION["embedToken"];
    // get recipient token
    $assertion = new RequestRecipientTokenAuthenticationAssertion();
    $assertion->AssertionID = guid();
    $assertion->AuthenticationInstant = todayXsdDate();
    $assertion->AuthenticationMethod = RequestRecipientTokenAuthenticationAssertionAuthenticationMethod::Password;
    $assertion->SecurityDomain = "DocuSign2011Q1Sample";
    // Get Recipient fro ClientID
    $recipient = false;
    foreach ($status->RecipientStatuses->RecipientStatus as $rs) {
        if ($rs->ClientUserId == $clientID) {
            $recipient = $rs;
        }
    }
    if ($recipient == false) {
        $_SESSION["errorMessage"] = "Unable to find Recipient";
        header("Location: error.php");
    }
    $urls = new RequestRecipientTokenClientURLs();
    $urlbase = getCallbackURL("pop.html") . "?source=Embedded";
    $urls->OnAccessCodeFailed = $urlbase . "&event=AccessCodeFailed&uname=" . $recipient->UserName;
    $urls->OnCancel = $urlbase . "&event=Cancel&uname=" . $recipient->UserName;
    $urls->OnDecline = $urlbase . "&event=Decline&uname=" . $recipient->UserName;
    $urls->OnException = $urlbase . "&event=Exception&uname=" . $recipient->UserName;
    $urls->OnFaxPending = $urlbase . "&event=FaxPending&uname=" . $recipient->UserName;
    $urls->OnIdCheckFailed = $urlbase . "&event=IdCheckFailed&uname=" . $recipient->UserName;
    $urls->OnSessionTimeout = $urlbase . "&event=SessionTimeout&uname=" . $recipient->UserName;
    $urls->OnTTLExpired = $urlbase . "&event=TTLExpired&uname=" . $recipient->UserName;
    $urls->OnViewingComplete = $urlbase . "&event=ViewingComplete&uname=" . $recipient->UserName;
    if ($_oneSigner) {
        $urls->OnSigningComplete = $urlbase . "&event=SigningComplete&uname=" . $recipient->UserName;
    } else {
        $urls->OnSigningComplete = getCallbackURL("pop2.html") . "?envelopeID=" . $status->EnvelopeID;
    }
    $api = getAPI();
    $rrtParams = new RequestRecipientToken();
    $rrtParams->AuthenticationAssertion = $assertion;
    $rrtParams->ClientURLs = $urls;
    $rrtParams->ClientUserID = $recipient->ClientUserId;
    $rrtParams->Email = $recipient->Email;
    $rrtParams->EnvelopeID = $status->EnvelopeID;
    $rrtParams->Username = $recipient->UserName;
    try {
        $token = $api->RequestRecipientToken($rrtParams)->RequestRecipientTokenResult;
    } catch (SoapFault $e) {
        $_SESSION["errorMessage"] = $e;
        header("Location: error.php");
    }
    $_SESSION["embedToken"] = $token;
}