Skip to content

Commit c3c169e

Browse files

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

appstoreserverlibrary/models/JWSRenewalInfoDecodedPayload.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Copyright (c) 2023 Apple Inc. Licensed under MIT License.
2-
from typing import Optional
2+
from typing import List, Optional
33

44
from attr import define
55
import attr
@@ -167,4 +167,11 @@ class JWSRenewalInfoDecodedPayload(AttrsRawValueAware):
167167
rawOfferDiscountType: Optional[str] = OfferDiscountType.create_raw_attr('offerDiscountType')
168168
"""
169169
See offerDiscountType
170+
"""
171+
172+
eligibleWinBackOfferIds: Optional[List[str]] = attr.ib(default=None)
173+
"""
174+
An array of win-back offer identifiers that a customer is eligible to redeem, which sorts the identifiers to present the better offers first.
175+
176+
https://developer.apple.com/documentation/appstoreserverapi/eligiblewinbackofferids
170177
"""

appstoreserverlibrary/models/OfferType.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ class OfferType(IntEnum, metaclass=AppStoreServerLibraryEnumMeta):
1313
INTRODUCTORY_OFFER = 1
1414
PROMOTIONAL_OFFER = 2
1515
SUBSCRIPTION_OFFER_CODE = 3
16+
WIN_BACK_OFFER = 4

tests/resources/models/signedRenewalInfo.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,9 @@
1515
"renewalDate": 1698148850000,
1616
"renewalPrice": 9990,
1717
"currency": "USD",
18-
"offerDiscountType": "PAY_AS_YOU_GO"
19-
}
18+
"offerDiscountType": "PAY_AS_YOU_GO",
19+
"eligibleWinBackOfferIds": [
20+
"eligible1",
21+
"eligible2"
22+
]
23+
}

tests/test_decoded_payloads.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ def test_renewal_info_decoding(self):
111111
self.assertEqual("USD", renewal_info.currency)
112112
self.assertEqual(OfferDiscountType.PAY_AS_YOU_GO, renewal_info.offerDiscountType)
113113
self.assertEqual("PAY_AS_YOU_GO", renewal_info.rawOfferDiscountType)
114+
self.assertEqual(['eligible1', 'eligible2'], renewal_info.eligibleWinBackOfferIds)
114115

115116
def test_notification_decoding(self):
116117
signed_notification = create_signed_data_from_json('tests/resources/models/signedNotification.json')

0 commit comments

Comments
 (0)