Merge pull request #120 from OmarElGabry/play-store-one-time-prod-notification
Update the developer notification struct to include one time products
This commit is contained in:
@@ -1,39 +1,63 @@
|
||||
package playstore
|
||||
|
||||
// https://developer.android.com/google/play/billing/rtdn-reference#sub
|
||||
type SubscriptionNotificationType int
|
||||
|
||||
const (
|
||||
SubscriptionNotificationTypeRecovered SubscriptionNotificationType = iota + 1
|
||||
SubscriptionNotificationTypeRenewed
|
||||
SubscriptionNotificationTypeCanceled
|
||||
SubscriptionNotificationTypePurchased
|
||||
SubscriptionNotificationTypeAccountHold
|
||||
SubscriptionNotificationTypeGracePeriod
|
||||
SubscriptionNotificationTypeRestarted
|
||||
SubscriptionNotificationTypePriceChangeConfirmed
|
||||
SubscriptionNotificationTypeDeferred
|
||||
SubscriptionNotificationTypePaused
|
||||
SubscriptionNotificationTypePauseScheduleChanged
|
||||
SubscriptionNotificationTypeRevoked
|
||||
SubscriptionNotificationTypeExpired
|
||||
)
|
||||
|
||||
// https://developer.android.com/google/play/billing/rtdn-reference#one-time
|
||||
type OneTimeProductNotificationType int
|
||||
|
||||
const (
|
||||
OneTimeProductNotificationTypePurchased OneTimeProductNotificationType = iota + 1
|
||||
OneTimeProductNotificationTypeCanceled
|
||||
)
|
||||
|
||||
// DeveloperNotification is sent by a Pub/Sub topic.
|
||||
// Detailed description is following.
|
||||
// https://developer.android.com/google/play/billing/realtime_developer_notifications.html#json_specification
|
||||
// https://developer.android.com/google/play/billing/rtdn-reference#json_specification
|
||||
type DeveloperNotification struct {
|
||||
Version string `json:"version"`
|
||||
PackageName string `json:"packageName"`
|
||||
EventTimeMillis string `json:"eventTimeMillis"`
|
||||
SubscriptionNotification SubscriptionNotification `json:"subscriptionNotification,omitempty"`
|
||||
TestNotification SubscriptionNotification `json:"testNotification,omitempty"`
|
||||
OneTimeProductNotification OneTimeProductNotification `json:"oneTimeProductNotification,omitempty"`
|
||||
TestNotification TestNotification `json:"testNotification,omitempty"`
|
||||
}
|
||||
|
||||
// SubscriptionNotification has subscription status as notificationType, toke and subscription id
|
||||
// SubscriptionNotification has subscription status as notificationType, token and subscription id
|
||||
// to confirm status by calling Google Android Publisher API.
|
||||
type SubscriptionNotification struct {
|
||||
Version string `json:"version"`
|
||||
NotificationType NotificationType `json:"notificationType,omitempty"`
|
||||
NotificationType SubscriptionNotificationType `json:"notificationType,omitempty"`
|
||||
PurchaseToken string `json:"purchaseToken,omitempty"`
|
||||
SubscriptionID string `json:"subscriptionId,omitempty"`
|
||||
}
|
||||
|
||||
type NotificationType int
|
||||
// OneTimeProductNotification has one-time product status as notificationType, token and sku (product id)
|
||||
// to confirm status by calling Google Android Publisher API.
|
||||
type OneTimeProductNotification struct {
|
||||
Version string `json:"version"`
|
||||
NotificationType OneTimeProductNotificationType `json:"notificationType,omitempty"`
|
||||
PurchaseToken string `json:"purchaseToken,omitempty"`
|
||||
SKU string `json:"sku,omitempty"`
|
||||
}
|
||||
|
||||
const (
|
||||
NotificationTypeRecovered NotificationType = iota + 1
|
||||
NotificationTypeRenewed
|
||||
NotificationTypeCanceled
|
||||
NotificationTypePurchased
|
||||
NotificationTypeAccountHold
|
||||
NotificationTypeGracePeriod
|
||||
NotificationTypeRestarted
|
||||
NotificationTypePriceChangeConfirmed
|
||||
NotificationTypeDeferred
|
||||
NotificationTypePaused
|
||||
NotificationTypePauseScheduleChanged
|
||||
NotificationTypeRevoked
|
||||
NotificationTypeExpired
|
||||
)
|
||||
// TestNotification is the test publish that are sent only through the Google Play Developer Console
|
||||
type TestNotification struct {
|
||||
Version string `json:"version"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user