Edits history of script submission #15455 for ' Equity Tax Events (deel)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * Equity Tax Events
     * Create an equity tax event
     **Token scopes**: `equities:write`
     */
    export async function main(auth: RT.Deel, body: Body) {
    	const url = new URL(`https://api.letsdeel.com/rest/v2/equities/tax-events`)
    
    	const response = await fetch(url, {
    		method: 'POST',
    		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 {
    	data?: {
    		/**
    		 * The exchange rate used to convert the local currency to the payroll currency
    		 */
    		fx_rate: number
    		/**
    		 * The tax rate applied to the benefit in kind
    		 */
    		tax_rate?: number
    		/**
    		 * The fair market value of the equity grant at the time of the event
    		 */
    		unit_fmv?: number
    		/**
    		 * The unique identifier of the contract of the employee who received the equity grant
    		 */
    		contract_d?: string
    		/**
    		 * The date of the event
    		 */
    		event_date?: string
    		/**
    		 * The price at which the equity was sold
    		 */
    		sale_price?: number
    		/**
    		 * The gross value of the equity grant
    		 */
    		gross_value?: number
    		/**
    		 * The currency in which the equity grant was issued
    		 */
    		plan_currency: string
    		/**
    		 * The price at which the equity was exercised
    		 */
    		exercise_price?: number
    		/**
    		 * The unique identifier of the equity grant - optional in case you don't have remove the property
    		 */
    		equity_grant_id?: string
    		/**
    		 * The date of the settlement
    		 */
    		settlement_date: string
    		/**
    		 * The currency in which the payroll is processed
    		 */
    		payroll_currency: string
    		/**
    		 * The tax jurisdiction in which the equity grant was issued
    		 */
    		tax_jurisdiction: string
    		/**
    		 * The fees associated with the transaction
    		 */
    		transaction_fees?: number
    		/**
    		 * The quantity of equity that remains
    		 */
    		quantity_remaining?: number
    		/**
    		 * The taxable gain or loss
    		 */
    		taxable_gain_or_loss: number
    		/**
    		 * The total exercise price
    		 */
    		total_exercise_price?: number
    		/**
    		 * The total amount of taxes withheld
    		 */
    		total_taxes_withheld: number
    		/**
    		 * The method used to cover the taxes
    		 */
    		method_of_tax_coverage:
    			| 'AD_HOC'
    			| 'BIK_REPORTING_ONLY'
    			| 'BIK_WITHHOLDING_AT_SOURCE_CLIENT'
    			| 'BIK_WITHHOLDING_AT_SOURCE_CLIENT_REVERSE'
    			| 'BIK_WITHHOLDING_GROSSED_UP_BONUS'
    			| 'BIK_WITHHOLDING_NET_SETTLEMENT'
    			| 'BIK_WITHHOLDING_SALARY_DEDUCTION'
    			| 'BIK_WITHHOLDING_WORKER'
    			| 'NO_BIK_NO_WITHHOLDING'
    		/**
    		 * The quantity of equity that was withheld or sold
    		 */
    		quantity_withheld_or_sold?: number
    		/**
    		 * The tax withheld in the local currency
    		 */
    		withheld_tax_local_currency: number
    		/**
    		 * The benefit in kind in the local currency
    		 */
    		benefit_in_kind_local_currency: number
    		/**
    		 * The quantity of equity that was exercised or released
    		 */
    		quantity_exercised_or_released?: number
    		[k: string]: unknown
    	}
    	[k: string]: unknown
    }
    

    Submitted by hugo697 235 days ago