quickbooks

package module
v0.0.0-...-6478e63 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2025 License: MIT Imports: 13 Imported by: 0

README

go-quickbooks

Quickbooks online SDK for Go, with OAuth 2.0

Build Status

Documentation

Index

Constants

View Source
const (
	AccountingScope          = "com.intuit.quickbooks.accounting"
	PaymentsScope            = "com.intuit.quickbooks.payment"
	PayrollScope             = "com.intuit.quickbooks.payroll"
	PayrollTimetrackingScope = "com.intuit.quickbooks.payroll.timetracking"
	PayrollBenefitsScope     = "com.intuit.quickbooks.payroll.benefits"
)

Variables

This section is empty.

Functions

func GetConnectURL

func GetConnectURL(clientID, scope, redirectURI, csrfToken string, isSandbox bool) (string, error)

GetConnectURL gets quickbooks login url for OAuth2

func RevokeToken

func RevokeToken(clientID, clientSecret string, refreshToken string, isSandbox bool) error

RevokeToken revokes existing bearer tokens

Types

type Account

type Account struct {
	Name                          string       `json:"Name"`
	SubAccount                    bool         `json:"SubAccount,omitempty"`
	FullyQualifiedName            string       `json:"FullyQualifiedName,omitempty"`
	Active                        bool         `json:"Active,omitempty"`
	Classification                string       `json:"Classification,omitempty"`
	AccountType                   string       `json:"AccountType"`
	AccountSubType                string       `json:"AccountSubType,omitempty"`
	AcctNum                       string       `json:"AcctNum,omitempty"`
	CurrentBalance                float64      `json:"CurrentBalance,omitempty"`
	CurrentBalanceWithSubAccounts float64      `json:"CurrentBalanceWithSubAccounts,omitempty"`
	CurrencyRef                   *CurrencyRef `json:"CurrencyRef,omitempty"`
	Domain                        string       `json:"domain,omitempty"`
	Sparse                        bool         `json:"sparse,omitempty"`
	ID                            string       `json:"Id,omitempty"`
	SyncToken                     string       `json:"SyncToken,omitempty"`
	MetaData                      *struct {
		CreateTime      string `json:"CreateTime,omitempty"`
		LastUpdatedTime string `json:"LastUpdatedTime,omitempty"`
	} `json:"MetaData,omitempty"`
}

Account quickbooks account type

type AccountObject

type AccountObject struct {
	Account Account `json:"Account"`
	Time    string  `json:"time"`
}

AccountObject the complete quickbooks account object type

type AccountRef

type AccountRef struct {
	Value string `json:"value"`
	Name  string `json:"name,omitempty"`
}

AccountRef chart of account reference

type Address

type Address struct {
	ID                     string `json:"Id,omitempty"`
	Line1                  string `json:"Line1"`
	Line2                  string `json:"Line2,omitempty"`
	City                   string `json:"City"`
	CountrySubDivisionCode string `json:"CountrySubDivisionCode"`
	PostalCode             string `json:"PostalCode"`
	Lat                    string `json:"Lat,omitempty"`
	Long                   string `json:"Long,omitempty"`
}

Address quickbooks address object

type BearerToken

type BearerToken struct {
	RefreshToken           string `json:"refresh_token"`
	AccessToken            string `json:"access_token"`
	TokenType              string `json:"token_type"`
	IDToken                string `json:"id_token"`
	ExpiresIn              int64  `json:"expires_in"`
	XRefreshTokenExpiresIn int64  `json:"x_refresh_token_expires_in"`
}

BearerToken token response type from quickbooks

func GetBearerToken

func GetBearerToken(clientID, clientSecret, code, redirectURI string, isSandbox bool) (*BearerToken, error)

GetBearerToken exchanges authorization code for bearer tokens

func RefreshToken

func RefreshToken(clientID, clientSecret string, refreshToken string, isSandbox bool) (*BearerToken, error)

RefreshToken gets new bearer token

type Class

type Class struct {
	Name               string `json:"Name"`
	SubClass           bool   `json:"SubClass"`
	FullyQualifiedName string `json:"FullyQualifiedName"`
	Active             bool   `json:"Active"`
	Domain             string `json:"domain"`
	Sparse             bool   `json:"sparse"`
	ID                 string `json:"Id"`
	SyncToken          string `json:"SyncToken"`
	MetaData           struct {
		CreateTime      string `json:"CreateTime"`
		LastUpdatedTime string `json:"LastUpdatedTime"`
	} `json:"MetaData"`
}

type ClassRef

type ClassRef struct {
	Value string `json:"value,omitempty"`
	Name  string `json:"name,omitempty"`
}

type Company

type Company struct {
	CompanyInfo `json:"CompanyInfo"`
	Time        string `json:"time"`
}

Company quickbooks object type

type CompanyInfo

type CompanyInfo struct {
	CompanyName string `json:"CompanyName"`
	LegalName   string `json:"LegalName"`
	CompanyAddr struct {
		ID                     string `json:"Id"`
		Line1                  string `json:"Line1"`
		City                   string `json:"City"`
		Country                string `json:"Country"`
		CountrySubDivisionCode string `json:"CountrySubDivisionCode"`
		PostalCode             string `json:"PostalCode"`
	} `json:"CompanyAddr"`
	CustomerCommunicationAddr struct {
		ID                     string `json:"Id"`
		Line1                  string `json:"Line1"`
		City                   string `json:"City"`
		Country                string `json:"Country"`
		CountrySubDivisionCode string `json:"CountrySubDivisionCode"`
		PostalCode             string `json:"PostalCode"`
	} `json:"CustomerCommunicationAddr"`
	LegalAddr struct {
		ID                     string `json:"Id"`
		Line1                  string `json:"Line1"`
		City                   string `json:"City"`
		Country                string `json:"Country"`
		CountrySubDivisionCode string `json:"CountrySubDivisionCode"`
		PostalCode             string `json:"PostalCode"`
	} `json:"LegalAddr"`
	PrimaryPhone struct {
		FreeFormNumber string `json:"FreeFormNumber"`
	} `json:"PrimaryPhone"`
	CompanyStartDate     string `json:"CompanyStartDate"`
	FiscalYearStartMonth string `json:"FiscalYearStartMonth"`
	Country              string `json:"Country"`
	Email                struct {
		Address string `json:"Address"`
	} `json:"Email"`
	WebAddr struct {
	} `json:"WebAddr"`
	SupportedLanguages string `json:"SupportedLanguages"`
	NameValue          []struct {
		Name  string `json:"Name"`
		Value string `json:"Value"`
	} `json:"NameValue"`
	Domain    string `json:"domain"`
	Sparse    bool   `json:"sparse"`
	ID        string `json:"Id"`
	SyncToken string `json:"SyncToken"`
	MetaData  struct {
		CreateTime      string `json:"CreateTime"`
		LastUpdatedTime string `json:"LastUpdatedTime"`
	} `json:"MetaData"`
}

type CreditMemo

type CreditMemo struct {
	ID           string           `json:"Id,omitempty"`
	Domain       string           `json:"domain,omitempty"`
	Sparse       bool             `json:"sparse,omitempty"`
	SyncToken    string           `json:"SyncToken,omitempty"`
	CustomField  *[]CustomField   `json:"CustomField,omitempty"`
	DocNumber    string           `json:"DocNumber,omitempty"`
	TxnDate      string           `json:"TxnDate,omitempty"`
	LinkedTxn    *[]LinkedTxn     `json:"LinkedTxn,omitempty"`
	Line         []CreditMemoLine `json:"Line"`
	TxnTaxDetail *struct {
		TxnTaxCodeRef *TaxCodeRef `json:"TxnTaxCodeRef,omitempty"`
		TotalTax      float64     `json:"TotalTax"`
		TaxLine       []TaxLine   `json:"TaxLine,omitempty"`
	} `json:"TxnTaxDetail,omitempty"`
	CustomerRef  *CustomerRef `json:"CustomerRef"`
	CustomerMemo *struct {
		Value string `json:"value"`
	} `json:"CustomerMemo,omitempty"`
	BillAddr     *Address `json:"BillAddr"`
	ShipAddr     *Address `json:"ShipAddr"`
	SalesTermRef *struct {
		Value string `json:"value"`
	} `json:"SalesTermRef,omitempty"`
	DueDate               string  `json:"DueDate,omitempty"`
	TotalAmt              float64 `json:"TotalAmt,omitempty"`
	ApplyTaxAfterDiscount bool    `json:"ApplyTaxAfterDiscount,omitempty"`
	PrintStatus           string  `json:"PrintStatus,omitempty"`
	EmailStatus           string  `json:"EmailStatus,omitempty"`
	BillEmail             *struct {
		Address string `json:"Address"`
	} `json:"BillEmail,omitempty"`
	Balance  float64 `json:"Balance,omitempty"`
	MetaData *struct {
		CreateTime      string `json:"CreateTime"`
		LastUpdatedTime string `json:"LastUpdatedTime"`
	} `json:"MetaData,omitempty"`
}

