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

misc(PaymentRequest): Apply payment idempotency refactor #2986

Merged
merged 4 commits into from
Jan 13, 2025

Conversation

vincent-pochet
Copy link
Collaborator

Context

This PR follow #2962 in the refactor of the payment processing. It applied the logic that was applied to payment for invoices to payment requests

The main goal of this refactor will be to:

  • Avoid double payment at all cost
  • Avoid code duplication between payment processor integration to make maintenance easier

Description

This PR applies the following logic for payment processing of payment requests:

  • Creates a payment (or retrieve the pending one in case of retry)
  • Delegate the payment processing to the dedicated PaymentProviders::*::Payments::CreateService responsible only for the payment creation and the error handling (including idempotency). The payment provider payment creation logic will be shared between types of payment and will rely only on the Lago Payment record

@vincent-pochet vincent-pochet force-pushed the refact-payment-request branch 8 times, most recently from 0117994 to 66411fe Compare December 23, 2024 11:07
@vincent-pochet vincent-pochet force-pushed the refact-payment-request branch 2 times, most recently from e262e32 to d7f520f Compare January 7, 2025 09:30
@vincent-pochet vincent-pochet force-pushed the refact-payment-request branch from d7f520f to 24369f9 Compare January 7, 2025 10:11
@vincent-pochet vincent-pochet merged commit 4a0f0c4 into main Jan 13, 2025
6 checks passed
@vincent-pochet vincent-pochet deleted the refact-payment-request branch January 13, 2025 12:50
vincent-pochet added a commit that referenced this pull request Jan 20, 2025
The issue is related to the merge of
#2986 created before the
migration but turning the `PENDING_STATUSES` constants to
`PROCESSING_STATUSES`
vincent-pochet added a commit that referenced this pull request Jan 24, 2025
# Context

This PR is related to the recent changes introduced by
#2962 and
#2986 to rely on payment
provider idem-potency logic

A new `payable_payment_status` was added to the Payment model, but this
status is not updated when a webhook is received from a payment provider

# Description

This PR makes sure that the payment, payment request or all other
payment related statuses are updated accordingly
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.

3 participants