Comments (2)
// Envelope ID {$envelope_id}." // ); // } } else { $this->clientService->needToReAuth($this->eg); } } /** * Do the work of the example * 1. Create the envelope request object * 2. Send the envelope * * @param $args array * @return string * @throws ApiException for API problems and perhaps file access \Exception, too */ public function worker($args): array { // echo '
'; # Step 3 Start # Update resend envelope parameter //return $envelope_id; try { $env = new EnvelopeDefinition([ 'workflow' => new Workflow(['workflow_status' => 'in_progress'] ), //'status' => "sent" ]); $envelope_api = $this->clientService->getEnvelopeApi(); $envelope_option = new UpdateOptions(); $envelope_option -> setAdvancedUpdate('true'); // $envelope_option -> setResendEnvelope('true'); # Step 3 End # Step 4 Start # Call Envelopes::update API method to unpause signature workflow // $env->setStatus("sent"); $signer1 = new Signer([ # The signer1 'email' => 'xxxxx', 'name' => 'xxx', 'recipient_id' => "1", 'routing_order' => "1", 'role_name' => 'signer1', 'client_user_id' => 'xxxxxx' ]); $signer2 = new Signer([ # The signer2 'email' => 'xxx', 'name' => 'xxx', 'recipient_id' => "2", 'routing_order' => "2", 'role_name' => 'signer2', 'client_user_id' => 'xxxxx' ]); $sign_here1 = new SignHere([ 'document_id' => "1", 'page_number' => "1", 'tab_label' => "Sign Here", 'x_position' => "200", 'y_position' => "200", ]); $sign_here2 = new SignHere([ 'document_id' => "1", 'page_number' => "1", 'tab_label' => "Sign Here", 'x_position' => "300", 'y_position' => "200", ]); # Add the tabs model (including the sign_here tabs) to the signer # The Tabs object takes arrays of the different field/tab types $signer1->setTabs( new Tabs([ 'sign_here_tabs' => [$sign_here1, ], ]) ); $signer2->setTabs( new Tabs([ 'sign_here_tabs' => [$sign_here2, ], ]) ); $recipients = new Recipients([ 'signers' => [$signer1, $signer2, ], ]) ; $env->setRecipients($recipients); // $env->setTemplateRoles([$signer1, $signer2]); $authentication_method = 'None'; $recipient_view_request = $this->clientService->getRecipientViewRequest( $authentication_method, $args['receipent_arguments']); $envelope = $envelope_api->update( $args['account_id'], $args['pause_envelope_id'], $envelope=$env, $options=$envelope_option ); $envelope_id = $envelope['envelope_id']; // $results = $this->clientService->getRecipientView($args['account_id'], $envelope_id, // $recipient_view_request); // return ['envelope_id' => $envelope_id,'ServiceStatus' =>'Success', 'redirect_url' => $results['url']]; # 4. Obtain the recipient_view_url for the embedded signing # Exceptions will be caught by the calling function // $results = $this->clientService->getRecipientView($args['account_id'], $envelope_id, $recipient_view_request); $results = $this->clientService->getRecipientView($args['account_id'], $envelope_id, $recipient_view_request); return ['envelope_id' => $envelope_id, 'redirect_url' => $results['url']]; } catch (ApiException $e) { $this->clientService->showErrorTemplate($e); exit; } // $results = $envelope_api->createRecipientView($args['account_id'], $envelope_id, // $recipient_view_request); // return ['envelope_id' => $envelope_id,'ServiceStatus' =>'Success', 'redirect_url' => $results['url']]; # 4. Obtain the recipient_view_url for the embedded signing # Exceptions will be caught by the calling function // $results = $this->clientService->getRecipientView($args['account_id'], $envelope_id, $recipient_view_request); // return ['envelope_id' => $envelope_id, 'redirect_url' => $results['url']]; // } catch (ApiException $e) { // $this->clientService->showErrorTemplate($e); // exit; // } } /** * Get specific template arguments * * @return array */ private function getTemplateArgs(): array { $signer2_name = preg_replace('/([^\w \-\@\.\,])+/', '', $_SESSION['signer2_name']); $signer2_email = preg_replace('/([^\w \-\@\.\,])+/', '', $_SESSION['signer2_email']); $receipent_arguments =[ 'signer_email' => 'xxxxxx', 'signer_name' => 'xxxx', 'signer_client_id' =>'xxxxx', 'ds_return_url' => $GLOBALS['app_url'] . 'index.php?page=ds_return', 'recipient_id' => '2', 'routing_order' => '2', 'role_name' => 'signer2', ]; $args = [ 'account_id' => $_SESSION['ds_account_id'], 'base_path' => $_SESSION['ds_base_path'], 'ds_access_token' => $_SESSION['ds_access_token'], 'pause_envelope_id' => 'xxxx', 'receipent_arguments' => $receipent_arguments, ]; return $args; } }
from code-examples-php.
args = $this->getTemplateArgs(); $this->clientService = new SignatureClientService($this->args); $this->routerService = new RouterService(); parent::controller($this->eg, $this->routerService, basename(FILE)); } /** * 1. Check the token * 2. Call the worker method * * @return void * @throws ApiException for API problems and perhaps file access \Exception, too / public function createController(): void { $minimum_buffer_min = 3; if ($this->routerService->ds_token_ok($minimum_buffer_min)) { # 1. Call the worker method # More data validation would be a good idea here # Strip anything other than characters listed // $envelope_id = $this->worker($this->args); $results = $this->worker($this->args); if ($results) { $_SESSION['pause_envelope_id'] = false; # Redirect the user to the embedded signing # Don't use an iFrame! # State can be stored/recovered using the framework's session or a # query parameter on the returnUrl (see the make recipient_view_request method) header('Location: ' . $results["redirect_url"]); exit; } // if ($envelope_id) { // $_SESSION['pause_envelope_id'] = false; // $this->clientService->showDoneTemplate( // "Envelope unpaused", // "Envelope unpaused", // "The envelope workflow has been resumed and the envelope // has been sent to a second recipient!
// Envelope ID {$envelope_id}." // ); // } } else { $this->clientService->needToReAuth($this->eg); } } /* * Do the work of the example * 1. Create the envelope request object * 2. Send the envelope * * @param $args array * @return string * @throws ApiException for API problems and perhaps file access \Exception, too */ public function worker($args): array { // echo '';
# Step 3 Start # Update resend envelope parameter //return $envelope_id; try { $env = new EnvelopeDefinition([ 'workflow' => new Workflow(['workflow_status' => 'in_progress'] ), //'status' => "sent" ]); $envelope_api = $this->clientService->getEnvelopeApi(); $envelope_option = new UpdateOptions(); $envelope_option -> setAdvancedUpdate('true'); // $envelope_option -> setResendEnvelope('true'); # Step 3 End # Step 4 Start # Call Envelopes::update API method to unpause signature workflow // $env->setStatus("sent"); $signer1 = new Signer([ # The signer1 'email' => 'xxxxx', 'name' => 'xxx', 'recipient_id' => "1", 'routing_order' => "1", 'role_name' => 'signer1', 'client_user_id' => 'xxxxxx' ]); $signer2 = new Signer([ # The signer2 'email' => 'xxx', 'name' => 'xxx', 'recipient_id' => "2", 'routing_order' => "2", 'role_name' => 'signer2', 'client_user_id' => 'xxxxx' ]); $sign_here1 = new SignHere([ 'document_id' => "1", 'page_number' => "1", 'tab_label' => "Sign Here", 'x_position' => "200", 'y_position' => "200", ]); $sign_here2 = new SignHere([ 'document_id' => "1", 'page_number' => "1", 'tab_label' => "Sign Here", 'x_position' => "300", 'y_position' => "200", ]); # Add the tabs model (including the sign_here tabs) to the signer # The Tabs object takes arrays of the different field/tab types $signer1->setTabs( new Tabs([ 'sign_here_tabs' => [$sign_here1, ], ]) ); $signer2->setTabs( new Tabs([ 'sign_here_tabs' => [$sign_here2, ], ]) ); $recipients = new Recipients([ 'signers' => [$signer1, $signer2, ], ]) ; $env->setRecipients($recipients); // $env->setTemplateRoles([$signer1, $signer2]); $authentication_method = 'None'; $recipient_view_request = $this->clientService->getRecipientViewRequest( $authentication_method, $args['receipent_arguments']); $envelope = $envelope_api->update( $args['account_id'], $args['pause_envelope_id'], $envelope=$env, $options=$envelope_option ); $envelope_id = $envelope['envelope_id']; // $results = $this->clientService->getRecipientView($args['account_id'], $envelope_id, // $recipient_view_request); // return ['envelope_id' => $envelope_id,'ServiceStatus' =>'Success', 'redirect_url' => $results['url']]; # 4. Obtain the recipient_view_url for the embedded signing # Exceptions will be caught by the calling function // $results = $this->clientService->getRecipientView($args['account_id'], $envelope_id, $recipient_view_request); $results = $this->clientService->getRecipientView($args['account_id'], $envelope_id, $recipient_view_request); return ['envelope_id' => $envelope_id, 'redirect_url' => $results['url']]; } catch (ApiException $e) { $this->clientService->showErrorTemplate($e); exit; } // $results = $envelope_api->createRecipientView($args['account_id'], $envelope_id, // $recipient_view_request); // return ['envelope_id' => $envelope_id,'ServiceStatus' =>'Success', 'redirect_url' => $results['url']]; # 4. Obtain the recipient_view_url for the embedded signing # Exceptions will be caught by the calling function // $results = $this->clientService->getRecipientView($args['account_id'], $envelope_id, $recipient_view_request); // return ['envelope_id' => $envelope_id, 'redirect_url' => $results['url']]; // } catch (ApiException $e) { // $this->clientService->showErrorTemplate($e); // exit; // } } /** * Get specific template arguments * * @return array */ private function getTemplateArgs(): array { $signer2_name = preg_replace('/([^\w \-\@\.\,])+/', '', $_SESSION['signer2_name']); $signer2_email = preg_replace('/([^\w \-\@\.\,])+/', '', $_SESSION['signer2_email']); $receipent_arguments =[ 'signer_email' => 'xxxxxx', 'signer_name' => 'xxxx', 'signer_client_id' =>'xxxxx', 'ds_return_url' => $GLOBALS['app_url'] . 'index.php?page=ds_return', 'recipient_id' => '2', 'routing_order' => '2', 'role_name' => 'signer2', ]; $args = [ 'account_id' => $_SESSION['ds_account_id'], 'base_path' => $_SESSION['ds_base_path'], 'ds_access_token' => $_SESSION['ds_access_token'], 'pause_envelope_id' => 'xxxx', 'receipent_arguments' => $receipent_arguments, ]; return $args; }
}
from code-examples-php.
Related Issues (20)
- Need Solution for the Issue :Object reference not set to an instance of an object HOT 2
- Need help regarding customfields in weeb hook HOT 3
- Sending custom field to the envelope and receiving that custom field in the web hook HOT 2
- Webhook url notification HOT 4
- Custom field in webhook api response HOT 2
- Getting recipient signed or not and get the recipient inputs in web hook HOT 2
- finding redirect url expired or not in webhook HOT 2
- 3 Signers with Embedded signing using Docusign HOT 1
- How to migrate from previous eg-01-php-jwt implementation to this repository? HOT 6
- Composer install fails
- part-11 module HOT 1
- Multiple signers in part-11 module with in single document HOT 2
- Email sending to multi signer using docusign php HOT 2
- Sending Email to users not signed in the document HOT 2
- Envelope Creation Error HOT 2
- Download document from the envelope HOT 3
- API Example code should not reference the Quickstart app HOT 3
- Error: Connection refused for URI HOT 7
- Missing dependencies in Dockerfile HOT 1
- QuickStart cannot authenticate with JWT login HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from code-examples-php.