|
|
|
|
@ -40,11 +40,10 @@ def index(request): |
|
|
|
|
def app_store_webhook_prod(request): |
|
|
|
|
|
|
|
|
|
decoded = request.body.decode('utf-8') |
|
|
|
|
fulljson = json.loads(decoded) |
|
|
|
|
signedPayload = fulljson['signedPayload'] |
|
|
|
|
|
|
|
|
|
notification = ASSNotification( |
|
|
|
|
content=decoded, |
|
|
|
|
) |
|
|
|
|
notification.save() |
|
|
|
|
decodePayload(signedPayload) |
|
|
|
|
|
|
|
|
|
return JsonResponse({'status': 'success'}) |
|
|
|
|
|
|
|
|
|
@ -57,29 +56,8 @@ def app_store_webhook(request): |
|
|
|
|
|
|
|
|
|
decodePayload(signedPayload) |
|
|
|
|
|
|
|
|
|
# client = AppStoreServerAPIClient(private_key_bytes, key_id, issuer_id, bundle_id, environment) |
|
|
|
|
|
|
|
|
|
# environment = Environment.SANDBOX |
|
|
|
|
# bundle_id = 'stax.SlashPoker.nosebleed' |
|
|
|
|
# verifier = SignedDataVerifier([root_cert_bytes, g6_cert_bytes], False, environment, bundle_id) |
|
|
|
|
# try: |
|
|
|
|
# # response = client.get_transaction_info(<txn-id>) |
|
|
|
|
# decoded_txn = verifier.verify_and_decode_signed_transaction(signedPayload) |
|
|
|
|
# print(decoded_txn) |
|
|
|
|
|
|
|
|
|
# type = data['notificationType'] |
|
|
|
|
|
|
|
|
|
# notification = ASSNotification( |
|
|
|
|
# content=type, |
|
|
|
|
# ) |
|
|
|
|
# notification.save() |
|
|
|
|
|
|
|
|
|
# except APIException as e: |
|
|
|
|
# print(e) |
|
|
|
|
|
|
|
|
|
return JsonResponse({'status': 'success'}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def decodePayload(signedPayload): |
|
|
|
|
|
|
|
|
|
# with open('payload.txt') as f: |
|
|
|
|
@ -139,12 +117,24 @@ def decodePayload(signedPayload): |
|
|
|
|
notificationType=payload.notificationType, |
|
|
|
|
subtype=payload.subtype, |
|
|
|
|
notificationUUID=payload.notificationUUID, |
|
|
|
|
signedDate=signedDateTime.date, |
|
|
|
|
signedDate=signedDateTime, |
|
|
|
|
|
|
|
|
|
productId=summary.productId, |
|
|
|
|
requestIdentifier=summary.requestIdentifier, |
|
|
|
|
succeededCount=summary.succeededCount, |
|
|
|
|
failedCount=summary.failedCount, |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
# notification = ASSNotification( |
|
|
|
|
# notificationType=payload.notificationType, |
|
|
|
|
# subtype=payload.subtype, |
|
|
|
|
# notificationUUID=payload.notificationUUID, |
|
|
|
|
# signedDate=signedDateTime, |
|
|
|
|
# productId=summary.productId, |
|
|
|
|
# requestIdentifier=summary.requestIdentifier, |
|
|
|
|
# succeededCount=summary.succeededCount, |
|
|
|
|
# failedCount=summary.failedCount, |
|
|
|
|
# ) |
|
|
|
|
notification.save() |
|
|
|
|
|
|
|
|
|
except APIException as e: |
|
|
|
|
|