Skip to content

v0.1.0-alpha.31

Pre-release
Pre-release

Choose a tag to compare

@sandervanhooft sandervanhooft released this 02 Nov 21:37
e6a5aff

Added

  • Order->cancellationReason: nullable string explaining why an order was canceled. payment_failure when payment recovery for the unpaid order was exhausted, otherwise null. Always null unless the order's status is canceled, and null for orders canceled before the API exposed this field. Compare against Vatly\API\Types\CancellationReason::PAYMENT_FAILURE.
  • cancellationReason on the OrderCanceled webhook DTO: a nullable ?string, read straight from the delivery's object. Additive: it is an optional constructor argument that defaults to null.
  • orderId on the refund webhook DTOs: RefundCompleted, RefundFailed, and RefundCanceled now expose orderId (?string): the credit order Vatly creates from a refund, whose customerInvoice is the credit note. It is hydrated from the signed refund payload like every other field (the id is already present there), so a consumer stamping the credit note can reach it with a single GetOrder instead of first re-fetching the refund with GetRefund. null until a credit order has materialized.

Changed

  • testHelpers->simulateOrderPayment() and testHelpers->fastForwardSubscriptionRenewal() now return typed resources: the hydrated Vatly\API\Resources\Order and Vatly\API\Resources\Subscription instead of a raw ?object, matching the 200 responses. Breaking if you type-hint the old return, or mock these methods with a plain object or null. Reading properties such as $order->id keeps working.
  • Synced openapi.yaml with the published spec: adds the simulate-payment path, the SimulateOrderPaymentRequest and EurMoney schemas, CreateCheckoutRequest.billingAddress, UpdateSubscriptionRequest.prorationCharge, the requires_amount_review chargeback status, and reason on WebhookEvent and WebhookDelivery. Prices you set on products and plans are EurMoney (EUR only).
  • docs/Checkouts.md now documents the billingAddress prefill.

Fixed

  • orderRefunds->createFullRefundForOrderId() no longer changes the path of later calls. It left /full on the shared endpoint, so every later orderRefunds call on the same client went to the wrong URL: a partial refund was sent to /orders/{id}/refunds/full, and a second full refund to /refunds/full/full. Order::fullRefund() was affected too. Long-lived clients, such as queue workers, are the ones that could hit this.
  • subscriptions->listForCustomerId() and listForCustomer() now return only that customer's subscriptions. They called GET /subscriptions with a customer_id parameter the API does not support, so the response held every subscription for the API token's storefront and mode. They now call GET /customers/{customerId}/subscriptions. If you worked around this by filtering the result yourself, that filter is no longer needed.
  • docs/Orders.md now matches the Order resource and the API: the statuses are created, pending, paid, canceled and expired, the helpers are isCreated(), isPaid(), isPending(), isCanceled() and isExpired() plus the reversal helpers (there is no failed status or isFailed()), and the properties and examples use the real fields (total and subtotal as Money, no amount, currency, taxAmount, paidAt, checkoutId or subscriptionId).
  • Corrected the code samples and reference tables in docs/, which called methods the SDK does not have:
    • The list samples for checkouts, customers, subscriptions, refunds and chargebacks now call page(). There is no list() method, and limit and startingAfter are positional arguments, not an array. endingBefore is documented too.
    • docs/Refunds.md now uses orderRefunds->createForOrderId() and createFullRefundForOrderId() (there is no refunds->create()), the items request body, the real properties and statuses, and documents canceling a refund. The status helpers it listed do not exist.
    • The hosted checkout URL is read from $checkout->links->checkoutUrl->href. getCheckoutUrl() and getOrderId() do not exist.
    • Removed the customerId filter on the subscriptions list, which the API does not offer, in favor of customerSubscriptions->pageForCustomerId().
    • docs/Checkouts.md and docs/Chargebacks.md no longer list merchantId, and the properties tables now include the fields the API returns. docs/Chargebacks.md also lists the dispute statuses.