From 910e954f75906b7dca7ba805cf4a9c6621cbf0a4 Mon Sep 17 00:00:00 2001 From: Vincent Pochet Date: Thu, 14 Nov 2024 11:39:01 +0100 Subject: [PATCH] fix(payment_request): Avoid deserialization issues --- app/services/payment_requests/create_service.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/services/payment_requests/create_service.rb b/app/services/payment_requests/create_service.rb index 3749f3ca422..f17ebdd1fa1 100644 --- a/app/services/payment_requests/create_service.rb +++ b/app/services/payment_requests/create_service.rb @@ -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