Documentation ¶
Index ¶
- Constants
- type CheckoutSession
- type CheckoutSessionRequest
- type CheckoutSessionResponse
- type Client
- type Data
- type Error
- type EventData
- type Gateway
- type LineItem
- type Managed
- type MessageAuthConfig
- type MessageAuthenticator
- type Metadata
- type Method
- type NewSubscription
- type Notification
- func (n *Notification) Effect() string
- func (n *Notification) IsNewSub() bool
- func (n *Notification) NtfType() string
- func (n *Notification) OrderID() (uuid.UUID, error)
- func (n *Notification) ShouldCancel() bool
- func (n *Notification) ShouldProcess() bool
- func (n *Notification) ShouldRenew() bool
- func (n *Notification) SubID() (uuid.UUID, error)
- type Payment
- type Subscription
- type SubscriptionCancelled
- type SubscriptionExpired
- type SubscriptionPayment
- type SubscriptionResponse
Constants ¶
View Source
const ( ErrUnsupportedEvent = Error("radom: unsupported event") ErrNoCheckoutSessionData = Error("radom: no checkout session data") ErrBraveOrderIDNotFound = Error("radom: brave order id not found") ErrNoRadomPaymentData = Error("radom: no radom payment data") ErrDisabled = Error("radom: disabled") ErrVerificationKeyEmpty = Error("radom: verification key is empty") ErrVerificationKeyInvalid = Error("radom: verification key is invalid") )
View Source
const ErrSubPaymentsEmpty = Error("radom: subscription payments empty")
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CheckoutSession ¶
type CheckoutSessionRequest ¶
type CheckoutSessionResponse ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CreateCheckoutSession ¶
func (c *Client) CreateCheckoutSession(ctx context.Context, creq *CheckoutSessionRequest) (CheckoutSessionResponse, error)
func (*Client) GetSubscription ¶
type Data ¶
type Data struct { CheckoutSession *CheckoutSession `json:"checkoutSession"` Subscription *Subscription `json:"subscription"` }
type EventData ¶
type EventData struct { New *NewSubscription `json:"newSubscription"` Payment *SubscriptionPayment `json:"subscriptionPayment"` Cancelled *SubscriptionCancelled `json:"subscriptionCancelled"` Expired *SubscriptionExpired `json:"subscriptionExpired"` }
type MessageAuthConfig ¶
type MessageAuthenticator ¶
type MessageAuthenticator struct {
// contains filtered or unexported fields
}
func NewMessageAuthenticator ¶
func NewMessageAuthenticator(cfg MessageAuthConfig) *MessageAuthenticator
func (*MessageAuthenticator) Authenticate ¶
func (r *MessageAuthenticator) Authenticate(_ context.Context, token string) error
type NewSubscription ¶
type Notification ¶
type Notification struct { EventType string `json:"eventType"` EventData *EventData `json:"eventData"` RadomData *Data `json:"radomData"` }
func ParseNotification ¶
func ParseNotification(b []byte) (*Notification, error)
func (*Notification) Effect ¶
func (n *Notification) Effect() string
func (*Notification) IsNewSub ¶
func (n *Notification) IsNewSub() bool
func (*Notification) NtfType ¶
func (n *Notification) NtfType() string
func (*Notification) ShouldCancel ¶
func (n *Notification) ShouldCancel() bool
func (*Notification) ShouldProcess ¶
func (n *Notification) ShouldProcess() bool
func (*Notification) ShouldRenew ¶
func (n *Notification) ShouldRenew() bool
type Subscription ¶
type SubscriptionCancelled ¶
type SubscriptionExpired ¶
type SubscriptionPayment ¶
type SubscriptionPayment struct {
RadomData *Data `json:"radomData"`
}
type SubscriptionResponse ¶
type SubscriptionResponse struct { ID string `json:"id"` NextBillingDateAt string `json:"nextBillingDateAt"` Payments []Payment `json:"payments"` }
func (*SubscriptionResponse) LastPaid ¶
func (s *SubscriptionResponse) LastPaid() (time.Time, error)
func (*SubscriptionResponse) NextBillingDate ¶
func (s *SubscriptionResponse) NextBillingDate() (time.Time, error)
Click to show internal directories.
Click to hide internal directories.