Skip to content

Commit e983905

Browse files
authored
Merge pull request #205 from richzw/master
feat(amazon): add amazon notification model
2 parents 9c4044f + d6cc023 commit e983905

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

amazon/notification.go

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package amazon
2+
3+
// NotificationType is type
4+
// https://developer.amazon.com/docs/in-app-purchasing/rtn-example.html
5+
type NotificationType string
6+
7+
const (
8+
NotificationTypeSubscription = "SUBSCRIPTION_PURCHASED"
9+
NotificationTypeConsumable = "CONSUMABLE_PURCHASED"
10+
NotificationTypeEntitlement = "ENTITLEMENT_PURCHASED"
11+
)
12+
13+
// Notification is struct for amazon notification
14+
type Notification struct {
15+
Type string `json:"Type"`
16+
MessageId string `json:"MessageId"`
17+
TopicArn string `json:"TopicArn"`
18+
Message string `json:"Message"`
19+
Timestamp string `json:"Timestamp"`
20+
SignatureVersion string `json:"SignatureVersion"`
21+
Signature string `json:"Signature"`
22+
SigningCertURL string `json:"SigningCertURL"`
23+
UnsubscribeURL string `json:"UnsubscribeURL"`
24+
}
25+
26+
// NotificationMessage is struct for Message field of Notification
27+
type NotificationMessage struct {
28+
AppPackageName string `json:"appPackageName"`
29+
NotificationType NotificationType `json:"notificationType"`
30+
AppUserId string `json:"appUserId"`
31+
ReceiptId string `json:"receiptId"`
32+
RelatedReceipts struct{} `json:"relatedReceipts"`
33+
Timestamp int64 `json:"timestamp"`
34+
BetaProductTransaction bool `json:"betaProductTransaction"`
35+
}

0 commit comments

Comments
 (0)