Repository navigation
Carry order lines on the OrderPaymentFailed webhook DTO - #77
Merged
Merged
Conversation
OrderPaymentFailed gains lines (OrderLineData[]), mapped from the payload as on OrderPaid, so consumers read the failed order's subscription link from lines[].relatedResources without a follow-up GetOrder. The order.payment_failed payload already carried the lines. A payload without a lines key still yields an empty array. The docblock no longer claims a GetOrder enrichment. Release v0.1.0-alpha.34 in the changelog. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-01a1d5e4-0a4e-740c-83d6-ad5ea3772ccb
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
OrderPaymentFailednow carrieslines(OrderLineData[]), mapped from the payload the same way as onOrderPaid. Consumers can read$event->lines[0]->relatedResources?->subscriptionIdto find the subscription whose payment failed, without a follow-upGetOrder.The
order.payment_failedpayload already carries the lines (Vatly serializes it with the same order payload asorder.paid); the DTO dropped them. The JS and Python SDKs expose the fullOrderresource on this event, so they already have the lines.[]. A payload without alineskey still yields[]rather than throwing on the uninitializedOrder::$lines.GetOrder; it is built from the signed payload.Tests
Two new tests: lines with and without a subscription link are mapped, and a payload without lines yields
[]. Both fail without the change. Full suite: 308 passing; PHPStan and php-cs-fixer clean.