Documentation
¶
Index ¶
- type DefaultSubscriptionService
- func (s *DefaultSubscriptionService) Create(subscription *Request) (*Subscription, error)
- func (s *DefaultSubscriptionService) Disable(subscriptionCode, emailToken string) (response.Response, error)
- func (s *DefaultSubscriptionService) Enable(subscriptionCode, emailToken string) (response.Response, error)
- func (s *DefaultSubscriptionService) Get(id int) (*Subscription, error)
- func (s *DefaultSubscriptionService) List() (*List, error)
- func (s *DefaultSubscriptionService) ListN(count, offset int) (*List, error)
- func (s *DefaultSubscriptionService) Update(subscription *Subscription) (*Subscription, error)
- type List
- type Request
- type Service
- type Subscription
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultSubscriptionService ¶
DefaultSubscriptionService handles operations related to the subscription For more details see https://developers.paystack.co/v1.0/reference#create-subscription
func (*DefaultSubscriptionService) Create ¶
func (s *DefaultSubscriptionService) Create(subscription *Request) (*Subscription, error)
Create creates a new subscription For more details see https://developers.paystack.co/v1.0/reference#create-subscription
func (*DefaultSubscriptionService) Disable ¶
func (s *DefaultSubscriptionService) Disable(subscriptionCode, emailToken string) (response.Response, error)
Disable disables a subscription For more details see https://developers.paystack.co/v1.0/reference#disable-subscription
func (*DefaultSubscriptionService) Enable ¶
func (s *DefaultSubscriptionService) Enable(subscriptionCode, emailToken string) (response.Response, error)
Enable enables a subscription For more details see https://developers.paystack.co/v1.0/reference#enable-subscription
func (*DefaultSubscriptionService) Get ¶
func (s *DefaultSubscriptionService) Get(id int) (*Subscription, error)
Get returns the details of a subscription. For more details see https://developers.paystack.co/v1.0/reference#fetch-subscription
func (*DefaultSubscriptionService) List ¶
func (s *DefaultSubscriptionService) List() (*List, error)
List returns a list of subscriptions. For more details see https://developers.paystack.co/v1.0/reference#list-subscriptions
func (*DefaultSubscriptionService) ListN ¶
func (s *DefaultSubscriptionService) ListN(count, offset int) (*List, error)
ListN returns a list of subscriptions For more details see https://developers.paystack.co/v1.0/reference#list-subscriptions
func (*DefaultSubscriptionService) Update ¶
func (s *DefaultSubscriptionService) Update(subscription *Subscription) (*Subscription, error)
Update updates a subscription's properties. For more details see https://developers.paystack.co/v1.0/reference#update-subscription
type List ¶
type List struct {
Meta response.ListMeta
Values []Subscription `json:"data"`
}
List is a list object for subscriptions.
type Request ¶
type Request struct {
// customer code or email address
Customer string `json:"customer,omitempty"`
// plan code
Plan string `json:"plan,omitempty"`
Authorization string `json:"authorization,omitempty"`
StartDate string `json:"start,omitempty"`
}
Request represents a Paystack subscription request
type Service ¶
type Service interface {
Create(subscription *Request) (*Subscription, error)
Update(subscription *Subscription) (*Subscription, error)
Get(id int) (*Subscription, error)
List() (*List, error)
ListN(count, offset int) (*List, error)
Enable(subscriptionCode, emailToken string) (response.Response, error)
Disable(subscriptionCode, emailToken string) (response.Response, error)
}
type Subscription ¶
type Subscription struct {
ID int `json:"id,omitempty"`
CreatedAt string `json:"createdAt,omitempty"`
UpdatedAt string `json:"updatedAt,omitempty"`
Domain string `json:"domain,omitempty"`
Integration int `json:"integration,omitempty"`
// inconsistent API response. Create returns Customer code, Fetch returns an object
Customer interface{} `json:"customer,omitempty"`
Plan string `json:"plan,omitempty"`
StartDate string `json:"start,omitempty"`
// inconsistent API response. Fetch returns string, List returns an object
Authorization interface{} `json:"authorization,omitempty"`
Invoices []interface{} `json:"invoices,omitempty"`
Status string `json:"status,omitempty"`
Quantity int `json:"quantity,omitempty"`
Amount int `json:"amount,omitempty"`
SubscriptionCode string `json:"subscription_code,omitempty"`
EmailToken string `json:"email_token,omitempty"`
EasyCronID string `json:"easy_cron_id,omitempty"`
CronExpression string `json:"cron_expression,omitempty"`
NextPaymentDate string `json:"next_payment_date,omitempty"`
OpenInvoice string `json:"open_invoice,omitempty"`
}
Subscription represents a Paystack subscription For more details see https://developers.paystack.co/v1.0/reference#create-subscription