Edits history of script submission #19146 for ' Delete an other receipts object (sage_intacct)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type SageIntacct = {
    	token: string
    }
    /**
     * Delete an other receipts object
     * Deletes an other receipts object. Only those receipts that have not yet been deposited or reconciled that are in an open period can be deleted.
    
    
    Permissions and other requirements
    
    SubscriptionCash Management
    User typeBusiness
    PermissionsList, View, Delete Other receipts
    
    
    
    
     */
    export async function main(auth: SageIntacct, key: string) {
    	const url = new URL(
    		`https://api.intacct.com/ia/api/v1/objects/cash-management/other-receipt/${key}`
    	)
    
    	const response = await fetch(url, {
    		method: 'DELETE',
    		headers: {
    			Authorization: 'Bearer ' + auth.token
    		},
    		body: undefined
    	})
    	if (!response.ok) {
    		const text = await response.text()
    		throw new Error(`${response.status} ${text}`)
    	}
    	return await response.text()
    }
    

    Submitted by hugo697 235 days ago