Exemplo n.º 1
0
/**
 * Creates an embedded signing experience.
 */
function createAndSend()
{
    global $_oneSigner;
    $status = "";
    // Construct basic envelope
    $env = new Envelope();
    $env->Subject = "DocuSign API SDK Sample";
    $env->EmailBlurb = "This envelope demonstrates embedded signing";
    $env->AccountId = $_SESSION["AccountID"];
    $env->Recipients = constructRecipients($_oneSigner);
    $doc = new Document();
    $doc->PDFBytes = file_get_contents("resources/Docusign_Demo_11.pdf");
    $doc->Name = "Demo Document";
    $doc->ID = "1";
    $doc->FileExtension = "pdf";
    $env->Documents = array($doc);
    $env->Tabs = addTabs(count($env->Recipients));
    $api = getAPI();
    try {
        $csParams = new CreateAndSendEnvelope();
        $csParams->Envelope = $env;
        $status = $api->CreateAndSendEnvelope($csParams)->CreateAndSendEnvelopeResult;
        addEnvelopeID($status->EnvelopeID);
        getToken($status, 1);
    } catch (SoapFault $e) {
        $_SESSION["errorMessage"] = $e;
        header("Location: error.php");
    }
}
Exemplo n.º 2
0
function buildEnvelope()
{
    $envelope = new Envelope();
    if (isset($_POST["subject"])) {
        $envelope->Subject = $_POST["subject"];
    } else {
        $_SESSION["errorMessage"] = "You must have a subject";
        header("Location: error.php");
    }
    if ($_POST["emailBlurb"]) {
        $envelope->EmailBlurb = $_POST["emailBlurb"];
    } else {
        $_SESSION["errorMessage"] = "You must have an email blurb";
        header("Location: error.php");
    }
    $envelope->AccountId = $_SESSION["AccountID"];
    $envelope->Recipients = constructRecipients();
    $envelope->Tabs = addTabs(count($envelope->Recipients));
    $envelope = processOptions($envelope);
    $envelope->Documents = getDocuments();
    return $envelope;
}