Add reconciliation job to sync stuck processing invoices with Wise#1617
Open
nyomanjyotisa wants to merge 1 commit intomainfrom
Open
Add reconciliation job to sync stuck processing invoices with Wise#1617nyomanjyotisa wants to merge 1 commit intomainfrom
nyomanjyotisa wants to merge 1 commit intomainfrom
Conversation
nyomanjyotisa
commented
Feb 13, 2026
| @@ -0,0 +1,45 @@ | |||
| # frozen_string_literal: true | |||
|
|
|||
| class InvoicePaymentTransferUpdate | |||
Member
Author
There was a problem hiding this comment.
New service extracted from WiseTransferUpdateJob to handle invoice payment transfer status updates to we can reuse it
| payment.update!(status: Payment::SUCCEEDED, wise_transfer_amount: amount, wise_transfer_estimate: estimate) | ||
| invoice.mark_as_paid!(timestamp: Time.zone.parse(params.dig("data", "occurred_at")), payment_id: payment.id) | ||
| end | ||
| InvoicePaymentTransferUpdate.new( |
Member
Author
There was a problem hiding this comment.
Replaced the inline invoice payment status handling with the new InvoicePaymentTransferUpdate service
| description: Sends monthly vesting report to company admins | ||
|
|
||
| reconcile_processing_invoices_job: | ||
| cron: "0 */4 * * *" # Every 4 hours |
Member
Author
There was a problem hiding this comment.
Every 4 hours is frequent enough to catch stuck invoices within a reasonable window, but conservative enough to not over-call the Wise API
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.
Resolves #1615
Description
Problem
If a Wise webhook fails or is not delivered, invoices can remain stuck in "processing" status indefinitely, even though the transfer has been completed or failed on Wise's side. This required manual intervention to resolve.
Solution
Add
ReconcileProcessingInvoicesJobthat runs every 4 hours to check the actual transfer status via the Wise API for invoices stuck in "processing"AI Disclosure
Claude Opus 4.6 for code generation. All code self reviewed