//native
type SageIntacct = {
token: string
}
/**
* Create a credit card account
* Creates a new credit card account.
Permissions and other requirements
SubscriptionCash Management
User typeBusiness, Employee, Project Manager
PermissionsList, View, Add Credit card accounts
*/
export async function main(
auth: SageIntacct,
body: {
key?: string
id?: string
href?: string
accountDetails?: {
description?: string
cardType?:
| 'visa'
| 'mastercard'
| 'discover'
| 'americanExpress'
| 'dinersClub'
| 'otherChargeCard'
number?: string
accountType?: 'credit' | 'debit'
expirationMonth?:
| '01'
| '02'
| '03'
| '04'
| '05'
| '06'
| '07'
| '08'
| '09'
| '10'
| '11'
| '12'
expirationYear?: string
currency?: string
billingAddress?: {
addressLine1?: string
addressLine2?: string
addressLine3?: string
city?: string
state?: string
postCode?: string
country?: string
countryCode?: string
}
debitCardCheckingAccount?: { id?: string; key?: string; href?: string }
}
accounting?: {
offsetGLAccount?: { key?: string; id?: string; href?: string }
financeChargeGLAccount?: { key?: string; id?: string; href?: string }
financeChargeAPAccountLabel?: {
key?: string
id?: string
href?: string
}
otherFeesGLAccount?: { key?: string; id?: string; href?: string }
otherFeesAPAccountLabel?: { key?: string; id?: string; href?: string }
defaultAccrualBasisGLJournal?: {
key?: string
id?: string
href?: string
}
defaultCashBasisGLJournal?: { key?: string; id?: string; href?: string }
employeeExpenseGLAccount?: { key?: string; id?: string; href?: string }
employeeExpenseAccountLabel?: {
key?: string
id?: string
href?: string
}
bankingTimeZone?:
| 'GMT (Greenwich Mean Time) Dublin, Edinburgh, London'
| 'GMT+00:00 Western Europe Time'
| 'GMT+01:00 Western Europe Summer Time'
| 'GMT+01:00 British Summer Time'
| 'GMT+01:00 Irish Summer Time'
| 'GMT+01:00 Central Europe Time'
| 'GMT+01:00 Berlin, Stockholm, Rome, Bern, Brussels'
| 'GMT+01:00 Lisbon, Warsaw'
| 'GMT+01:00 Paris, Madrid'
| 'GMT+01:00 Prague'
| 'GMT+02:00 Central Europe Summer Time'
| 'GMT+02:00 Eastern Europe Time'
| 'GMT+02:00 Athens, Helsinki, Istanbul'
| 'GMT+02:00 Cairo'
| 'GMT+02:00 Harare, Pretoria'
| 'GMT+02:00 Israel'
| 'GMT+03:00 Eastern Europe Summer Time'
| 'GMT+03:00 Baghdad, Kuwait, Nairobi, Riyadh'
| 'GMT+03:00 Moscow, St. Petersburg, Volgograd'
| 'GMT+03:30 Tehran'
| 'GMT+04:00 Moscow Summer Time'
| 'GMT+04:00 Abu Dhabi, Muscat, Tbilisi, Kazan'
| 'GMT+04:30 Kabul'
| 'GMT+05:00 Islamabad, Karachi, Sverdlovsk, Tashkent'
| 'GMT+05:30 Bombay, Calcutta, Madras, New Delhi'
| 'GMT+06:00 Almaty, Dhaka'
| 'GMT+07:00 Bangkok, Jakarta, Hanoi'
| 'GMT+08:00 Beijing, Chongqing, Urumqi'
| 'GMT+08:00 Hong Kong SAR, Perth, Singapore, Taipei'
| 'GMT+08:00 (Australian) Western Standard Time'
| 'GMT+09:00 Tokyo, Osaka, Sapporo, Seoul, Yakutsk'
| 'GMT+09:30 (Australian) Central Standard Time'
| 'GMT+10:30 (Australian) Central Daylight Time'
| 'GMT+09:30 Adelaide'
| 'GMT+09:30 Darwin'
| 'GMT+10:00 Brisbane, Melbourne, Sydney'
| 'GMT+10:00 Guam, Port Moresby'
| 'GMT+10:00 Vladivostok'
| 'GMT+10:00 (Australian) Eastern Standard Time'
| 'GMT+11:00 (Australian) Eastern Daylight Time'
| 'GMT+12:00 Fiji Islands, Marshall Islands'
| 'GMT+12:00 Kamchatka'
| 'GMT+12:00 Magadan, Solomon Islands, New Caledonia'
| 'GMT+12:00 Wellington, Auckland'
| 'GMT+13:00 Nuku`alofa'
| 'GMT+13:00 Samoa'
| 'GMT-01:00 Azores, Cape Verde Island'
| 'GMT-03:00 Brasilia'
| 'GMT-03:00 Buenos Aires, Georgetown'
| 'GMT-03:30 Newfoundland Standard Time'
| 'GMT-02:30 Newfoundland Daylight Time'
| 'GMT-04:00 Atlantic Standard Time'
| 'GMT-03:00 Atlantic Daylight Time'
| 'GMT-04:00 Caracas, La Paz'
| 'GMT-05:00 Bogota, Lima'
| 'GMT-05:00 Eastern Standard Time'
| 'GMT-04:00 Eastern Daylight Saving Time'
| 'GMT-05:00 Indiana (East)'
| 'GMT-06:00 Central Standard Time'
| 'GMT-05:00 Central Daylight Saving Time'
| 'GMT-06:00 Mexico City, Tegucigalpa'
| 'GMT-06:00 Saskatchewan'
| 'GMT-07:00 Arizona'
| 'GMT-07:00 Mountain Standard Time'
| 'GMT-06:00 Mountain Daylight Saving Time'
| 'GMT-08:00 Pacific Standard Time'
| 'GMT-07:00 Pacific Daylight Saving Time'
| 'GMT-09:00 Alaska Standard Time'
| 'GMT-08:00 Alaska Standard Daylight Saving Time'
| 'GMT-10:00 Hawaii'
| 'GMT-11:00 Midway Island, Samoa'
| 'GMT-12:00 Eniwetok, Kwajalein'
disableInterEntityTransfer?: false | true
useInEmployeeExpense?: false | true
}
reconciliation?: {
lastReconciledBalance?: string
lastReconciledDate?: string
cutOffDate?: string
inProgressBalance?: string
inProgressDate?: string
matchSequence?: { key?: string; id?: string; href?: string }
useMatchSequenceForAutoMatch?: false | true
useMatchSequenceForManualMatch?: false | true
}
department?: { key?: string; id?: string; href?: string }
location?: { key?: string; id?: string; href?: string }
vendor?: { key?: string; id?: string; href?: string }
status?: 'active' | 'inactive'
audit?: {
createdDateTime?: string
modifiedDateTime?: string
createdBy?: string
modifiedBy?: string
}
entity?: { key?: string; id?: string; name?: string; href?: string }
bankingCloudConnection?: {
name?: string
bankName?: string
status?:
| 'notConnected'
| 'connectionRequested'
| 'inProgress'
| 'pending'
| 'pendingConfirmation'
| 'connected'
| 'authRequired'
| 'verifyingAuth'
| 'inactiveFeed'
| 'inactiveClient'
| 'canceled'
| 'invalid'
| 'canceling'
| 'disconnecting'
lastBankTxnDateTime?: string
lastRefreshedDateTime?: string
refreshStatus?: 'queued' | 'refreshing' | 'success' | 'partialSuccess' | 'failure'
supportMultiAccountLinking?: false | true
}
financialInstitution?: { key?: string; id?: string; href?: string }
ruleSet?: { key?: string; id?: string; href?: string }
} & { accountDetails?: {}; accounting?: {} }
) {
const url = new URL(
`https://api.intacct.com/ia/api/v1/objects/cash-management/credit-card-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