Documentation
¶
Index ¶
- Constants
- type BAddrInvoiceParams
- type BankAccount
- type BankAccountFindOptions
- type BankTransaction
- type BankTransactionParams
- type BillingAddress
- type Client
- func (c *Client) Delete(path string) (*http.Response, error)
- func (c *Client) GenAccessToken() (string, error)
- func (c *Client) Get(path string) (*http.Response, error)
- func (c *Client) GetBaseURL() string
- func (c *Client) GetOauthURL() string
- func (c *Client) Post(path string, body string) (*http.Response, error)
- func (c *Client) Put(path string, body string) (*http.Response, error)
- type ClientConfig
- type Contact
- func (c *Contact) Create(params *ContactParams, client *Client) (*Contact, error)
- func (c *Contact) Delete(id string, client *Client) error
- func (c *Contact) Endpoint() string
- func (c *Contact) FindAll(opts *ContactFindOptions, client *Client) ([]Contact, error)
- func (c *Contact) FindOne(id string, client *Client) (*Contact, error)
- func (c *Contact) New() Resource
- func (c *Contact) Update(id string, params *ContactParams, client *Client) (*Contact, error)
- type ContactFindOptions
- type ContactParams
- type ContactPerson
- type Currency
- type EInvDetails
- type Invoice
- func (i *Invoice) Create(params *InvoiceParams, client *Client) (*Invoice, error)
- func (i *Invoice) DownloadPDF(id, filepath string, client *Client) error
- func (i *Invoice) Email(id string, params *InvoiceEmailParams, client *Client)
- func (i *Invoice) Endpoint() string
- func (i *Invoice) FindOne(id string, client *Client) (*Invoice, error)
- func (i *Invoice) New() Resource
- func (i *Invoice) PushInvoiceToIRP(id string, client *Client) (*Invoice, error)
- func (i *Invoice) Update(id string, params *InvoiceParams, client *Client) (*Invoice, error)
- func (i *Invoice) UpdateInvBillingAddress(id string, billingAddress *BAddrInvoiceParams, client *Client) (*Invoice, error)
- type InvoiceEmailParams
- type InvoiceInfo
- type InvoiceParams
- type LineItem
- type LineItemTaxes
- type OAuthResponse
- type Payment
- func (p *Payment) Create(params *PaymentParams, client *Client) (*Payment, error)
- func (p *Payment) Delete(id string, client *Client) error
- func (p *Payment) Endpoint() string
- func (p *Payment) FindAll(opts *PaymentFindOptions, client *Client) ([]Payment, error)
- func (p *Payment) FindOne(id string, client *Client) (*Payment, error)
- func (p *Payment) New() Resource
- type PaymentFindOptions
- type PaymentParams
- type Resource
- type Response
Constants ¶
const BaseURL = "https://www.zohoapis.com/books/v3"
BaseURL stores the API base URL
const BaseURLAU = "https://www.zohoapis.com.au/books/v3"
const BaseURLEU = "https://www.zohoapis.eu/books/v3"
const BaseURLIN = "https://www.zohoapis.in/books/v3"
const BaseURLUS = "https://www.zohoapis.com/books/v3"
const InvStatusCancelled = "cancelled"
const InvStatusPushed = "pushed"
const InvStatusYTP = "yet_to_be_pushed"
const OAuthURL = "https://accounts.zoho.com/oauth/v2/token"
const OAuthURLAu = "https://accounts.zoho.com.au/oauth/v2/token"
const OAuthURLEu = "https://accounts.zoho.eu/oauth/v2/token"
const OAuthURLIn = "https://accounts.zoho.in/oauth/v2/token"
const TaxIGST = "IGST"
TaxIGST name of tax type
const TaxIGST0 = "IGST0"
TaxIGST0 name of tax type
const TaxIGST18 = "IGST18"
TaxIGST18 name of the tax
const TransactionTypeTransfer = "transfer_fund"
TransactionTypeTransfer constant is a bank transaction type of "transfer_fund"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BAddrInvoiceParams ¶
type BAddrInvoiceParams struct {
Address string `json:"address,omitempty"`
City string `json:"city,omitempty"`
State string `json:"state,omitempty"`
Zip string `json:"zip,omitempty"`
Country string `json:"country,omitempty"`
}
Billing Address Params for Invoice
type BankAccount ¶
type BankAccount struct {
ID string `json:"account_id"`
Name string `json:"account_name"`
Type string `json:"account_type"`
IsActive bool `json:"is_active"`
BankName string `json:"bank_name"`
}
BankAccount struct will contain all the information of bank
func (*BankAccount) Endpoint ¶
func (ba *BankAccount) Endpoint() string
Endpoint method returns the endpoint of the resource
func (*BankAccount) FindAll ¶
func (ba *BankAccount) FindAll(opts *BankAccountFindOptions, client *Client) ([]BankAccount, error)
FindAll tries to find the contacts with given options
func (*BankAccount) New ¶
func (ba *BankAccount) New() Resource
New method will create an object and return a pointer to it
type BankAccountFindOptions ¶
type BankAccountFindOptions struct {
FilterBy, SortColumn string
}
type BankTransaction ¶
type BankTransaction struct {
ID string `json:"transaction_id"`
FromAccID string `json:"from_account_id"`
FromAccName string `json:"from_account_name"`
ToAccID string `json:"to_account_id"`
ToAccName string `json:"to_account_name"`
Type string `json:"transaction_type"`
Amount float64 `json:"amount"`
PaymentMode string `json:"payment_mode"`
Date string `json:"date"`
RefNO string `json:"reference_number"`
Description string `json:"description"`
}
BankTransaction struct will contain all the information of bank
func (*BankTransaction) Create ¶
func (bt *BankTransaction) Create(params *BankTransactionParams, client *Client) (*BankTransaction, error)
Create method will try to create a bank transaction on zohobooks
func (*BankTransaction) Endpoint ¶
func (bt *BankTransaction) Endpoint() string
Endpoint method returns the endpoint of the resource
func (*BankTransaction) New ¶
func (bt *BankTransaction) New() Resource
New method will create an object and return a pointer to it
type BankTransactionParams ¶
type BankTransactionParams struct {
FromAccID string `json:"from_account_id"`
ToAccID string `json:"to_account_id"`
Type string `json:"transaction_type"`
Amount float64 `json:"amount"`
PaymentMode string `json:"payment_mode"`
Date string `json:"date"`
RefNO string `json:"reference_number"`
Description string `json:"description"`
}
BankTransactionParams struct contains the params used to create a bank transaction on zohobooks
type BillingAddress ¶
type BillingAddress struct {
Attention string `json:"attention"`
Address string `json:"address"`
Street2 string `json:"street2"`
StateCode string `json:"state_code"`
City string `json:"city"`
State string `json:"state"`
Zip string `json:"zip"`
Country string `json:"country"`
Fax string `json:"fax"`
Phone string `json:"phone"`
}
type Client ¶
type Client struct {
Key string
OAuthToken string
OrgID string
Datacenter string
// contains filtered or unexported fields
}
Client struct
func NewClientWithConfig ¶
func NewClientWithConfig(conf *ClientConfig) *Client
NewClientWithTimeout returns a pointer to the zohobooks client
func NewClientWithTimeout ¶
NewClientWithTimeout returns a pointer to the zohobooks client
func (*Client) GenAccessToken ¶
func (*Client) GetBaseURL ¶
GetBaseURL will return the base URL for zohobooks based on the specified datacenter while initializing the client
func (*Client) GetOauthURL ¶
type ClientConfig ¶
type Contact ¶
type Contact struct {
ID string `json:"contact_id"`
Name string `json:"contact_name"`
Company string `json:"company_name"`
Website string `json:"website"`
LanguageCode string `json:"language_code"`
ContactType string `json:"contact_type"`
Notes string `json:"notes"`
CurrencyID string `json:"currency_id"`
ContactPersons []ContactPerson `json:"contact_persons"`
BillingAddress BillingAddress `json:"billing_address"`
ShippingAddress BillingAddress `json:"shipping_address"`
// possible values ---> vat_registered,vat_not_registered,gcc_vat_not_registered,gcc_vat_registered,non_gcc,dz_vat_registered and dz_vat_not_registered.
TaxTreatment string `json:"tax_treatment"`
GstNO string `json:"gst_no"` // 15 digit
GstTreatment string `json:"gst_treatment"` // Allowed values are business_gst , business_none , overseas , consumer
TaxID string `json:"tax_id"`
CreatedTime string `json:"created_time"`
LastModifiedTime string `json:"last_modified_time"`
Status string `json:"status"`
CC string `json:"country_code"`
POC string `json:"place_of_contact"` // should be same as billing state
TaxName string `json:"tax_name"` // IGST0
LegalName string `json:"legal_name"`
Country string `json:"country"`
}
Contact struct represents the information of the contact
func (*Contact) Create ¶
func (c *Contact) Create(params *ContactParams, client *Client) (*Contact, error)
Create method will try to create a contact on razorpay
func (*Contact) FindAll ¶
func (c *Contact) FindAll(opts *ContactFindOptions, client *Client) ([]Contact, error)
FindAll tries to find the contacts with given options
type ContactFindOptions ¶
type ContactFindOptions struct {
EmailContains string
}
type ContactParams ¶
type ContactParams struct {
Name string `json:"contact_name"`
Company string `json:"company_name,omitempty"`
Website string `json:"website,omitempty"`
LanguageCode string `json:"language_code,omitempty"`
ContactType string `json:"contact_type,omitempty"`
Notes string `json:"notes,omitempty"`
CurrencyID string `json:"currency_id"`
OwnerID string `json:"owner_id"`
ContactPersons []ContactPerson `json:"contact_persons,omitempty"`
BillingAddress BillingAddress `json:"billing_address,omitempty"`
ShippingAddress BillingAddress `json:"shipping_address,omitempty"`
// possible values ---> vat_registered,vat_not_registered,gcc_vat_not_registered,gcc_vat_registered,non_gcc,dz_vat_registered and dz_vat_not_registered.
TaxTreatment string `json:"tax_treatment,omitempty"`
GstNO string `json:"gst_no,omitempty"` // 15 digit
GstTreatment string `json:"gst_treatment,omitempty"` // Allowed values are business_gst , business_none , overseas , consumer
TaxID string `json:"tax_id,omitempty"`
Status string `json:"status,omitempty"`
TaxPercentage float64 `json:"tax_percentage,omitempty"`
CC string `json:"country_code,omitempty"`
POC string `json:"place_of_contact,omitempty"` // should be same as billing state
TaxName string `json:"tax_name,omitempty"` // IGST0
LegalName string `json:"legal_name,omitempty"`
Country string `json:"country,omitempty"`
}
ContactParams struct represents the information to create a contact
type ContactPerson ¶
type Currency ¶
type Currency struct {
ID string `json:"currency_id"`
Code string `json:"currency_code"`
Name string `json:"currency_name"`
Symbol string `json:"currency_symbol"`
PricePrecision int `json:"price_precision"`
IsBaseCurrency bool `json:"is_base_currency"`
ExchangeRate float64 `json:"exchange_rate"`
EffectiveDate string `json:"effective_date"`
}
Currency struct represents the information of the currency
type EInvDetails ¶
type Invoice ¶
type Invoice struct {
ID string `json:"invoice_id"`
CustomerID string `json:"customer_id"`
CustomerName string `json:"customer_name"`
ContactPersons []string `json:"contact_persons"`
InvoiceNumber string `json:"invoice_number"`
PlaceOfSupply string `json:"place_of_supply"`
// possible values ---> vat_registered,vat_not_registered,gcc_vat_not_registered,gcc_vat_registered,non_gcc,dz_vat_registered and dz_vat_not_registered.
TaxTreatment string `json:"tax_treatment"`
GstNO string `json:"gst_no"` // 15 digit
GstTreatment string `json:"gst_treatment"` // Allowed values are business_gst , business_none , overseas , consumer
Status string `json:"status"`
Date string `json:"date"`
PaymentTerms int `json:"payment_terms"`
PaymentTermsLabel string `json:"payment_terms_label"`
DueDate string `json:"due_date"`
CurrencyCode string `json:"currency_code"`
CurrencyID string `json:"currency_id"`
Discount float64 `json:"discount"`
TaxID string `json:"tax_id"`
RefNo string `json:"reference_number"`
LineItems []LineItem `json:"line_items"`
Notes string `json:"notes"`
Terms string `json:"terms"`
BranchID string `json:"branch_id"`
BranchName string `json:"branch_name"`
SubTotal float64 `json:"sub_total"`
TaxTotal float64 `json:"tax_total"`
Total float64 `json:"total"`
Taxes []taxInfo `json:"taxes"`
PaymentReminder bool `json:"payment_reminder_enabled"`
PaymentMade float64 `json:"payment_made"`
CreditsApplied float64 `json:"credits_applied"`
TaxAmountWithheld float64 `json:"tax_amount_withheld"`
Balance float64 `json:"balance"`
WriteOffAmount float64 `json:"write_off_amount"`
CreatedTime string `json:"created_time"`
LastModifiedTime string `json:"last_modified_time"`
InvoiceURL string `json:"invoice_url"`
Country string `json:"country"`
EInvDetails EInvDetails `json:"einvoice_details"`
BillingAddress BillingAddress `json:"billing_address"`
ShippingAddress BillingAddress `json:"shipping_address"`
}
Invoice struct represents the information of the invoice
func (*Invoice) Create ¶
func (i *Invoice) Create(params *InvoiceParams, client *Client) (*Invoice, error)
Create method will try to create a invoice on razorpay
func (*Invoice) DownloadPDF ¶
DownloadPDF method will download the pdf to the given filepath
func (*Invoice) Email ¶
func (i *Invoice) Email(id string, params *InvoiceEmailParams, client *Client)
Email method will send the invoice to the customer
func (*Invoice) PushInvoiceToIRP ¶
push Invoice to IRP portal and returns the Invoice with IRP Ack Num and Ref Num
func (*Invoice) UpdateInvBillingAddress ¶
func (i *Invoice) UpdateInvBillingAddress(id string, billingAddress *BAddrInvoiceParams, client *Client) (*Invoice, error)
update invoice billing address
type InvoiceEmailParams ¶
type InvoiceEmailParams struct {
SendFromOrgEmail bool `json:"send_from_org_email_id"`
ToMailIDs []string `json:"to_mail_ids"`
CCMailIDs []string `json:"cc_mail_ids,omitempty"`
Subject string `json:"subject,omitempty"`
Body string `json:"body,omitempty"`
}
InvoiceEmailParams struct contains the parameters to be used while sending invoices
type InvoiceInfo ¶
type InvoiceInfo struct {
InvoiceID string `json:"invoice_id"`
Number string `json:"invoice_number,omitempty"`
Date string `json:"date,omitempty"`
Amount float64 `json:"invoice_amount,omitempty"`
AmountApplied float64 `json:"amount_applied"`
BalanceAmount float64 `json:"balance_amount,omitempty"`
TaxAmountWithheld float64 `json:"tax_amount_withheld,omitempty"`
}
type InvoiceParams ¶
type InvoiceParams struct {
CustomerID string `json:"customer_id"`
ContactPersons []string `json:"contact_persons,omitempty"`
InvoiceNumber string `json:"invoice_number,omitempty"`
ReferenceNo string `json:"reference_number,omitempty"`
PlaceOfSupply string `json:"place_of_supply,omitempty"`
// possible values ---> vat_registered,vat_not_registered,gcc_vat_not_registered,gcc_vat_registered,non_gcc,dz_vat_registered and dz_vat_not_registered.
TaxTreatment string `json:"tax_treatment,omitempty"`
GstNO string `json:"gst_no,omitempty"` // 15 digit
GstTreatment string `json:"gst_treatment,omitempty"` // Allowed values are business_gst , business_none , overseas , consumer
Date string `json:"date,omitempty"`
PaymentTerms int `json:"payment_terms,omitempty"`
PaymentTermsLabel string `json:"payment_terms_label,omitempty"`
DueDate string `json:"due_date,omitempty"`
IsInclusiveTax bool `json:"is_inclusive_tax"`
Discount float64 `json:"discount,omitempty"`
TaxID string `json:"tax_id,omitempty"`
Reason string `json:"reason,omitempty"` // required when updating sent invoice
LineItems []LineItem `json:"line_items"`
Notes string `json:"notes,omitempty"`
Terms string `json:"terms,omitempty"`
BranchID string `json:"branch_id,omitempty"`
Country string `json:"country"`
}
InvoiceParams struct represents the information to create a invoice
type LineItem ¶
type LineItem struct {
ItemID string `json:"item_id,omitempty"`
ProjectID string `json:"project_id,omitempty"`
ProductType string `json:"product_type,omitempty"`
Name string `json:"name"`
Description string `json:"description"`
Rate float64 `json:"rate"`
Quantity float64 `json:"quantity"`
Unit string `json:"unit,omitempty"`
TaxID string `json:"tax_id,omitempty"`
HsnOrSac string `json:"hsn_or_sac,omitempty"`
TaxName string `json:"tax_name,omitempty"`
TaxType string `json:"tax_type,omitempty"`
TaxPercent float64 `json:"tax_percentage,omitempty"`
LineItemTaxes []LineItemTaxes `json:"line_item_taxes,omitempty"`
}
LineItem struct contains info about the line items of the invoice
type LineItemTaxes ¶
type OAuthResponse ¶
type Payment ¶
type Payment struct {
ID string `json:"payment_id"`
Mode string `json:"payment_mode"`
Amount float64 `json:"amount"`
AmountRefunded float64 `json:"amount_refunded"`
BankCharges float64 `json:"bank_charges"`
Date string `json:"date"`
Status string `json:"status"`
RefNo string `json:"reference_number"`
Description string `json:"description"`
CustomerID string `json:"customer_id"`
CustomerName string `json:"customer_name"`
Email string `json:"email"`
Invoices []InvoiceInfo `json:"invoices"`
CurrencyCode string `json:"currency_code"`
CurrencySymbol string `json:"currency_symbol"`
}
func (*Payment) Create ¶
func (p *Payment) Create(params *PaymentParams, client *Client) (*Payment, error)
Create method will try to create a contact on razorpay
func (*Payment) FindAll ¶
func (p *Payment) FindAll(opts *PaymentFindOptions, client *Client) ([]Payment, error)
FindAll tries to find the payment with given options
type PaymentFindOptions ¶
type PaymentFindOptions struct {
CustomerID string
}
type PaymentParams ¶
type PaymentParams struct {
CustomerID string `json:"customer_id"`
Mode string `json:"payment_mode"` // This can be check, cash, creditcard, banktransfer, bankremittance, autotransaction or others
Amount float64 `json:"amount"`
Date string `json:"date"`
RefNo string `json:"reference_number,omitempty"`
Description string `json:"description,omitempty"`
Invoices []InvoiceInfo `json:"invoices"`
BankCharges float64 `json:"bank_charges"`
AccountID string `json:"account_id,omitempty"`
TaxAccountID string `json:"tax_account_id,omitempty"`
ContactPersons []string `json:"contact_persons,omitempty"`
}
type Response ¶
type Response struct {
Code int `json:"code"`
Message string `json:"message"`
Contact Contact `json:"contact"`
Invoice Invoice `json:"invoice"`
Payment Payment `json:"payment"`
BankTransaction BankTransaction `json:"banktransaction"`
Contacts []Contact `json:"contacts"`
Payments []Payment `json:"customerpayments"`
Currencies []Currency `json:"currencies"`
BankAccounts []BankAccount `json:"bankaccounts"`
Data zohoRespError `json:"data"`
}
Response struct to handle zohobooks response