Skip to content

feat: add repeating-invoice tools (list, get, create, delete)#192

Open
rathga wants to merge 5 commits into
XeroAPI:mainfrom
rathga:feat/repeating-invoices
Open

feat: add repeating-invoice tools (list, get, create, delete)#192
rathga wants to merge 5 commits into
XeroAPI:mainfrom
rathga:feat/repeating-invoices

Conversation

@rathga

@rathga rathga commented Jun 8, 2026

Copy link
Copy Markdown

Summary

Adds four thin-wrapper tools over the xero-node repeating-invoice SDK calls, mirroring the existing invoice tools:

  • list-repeating-invoicesgetRepeatingInvoices (optional where/order)
  • get-repeating-invoicegetRepeatingInvoice (single template incl. line items + schedule)
  • create-repeating-invoicecreateRepeatingInvoices (contact, schedule, line items, type/status, branding/currency/line-amount-type, auto-send flags)
  • delete-repeating-invoice — deletes a template (POST id + status=DELETED)

Each tool maps ~1:1 to an accountingApi call and returns the raw RepeatingInvoice. Line-item and tracking schemas match the invoice tools.

Why delete and not update

Xero's repeating-invoice API has no edit operation. A POST to /RepeatingInvoices with an existing RepeatingInvoiceID is only valid with status=DELETED — anything else returns 400 ValidationException: "Repeating invoice status must be set to DELETED" (confirmed against a live tenant). So updateOrCreateRepeatingInvoices is, in practice, create-or-delete. Editing a template means delete + recreate, which is left to the caller rather than baked into the wrapper.

Test Plan

  • npm run build — clean
  • npm run lint — clean
  • npm test — all existing Vitest suites pass (no new pure helper with logic, so no unit tests added, per the repo's helper-test convention)
  • Live smoke against a real Xero tenant: list → create (DRAFT) → get → delete (status=DELETED), self-cleaning throwaway template — all four tools verified end to end

rathga and others added 5 commits June 8, 2026 20:50
Xero's repeating-invoice API has no edit operation: a POST to /RepeatingInvoices
with an existing RepeatingInvoiceID is only valid with status=DELETED (confirmed
live against the tenant: 'Repeating invoice status must be set to DELETED').

Replace the impossible update tool with delete-repeating-invoice (POST id +
status=DELETED; minimal body works). Editing a template = delete + recreate, which
is composite logic left to higher-level tooling per the thin-wrapper rule. Also drop
the now-unused repeatingInvoiceId path from the create handler's builder.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant