fix(netsuite): skip sync of line-less invoices - #6073
Open
lago-claude-ai-agent[bot] wants to merge 1 commit into
Open
lago-claude-ai-agent[bot] wants to merge 1 commit into
lago-claude-ai-agent[bot] wants to merge 1 commit into
Conversation
## Context Finalized invoices whose fees are all zero-amount were still posted to NetSuite. NetSuite drops zero-amount lines, ends up with no line item at all, and rejects the transaction with an HTTP 424. That status is treated as retryable, so the job retried three times and delivered a sync_error webhook on every attempt, for an invoice that has nothing billable to sync. The decision is provider-specific and cannot live at enqueue time: Xero deliberately syncs zero-amount lines, so a shared guard would change its behavior. ## Description Invoice payloads now expose a `sync_allowed?` predicate that defaults to true, and the create service returns early, without an error, when it is false. NetSuite overrides it to mirror the lines that actually survive on its side: positive fees or discount lines. Xero, Anrok and HubSpot keep the default, so their behavior is unchanged. The zero-amount fee filter shared by the payload body and the new predicate is extracted into a single place, and the payload instance is memoized now that the create service references it more than once. The 424 retryable classification is left alone: the fix stops the request from being sent in the first place. Signed-off-by: lago-claude-ai-agent[bot] <297187938+lago-claude-ai-agent[bot]@users.noreply.github.com>
Contributor
Author
|
PASS — the guard matches the lines that actually survive on NetSuite's side, and it is scoped to NetSuite only, so no other provider changes behavior. Verified:
Nits (non-blocking):
|
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.
Finalized invoices whose fees are all zero-amount were still posted to NetSuite, which drops zero-amount lines, ends up with no line item, and rejects the transaction with a 424. That status counts as retryable, so the job retried three times and sent a
sync_errorwebhook on each attempt for an invoice with nothing billable to sync.Invoice payloads now expose a
sync_allowed?predicate defaulting totrue, andCreateServicereturns early (as a success, not an error) when it is false. NetSuite overrides it to mirror the lines that actually survive on its side — positive fees or discounts. Xero, Anrok and HubSpot keep the default, so Xero's deliberate zero-amount line syncing is unchanged. This also makes a manual invoice sync a clean no-op for these invoices.Deliberately out of scope: the 424 retryable classification stays as is, since the request is no longer sent at all.