将大部分费用报销单发送到Xero帐户



我有一个管理公司费用的nodejs应用程序(SAAS(,我想与xero合作,这样我的客户就可以一键将我网站上提交的请求(又名费用索赔(发送到xero,我发现我可以一个接一个地发送请求,但我想一次发送所有请求,任何人都知道如何做到

我相信您可以在Xero Node SDK上使用createExpenseClaims方法来批量创建费用索赔。您可以使用以下模式:

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const currDate = '2020-12-10'
const user: User = { 
userID: "00000000-0000-0000-0000-000000000000" }; 
const receipt: Receipt = { 
receiptID: "00000000-0000-0000-0000-000000000000",
date: currDate };   
const receipts = [];    
receipts.push(receipt)
const expenseClaim: ExpenseClaim = { 
status: ExpenseClaim.StatusEnum.SUBMITTED,
user: user,
receipts: receipts }; 
const expenseClaims: ExpenseClaims = {  
expenseClaims: [expenseClaim] }; 
try {
const response = await xero.accountingApi.createExpenseClaims(xeroTenantId, expenseClaims);
console.log(response.body || response.response.statusCode)
} catch (err) {
const error = JSON.stringify(err.response.body, null, 2)
console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

来源:Xero Node SDK文档

相关内容

  • 没有找到相关文章

最新更新