diff --git a/src/Models/JWSRenewalInfoDecodedPayload.php b/src/Models/JWSRenewalInfoDecodedPayload.php index 991e9eb..2a7075b 100644 --- a/src/Models/JWSRenewalInfoDecodedPayload.php +++ b/src/Models/JWSRenewalInfoDecodedPayload.php @@ -11,6 +11,21 @@ */ class JWSRenewalInfoDecodedPayload extends AbstractModel { + /** + * The UUID an app optionally generates to map a customer’s in-app purchase with its resulting App Store transaction. + * + * @var string|null + * @link https://developer.apple.com/documentation/appstoreserverapi/appaccounttoken + */ + public $appAccountToken; + + /** + * The unique identifier of the app download transaction. + * + * @var string + * @link https://developer.apple.com/documentation/appstoreserverapi/apptransactionid + */ + public $appTransactionId; /** * The identifier of the product that renews at the next billing period. * @@ -31,6 +46,25 @@ class JWSRenewalInfoDecodedPayload extends AbstractModel */ public $autoRenewStatus; + /** + * The three-letter ISO 4217 currency code associated with the price parameter. + * + * This value is present only if price is present. + * + * @var string|null + * @link https://developer.apple.com/documentation/appstoreserverapi/currency + */ + public $currency = null; + + /** + * An array of win-back offer identifiers that a customer is eligible to redeem, which + * sorts the identifiers with the best offers first. + * + * @var array|null + * @link https://developer.apple.com/documentation/appstoreserverapi/eligiblewinbackofferids + */ + public $eligibleWinBackOfferIds; + /** * The server environment, either sandbox or production. * @@ -69,6 +103,14 @@ class JWSRenewalInfoDecodedPayload extends AbstractModel */ public $isInBillingRetryPeriod; + /** + * The payment mode for a discount offer on an In-App Purchase. + * + * @var string|null + * @link https://developer.apple.com/documentation/appstoreserverapi/offerdiscounttype + */ + public $offerDiscountType; + /** * The promo code or the promotional offer identifier. * @@ -77,6 +119,22 @@ class JWSRenewalInfoDecodedPayload extends AbstractModel */ public $offerIdentifier; + /** + * The duration of the offer. + * + * This field is in ISO 8601 duration format. + * The following table shows examples of offer period values. + * + * Single period length - Period count - Offer period value + * 1 month - 1 - P1M + * 1 month - 2 - P2M + * 3 days - 1 - P3D + * + * @var string|null + * @link https://developer.apple.com/documentation/appstoreserverapi/offerperiod + */ + public $offerPeriod; + /** * The type of promotional offer. * @@ -133,6 +191,14 @@ class JWSRenewalInfoDecodedPayload extends AbstractModel */ public $renewalDate; + /** + * The renewal price, in milliunits, of the auto-renewable subscription that renews at the next billing period. + * + * @var int|null + * @link https://developer.apple.com/documentation/appstoreserverapi/renewalprice + */ + public $renewalPrice = null; + /** * The UNIX time, in milliseconds, that the App Store signed the JSON Web Signature data. * diff --git a/src/Models/JWSTransactionDecodedPayload.php b/src/Models/JWSTransactionDecodedPayload.php index 636b9dd..407c631 100644 --- a/src/Models/JWSTransactionDecodedPayload.php +++ b/src/Models/JWSTransactionDecodedPayload.php @@ -19,6 +19,14 @@ class JWSTransactionDecodedPayload extends AbstractModel */ public $appAccountToken; + /** + * The unique identifier of the app download transaction. + * + * @var string + * @link https://developer.apple.com/documentation/appstoreserverapi/apptransactionid + */ + public $appTransactionId; + /** * The bundle identifier of an app. * @@ -91,6 +99,22 @@ class JWSTransactionDecodedPayload extends AbstractModel */ public $offerIdentifier; + /** + * The duration of the offer. + * + * This field is in ISO 8601 duration format. + * The following table shows examples of offer period values. + * + * Single period length - Period count - Offer period value + * 1 month - 1 - P1M + * 1 month - 2 - P2M + * 3 days - 1 - P3D + * + * @var string|null + * @link https://developer.apple.com/documentation/appstoreserverapi/offerperiod + */ + public $offerPeriod; + /** * The type of promotional offer. * diff --git a/tests/AppStoreServerApiClientTest.php b/tests/AppStoreServerApiClientTest.php index d59848a..06127bd 100644 --- a/tests/AppStoreServerApiClientTest.php +++ b/tests/AppStoreServerApiClientTest.php @@ -297,6 +297,7 @@ public function testCallApiBadMethod() protected function testJWSTransactionDecodedPayload(JWSTransactionDecodedPayload $transaction) { $this->assertTrue(\is_string($transaction->appAccountToken) || \is_null($transaction->appAccountToken), 'Bad appAccountToken'); + $this->assertIsStringNotEmpty($transaction->appTransactionId, 'Bad appTransactionId'); $this->assertIsStringNotEmpty($transaction->bundleId, 'Bad bundleId'); $this->assertTrue(\is_string($transaction->currency) || \is_null($transaction->currency), 'Bad currency'); $this->assertIsStringNotEmpty($transaction->environment, 'Bad environment'); @@ -305,6 +306,7 @@ protected function testJWSTransactionDecodedPayload(JWSTransactionDecodedPayload $this->assertTrue(\is_null($transaction->isUpgraded) || \is_bool($transaction->isUpgraded), 'Bad isUpgraded'); $this->assertTrue(\is_null($transaction->offerDiscountType) || \is_string($transaction->offerDiscountType), 'Bad offerDiscountType'); $this->assertTrue(\is_null($transaction->offerIdentifier) || \is_string($transaction->offerIdentifier), 'Bad offerIdentifier'); + $this->assertTrue(\is_null($transaction->offerPeriod) || \is_string($transaction->offerPeriod), 'Bad offerPeriod'); $this->assertTrue(\is_null($transaction->offerType) || \is_int($transaction->offerType), 'Bad offerType'); $this->assertIsIntNotEmpty($transaction->originalPurchaseDate, 'Bad originalPurchaseDate'); $this->assertIsStringNotEmpty($transaction->originalTransactionId, 'Bad originalTransactionId'); @@ -326,19 +328,26 @@ protected function testJWSTransactionDecodedPayload(JWSTransactionDecodedPayload protected function testJWSRenewalInfoDecodedPayload(JWSRenewalInfoDecodedPayload $info) { + $this->assertTrue(\is_string($info->appAccountToken) || \is_null($info->appAccountToken), 'Bad appAccountToken'); + $this->assertIsStringNotEmpty($info->appTransactionId, 'Bad appTransactionId'); $this->assertIsStringNotEmpty($info->autoRenewProductId, 'Bad autoRenewProductId'); $this->assertIsInt($info->autoRenewStatus, 'Bad autoRenewStatus'); + $this->assertTrue(\is_string($info->currency) || \is_null($info->currency), 'Bad currency'); + $this->assertTrue(\is_array($info->eligibleWinBackOfferIds) || \is_null($info->eligibleWinBackOfferIds), 'Bad eligibleWinBackOfferIds'); $this->assertIsStringNotEmpty($info->environment, 'Bad environment'); $this->assertTrue(\is_null($info->expirationIntent) || \is_int($info->expirationIntent), 'Bad expirationIntent'); $this->assertTrue(\is_null($info->gracePeriodExpiresDate) || \is_int($info->gracePeriodExpiresDate), 'Bad gracePeriodExpiresDate'); $this->assertTrue(\is_null($info->isInBillingRetryPeriod) || \is_bool($info->isInBillingRetryPeriod), 'Bad isInBillingRetryPeriod'); + $this->assertTrue(\is_null($info->offerDiscountType) || \is_string($info->offerDiscountType), 'Bad offerDiscountType'); $this->assertTrue(\is_null($info->offerIdentifier) || \is_string($info->offerIdentifier), 'Bad offerIdentifier'); + $this->assertTrue(\is_null($info->offerPeriod) || \is_string($info->offerPeriod), 'Bad offerPeriod'); $this->assertTrue(\is_null($info->offerType) || \is_int($info->offerType), 'Bad offerType'); $this->assertIsStringNotEmpty($info->originalTransactionId, 'Bad originalTransactionId'); $this->assertTrue(\is_null($info->priceIncreaseStatus) || \is_int($info->priceIncreaseStatus), 'Bad priceIncreaseStatus'); $this->assertIsStringNotEmpty($info->productId, 'Bad productId'); $this->assertIsIntNotEmpty($info->recentSubscriptionStartDate, 'Bad recentSubscriptionStartDate'); $this->assertIsIntNotEmpty($info->renewalDate, 'Bad renewalDate'); + $this->assertTrue(\is_null($info->renewalPrice) || \is_int($info->renewalPrice), 'Bad renewalPrice'); $this->assertIsIntNotEmpty($info->signedDate, 'Bad signedDate'); }