Skip to content

2.2.0

Choose a tag to compare

@aporat aporat released this 07 Nov 15:36
e3e89e5

Added

  • iTunes\Response::getAppItemId(), getOriginalPurchaseDate(), getRequestDate() and
    getReceiptCreationDate() expose the app_item_id, original_purchase_date_ms,
    request_date_ms and receipt_creation_date_ms receipt fields (dates as Carbon).
  • iTunes\Response::getRawData() returns the decoded JSON array the response was built from. Thanks
    to @amasok (#82)
  • iTunes\PurchaseItem::isTrialPeriod() and isInIntroOfferPeriod() read the is_trial_period and
    is_in_intro_offer_period fields.
  • iTunes\Response::getLatestReceiptInfo() and getPendingRenewalInfo() now return an empty array
    instead of null when the receipt has no such data.

Changed

  • Breaking: composer now requires PHP >= 7.1 (was 7.0), ext-json, and guzzlehttp/guzzle ~6.3
    (was ~6.2).
  • Breaking: iTunes\Response::parseJsonResponse() and
    iTunes\PurchaseItem::parseJsonResponse() were renamed to parseData();
    iTunes\PendingRenewalInfo gained a public parseData() as well.
  • Breaking: iTunes\PendingRenewalInfo::getIsInBillingRetryPeriod() was renamed to
    isInBillingRetryPeriod(), and getAutoRenewStatus() now returns bool instead of int.
  • Breaking: iTunes\Validator::__construct() throws \InvalidArgumentException instead of
    ReceiptValidator\RunTimeException for an unknown endpoint.
  • Breaking: iTunes\Response, iTunes\PurchaseItem and iTunes\PendingRenewalInfo
    constructors are typed ?array $data = null and always parse; constructing one with null now
    throws RunTimeException ("Response must be a scalar value") instead of producing an empty
    object.
  • iTunes\Validator::validate(?string $receipt_data = null, ?string $shared_secret = null): Response and most iTunes getters gained scalar/nullable return types (for example
    getResultCode(): int, getBundleId(): string, getPurchaseDate(): ?Carbon).
    getLatestReceipt(): string and getBundleId(): string are non-nullable, so a receipt lacking
    those fields will raise a TypeError.
  • Amazon\Validator::setEndpoint() is now explicitly public (it had no visibility keyword).
    Thanks to @gsingh1 (#75)

Fixed

  • iTunes\PurchaseItem trial/intro-offer flags are compared against the string "true" instead of
    boolval(), which returned true for the string "false". Thanks to @cumhuronat
    (#77)
  • Amazon\PurchaseItem::getRenewalDate() now uses Carbon::createFromTimestampUTC() on the
    millisecond value divided by 1000; 2.1.0 passed that seconds value to createFromTimestampMs(),
    yielding a date near 1970.
  • All millisecond-to-Carbon conversions (iTunes and Amazon) cast the rounded timestamp to int
    before calling Carbon.

Notes written from the code diff for this release; see CHANGELOG.md.