CreditMemo quickbooks creditmemo type

type CreditMemoLine

type CreditMemoLine struct {
	ID                  string               `json:"Id,omitempty"`
	LineNum             int                  `json:"LineNum,omitempty"`
	Description         string               `json:"Description,omitempty"`
	Amount              float64              `json:"Amount"`
	DetailType          string               `json:"DetailType"`
	SalesItemLineDetail *SalesItemLineDetail `json:"SalesItemLineDetail,omitempty"`
	SubTotalLineDetail  interface{}          `json:"SubTotalLineDetail,omitempty"`
}

CreditMemoLine quickbooks creditmemo line item object

type CreditMemoObject

type CreditMemoObject struct {
	CreditMemo CreditMemo `json:"CreditMemo"`
	Time       string     `json:"time"`
}

CreditMemoObject the complete quickbooks creditmemo object type

type CurrencyRef

type CurrencyRef struct {
	Value string `json:"value"`
	Name  string `json:"name,omitempty"`
}

CurrencyRef chart of account currency reference

type CustomField

type CustomField struct {
	DefinitionID string `json:"DefinitionId"`
	Name         string `json:"Name,omitempty"`
	Type         string `json:"Type"`
	StringValue  string `json:"StringValue,omitempty"`
}

CustomField quickbooks invoice customer field object

type Customer

type Customer struct {
	ID                      string   `json:"Id,omitempty"`
	Taxable                 bool     `json:"Taxable,omitempty"`
	BillAddr                *Address `json:"BillAddr,omitempty"`
	ShipAddr                *Address `json:"ShipAddr,omitempty"`
	Job                     bool     `json:"Job,omitempty"`
	BillWithParent          bool     `json:"BillWithParent,omitempty"`
	Balance                 float64  `json:"Balance,omitempty"`
	BalanceWithJobs         float64  `json:"BalanceWithJobs,omitempty"`
	PreferredDeliveryMethod string   `json:"PreferredDeliveryMethod,omitempty"`
	Domain                  string   `json:"domain,omitempty"`
	Sparse                  bool     `json:"sparse,omitempty"`
	SyncToken               string   `json:"SyncToken,omitempty"`
	GivenName               string   `json:"GivenName"`
	MiddleName              string   `json:"MiddleName,omitempty"`
	FamilyName              string   `json:"FamilyName"`
	FullyQualifiedName      string   `json:"FullyQualifiedName,omitempty"`
	CompanyName             string   `json:"CompanyName,omitempty"`
	DisplayName             string   `json:"DisplayName"`
	PrintOnCheckName        string   `json:"PrintOnCheckName,omitempty"`
	Active                  bool     `json:"Active,omitempty"`

	PrimaryPhone *struct {
		FreeFormNumber string `json:"FreeFormNumber"`
	} `json:"PrimaryPhone,omitempty"`
	AlternatePhone *struct {
		FreeFormNumber string `json:"FreeFormNumber"`
	} `json:"AlternatePhone,omitempty"`
	PrimaryEmailAddr *struct {
		Address string `json:"Address"`
	} `json:"PrimaryEmailAddr,omitempty"`
	ResaleNum string `json:"ResaleNum,omitempty"`
	Notes     string `json:"Notes,omitempty"`

	MetaData *struct {
		CreateTime      string `json:"CreateTime"`
		LastUpdatedTime string `json:"LastUpdatedTime"`
	} `json:"MetaData,omitempty"`
}

Customer quickbooks customer type

type CustomerObject

type CustomerObject struct {
	Customer Customer `json:"Customer"`
	Time     string   `json:"time"`
}

CustomerObject the complete quickbooks customer object type

type CustomerRef

type CustomerRef struct {
	Value string `json:"value"`
	Name  string `json:"name,omitempty"`
}

CustomerRef quickbooks customer reference object

type Discovery

type Discovery struct {
	Issuer                string `json:"issuer"`
	AuthorizationEndpoint string `json:"authorization_endpoint"`
	TokenEndpoint         string `json:"token_endpoint"`
	UserinfoEndpoint      string `json:"userinfo_endpoint"`
	RevocationEndpoint    string `json:"revocation_endpoint"`
	JwksURI               string `json:"jwks_uri"`
}

Discovery quickbooks discovery API response type

func NewDiscovery

func NewDiscovery(isSandbox bool) (*Discovery, error)

