Skip to content

1.1.3

Latest

Choose a tag to compare

@github-actions github-actions released this 01 Oct 14:44

πŸš€ UPC 1.1.3

Adds the authorization / capture / cancellation payment lifecycle to UnifiedApiPaymentService, and
fixes payments failing for customers browsing over IPv6. No breaking changes; a plugin that upgrades
and changes nothing is unaffected.

πŸ› Fixes

  • 🌐 IPv6 browser IP no longer rejected β€” the Unified API caps browser.ip at 15
    characters (an IPv4 maximum) and rejects an IPv6 address, so payments from IPv6 clients failed.
    BrowserDto::toArray() now serializes any ip containing a : as 0.0.0.0, for both
    HostedFieldDto and PaymentDto. The public BrowserDto::$ip keeps the caller's original value;
    only the request payload changes.

✨ Added

  • πŸ” Authorization β€” no new call: it is createPayment() with CommonFieldsDto::$capture = false,
    optionally with the new partialAuthorization flag and/or authorizationType
    (AuthorizationType::PRE_AUTHORIZATION / FINAL_AUTHORIZATION). PaymentOutput now also exposes
    maxCaptureDate and remainingCapturableAmount for an authorization-only creation (PRE-3670).
  • πŸ’³ UnifiedApiPaymentService::capturePayment() β€” full or partial capture, immediate or deferred,
    one or several times, returning a CaptureOutput.
  • 🚫 UnifiedApiPaymentService::cancelPayment() β€” full (default) or partial cancellation of a
    payment or authorization, returning a CancellationOutput.
  • ⚠️ 13 new exception subtypes so a plugin can catch precisely instead of parsing a generic
    ApiException:
    • Business outcomes normalized from the Unified API response: AuthorizationExpiredException,
      PaymentAlreadyCapturedException, PaymentAlreadyCancelledException,
      AmountExceedsAvailableException, OperationConflictException,
      PartialCancellationNotAllowedException, PaymentNotVoidableException,
      PaymentNotCapturableException, MultipleCaptureNotAllowedException. An issuer refusal reuses the
      existing CardOperationException.
    • Local pre-call validation (no HTTP request sent): InvalidCaptureRequestException /
      CaptureAmountException and InvalidCancellationRequestException /
      CancellationAmountException β€” empty orderId/description, non-positive amount, or a missing
      currency alongside a partial amount.

πŸ” Compatibility

Upgrading from 1.1.2 with no plugin-side change is a no-op: no existing signature, contract or
exception changed, and the new CommonFieldsDto properties default to null. Idempotency across
replayed capture/cancel requests remains the consuming plugin's job (IPaymentRepository / ILock);
UPC only normalizes the API's "already happened" signals into distinct exception types.

βœ… Quality

PHPStan level 8, PHP-CS-Fixer, PHPUnit and CI verifying PHP 7.1–8.2 compatibility. New unit tests cover
every new class and the error-classification paths, plus two integration tests that assert the API's own
rejection against the shared staging fixture payment (proving auth/URL/JSON wiring without mutating it).

πŸ“‹ Requirements

  • PHP β‰₯7.4 to install/develop (build-tooling floor only β€” shipped source runs on PHP 7.1)
  • Runtime dependency: giggsey/libphonenumber-for-php

πŸ”— Full Changelog: 1.1.2...1.1.3