lago

package module
v0.39.0-beta Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: MIT Imports: 13 Imported by: 3

README

Lago Go Client

This is a Go wrapper for Lago API

Installation

go get github.com/getlago/lago-go-client@v0.15.2-alpha

Usage

Check the lago API reference

Development

  • Fork the repository
  • Open a Pull Request

Documentation

The Lago documentation is available at doc.getlago.com.

Contributing

The contribution documentation is available here

License

Lago Go client is distributed under MIT license.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorTypeAssert = Error{
	Err:            errors.New("type assertion failed"),
	HTTPStatusCode: http.StatusUnprocessableEntity,
	Msg:            "type assertion failed",
}

Functions

This section is empty.

Types

type AddOn

type AddOn struct {
	LagoID      uuid.UUID `json:"lago_id,omitempty"`
	Name        string    `json:"name,omitempty"`
	Code        string    `json:"code,omitempty"`
	Description string    `json:"description,omitempty"`

	AmountCents    int      `json:"amount_cents,omitempty"`
	AmountCurrency Currency `json:"amount_currency,omitempty"`

	CreatedAt time.Time `json:"created_at,omitempty"`
}

type AddOnInput

type AddOnInput struct {
	Name        string `json:"name,omitempty"`
	Code        string `json:"code,omitempty"`
	Description string `json:"description,omitempty"`

	AmountCents    int      `json:"amount_cents,omitempty"`
	AmountCurrency Currency `json:"amount_currency,omitempty"`
}

type AddOnListInput

type AddOnListInput struct {
	PerPage int `json:"per_page,omitempty,string"`
	Page    int `json:"page,omitempty,string"`
}

type AddOnParams

type AddOnParams struct {
	AddOn *AddOnInput `json:"add_on"`
}

type AddOnRequest

type AddOnRequest struct {
	// contains filtered or unexported fields
}

func (*AddOnRequest) ApplyToCustomer

func (adr *AddOnRequest) ApplyToCustomer(ctx context.Context, applyAddOnInput *ApplyAddOnInput) (*AppliedAddOn, *Error)

func (*AddOnRequest) Create

func (adr *AddOnRequest) Create(ctx context.Context, addOnInput *AddOnInput) (*AddOn, *Error)

func (*AddOnRequest) Delete

func (adr *AddOnRequest) Delete(ctx context.Context, addOnCode string) (*AddOn, *Error)

func (*AddOnRequest) Get

func (adr *AddOnRequest) Get(ctx context.Context, addOnCode string) (*AddOn, *Error)

func (*AddOnRequest) GetList

func (adr *AddOnRequest) GetList(ctx context.Context, addOnListInput *AddOnListInput) (*AddOnResult, *Error)

func (*AddOnRequest) Update

func (adr *AddOnRequest) Update(ctx context.Context, addOnInput *AddOnInput) (*AddOn, *Error)

type AddOnResult

type AddOnResult struct {
	AddOn  *AddOn   `json:"add_on,omitempty"`
	AddOns []AddOn  `json:"add_ons,omitempty"`
	Meta   Metadata `json:"meta,omitempty"`
}

type AggregationType

type AggregationType string
const (
	CountAggregation          AggregationType = "count_agg"
	SumAggregation            AggregationType = "sum_agg"
	MaxAggregation            AggregationType = "max_agg"
	UniqueCountAggregation    AggregationType = "unique_count_agg"
	RecurringCountAggregation AggregationType = "recurring_count_agg"
)

type AppliedAddOn

type AppliedAddOn struct {
	LagoID             uuid.UUID `json:"lago_id,omitempty"`
	LagoAddOnID        uuid.UUID `json:"lago_add_on_id,omitempty"`
	LagoCustomerID     uuid.UUID `json:"lago_customer_id,omitempty"`
	ExternalCustomerID string    `json:"external_customer_id,omitempty"`

	AddOnCode      string   `json:"add_on_code,omitempty"`
	AmountCents    int      `json:"amount_cents,omitempty"`
	AmountCurrency Currency `json:"amount_currency,omitempty"`

	CreatedAt time.Time `json:"created_at,omitempty"`
}

type AppliedAddOnResult

type AppliedAddOnResult struct {
	AppliedAddOn *AppliedAddOn `json:"applied_add_on,omitempty"`
}

type AppliedCoupon

type AppliedCoupon struct {
	LagoID             uuid.UUID           `json:"lago_id,omitempty"`
	LagoCouponID       uuid.UUID           `json:"lago_coupon_id,omitempty"`
	ExternalCustomerID string              `json:"external_customer_id,omitempty"`
	LagoCustomerID     uuid.UUID           `json:"lago_customer_id,omitempty"`
	Status             AppliedCouponStatus `json:"status,omitempty"`

	CouponCode     string   `json:"coupon_code,omitempty"`
	AmountCents    int      `json:"amount_cents,omitempty"`
	AmountCurrency Currency `json:"amount_currency,omitempty"`

	ExpirationDate string    `json:"expiration_date,omitempty"`
	TerminatedAt   time.Time `json:"terminated_at,omitempty"`

	PercentageRate    float64         `json:"percentage_rate,omitempty,string"`
	Frequency         CouponFrequency `json:"frequency,omitempty"`
	FrequencyDuration int             `json:"frequency_duration,omitempty"`

	AmountCentsRemaining       int `json:"amount_cents_remaining,omitempty"`
	FrequencyDurationRemaining int `json:"frequency_duration_remaining,omitempty"`

	Credits []InvoiceCredit `json:"credits,omitempty"`
}

type AppliedCouponListInput

type AppliedCouponListInput struct {
	PerPage            int                 `json:"per_page,omitempty,string"`
	Page               int                 `json:"page,omitempty,string"`
	Status             AppliedCouponStatus `json:"status,omitempty"`
	ExternalCustomerID string              `json:"external_customer_id,omitempty"`
}

type AppliedCouponRequest

type AppliedCouponRequest struct {
	// contains filtered or unexported fields
}

func (*AppliedCouponRequest) AppliedCouponDelete

func (acr *AppliedCouponRequest) AppliedCouponDelete(ctx context.Context, externalCustomerID string, appliedCouponID string) (*AppliedCoupon, *Error)

func (*AppliedCouponRequest) GetList

func (cr *AppliedCouponRequest) GetList(ctx context.Context, appliedCouponListInput *AppliedCouponListInput) (*AppliedCouponResult, *Error)

type AppliedCouponResult

type AppliedCouponResult struct {
	AppliedCoupon  *AppliedCoupon  `json:"applied_coupon,omitempty"`
	AppliedCoupons []AppliedCoupon `json:"applied_coupons,omitempty"`
	Meta           Metadata        `json:"meta,omitempty"`
}

type AppliedCouponStatus

type AppliedCouponStatus string
const (
	AppliedCouponStatusActive     AppliedCouponStatus = "active"
	AppliedCouponStatusTerminated AppliedCouponStatus = "terminated"
)

type AppliedTax

type AppliedTax struct {
	LagoID         uuid.UUID `json:"lago_id,omitempty"`
	LagoCustomerID uuid.UUID `json:"lago_customer_id,omitempty"`
	LagoTaxID      uuid.UUID `json:"lago_tax_id,omitempty"`

	TaxCode string `json:"tax_code,omitempty"`

	ExternalCustomerID string `json:"external_customer_id,omitempty"`

	CreatedAt time.Time `json:"created_at,omitempty"`
}

type AppliedTaxInput

type AppliedTaxInput struct {
	TaxCode string `json:"tax__code,omitempty"`
}

type AppliedTaxParams

type AppliedTaxParams struct {
	AppliedTax *AppliedTaxInput `json:"applied_tax"`
}

type AppliedTaxRequest

type AppliedTaxRequest struct {
	// contains filtered or unexported fields
}

func (*AppliedTaxRequest) Create

func (adr *AppliedTaxRequest) Create(ctx context.Context, externalCustomerID string, appliedTaxInput *AppliedTaxInput) (*AppliedTax, *Error)

func (*AppliedTaxRequest) Delete

func (adr *AppliedTaxRequest) Delete(ctx context.Context, externalCustomerID string, taxCode string) (*AppliedTax, *Error)

type AppliedTaxResult

type AppliedTaxResult struct {
	AppliedTax *AppliedTax `json:"applied_tax,omitempty"`
	Meta       Metadata    `json:"meta,omitempty"`
}

type ApplyAddOnInput

type ApplyAddOnInput struct {
	ExternalCustomerID string   `json:"external_customer_id,omitempty"`
	AddOnCode          string   `json:"add_on_code,omitempty"`
	AmountCents        int      `json:"amount_cents,omitempty"`
	AmountCurrency     Currency `json:"amount_currency,omitempty"`
}

type ApplyAddOnParams

type ApplyAddOnParams struct {
	AppliedAddOn *ApplyAddOnInput `json:"applied_add_on"`
}

type ApplyCouponInput

type ApplyCouponInput struct {
	ExternalCustomerID string          `json:"external_customer_id,omitempty"`
	CouponCode         string          `json:"coupon_code,omitempty"`
	AmountCents        int             `json:"amount_cents,omitempty"`
	AmountCurrency     Currency        `json:"amount_currency,omitempty"`
	PercentageRate     float64         `json:"percentage_rate,omitempty,string"`
	Frequency          CouponFrequency `json:"frequency,omitempty"`
	FrequencyDuration  int             `json:"frequency_duration,omitempty"`
}

type ApplyCouponParams

type ApplyCouponParams struct {
	AppliedCoupon *ApplyCouponInput `json:"applied_coupon"`
}

type BillableMetric

type BillableMetric struct {
	LagoID                   uuid.UUID              `json:"lago_id"`
	Name                     string                 `json:"name,omitempty"`
	Code                     string                 `json:"code,omitempty"`
	Description              string                 `json:"description,omitempty"`
	AggregationType          AggregationType        `json:"aggregation_type,omitempty"`
	FieldName                string                 `json:"field_name"`
	CreatedAt                time.Time              `json:"created_at,omitempty"`
	Group                    map[string]interface{} `json:"group,omitempty"`
	ActiveSubscriptionsCount int                    `json:"active_subscriptions_count,omitempty"`
	DraftInvoicesCount       int                    `json:"draft_invoices_count,omitempty"`
	PlansCount               int                    `json:"plans_count,omitempty"`
}

type BillableMetricInput

type BillableMetricInput struct {
	Name            string                 `json:"name,omitempty"`
	Code            string                 `json:"code,omitempty"`
	Description     string                 `json:"description,omitempty"`
	AggregationType AggregationType        `json:"aggregation_type,omitempty"`
	FieldName       string                 `json:"field_name"`
	Group           map[string]interface{} `json:"group,omitempty"`
}

type BillableMetricListInput

type BillableMetricListInput struct {
	PerPage int `json:"per_page,omitempty,string"`
	Page    int `json:"page,omitempty,string"`
}

type BillableMetricParams

type BillableMetricParams struct {
	BillableMetricInput *BillableMetricInput `json:"billable_metric,omitempty"`
}

type BillableMetricRequest

type BillableMetricRequest struct {
	// contains filtered or unexported fields
}

func (*BillableMetricRequest) Create

func (bmr *BillableMetricRequest) Create(ctx context.Context, billableMetricInput *BillableMetricInput) (*BillableMetric, *Error)

func (*BillableMetricRequest) Delete

func (bmr *BillableMetricRequest) Delete(ctx context.Context, billableMetricCode string) (*BillableMetric, *Error)

func (*BillableMetricRequest) Get

func (bmr *BillableMetricRequest) Get(ctx context.Context, billableMetricCode string) (*BillableMetric, *Error)

func (*BillableMetricRequest) GetList

func (bmr *BillableMetricRequest) GetList(ctx context.Context, billableMetricListInput *BillableMetricListInput) (*BillableMetricResult, *Error)

func (*BillableMetricRequest) Update

func (bmr *BillableMetricRequest) Update(ctx context.Context, billableMetricInput *BillableMetricInput) (*BillableMetric, *Error)

type BillableMetricResult

type BillableMetricResult struct {
	BillableMetric  *BillableMetric  `json:"billable_metric,omitempty"`
	BillableMetrics []BillableMetric `json:"billable_metrics,omitempty"`
	Meta            Metadata         `json:"meta,omitempty"`
}

type BillingTime

type BillingTime string
const (
	Anniversary BillingTime = "anniversary"
	Calendar    BillingTime = "calendar"
)

type Charge

type Charge struct {
	LagoID               uuid.UUID              `json:"lago_id,omitempty"`
	LagoBillableMetricID uuid.UUID              `json:"lago_billable_metric_id,omitempty"`
	BillableMetricCode   string                 `json:"billable_metric_code,omitempty"`
	ChargeModel          ChargeModel            `json:"charge_model,omitempty"`
	CreatedAt            time.Time              `json:"created_at,omitempty"`
	PayInAdvance         bool                   `json:"pay_in_advance,omitempty"`
	Invoiceable          bool                   `json:"invoiceable,omitempty"`
	MinAmountCents       int                    `json:"min_amount_cents,omitempty"`
	Properties           map[string]interface{} `json:"properties,omitempty"`
	GroupProperties      []GroupProperties      `json:"group_properties,omitempty"`
}

type ChargeModel

type ChargeModel string
const (
	StandardChargeModel   ChargeModel = "standard"
	GraduatedChargeModel  ChargeModel = "graduated"
	PackageChargeModel    ChargeModel = "package"
	PercentageChargeModel ChargeModel = "percentage"
)

type Client

type Client struct {
	Debug      bool
	HttpClient *resty.Client
}

func New

func New() *Client

func (*Client) AddOn

func (c *Client) AddOn() *AddOnRequest

func (*Client) AppliedCoupon

func (c *Client) AppliedCoupon() *AppliedCouponRequest

func (*Client) AppliedTax

func (c *Client) AppliedTax() *AppliedTaxRequest

func (*Client) BillableMetric

func (c *Client) BillableMetric() *BillableMetricRequest

func (*Client) Coupon

func (c *Client) Coupon() *CouponRequest

func (*Client) CreditNote

func (c *Client) CreditNote() *CreditNoteRequest

func (*Client) Customer

func (c *Client) Customer() *CustomerRequest

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, cr *ClientRequest) (interface{}, *Error)

func (*Client) Event

func (c *Client) Event() *EventRequest

func (*Client) Fee

func (c *Client) Fee() *FeeRequest

func (*Client) Get

func (c *Client) Get(ctx context.Context, cr *ClientRequest) (interface{}, *Error)

func (*Client) Group

func (c *Client) Group() *GroupRequest

func (*Client) Invoice

func (c *Client) Invoice() *InvoiceRequest

func (*Client) Organization

func (c *Client) Organization() *OrganizationRequest

func (*Client) Plan

func (c *Client) Plan() *PlanRequest

func (*Client) Post

func (c *Client) Post(ctx context.Context, cr *ClientRequest) (interface{}, *Error)

func (*Client) PostWithoutBody

func (c *Client) PostWithoutBody(ctx context.Context, cr *ClientRequest) (interface{}, *Error)

func (*Client) PostWithoutResult

func (c *Client) PostWithoutResult(ctx context.Context, cr *ClientRequest) *Error

func (*Client) Put

func (c *Client) Put(ctx context.Context, cr *ClientRequest) (interface{}, *Error)

func (*Client) SetApiKey

func (c *Client) SetApiKey(apiKey string) *Client

func (*Client) SetBaseURL

func (c *Client) SetBaseURL(url string) *Client

func (*Client) SetDebug

func (c *Client) SetDebug(debug bool) *Client

func (*Client) Subscription

func (c *Client) Subscription() *SubscriptionRequest

func (*Client) Tax

func (c *Client) Tax() *TaxRequest

func (*Client) Wallet

func (c *Client) Wallet() *WalletRequest

func (*Client) WalletTransaction

func (c *Client) WalletTransaction() *WalletTransactionRequest

func (*Client) Webhook

func (c *Client) Webhook() *WebhookRequest

type ClientRequest

type ClientRequest struct {
	Path        string
	QueryParams map[string]string
	Result      interface{}
	Body        interface{}
}

type Coupon

type Coupon struct {
	LagoID                 uuid.UUID             `json:"lago_id,omitempty"`
	Name                   string                `json:"name,omitempty"`
	Code                   string                `json:"code,omitempty"`
	Description            string                `json:"description,omitempty"`
	AmountCents            int                   `json:"amount_cents,omitempty"`
	AmountCurrency         Currency              `json:"amount_currency,omitempty"`
	Expiration             CouponExpiration      `json:"expiration,omitempty"`
	ExpirationDate         string                `json:"expiration_date,omitempty"`
	PercentageRate         float64               `json:"percentage_rate,omitempty,string"`
	CouponType             CouponCalculationType `json:"coupon_type,omitempty"`
	Frequency              CouponFrequency       `json:"frequency,omitempty"`
	Reusable               bool                  `json:"reusable,omitempty"`
	LimitedPlans           bool                  `json:"limited_plans,omitempty"`
	PlanCodes              []string              `json:"plan_codes,omitempty"`
	LimitedBillableMetrics bool                  `json:"limited_billable_metrics,omitempty"`
	BillableMetricCodes    []string              `json:"billable_metric_codes,omitempty"`
	FrequencyDuration      int                   `json:"frequency_duration,omitempty"`
	CreatedAt              time.Time             `json:"created_at,omitempty"`
}

type CouponCalculationType

type CouponCalculationType string
const (
	CouponTypeFixedAmount CouponCalculationType = "fixed_amount"
	CouponTypePercentage  CouponCalculationType = "percentage"
)

type CouponExpiration

type CouponExpiration string
const (
	CouponExpirationTimeLimit    CouponExpiration = "time_limit"
	CouponExpirationNoExpiration CouponExpiration = "no_expiration"
)

type CouponFrequency

type CouponFrequency string
const (
	CouponFrequencyOnce      CouponFrequency = "once"
	CouponFrequencyRecurring CouponFrequency = "recurring"
)

type CouponInput

type CouponInput struct {
	Name              string                `json:"name,omitempty"`
	Code              string                `json:"code,omitempty"`
	Description       string                `json:"description,omitempty"`
	AmountCents       int                   `json:"amount_cents,omitempty"`
	AmountCurrency    Currency              `json:"amount_currency,omitempty"`
	Expiration        CouponExpiration      `json:"expiration,omitempty"`
	ExpirationAt      *time.Time            `json:"expiration_at,omitempty"`
	PercentageRate    float64               `json:"percentage_rate,omitempty,string"`
	CouponType        CouponCalculationType `json:"coupon_type,omitempty"`
	Frequency         CouponFrequency       `json:"frequency,omitempty"`
	Reusable          bool                  `json:"reusable,omitempty"`
	FrequencyDuration int                   `json:"frequency_duration,omitempty"`
	AppliesTo         LimitationInput       `json:"applies_to,omitempty"`
}

type CouponListInput

type CouponListInput struct {
	PerPage int `json:"per_page,omitempty,string"`
	Page    int `json:"page,omitempty,string"`
}

type CouponParams

type CouponParams struct {
	Coupon *CouponInput `json:"coupon"`
}

type CouponRequest

type CouponRequest struct {
	// contains filtered or unexported fields
}

func (*CouponRequest) ApplyToCustomer

func (cr *CouponRequest) ApplyToCustomer(ctx context.Context, applyCouponInput *ApplyCouponInput) (*AppliedCoupon, *Error)

func (*CouponRequest) Create

func (cr *CouponRequest) Create(ctx context.Context, couponInput *CouponInput) (*Coupon, *Error)

func (*CouponRequest) Delete

func (cr *CouponRequest) Delete(ctx context.Context, couponCode string) (*Coupon, *Error)

func (*CouponRequest) Get

func (cr *CouponRequest) Get(ctx context.Context, couponCode string) (*Coupon, *Error)

func (*CouponRequest) GetList

func (cr *CouponRequest) GetList(ctx context.Context, couponListInput *CouponListInput) (*CouponResult, *Error)

func (*CouponRequest) Update

func (cr *CouponRequest) Update(ctx context.Context, couponInput *CouponInput) (*Coupon, *Error)

type CouponResult

type CouponResult struct {
	Coupon  *Coupon  `json:"coupon,omitempty"`
	Coupons []Coupon `json:"coupons,omitempty"`
	Meta    Metadata `json:"meta,omitempty"`
}

type CreditListInput

type CreditListInput struct {
	PerPage            int    `json:"per_page,omitempty,string"`
	Page               int    `json:"page,omitempty,string"`
	ExternalCustomerID string `json:"external_customer_id,omitempty"`
}

type CreditNote

type CreditNote struct {
	LagoID        uuid.UUID        `json:"lago_id,omitempty"`
	SequentialID  int              `json:"sequential_id,omitempty"`
	Number        string           `json:"number,omitempty"`
	LagoInvoiceID uuid.UUID        `json:"lago_invoice_id,omitempty"`
	InvoiceNumber string           `json:"invoice_number,omitempty"`
	Reason        CreditNoteReason `json:"reason,omitempty"`

	CreditStatus CreditNoteCreditStatus `json:"credit_status,omitempty"`
	RefundStatus CreditNoteRefundStatus `json:"refund_status,omitempty"`

	Currency                          Currency `json:"currency,omitempty"`
	TotalAmountCents                  int      `json:"total_amount_cents,omitempty"`
	CreditAmountCents                 int      `json:"credit_amount_cents,omitempty"`
	BalanceAmountCents                int      `json:"balance_amount_cents,omitempty"`
	RefundAmountCents                 int      `json:"refund_amount_cents,omitempty"`
	TaxesAmountCents                  int      `json:"taxes_amount_cents,omitempty"`
	TaxesRate                         float32  `json:"taxes_rate,omitempty,string"`
	SubTotalExcludingTaxesAmountCents int      `json:"sub_total_excluding_taxes_amount_cents,omitempty"`
	CouponsAdjustementAmountCents     int      `json:"coupons_adjustement_amount_cents,omitempty"`

	FileURL string `json:"file_url,omitempty"`

	CreatedAt time.Time `json:"created_at,omitempty"`
	UpdatedAt time.Time `json:"updated_at,omitempty"`

	Items []CreditNoteItem `json:"items,omitempty"`

	// Deprecated: Will be removed in the future
	TotalAmountCurrency               Currency `json:"total_amount_currency,omitempty"`
	CreditAmountCurrency              Currency `json:"credit_amount_currency,omitempty"`
	BalanceAmountCurrency             Currency `json:"balance_amount_currency,omitempty"`
	RefundAmountCurrency              Currency `json:"refund_amount_currency,omitempty"`
	VatAmountCents                    int      `json:"vat_amount_cents,omitempty"`
	VatAmountCurrency                 Currency `json:"vat_amount_currency,omitempty"`
	SubTotalVatExcludedAmountCents    int      `json:"sub_total_vat_excluded_amount_cents,omitempty"`
	SubTotalVatExcludedAmountCurrency Currency `json:"sub_total_vat_excluded_amount_currency,omitempty"`
}

type CreditNoteAppliedTax

type CreditNoteAppliedTax struct {
	LagoId           uuid.UUID `json:"lago_id,omitempty"`
	LagoCreditNoteId uuid.UUID `json:"lago_credit_note_id,omitempty"`
	LagoTaxId        uuid.UUID `json:"lago_tax_id,omitempty"`
	TaxName          string    `json:"tax_name,omitempty"`
	TaxCode          string    `json:"tax_code,omitempty"`
	TaxRate          float32   `json:"tax_rate,omitempty,string"`
	TaxDescription   string    `json:"tax_description,omitempty"`
	AmountCents      int       `json:"amount_cents,omitempty"`
	AmountCurrency   Currency  `json:"amount_currency,omitempty"`
	BaseAmountCents  int       `json:"base_amount_cents,omitempty"`
	CreatedAt        time.Time `json:"created_at,omitempty"`
}

type CreditNoteCreditStatus

type CreditNoteCreditStatus string
const (
	CreditNoteCreditStatusAvailable CreditNoteCreditStatus = "available"
	CreditNoteCreditStatusConsumed  CreditNoteCreditStatus = "consumed"
)

type CreditNoteInput

type CreditNoteInput struct {
	LagoInvoiceID     uuid.UUID             `json:"invoice_id,omitempty"`
	Reason            CreditNoteReason      `json:"reason,omitempty"`
	Items             []CreditNoteItemInput `json:"items,omitempty"`
	CreditAmountCents int                   `json:"refund_amount_cents,omitempty"`
	RefundAmountCents int                   `json:"credit_amount_cents,omitempty"`
}

type CreditNoteItem

type CreditNoteItem struct {
	LagoID         uuid.UUID `json:"lago_id,omitempty"`
	AmountCents    int       `json:"amount_cents,omitempty"`
	AmountCurrency Currency  `json:"amount_currency,omitempty"`
	Fee            Fee       `json:"fee,omitempty"`
}

type CreditNoteItemInput

type CreditNoteItemInput struct {
	LagoFeeID   uuid.UUID `json:"fee_id,omitempty"`
	AmountCents int       `json:"amount_cents,omitempty"`
}

type CreditNoteParams

type CreditNoteParams struct {
	CreditNote *CreditNoteInput `json:"credit_note"`
}

type CreditNoteReason

type CreditNoteReason string
const (
	CreditNoteReasonDuplicatedCharge      CreditNoteReason = "duplicated_charge"
	CreditNoteReasonProductUnsatisfactory CreditNoteReason = "product_unsatisfactory"
	CreditNoteReasonOrderChange           CreditNoteReason = "order_change"
	CreditNoteReasonOrderCancellation     CreditNoteReason = "order_cancellation"
	CreditNoteReasonFraudulentCharge      CreditNoteReason = "fraudulent_charge"
	CreditNoteReasonOther                 CreditNoteReason = "other"
)

type CreditNoteRefundStatus

type CreditNoteRefundStatus string
const (
	CreditNoteRefundStatusPending  CreditNoteRefundStatus = "pending"
	CreditNoteRefundStatusRefunded CreditNoteRefundStatus = "refunded"
)

type CreditNoteRequest

type CreditNoteRequest struct {
	// contains filtered or unexported fields
}

func (*CreditNoteRequest) Create

func (cr *CreditNoteRequest) Create(ctx context.Context, creditNoteInput *CreditNoteInput) (*CreditNote, *Error)

func (*CreditNoteRequest) Download

func (cr *CreditNoteRequest) Download(ctx context.Context, creditNoteID string) (*CreditNote, *Error)

func (*CreditNoteRequest) Get

func (cr *CreditNoteRequest) Get(ctx context.Context, creditNoteID uuid.UUID) (*CreditNote, *Error)

func (*CreditNoteRequest) GetList

func (cr *CreditNoteRequest) GetList(ctx context.Context, creditNoteListInput *CreditListInput) (*CreditNoteResult, *Error)

func (*CreditNoteRequest) Update

func (cr *CreditNoteRequest) Update(ctx context.Context, creditNoteUpdateInput *CreditNoteUpdateInput) (*CreditNote, *Error)

func (*CreditNoteRequest) Void

func (cr *CreditNoteRequest) Void(ctx context.Context, creditNoteID string) (*CreditNote, *Error)

type CreditNoteResult

type CreditNoteResult struct {
	CreditNote  *CreditNote  `json:"credit_note,omitempty"`
	CreditNotes []CreditNote `json:"credit_notes,omitempty"`
	Meta        Metadata     `json:"meta,omitempty"`
}

type CreditNoteUpdateInput

type CreditNoteUpdateInput struct {
	LagoID       string                 `json:"id,omitempty"`
	RefundStatus CreditNoteRefundStatus `json:"refund_status,omitempty"`
}

type CreditNoteUpdateParams

type CreditNoteUpdateParams struct {
	CreditNote *CreditNoteUpdateInput `json:"credit_note"`
}

type Currency