NewDiscovery makes call to quickbooks discovery API and returns discovery object

type Entity

type Entity struct {
	Type      string    `json:"Type"`
	EntityRef EntityRef `json:"EntityRef"`
}

type EntityRef

type EntityRef struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type ErrorObject

type ErrorObject struct {
	Fault fault `json:"Fault"`
	// @TODO: change this to a Time/Timestamp type
	// can be 13234232 or "2018-11-29T02:53:10.369-08:00"
	Time string `json:"time"`
}

ErrorObject quickbooks error object

func (ErrorObject) Error

func (e ErrorObject) Error() string

Error() ErrorObject error interface method

type Invoice

type Invoice struct {
	ID           string         `json:"Id,omitempty"`
	Deposit      int            `json:"Deposit,omitempty"`
	Domain       string         `json:"domain,omitempty"`
	Sparse       bool           `json:"sparse,omitempty"`
	SyncToken    string         `json:"SyncToken,omitempty"`
	CustomField  *[]CustomField `json:"CustomField,omitempty"`
	DocNumber    string         `json:"DocNumber,omitempty"`
	TxnDate      string         `json:"TxnDate,omitempty"`
	LinkedTxn    *[]LinkedTxn   `json:"LinkedTxn,omitempty"`
	Line         []InvoiceLine  `json:"Line"`
	TxnTaxDetail *struct {
		TxnTaxCodeRef *TaxCodeRef `json:"TxnTaxCodeRef,omitempty"`
		TotalTax      float64     `json:"TotalTax"`
		TaxLine       []TaxLine   `json:"TaxLine,omitempty"`
	} `json:"TxnTaxDetail,omitempty"`
	CustomerRef  *CustomerRef `json:"CustomerRef"`
	CustomerMemo *struct {
		Value string `json:"value"`
	} `json:"CustomerMemo,omitempty"`
	BillAddr     *Address `json:"BillAddr"`
	ShipAddr     *Address `json:"ShipAddr"`
	SalesTermRef *struct {
		Value string `json:"value"`
	} `json:"SalesTermRef,omitempty"`
	DueDate               string  `json:"DueDate,omitempty"`
	TotalAmt              float64 `json:"TotalAmt,omitempty"`
	ApplyTaxAfterDiscount bool    `json:"ApplyTaxAfterDiscount,omitempty"`
	PrintStatus           string  `json:"PrintStatus,omitempty"`
	EmailStatus           string  `json:"EmailStatus,omitempty"`
	BillEmail             *struct {
		Address string `json:"Address"`
	} `json:"BillEmail,omitempty"`
	Balance  float64 `json:"Balance,omitempty"`
	MetaData *struct {
		CreateTime      string `json:"CreateTime"`
		LastUpdatedTime string `json:"LastUpdatedTime"`
	} `json:"MetaData,omitempty"`
}

Invoice quickbooks invoice type

type InvoiceLine

type InvoiceLine struct {
	ID                  string               `json:"Id,omitempty"`
	LineNum             int                  `json:"LineNum,omitempty"`
	Description         string               `json:"Description,omitempty"`
	Amount              float64              `json:"Amount"`
	DetailType          string               `json:"DetailType"`
	SalesItemLineDetail *SalesItemLineDetail `json:"SalesItemLineDetail,omitempty"`
	SubTotalLineDetail  interface{}          `json:"SubTotalLineDetail,omitempty"`
}

InvoiceLine quickbooks invoice line item object

type InvoiceObject

type InvoiceObject struct {
	Invoice Invoice `json:"Invoice"`
	Time    string  `json:"time"`
}

InvoiceObject the complete quickbooks invoice object type

type Item

type Item struct {
	ID                 string      `json:"Id,omitempty"`
	Name               string      `json:"Name"`
	Description        string      `json:"Description,omitempty"`
	Type               string      `json:"Type"`
	Active             bool        `json:"Active,omitempty"`
	FullyQualifiedName string      `json:"FullyQualifiedName,omitempty"`
	Taxable            bool        `json:"Taxable,omitempty"`
	UnitPrice          float64     `json:"UnitPrice,omitempty"`
	IncomeAccountRef   *AccountRef `json:"IncomeAccountRef"`
	PurchaseDesc       string      `json:"PurchaseDesc,omitempty"`
	PurchaseCost       float64     `json:"PurchaseCost,omitempty"`
	ExpenseAccountRef  *AccountRef `json:"ExpenseAccountRef,omitempty"`
	AssetAccountRef    *AccountRef `json:"AssetAccountRef,omitempty"`
	TrackQtyOnHand     bool        `json:"TrackQtyOnHand,omitempty"`
	QtyOnHand          float64     `json:"QtyOnHand,omitempty"`
	InvStartDate       string      `json:"InvStartDate,omitempty"`
	Domain             string      `json:"domain,omitempty"`
	Sparse             bool        `json:"sparse,omitempty"`
	SyncToken          string      `json:"SyncToken,omitempty"`
	MetaData           *struct {
		CreateTime      string `json:"CreateTime"`
		LastUpdatedTime string `json:"LastUpdatedTime"`
	} `json:"MetaData,omitempty"`
}

