Skip to content

Commit 0203268

Browse files
Merge pull request #8 from alexanderjordanbaker/ReadTheDocs
Updating for Read the Docs integration
2 parents 1d8d717 + 300cfe8 commit 0203268

File tree

7 files changed

+97
-78
lines changed

7 files changed

+97
-78
lines changed

.readthedocs.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
version: 2
2+
3+
build:
4+
os: "ubuntu-20.04"
5+
tools:
6+
python: "3.11"
7+
jobs:
8+
pre_build:
9+
- sphinx-apidoc -F -H "App Store Server Library" -A "Apple Inc." -V "0.1.0" -e -a -o _staging . tests setup.py
10+
11+
sphinx:
12+
configuration: _staging/conf.py
13+
14+
python:
15+
install:
16+
- requirements: docs/requirements.txt
17+
- requirements: requirements.txt
18+
- method: pip
19+
path: .

appstoreserverlibrary/api_client.py

Lines changed: 54 additions & 55 deletions
Large diffs are not rendered by default.

appstoreserverlibrary/promotional_offer.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ def create_signature(self, product_identifier: str, subscription_offer_id: str,
2222
2323
https://developer.apple.com/documentation/storekit/in-app_purchase/original_api_for_in-app_purchase/subscriptions_and_offers/generating_a_signature_for_promotional_offers
2424
25-
:param product_identifier The subscription product identifier
26-
:param subscription_offer_id The subscription discount identifier
27-
:param application_username An optional string value that you define; may be an empty string
28-
:param nonce A one-time UUID value that your server generates. Generate a new nonce for every signature.
29-
:param timestamp A timestamp your server generates in UNIX time format, in milliseconds. The timestamp keeps the offer active for 24 hours.
30-
:return The Base64 encoded signature
25+
:param product_identifier: The subscription product identifier
26+
:param subscription_offer_id: The subscription discount identifier
27+
:param application_username: An optional string value that you define; may be an empty string
28+
:param nonce: A one-time UUID value that your server generates. Generate a new nonce for every signature.
29+
:param timestamp: A timestamp your server generates in UNIX time format, in milliseconds. The timestamp keeps the offer active for 24 hours.
30+
:return: The Base64 encoded signature
3131
"""
3232
payload = self._bundle_id + '\u2063' + \
3333
self._key_id + '\u2063' + \

appstoreserverlibrary/receipt_utility.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ def extract_transaction_id_from_app_receipt(self, app_receipt: str) -> Optional[
1717
Extracts a transaction id from an encoded App Receipt. Throws if the receipt does not match the expected format.
1818
*NO validation* is performed on the receipt, and any data returned should only be used to call the App Store Server API.
1919
20-
:param appReceipt The unmodified app receipt
21-
:returns A transaction id from the array of in-app purchases, null if the receipt contains no in-app purchases
20+
:param appReceipt: The unmodified app receipt
21+
:return: A transaction id from the array of in-app purchases, null if the receipt contains no in-app purchases
2222
"""
2323
decoder = asn1.Decoder()
2424
decoder.start(b64decode(app_receipt, validate=True))
@@ -82,8 +82,8 @@ def extract_transaction_id_from_transaction_receipt(self, transaction_receipt: s
8282
"""
8383
Extracts a transaction id from an encoded transactional receipt. Throws if the receipt does not match the expected format.
8484
*NO validation* is performed on the receipt, and any data returned should only be used to call the App Store Server API.
85-
:param transactionReceipt The unmodified transactionReceipt
86-
:returns A transaction id, or null if no transactionId is found in the receipt
85+
:param transactionReceipt: The unmodified transactionReceipt
86+
:return: A transaction id, or null if no transactionId is found in the receipt
8787
"""
8888
decoded_top_level = base64.b64decode(transaction_receipt).decode('utf-8')
8989
matching_result = re.search('"purchase-info"\s+=\s+"([a-zA-Z0-9+/=]+)";', decoded_top_level)

appstoreserverlibrary/signed_data_verifier.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,19 @@ def verify_and_decode_renewal_info(self, signed_renewal_info: str) -> JWSRenewal
4747
"""
4848
Verifies and decodes a signedRenewalInfo obtained from the App Store Server API, an App Store Server Notification, or from a device
4949
50-
:param signed_renewal_info The signedRenewalInfo field
51-
:return The decoded renewal info after verification
52-
:throws VerificationException Thrown if the data could not be verified
50+
:param signed_renewal_info: The signedRenewalInfo field
51+
:return: The decoded renewal info after verification
52+
:throws VerificationException: Thrown if the data could not be verified
5353
"""
5454
return cattrs.structure(self._decode_signed_object(signed_renewal_info), JWSRenewalInfoDecodedPayload)
5555

5656
def verify_and_decode_signed_transaction(self, signed_transaction: str) -> JWSTransactionDecodedPayload:
5757
"""
5858
Verifies and decodes a signedTransaction obtained from the App Store Server API, an App Store Server Notification, or from a device
5959
60-
:param signed_transaction The signedRenewalInfo field
61-
:return The decoded transaction info after verification
62-
:throws VerificationException Thrown if the data could not be verified
60+
:param signed_transaction: The signedRenewalInfo field
61+
:return: The decoded transaction info after verification
62+
:throws VerificationException: Thrown if the data could not be verified
6363
"""
6464
decoded_transaction_info = cattrs.structure(self._decode_signed_object(signed_transaction), JWSTransactionDecodedPayload)
6565
if decoded_transaction_info.bundleId != self._bundle_id:
@@ -72,9 +72,9 @@ def verify_and_decode_notification(self, signed_payload: str) -> ResponseBodyV2D
7272
"""
7373
Verifies and decodes an App Store Server Notification signedPayload
7474
75-
:param signedPayload The payload received by your server
76-
:return The decoded payload after verification
77-
:throws VerificationException Thrown if the data could not be verified
75+
:param signedPayload: The payload received by your server
76+
:return: The decoded payload after verification
77+
:throws VerificationException: Thrown if the data could not be verified
7878
"""
7979
decoded_dict = self._decode_signed_object(signed_payload)
8080
decoded_signed_notification = cattrs.structure(decoded_dict, ResponseBodyV2DecodedPayload)
@@ -99,9 +99,9 @@ def verify_and_decode_app_transaction(self, signed_app_transaction: str) -> AppT
9999
"""
100100
Verifies and decodes a signed AppTransaction
101101
102-
:param signed_app_transaction The signed AppTransaction
103-
:return The decoded AppTransaction after validation
104-
:throws VerificationException Thrown if the data could not be verified
102+
:param signed_app_transaction: The signed AppTransaction
103+
:return: The decoded AppTransaction after validation
104+
:throws VerificationException: Thrown if the data could not be verified
105105
"""
106106
decoded_dict = self._decode_signed_object(signed_app_transaction)
107107
decoded_app_transaction = cattrs.structure(decoded_dict, AppTransaction)

docs/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
sphinx == 7.0.1

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ requests >= 2.28.0, < 3
44
cryptography >= 40.0.0, < 42
55
pyOpenSSL >= 23.1.1, < 24
66
asn1==2.7.0
7-
cattrs==23.1.2
7+
cattrs==23.1.2

0 commit comments

Comments
 (0)