feat: add repeating-invoice tools (list, get, create, delete)#192
Open
rathga wants to merge 5 commits into
Open
feat: add repeating-invoice tools (list, get, create, delete)#192rathga wants to merge 5 commits into
rathga wants to merge 5 commits into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds four thin-wrapper tools over the
xero-noderepeating-invoice SDK calls, mirroring the existing invoice tools:list-repeating-invoices—getRepeatingInvoices(optionalwhere/order)get-repeating-invoice—getRepeatingInvoice(single template incl. line items + schedule)create-repeating-invoice—createRepeatingInvoices(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
accountingApicall and returns the rawRepeatingInvoice. 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
/RepeatingInvoiceswith an existingRepeatingInvoiceIDis only valid withstatus=DELETED— anything else returns400 ValidationException: "Repeating invoice status must be set to DELETED"(confirmed against a live tenant). SoupdateOrCreateRepeatingInvoicesis, 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— cleannpm run lint— cleannpm test— all existing Vitest suites pass (no new pure helper with logic, so no unit tests added, per the repo's helper-test convention)