8000 Fix charge update service params by brunomiguelpinto · Pull Request #3384 · getlago/lago-api · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix charge update service params #3384

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

Merged
merged 4 commits into from
Mar 27, 2025

Conversation

brunomiguelpinto
Copy link
Contributor
@brunomiguelpinto brunomiguelpinto commented Mar 26, 2025

Context

While executing the Charges::UpdateJob, we noticed that some data — specifically the properties key inside params — was being lost. This happened because payload_charge was passed to perform_later with symbol keys (:key), and ActiveJob/Sidekiq serializes job arguments using JSON, which does not handle deeply nested symbol keys properly. As a result, some nested data like properties was silently dropped during serialization.

Description

This PR ensures that payload_charge is passed to the job using .deep_stringify_keys, making the entire structure JSON-safe before enqueueing the job. Additionally, inside the Charges::UpdateService, params are converted back to symbolized keys using .to_h.deep_symbolize_keys

@brunomiguelpinto brunomiguelpinto force-pushed the fix-charge-update-service-params branch from dcd208d to eddc515 Compare March 26, 2025 19:08
@brunomiguelpinto brunomiguelpinto marked this pull request as ready for review March 26, 2025 19:08
@brunomiguelpinto brunomiguelpinto self-assigned this Mar 26, 2025
@brunomiguelpinto brunomiguelpinto added the 🐞 Bug Something isn't working label Mar 26, 2025
@brunomiguelpinto brunomiguelpinto force-pushed the fix-charge-update-service-params branch from eddc515 to c1d3499 Compare March 27, 2025 09:52
@brunomiguelpinto brunomiguelpinto merged commit 08eca21 into main Mar 27, 2025
13 checks passed
@brunomiguelpinto brunomiguelpinto deleted the fix-charge-update-service-params branch March 27, 2025 12:22
jdenquin pushed a commit that referenced this pull request Mar 27, 2025
## Context
 
While executing the Charges::UpdateJob, we noticed that some data —
specifically the properties key inside params — was being lost. This
happened because payload_charge was passed to perform_later with symbol
keys (:key), and ActiveJob/Sidekiq serializes job arguments using JSON,
which does not handle deeply nested symbol keys properly. As a result,
some nested data like properties was silently dropped during
serialization.

## Description

This PR ensures that payload_charge is passed to the job using
.deep_stringify_keys, making the entire structure JSON-safe before
enqueueing the job. Additionally, inside the Charges::UpdateService,
params are converted back to symbolized keys using
.to_h.deep_symbolize_keys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0