Edits history of script submission #15553 for ' Modify bank account (deel)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * Modify bank account
     * Modify bank account for an employee.
     **Token scopes**: `people:write`
     */
    export async function main(auth: RT.Deel, worker_id: string, bank_id: string, body: Body) {
    	const url = new URL(`https://api.letsdeel.com/rest/v2/gp/workers/${worker_id}/banks/${bank_id}`)
    
    	const response = await fetch(url, {
    		method: 'PATCH',
    		headers: {
    			'Content-Type': 'application/json',
    			Authorization: 'Bearer ' + auth.apiKey
    		},
    		body: JSON.stringify(body)
    	})
    	if (!response.ok) {
    		const text = await response.text()
    		throw new Error(`${response.status} ${text}`)
    	}
    	return await response.json()
    }
    
    /* eslint-disable */
    /**
     * This file was automatically generated by json-schema-to-typescript.
     * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
     * and run json-schema-to-typescript to regenerate this file.
     */
    
    export interface Body {
    	/**
    	 * The city of the user's address.
    	 */
    	city?: string
    	/**
    	 * The International Bank Account Number (IBAN).
    	 */
    	iban?: string
    	/**
    	 * The user's email address.
    	 */
    	email?: string
    	/**
    	 * The user's phone number.
    	 */
    	phone?: string
    	/**
    	 * The user's postal or ZIP code.
    	 */
    	postal?: string
    	/**
    	 * The user's tax identification number.
    	 */
    	tax_id?: string
    	/**
    	 * The bank code.
    	 */
    	bank_code?: string
    	/**
    	 * Name of the user's bank.
    	 */
    	bank_name?: string
    	/**
    	 * Full name of the user.
    	 */
    	full_name?: string
    	/**
    	 * SWIFT/BIC code for the bank.
    	 */
    	swift_bic?: string
    	/**
    	 * The RIB (Relevé d'Identité Bancaire).
    	 */
    	rib_number?: string
    	/**
    	 * The branch code of the user's bank.
    	 */
    	branch_code?: string
    	/**
    	 * Bank account type.
    	 */
    	account_type?: string
    	/**
    	 * The country code of the user's address.
    	 */
    	country_code?: string
    	/**
    	 * The primary address line.
    	 */
    	address_line1?: string
    	/**
    	 * The secondary address line.
    	 */
    	address_line2?: string
    	/**
    	 * The currency code for transactions.
    	 */
    	currency_code?: string
    	/**
    	 * The original name of the user.
    	 */
    	original_name?: string
    	/**
    	 * The user's bank account number.
    	 */
    	account_number?: string
    	/**
    	 * The state or province of the user's address.
    	 */
    	province_state?: string
    	/**
    	 * The name of the user's bank branch.
    	 */
    	bank_branch_name?: string
    	/**
    	 * The country code where the bank is located.
    	 */
    	bank_country_code?: string
    	/**
    	 * The ACH (Automated Clearing House) Routing Number.
    	 */
    	ach_routing_number?: string
    	[k: string]: unknown
    }
    

    Submitted by hugo697 235 days ago