Files
utility_go/package/pay/playstore/notification.go
2025-02-28 17:45:44 +08:00

63 lines
4.2 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package playstore
// SubscriptionNotificationType 定义了订阅通知的类型。
type SubscriptionNotificationType int
// 预定义的订阅通知类型。
const (
SubscriptionNotificationTypeRecovered SubscriptionNotificationType = iota + 1 // 订阅已恢复
SubscriptionNotificationTypeRenewed // 订阅已续订
SubscriptionNotificationTypeCanceled // 订阅已取消
SubscriptionNotificationTypePurchased // 订阅已购买
SubscriptionNotificationTypeAccountHold // 订阅账户暂停
SubscriptionNotificationTypeGracePeriod // 宽限期通知
SubscriptionNotificationTypeRestarted // 订阅已重新开始
SubscriptionNotificationTypePriceChangeConfirmed // 订阅价格变更已确认
SubscriptionNotificationTypeDeferred // 订阅延迟
SubscriptionNotificationTypePaused // 订阅已暂停
SubscriptionNotificationTypePauseScheduleChanged // 暂停计划已更改
SubscriptionNotificationTypeRevoked // 订阅已撤销
SubscriptionNotificationTypeExpired // 订阅已过期
)
// OneTimeProductNotificationType 定义了一次性产品通知的类型。
type OneTimeProductNotificationType int
// 预定义的一次性产品通知类型。
const (
OneTimeProductNotificationTypePurchased OneTimeProductNotificationType = iota + 1 // 一次性产品已购买
OneTimeProductNotificationTypeCanceled // 一次性产品已取消
)
// DeveloperNotification 是通过 Pub/Sub 主题发送给开发者的通知。
// 详细描述请参见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"` // 订阅通知
OneTimeProductNotification OneTimeProductNotification `json:"oneTimeProductNotification,omitempty"` // 一次性产品通知
TestNotification TestNotification `json:"testNotification,omitempty"` // 测试通知
}
// SubscriptionNotification 包含订阅状态通知类型、token 和订阅ID用于通过Google Android Publisher API确认状态。
type SubscriptionNotification struct {
Version string `json:"version"` // 版本号
NotificationType SubscriptionNotificationType `json:"notificationType,omitempty"` // 通知类型
PurchaseToken string `json:"purchaseToken,omitempty"` // 购买token
SubscriptionID string `json:"subscriptionId,omitempty"` // 订阅ID
}
// OneTimeProductNotification 包含一次性产品状态通知类型、token 和产品IDSKU用于通过Google Android Publisher API确认状态。
type OneTimeProductNotification struct {
Version string `json:"version"` // 版本号
NotificationType OneTimeProductNotificationType `json:"notificationType,omitempty"` // 通知类型
PurchaseToken string `json:"purchaseToken,omitempty"` // 购买token
SKU string `json:"sku,omitempty"` // 产品IDSKU
}
// TestNotification 是仅通过Google Play开发者控制台发送的测试发布通知。
type TestNotification struct {
Version string `json:"version"` // 版本号
}