1 | |
2 | |
3 | * Add bank account |
4 | * Add a new bank account for an employee. |
5 | **Token scopes**: `people:write` |
6 | */ |
7 | export async function main(auth: RT.Deel, worker_id: string, body: Body) { |
8 | const url = new URL(`https://api.letsdeel.com/rest/v2/gp/workers/${worker_id}/banks`) |
9 |
|
10 | const response = await fetch(url, { |
11 | method: 'POST', |
12 | headers: { |
13 | 'Content-Type': 'application/json', |
14 | Authorization: 'Bearer ' + auth.apiKey |
15 | }, |
16 | body: JSON.stringify(body) |
17 | }) |
18 | if (!response.ok) { |
19 | const text = await response.text() |
20 | throw new Error(`${response.status} ${text}`) |
21 | } |
22 | return await response.json() |
23 | } |
24 |
|
25 | |
26 | |
27 | * This file was automatically generated by json-schema-to-typescript. |
28 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, |
29 | * and run json-schema-to-typescript to regenerate this file. |
30 | */ |
31 |
|
32 | export interface Body { |
33 | data: { |
34 | |
35 | * The city of the user's address. |
36 | */ |
37 | city?: string |
38 | |
39 | * The International Bank Account Number (IBAN). |
40 | */ |
41 | iban?: string |
42 | |
43 | * The user's email address. |
44 | */ |
45 | email?: string |
46 | |
47 | * The user's phone number. |
48 | */ |
49 | phone?: string |
50 | |
51 | * The user's postal or ZIP code. |
52 | */ |
53 | postal?: string |
54 | |
55 | * The user's tax identification number. |
56 | */ |
57 | tax_id?: string |
58 | |
59 | * The bank code. |
60 | */ |
61 | bank_code?: string |
62 | |
63 | * Name of the user's bank. |
64 | */ |
65 | bank_name?: string |
66 | |
67 | * Full name of the user. |
68 | */ |
69 | full_name?: string |
70 | |
71 | * SWIFT/BIC code for the bank. |
72 | */ |
73 | swift_bic?: string |
74 | |
75 | * The RIB (Relevé d'Identité Bancaire). |
76 | */ |
77 | rib_number?: string |
78 | |
79 | * The branch code of the user's bank. |
80 | */ |
81 | branch_code?: string |
82 | |
83 | * Bank account type. |
84 | */ |
85 | account_type?: string |
86 | |
87 | * The country code of the user's address. |
88 | */ |
89 | country_code?: string |
90 | |
91 | * The primary address line. |
92 | */ |
93 | address_line1?: string |
94 | |
95 | * The secondary address line. |
96 | */ |
97 | address_line2?: string |
98 | |
99 | * The currency code for transactions. |
100 | */ |
101 | currency_code?: string |
102 | |
103 | * The original name of the user. |
104 | */ |
105 | original_name?: string |
106 | |
107 | * The user's bank account number. |
108 | */ |
109 | account_number?: string |
110 | |
111 | * The state or province of the user's address. |
112 | */ |
113 | province_state?: string |
114 | |
115 | * The name of the user's bank branch. |
116 | */ |
117 | bank_branch_name?: string |
118 | |
119 | * The country code where the bank is located. |
120 | */ |
121 | bank_country_code?: string |
122 | |
123 | * The ACH (Automated Clearing House) Routing Number. |
124 | */ |
125 | ach_routing_number?: string |
126 | [k: string]: unknown |
127 | } |
128 | [k: string]: unknown |
129 | } |
130 |
|