Documentation
¶
Index ¶
- func NewServer(addr, secret string, matcher ExpiringSubscriptions, fetch SubscriptionFetch, ...) *server
- type AutoRenewEvent
- type Env
- type Event
- func (evt Event) AdvertisingID() string
- func (evt Event) AutoRenewChangedAt() time.Time
- func (evt Event) AutoRenewProduct() string
- func (evt Event) AutoRenewStatus() bool
- func (evt Event) CancelledAt() time.Time
- func (evt Event) Currency() string
- func (evt Event) DeviceIP() string
- func (evt Event) Email() string
- func (evt Event) ExpiresAt() time.Time
- func (evt Event) FacebookID() string
- func (evt Event) FirstName() string
- func (evt Event) GetString(key string) string
- func (evt Event) GracePeriodEndsAt() (time.Time, bool)
- func (evt Event) ImageURL() string
- func (evt Event) IsTrialPeriod() bool
- func (evt Event) LastName() string
- func (evt Event) OriginalTransactionID() string
- func (evt Event) PaidAt() time.Time
- func (evt Event) PremiumAccess() bool
- func (evt Event) Price() float64
- func (evt Event) ProductID() string
- func (evt Event) RefundedAt() time.Time
- func (evt *Event) SetNote(note Note)
- func (evt *Event) SetReceiptInfo(resp receipt.Info)
- func (evt *Event) SetRevenue(currency string, price float64)
- func (evt *Event) SetStartedTrialAt(startedTrialAt time.Time)
- func (evt *Event) SetUser(user User)
- func (evt Event) SignedUpAt() time.Time
- func (evt Event) StartedTrialAt() time.Time
- func (evt Event) Status() int
- func (evt Event) String() string
- func (evt Event) UserID() string
- type EventListener
- type ExpiringSubscriptions
- type MultiEventListener
- func (multi *MultiEventListener) Add(l EventListener)
- func (multi MultiEventListener) ChangedAutoRenewProduct(evt AutoRenewEvent) error
- func (multi MultiEventListener) ChangedAutoRenewStatus(evt AutoRenewEvent) error
- func (multi *MultiEventListener) Name() string
- func (multi MultiEventListener) Paid(evt PayEvent) error
- func (multi MultiEventListener) Refunded(evt RefundEvent) error
- func (multi MultiEventListener) StartedTrial(evt StartTrialEvent) error
- type Note
- type NoteType
- type Notification
- type PayEvent
- type RefundEvent
- type StartTrialEvent
- type Subscription
- type SubscriptionFetch
- type SubscriptionUpdater
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewServer ¶
func NewServer(addr, secret string, matcher ExpiringSubscriptions, fetch SubscriptionFetch, updater SubscriptionUpdater, interval time.Duration) *server
Types ¶
type AutoRenewEvent ¶
type AutoRenewEvent interface {
Subscription
AutoRenewProduct() string
AutoRenewChangedAt() time.Time
}
type Event ¶
type Event struct {
// contains filtered or unexported fields
}
func (Event) AdvertisingID ¶
func (Event) AutoRenewChangedAt ¶
func (Event) AutoRenewProduct ¶
func (Event) AutoRenewStatus ¶
func (Event) CancelledAt ¶
func (Event) FacebookID ¶
func (Event) IsTrialPeriod ¶
func (Event) OriginalTransactionID ¶
func (Event) PremiumAccess ¶
func (Event) RefundedAt ¶
func (*Event) SetReceiptInfo ¶
func (*Event) SetRevenue ¶
func (*Event) SetStartedTrialAt ¶
func (Event) SignedUpAt ¶
func (Event) StartedTrialAt ¶
type EventListener ¶
type EventListener interface {
// Name describes the listener for identification in the logs
Name() string
// ChangedAutoRenewProduct indicates the next renewal period's product ID
ChangedAutoRenewProduct(AutoRenewEvent) error
// ChangedAutoRenewStatus indicates new on/off state
ChangedAutoRenewStatus(AutoRenewEvent) error
// Paid indicates a successful charge
Paid(PayEvent) error
// Refunded indicates App Store customer support issued a subscription refund of some sort
Refunded(RefundEvent) error
// StartedTrial indicates a subscription free trial began
StartedTrial(StartTrialEvent) error
}
type ExpiringSubscriptions ¶
ExpiringSubscriptions returns a list of App Store receipts for subscriptions nearing expiration for a specified current time.
type MultiEventListener ¶
type MultiEventListener struct {
// contains filtered or unexported fields
}
func NewMultiEventListener ¶
func NewMultiEventListener() *MultiEventListener
func (*MultiEventListener) Add ¶
func (multi *MultiEventListener) Add(l EventListener)
func (MultiEventListener) ChangedAutoRenewProduct ¶
func (multi MultiEventListener) ChangedAutoRenewProduct(evt AutoRenewEvent) error
func (MultiEventListener) ChangedAutoRenewStatus ¶
func (multi MultiEventListener) ChangedAutoRenewStatus(evt AutoRenewEvent) error
func (*MultiEventListener) Name ¶
func (multi *MultiEventListener) Name() string
func (MultiEventListener) Paid ¶
func (multi MultiEventListener) Paid(evt PayEvent) error
func (MultiEventListener) Refunded ¶
func (multi MultiEventListener) Refunded(evt RefundEvent) error
func (MultiEventListener) StartedTrial ¶
func (multi MultiEventListener) StartedTrial(evt StartTrialEvent) error
type NoteType ¶
type NoteType string
const ( Cancel NoteType = "CANCEL" DidChangeRenewalPref NoteType = "DID_CHANGE_RENEWAL_PREF" InitialBuy NoteType = "INITIAL_BUY" InteractiveRenewal NoteType = "INTERACTIVE_RENEWAL" Renewal NoteType = "RENEWAL" // Introduced in June 2019 at WWDC DidChangeRenewalStatus NoteType = "DID_CHANGE_RENEWAL_STATUS" DidFailToRenew NoteType = "DID_FAIL_TO_RENEW" )
type Notification ¶
type Notification struct {
Env Env `json:"environment"`
NotificationType NoteType `json:"notification_type"`
Password string `json:"password"`
CancellationDate *receipt.Millistamp `json:"cancellation_date_ms,string,omitempty"`
WebOrderLineItemID string `json:"web_order_line_item_id"`
LatestReceipt string `json:"latest_receipt,omitempty"`
LatestReceiptInfo receiptInfo `json:"latest_receipt_info,omitempty"`
LatestExpiredReceipt string `json:"latest_expired_receipt,omitempty"`
LatestExpiredReceiptInfo *receiptInfo `json:"latest_expired_receipt_info,omitempty"`
AutoRenewStatus bool `json:"auto_renew_status,string"`
AutoRenewStatusChangedAt receipt.Millistamp `json:"auto_renew_status_change_date_ms,string,omitempty"`
AutoRenewAdamID string `json:"auto_renew_adam_id"`
AutoRenewProductID string `json:"auto_renew_product_id"`
ExpirationIntent string `json:"expiration_intent"`
UnifiedReceipt receipt.Unified `json:"unified_receipt"`
}
type PayEvent ¶
type PayEvent interface {
Subscription
PaidAt() time.Time
}
type RefundEvent ¶
type RefundEvent interface {
Subscription
RefundedAt() time.Time
}
type StartTrialEvent ¶
type StartTrialEvent interface {
Subscription
StartedTrialAt() time.Time
}
type Subscription ¶
type SubscriptionFetch ¶
type SubscriptionFetch func(string) (Subscription, error)
SubscriptionFetch returns the last known state of a subscription by original transaction ID, which can determine what changes have happened when compared to the latest receipt info.
type SubscriptionUpdater ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.