//native
type SageIntacct = {
token: string
}
/**
* Create a payment provider bank account
* Creates a new payment provider bank account.
Permissions and other requirements
SubscriptionAdministration, Sage Cloud Services, Outbound Payment Services
User typeBusiness user with admin permissions
PermissionsList, View, Subscribe, Configure Application Subscriptions
*/
export async function main(
auth: SageIntacct,
body: {
key?: string
id?: string
state?:
| 'requestInitiated'
| 'inProgress'
| 'requestReceived'
| 'requestFailed'
| 'awaitingAuthorization'
| 'subscribed'
| 'canceled'
| 'suspended'
providerReferenceNumber?: string
authenticationURL?: string
checkStartNumber?: string
isRebateAccount?: false | true
remittanceEmail?: string
bankAccount?: {
key?: string
id?: string
currency?: string
href?: string
}
paymentProvider?: { key?: string; id?: string; href?: string }
href?: string
audit?: {
createdDateTime?: string
modifiedDateTime?: string
createdBy?: string
modifiedBy?: string
}
status?: 'active' | 'inactive'
}
) {
const url = new URL(
`https://api.intacct.com/ia/api/v1/objects/cash-management/payment-provider-bank-account`
)
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer ' + auth.token
},
body: JSON.stringify(body)
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 235 days ago