Adopt latest OpenAPI spec from vatlify#29
Merged
Conversation
…t constants Sync openapi.yaml with vatlify main's bundled spec (idempotency support, currency enum, additionalProperties, webhook createdAt/testmode, new event types) and add the matching webhook event-type constants to the SDK. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Avoids the name collision with Resources\WebhookEvent and matches the `eventName` field it documents plus the sibling *Status enum naming. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The latest vatlify OpenAPI spec exposes an inline `mandate` summary (payment method on file) on subscription responses. Adopt the spec verbatim and add SDK support: a minimal Mandate DTO, ResourceFactory hydration (with null handling), the Subscription::$mandate property, docs, and test coverage including the null case. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…re Money) vatlify shipped the two fixes from sandervanhooft/vatlify#1454: - Standardize on US English: `cancelledAt` -> `canceledAt` on the Subscription schema (and resume-endpoint prose keyed off `status` rather than `endedAt`/`endsAt`). - Money is now validated currency-aware via a `oneOf` over ISO 4217 minor units (2 / 0 / 3 decimals) instead of one permissive pattern. Adopt the spec verbatim and rename `Subscription::$cancelledAt` -> `$canceledAt` so hydration keeps matching the JSON key. `Money` stays a passthrough DTO (server enforces precision). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The properties table, helper-method examples, and status list had drifted from src/API/Resources/Subscription.php and src/API/Types/SubscriptionStatus.php. - Replace invented fields (planId, currentPeriodStart/End, trialStart/End, metadata, createdAt) with the real resource properties, and add the ones that were missing (resource, name, description, billingAddress, basePrice, quantity, interval, intervalCount, renewedAt/Until, nextRenewalAt, links). - Fix helper-method example: isActive/isTrial/isOnGracePeriod/isCanceled (drop the non-existent isCreated/onTrial/onGracePeriod/isPaused). - Add the missing `canceled` status; keep the verified `created`/`paused` statuses (both defined in SubscriptionStatus.php and the spec enum) and align descriptions with SubscriptionStatus. - Update code examples to real property names (subscriptionPlanId, renewedUntil). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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
openapi.yamlwith the latest bundled spec fromsandervanhooft/vatlifymain(docs/openapi/dist/openapi.bundled.yaml), adopted verbatim.payment.failed,subscription.resumed,checkout.paid,checkout.failed,checkout.canceled.Vatly\API\Types\WebhookEvent→Vatly\API\Types\WebhookEventNameto remove the collision withVatly\API\Resources\WebhookEventand match theeventNamefield it documents (and the sibling*Statusenum naming). Safe to rename atv0.1.0-alpha.mandatesummary now exposed on subscription responses (payment method on file).Subscription::$cancelledAt→$canceledAtto match the spec.What the new spec brings in
Idempotency-Keyrequest params,Idempotent-Replayedresponse headers, and409 Conflictresponses across mutating endpoints (SDK already sends idempotency keys).additionalProperties: falsethroughout.oneOfover ISO 4217 minor units (2 / 0 / 3 decimals) — replaces the earlier single permissive pattern. Validation is server-side;Moneystays a passthrough DTO.createdAt/testmodefields (now required) and new event types.mandateobject (method,maskedIdentifier), ornullwhen the subscription has no mandate yet.canceledAt: the subscription schema now usescanceledAt(wascancelledAt), and the resume-endpoint prose keys resumability offstatus(on_grace_period) rather thanendedAt/endsAt.Mandate support (SDK)
Vatly\API\Types\MandateDTO (methodstring + nullablemaskedIdentifier), mirroring theMoneyDTO pattern.ResourceFactoryhydratesmandate, handling thenullcase.Subscription::$mandatetyped as?Mandate.docs/Subscriptions.mdproperties table updated; test coverage added (incl. the null-mandate case).Notes
subscription_cancellation_grace_period_completed(all-underscore) for one event, inconsistent with its dot-notation siblings — root cause wasEventNameTransformeronly inserting the.for*Was*/*Has*class names. Reported and fixed upstream (sandervanhooft/vatlify#1452); this PR adopts the corrected dot formsubscription.cancellation_grace_period_completed.cancelledAt→canceledAt(US English) standardization and the currency-aware Money validation were filed upstream (sandervanhooft/vatlify#1454); both have now shipped and are adopted here. The SDK property rename keeps hydration matching the JSON key.docs/Webhooks.mdupdated with the new events and the renamed class reference.Test plan
composer test— 109 tests, 562 assertions passingopenapi.yamlvalidates as YAML