44
55use DocuSign \eSign \Api \TemplatesApi ;
66use DocuSign \eSign \Api \TemplatesApi \ListTemplatesOptions ;
7- use DocuSign \eSign \Model \CarbonCopy ;
87use DocuSign \eSign \Model \Checkbox ;
8+ use DocuSign \eSign \Model \DateSigned ;
99use DocuSign \eSign \Model \Document ;
1010use DocuSign \eSign \Model \EnvelopeTemplate ;
11- use DocuSign \eSign \Model \ModelList ;
12- use DocuSign \eSign \Model \Numerical ;
13- use DocuSign \eSign \Model \Radio ;
14- use DocuSign \eSign \Model \RadioGroup ;
1511use DocuSign \eSign \Model \Recipients ;
1612use DocuSign \eSign \Model \Signer ;
1713use DocuSign \eSign \Model \SignHere ;
@@ -108,7 +104,7 @@ public static function getTemplatesByName(
108104 TemplatesApi $ templatesApi ,
109105 string $ templateName ,
110106 string $ accountId
111- ): array
107+ ): mixed
112108 {
113109 $ listTemplateOptions = new ListTemplatesOptions ();
114110 $ listTemplateOptions ->setSearchText ($ templateName );
@@ -186,13 +182,13 @@ public static function makeTemplateRequest(
186182 string $ demoDocsPath
187183 ): EnvelopeTemplate
188184 {
189- $ docName = 'World_Wide_Corp_fields .pdf ' ;
185+ $ docName = 'World_Wide_Corp_Web_Form .pdf ' ;
190186 $ contentBytes = file_get_contents ($ demoDocsPath . $ docName );
191187 $ base64FileContent = base64_encode ($ contentBytes );
192188
193189 $ document = new Document ([
194190 'document_base64 ' => $ base64FileContent ,
195- 'name ' => 'Lorem Ipsum ' ,
191+ 'name ' => 'World_Wide_Web_Form ' ,
196192 'file_extension ' => 'pdf ' ,
197193 'document_id ' => '1 '
198194 ]);
@@ -202,109 +198,69 @@ public static function makeTemplateRequest(
202198 'recipient_id ' => "1 " ,
203199 'routing_order ' => "1 "
204200 ]);
205- $ cc = new CarbonCopy ([
206- 'role_name ' => 'cc ' ,
207- 'recipient_id ' => "2 " ,
208- 'routing_order ' => "2 "
209- ]);
210201 $ signHere = new SignHere ([
211202 'document_id ' => '1 ' ,
212- 'page_number ' => '1 ' ,
213- 'x_position ' => '191 ' ,
214- 'y_position ' => '148 '
203+ 'anchor_string ' => '/SignHere/ ' ,
204+ 'anchor_units ' => 'pixels ' ,
205+ 'anchor_x_offset ' => '20 ' ,
206+ 'anchor_y_offset ' => '10 ' ,
207+ 'tab_label ' => 'Signature '
215208 ]);
216209 $ checkbox = new Checkbox ([
217210 'document_id ' => '1 ' ,
218- 'page_number ' => '1 ' ,
219- 'x_position ' => '75 ' ,
220- 'y_position ' => '417 ' ,
221- 'tab_label ' => 'ckAuthorization '
211+ 'anchor_string ' => '/SMS/ ' ,
212+ 'anchor_units ' => 'pixels ' ,
213+ 'anchor_x_offset ' => '20 ' ,
214+ 'anchor_y_offset ' => '10 ' ,
215+ 'tab_label ' => 'Yes '
222216 ]);
223- $ checkboxTwo = new Checkbox ([
224- 'document_id ' => '1 ' ,
225- 'page_number ' => '1 ' ,
226- 'x_position ' => '75 ' ,
227- 'y_position ' => '447 ' ,
228- 'tab_label ' => 'ckAuthentication '
217+ $ text = new Text ([
218+ 'document_id ' => "1 " ,
219+ 'font_size ' => "FullName " ,
220+ 'anchor_string ' => "/FullName/ " ,
221+ 'anchor_units ' => "pixels " ,
222+ 'anchor_x_offset ' => "20 " ,
223+ 'anchor_y_offset ' => "10 "
229224 ]);
230- $ checkboxThree = new Checkbox ([
231- 'document_id ' => '1 ' ,
232- 'page_number ' => '1 ' ,
233- 'x_position ' => '75 ' ,
234- 'y_position ' => '478 ' ,
235- 'tab_label ' => 'ckAgreement '
225+ $ text2 = new Text ([
226+ 'document_id ' => "1 " ,
227+ 'font_size ' => "PhoneNumber " ,
228+ 'anchor_string ' => "/PhoneNumber/ " ,
229+ 'anchor_units ' => "pixels " ,
230+ 'anchor_x_offset ' => "20 " ,
231+ 'anchor_y_offset ' => "10 "
236232 ]);
237- $ checkboxFour = new Checkbox ([
238- 'document_id ' => '1 ' ,
239- 'page_number ' => '1 ' ,
240- 'x_position ' => '75 ' ,
241- 'y_position ' => '508 ' ,
242- 'tab_label ' => 'ckAcknowledgement '
233+ $ text3 = new Text ([
234+ 'document_id ' => "1 " ,
235+ 'font_size ' => "Company " ,
236+ 'anchor_string ' => "/Company/ " ,
237+ 'anchor_units ' => "pixels " ,
238+ 'anchor_x_offset ' => "20 " ,
239+ 'anchor_y_offset ' => "10 "
243240 ]);
244-
245- $ list = CreateAndEmbedFormService::createListOfButtonOptions ();
246-
247- $ numerical = new Numerical ([
241+ $ text4 = new Text ([
248242 'document_id ' => "1 " ,
249- 'validation_type ' => "Currency " ,
250- 'page_number ' => "1 " ,
251- 'x_position ' => "163 " ,
252- 'y_position ' => "260 " ,
253- 'font ' => "helvetica " ,
254- 'font_size ' => "size14 " ,
255- 'tab_label ' => "numericalCurrency " ,
256- 'width ' => "84 " ,
257- 'required ' => "false "
243+ 'font_size ' => "JobTitle " ,
244+ 'anchor_string ' => "/Title/ " ,
245+ 'anchor_units ' => "pixels " ,
246+ 'anchor_x_offset ' => "20 " ,
247+ 'anchor_y_offset ' => "10 "
258248 ]);
259249
260- $ radioGroup = new RadioGroup (
261- [
262- 'document_id ' => "1 " ,
263- 'group_name ' => "radio1 " ,
264- 'radios ' => [
265- new Radio ([
266- 'page_number ' => "1 " ,
267- 'x_position ' => "142 " ,
268- 'y_position ' => "384 " ,
269- 'value ' => "white " ,
270- 'required ' => "false "
271- ]),
272- new Radio ([
273- 'page_number ' => "1 " ,
274- 'x_position ' => "74 " ,
275- 'y_position ' => "384 " ,
276- 'value ' => "red " ,
277- 'required ' => "false "
278- ]),
279- new Radio ([
280- 'page_number ' => "1 " ,
281- 'x_position ' => "220 " ,
282- 'y_position ' => "384 " ,
283- 'value ' => "blue " ,
284- 'required ' => "false "
285- ])
286- ]]
287- );
288- $ text = new Text ([
250+ $ dateSignedTabs = new DateSigned ([
289251 'document_id ' => "1 " ,
290- 'page_number ' => "1 " ,
291- 'x_position ' => "153 " ,
292- 'y_position ' => "230 " ,
293- 'font ' => "helvetica " ,
294- 'font_size ' => "size14 " ,
295- 'tab_label ' => "text " ,
296- 'height ' => "23 " ,
297- 'width ' => "84 " ,
298- 'required ' => "false "
252+ 'font_size ' => "DateSigned " ,
253+ 'anchor_string ' => "/Date/ " ,
254+ 'anchor_units ' => "pixels " ,
255+ 'anchor_x_offset ' => "20 " ,
256+ 'anchor_y_offset ' => "10 "
299257 ]);
300258
301259 $ signer ->setTabs (new Tabs ([
302260 'sign_here_tabs ' => [$ signHere ],
303- 'checkbox_tabs ' => [$ checkbox , $ checkboxTwo , $ checkboxThree , $ checkboxFour ],
304- 'list_tabs ' => [$ list ],
305- 'numerical_tabs ' => [$ numerical ],
306- 'radio_group_tabs ' => [$ radioGroup ],
307- 'text_tabs ' => [$ text ]
261+ 'checkbox_tabs ' => [$ checkbox ],
262+ 'text_tabs ' => [$ text , $ text2 , $ text3 , $ text4 ],
263+ 'date_signed_tabs ' => [$ dateSignedTabs ]
308264 ]));
309265
310266 return new EnvelopeTemplate (
@@ -315,33 +271,10 @@ public static function makeTemplateRequest(
315271 'documents ' => [$ document ],
316272 'email_subject ' => "Please sign this document " ,
317273 'recipients ' => new Recipients ([
318- 'signers ' => [$ signer ],
319- 'carbon_copies ' => [$ cc ]
274+ 'signers ' => [$ signer ]
320275 ]),
321276 'status ' => "created "
322277 ]
323278 );
324279 }
325-
326- public static function createListOfButtonOptions (): ModelList
327- {
328- return new ModelList ([
329- 'font ' => "helvetica " ,
330- 'font_size ' => "size11 " ,
331- 'anchor_string ' => '/l1q/ ' ,
332- 'anchor_y_offset ' => '-10 ' ,
333- 'anchor_units ' => 'pixels ' ,
334- 'anchor_x_offset ' => '0 ' ,
335- 'list_items ' => [
336- ['text ' => "Red " , 'value ' => "red " ],
337- ['text ' => "Orange " , 'value ' => "orange " ],
338- ['text ' => "Yellow " , 'value ' => "yellow " ],
339- ['text ' => "Green " , 'value ' => "green " ],
340- ['text ' => "Blue " , 'value ' => "blue " ],
341- ['text ' => "Indigo " , 'value ' => "indigo " ]
342- ],
343- 'required ' => "true " ,
344- 'tab_label ' => "l1q "
345- ]);
346- }
347280}
0 commit comments