// setup api connection $api_endpoint = "https://demo.docusign.net/api/3.0/api.asmx"; $api_wsdl = "api/APIService.wsdl"; $api_options = array('location' => $api_endpoint, 'trace' => true, 'features' => SOAP_SINGLE_ELEMENT_ARRAYS); $api = new APIService($api_wsdl, $api_options); // set credentials on the api object - if we have an integrator key then we prepend that to the UserID if (isset($IntegratorsKey) && $IntegratorsKey != "") { $api->setCredentials($IntegratorsKey . $_SESSION["UserID"], $_SESSION["Password"]); } else { $api->setCredentials($_SESSION["UserID"], $_SESSION["Password"]); } // main page loop if ($_SERVER["REQUEST_METHOD"] == "POST") { if (isset($_POST["Submit"])) { // setup recipient. This varies depending on whether we have selected Embedded Signing or Embedded Sending $Recipient = makeRecipient(); // set any selected security options on the recipient if (isset($_POST['AuthenticationMethod']) && $_POST["AuthenticationMethod"] == "IDLookup") { $Recipient->RequireIDLookup = true; $Recipient->IDCheckConfigurationName = "ID Check \$"; } if (isset($_POST['accessCode'])) { $Recipient->AccessCode = $_POST["accessCode"]; } if (isset($_POST['AuthenticationMethod']) && $_POST["AuthenticationMethod"] == "Phone") { $Recipient->RequireIDLookup = true; $Recipient->IDCheckConfigurationName = "Phone Auth \$"; $Recipient->PhoneAuthentication->SenderProvidedNumbers->SenderProvidedNumber[0] = $_POST["authPhoneNumber"]; $Recipient->PhoneAuthentication->RecipMayProvideNumber = true; $Recipient->PhoneAuthentication->RecordVoicePrint = true; }
} // Here we'll start building our Envelope object to send to docusign. // build CreateAndSendEnvelope and set basic properties $CreateAndSendEnvelopeParam = new CreateAndSendEnvelope(); $CreateAndSendEnvelopeParam->Envelope->AccountId = $_SESSION["AccountID"]; // EnvelopeIDStamping controls whether the EnvelopeID is printed on the final documents or not $CreateAndSendEnvelopeParam->Envelope->EnvelopeIDStamping = "true"; $CreateAndSendEnvelopeParam->Envelope->Subject = "Loan Application"; $CreateAndSendEnvelopeParam->Envelope->EmailBlurb = "Please sign the Loan application to start the application process."; // add our document. The php soap client will convert the file bytes to base64 encoding automatically when it sends the request $CreateAndSendEnvelopeParam->Envelope->Documents->Document->ID = "1"; $CreateAndSendEnvelopeParam->Envelope->Documents->Document->Name = "Document"; $CreateAndSendEnvelopeParam->Envelope->Documents->Document->PDFBytes = file_get_contents($pdffile); // initialize a Recipient object with typical values and then overwrite as needed $useEmbedded = $_SESSION["SigningLocation"] == "Embedded" ? true : false; $Recipient = makeRecipient($_POST["FirstName"], $_POST["LastName"], $_POST["Email"], $useEmbedded); // security checks - we'll alter the Recipient object based on the security settings if ($_SESSION["Authentication"] == "IDLookup") { if ($_POST["formid"] == "form1") { //only form1 has the address information so we'll prefill it $address2 = isset($_POST["Address2"]) ? $_POST["Address2"] : null; $Recipient = AddIDLookupToRecipient($Recipient, $_POST["Address1"], $address2, $_POST["City"], $_POST["State"], $_POST["ZIP"]); } else { // in this case the address information will be entered during the ID Lookup $Recipient = AddIDLookupToRecipient($Recipient); } } if ($_SESSION["Authentication"] == "Phone") { $Recipient = AddPhoneAuthToRecipient($Recipient, $_POST["Phone"]); } if (isset($_SESSION["AccessCode"]) && strlen($_SESSION["AccessCode"]) > 0) {