Item quickbooks item type

type ItemObject

type ItemObject struct {
	Item Item   `json:"Item"`
	Time string `json:"time"`
}

ItemObject the complete quickbooks item object type

type ItemRef

type ItemRef struct {
	Value string `json:"value"`
	Name  string `json:"name,omitempty"`
}

ItemRef quickbooks item reference object

type JournalCode

type JournalCode struct {
	SyncToken string    `json:"SyncToken"`
	Domain    string    `json:"domain"`
	Name      string    `json:"Name"`
	Sparse    bool      `json:"sparse"`
	Time      time.Time `json:"time"`
	Active    bool      `json:"Active"`
	MetaData  struct {
		CreateTime      string `json:"CreateTime"`
		LastUpdatedTime string `json:"LastUpdatedTime"`
	} `json:"MetaData"`
	Type        string `json:"Type"`
	ID          string `json:"Id"`
	Description string `json:"Description"`
}

type JournalCodeRef

type JournalCodeRef struct {
	Value string `json:"value,omitempty"`
	Name  string `json:"name,omitempty"`
}

type JournalEntry

type JournalEntry struct {
	ID           string        `json:"Id,omitempty"`
	Adjustment   bool          `json:"Adjustment,omitempty"`
	Domain       string        `json:"domain,omitempty"`
	Sparse       bool          `json:"sparse,omitempty"`
	SyncToken    string        `json:"SyncToken,omitempty"`
	DocNumber    string        `json:"DocNumber,omitempty"`
	TxnDate      string        `json:"TxnDate,omitempty"`
	Line         []Line        `json:"Line"`
	TxnTaxDetail *TxnTaxDetail `json:"TxnTaxDetail,omitempty"`
	MetaData     *MetaData     `json:"MetaData,omitempty"`
}

Journal Entry quickbooks Journal Entry type

type JournalEntryLineDetail

type JournalEntryLineDetail struct {
	AccountRef      JournalEntryRef `json:"AccountRef,omitempty"`
	PostingType     string          `json:"PostingType,omitempty"`
	TaxCodeRef      *TaxCodeRef     `json:"TaxCodeRef,omitempty"`
	TaxApplicableOn *string         `json:"TaxApplicableOn,omitempty"`
	TaxAmount       *float64        `json:"TaxAmount,omitempty"`
	ClassRef        *ClassRef       `json:"ClassRef,omitempty"`
	Entity          *Entity         `json:"Entity,omitempty"`
	JournalCodeRef  JournalCodeRef  `json:"JournalCodeRef,omitempty"`
}

JournalEntryLineDetail - part of Journal Entry

type JournalEntryObject

type JournalEntryObject struct {
	JournalEntry JournalEntry `json:"JournalEntry"`
	Time         string       `json:"time"`
}

JournalEntryObject the complete quickbooks journal entry object type

type JournalEntryRef

type JournalEntryRef struct {
	Value string `json:"value,omitempty"`
	Name  string `json:"name,omitempty"`
}

type Line

type Line struct {
	LineID                 string                  `json:"Id,omitempty"`
	Description            string                  `json:"Description,omitempty"`
	Amount                 float64                 `json:"Amount,omitempty"`
	DetailType             string                  `json:"DetailType,omitempty"`
	JournalEntryLineDetail *JournalEntryLineDetail `json:"JournalEntryLineDetail,omitempty"`
	LineNum                *int                    `json:"LineNum,omitempty"`
}

Line type - part of Journal Entry

type LineEx

type LineEx struct {
	Any []struct {
		Name         string `json:"name"`
		DeclaredType string `json:"declaredType"`
		Scope        string `json:"scope"`
		Value        struct {
			Name  string `json:"Name"`
			Value string `json:"Value"`
		} `json:"value"`
		Nil             bool `json:"nil"`
		GlobalScope     bool `json:"globalScope"`
		TypeSubstituted bool `json:"typeSubstituted"`
	} `json:"any"`
}

LineEx quickbooks payment LineEx object

type LinkedTxn

type LinkedTxn struct {
	TxnID   string `json:"TxnId"`
	TxnType string `json:"TxnType"`
}

type MetaData

type MetaData struct {
	CreateTime      string `json:"CreateTime,omitempty"`
	LastUpdatedTime string `json:"LastUpdatedTime,omitempty"`
}

Metadata - info about when the journal entry was created/updated.

type Oauth2Config

type Oauth2Config struct {
	oauth2.Config
}

func NewOauth2Config

func NewOauth2Config(isSandbox bool) (*Oauth2Config, error)

func NewOauth2ConfigProduction

func NewOauth2ConfigProduction() (*Oauth2Config, error)

func NewOauth2ConfigSandbox

func NewOauth2ConfigSandbox() (*Oauth2Config, error)

type Payment

type Payment struct {
	ID                  string        `json:"Id,omitempty"`
	CustomerRef         *CustomerRef  `json:"CustomerRef,omitempty"`
	DepositToAccountRef *AccountRef   `json:"DepositToAccountRef,omitempty"`
	TotalAmt            float64       `json:"TotalAmt"`
	UnappliedAmt        float64       `json:"UnappliedAmt,omitempty"`
	ProcessPayment      bool          `json:"ProcessPayment,omitempty"`
	Domain              string        `json:"domain,omitempty"`
	Sparse              bool          `json:"sparse,omitempty"`
	SyncToken           string        `json:"SyncToken,omitempty"`
	TxnDate             string        `json:"TxnDate,omitempty"`
	Line                []PaymentLine `json:"Line"`
	MetaData            *struct {
		CreateTime      string `json:"CreateTime"`
		LastUpdatedTime string `json:"LastUpdatedTime"`
	} `json:"MetaData,omitempty"`
	PaymentRefNum string `json:"PaymentRefNum,omitempty"`
}

Payment quickbooks payment type

type PaymentLine

type PaymentLine struct {
	Amount    float64     `json:"Amount"`
	LinkedTxn []LinkedTxn `json:"LinkedTxn"`
	LineEx    *LineEx     `json:"LineEx,omitempty"`
}

PaymentLine quickbooks payment line object

type PaymentObject

type PaymentObject struct {
	Payment Payment `json:"Payment"`
	Time    string  `json:"time"`
}

PaymentObject the complete quickbooks payment object type

type PurchaseTaxRateList

type PurchaseTaxRateList struct {
	TaxRateDetail []TaxRateDetail `json:"TaxRateDetail"`
}

type QueryResponse

type QueryResponse map[string]interface{}

QueryResponse quickbooks search response type

func (QueryResponse) ToAccount

func (qr QueryResponse) ToAccount() ([]Account, error)

ToAccount converts a search QueryRespose to Account array type

func (QueryResponse) ToClass

func (qr QueryResponse) ToClass() ([]Class, error)

ToClass converts a search QueryRespose to Class array type

func (QueryResponse) ToCompanyInfo

func (qr QueryResponse) ToCompanyInfo() ([]CompanyInfo, error)

ToCompanyInfo converts a search QueryRespose to JournalCode array type

func (QueryResponse) ToCreditMemo

func (qr QueryResponse) ToCreditMemo() ([]CreditMemo, error)

ToCreditMemo converts a search QueryRespose to CreditMemo array type

func (QueryResponse) ToCustomer

func (qr QueryResponse) ToCustomer() ([]Customer, error)

ToCustomer converts a search QueryRespose to Customer array type

func (QueryResponse) ToInvoice

func (qr QueryResponse) ToInvoice() ([]Invoice, error)

ToInvoice converts a search QueryRespose to Invoice array type

func (QueryResponse) ToItem

func (qr QueryResponse) ToItem() ([]Item, error)

ToItem converts a search QueryRespose to Item array type

func (QueryResponse) ToJournalCode

func (qr QueryResponse) ToJournalCode() ([]JournalCode, error)

ToJournalCode converts a search QueryRespose to JournalCode array type

func (QueryResponse) ToJournalEntry

func (qr QueryResponse) ToJournalEntry() ([]JournalEntry, error)

ToJournalEntry converts a search QueryRespose to Invoice array type

func (QueryResponse) ToPayment

func (qr QueryResponse) ToPayment() ([]Payment, error)

ToPayment converts a search QueryRespose to Payment array type

func (QueryResponse) ToTaxCode

func (qr QueryResponse) ToTaxCode() ([]TaxCode, error)

ToTaxCode converts a search QueryRespose to TaxCode array type

func (QueryResponse) ToVendor

func (qr QueryResponse) ToVendor() ([]Vendor, error)

ToVendor converts a search QueryRespose to Vendor array type

type Quickbooks

type Quickbooks struct {
	RealmID     string
	AccessToken string
	// contains filtered or unexported fields
}

Quickbooks client type

func NewClient

func NewClient(httpClient *http.Client, realmID string) *Quickbooks

NewClient creates a new client to work with Quickbooks

func (*Quickbooks) CreateAccount

func (q *Quickbooks) CreateAccount(account Account) (*AccountObject, error)

CreateAccount creates a chart of account on quickbooks

func (*Quickbooks) CreateCreditMemo

func (q *Quickbooks) CreateCreditMemo(creditmemo CreditMemo) (*CreditMemoObject, error)

CreateCreditMemo creates an creditmemo on quickbooks

func (*Quickbooks) CreateCustomer

func (q *Quickbooks) CreateCustomer(customer Customer) (*CustomerObject, error)

CreateCustomer creates a customer on quickbooks

func (*Quickbooks) CreateInvoice

func (q *Quickbooks) CreateInvoice(invoice Invoice) (*InvoiceObject, error)

CreateInvoice creates an invoice on quickbooks

func (*Quickbooks) CreateItem

func (q *Quickbooks) CreateItem(item Item) (*ItemObject, error)

CreateItem creates an item on quickbooks

func (*Quickbooks) CreateJournalEntry

func (q *Quickbooks) CreateJournalEntry(journalentry JournalEntry) (*JournalEntryObject, error)

CreateJE creates a journal entry on quickbooks

func (*Quickbooks) CreatePayment

func (q *Quickbooks) CreatePayment(payment Payment) (*PaymentObject, error)

CreatePayment creates a payment on quickbooks

func (*Quickbooks) CreateSalesReceipt

func (q *Quickbooks) CreateSalesReceipt(invoice SalesReceipt) (*SalesReceiptObject, error)

CreateSalesReceipt creates an sales receipt on quickbooks

func (*Quickbooks) GetCompanyInfo

func (q *Quickbooks) GetCompanyInfo() (*Company, error)

GetCompanyInfo returns company info bases on realmID/companyID passed to NewClient options

func (*Quickbooks) MinorVersion

func (q *Quickbooks) MinorVersion() int

func (*Quickbooks) Search

func (q *Quickbooks) Search(query string) (*QueryResponse, error)

Search quickbooks document with a query string

func (*Quickbooks) SetBaseURL

func (q *Quickbooks) SetBaseURL(URL string)

func (*Quickbooks) SetDebug

func (q *Quickbooks) SetDebug(debug bool)

func (*Quickbooks) SetMinorVersion

func (q *Quickbooks) SetMinorVersion(minorVersion int)

type SDKError

type SDKError struct {
	Type    string
	Code    string
	Message string
}

SDKError customer error object

func (SDKError) Error

func (e SDKError) Error() string

Error() SDKError error interface method

func (SDKError) New

func (e SDKError) New(errorType string, errorCode string, errorMessage string) SDKError

New creates a new SDKError object

type SalesItemLineDetail

type SalesItemLineDetail struct {
	ItemRef    *ItemRef    `json:"ItemRef"`
	UnitPrice  float64     `json:"UnitPrice"`
	Qty        int         `json:"Qty"`
	TaxCodeRef *TaxCodeRef `json:"TaxCodeRef,omitempty"`
}

SalesItemLineDetail quickbooks invoice sales line item details object

type SalesReceipt

type SalesReceipt struct {
	ID               string `json:"Id,omitempty"`
	DocNumber        string `json:"DocNumber,omitempty"`
	SyncToken        string `json:"SyncToken,omitempty"`
	Domain           string `json:"domain,omitempty"`
	Balance          int    `json:"Balance,omitempty"`
	PaymentMethodRef struct {
		Name  string `json:"name"`
		Value string `json:"value"`
	} `json:"PaymentMethodRef"`
	BillAddr            *Address `json:"BillAddr"`
	DepositToAccountRef struct {
		Name  string `json:"name"`
		Value string `json:"value"`
	} `json:"DepositToAccountRef"`
	TxnDate     string  `json:"TxnDate"`
	TotalAmt    float64 `json:"TotalAmt"`
	CustomerRef struct {
		Name  string `json:"name"`
		Value string `json:"value"`
	} `json:"CustomerRef"`
	CustomerMemo struct {
		Value string `json:"value"`
	} `json:"CustomerMemo"`
	PrintStatus           string             `json:"PrintStatus,omitempty"`
	PaymentRefNum         string             `json:"PaymentRefNum"`
	EmailStatus           string             `json:"EmailStatus,omitempty"`
	Sparse                bool               `json:"sparse,omitempty"`
	Line                  []SalesReceiptLine `json:"Line"`
	ApplyTaxAfterDiscount bool               `json:"ApplyTaxAfterDiscount,omitempty"`
	CustomField           *[]CustomField     `json:"CustomField,omitempty"`
	TxnTaxDetail          *struct {
		TxnTaxCodeRef *TaxCodeRef `json:"TxnTaxCodeRef,omitempty"`
		TotalTax      float64     `json:"TotalTax"`
		TaxLine       []TaxLine   `json:"TaxLine,omitempty"`
	} `json:"TxnTaxDetail,omitempty"`
	MetaData *struct {
		CreateTime      string `json:"CreateTime"`
		LastUpdatedTime string `json:"LastUpdatedTime"`
	} `json:"MetaData,omitempty"`
}

SalesReceipt quickbooks sales receipt type

type SalesReceiptLine

type SalesReceiptLine struct {
	Description         string               `json:"Description,omitempty"`
	DetailType          string               `json:"DetailType"`
	SalesItemLineDetail *SalesItemLineDetail `json:"SalesItemLineDetail,omitempty"`
	LineNum             int                  `json:"LineNum,omitempty"`
	Amount              float64              `json:"Amount"`
	ID                  string               `json:"Id,omitempty"`
	SubTotalLineDetail  struct {
	} `json:"SubTotalLineDetail,omitempty"`
}

SalesReceiptLine quickbooks sales receipt line item object

type SalesReceiptObject

type SalesReceiptObject struct {
	SalesReceipt SalesReceipt `json:"SalesReceipt"`
	Time         string       `json:"time"`
}

SalesReceiptObject the complete quickbooks sales receipt object type

type SalesTaxRateList

type SalesTaxRateList struct {
	TaxRateDetail []TaxRateDetail `json:"TaxRateDetail"`
}

type TaxCode

type TaxCode struct {
	Name                string              `json:"Name"`
	Description         string              `json:"Description"`
	Active              bool                `json:"Active"`
	Taxable             bool                `json:"Taxable"`
	TaxGroup            bool                `json:"TaxGroup"`
	SalesTaxRateList    SalesTaxRateList    `json:"SalesTaxRateList"`
	PurchaseTaxRateList PurchaseTaxRateList `json:"PurchaseTaxRateList"`
	Domain              string              `json:"domain"`
	Sparse              bool                `json:"sparse"`
	ID                  string              `json:"Id"`
	SyncToken           string              `json:"SyncToken"`
	MetaData            struct {
		CreateTime      string `json:"CreateTime"`
		LastUpdatedTime string `json:"LastUpdatedTime"`
	} `json:"MetaData"`
}

type TaxCodeRef

type TaxCodeRef struct {
	Value string `json:"value"`
}

type TaxLine

type TaxLine struct {
	Amount        float64 `json:"Amount"`
	DetailType    string  `json:"DetailType,omitempty"`
	TaxLineDetail *struct {
		TaxRateRef       *TaxCodeRef `json:"TaxRateRef,omitempty"`
		PercentBased     bool        `json:"PercentBased,omitempty"`
		TaxPercent       float64     `json:"TaxPercent,omitempty"`
		NetAmountTaxable float64     `json:"NetAmountTaxable"`
	} `json:"TaxLineDetail,omitempty"`
}

TaxLine quickbooks invoice tax line item object

type TaxRateDetail

type TaxRateDetail struct {
	TaxRateRef        TaxRateRef `json:"TaxRateRef"`
	TaxTypeApplicable string     `json:"TaxTypeApplicable"`
	TaxOrder          int        `json:"TaxOrder"`
}

type TaxRateRef

type TaxRateRef struct {
	Value string `json:"value"`
	Name  string `json:"name"`
}

type TxnTaxDetail

type TxnTaxDetail struct {
	TotalTax *float64  `json:"TotalTax,omitempty"`
	TaxLine  []TaxLine `json:"TaxLine,omitempty"`
}

type Vendor

type Vendor struct {
}

Directories

Path Synopsis
sdk

Jump to

Keyboard shortcuts

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