Я столкнулся с серьезной проблемой, касающейся API DocuSign.
Я хочу подписать документы в моем веб-приложении с использованием встроенной церемонии подписания, но без аутентификации моих пользователей, поскольку большинство пользователей моего приложения не будут иметь любые учетные записи DocuSign с ними.
Итак, дело в том.
Пользователь заходит на мой сайт и делает подпись с помощью DocuSign, и когда я закончу, я сохраню документ на своем сервере и продолжу.
Прямо сейчас я использую github Пример кода для получения документов, подписанных с использованием потока JWT GRant
php пример
Что я делаю:
$this->checkToken();
# create the envelope definition
$signer_name = DSConfig::signer_name();
$signer_email = DSConfig::signer_email();
$demo_docs_path = getcwd() . '/' . self::DEMO_DIR . '/';
$content_bytes = file_get_contents($demo_docs_path . self::DOC_3_PDF);
$doc3_b64 = base64_encode($content_bytes);
# Create the document models
$clientUserId=5;
$document1 = new \DocuSign\eSign\Model\Document([ # create the DocuSign document object
'document_base64' => $doc3_b64,
'name' => 'Test Document', # can be different from actual file name
'file_extension' => 'pdf', # many different document types are accepted
'document_id' => '1', # a label used to reference the doc
'client_user_id' => $clientUserId
]);
# The order in the docs array determines the order in the envelope
//$envelope_definition->setDocuments([$document1]);
# Create the signer recipient model
$signer1 = new \DocuSign\eSign\Model\Signer([
'email' => "mahjoor_samiullah@hotmail.com", 'name' => "Samiullah Mahjoor",
'recipient_id' => "1", 'routing_order' => "1"]);
# routingOrder (lower means earlier) determines the order of deliveries
# to the recipients. Parallel routing order is supported by using the
# same integer as the order for two or more recipients.
# create a cc recipient to receive a copy of the documents
$sign_here1 = new \DocuSign\eSign\Model\SignHere(['document_id' => '1', 'page_number' => '1', 'recipient_id' => '1',
'tab_label' => 'SignHereTab', 'x_position' => '35', 'y_position' => '680']);
# Add the tabs model (including the sign_here tabs) to the signer
# The Tabs object wants arrays of the different field/tab types
$signer1->setTabs(new \DocuSign\eSign\Model\Tabs([
'sign_here_tabs' => [$sign_here1]]));
# Add the recipients to the envelope object
//$recipients = new \DocuSign\eSign\Model\Recipients(['signers' => [$signer1]]);
//$envelope_definition->setRecipients($recipients);
# Request that the envelope be sent by setting |status| to "sent".
# To request that the envelope be created as a draft, set to "created"
//$envelope_definition->setStatus("sent");
$envelopeDefinition = new DocuSign\eSign\Model\EnvelopeDefinition([
'email_subject' => "Please sign this document",
'documents' => [$document1], # The order in the docs array determines the order in the envelope
# The Recipients object wants arrays for each recipient type
'recipients' => new DocuSign\eSign\Model\Recipients(['signers' => [$signer1]]),
'status' => "sent" # requests that the envelope be created and sent.
]);
$envelopeApi = new DocuSign\eSign\Api\EnvelopesApi(self::$apiClient);
$results = $envelopeApi->createEnvelope(self::$accountID, $envelopeDefinition);
$envelopeId = $results['envelope_id'];
$recipientViewRequest = new DocuSign\eSign\Model\RecipientViewRequest([
'authentication_method' => 'None', 'client_user_id' => self::$apiClient,
'recipient_id' => '1', 'return_url' => "http://www.dev.overheadlending.com/app/docusign/main.php",
'user_name' => "Samiullah", 'email' => "mahjoor_samiullah@hotmail.com"
]);
$results = $envelopeApi->createRecipientView(self::$accountID, $envelopeId,
$recipientViewRequest);
return $results;
Затем перенаправляем пользователя with:
header('Location: ' . $result['url']);
В качестве URL-адреса будет использоваться URL-адрес перенаправления для встраивания подписи.
Вот URL-адрес, на котором отображается ошибка:
Вызов неопределенного метода DocuSign \ eSign \ ApiClient :: swaggerTypes () в /home4/b4fgf4xx/dev.overheadlending.com/app/docusign/vendor/docusign/esign-client/src/ObjectSerializer.php:62 трассировки стека: # 0 / home4 /b4fgf4xx/dev.overheadlending.com/app/docusign/vendor/docusign/esign-client/src/ObjectSerializer.php(65): DocuSign \ eSign \ ObjectSerializer :: sanitizeForSerialization (Object (DocuSign \ eSign \ ApiClient))
1 /home4/b4fgf4xx/dev.overheadlending.com/app/docusign/vendor /docusign/esign-client/src/ApiClient.php(159):
DocuSign \ eSign \ ObjectSerializer :: sanitizeForSerialization (Object (DocuSign \ eSign \ Model \ RecipientViewRequest))
2 /home4/b4fgf4xx/dev.overheadlending.com/app/docusign/vendor/docusign/esign-client/src/Api/EnvelopesApi.php(3222):
DocuSign \ eSign \ ApiClient-> callApi ('/ v2 / account / 98 ...', 'POST', Array, Object (DocuSign \ eSign \ Model \ RecipientViewRequest), Array, '\ DocuSign \ eSign ...', '/ v2 / accounts / { a ... ') # 3 /home4/b4fgf4xx/dev.overheadlending.com/app/docusign/vendor/docusign/esign-client/src/Api/Envelo в /home4/b4fgf4xx/dev.overheadlending.com/app/ docusign / vendor / docusign / esign-client / src / ObjectSerializer. php on line 62
, если кто-то может помочь и предоставить мне пример кода для вышеуказанной проблемы.
Спасибо!