Fix resource lifecycle webhook payload mismatch#218
Open
PremSharma-Intelegencia wants to merge 1 commit into
Open
Fix resource lifecycle webhook payload mismatch#218PremSharma-Intelegencia wants to merge 1 commit into
PremSharma-Intelegencia wants to merge 1 commit into
Conversation
Compute the resource lifecycle payload once in SendResourceLifecycleWebhook and use the same value for both the persisted ApiEvent data and the outbound webhook request body. This prevents webhook deliveries from diverging from the api_events.data record when the event snapshot and live model payload differ.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes a payload mismatch in
SendResourceLifecycleWebhook.Previously, the listener stored the API event using
$event->getEventData(), but sent the webhook using$event->data. Because these values can be resolved at different times, the payload stored inapi_events.datacould differ from the payload actually sent to integrators.This change computes the lifecycle payload once and reuses it for both the stored
ApiEventrecord and the outbound webhook request body.Background
For
order.completedwebhooks, we observed cases where the payload recorded in the database did not match the payload sent to the webhook endpoint. This made it difficult to rely onapi_events.dataas an accurate record of delivered webhook data.Changes
$payload = $event->getEventData()once inSendResourceLifecycleWebhook$payloadinapi_events.data$payloadas the outbound webhook bodyRelated PRs