-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhelpers.robot
77 lines (57 loc) · 2.26 KB
/
helpers.robot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
*** Settings ***
Library RPA.Browser.Playwright
Library RPA.Dialogs
Library OperatingSystem
*** Keywords ***
Get Providers
${providers}= Create List Digital Ocean Pipedrive Namecheap
[Return] ${providers}
Get Invoice Id
[Arguments] ${date} ${invoiceNumber}
${invoiceId}= Evaluate "${date}${invoiceNumber}".replace(' ', '_').replace('#', '')
[Return] ${invoiceId}
Get Invoice Label
[Arguments] ${date} ${invoiceNumber}
IF "${invoiceNumber}" == "None"
${invoiceLabel}= Set Variable ${date}
ELSE
${invoiceLabel}= Set Variable ${date} - ${invoiceNumber}
END
[Return] ${invoiceLabel}
Display Picker
[Arguments] ${bills} ${hasMorePages}
Add heading Bills to collect
FOR ${bill} IN @{bills}
${invoiceNumber}= Set Variable ${bill["invoiceNumber"]}
${billDate}= Set Variable ${bill["date"]}
${billId}= Get Invoice Id ${billDate} ${invoiceNumber}
${invoiceLabel}= Get Invoice Label ${billDate} ${invoiceNumber}
Add checkbox name=${billId} label=${invoiceLabel} default=False
END
IF "${hasMorePages}" == "TRUE"
Add submit buttons buttons=Get older bills, Done
END
${selectedBills}= Run dialog
IF "${selectedBills.submit}" == "Done"
${shouldExit}= Set Variable TRUE
ELSE
${shouldExit}= Set Variable FALSE
END
[Return] ${selectedBills} ${shouldExit}
Download Selected Bills
[Arguments] ${bills} ${selectedBills}
FOR ${bill} IN @{bills}
${invoiceNumber}= Set Variable ${bill["invoiceNumber"]}
${billDate}= Set Variable ${bill["date"]}
${billId}= Get Invoice Id ${billDate} ${invoiceNumber}
IF ${selectedBills}[${billId}]
${file}= Download ${bill}[downloadURL]
${invoiceLabel}= Get Invoice Label ${billDate} ${invoiceNumber}
Move File ${file}[saveAs] %{ROBOT_ARTIFACTS}/bills/${invoiceLabel}.pdf
END
END
Select Provider
${supportedProviders}= Get Providers
Add drop-down provider ${supportedProviders}
${result}= Run dialog
[Return] ${result.provider}