EnvelopeID在更正后更改了吗?

时间:2015-12-10 12:41:20

标签: soap docusignapi

我有2个签名文件,第一个签名者已签名。该文件仍在进行中。所以我去纠正了第二个签名者。我意识到修正后信封ID发生了变化。

旧信封会怎样?空隙?

function getDocuments($pdfbytes) {
    $documents = array();
    $id = 1;


        $d = new Document();
        $d->PDFBytes = $pdfbytes;
        $d->Name = "Demo Document";
        $d->ID = $id++;;
        $d->FileExtension = "pdf";
        array_push($documents, $d);


    return $documents;
}

function buildEnvelope($pdfbytes) {
    $envelope = new Envelope();
    $envelope->Subject = $_SESSION["Taskmaster"];
    $envelope->EmailBlurb = "Please Sign by logining ";

    $envelope->AccountId = $_SESSION["AccountID"];
    $envelope->Recipients = constructRecipients();
    $envelope->Tabs = addTabs(count($envelope->Recipients));
    $envelope = processOptions($envelope);
    $envelope->Documents = getDocuments($pdfbytes);
    return $envelope;
}

function constructRecipients() {
    $recipients = array();



        $r = new Recipient();

        $r->UserName =$_SESSION["Secretaryname"];
        $r->Email =  $_SESSION["Secretaryemail"];
        $r->RequireIDLookup = false;


        $r->ID = 1;
        $r->Type = RecipientTypeCode::Signer;
        $r->RoutingOrder = "2";

       // if(!isset($_POST['RecipientInviteToggle'][$i])){
            $r->CaptiveInfo = new RecipientCaptiveInfo();
            $r->CaptiveInfo->ClientUserId = 2;
            $r->CaptiveInfo->embeddedRecipientStartURL=SIGN_AT_DOCUSIGN;
       // }

        array_push($recipients, $r);


    if(empty($recipients)){
        $_SESSION["errorMessage"] = "You must include at least 1 Recipient";
        //header("Location: error.php");
        exit;
    }

    return $recipients;
}

function sendNow($envelope) {
    $api = getAPI();



    $csParams = new CreateAndSendEnvelope();
    $csParams->Envelope = $envelope;
    //print_r($csParams);
    try {
        $status = $api->CreateAndSendEnvelope($csParams)->CreateAndSendEnvelopeResult;
        //echo "Result for Create and Send <br>";
        //print_r($status);

        if ($status->Status == EnvelopeStatusCode::Sent) {
            addEnvelopeID($status->EnvelopeID);
            $correct = new Correction;

    $correct->EnvelopeID = $status->EnvelopeID;
    $correct->RecipientCorrections = addRecipientCorrection();
    $correctparams = new CorrectAndResendEnvelope();
    $correctparams->Correction  = $correct;

    //print_r($correctparams);
   //Send
   $response = $api->CorrectAndResendEnvelope($correctparams);
   //print_r($response);
//exit;
$_SESSION["EnvelopeID"]=null;
$_SESSION["Direct"]="Yes";
            header("Location: getstatusanddocs.php?envelopid=" . $status->EnvelopeID . 
                "&accountID=" . $envelope->AccountId . "&source=Document");
        }
    } catch (SoapFault $e) {
      $_SESSION["errorMessage"] = $e;
      header("Location: error.php");
    }
}

function addRecipientCorrection(){
$correction = new RecipientCorrection();

$correction->PreviousUserName = "xxxxxx";
$correction->PreviousEmail = "xxxxxxx";
$correction->PreviousSignerName = $correction->PreviousUserName;
$correction->PreviousRoutingOrder = "2";
$correction->CorrectedUserName = $_SESSION["Secretaryname"];
$correction->CorrectedEmail    = $_SESSION["Secretaryemail"];
$correction->CorrectedSignerName = $correction->CorrectedUserName;

return $correction;
}

//========================================================================
// Main
//========================================================================
loginCheck();

if($_SESSION["Taskmaster"]=="xxxxx"){
$api = getAPI();
$RequestPDFParam = new RequestPDF();
$RequestPDFParam->EnvelopeID = $_SESSION["EnvelopeID"];
$result = $api->RequestPDF($RequestPDFParam);
$envPDF = $result->RequestPDFResult;
//file_put_contents("./Cert/".$_SESSION["EnvelopeID"].".pdf", $envPDF->PDFBytes);
//echo "Stop here";
//exit;


    $envelope = buildEnvelope($envPDF->PDFBytes);

    sendNow($envelope);

}else{
echo "You have no power";
}

1 个答案:

答案 0 :(得分:0)

EnvelopeId在更正后不会更改。信封ID永不更改。可以创建新的信封,但是使用的原始GUID仍将保留在系统中。