-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please add createInvoice, createCreditNote functions #734
Comments
PETOSS-678 |
Thanks for raising an issue, a ticket has been created to track your request |
@caub I don't understand why you find it impractical? Maybe you have a special use-case I've not encountered? I use it for single document creation in several functions. You just submit an Invoices array of one Invoice object instead of multiple. Seems totally reasonable to me to have a single endpoint cater for one or many in preference to 2 dedicated endpoints. |
It's working, but it's not super practical: const { body: r } = await xero.accountingApi[isCreditNote ? 'createCreditNotes' : 'createInvoices'](
addon.customFields.xero_tenantId,
{ [isCreditNote ? 'creditNotes' : 'invoices']: [formattedInvoice] },
`${invoice.id}-${invoice.version || 0}`, // idempotencyKey
);
const createdDoc = r[isCreditNote ? 'creditNotes' : 'invoices'][0]; With this proposal: const { body: r } = await xero.accountingApi[isCreditNote ? 'createCreditNote' : 'createInvoice'](
addon.customFields.xero_tenantId,
formattedInvoice,
`${invoice.id}-${invoice.version || 0}`, // idempotencyKey
);
const createdDoc = r[isCreditNote ? 'creditNote' : 'invoice']; Asking because there's a similar |
Because using createInvoices for one document is not practical
The text was updated successfully, but these errors were encountered: