|
| 1 | +package appstore |
| 2 | + |
| 3 | +// NotificationTypeV2 is type |
| 4 | +type NotificationTypeV2 string |
| 5 | + |
| 6 | +// list of notificationType |
| 7 | +// https://developer.apple.com/documentation/appstoreservernotifications/notificationtype |
| 8 | +const ( |
| 9 | + NotificationTypeV2ConsumptionRequest NotificationTypeV2 = "CONSUMPTION_REQUEST" |
| 10 | + NotificationTypeV2DidChangeRenewalPref NotificationTypeV2 = "DID_CHANGE_RENEWAL_PREF" |
| 11 | + NotificationTypeV2DidChangeRenewalStatus NotificationTypeV2 = "DID_CHANGE_RENEWAL_STATUS" |
| 12 | + NotificationTypeV2DidFailToRenew NotificationTypeV2 = "DID_FAIL_TO_RENEW" |
| 13 | + NotificationTypeV2DidRenew NotificationTypeV2 = "DID_RENEW" |
| 14 | + NotificationTypeV2Expired NotificationTypeV2 = "EXPIRED" |
| 15 | + NotificationTypeV2GracePeriodExpired NotificationTypeV2 = "GRACE_PERIOD_EXPIRED" |
| 16 | + NotificationTypeV2OfferRedeemed NotificationTypeV2 = "OFFER_REDEEMED" |
| 17 | + NotificationTypeV2PriceIncrease NotificationTypeV2 = "PRICE_INCREASE" |
| 18 | + NotificationTypeV2Refund NotificationTypeV2 = "REFUND" |
| 19 | + NotificationTypeV2RefundDeclined NotificationTypeV2 = "REFUND_DECLINED" |
| 20 | + NotificationTypeV2RenewalExtended NotificationTypeV2 = "RENEWAL_EXTENDED" |
| 21 | + NotificationTypeV2Revoke NotificationTypeV2 = "REVOKE" |
| 22 | + NotificationTypeV2Subscribed NotificationTypeV2 = "SUBSCRIBED" |
| 23 | +) |
| 24 | + |
| 25 | +// SubtypeV2 is type |
| 26 | +type SubtypeV2 string |
| 27 | + |
| 28 | +// list of subtypes |
| 29 | +// https://developer.apple.com/documentation/appstoreservernotifications/subtype |
| 30 | +const ( |
| 31 | + SubTypeV2InitialBuy = "INITIAL_BUY" |
| 32 | + SubTypeV2Resubscribe = "RESUBSCRIBE" |
| 33 | + SubTypeV2Downgrade = "DOWNGRADE" |
| 34 | + SubTypeV2Upgrade = "UPGRADE" |
| 35 | + SubTypeV2AutoRenewEnabled = "AUTO_RENEW_ENABLED" |
| 36 | + SubTypeV2AutoRenewDisabled = "AUTO_RENEW_DISABLED" |
| 37 | + SubTypeV2Voluntary = "VOLUNTARY" |
| 38 | + SubTypeV2BillingRetry = "BILLING_RETRY" |
| 39 | + SubTypeV2PriceIncrease = "PRICE_INCREASE" |
| 40 | + SubTypeV2GracePeriod = "GRACE_PERIOD" |
| 41 | + SubTypeV2BillingRecovery = "BILLING_RECOVERY" |
| 42 | + SubTypeV2Pending = "PENDING" |
| 43 | + SubTypeV2Accepted = "ACCEPTED" |
| 44 | +) |
| 45 | + |
| 46 | +type ( |
| 47 | + // SubscriptionNotificationV2 is struct for |
| 48 | + // https://developer.apple.com/documentation/appstoreservernotifications/responsebodyv2 |
| 49 | + SubscriptionNotificationV2 struct { |
| 50 | + SignedPayload SubscriptionNotificationV2SignedPayload `json:"signedPayload"` |
| 51 | + } |
| 52 | + |
| 53 | + // SubscriptionNotificationV2SignedPayload is struct |
| 54 | + // https://developer.apple.com/documentation/appstoreservernotifications/signedpayload |
| 55 | + SubscriptionNotificationV2SignedPayload struct { |
| 56 | + SignedPayload string `json:"signedPayload"` |
| 57 | + } |
| 58 | + |
| 59 | + // SubscriptionNotificationV2DecodedPayload is struct |
| 60 | + // https://developer.apple.com/documentation/appstoreservernotifications/responsebodyv2decodedpayload |
| 61 | + SubscriptionNotificationV2DecodedPayload struct { |
| 62 | + NotificationType NotificationTypeV2 `json:"notificationType"` |
| 63 | + Subtype SubtypeV2 `json:"subtype"` |
| 64 | + NotificationUUID string `json:"notificationUUID"` |
| 65 | + NotificationVersion string `json:"notificationVersion"` |
| 66 | + Data SubscriptionNotificationV2Data `json:"data"` |
| 67 | + } |
| 68 | + |
| 69 | + // SubscriptionNotificationV2Data is struct |
| 70 | + // https://developer.apple.com/documentation/appstoreservernotifications/data |
| 71 | + SubscriptionNotificationV2Data struct { |
| 72 | + AppAppleID int `json:"appAppleId"` |
| 73 | + BundleID string `json:"bundleId"` |
| 74 | + BundleVersion string `json:"bundleVersion"` |
| 75 | + Environment string `json:"environment"` |
| 76 | + SignedRenewalInfo string `json:"signedRenewalInfo"` |
| 77 | + SignedTransactionInfo string `json:"signedTransactionInfo"` |
| 78 | + } |
| 79 | + |
| 80 | + // SubscriptionNotificationV2JWSDecodedHeader is struct |
| 81 | + SubscriptionNotificationV2JWSDecodedHeader struct { |
| 82 | + Alg string `json:"alg"` |
| 83 | + Kid string `json:"kid"` |
| 84 | + X5c []string `json:"x5c"` |
| 85 | + } |
| 86 | +) |
0 commit comments