type Currency string
const (
	AED Currency = "AED"
	AFN Currency = "AFN"
	ALL Currency = "ALL"
	AMD Currency = "AMD"
	ANG Currency = "ANG"
	AOA Currency = "AOA"
	ARS Currency = "ARS"
	AUD Currency = "AUD"
	AWG Currency = "AWG"
	AZN Currency = "AZN"
	BAM Currency = "BAM"
	BBD Currency = "BBD"
	BDT Currency = "BDT"
	BGN Currency = "BGN"
	BIF Currency = "BIF"
	BMD Currency = "BMD"
	BND Currency = "BND"
	BOB Currency = "BOB"
	BRL Currency = "BRL"
	BSD Currency = "BSD"
	BWP Currency = "BWP"
	BYN Currency = "BYN"
	BZD Currency = "BZD"
	CAD Currency = "CAD"
	CDF Currency = "CDF"
	CHF Currency = "CHF"
	CLP Currency = "CLP"
	CNY Currency = "CNY"
	COP Currency = "COP"
	CRC Currency = "CRC"
	CVE Currency = "CVE"
	CZK Currency = "CZK"
	DJF Currency = "DJF"
	DKK Currency = "DKK"
	DOP Currency = "DOP"
	DZD Currency = "DZD"
	EGP Currency = "EGP"
	ETB Currency = "ETB"
	EUR Currency = "EUR"
	FJD Currency = "FJD"
	FKP Currency = "FKP"
	GBP Currency = "GBP"
	GEL Currency = "GEL"
	GIP Currency = "GIP"
	GMD Currency = "GMD"
	GNF Currency = "GNF"
	GTQ Currency = "GTQ"
	GYD Currency = "GYD"
	HKD Currency = "HKD"
	HNL Currency = "HNL"
	HRK Currency = "HRK"
	HTG Currency = "HTG"
	HUF Currency = "HUF"
	IDR Currency = "IDR"
	ILS Currency = "ILS"
	INR Currency = "INR"
	ISK Currency = "ISK"
	JMD Currency = "JMD"
	JPY Currency = "JPY"
	KES Currency = "KES"
	KGS Currency = "KGS"
	KHR Currency = "KHR"
	KMF Currency = "KMF"
	KRW Currency = "KRW"
	KYD Currency = "KYD"
	KZT Currency = "KZT"
	LAK Currency = "LAK"
	LBP Currency = "LBP"
	LKR Currency = "LKR"
	LRD Currency = "LRD"
	LSL Currency = "LSL"
	MAD Currency = "MAD"
	MDL Currency = "MDL"
	MGA Currency = "MGA"
	MKD Currency = "MKD"
	MMK Currency = "MMK"
	MNT Currency = "MNT"
	MOP Currency = "MOP"
	MRO Currency = "MRO"
	MUR Currency = "MUR"
	MVR Currency = "MVR"
	MWK Currency = "MWK"
	MXN Currency = "MXN"
	MYR Currency = "MYR"
	MZN Currency = "MZN"
	NAD Currency = "NAD"
	NGN Currency = "NGN"
	NIO Currency = "NIO"
	NOK Currency = "NOK"
	NPR Currency = "NPR"
	NZD Currency = "NZD"
	PAB Currency = "PAB"
	PEN Currency = "PEN"
	PGK Currency = "PGK"
	PHP Currency = "PHP"
	PKR Currency = "PKR"
	PLN Currency = "PLN"
	PYG Currency = "PYG"
	QAR Currency = "QAR"
	RON Currency = "RON"
	RSD Currency = "RSD"
	RUB Currency = "RUB"
	RWF Currency = "RWF"
	SAR Currency = "SAR"
	SBD Currency = "SBD"
	SCR Currency = "SCR"
	SEK Currency = "SEK"
	SGD Currency = "SGD"
	SHP Currency = "SHP"
	SLL Currency = "SLL"
	SOS Currency = "SOS"
	SRD Currency = "SRD"
	STD Currency = "STD"
	SZL Currency = "SZL"
	THB Currency = "THB"
	TJS Currency = "TJS"
	TOP Currency = "TOP"
	TRY Currency = "TRY"
	TTD Currency = "TTD"
	TWD Currency = "TWD"
	TZS Currency = "TZS"
	UAH Currency = "UAH"
	UGX Currency = "UGX"
	USD Currency = "USD"
	UYU Currency = "UYU"
	UZS Currency = "UZS"
	VND Currency = "VND"
	VUV Currency = "VUV"
	WST Currency = "WST"
	XAF Currency = "XAF"
	XCD Currency = "XCD"
	XOF Currency = "XOF"
	XPF Currency = "XPF"
	YER Currency = "YER"
	ZAR Currency = "ZAR"
	ZMW Currency = "ZMW"
)

type Customer

type Customer struct {
	LagoID       uuid.UUID `json:"lago_id,omitempty"`
	SequentialID int       `json:"sequential_id,omitempty"`
	ExternalID   string    `json:"external_id,omitempty"`
	Slug         string    `json:"slug,omitempty"`

	Name                    string                       `json:"name,omitempty"`
	Email                   string                       `json:"email,omitempty"`
	AddressLine1            string                       `json:"address_line1,omitempty"`
	AddressLine2            string                       `json:"address_line2,omitempty"`
	City                    string                       `json:"city,omitempty"`
	State                   string                       `json:"state,omitempty"`
	Zipcode                 string                       `json:"zipcode,omitempty"`
	Country                 string                       `json:"country,omitempty"`
	LegalName               string                       `json:"legal_name,omitempty"`
	LegalNumber             string                       `json:"legal_number,omitempty"`
	TaxIdentificationNumber string                       `json:"tax_identification_number,omitempty"`
	LogoURL                 string                       `json:"logo_url,omitempty"`
	Phone                   string                       `json:"phone,omitempty"`
	URL                     string                       `json:"url,omitempty"`
	BillingConfiguration    CustomerBillingConfiguration `json:"billing_configuration,omitempty"`
	Metadata                []MetadataResponse           `json:"metadata,omitempty"`
	Currency                Currency                     `json:"currency,omitempty"`
	Timezone                string                       `json:"timezone,omitempty"`
	ApplicableTimezone      string                       `json:"applicable_timezone,omitempty"`

	Taxes []Tax `json:"taxes,omitempty"`

	CreatedAt time.Time `json:"created_at,omitempty"`
}

type CustomerBillingConfiguration

type CustomerBillingConfiguration struct {
	InvoiceGracePeriod int                     `json:"invoice_grace_period,omitempty"`
	PaymentProvider    CustomerPaymentProvider `json:"payment_provider,omitempty"`
	ProviderCustomerID string                  `json:"provider_customer_id,omitempty"`
	SyncWithProvider   bool                    `json:"sync_with_provider,omitempty"`
	DocumentLocale     string                  `json:"document_locale,omitempty"`
}

type CustomerBillingConfigurationInput

type CustomerBillingConfigurationInput struct {
	InvoiceGracePeriod int                     `json:"invoice_grace_period,omitempty"`
	PaymentProvider    CustomerPaymentProvider `json:"payment_provider,omitempty"`
	ProviderCustomerID string                  `json:"provider_customer_id,omitempty"`
	Sync               bool                    `json:"sync,omitempty"`
	SyncWithProvider   bool                    `json:"sync_with_provider,omitempty"`
	DocumentLocale     string                  `json:"document_locale,omitempty"`
}

type CustomerChargeUsage

type CustomerChargeUsage struct {
	Units          string   `json:"units,omitempty"`
	AmountCents    int      `json:"amount_cents,omitempty"`
	AmountCurrency Currency `json:"amount_currency,omitempty"`

	Charge         *Charge         `json:"charge,omitempty"`
	BillableMetric *BillableMetric `json:"billable_metric,omitempty"`
}

type CustomerInput

type CustomerInput struct {
	ExternalID              string                            `json:"external_id,omitempty"`
	Name                    string                            `json:"name,omitempty"`
	Email                   string                            `json:"email,omitempty"`
	AddressLine1            string                            `json:"address_line1,omitempty"`
	AddressLine2            string                            `json:"address_line2,omitempty"`
	City                    string                            `json:"city,omitempty"`
	Zipcode                 string                            `json:"zipcode,omitempty"`
	State                   string                            `json:"state,omitempty"`
	Country                 string                            `json:"country,omitempty"`
	LegalName               string                            `json:"legal_name,omitempty"`
	LegalNumber             string                            `json:"legal_number,omitempty"`
	TaxIdentificationNumber string                            `json:"tax_identification_number,omitempty"`
	Phone                   string                            `json:"phone,omitempty"`
	URL                     string                            `json:"url,omitempty"`
	Currency                Currency                          `json:"currency,omitempty"`
	Timezone                string                            `json:"timezone,omitempty"`
	Metadata                []CustomerMetadataInput           `json:"metadata,omitempty"`
	BillingConfiguration    CustomerBillingConfigurationInput `json:"billing_configuration,omitempty"`
}

type CustomerListInput

type CustomerListInput struct {
	PerPage int `json:"per_page,omitempty,string"`
	Page    int `json:"page,omitempty,string"`
}

type CustomerMetadataInput

type CustomerMetadataInput struct {
	LagoID           *uuid.UUID `json:"id,omitempty"`
	Key              string     `json:"key,omitempty"`
	Value            string     `json:"value,omitempty"`
	DisplayInInvoice bool       `json:"display_in_invoice,omitempty"`
}

type CustomerParams

type CustomerParams struct {
	Customer *CustomerInput `json:"customer"`
}

type CustomerPaymentProvider

type CustomerPaymentProvider string
const (
	PaymentProviderStripe     CustomerPaymentProvider = "stripe"
	PaymentProviderGocardless CustomerPaymentProvider = "gocardless"
)

type CustomerPortalUrl

type CustomerPortalUrl struct {
	PortalUrl string `json:"portal_url,omitempty"`
}

type CustomerPortalUrlResult

type CustomerPortalUrlResult struct {
	CustomerPortalUrl *CustomerPortalUrl `json:"customer"`
}

type CustomerRequest

type CustomerRequest struct {
	// contains filtered or unexported fields
}

func (*CustomerRequest) Create

func (cr *CustomerRequest) Create(ctx context.Context, customerInput *CustomerInput) (*Customer, *Error)

func (*CustomerRequest) CurrentUsage

func (cr *CustomerRequest) CurrentUsage(ctx context.Context, externalCustomerID string, customerUsageInput *CustomerUsageInput) (*CustomerUsage, *Error)

func (*CustomerRequest) Delete

func (cr *CustomerRequest) Delete(ctx context.Context, externalCustomerID string) (*Customer, *Error)

func (*CustomerRequest) Get

func (cr *CustomerRequest) Get(ctx context.Context, externalCustomerID string) (*Customer, *Error)

func (*CustomerRequest) GetList

func (cr *CustomerRequest) GetList(ctx context.Context, customerListInput *CustomerListInput) (*CustomerResult, *Error)

func (*CustomerRequest) PortalUrl

func (cr *CustomerRequest) PortalUrl(ctx context.Context, externalCustomerID string) (*CustomerPortalUrl, *Error)

func (*CustomerRequest) Update

func (cr *CustomerRequest) Update(ctx context.Context, customerInput *CustomerInput) (*Customer, *Error)

NOTE: Update endpoint does not exists, actually we use the create endpoint with the same externalID to update a customer

type CustomerResult

type CustomerResult struct {
	Customer  *Customer  `json:"customer"`
	Customers []Customer `json:"customers,omitempty"`
	Meta      Metadata   `json:"medata,omitempty"`
}

type CustomerUsage

type CustomerUsage struct {
	FromDatetime     time.Time `json:"from_datetime,omitempty"`
	ToDatetime       time.Time `json:"to_datetime,omitempty"`
	IssuingDate      string    `json:"issuing_date,omitempty"`
	Currency         Currency  `json:"currency,omitempty"`
	AmountCents      int       `json:"amount_cents,omitempty"`
	TotalAmountCents int       `json:"total_amount_cents,omitempty"`
	TaxesAmountCents int       `json:"taxes_amount_cents,omitempty"`

	ChargesUsage []CustomerChargeUsage `json:"charges_usage,omitempty"`
}

type CustomerUsageInput

type CustomerUsageInput struct {
	ExternalSubscriptionID string `json:"external_subscription_id,omitempty"`
}

type CustomerUsageResult

type CustomerUsageResult struct {
	CustomerUsage *CustomerUsage `json:"customer_usage"`
}

type Error

type Error struct {
	Err error `json:"-"`

	HTTPStatusCode int    `json:"status"`
	Msg            string `json:"message"`

	ErrorDetail ErrorDetail `json:"error_details"`
}

type ErrorCode

type ErrorCode string
const (
	ErrorCodeAlreadyExist ErrorCode = "value_already_exist"
	ErrorCodeInvalidValue
)

func (ErrorCode) Error

func (e ErrorCode) Error() string

type ErrorDetail added in v1.5.3

type ErrorDetail struct {
	ErrorCode []ErrorCode `json:"code,omitempty"`
}

type EventEstimateFeesInput

type EventEstimateFeesInput struct {
	ExternalCustomerID     string            `json:"external_customer_id,omitempty"`
	ExternalSubscriptionID string            `json:"external_subscription_id,omitempty"`
	Code                   string            `json:"code,omitempty"`
	Properties             map[string]string `json:"properties,omitempty"`
}

type EventEstimateFeesParams

type EventEstimateFeesParams struct {
	Event *EventEstimateFeesInput `json:"event"`
}

type EventInput

type EventInput struct {
	TransactionID          string                 `json:"transaction_id,omitempty"`
	ExternalCustomerID     string                 `json:"external_customer_id,omitempty"`
	ExternalSubscriptionID string                 `json:"external_subscription_id,omitempty"`
	Code                   string                 `json:"code,omitempty"`
	Timestamp              int64                  `json:"timestamp,omitempty"`
	Properties             map[string]interface{} `json:"properties,omitempty"`
}

type EventParams

type EventParams struct {
	Event *EventInput `json:"event"`
}

type EventRequest

type EventRequest struct {
	// contains filtered or unexported fields
}

func (*EventRequest) Create

func (er *EventRequest) Create(ctx context.Context, eventInput *EventInput) *Error

func (*EventRequest) EstimateFees

func (er *EventRequest) EstimateFees(ctx context.Context, estimateInput EventEstimateFeesInput) (*FeeResult, *Error)

type Fee

type Fee struct {
	LagoID                 uuid.UUID `json:"lago_id,omitempty"`
	LagoGroupID            uuid.UUID `json:"lago_group_id,omitempty"`
	LagoInvoiceID          uuid.UUID `json:"lago_invoice_id,omitempty"`
	LagoTrueUpFeeID        uuid.UUID `json:"lago_true_up_fee_id,omitempty"`
	LagoTrueUpParentFeeID  uuid.UUID `json:"lago_true_up_parent_fee_id,omitempty"`
	ExternalSubscriptionID string    `json:"external_subscription_id,omitempty"`

	AmountCents         int     `json:"amount_cents,omitempty"`
	UnitAmountCents     int     `json:"unit_amount_cents,omitempty"`
	AmountCurrency      string  `json:"amount_currency,omitempty"`
	TaxesAmountCents    int     `json:"taxes_amount_cents,omitempty"`
	TaxesRate           float32 `json:"taxes_rate,omitempty,string"`
	TotalAmountCents    int     `json:"total_amount_cents,omitempty"`
	TotalAmountCurrency string  `json:"total_amount_currency,omitempty"`
	PayInAdvance        bool    `json:"pay_in_advance,omitempty"`
	Invoiceable         bool    `json:"invoiceable,omitempty"`
	FromDate            string  `json:"from_date,omitempty"`
	ToDate              string  `json:"to_date,omitempty"`

	Units       string `json:"units,omitempty"`
	Description string `json:"description,omitempty"`
	EventsCount int    `json:"events_count,omitempty"`

	PaymentStatus FeePaymentStatus `json:"payment_status,omitempty"`

	CreatedAt   time.Time `json:"created_at,omitempty"`
	SucceededAt time.Time `json:"succeeded_at,omitempty"`
	FailedAt    time.Time `json:"failed_at,omitempty"`
	RefundedAt  time.Time `json:"refunded_at,omitempty"`

	Item         FeeItem         `json:"item,omitempty"`
	AppliedTaxes []FeeAppliedTax `json:"applied_taxes,omitempty"`
}

type FeeAppliedTax

type FeeAppliedTax struct {
	LagoId         uuid.UUID `json:"lago_id,omitempty"`
	LagoFeeId      uuid.UUID `json:"lago_fee_id,omitempty"`
	LagoTaxId      uuid.UUID `json:"lago_tax_id,omitempty"`
	TaxName        string    `json:"tax_name,omitempty"`
	TaxCode        string    `json:"tax_code,omitempty"`
	TaxRate        float32   `json:"tax_rate,omitempty,string"`
	TaxDescription string    `json:"tax_description,omitempty"`
	AmountCents    int       `json:"amount_cents,omitempty"`
	AmountCurrency Currency  `json:"amount_currency,omitempty"`
	CreatedAt      time.Time `json:"created_at,omitempty"`
}

type FeeItem

type FeeItem struct {
	Type       FeeType     `json:"type,omitempty"`
	Code       string      `json:"code,omitempty"`
	Name       string      `json:"name,omitempty"`
	LagoItemID uuid.UUID   `json:"lago_item_id,omitempty"`
	ItemType   FeeItemType `json:"item_type,omitempty"`
}

type FeeItemType

type FeeItemType string
const (
	FeeAddOnType         FeeItemType = "AddOn"
	FeeBillableMetric    FeeItemType = "BillableMetric"
	FeeSubscription      FeeItemType = "Subscription"
	FeeWalletTransaction FeeItemType = "WalletTransaction"
)

type FeeListInput

type FeeListInput struct {
	PerPage int `json:"per_page,omitempty,string"`
	Page    int `json:"page,omitempty,string"`

	FeeType       FeeType          `json:"fee_type,omitempty"`
	PaymentStatus FeePaymentStatus `json:"payment_status,omitempty"`

	ExternalSubscriptionID string `json:"external_subscription_id,omitempty"`
	ExternalCustomerID     string `json:"external_customer_id,omitempty"`

	BillableMetricCode string `json:"billable_metric_code,omitempty"`

	Currency Currency `json:"currency"`

	CreatedAtFrom   string `json:"created_at_from,omitempty"`
	CreatedAtTo     string `json:"created_at_to,omitempty"`
	FailedAtFrom    string `json:"failed_at_from,omitempty"`
	FailedAtTo      string `json:"failed_at_to,omitempty"`
	SucceededAtFrom string `json:"succeeded_at_from,omitempty"`
	SucceededAtTo   string `json:"succeeded_at_to,omitempty"`
	RefundedAtFrom  string `json:"refunded_at_from,omitempty"`
	RefundedAtTo    string `json:"refunded_at_to,omitempty"`
}

type FeePaymentStatus

type FeePaymentStatus string
const (
	FeePaymentStatusPending   FeePaymentStatus = "pending"
	FeePaymentStatusSucceeded FeePaymentStatus = "succeeded"
	FeePaymentStatusFailed    FeePaymentStatus = "failed"
	FeePaymentStatusRefunded  FeePaymentStatus = "refunded"
)

type FeeRequest

type FeeRequest struct {
	// contains filtered or unexported fields
}

func (*FeeRequest) Get

func (fr *FeeRequest) Get(ctx context.Context, feeID string) (*Fee, *Error)

func (*FeeRequest) GetList

func (fr *FeeRequest) GetList(ctx context.Context, feeListInput *FeeListInput) (*FeeResult, *Error)

func (*FeeRequest) Update

func (fr *FeeRequest) Update(ctx context.Context, feeInput *FeeUpdateInput) (*Fee, *Error)

type FeeResult

type FeeResult struct {
	Fee  *Fee     `json:"fee,omitempty"`
	Fees []Fee    `json:"fees,omitempty"`
	Meta Metadata `json:"meta,omitempty"`
}

type FeeType

type FeeType string
const (
	FeeItemSubscription FeeType = "subscription"
	FeeItemCharge       FeeType = "charge"
	FeeItemAddOn        FeeType = "add_on"
)

type FeeUpdateInput

type FeeUpdateInput struct {
	LagoID        uuid.UUID        `json:"lago_id,omitempty"`
	PaymentStatus FeePaymentStatus `json:"payment_status,omitempty"`
}

type FeeUpdateParams

type FeeUpdateParams struct {
	Fee *FeeUpdateInput `json:"fee"`
}

type Group

type Group struct {
	LagoID uuid.UUID `json:"lago_id,omitempty"`
	Key    string    `json:"key,omitempty"`
	Value  string    `json:"value,omitempty"`
}

type GroupListInput

type GroupListInput struct {
	PerPage int    `json:"per_page,omitempty,string"`
	Page    int    `json:"page,omitempty,string"`
	Code    string `json:"code,omitempty"`
}

type GroupProperties

type GroupProperties struct {
	GroupID uuid.UUID              `json:"group_id"`
	Values  map[string]interface{} `json:"values"`
}

type GroupRequest

type GroupRequest struct {
	// contains filtered or unexported fields
}

func (*GroupRequest) GetList

func (cr *GroupRequest) GetList(ctx context.Context, groupListInput *GroupListInput) (*GroupResult, *Error)

type GroupResult

type GroupResult struct {
	Groups []Group  `json:"groups,omitempty"`
	Meta   Metadata `json:"meta,omitempty"`
}

type Invoice

type Invoice struct {
	LagoID       uuid.UUID `json:"lago_id,omitempty"`
	SequentialID int       `json:"sequential_id,omitempty"`
	Number       string    `json:"number,omitempty"`

	IssuingDate string `json:"issuing_date,omitempty"`

	InvoiceType   InvoiceType          `json:"invoice_type,omitempty"`
	Status        InvoiceStatus        `json:"status,omitempty"`
	PaymentStatus InvoicePaymentStatus `json:"payment_status,omitempty"`

	Currency Currency `json:"currency,omitempty"`

	FeesAmountCents                   int `json:"fees_amount_cents,omitempty"`
	TaxesAmountCents                  int `json:"taxes_amount_cents,omitempty"`
	CouponsAmountCents                int `json:"coupons_amount_cents,omitempty"`
	CreditNotesAmountCents            int `json:"credit_notes_amount_cents,omitempty"`
	SubTotalExcludingTaxesAmountCents int `json:"sub_total_excluding_taxes_amount_cents,omitempty"`
	SubTotalIncludingTaxesAmountCents int `json:"sub_total_including_taxes_amount_cents,omitempty"`
	TotalAmountCents                  int `json:"total_amount_cents,omitempty"`
	PrepaidCreditAmountCents          int `json:"prepaid_credit_amount_cents,omitempty"`

	FileURL       string                    `json:"file_url,omitempty"`
	Metadata      []InvoiceMetadataResponse `json:"metadata,omitempty"`
	VersionNumber int                       `json:"version_number,omitempty"`

	Customer      *Customer      `json:"customer,omitempty"`
	Subscriptions []Subscription `json:"subscriptions,omitempty"`

	Fees         []Fee               `json:"fees,omitempty"`
	Credits      []InvoiceCredit     `json:"credits,omitempty"`
	AppliedTaxes []InvoiceAppliedTax `json:"applied_taxes,omitempty"`

	// Deprecated: Will be removed in the future
	Legacy                         bool     `json:"legacy,omitempty"`
	AmountCurrency                 Currency `json:"amount_currency,omitempty"`
	AmountCents                    int      `json:"amount_cents,omitempty"`
	CreditAmountCents              int      `json:"credit_amount_cents,omitempty"`
	CreditAmountCurrency           Currency `json:"credit_amount_currency,omitempty"`
	TotalAmountCurrency            Currency `json:"total_amount_currency,omitempty"`
	VatAmountCents                 int      `json:"vat_amount_cents,omitempty"`
	VatAmountCurrency              Currency `json:"vat_amount_currency,omitempty"`
	SubTotalVatExcludedAmountCents int      `json:"sub_total_vat_excluded_amount_cents,omitempty"`
	SubTotalVatIncludedAmountCents int      `json:"sub_total_vat_included_amount_cents,omitempty"`
}

type InvoiceAppliedTax

type InvoiceAppliedTax struct {
	LagoId         uuid.UUID `json:"lago_id,omitempty"`
	LagoInvoiceId  uuid.UUID `json:"lago_invoice_id,omitempty"`
	LagoTaxId      uuid.UUID `json:"lago_tax_id,omitempty"`
	TaxName        string    `json:"tax_name,omitempty"`
	TaxCode        string    `json:"tax_code,omitempty"`
	TaxRate        float32   `json:"tax_rate,omitempty,string"`
	TaxDescription string    `json:"tax_description,omitempty"`
	AmountCents    int       `json:"amount_cents,omitempty"`
	AmountCurrency Currency  `json:"amount_currency,omitempty"`
	CreatedAt      time.Time `json:"created_at,omitempty"`
}

type InvoiceCredit

type InvoiceCredit struct {
	Item InvoiceCreditItem `json:"item,omitempty"`

	Invoice InvoiceSummary `json:"invoice,omitempty"`

	LagoID         uuid.UUID `json:"lago_id,omitempty"`
	AmountCents    int       `json:"amount_cents,omitempty"`
	AmountCurrency Currency  `json:"amount_currency,omitempty"`
	BeforeVAT      bool      `json:"before_vat,omitempty"`
}

type InvoiceCreditItem

type InvoiceCreditItem struct {
	LagoID uuid.UUID             `json:"lago_id,omitempty"`
	Type   InvoiceCreditItemType `json:"type,omitempty"`
	Code   string                `json:"code,omitempty"`
	Name   string                `json:"name,omitempty"`
}

type InvoiceCreditItemType

type InvoiceCreditItemType string
const (
	InvoiceCreditItemCredit InvoiceCreditItemType = "coupon"
)

type InvoiceFeesInput

type InvoiceFeesInput struct {
	AddOnCode       string  `json:"add_on_code,omitempty"`
	UnitAmountCents int     `json:"unit_amount_cents,omitempty"`
	Description     string  `json:"description,omitempty"`
	Units           float32 `json:"units,omitempty"`
}

type InvoiceInput

type InvoiceInput struct {
	LagoID        uuid.UUID              `json:"lago_id,omitempty"`
	PaymentStatus InvoicePaymentStatus   `json:"payment_status,omitempty"`
	Metadata      []InvoiceMetadataInput `json:"metadata,omitempty"`
}

type InvoiceListInput

type InvoiceListInput struct {
	PerPage int `json:"per_page,omitempty,string"`
	Page    int `json:"page,omitempty,string"`

	IssuingDateFrom string `json:"issuing_date_from,omitempty"`
	IssuingDateTo   string `json:"issuing_date_to,omitempty"`

	ExternalCustomerID string               `json:"external_customer_id,omitempty"`
	Status             InvoiceStatus        `json:"status,omitempty"`
	PaymentStatus      InvoicePaymentStatus `json:"payment_status,omitempty"`
}

type InvoiceMetadataInput

type InvoiceMetadataInput struct {
	LagoID *uuid.UUID `json:"id,omitempty"`
	Key    string     `json:"key,omitempty"`
	Value  string     `json:"value,omitempty"`
}

type InvoiceMetadataResponse

type InvoiceMetadataResponse struct {
	LagoID    uuid.UUID `json:"lago_id,omitempty"`
	Key       string    `json:"key,omitempty"`
	Value     string    `json:"value,omitempty"`
	CreatedAt time.Time `json:"created_at,omitempty"`
}

type InvoiceOneOffInput

type InvoiceOneOffInput struct {
	ExternalCustomerId string             `json:"external_customer_id,omitempty"`
	Currency           string             `json:"currency,omitempty"`
	Fees               []InvoiceFeesInput `json:"fees,omitempty"`
}

type InvoiceOneOffParams

type InvoiceOneOffParams struct {
	Invoice *InvoiceOneOffInput `json:"invoice"`
}

type InvoiceParams

type InvoiceParams struct {
	Invoice *InvoiceInput `json:"invoice"`
}

type InvoicePaymentStatus

type InvoicePaymentStatus string
const (
	InvoicePaymentStatusPending   InvoicePaymentStatus = "pending"
	InvoicePaymentStatusSucceeded InvoicePaymentStatus = "succeeded"
	InvoicePaymentStatusFailed    InvoicePaymentStatus = "failed"
)

type InvoiceRequest

type InvoiceRequest struct {
	// contains filtered or unexported fields
}

func (*InvoiceRequest) Create

func (ir *InvoiceRequest) Create(ctx context.Context, oneOffInput *InvoiceOneOffInput) (*Invoice, *Error)

func (*InvoiceRequest) Download

func (ir *InvoiceRequest) Download(ctx context.Context, invoiceID string) (*Invoice, *Error)

func (*InvoiceRequest) Finalize

func (ir *InvoiceRequest) Finalize(ctx context.Context, invoiceID string) (*Invoice, *Error)

func (*InvoiceRequest) Get

func (ir *InvoiceRequest) Get(ctx context.Context, invoiceID string) (*Invoice, *Error)

func (*InvoiceRequest) GetList

func (ir *InvoiceRequest) GetList(ctx context.Context, invoiceListInput *InvoiceListInput) (*InvoiceResult, *Error)

func (*InvoiceRequest) Refresh

func (ir *InvoiceRequest) Refresh(ctx context.Context, invoiceID string) (*Invoice, *Error)

func (*InvoiceRequest) RetryPayment

func (ir *InvoiceRequest) RetryPayment(ctx context.Context, invoiceID string) (*Invoice, *Error)

func (*InvoiceRequest) Update

func (ir *InvoiceRequest) Update(ctx context.Context, invoiceInput *InvoiceInput) (*Invoice, *Error)

type InvoiceResult

type InvoiceResult struct {
	Invoice  *Invoice  `json:"invoice,omitempty"`
	Invoices []Invoice `json:"invoices,omitempty"`
	Meta     Metadata  `json:"meta,omitempty"`
}

type InvoiceStatus

type InvoiceStatus string
const (
	InvoiceStatusDraft     InvoiceStatus = "draft"
	InvoiceStatusFinalized InvoiceStatus = "finalized"
)

type InvoiceSummary

type InvoiceSummary struct {
	LagoID        uuid.UUID            `json:"lago_id,omitempty"`
	PaymentStatus InvoicePaymentStatus `json:"payment_status,omitempty"`
}

type InvoiceType

type InvoiceType string
const (
	SubscriptionInvoiceType InvoiceType = "subscription"
	AddOnInvoiceType        InvoiceType = "add_on"
	CreditInvoiceType       InvoiceType = "credit"
)

type LimitationInput

type LimitationInput struct {
	PlanCodes           []string `json:"plan_codes,omitempty"`
	BillableMetricCodes []string `json:"billable_metric_codes,omitempty"`
}

type Metadata

type Metadata struct {
	CurrentPage int `json:"current_page,omitempty"`
	NextPage    int `json:"next_page,omitempty"`
	PrevPage    int `json:"prev_page,omitempty"`
	TotalPages  int `json:"total_pages,omitempty"`
	TotalCount  int `json:"total_count,omitempty"`
}

type MetadataResponse

type MetadataResponse struct {
	LagoID           uuid.UUID `json:"lago_id,omitempty"`
	Key              string    `json:"key,omitempty"`
	Value            string    `json:"value,omitempty"`
	DisplayInInvoice bool      `json:"display_in_invoice,omitempty"`
	CreatedAt        time.Time `json:"created_at,omitempty"`
}

type Organization

type Organization struct {
	Name string `json:"name,omitempty"`

	Email                   string   `json:"email,omitempty"`
	AddressLine1            string   `json:"address_line1,omitempty"`
	AddressLine2            string   `json:"address_line2,omitempty"`
	City                    string   `json:"city,omitempty"`
	Zipcode                 string   `json:"zipcode,omitempty"`
	State                   string   `json:"state,omitempty"`
	Country                 string   `json:"country,omitempty"`
	LegalName               string   `json:"legal_name,omitempty"`
	LegalNumber             string   `json:"legal_number,omitempty"`
	TaxIdentificationNumber string   `json:"tax_identification_number,omitempty"`
	WebhookURL              string   `json:"webhook_url,omitempty"`
	WebhookURLs             []string `json:"webhook_urls,omitempty"`
	Timezone                string   `json:"timezone,omitempty"`
	EmailSettings           []string `json:"email_settings,omitempty"`

	BillingConfiguration OrganizationBillingConfiguration `json:"billing_configuration,omitempty"`

	Taxes []Tax `json:"taxes,omitempty"`

	CreatedAt time.Time `json:"created_at,omitempty"`
}

type OrganizationBillingConfiguration

type OrganizationBillingConfiguration struct {
	InvoiceGracePeriod int    `json:"invoice_grace_period,omitempty"`
	InvoiceFooter      string `json:"invoice_footer,omitempty"`
	DocumentLocale     string `json:"document_locale,omitempty"`
}

type OrganizationBillingConfigurationInput

type OrganizationBillingConfigurationInput struct {
	InvoiceGracePeriod int    `json:"invoice_grace_period,omitempty"`
	InvoiceFooter      string `json:"invoice_footer,omitempty"`
	DocumentLocale     string `json:"document_locale,omitempty"`
}

type OrganizationInput

type OrganizationInput struct {
	Name string `json:"name,omitempty"`

	Email                   string   `json:"email,omitempty"`
	AddressLine1            string   `json:"address_line1,omitempty"`
	AddressLine2            string   `json:"address_line2,omitempty"`
	City                    string   `json:"city,omitempty"`
	Zipcode                 string   `json:"zipcode,omitempty"`
	State                   string   `json:"state,omitempty"`
	Country                 string   `json:"country,omitempty"`
	LegalName               string   `json:"legal_name,omitempty"`
	LegalNumber             string   `json:"legal_number,omitempty"`
	TaxIdentificationNumber string   `json:"tax_identification_number,omitempty"`
	WebhookURL              string   `json:"webhook_url,omitempty"`
	Timezone                string   `json:"timezone,omitempty"`
	EmailSettings           []string `json:"email_settings,omitempty"`

	BillingConfiguration OrganizationBillingConfigurationInput `json:"billing_configuration,omitempty"`
}

type OrganizationParams

type OrganizationParams struct {
	Organization *OrganizationInput `json:"organization"`
}

type OrganizationRequest

type OrganizationRequest struct {
	// contains filtered or unexported fields
}

func (*OrganizationRequest) Update

func (or *OrganizationRequest) Update(ctx context.Context, organizationInput *OrganizationInput) (*Organization, *Error)

type OrganizationResult

type OrganizationResult struct {
	Organization *Organization `json:"organization,omitempty"`
}

type Plan

type Plan struct {
	LagoID                   uuid.UUID    `json:"lago_id"`
	Name                     string       `json:"name,omitempty"`
	Code                     string       `json:"code,omitempty"`
	Interval                 PlanInterval `json:"interval,omitempty"`
	Description              string       `json:"description,omitempty"`
	AmountCents              int          `json:"amount_cents,omitempty"`
	AmountCurrency           Currency     `json:"amount_currency,omitempty"`
	PayInAdvance             bool         `json:"pay_in_advance,omitempty"`
	BillChargeMonthly        bool         `json:"bill_charge_monthly,omitempty"`
	ActiveSubscriptionsCount int          `json:"active_subscriptions_count,omitempty"`
	DraftInvoicesCount       int          `json:"draft_invoices_count,omitempty"`
	Charges                  []Charge     `json:"charges,omitempty"`
}

type PlanChargeInput

type PlanChargeInput struct {
	LagoID           *uuid.UUID             `json:"id,omitempty"`
	BillableMetricID uuid.UUID              `json:"billable_metric_id,omitempty"`
	AmountCurrency   Currency               `json:"amount_currency,omitempty"`
	ChargeModel      ChargeModel            `json:"charge_model,omitempty"`
	PayInAdvance     bool                   `json:"pay_in_advance,omitempty"`
	Invoiceable      bool                   `json:"invoiceable,omitempty"`
	MinAmountCents   int                    `json:"min_amount_cents,omitempty"`
	Properties       map[string]interface{} `json:"properties"`
	GroupProperties  []GroupProperties      `json:"group_properties,omitempty"`
}

type PlanInput

type PlanInput struct {
	Name              string            `json:"name,omitempty"`
	Code              string            `json:"code,omitempty"`
	Interval          PlanInterval      `json:"interval,omitempty"`
	Description       string            `json:"description,omitempty"`
	AmountCents       int               `json:"amount_cents"`
	AmountCurrency    Currency          `json:"amount_currency,omitempty"`
	PayInAdvance      bool              `json:"pay_in_advance"`
	BillChargeMonthly bool              `json:"bill_charge_monthly"`
	TrialPeriod       float32           `json:"trial_period"`
	Charges           []PlanChargeInput `json:"charges,omitempty"`
}

type PlanInterval

type PlanInterval string
const (
	PlanWeekly  PlanInterval = "weekly"
	PlanMonthly PlanInterval = "monthly"
	PlanYearly  PlanInterval = "yearly"
)

type PlanListInput

type PlanListInput struct {
	PerPage int `json:"per_page,omitempty,string"`
	Page    int `json:"page,omitempty,string"`
}

type PlanParams

type PlanParams struct {
	Plan *PlanInput `json:"plan"`
}

type PlanRequest

type PlanRequest struct {
	// contains filtered or unexported fields
}

func (*PlanRequest) Create

func (pr *PlanRequest) Create(ctx context.Context, planInput *PlanInput) (*Plan, *Error)

func (*PlanRequest) Delete

func (pr *PlanRequest) Delete(ctx context.Context, planCode string) (*Plan, *Error)

func (*PlanRequest) Get

func (pr *PlanRequest) Get(ctx context.Context, planCode string) (*Plan, *Error)

func (*PlanRequest) GetList

func (pr *PlanRequest) GetList(ctx context.Context, planListInput *PlanListInput) (*PlanResult, *Error)

func (*PlanRequest) Update

func (pr *PlanRequest) Update(ctx context.Context, planInput *PlanInput) (*Plan, *Error)

type PlanResult

type PlanResult struct {
	Plan  *Plan    `json:"plan,omitempty"`
	Plans []Plan   `json:"plans,omitempty"`
	Meta  Metadata `json:"meta,omitempty"`
}

type Status

type Status string
const (
	Active     Status = "active"
	Terminated Status = "terminated"
)

type Subscription

type Subscription struct {
	LagoID             uuid.UUID `json:"lago_id"`
	LagoCustomerID     uuid.UUID `json:"lago_customer_id"`
	ExternalCustomerID string    `json:"external_customer_id"`
	ExternalID         string    `json:"external_id"`

	PlanCode string `json:"plan_code"`

	Name string `json:"name"`

	Status         SubscriptionStatus `json:"status"`
	BillingTime    BillingTime        `json:"billing_time"`
	SubscriptionAt *time.Time         `json:"subscription_at"`

	PreviousPlanCode  string `json:"previous_plan_code"`
	NextPlanCode      string `json:"next_plan_code"`
	DowngradePlanDate string `json:"downgrade_plan_date"`

	CreatedAt    *time.Time `json:"created_at"`
	StartedAt    *time.Time `json:"started_at"`
	CanceledAt   *time.Time `json:"canceled_at"`
	TerminatedAt *time.Time `json:"terminated_at"`
}

type SubscriptionInput

type SubscriptionInput struct {
	ExternalCustomerID string      `json:"external_customer_id,omitempty"`
	PlanCode           string      `json:"plan_code,omitempty"`
	SubscriptionAt     *time.Time  `json:"subscription_at,omitempty"`
	BillingTime        BillingTime `json:"billing_time,omitempty"`
	ExternalID         string      `json:"external_id"`
	Name               string      `json:"name"`
}

type SubscriptionListInput

type SubscriptionListInput struct {
	ExternalCustomerID string `json:"external_customer_id,omitempty"`
	PlanCode           string `json:"plan_code,omitempty"`
	PerPage            int    `json:"per_page,omitempty,string"`
	Page               int    `json:"page,omitempty,string"`
}

