22
33namespace DocuSign \Services \Examples \eSignature ;
44
5- use DocuSign \eSign \Model \ReturnUrlRequest ;
5+ use DocuSign \eSign \Model \EnvelopeViewRecipientSettings ;
6+ use DocuSign \eSign \Model \EnvelopeViewDocumentSettings ;
7+ use DocuSign \eSign \Model \EnvelopeViewTaggerSettings ;
8+ use DocuSign \eSign \Model \EnvelopeViewTemplateSettings ;
9+ use DocuSign \eSign \Model \EnvelopeViewRequest ;
10+ use DocuSign \eSign \Model \EnvelopeViewSettings ;
611
712class EmbeddedSendingService
813{
@@ -30,7 +35,7 @@ public static function embeddedSending(array $args, $clientService, $demoDocsPat
3035
3136 # Create sender view
3237 #ds-snippet-start:eSign11Step3
33- $ view_request = new ReturnUrlRequest ([ ' return_url ' => $ args ['ds_return_url ' ] ]);
38+ $ view_request = EmbeddedSendingService:: prepareViewRequest ( $ args [ ' starting_view ' ], $ args ['ds_return_url ' ]);
3439 $ envelope_api = $ clientService ->getEnvelopeApi ();
3540 $ senderView = $ envelope_api ->createSenderView ($ args ['account_id ' ], $ envelope_id , $ view_request );
3641
@@ -43,4 +48,41 @@ public static function embeddedSending(array $args, $clientService, $demoDocsPat
4348 return ['envelope_id ' => $ envelope_id , 'redirect_url ' => $ url ];
4449 #ds-snippet-end:eSign11Step3
4550 }
51+
52+ private static function prepareViewRequest (string $ startingView , string $ returnUrl ): EnvelopeViewRequest
53+ {
54+ $ viewSettings = new EnvelopeViewSettings ([
55+ 'starting_screen ' => $ startingView ,
56+ 'send_button_action ' => 'send ' ,
57+ 'show_back_button ' => 'false ' ,
58+ 'back_button_action ' => 'previousPage ' ,
59+ 'show_header_actions ' => 'false ' ,
60+ 'show_discard_action ' => 'false ' ,
61+ 'lock_token ' => '' ,
62+ 'recipient_settings ' => new EnvelopeViewRecipientSettings ([
63+ 'show_edit_recipients ' => 'false ' ,
64+ 'show_contacts_list ' => 'false '
65+ ]),
66+ 'document_settings ' => new EnvelopeViewDocumentSettings ([
67+ 'show_edit_documents ' => 'false ' ,
68+ 'show_edit_document_visibility ' => 'false ' ,
69+ 'show_edit_pages ' => 'false ' ,
70+ ]),
71+ 'tagger_settings ' => new EnvelopeViewTaggerSettings ([
72+ 'palette_sections ' => 'default ' ,
73+ 'palette_default ' => 'custom '
74+ ]),
75+ 'template_settings ' => new EnvelopeViewTemplateSettings ([
76+ 'show_matching_templates_prompt ' => 'true '
77+ ])
78+ ]);
79+
80+ $ viewRequest = new EnvelopeViewRequest ([
81+ 'return_url ' => $ returnUrl ,
82+ 'view_access ' => 'envelope ' ,
83+ 'settings ' => $ viewSettings
84+ ]);
85+
86+ return $ viewRequest ;
87+ }
4688}
0 commit comments