subscription

package
v0.0.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2022 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const ROUTE_GROUP = "/subscriptions"

Variables

This section is empty.

Functions

This section is empty.

Types

type CancelSubscriptionResponse

type CancelSubscriptionResponse struct {
	Data struct {
		ID          string    `json:"id"`
		Status      string    `json:"status"`
		StartedAt   time.Time `json:"started_at"`
		CancelledAt time.Time `json:"cancelled_at"`
	} `json:"data"`
}

type CreateSubscriptionLinkRequestPayload

type CreateSubscriptionLinkRequestPayload struct {
	Plan              Plan      `json:"plan"`
	Customer          Customer  `json:"customer"`
	BillingCycleCount int       `json:"billing_cycle_count"`
	StartedAt         time.Time `json:"started_at"`
	ChargeType        string    `json:"charge_type"`
	Notes             string    `json:"notes"`
}

type CreateSubscriptionLinkResponse

type CreateSubscriptionLinkResponse struct {
	Data struct {
		ID   string `json:"id"`
		Plan struct {
			ID                 string `json:"id"`
			Name               string `json:"name"`
			BillingPeriod      string `json:"billing_period"`
			BillingPeriodCount int    `json:"billing_period_count"`
			GracePeriod        string `json:"grace_period"`
			GracePeriodCount   int    `json:"grace_period_count"`
			Price              string `json:"price"`
			Qty                string `json:"qty"`
			Amount             string `json:"amount"`
			SubscriptionRefID  string `json:"subscription_ref_id"`
		} `json:"plan"`
		Customer struct {
			ID         string `json:"id"`
			Email      string `json:"email"`
			Mobile     string `json:"mobile"`
			GivenName  string `json:"given_name"`
			MiddleName string `json:"middle_name"`
			SurName    string `json:"sur_name"`
		} `json:"customer"`
		Status             string    `json:"status"`
		StartedAt          time.Time `json:"started_at"`
		NextDueAt          time.Time `json:"next_due_at"`
		SubscriptionOrders []struct {
			BillingPeriod int    `json:"billing_period"`
			OrderID       string `json:"order_id"`
			Status        string `json:"status"`
		} `json:"subscription_orders"`
		ChargeType string `json:"charge_type"`
		Link       string `json:"link"`
	} `json:"data"`
}

type Customer

type Customer struct {
	Email      string `json:"email"`
	Mobile     string `json:"mobile"`
	GivenName  string `json:"given_name"`
	MiddleName string `json:"middle_name"`
	SurName    string `json:"sur_name"`
}

type FetchSubscriptionByIdResponse

type FetchSubscriptionByIdResponse struct {
	Data struct {
		ID   string `json:"id"`
		Plan struct {
			ID                 string `json:"id"`
			Name               string `json:"name"`
			BillingPeriod      string `json:"billing_period"`
			BillingPeriodCount int    `json:"billing_period_count"`
			GracePeriod        string `json:"grace_period"`
			GracePeriodCount   int    `json:"grace_period_count"`
			Price              string `json:"price"`
			SubscriptionRefID  string `json:"subscription_ref_id"`
		} `json:"plan"`
		ChargeType        string    `json:"charge_type"`
		Status            string    `json:"status"`
		StartedAt         time.Time `json:"started_at"`
		NextDueDate       time.Time `json:"next_due_date"`
		BillingCycleCount int       `json:"billing_cycle_count"`
		Amount            string    `json:"amount"`
		ActiveOrderID     string    `json:"active_order_id"`
		Link              string    `json:"link"`
	} `json:"data"`
}

type FetchSubscriptionResponse

type FetchSubscriptionResponse struct {
	Data struct {
		Subscription []struct {
			ID                 string    `json:"id"`
			Status             string    `json:"status"`
			ChargeType         string    `json:"charge_type"`
			Name               string    `json:"name"`
			StartedAt          time.Time `json:"started_at"`
			BillingPeriod      string    `json:"billing_period"`
			BillingPeriodCount int       `json:"billing_period_count"`
			Customer           struct {
				ID         string `json:"id"`
				Email      string `json:"email"`
				Mobile     string `json:"mobile"`
				GivenName  string `json:"given_name"`
				MiddleName string `json:"middle_name"`
				SurName    string `json:"sur_name"`
			} `json:"customer"`
		} `json:"subscription"`
		Count int `json:"count"`
	} `json:"data"`
}

type Plan

type Plan struct {
	SubscriptionRefID  string `json:"subscription_ref_id"`
	Name               string `json:"name"`
	BillingPeriod      string `json:"billing_period"`
	BillingPeriodCount int    `json:"billing_period_count"`
	GracePeriod        string `json:"grace_period"`
	GracePeriodCount   int    `json:"grace_period_count"`
	Price              string `json:"price"`
	Qty                string `json:"qty"`
}

type Subscription

type Subscription struct {
	*common.Agent
}

func (*Subscription) CancelSubscription

func (s *Subscription) CancelSubscription(ctx context.Context, subscriptionId string) (res *CancelSubscriptionResponse, err error)

func (*Subscription) FetchSubscription

func (s *Subscription) FetchSubscription(ctx context.Context) (res *FetchSubscriptionResponse, err error)

func (*Subscription) FetchSubscriptionById

func (s *Subscription) FetchSubscriptionById(ctx context.Context, subscriptionId string) (res *FetchSubscriptionByIdResponse, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL