Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gocardless): Ignore refund not found when not comming from lago #2067

Merged
merged 1 commit into from
May 24, 2024

Conversation

vincent-pochet
Copy link
Collaborator

Context

Some PaymentProviders::Gocardless::HandleEventJob jobs are raising BaseService::NotFoundFailure with a gocardless_refund_not_found error message.

It seems to happen when the related refund is not found in Lago database.
By looking at the event payload, it appears that no metadata was attached to the event, meaning that the refund was not emitted from Lago.

Since we cannot handle this event, we should ignore them and not raise any error.

Description

This PR uses an approach that was previously introduce to handle stripe webhooks:

  • Check for the Refund into the DB
  • If not found, check for the metadata in the payload
  • raise an error only if the metadata matches a Lago resource (invoice), return a success result otherwise

@vincent-pochet vincent-pochet changed the title fix(go-cardless): Ignore refund not found when not comming from lago fix(gocardless): Ignore refund not found when not comming from lago May 24, 2024
@vincent-pochet vincent-pochet merged commit 2874aa9 into main May 24, 2024
6 checks passed
@vincent-pochet vincent-pochet deleted the fix-go-cardless-missing-refund branch May 24, 2024 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants