invoiced

package module
v2.4.2 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2022 License: MIT Imports: 17 Imported by: 0

README

invoiced-go

This repository contains the Go client library for the Invoiced API.

Build Status Coverage Status

Installing

The Invoiced package can be installed like this:

go get -u https://github.com/Invoiced/invoiced-go/v2

Requirements

  • Go 1.11+

Usage

First, you must instantiate a new client

import "github.com/Invoiced/invoiced-go/v2/api"

client := api.New("API_KEY", false)

Then, API calls can be made like this:

import "github.com/Invoiced/invoiced-go/v2"
import "fmt"

// Get all invoices with auto pagination
invoices, err := client.Invoice.ListAll(nil, nil)
if err != nil {
    panic(err)
}

// Let's print all the invoices
for _, invoice := range invoices {
    fmt.Println(invoice)
}

// Let's create a new customer
customer, err := client.Customer.Create(&invoiced.CustomerRequest{
	Name: invoiced.String("Test Customer")
})

if err != nil {
    panic(err)
}

fmt.Println("Customer Response => ", customer)

// Let's create a new invoice
invoice, err := client.Invoice.Create(&invoiced.InvoiceRequest{
    Customer: invoiced.Int64(customerResponse.Id),
    PaymentTerms: invoiced.String("NET 30"),
    Items: []*invoiced.LineItemRequest{
        {
            Description: invoiced.String("Retina MacBook Pro"),
            Quantity: invoiced.Float64(5),
            UnitCost: invoiced.Float64(1999.22),
        },
    },
})

if err != nil {
    panic(err)
}

fmt.Println("Invoice Response => ", invoice)

If you want to use the sandbox API instead then you must set the second argument on the client to true like this:

client := api.New("SANDBOX_API_KEY", false)

Developing

The test suite can be run with:

go test ./...

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFilterAndSort

func AddFilterAndSort(url string, filter *Filter, sort *Sort) string

func AddQueryParameter

func AddQueryParameter(url string, name string, value string) string

func Bool

func Bool(v bool) *bool

func BoolValue

func BoolValue(v *bool) bool

func CleanMetaDataArray

func CleanMetaDataArray(b []byte) []byte

func Float64

func Float64(v float64) *float64

func Float64Value

func Float64Value(v *float64) float64

func Int64

func Int64(v int64) *int64

func Int64Value

func Int64Value(v *int64) int64

func String

func String(v string) *string

func StringValue

func StringValue(v *string) string

func Version

func Version() string

Types

type APIError

type APIError struct {
	Type    string `json:"type"`
	Message string `json:"message"`
	Param   string `json:"param"`
}

func NewAPIError

func NewAPIError(typeE, message, param string) *APIError

func (*APIError) Error

func (a *APIError) Error() string

type AccountingSyncStatus added in v2.3.0

type AccountingSyncStatus struct {
	Synced           bool   `json:"synced"`
	Error            string `json:"error"`
	AccountingSystem string `json:"accounting_system"`
	AccountingId     string `json:"accounting_id"`
	Source           string `json:"source"`
	FirstSynced      int64  `json:"first_synced"`
	LastSynced       int64  `json:"last_synced"`
}

type Api

type Api struct {
	Sandbox bool
	Key     string
	// contains filtered or unexported fields
}

func New

func New(key string, sandbox bool) *Api

func NewMockApi

func NewMockApi(key string, server *httptest.Server) *Api

func (*Api) Count

func (c *Api) Count(endpoint string) (int64, error)

func (*Api) Create

func (c *Api) Create(endpoint string, requestData interface{}, responseData interface{}) error

func (*Api) Delete

func (c *Api) Delete(endpoint string) error

func (*Api) Get

func (c *Api) Get(endpoint string, endpointData interface{}) (string, error)

func (*Api) PostWithoutData

func (c *Api) PostWithoutData(endpoint string, responseData interface{}) error

func (*Api) Update

func (c *Api) Update(endpoint string, requestData interface{}, responseData interface{}) error

func (*Api) Upload

func (c *Api) Upload(endpoint string, filePath string, fileParamName string, fileParams map[string]string, fileType string, responseData interface{}) error

type Balance

type Balance struct {
	AvailableCredits float64          `json:"available_credits"`
	Currency         string           `json:"currency"`
	DueNow           float64          `json:"due_now"`
	Histories        BalanceHistories `json:"history"`
	PastDue          bool             `json:"past_due"`
	TotalOutstanding float64          `json:"total_outstanding"`
}

type BalanceHistories

type BalanceHistories []*BalanceHistory

type BalanceHistory

type BalanceHistory struct {
	Balance   float64 `json:"balance"`
	Currency  string  `json:"currency"`
	Timestamp int64   `json:"timestamp"`
}

type BankAccount

type BankAccount struct {
	BankName        string `json:"bank_name"`
	Chargeable      bool   `json:"chargeable"`
	Country         string `json:"country"`
	CreatedAt       int64  `json:"created_at"`
	Currency        string `json:"currency"`
	FailureReason   string `json:"failure_reason"`
	Gateway         string `json:"gateway"`
	GatewayCustomer string `json:"gateway_customer"`
	GatewayId       string `json:"gateway_id"`
	Id              int64  `json:"id"`
	Last4           string `json:"last4"`
	Object          string `json:"object"`
	ReceiptEmail    string `json:"receipt_email"`
	RoutingNumber   string `json:"routing_number"`
	UpdatedAt       int64  `json:"updated_at"`
	Verified        bool   `json:"verified"`
}

type Card

type Card struct {
	Brand           string `json:"brand"`
	Chargeable      bool   `json:"chargeable"`
	CreatedAt       int64  `json:"created_at"`
	ExpMonth        int64  `json:"exp_month"`
	ExpYear         int64  `json:"exp_year"`
	FailureReason   string `json:"failure_reason"`
	Funding         string `json:"funding"`
	Gateway         string `json:"gateway"`
	GatewayCustomer string `json:"gateway_customer"`
	GatewayId       string `json:"gateway_id"`
	Id              int64  `json:"id"`
	Last4           string `json:"last4"`
	Object          string `json:"object"`
	ReceiptEmail    string `json:"receipt_email"`
	UpdatedAt       int64  `json:"updated_at"`
}

type Charge

type Charge struct {
	Id             int64          `json:"id"`
	Object         string         `json:"object"`
	Customer       int64          `json:"customer"`
	Status         string         `json:"status"`
	Gateway        string         `json:"gateway"`
	GatewayId      string         `json:"gateway_id"`
	PaymentSource  *PaymentSource `json:"payment_source"`
	Currency       string         `json:"currency"`
	Amount         float64        `json:"amount"`
	FailureMessage string         `json:"failure_message"`
	AmountRefunded float64        `json:"amount_refunded"`
	Refunded       bool           `json:"refunded"`
	Refunds        []Refund       `json:"refunds"`
	Disputed       bool           `json:"disputed"`
	CreatedAt      int64          `json:"created_at"`
	UpdatedAt      int64          `json:"updated_at"`
}

type ChargeRequest

type ChargeRequest struct {
	Customer          *int64                `json:"customer,omitempty"`
	Method            *string               `json:"method,omitempty"`
	Currency          *string               `json:"currency,omitempty"`
	Amount            *float64              `json:"amount,omitempty"`
	InvoicedToken     *string               `json:"invoiced_token,omitempty"`
	GatewayToken      *string               `json:"gateway_token,omitempty"`
	PaymentSourceType *string               `json:"payment_source_type,omitempty"`
	PaymentSourceId   *int64                `json:"payment_source_id,omitempty"`
	VaultMethod       *bool                 `json:"vault_method,omitempty"`
	MakeDefault       *bool                 `json:"make_default,omitempty"`
	ReceiptEmail      *string               `json:"receipt_email,omitempty"`
	AppliedTo         []*PaymentItemRequest `json:"applied_to,omitempty"`
}

type ChasingCadence

type ChasingCadence struct {
	AssignmentConditions *string       `json:"assignment_conditions"`
	AssignmentMode       string        `json:"assignment_mode"`
	CreatedAt            int64         `json:"created_at"`
	UpdatedAt            int64         `json:"updated_at"`
	Frequency            string        `json:"frequency"`
	Id                   int64         `json:"id"`
	LastRun              *int64        `json:"last_run"`
	MinBalance           *float64      `json:"min_balance"`
	Name                 string        `json:"name"`
	NextRun              *int64        `json:"nextrun"`
	NumCustomers         int64         `json:"num_customers"`
	Object               string        `json:"object"`
	Paused               bool          `json:"paused"`
	RunDate              int64         `json:"run_date"`
	Steps                []ChasingStep `json:"steps"`
	TimeOfDay            int64         `json:"time_of_day"`
}

type ChasingCadences

type ChasingCadences []*ChasingCadence

type ChasingStep

type ChasingStep struct {
	Action          string  `json:"action"`
	AssignedUserId  *int64  `json:"assigned_user_id"`
	CreatedAt       int64   `json:"created_at"`
	EmailTemplateId *string `json:"email_template_id"`
	Id              int64   `json:"id"`
	Name            string  `json:"name"`
	Schedule        string  `json:"schedule"`
	SmsTemplateId   *string `json:"sms_template_id"`
	UpdatedAt       int64   `json:"updated_at"`
}

type Contact

type Contact struct {
	Address1   *string `json:"address1"`
	Address2   *string `json:"address2"`
	City       *string `json:"city"`
	Country    *string `json:"country"`
	CreatedAt  int64   `json:"created_at"`
	Department *string `json:"department"`
	Email      *string `json:"email"`
	Id         int64   `json:"id"`
	Name       string  `json:"name"`
	Object     string  `json:"object"`
	Phone      *string `json:"phone"`
	PostalCode *string `json:"postal_code"`
	Primary    bool    `json:"primary"`
	SmsEnabled bool    `json:"sms_enabled"`
	State      *string `json:"state"`
	Title      *string `json:"title"`
	UpdatedAt  int64   `json:"updated_at"`
}

type ContactRequest

type ContactRequest struct {
	Address1   *string `json:"address1,omitempty"`
	Address2   *string `json:"address2,omitempty"`
	City       *string `json:"city,omitempty"`
	Country    *string `json:"country,omitempty"`
	Department *string `json:"department,omitempty"`
	Email      *string `json:"email,omitempty"`
	Name       *string `json:"name,omitempty"`
	Phone      *string `json:"phone,omitempty"`
	PostalCode *string `json:"postal_code,omitempty"`
	Primary    *bool   `json:"primary"`
	SmsEnabled *bool   `json:"sms_enabled"`
	State      *string `json:"state,omitempty"`
	Title      *string `json:"title,omitempty"`
}

type Contacts

type Contacts []*Contact

type Coupon

type Coupon struct {
	CreatedAt      int64                  `json:"created_at"`
	Currency       *string                `json:"currency"`
	Duration       *int64                 `json:"duration"`
	Exclusive      bool                   `json:"exclusive"`
	ExpirationDate *int64                 `json:"expiration_date"`
	Id             string                 `json:"id"`
	IsPercent      bool                   `json:"is_percent"`
	MaxRedemptions *int64                 `json:"max_redemptions"`
	Metadata       map[string]interface{} `json:"metadata"`
	Name           string                 `json:"name"`
	Object         string                 `json:"object"`
	UpdatedAt      int64                  `json:"updated_at"`
	Value          int64                  `json:"value"`
}

type CouponRequest

type CouponRequest struct {
	Currency       *string                 `json:"currency,omitempty"`
	Duration       *int64                  `json:"durationo,omitempty"`
	Exclusive      *bool                   `json:"exclusive,omitempty"`
	ExpirationDate *int64                  `json:"expiration_date,omitempty"`
	Id             *string                 `json:"id,omitempty"`
	IsPercent      *bool                   `json:"is_percent,omitempty"`
	MaxRedemptions *int64                  `json:"max_redemptions,omitempty"`
	Metadata       *map[string]interface{} `json:"metadata,omitempty"`
	Name           *string                 `json:"name,omitempty"`
	Value          *int64                  `json:"value,omitempty"`
}

type Coupons

type Coupons []*Coupon

type CreditBalanceAdjustment

type CreditBalanceAdjustment struct {
	Amount    float64 `json:"amount,omitempty"`
	CreatedAt int64   `json:"created_at,omitempty"`
	Currency  string  `json:"currency,omitempty"`
	Customer  int64   `json:"customer,omitempty"`
	Date      int64   `json:"date,omitempty"`
	ID        int64   `json:"id,omitempty"`
	Notes     string  `json:"notes,omitempty"`
	Object    string  `json:"object,omitempty"`
	UpdatedAt int64   `json:"updated_at,omitempty"`
}

type CreditBalanceAdjustmentRequest

type CreditBalanceAdjustmentRequest struct {
	Amount   *float64 `json:"amount,omitempty"`
	Currency *string  `json:"currency,omitempty"`
	Customer *int64   `json:"customer,omitempty"`
	Date     *int64   `json:"date,omitempty"`
	Notes    *string  `json:"notes,omitempty"`
}

type CreditBalanceAdjustments

type CreditBalanceAdjustments []*CreditBalanceAdjustment

type CreditNote

type CreditNote struct {
	Attachments   []int64                `json:"attachments"`
	Balance       float64                `json:"balance"`
	Closed        bool                   `json:"closed"`
	CreatedAt     int64                  `json:"created_at"`
	Currency      string                 `json:"currency"`
	Customer      int64                  `json:"customer"`
	Date          int64                  `json:"date"`
	Discounts     []Discount             `json:"discounts"`
	Draft         bool                   `json:"draft"`
	Id            int64                  `json:"id"`
	Invoice       int64                  `json:"invoice"`
	Items         []LineItem             `json:"items"`
	Metadata      map[string]interface{} `json:"metadata"`
	Name          string                 `json:"name"`
	Notes         string                 `json:"notes"`
	Number        string                 `json:"number"`
	Object        string                 `json:"object"`
	Paid          bool                   `json:"paid"`
	PdfUrl        string                 `json:"pdf_url"`
	PurchaseOrder string                 `json:"purchase_order"`
	Status        string                 `json:"status"`
	Subtotal      float64                `json:"subtotal"`
	Taxes         []Tax                  `json:"taxes"`
	Total         float64                `json:"total"`
	UpdatedAt     int64                  `json:"updated_at"`
	Url           string                 `json:"url"`
}

func (*CreditNote) String

func (i *CreditNote) String() string

type CreditNoteRequest

type CreditNoteRequest struct {
	Attachments   []*int64                `json:"attachments,omitempty"`
	CalculateTax  *bool                   `json:"calculate_taxes,omitempty"`
	Closed        *bool                   `json:"closed,omitempty"`
	Currency      *string                 `json:"currency,omitempty"`
	Customer      *int64                  `json:"customer,omitempty"`
	Date          *int64                  `json:"date,omitempty"`
	Discounts     []*DiscountRequest      `json:"discounts,omitempty"`
	Draft         *bool                   `json:"draft,omitempty"`
	Items         []*LineItemRequest      `json:"items,omitempty"`
	Metadata      *map[string]interface{} `json:"metadata,omitempty"`
	Name          *string                 `json:"name,omitempty"`
	Notes         *string                 `json:"notes,omitempty"`
	Number        *string                 `json:"number,omitempty"`
	Paid          *bool                   `json:"paid,omitempty"`
	PurchaseOrder *string                 `json:"purchase_order,omitempty"`
	Taxes         []*TaxRequest           `json:"taxes,omitempty"`
}

type CreditNotes

type CreditNotes []*CreditNote

type Customer

type Customer struct {
	Address1               string                 `json:"address1"`
	Address2               string                 `json:"address2"`
	AttentionTo            string                 `json:"attention_to"`
	AutoPay                bool                   `json:"autopay"`
	AutoPayDelays          int64                  `json:"autopay_delay_days"`
	AvalaraEntityUseCode   string                 `json:"avalara_entity_use_code"`
	AvalaraExemptionNumber string                 `json:"avalara_exemption_number"`
	BillToParent           bool                   `json:"bill_to_parent"`
	Chase                  bool                   `json:"boolean"`
	ChasingCadence         int64                  `json:"chasing_cadence"`
	City                   string                 `json:"city"`
	Country                string                 `json:"country"`
	CreatedAt              int64                  `json:"created_at"`
	CreditHold             bool                   `json:"credit_hold"`
	CreditLimit            float64                `json:"credit_limit"`
	Currency               string                 `json:"currency"`
	DisabledPaymentMethods []string               `json:"disabled_payment_methods"`
	Email                  string                 `json:"email"`
	Id                     int64                  `json:"id"`
	Language               string                 `json:"language"`
	Metadata               map[string]interface{} `json:"metadata"`
	Name                   string                 `json:"name"`
	NextChaseStep          int64                  `json:"next_chase_step"`
	Notes                  string                 `json:"notes"`
	Number                 string                 `json:"number"`
	Object                 string                 `json:"object"`
	Owner                  int64                  `json:"owner"`
	ParentCustomer         int64                  `json:"parent_customer"`
	PaymentSource          *PaymentSource         `json:"payment_source"`
	PaymentTerms           string                 `json:"payment_terms"`
	Phone                  string                 `json:"phone"`
	PostalCode             string                 `json:"postal_code"`
	SignUpPage             int64                  `json:"sign_up_page"`
	SignUpUrl              string                 `json:"sign_up_url"`
	State                  string                 `json:"state"`
	StatementPdfUrl        string                 `json:"statement_pdf_url"`
	TaxId                  string                 `json:"taxid"`
	Taxable                bool                   `json:"taxable"`
	Taxes                  []TaxRate              `json:"taxes"`
	Type                   string                 `json:"type"`
	UpdatedAt              int64                  `json:"updated_at"`
}

func (*Customer) String

func (c *Customer) String() string

type CustomerRequest

type CustomerRequest struct {
	Address1               *string                 `json:"address1,omitempty"`
	Address2               *string                 `json:"address2,omitempty"`
	AttentionTo            *string                 `json:"attention_to,omitempty"`
	AutoPay                *bool                   `json:"autopay,omitempty"`
	AutoPayDelays          *int64                  `json:"autopay_delay_days,omitempty"`
	AvalaraEntityUseCode   *string                 `json:"avalara_entity_use_code,omitempty"`
	AvalaraExemptionNumber *string                 `json:"avalara_exemption_number,omitempty"`
	BillToParent           *bool                   `json:"bill_to_parent,omitempty"`
	Chase                  *bool                   `json:"boolean,omitempty"`
	ChasingCadence         *int64                  `json:"chasing_cadence,omitempty"`
	City                   *string                 `json:"city,omitempty"`
	Country                *string                 `json:"country,omitempty"`
	CreatedAt              *int64                  `json:"created_at,omitempty"`
	CreditHold             *bool                   `json:"credit_hold,omitempty"`
	CreditLimit            *float64                `json:"credit_limit,omitempty"`
	Currency               *string                 `json:"currency,omitempty"`
	DisabledPaymentMethods []*string               `json:"disabled_payment_methods,omitempty"`
	Email                  *string                 `json:"email,omitempty"`
	Id                     *int64                  `json:"id,omitempty"`
	Language               *string                 `json:"language,omitempty"`
	Metadata               *map[string]interface{} `json:"metadata,omitempty"`
	Name                   *string                 `json:"name,omitempty"`
	NextChaseStep          *int64                  `json:"next_chase_step,omitempty"`
	Notes                  *string                 `json:"notes,omitempty"`
	Number                 *string                 `json:"number,omitempty"`
	Object                 *string                 `json:"object,omitempty"`
	Owner                  *int64                  `json:"owner,omitempty"`
	ParentCustomer         *int64                  `json:"parent_customer,omitempty"`
	PaymentSource          *PaymentSource          `json:"payment_source,omitempty"`
	PaymentTerms           *string                 `json:"payment_terms,omitempty"`
	Phone                  *string                 `json:"phone,omitempty"`
	PostalCode             *string                 `json:"postal_code,omitempty"`
	SignUpPage             *int64                  `json:"sign_up_page,omitempty"`
	SignUpUrl              *string                 `json:"sign_up_url,omitempty"`
	State                  *string                 `json:"state,omitempty"`
	StatementPdfUrl        *string                 `json:"statement_pdf_url,omitempty"`
	TaxId                  *string                 `json:"taxid,omitempty"`
	Taxable                *bool                   `json:"taxable,omitempty"`
	Taxes                  []*TaxRate              `json:"taxes,omitempty"`
	Type                   *string                 `json:"type,omitempty"`
	UpdatedAt              *int64                  `json:"updated_at,omitempty"`
}

type Customers

type Customers []*Customer

type Discount

type Discount struct {
	Id      int64   `json:"id"`
	Amount  float64 `json:"amount"`
	Coupon  TaxRate `json:"coupon"`
	Expires int64   `json:"expires"`
}

type DiscountRequest

type DiscountRequest struct {
	Amount  *float64 `json:"amount,omitempty"`
	Coupon  *TaxRate `json:"coupon,omitempty"`
	Expires *int64   `json:"expires,omitempty"`
}

type EmailRecipient

type EmailRecipient struct {
	Email *string `json:"email,omitempty"`
	Name  *string `json:"name,omitempty"`
}

type Estimate

type Estimate struct {
	Approved               string                 `json:"approved"`
	Attachments            []int64                `json:"attachments"`
	Closed                 bool                   `json:"closed"`
	CreatedAt              int64                  `json:"created_at"`
	Currency               string                 `json:"currency"`
	Customer               int64                  `json:"customer"`
	Date                   int64                  `json:"date"`
	Deposit                float64                `json:"deposit"`
	DepositPaid            bool                   `json:"deposit_paid"`
	DisabledPaymentMethods []string               `json:"disabled_payment_methods"`
	Discounts              []Discount             `json:"discounts"`
	Draft                  bool                   `json:"draft"`
	ExpirationDate         int64                  `json:"expiration_date"`
	Id                     int64                  `json:"id"`
	Invoice                int64                  `json:"invoice"`
	Items                  []LineItem             `json:"items"`
	Metadata               map[string]interface{} `json:"metadata"`
	Name                   string                 `json:"name"`
	Notes                  string                 `json:"notes"`
	Number                 string                 `json:"number"`
	Object                 string                 `json:"object"`
	PaymentTerms           string                 `json:"payment_terms"`
	PdfUrl                 string                 `json:"pdf_url"`
	PurchaseOrder          string                 `json:"purchase_order"`
	ShipTo                 string                 `json:"ship_to"`
	Status                 string                 `json:"status"`
	Subtotal               float64                `json:"subtotal"`
	Taxes                  []Tax                  `json:"taxes"`
	Total                  float64                `json:"total"`
	UpdatedAt              int64                  `json:"updated_at"`
	Url                    string                 `json:"url"`
}

func (*Estimate) String

func (i *Estimate) String() string

type EstimateRequest

type EstimateRequest struct {
	Approved               *string                 `json:"approved,omitempty"`
	Attachments            []*int64                `json:"attachments,omitempty"`
	CalculateTax           *bool                   `json:"calculate_taxes,omitempty"`
	Closed                 *bool                   `json:"closed,omitempty"`
	Currency               *string                 `json:"currency,omitempty"`
	Customer               *int64                  `json:"customer,omitempty"`
	Date                   *int64                  `json:"date,omitempty"`
	Deposit                *float64                `json:"deposit,omitempty"`
	DepositPaid            *bool                   `json:"deposit_paid,omitempty"`
	DisabledPaymentMethods []*string               `json:"disabled_payment_methods,omitempty"`
	Discounts              []*DiscountRequest      `json:"discounts,omitempty"`
	Draft                  *bool                   `json:"draft,omitempty"`
	ExpirationDate         *int64                  `json:"expiration_date,omitempty"`
	Items                  []*LineItemRequest      `json:"items,omitempty"`
	Metadata               *map[string]interface{} `json:"metadata,omitempty"`
	Name                   *string                 `json:"name,omitempty"`
	Notes                  *string                 `json:"notes,omitempty"`
	Number                 *string                 `json:"number,omitempty"`
	PaymentTerms           *string                 `json:"payment_terms,omitempty"`
	PurchaseOrder          *string                 `json:"purchase_order,omitempty"`
	ShipTo                 *string                 `json:"ship_to,omitempty"`
	Taxes                  []*TaxRequest           `json:"taxes,omitempty"`
	UpdatedAt              *int64                  `json:"updated_at,omitempty"`
}

type Estimates

type Estimates []*Estimate

type Event

type Event struct {
	Id        int64           `json:"id"`
	Object    string          `json:"object"`
	Type      string          `json:"type"`
	Timestamp int64           `json:"timestamp"`
	Data      json.RawMessage `json:"data"`
	User      *User           `json:"user"`
}

func (*Event) ParseCustomerEvent

func (e *Event) ParseCustomerEvent() (*Customer, error)

func (*Event) ParseCustomerPreviousEvent

func (e *Event) ParseCustomerPreviousEvent() (*Customer, error)

func (*Event) ParseEventObject

func (e *Event) ParseEventObject() (*json.RawMessage, error)

func (*Event) ParseEventPreviousObject

func (e *Event) ParseEventPreviousObject() (*json.RawMessage, error)

func (*Event) ParseInvoiceEvent

func (e *Event) ParseInvoiceEvent() (*Invoice, error)

func (*Event) ParseInvoicePreviousEvent

func (e *Event) ParseInvoicePreviousEvent() (*Invoice, error)

func (*Event) ParsePaymentEvent

func (e *Event) ParsePaymentEvent() (*Payment, error)

func (*Event) ParseSubscriptionEvent

func (e *Event) ParseSubscriptionEvent() (*Subscription, error)

type EventObject

type EventObject struct {
	Object         *json.RawMessage `json:"object"`
	PreviousObject *json.RawMessage `json:"previous"`
}

type Events

type Events []*Event

type Exclude

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

func NewExclude

func NewExclude() *Exclude

func (*Exclude) Set

func (e *Exclude) Set(key string)

func (*Exclude) String

func (e *Exclude) String() string

type Expand

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

func NewExpand

func NewExpand() *Expand

func (*Expand) Set

func (e *Expand) Set(key string)

func (*Expand) String

func (e *Expand) String() string

type File

type File struct {
	CreatedAt int64  `json:"created_at"`
	Id        int64  `json:"id"`
	Name      string `json:"name"`
	Object    string `json:"object"`
	Size      int64  `json:"size"`
	Type      string `json:"type"`
	UpdatedAt int64  `json:"updated_at"`
	Url       string `json:"url"`
}

type FileRequest

type FileRequest struct {
	Name *string `json:"name,omitempty"`
	Size *int64  `json:"size,omitempty"`
	Type *string `json:"type,omitempty"`
	Url  *string `json:"url,omitempty"`
}

type Files

type Files []*File

type Filter

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

func NewFilter

func NewFilter() *Filter

func NewMetadataFilter

func NewMetadataFilter() *Filter

func (*Filter) Get

func (f *Filter) Get(key string) string

func (*Filter) Set

func (f *Filter) Set(key string, value interface{}) error

Can only set Numeric Types and Strings

func (*Filter) String

func (f *Filter) String() string

type Invoice

type Invoice struct {
	Attachments            []int64                `json:"attachments"`
	AttemptCount           int64                  `json:"attempt_count"`
	AutoPay                bool                   `json:"autopay"`
	Balance                float64                `json:"balance"`
	Closed                 bool                   `json:"closed"`
	CreatedAt              int64                  `json:"created_at"`
	Currency               string                 `json:"currency"`
	Customer               int64                  `json:"-"`
	CustomerFull           *Customer              `json:"-"`
	CustomerRaw            json.RawMessage        `json:"customer"`
	Date                   int64                  `json:"date"`
	DisabledPaymentMethods []string               `json:"disabled_payment_methods"`
	Discounts              []Discount             `json:"discounts"`
	Draft                  bool                   `json:"draft"`
	DueDate                int64                  `json:"due_date"`
	Id                     int64                  `json:"id"`
	Items                  []LineItem             `json:"items"`
	Metadata               map[string]interface{} `json:"metadata"`
	Name                   string                 `json:"name"`
	NextPaymentAttempt     int64                  `json:"next_payment_attempt"`
	Notes                  string                 `json:"notes"`
	Number                 string                 `json:"number"`
	Object                 string                 `json:"object"`
	Paid                   bool                   `json:"paid"`
	PaymentPlan            int64                  `json:"payment_plan"`
	PaymentTerms           string                 `json:"payment_terms"`
	PaymentUrl             string                 `json:"payment_url"`
	PdfUrl                 string                 `json:"pdf_url"`
	PurchaseOrder          string                 `json:"purchase_order"`
	Sent                   bool                   `json:"sent"`
	ShipTo                 *ShippingDetail        `json:"ship_to"`
	Status                 string                 `json:"status"`
	Subscription           int64                  `json:"subscription"`
	Subtotal               float64                `json:"subtotal"`
	Taxes                  []Tax                  `json:"taxes"`
	Total                  float64                `json:"total"`
	UpdatedAt              int64                  `json:"updated_at"`
	Url                    string                 `json:"url"`
}

func (*Invoice) MarshalJSON

func (i *Invoice) MarshalJSON() ([]byte, error)

func (*Invoice) String

func (i *Invoice) String() string

func (*Invoice) TotalDiscountAmount

func (i *Invoice) TotalDiscountAmount() float64

func (*Invoice) TotalTaxAmount

func (i *Invoice) TotalTaxAmount() float64

func (*Invoice) UnmarshalJSON

func (i *Invoice) UnmarshalJSON(data []byte) error

type InvoiceRequest

type InvoiceRequest struct {
	Attachments            []*int64                `json:"attachments,omitempty"`
	AutoPay                *bool                   `json:"autopay,omitempty"`
	CalculateTaxes         *bool                   `json:"calculate_taxes,omitempty"`
	Closed                 *bool                   `json:"closed,omitempty"`
	Currency               *string                 `json:"currency,omitempty"`
	Customer               *int64                  `json:"-"`
	Date                   *int64                  `json:"date,omitempty"`
	DisabledPaymentMethods []*string               `json:"disabled_payment_methods,omitempty"`
	Discounts              []*DiscountRequest      `json:"discounts,omitempty"`
	Draft                  *bool                   `json:"draft,omitempty"`
	DueDate                *int64                  `json:"due_date,omitempty"`
	Items                  []*LineItemRequest      `json:"items,omitempty"`
	Metadata               *map[string]interface{} `json:"metadata,omitempty"`
	Name                   *string                 `json:"name,omitempty"`
	NextPaymentAttempt     *int64                  `json:"next_payment_attempt,omitempty"`
	Notes                  *string                 `json:"notes,omitempty"`
	Number                 *string                 `json:"number,omitempty"`
	PaymentTerms           *string                 `json:"payment_terms,omitempty"`
	PurchaseOrder          *string                 `json:"purchase_order,omitempty"`
	Sent                   *bool                   `json:"sent,omitempty"`
	ShipTo                 *ShippingDetailRequest  `json:"ship_to,omitempty"`
	Taxes                  []*TaxRequest           `json:"taxes,omitempty"`
}

type Invoices

type Invoices []*Invoice

type Item

type Item struct {
	AvalaraLocationCode string                 `json:"avalara_location_code"`
	AvalaraTaxCode      string                 `json:"avalara_tax_code"`
	CreatedAt           int64                  `json:"created_at"`
	Currency            string                 `json:"currency"`
	Description         string                 `json:"description"`
	Discountable        bool                   `json:"discountable"`
	GlAccount           string                 `json:"gl_account"`
	Id                  string                 `json:"id"`
	Metadata            map[string]interface{} `json:"metadata"`
	Name                string                 `json:"name"`
	Object              string                 `json:"object"`
	Taxable             bool                   `json:"taxable"`
	Taxes               []Tax                  `json:"taxes"`
	Type                string                 `json:"service"`
	UnitCost            float64                `json:"unit_cost"`
	UpdatedAt           int64                  `json:"updated_at"`
}

type ItemRequest

type ItemRequest struct {
	AvalaraLocationCode *string                 `json:"avalara_location_code,omitempty"`
	AvalaraTaxCode      *string                 `json:"avalara_tax_code,omitempty"`
	Currency            *string                 `json:"currency,omitempty"`
	Description         *string                 `json:"description,omitempty"`
	Discountable        *bool                   `json:"discountable,omitempty"`
	GlAccount           *string                 `json:"gl_account,omitempty"`
	Id                  *string                 `json:"id,omitempty"`
	Metadata            *map[string]interface{} `json:"metadata,omitempty"`
	Name                *string                 `json:"name,omitempty"`
	Taxable             *bool                   `json:"taxable,omitempty"`
	Taxes               []*TaxRequest           `json:"taxes,omitempty"`
	Type                *string                 `json:"service,omitempty"`
	UnitCost            *float64                `json:"unit_cost,omitempty"`
}

type Items

type Items []*Item

type Letter

type Letter struct {
	CreatedAt            int64  `json:"created_at"`
	ExpectedDeliveryDate int64  `json:"expected_delivery_date"`
	Id                   string `json:"id"`
	NumPages             int64  `json:"num_pages"`
	State                string `json:"state"`
	To                   string `json:"to"`
	UpdatedAt            int64  `json:"updated_at"`
}

type LineItem

type LineItem struct {
	Amount       float64                `json:"amount"`
	Description  string                 `json:"description"`
	Discountable bool                   `json:"discountable"`
	Discounts    []Discount             `json:"discounts"`
	Id           int64                  `json:"id"`
	Item         string                 `json:"catalog_item"`
	Metadata     map[string]interface{} `json:"metadata"`
	Name         string                 `json:"name"`
	PeriodEnd    int64                  `json:"period_end"`
	PeriodStart  int64                  `json:"period_start"`
	Plan         string                 `json:"plan"`
	Prorated     bool                   `json:"prorated"`
	Quantity     float64                `json:"quantity"`
	Taxable      bool                   `json:"taxable"`
	Taxes        []Tax                  `json:"taxes"`
	Type         string                 `json:"type"`
	UnitCost     float64                `json:"unit_cost"`
}

type LineItemPreview

type LineItemPreview struct {
	Amount       float64                `json:"amount"`
	Description  string                 `json:"description"`
	Discountable bool                   `json:"discountable"`
	Discounts    []Discount             `json:"discounts"`
	Item         string                 `json:"catalog_item"`
	Metadata     map[string]interface{} `json:"metadata"`
	Name         string                 `json:"name"`
	PeriodEnd    int64                  `json:"period_end"`
	PeriodStart  int64                  `json:"period_start"`
	Plan         string                 `json:"plan"`
	Prorated     bool                   `json:"prorated"`
	Quantity     float64                `json:"quantity"`
	Taxable      bool                   `json:"taxable"`
	Taxes        []Tax                  `json:"taxes"`
	Type         string                 `json:"type"`
	UnitCost     float64                `json:"unit_cost"`
}

type LineItemRequest

type LineItemRequest struct {
	Amount       *float64                `json:"amount,omitempty"`
	Description  *string                 `json:"description,omitempty"`
	Discountable *bool                   `json:"discountable,omitempty"`
	Discounts    []*DiscountRequest      `json:"discounts,omitempty"`
	Item         *string                 `json:"catalog_item,omitempty"`
	Metadata     *map[string]interface{} `json:"metadata,omitempty"`
	Name         *string                 `json:"name,omitempty"`
	PeriodEnd    *int64                  `json:"period_end,omitempty"`
	PeriodStart  *int64                  `json:"period_start,omitempty"`
	Plan         *string                 `json:"plan,omitempty"`
	Prorated     *bool                   `json:"prorated,omitempty"`
	Quantity     *float64                `json:"quantity,omitempty"`
	Taxable      *bool                   `json:"taxable,omitempty"`
	Taxes        []*TaxRequest           `json:"taxes,omitempty"`
	Type         *string                 `json:"type,omitempty"`
	UnitCost     *float64                `json:"unit_cost,omitempty"`
}

type Member

type Member struct {
	CreatedAt            int64               `json:"created_at"`
	UpdatedAt            int64               `json:"updated_at"`
	EmailUpdateFrequency string              `json:"email_update_frequency"`
	Id                   int64               `json:"id"`
	LastSignedIn         int64               `json:"last_accessed"`
	RestrictionMode      string              `json:"restriction_mode"`
	Restrictions         map[string][]string `json:"restrictions"`
	Role                 string              `json:"role"`
	User                 *User               `json:"user"`
}

type MemberRequest

type MemberRequest struct {
	Email           *string              `json:"email,omitempty"`
	FirstName       *string              `json:"first_name,omitempty"`
	LastName        *string              `json:"last_name,omitempty"`
	RestrictionMode *string              `json:"restriction_mode,omitempty"`
	Restrictions    *map[string][]string `json:"restrictions,omitempty"`
	Role            *string              `json:"role,omitempty"`
}

type MemberRequests

type MemberRequests []MemberRequest

type Members

type Members []*Member

type Note

type Note struct {
	CreatedAt int64  `json:"created_at"`
	Customer  int64  `json:"customer"`
	Id        int64  `json:"id"`
	Notes     string `json:"notes"`
	Object    string `json:"object"`
	UpdatedAt int64  `json:"updated_at"`
	User      *User  `json:"user"`
}

type NoteRequest

type NoteRequest struct {
	Customer *int64  `json:"customer_id,omitempty"`
	Invoice  *int64  `json:"invoice_id,omitempty"`
	Notes    *string `json:"notes,omitempty"`
}

type Notes

type Notes []*Note

type Notification

type Notification struct {
	Conditions string `json:"conditions"`
	Enabled    bool   `json:"enabled"`
	Event      string `json:"event"`
	Id         int64  `json:"id"`
	MatchMode  string `json:"match_mode"`
	Medium     string `json:"medium"`
	User       int64  `json:"user_id"`
}

type NotificationRequest

type NotificationRequest struct {
	Enabled *bool   `json:"enabled,omitempty"`
	Event   *string `json:"event,omitempty"`
	Medium  *string `json:"medium,omitempty"`
	Role    *string `json:"role,omitempty"`
	User    *int64  `json:"user_id,omitempty"`
}

type Notifications

type Notifications []*Notification

type Payment

type Payment struct {
	Amount       float64         `json:"amount"`
	AppliedTo    []PaymentItem   `json:"applied_to"`
	Balance      float64         `json:"balance"`
	Charge       *Charge         `json:"charge"`
	CreatedAt    int64           `json:"created_at"`
	Currency     string          `json:"currency"`
	Customer     int64           `json:"-"`
	CustomerFull *Customer       `json:"-"`
	CustomerRaw  json.RawMessage `json:"customer"`
	Date         int64           `json:"date"`
	Id           int64           `json:"id"`
	Matched      bool            `json:"matched"`
	Method       string          `json:"method"`
	Notes        string          `json:"notes"`
	Object       string          `json:"object"`
	PdfUrl       string          `json:"pdf_url"`
	Reference    string          `json:"reference"`
	Source       string          `json:"source"`
	Status       string          `json:"status"`
	UpdatedAt    int64           `json:"updated_at"`
	Voided       bool            `json:"voided"`
}

func (*Payment) MarshalJSON

func (i *Payment) MarshalJSON() ([]byte, error)

func (*Payment) String

func (i *Payment) String() string

func (*Payment) UnmarshalJSON

func (i *Payment) UnmarshalJSON(data []byte) error

type PaymentItem

type PaymentItem struct {
	Amount       float64 `json:"amount"`
	CreditNote   int64   `json:"credit_note"`
	DocumentType string  `json:"document_type"`
	Estimate     int64   `json:"estimate"`
	Invoice      int64   `json:"invoice"`
	Type         string  `json:"type"`
}

type PaymentItemRequest

type PaymentItemRequest struct {
	Amount       *float64 `json:"amount,omitempty"`
	CreditNote   *int64   `json:"credit_note,omitempty"`
	DocumentType *string  `json:"document_type,omitempty"`
	Estimate     *int64   `json:"estimate,omitempty"`
	Invoice      *int64   `json:"invoice,omitempty"`
	Type         *string  `json:"type,omitempty"`
}

type PaymentPlan

type PaymentPlan struct {
	Approval     *PaymentPlanApproval     `json:"approval,omitempty"`
	CreatedAt    int64                    `json:"created_at,omitempty"`
	Id           int64                    `json:"id,omitempty"`
	Installments []PaymentPlanInstallment `json:"installments,omitempty"`
	Object       string                   `json:"object,omitempty"`
	Status       string                   `json:"status,omitempty"`
	UpdatedAt    int64                    `json:"updated_at,omitempty"`
}

type PaymentPlanApproval

type PaymentPlanApproval struct {
	Id        int64  `json:"id,omitempty"`
	Ip        string `json:"ip,omitempty"`
	Timestamp int64  `json:"timestamp,omitempty"`
	UserAgent string `json:"user_agent,omitempty"`
}

type PaymentPlanInstallment

type PaymentPlanInstallment struct {
	Amount  float64 `json:"amount,omitempty"`
	Balance float64 `json:"balance,omitempty"`
	Date    int64   `json:"date,omitempty"`
	Id      int64   `json:"id,omitempty"`
}

type PaymentPlanInstallmentRequest

type PaymentPlanInstallmentRequest struct {
	Amount  *float64 `json:"amount,omitempty"`
	Balance *float64 `json:"balance,omitempty"`
	Date    *int64   `json:"date,omitempty"`
}

type PaymentPlanInstallments

type PaymentPlanInstallments []*PaymentPlanInstallment

type PaymentPlanRequest

type PaymentPlanRequest struct {
	Installments []*PaymentPlanInstallmentRequest `json:"installments,omitempty"`
}

type PaymentRequest

type PaymentRequest struct {
	Amount    *float64              `json:"amount,omitempty"`
	AppliedTo []*PaymentItemRequest `json:"applied_to,omitempty"`
	Currency  *string               `json:"currency,omitempty"`
	Customer  *int64                `json:"-"`
	Date      *int64                `json:"date,omitempty"`
	Method    *string               `json:"method,omitempty"`
	Notes     *string               `json:"notes,omitempty"`
	Reference *string               `json:"reference,omitempty"`
	Source    *string               `json:"source,omitempty"`
	Voided    *bool                 `json:"voided,omitempty"`
}

type PaymentSource

type PaymentSource struct {
	*BankAccount
	*Card
	Object string `json:"object"`
}

func (*PaymentSource) UnmarshalJSON

func (d *PaymentSource) UnmarshalJSON(data []byte) error

type PaymentSourceRequest

type PaymentSourceRequest struct {
	GatewayToken  *string `json:"gateway_token,omitempty"`
	InvoicedToken *string `json:"invoiced_token,omitempty"`
	MakeDefault   *bool   `json:"make_default,omitempty"`
	Method        *string `json:"method,omitempty"`
	Object        *string `json:"object,omitempty"`
}

type PaymentSources

type PaymentSources []*PaymentSource

type Payments

type Payments []*Payment

type PendingLineItem

type PendingLineItem struct {
	Description  string                 `json:"description"`
	Discountable bool                   `json:"discountable"`
	Discounts    []Discount             `json:"discounts"`
	Id           int64                  `json:"id"`
	Item         string                 `json:"catalog_item"`
	Metadata     map[string]interface{} `json:"metadata"`
	Name         string                 `json:"name"`
	Quantity     float64                `json:"quantity"`
	Taxable      bool                   `json:"taxable"`
	Taxes        []Tax                  `json:"taxes"`
	Type         string                 `json:"type"`
	UnitCost     float64                `json:"unit_cost"`
}

type PendingLineItemRequest

type PendingLineItemRequest struct {
	Description  *string                 `json:"description,omitempty"`
	Discountable *bool                   `json:"discountable,omitempty"`
	Discounts    []*DiscountRequest      `json:"discounts,omitempty"`
	Item         *string                 `json:"catalog_item,omitempty"`
	Metadata     *map[string]interface{} `json:"metadata,omitempty"`
	Name         *string                 `json:"name,omitempty"`
	Quantity     *float64                `json:"quantity,omitempty"`
	Taxable      *bool                   `json:"taxable,omitempty"`
	Taxes        []*TaxRequest           `json:"taxes,omitempty"`
	Type         *string                 `json:"type,omitempty"`
	UnitCost     *float64                `json:"unit_cost,omitempty"`
}

type PendingLineItems

type PendingLineItems []PendingLineItem

type Plan

type Plan struct {
	Amount                float64                `json:"amount"`
	CreatedAt             int64                  `json:"created_at"`
	Currency              string                 `json:"currency"`
	Id                    string                 `json:"id"`
	Interval              string                 `json:"interval"`
	IntervalCount         float64                `json:"interval_count"`
	Item                  string                 `json:"catalog_item"`
	Metadata              map[string]interface{} `json:"metadata"`
	Name                  string                 `json:"name"`
	NumberOfSubscriptions *int64                 `json:"num_subscriptions"`
	Object                string                 `json:"object"`
	PricingMode           string                 `json:"pricing_mode"`
	QuantityType          string                 `json:"quantity_type"`
	Tiers                 []Tier                 `json:"tier"`
	UpdatedAt             int64                  `json:"updated_at"`
}

type PlanRequest

type PlanRequest struct {
	Amount        *float64                `json:"amount,omitempty"`
	Currency      *string                 `json:"currency,omitempty"`
	Id            *string                 `json:"id,omitempty"`
	Interval      *string                 `json:"interval,omitempty"`
	IntervalCount *float64                `json:"interval_count,omitempty"`
	Item          *string                 `json:"catalog_item,omitempty"`
	Metadata      *map[string]interface{} `json:"metadata,omitempty"`
	Name          *string                 `json:"name,omitempty"`
	PricingMode   *string                 `json:"pricing_mode,omitempty"`
	QuantityType  *string                 `json:"quantity_type,omitempty"`
	Tiers         []*TierRequest          `json:"tier,omitempty"`
}

type Plans

type Plans []*Plan

type Refund

type Refund struct {
	Amount         float64 `json:"amount,omitempty"`
	Charge         int64   `json:"charge,omitempty"`
	CreatedAt      int64   `json:"created_at,omitempty"`
	Currency       string  `json:"currency,omitempty"`
	FailureMessage string  `json:"failure_message,omitempty"`
	Gateway        string  `json:"gateway,omitempty"`
	GatewayId      string  `json:"gateway_id,omitempty"`
	Id             int64   `json:"id,omitempty"`
	Object         string  `json:"object,omitempty"`
	Status         string  `json:"status,omitempty"`
	UpdatedAt      int64   `json:"updated_at,omitempty"`
}

type RefundRequest

type RefundRequest struct {
	Amount *float64 `json:"amount,omitempty"`
}

type Role

type Role struct {
	Id   string `json:"id"`
	Name string `json:"name"`
}

type Roles

type Roles []*Role

type SendEmailRequest

type SendEmailRequest struct {
	Bcc      *string           `json:"bcc,omitempty"`
	Message  *string           `json:"message,omitempty"`
	Subject  *string           `json:"subject,omitempty"`
	Template *string           `json:"template,omitempty"`
	To       []*EmailRecipient `json:"to,omitempty"`
}

type SendStatementEmailRequest

type SendStatementEmailRequest struct {
	Bcc      *string           `json:"bcc,omitempty"`
	End      *int64            `json:"end,omitempty"`
	Items    *string           `json:"items,omitempty"`
	Message  *string           `json:"message,omitempty"`
	Start    *int64            `json:"start,omitempty"`
	Subject  *string           `json:"subject,omitempty"`
	Template *string           `json:"template,omitempty"`
	To       []*EmailRecipient `json:"to,omitempty"`
	Type     *string           `json:"type,omitempty"`
}

type SendStatementLetterRequest

type SendStatementLetterRequest struct {
	End   *int64  `json:"end,omitempty"`
	Items *string `json:"items,omitempty"`
	Start *int64  `json:"start,omitempty"`
	Type  *string `json:"type,omitempty"`
}

type SendStatementTextMessageRequest

type SendStatementTextMessageRequest struct {
	To      []*TextMessageRecipient `json:"to,omitempty"`
	Message *string                 `json:"message,omitempty"`
	Type    *string                 `json:"type,omitempty"`
	Start   *int64                  `json:"start,omitempty"`
	End     *int64                  `json:"end,omitempty"`
	Items   *string                 `json:"items,omitempty"`
}

type SendTextMessageRequest

type SendTextMessageRequest struct {
	To      []*TextMessageRecipient `json:"to,omitempty"`
	Message *string                 `json:"message,omitempty"`
}

type ShippingDetail

type ShippingDetail struct {
	Address1    string `json:"address1"`
	Address2    string `json:"address2"`
	AttentionTo string `json:"attention_to"`
	City        string `json:"city"`
	Country     string `json:"country"`
	Name        string `json:"name"`
	PostalCode  string `json:"postal_code"`
	State       string `json:"state"`
}

type ShippingDetailRequest

type ShippingDetailRequest struct {
	Address1    *string `json:"address1,omitempty"`
	Address2    *string `json:"address2,omitempty"`
	AttentionTo *string `json:"attention_to,omitempty"`
	City        *string `json:"city,omitempty"`
	Country     *string `json:"country,omitempty"`
	Name        *string `json:"name,omitempty"`
	PostalCode  *string `json:"postal_code,omitempty"`
	State       *string `json:"state,omitempty"`
}

type Sort

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

func NewSort

func NewSort() *Sort

func (*Sort) Set

func (s *Sort) Set(column string, order SortOrder)

func (*Sort) String

func (s *Sort) String() string

type SortOrder

type SortOrder int
const (
	ASC SortOrder = iota
	DESC
)

func (SortOrder) String

func (s SortOrder) String() string

type Subscription

type Subscription struct {
	Addons                []SubscriptionAddon    `json:"addons"`
	Amount                float64                `json:"amount"`
	BillIn                string                 `json:"bill_in"`
	BillInAdvanceDays     int64                  `json:"bill_in_advance_days"`
	CancelAtPeriodEnd     bool                   `json:"cancel_at_period_end"`
	CanceledAt            int64                  `json:"cancel_at"`
	ContractPeriodEnd     int64                  `json:"contract_period_end"`
	ContractPeriodStart   int64                  `json:"contract_period_start"`
	ContractRenewalCycles int64                  `json:"contract_renewal_cycles"`
	ContractRenewalMode   string                 `json:"contract_renewal_mode"`
	CreatedAt             int64                  `json:"created_at"`
	Customer              int64                  `json:"-"`
	CustomerFull          *Customer              `json:"-"`
	CustomerRaw           json.RawMessage        `json:"customer"`
	Cycles                int64                  `json:"cycles"`
	Discounts             []Discount             `json:"discount"`
	Id                    int64                  `json:"id"`
	Metadata              map[string]interface{} `json:"metadata"`
	Mrr                   float64                `json:"MRR"`
	Object                string                 `json:"object"`
	Paused                bool                   `json:"paused"`
	PeriodEnd             int64                  `json:"period_end"`
	PeriodStart           int64                  `json:"period_start"`
	Plan                  string                 `json:"-"`
	PlanFull              *Plan                  `json:"-"`
	PlanRaw               json.RawMessage        `json:"plan"`
	Prorate               bool                   `json:"prorate"`
	Quantity              float64                `json:"quantity"`
	RecurringTotal        float64                `json:"recurring_total"`
	ShipTo                *ShippingDetail        `json:"ship_to"`
	StartDate             int64                  `json:"start_date"`
	Status                string                 `json:"status"`
	Taxes                 []Tax                  `json:"taxes"`
	UpdatedAt             int64                  `json:"updated_at"`
	Url                   string                 `json:"url"`
}

func (*Subscription) MarshalJSON

func (i *Subscription) MarshalJSON() ([]byte, error)

func (*Subscription) String

func (s *Subscription) String() string

func (*Subscription) UnmarshalJSON

func (i *Subscription) UnmarshalJSON(data []byte) error

type SubscriptionAddon

type SubscriptionAddon struct {
	Amount    float64 `json:"amount"`
	CreatedAt int64   `json:"created_at"`
	Id        int64   `json:"id"`
	Plan      string  `json:"plan"`
	Quantity  float64 `json:"quantity"`
}

type SubscriptionAddonRequest

type SubscriptionAddonRequest struct {
	Amount    *float64 `json:"amount,omitempty"`
	CreatedAt *int64   `json:"created_at,omitempty"`
	Id        *int64   `json:"id,omitempty"`
	Plan      *string  `json:"plan,omitempty"`
	Quantity  *float64 `json:"quantity,omitempty"`
}

type SubscriptionPreview

type SubscriptionPreview struct {
	FirstInvoice   *SubscriptionPreviewInvoice `json:"first_invoice"`
	MRR            float64                     `json:"mrr"`
	RecurringTotal float64                     `json:"recurring_total"`
}

type SubscriptionPreviewInvoice

type SubscriptionPreviewInvoice struct {
	AttemptCount       int64                  `json:"attempt_count"`
	AutoPay            bool                   `json:"autopay"`
	Balance            float64                `json:"balance"`
	Closed             bool                   `json:"closed"`
	CreatedAt          int64                  `json:"created_at"`
	Currency           string                 `json:"currency"`
	Customer           int64                  `json:"customer"`
	Date               int64                  `json:"date"`
	Discounts          []Discount             `json:"discounts"`
	Draft              bool                   `json:"draft"`
	DueDate            int64                  `json:"due_date"`
	Items              []LineItemPreview      `json:"items"`
	Metadata           map[string]interface{} `json:"metadata"`
	Name               string                 `json:"name"`
	NextPaymentAttempt int64                  `json:"next_payment_attempt"`
	Notes              string                 `json:"notes"`
	Number             string                 `json:"number"`
	Paid               bool                   `json:"paid"`
	PaymentTerms       string                 `json:"payment_terms"`
	PaymentUrl         string                 `json:"payment_url"`
	PdfUrl             string                 `json:"pdf_url"`
	Status             string                 `json:"status"`
	Subtotal           float64                `json:"subtotal"`
	Taxes              []Tax                  `json:"taxes"`
	Total              float64                `json:"total"`
	UpdatedAt          int64                  `json:"updated_at"`
	Url                string                 `json:"url"`
}

type SubscriptionPreviewRequest

type SubscriptionPreviewRequest struct {
	Addons           []*SubscriptionAddonRequest `json:"addons,omitempty"`
	Customer         *int64                      `json:"customer,omitempty"`
	Discounts        []*DiscountRequest          `json:"discounts,omitempty"`
	PendingLineItems []*PendingLineItemRequest   `json:"pending_line_item,omitempty"`
	Plan             *string                     `json:"plan,omitempty"`
	Quantity         *float64                    `json:"quantity,omitempty"`
	Taxes            []*TaxRequest               `json:"Taxes,omitempty"`
}

type SubscriptionRequest

type SubscriptionRequest struct {
	Addons                []*SubscriptionAddonRequest `json:"addons,omitempty"`
	Amount                *float64                    `json:"amount,omitempty"`
	BillIn                *string                     `json:"bill_in,omitempty"`
	BillInAdvanceDays     *int64                      `json:"bill_in_advance_days,omitempty"`
	CancelAtPeriodEnd     *bool                       `json:"cancel_at_period_end,omitempty"`
	ContractPeriodEnd     *int64                      `json:"contract_period_end,omitempty"`
	ContractPeriodStart   *int64                      `json:"contract_period_start,omitempty"`
	ContractRenewalCycles *int64                      `json:"contract_renewal_cycles,omitempty"`
	ContractRenewalMode   *string                     `json:"contract_renewal_mode,omitempty"`
	Customer              *int64                      `json:"customer,omitempty"`
	Cycles                *int64                      `json:"cycles,omitempty"`
	Discounts             []*DiscountRequest          `json:"discount,omitempty"`
	Metadata              *map[string]interface{}     `json:"metadata,omitempty"`
	Paused                *bool                       `json:"paused,omitempty"`
	PeriodEnd             *int64                      `json:"period_end,omitempty"`
	Plan                  *string                     `json:"plan,omitempty"`
	Prorate               *bool                       `json:"prorate,omitempty"`
	ProrationDate         *int64                      `json:"proration_date,omitempty"`
	Quantity              *float64                    `json:"quantity,omitempty"`
	ShipTo                *ShippingDetail             `json:"ship_to,omitempty"`
	SnapToNthDay          *int64                      `json:"snap_to_nth_day,omitempty"`
	StartDate             *int64                      `json:"start_date,omitempty"`
	Taxes                 []*TaxRequest               `json:"taxes,omitempty"`
}

type Subscriptions

type Subscriptions []*Subscription

type Task

type Task struct {
	Action          string `json:"action"`
	ChaseStep       int64  `json:"chase_step_id"`
	Complete        bool   `json:"complete"`
	CompletedByUser int64  `json:"completed_by_user_id"`
	CompletedDate   int64  `json:"completed_date"`
	CreatedAt       int64  `json:"created_at"`
	Customer        int64  `json:"customer_id"`
	DueDate         int64  `json:"due_date"`
	Id              int64  `json:"id"`
	Name            string `json:"name"`
	UpdatedAt       int64  `json:"updated_at"`
	User            int64  `json:"user_id"`
}

type TaskRequest

type TaskRequest struct {
	Action   *string `json:"action,omitempty"`
	Complete *bool   `json:"complete,omitempty"`
	Customer *int64  `json:"customer_id,omitempty"`
	DueDate  *int64  `json:"due_date,omitempty"`
	Name     *string `json:"name,omitempty"`
	User     *int64  `json:"user_id,omitempty"`
}

type Tasks

type Tasks []*Task

type Tax

type Tax struct {
	Amount  float64 `json:"amount"`
	Id      int64   `json:"id"`
	TaxRate TaxRate `json:"tax_rate"`
}

type TaxRate

type TaxRate struct {
	CreatedAt int64                  `json:"created_at"`
	Currency  string                 `json:"currency"`
	Id        string                 `json:"id"`
	Inclusive bool                   `json:"inclusive"`
	IsPercent bool                   `json:"is_percent"`
	Metadata  map[string]interface{} `json:"metadata"`
	Name      string                 `json:"name"`
	Object    string                 `json:"object"`
	UpdatedAt int64                  `json:"updated_at"`
	Value     float64                `json:"value"`
}

type TaxRateRequest

type TaxRateRequest struct {
	Currency  *string                 `json:"currency,omitempty"`
	Id        *string                 `json:"id,omitempty"`
	Inclusive *bool                   `json:"inclusive,omitempty"`
	IsPercent *bool                   `json:"is_percent,omitempty"`
	Metadata  *map[string]interface{} `json:"metadata,omitempty"`
	Name      *string                 `json:"name,omitempty"`
	Value     *float64                `json:"value,omitempty"`
}

type TaxRates

type TaxRates []*TaxRate

type TaxRequest

type TaxRequest struct {
	Amount  *float64 `json:"amount,omitempty"`
	TaxRate *TaxRate `json:"tax_rate,omitempty"`
}

type TextMessage

type TextMessage struct {
	Id        string `json:"id"`
	To        string `json:"to"`
	State     string `json:"state"`
	Message   string `json:"message"`
	CreatedAt int64  `json:"created_at"`
	UpdatedAt int64  `json:"updated_at"`
}

type TextMessageRecipient

type TextMessageRecipient struct {
	Name  *string `json:"name,omitempty"`
	Phone *string `json:"phone,omitempty"`
}

type TextMessages

type TextMessages []*TextMessage

type Tier

type Tier struct {
	MaxQty   float64 `json:"max_qty"`
	MinQty   float64 `json:"min_qty"`
	UnitCost float64 `json:"unit_cost"`
}

type TierRequest

type TierRequest struct {
	MaxQty   *float64 `json:"max_qty,omitempty"`
	MinQty   *float64 `json:"min_qty,omitempty"`
	UnitCost *float64 `json:"unit_cost,omitempty"`
}

type User

type User struct {
	Email            string `json:"email,omitempty"`
	FirstName        string `json:"first_name,omitempty"`
	Id               int64  `json:"id,omitempty"`
	LastName         string `json:"last_name,omitempty"`
	Registered       bool   `json:"registered,omitempty"`
	TwoFactorEnabled bool   `json:"two_factor_enabled,omitempty"`
}

func (*User) GenerateRegistrationURL

func (u *User) GenerateRegistrationURL(sandbox bool) string

type UserEmailUpdateRequest

type UserEmailUpdateRequest struct {
	EmailUpdateFrequency *string `json:"email_update_frequency"`
}

type UserInvite

type UserInvite struct {
	Id int64 `json:"id"`
}

type WebhookAttempt

type WebhookAttempt struct {
	Attempts  []WebhookAttemptStatus `json:"attempts,omitempty"`
	CreatedAt int64                  `json:"created_at,omitempty"`
	EventId   int64                  `json:"event_id,omitempty"`
	Id        int64                  `json:"id,omitempty"`
	Payload   json.RawMessage        `json:"payload,omitempty"`
	UpdatedAt int64                  `json:"updated_at,omitempty"`
}

type WebhookAttemptStatus

type WebhookAttemptStatus struct {
	StatusCode int64 `json:"status_code,omitempty"`
	Timestamp  int64 `json:"timestamp,omitempty"`
}

type WebhookAttempts

type WebhookAttempts []*WebhookAttempt

Jump to

Keyboard shortcuts

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