feat(OUT-4005): payout reconciliation service + deposit lookup [2/4] - #274
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryAdds the payout-reconciliation service and QuickBooks deposit lookup infrastructure.
Confidence Score: 5/5The PR appears safe to merge with no concrete blocking or independently actionable non-blocking defects identified. The reconciliation validation, payment resolution, deposit lookup pagination, retry behavior, and persistence paths are internally consistent with the established repository contracts examined. Important Files Changed
Sequence DiagramsequenceDiagram
participant Caller
participant PayoutService
participant SyncLogService
participant IntuitAPI
participant PaymentService
participant Database
Caller->>PayoutService: reconcile(payout, tokens, options)
PayoutService->>PayoutService: Validate line items and totals
alt Resync idempotency check
PayoutService->>Database: Check stored qbDepositId
PayoutService->>IntuitAPI: Query deposits by transaction date
IntuitAPI-->>PayoutService: Matching deposits
PayoutService->>Database: Persist discovered deposit ID
else Deposit creation required
PayoutService->>SyncLogService: Resolve successful payment IDs
SyncLogService-->>PayoutService: Payment and batching metadata
PayoutService->>PaymentService: Create batched bank deposit
PaymentService->>IntuitAPI: Create QuickBooks deposit
IntuitAPI-->>PaymentService: Deposit ID
PayoutService->>Database: Persist deposit ID
end
PayoutService-->>Caller: depositId or null
Reviews (1): Last reviewed commit: "feat(OUT-4005): add payout reconciliatio..." | Re-trigger Greptile |
4235d7e to
5e3cf8a
Compare
| import { validateAccessToken } from '@/utils/auth' | ||
|
|
||
| export class PayoutService extends BaseService { | ||
| private syncLogService = new SyncLogService(this.user) |
There was a problem hiding this comment.
Does this work? what would this be. Can you maybe move this to constructor instead?
There was a problem hiding this comment.
Yes it works, but the constructor should be good for this case.
| deletePayment = this.wrapWithRetry(this._deletePayment) | ||
| deletePurchase = this.wrapWithRetry(this._deletePurchase) | ||
| createDeposit = this.wrapWithRetry(this._createDeposit) | ||
| getDepositsByTxnDate = this._getDepositsByTxnDate.bind(this) |
There was a problem hiding this comment.
What is the benifit of doing it this way?
There was a problem hiding this comment.
getDepositsByTxnDate is not wrapped with retry. In fact we do not wrap get functions with retry.
PayoutService.reconcile validates the payout, resolves its payments, and builds one batched deposit. On resync it reuses an already-made deposit (stored id, then a txn-date query on PrivateNote) so a retry can't duplicate. Adds getDepositsByTxnDate and its schemas. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
09c0eaa to
1f79d78
Compare
028757f
into
feature/payout-reconciliation
Stack 2/4 — base:
OUT-4005-split-1PayoutService.reconcilevalidates the payout, resolves its payments, and builds one batched QBO deposit. On resync it reuses an already-made deposit (stored id, then a txn-date query matchingPrivateNote) so a retry can't create a duplicate. AddsgetDepositsByTxnDate+ schemas, error types, and unit/service tests.Part of the OUT-4005 payout-reconciliation stack:
🤖 Generated with Claude Code