//native
/**
* Get bank transfer requirements
* Retrieve requireements for bank transfer method creation
**Token scopes**: `worker:read`, `worker:write`
*/
export async function main(
auth: RT.Deel,
country: string | undefined,
currency: string | undefined,
amount?: string | undefined
) {
const url = new URL(
`https://api.letsdeel.com/rest/v2/payouts/contractors/methods/bank_transfers/requirements`
)
for (const [k, v] of [
['country', country],
['currency', currency],
['amount', amount]
]) {
if (v !== undefined && v !== '') {
url.searchParams.append(k, v)
}
}
const response = await fetch(url, {
method: 'GET',
headers: {
Authorization: 'Bearer ' + auth.apiKey
},
body: undefined
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 235 days ago