type SubscriptionParams

type SubscriptionParams struct {
	Subscription *SubscriptionInput `json:"subscription"`
}

type SubscriptionRequest

type SubscriptionRequest struct {
	// contains filtered or unexported fields
}

func (*SubscriptionRequest) Create

func (sr *SubscriptionRequest) Create(ctx context.Context, subscriptionInput *SubscriptionInput) (*Subscription, *Error)

func (*SubscriptionRequest) GetList

func (sr *SubscriptionRequest) GetList(ctx context.Context, subscriptionListInput SubscriptionListInput) (*SubscriptionResult, *Error)

func (*SubscriptionRequest) Terminate

func (sr *SubscriptionRequest) Terminate(ctx context.Context, externalID string) (*Subscription, *Error)

type SubscriptionResult

type SubscriptionResult struct {
	Subscription  *Subscription  `json:"subscription,omitempty"`
	Subscriptions []Subscription `json:"subscriptions,omitempty"`
	Meta          Metadata       `json:"meta,omitempty"`
}

type SubscriptionStatus

type SubscriptionStatus string
const (
	SubscriptionStatusActive     SubscriptionStatus = "active"
	SubscriptionStatusPending    SubscriptionStatus = "pending"
	SubscriptionStatusTerminated SubscriptionStatus = "terminated"
	SubscriptionStatusCanceled   SubscriptionStatus = "canceled"
)

type Tax

type Tax struct {
	LagoID                uuid.UUID `json:"lago_id,omitempty"`
	Name                  string    `json:"name,omitempty"`
	Code                  string    `json:"code,omitempty"`
	Rate                  float32   `json:"rate,omitempty"`
	Description           string    `json:"description,omitempty"`
	CustomersCount        int       `json:"customers_count,omitempty"`
	AppliedToOrganization bool      `json:"applied_to_organization,omitempty"`
	CreatedAt             time.Time `json:"created_at,omitempty"`
}

type TaxInput

type TaxInput struct {
	Name                  string  `json:"name,omitempty"`
	Code                  string  `json:"code,omitempty"`
	Rate                  float32 `json:"rate,omitempty"`
	Description           string  `json:"description,omitempty"`
	AppliedToOrganization bool    `json:"applied_to_organization,omitempty"`
}

type TaxListInput

type TaxListInput struct {
	PerPage int `json:"per_page,omitempty,string"`
	Page    int `json:"page,omitempty,string"`
}

type TaxParams

type TaxParams struct {
	Tax *TaxInput `json:"tax"`
}

type TaxRequest

type TaxRequest struct {
	// contains filtered or unexported fields
}

func (*TaxRequest) Create

func (adr *TaxRequest) Create(ctx context.Context, taxInput *TaxInput) (*Tax, *Error)

func (*TaxRequest) Delete

func (adr *TaxRequest) Delete(ctx context.Context, taxCode string) (*Tax, *Error)

func (*TaxRequest) Get

func (adr *TaxRequest) Get(ctx context.Context, taxCode string) (*Tax, *Error)

func (*TaxRequest) GetList

func (adr *TaxRequest) GetList(ctx context.Context, taxListInput *TaxListInput) (*TaxResult, *Error)

func (*TaxRequest) Update

func (adr *TaxRequest) Update(ctx context.Context, taxInput *TaxInput) (*Tax, *Error)

type TaxResult

type TaxResult struct {
	Tax   *Tax     `json:"tax,omitempty"`
	Taxes []Tax    `json:"taxes,omitempty"`
	Meta  Metadata `json:"meta,omitempty"`
}

type TransactionType

type TransactionType string
const (
	Outbound TransactionType = "outbound"
	Inbound  TransactionType = "inbound"
)

type Wallet

type Wallet struct {
	LagoID               uuid.UUID `json:"lago_id,omitempty"`
	LagoCustomerID       uuid.UUID `json:"lago_customer_id,omitempty"`
	ExternalCustomerID   string    `json:"external_customer_id,omitempty"`
	Status               Status    `json:"status,omitempty"`
	Currency             Currency  `json:"currency,omitempty"`
	Name                 string    `json:"name,omitempty"`
	RateAmount           string    `json:"rate_amount,omitempty"`
	CreditsBalance       string    `json:"credits_balance,omitempty"`
	Balance              string    `json:"balance,omitempty"` // NOTE(legacy)
	BalanceCents         int       `json:"balance_cents,omitempty"`
	ConsumedCredits      string    `json:"consumed_credits,omitempty"`
	CreatedAt            time.Time `json:"created_at,omitempty"`
	ExpirationDate       time.Time `json:"expiration_date,omitempty"`
	LastBalanceSyncAt    time.Time `json:"last_balance_sync_at,omitempty"`
	LastConsumedCreditAt time.Time `json:"last_consumed_credit_at,omitempty"`
	TerminatedAt         time.Time `json:"terminated_at,omitempty"`
}

type WalletInput

type WalletInput struct {
	RateAmount         string     `json:"rate_amount,omitempty"`
	Currency           Currency   `json:"currency,omitempty"`
	Name               string     `json:"name,omitempty"`
	PaidCredits        string     `json:"paid_credits,omitempty"`
	GrantedCredits     string     `json:"granted_credits,omitempty"`
	ExpirationAt       *time.Time `json:"expiration_at,omitempty"`
	ExternalCustomerID string     `json:"external_customer_id,omitempty"`
}

type WalletListInput

type WalletListInput struct {
	PerPage            int `json:"per_page,omitempty,string"`
	Page               int `json:"page,omitempty,string"`
	ExternalCustomerID int `json:"external_customer_id,omitempty,string"`
}

type WalletParams

type WalletParams struct {
	WalletInput *WalletInput `json:"wallet"`
}

type WalletRequest

type WalletRequest struct {
	// contains filtered or unexported fields
}

func (*WalletRequest) Create

func (bmr *WalletRequest) Create(ctx context.Context, walletInput *WalletInput) (*Wallet, *Error)

func (*WalletRequest) Delete

func (bmr *WalletRequest) Delete(ctx context.Context, walletID string) (*Wallet, *Error)

func (*WalletRequest) Get

func (bmr *WalletRequest) Get(ctx context.Context, walletID string) (*Wallet, *Error)

func (*WalletRequest) GetList

func (bmr *WalletRequest) GetList(ctx context.Context, walletListInput *WalletListInput) (*WalletResult, *Error)

func (*WalletRequest) Update

func (bmr *WalletRequest) Update(ctx context.Context, walletInput *WalletInput, walletID string) (*Wallet, *Error)

type WalletResult

type WalletResult struct {
	Wallet  *Wallet  `json:"wallet,omitempty"`
	Wallets []Wallet `json:"wallets,omitempty"`
	Meta    Metadata `json:"meta,omitempty"`
}

type WalletTransaction

type WalletTransaction struct {
	LagoID          uuid.UUID               `json:"lago_id,omitempty"`
	LagoWalletID    uuid.UUID               `json:"lago_wallet_id,omitempty"`
	Status          WalletTransactionStatus `json:"status,omitempty"`
	TransactionType TransactionType         `json:"transaction_type,omitempty"`
	Amount          string                  `json:"amount,omitempty"`
	CreditAmount    string                  ` json:"credit_amount,omitempty"`
	CreatedAt       time.Time               `json:"created_at,omitempty"`
	SettledAt       time.Time               `json:"settled_at,omitempty"`
}

type WalletTransactionInput

type WalletTransactionInput struct {
	WalletID       string `json:"wallet_id,omitempty"`
	PaidCredits    string `json:"paid_credits,omitempty"`
	GrantedCredits string `json:"granted_credits,omitempty"`
}

type WalletTransactionListInput

type WalletTransactionListInput struct {
	PerPage         int                     `json:"per_page,omitempty,string"`
	Page            int                     `json:"page,omitempty,string"`
	WalletID        string                  `json:"wallet_id,omitempty"`
	Status          WalletTransactionStatus `json:"status,omitempty"`
	TransactionType TransactionType         `json:"transaction_type,omitempty"`
}

type WalletTransactionParams

type WalletTransactionParams struct {
	WalletTransactionInput *WalletTransactionInput `json:"wallet_transaction"`
}

type WalletTransactionRequest

type WalletTransactionRequest struct {
	// contains filtered or unexported fields
}

func (*WalletTransactionRequest) Create

func (wtr *WalletTransactionRequest) Create(ctx context.Context, walletTransactionInput *WalletTransactionInput) (*WalletTransactionResult, *Error)

func (*WalletTransactionRequest) GetList

func (wtr *WalletTransactionRequest) GetList(ctx context.Context, walletTransactionListInput *WalletTransactionListInput) (*WalletTransactionResult, *Error)

type WalletTransactionResult

type WalletTransactionResult struct {
	WalletTransactions []WalletTransaction `json:"wallet_transactions,omitempty"`
	Meta               Metadata            `json:"meta,omitempty"`
}

type WalletTransactionStatus

type WalletTransactionStatus string
const (
	WalletTransactionStatusPending WalletTransactionStatus = "pending"
	WalletTransactionStatusSettled WalletTransactionStatus = "settled"
)

type WebhookRequest

type WebhookRequest struct {
	// contains filtered or unexported fields
}

func (*WebhookRequest) GetPublicKey

func (wr *WebhookRequest) GetPublicKey(ctx context.Context) (*rsa.PublicKey, *Error)

func (*WebhookRequest) ValidateBody

func (wr *WebhookRequest) ValidateBody(ctx context.Context, signature string, body string) (bool, *Error)

func (*WebhookRequest) ValidateSignature

func (wr *WebhookRequest) ValidateSignature(ctx context.Context, signature string) (bool, *Error)

Jump to

Keyboard shortcuts

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