Skip to content

Commit

Permalink
fix(payment_request): Avoid deserialization issues (#2815)
Browse files Browse the repository at this point in the history
## Description
The goal of this PR is to avoid `ActiveJob::DeserializationError` with
`PaymentRequests::Payments::*CreateJob` (and in related webhooks and
mailers) when the payment request is enqueued from the
`DunningCampaigns::ProcessAttemptService`
  • Loading branch information
vincent-pochet authored Nov 14, 2024
1 parent b1b848c commit 7fed46e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions app/services/payment_requests/create_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ def call
)
end

SendWebhookJob.perform_later("payment_request.created", payment_request)
after_commit do
SendWebhookJob.perform_later("payment_request.created", payment_request)

payment_result = Payments::CreateService.call(payment_request)
PaymentRequestMailer.with(payment_request:).requested.deliver_later unless payment_result.success?
payment_result = Payments::CreateService.call(payment_request)
PaymentRequestMailer.with(payment_request:).requested.deliver_later unless payment_result.success?
end

result.payment_request = payment_request

Expand Down

0 comments on commit 7fed46e

Please sign in to comment.