OUT-4030: warn IUs which mixed-payout fees are already recorded - #280
Merged
Conversation
Query invoices that have a SUCCESS PAYMENT/SUCCEEDED sync log. The absorbed-fee Purchase exists in QBO only when that row is written, so its presence is ground truth rather than inferring from the batched-intent flag. Standalone @/db/service fn to avoid a syncLog.service <-> syncErrorNotifier import cycle. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
A mixed-intent payout fails terminally; the notification told the IU to record the deposit manually but did not flag that the non-batched invoices already have their fee expensed, so following it would double-book those fees. Name the already-recorded invoices in the copy (in-product + email) and warn against re-recording. A recorded-fee lookup failure now drops only that detail, not the whole notification. Share the remark delimiter so the writer and notifier split can't drift. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThe PR improves mixed-payout reconciliation notifications by identifying invoices whose Stripe fees were already recorded and warning users not to record those fees twice.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Important Files Changed
Sequence DiagramsequenceDiagram
participant W as Payout webhook
participant L as Sync log
participant N as SyncErrorNotifier
participant DB as Fee-log lookup
participant IU as Integration user
W->>L: Record terminal mixed-payout failure
L->>N: Notify with affected invoice numbers
N->>DB: Find successful PAYMENT/SUCCEEDED logs
DB-->>N: Invoices with recorded fees
N->>IU: Send manual-reconciliation warning
Note over IU: Do not record listed fees again
Reviews (2): Last reviewed commit: "feat(OUT-4030): warn IUs which mixed-pay..." | Re-trigger Greptile |
Collaborator
Author
|
@greptileai review PR again |
priosshrsth
requested changes
Aug 7, 2026
…lper
Move the remark parse + recorded-fee lookup out of notify() into a private
resolveMixedPayoutInvoices helper returning { affectedInvoiceNumbers,
invoiceNumbersWithFee }. Behavior-preserving; keeps the fault-isolation so a
lookup failure still dispatches the notification.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
SandipBajracharya
merged commit Aug 7, 2026
d73f5ab
into
feature/payout-reconciliation
5 checks passed
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.
Problem
A Stripe payout can straddle a
bankDepositFeeFlagtoggle, mixing invoices set to batch into a bank deposit with invoices that are not. These payouts are unsupported and fail terminally (FAILEDPAYOUT/SETTLED, no auto-retry) with an IU notification.The old notification told the IU to record the deposit manually and stated nothing was double-booked. But the non-batched invoices already have their absorbed Stripe fee posted as a QBO expense. Following that guidance — booking a normal batched deposit (gross lines minus a fee line) — double-books those fees.
Change
Keep mixed payouts terminal + manual (no auto delete/rebuild — the fee-funding account
assetAccountRefis user-selectable to a real, reconciled bank, so deleting posted fee expenses isn't safe). Instead, make the notification actionable:getInvoiceNumbersWithRecordedFee): invoices that have a SUCCESSPAYMENT/SUCCEEDEDsync log — the fee Purchase exists in QBO only when that row is written, so it's ground truth, not inferred from the batched-intent flag. Standalone@/db/servicefn to avoid asyncLog.service ↔ syncErrorNotifierimport cycle.NotificationContext.invoiceNumbersWithFee. A lookup failure drops only that detail — the terminal payout notification still fires.MIXED_INTENT_INVOICE_DELIMITERso the remark writer and the notifier split can't drift.Testing
Sub-issue of OUT-3604. Linear: https://linear.app/assemblycom/issue/OUT-4030
🤖 Generated with Claude Code