subscriptions

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const ZohoSubscriptionsEndpointHeader = "X-com-zoho-subscriptions-organizationid"

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	*zoho.Zoho

	OrganizationID string
	// contains filtered or unexported fields
}

API is used for interacting with the Zoho Subscriptions API

func New

func New(z *zoho.Zoho, organizationID string) *API

New returns a *subscriptions.API with the provided zoho.Zoho as an embedded field

func (*API) AddAttachment

func (s *API) AddAttachment(id, file string, canSendInEmail bool) (data AttachementResponse, err error)

AddAttachment attaches a file to an invoice https://www.zoho.com/subscriptions/api/v1/#Invoices_Add_attachment_to_an_invoice

func (*API) AddChargeToSubscription

func (s *API) AddChargeToSubscription(request SubscriptionAddCharge, ID string) (data AddChargeResponse, err error)

AddChargeToSubscription charges a one-time amount for the subscription https://www.zoho.com/subscriptions/api/v1/#Subscriptions_Update_a_subscription

func (*API) AddItems

func (s *API) AddItems(id string, request AddItemsRequest) (data AddItemsResponse, err error)

AddItems adds items to pending invoice https://www.zoho.com/subscriptions/api/v1/#Invoices_Add_items_to_a_pending_invoice

func (*API) CancelSubscription

func (s *API) CancelSubscription(ID string, cancelAtEnd bool) (data SubscriptionCancelResponse, err error)

CancelSubscription will cancel subscription by id https://www.zoho.com/subscriptions/api/v1/#Subscriptions_Cancel_a_subscription

func (*API) CollectChargeViaBankAccount

func (s *API) CollectChargeViaBankAccount(id string, request CollectChargeViaBankAccountRequest) (data CollectChargeViaBankAccountResponse, err error)

CollectChargeViaBankAccount collects charge via bank account https://www.zoho.com/subscriptions/api/v1/#Invoices_Collect_charge_via_bank_account

func (*API) CollectChargeViaCreditCard

func (s *API) CollectChargeViaCreditCard(id string, request CollectChargeViaCreditCardRequest) (data CollectChargeViaCreditCardResponse, err error)

CollectChargeViaCreditCard collects charge via credit card https://www.zoho.com/subscriptions/api/v1/#Invoices_Collect_charge_via_credit_card Note: Real life reply for this request differs from Zoho documentation, so CollectChargeViaCreditCardResponse was updated to include both top level objects: - 'payment' per documentation - 'invoice' per real life reply

func (*API) CreateSubscription

func (s *API) CreateSubscription(request SubscriptionCreate) (data SubscriptionResponse, err error)

CreateSubscription creates new subscription https://www.zoho.com/subscriptions/api/v1/#Subscriptions_Create_a_subscription

func (*API) DeleteSubscription

func (s *API) DeleteSubscription(ID string) (data SubscriptionDeleteResponse, err error)

DeleteSubscription will delete subscription by id https://www.zoho.com/subscriptions/api/v1/#Subscriptions_Delete_a_subscription

func (*API) EmailInvoice

func (s *API) EmailInvoice(id string, request EmailInvoiceRequest) (data EmailInvoiceResponse, err error)

EmailInvoice sends an invoice in email https://www.zoho.com/subscriptions/api/v1/#Invoices_Email_an_invoice

func (*API) GetCustomer

func (s *API) GetCustomer(id string) (data CustomerResponse, err error)

GetCustomer will return customer specified by id https://www.zoho.com/subscriptions/api/v1/#Invoices_Retrieve_a_subscription

func (*API) GetInvoice

func (s *API) GetInvoice(id string) (data InvoiceResponse, err error)

GetInvoice will return the subscription specified by id https://www.zoho.com/subscriptions/api/v1/#Invoices_Retrieve_a_subscription

func (*API) GetSubscription

func (s *API) GetSubscription(id string) (data SubscriptionResponse, err error)

GetSubscription will return the subscription specified by id https://www.zoho.com/subscriptions/api/v1/#Subscriptions_Retrieve_a_subscription

func (*API) ListAllInvoices

func (s *API) ListAllInvoices(status InvoiceStatus) (data InvoicesResponse, err error)

ListAllInvoices will return the list of invoices that match the given invoice status https://www.zoho.com/subscriptions/api/v1/#Invoices_List_all_invoices

func (*API) ListInvoicesForCustomer

func (s *API) ListInvoicesForCustomer(status InvoiceStatus, customerID string) (data InvoicesResponse, err error)

ListInvoicesForSubscription will return the list of invoices that match the given invoice status and customer ID https://www.zoho.com/subscriptions/api/v1/#Invoices_List_all_invoices

func (*API) ListInvoicesForSubscription

func (s *API) ListInvoicesForSubscription(status InvoiceStatus, subscriptionID string) (data InvoicesResponse, err error)

ListInvoicesForSubscription will return the list of invoices that match the given invoice status and subscription ID https://www.zoho.com/subscriptions/api/v1/#Invoices_List_all_invoices

func (*API) ListSubscriptions

func (s *API) ListSubscriptions(status SubscriptionStatus) (data SubscriptionsResponse, err error)

ListSubscriptions will return the list of subscriptions that match the given subscription status. https://www.zoho.com/subscriptions/api/v1/#Subscriptions_List_all_subscriptions

func (*API) UpdateSubscription

func (s *API) UpdateSubscription(request SubscriptionUpdate, ID string) (data SubscriptionResponse, err error)

UpdateSubscription will modify subscription by the data provided to request https://www.zoho.com/subscriptions/api/v1/#Subscriptions_Update_a_subscription

type AddChargeResponse

type AddChargeResponse struct {
	Code    int64  `json:"code"`
	Message string `json:"message"`
	Invoice struct {
		AchPaymentInitiated     bool    `json:"ach_payment_initiated"`
		Adjustment              float64 `json:"adjustment"`
		AdjustmentDescription   string  `json:"adjustment_description"`
		AllowPartialPayments    bool    `json:"allow_partial_payments"`
		ApproverID              string  `json:"approver_id"`
		AutoRemindersConfigured bool    `json:"auto_reminders_configured"`
		Balance                 float64 `json:"balance"`
		BcyAdjustment           float64 `json:"bcy_adjustment"`
		BcyDiscountTotal        float64 `json:"bcy_discount_total"`
		BcyShippingCharge       float64 `json:"bcy_shipping_charge"`
		BcySubTotal             float64 `json:"bcy_sub_total"`
		BcyTaxTotal             float64 `json:"bcy_tax_total"`
		BcyTotal                float64 `json:"bcy_total"`
		BillingAddress          struct {
			Address   string `json:"address"`
			Attention string `json:"attention"`
			City      string `json:"city"`
			Country   string `json:"country"`
			Fax       string `json:"fax"`
			Phone     string `json:"phone"`
			State     string `json:"state"`
			Street    string `json:"street"`
			Street2   string `json:"street2"`
			Zip       string `json:"zip"`
		} `json:"billing_address"`
		CanEditItems       bool   `json:"can_edit_items"`
		CanSendInMail      bool   `json:"can_send_in_mail"`
		CanSendInvoiceSms  bool   `json:"can_send_invoice_sms"`
		CanSkipPaymentInfo bool   `json:"can_skip_payment_info"`
		ClientViewedTime   string `json:"client_viewed_time"`
		Contactpersons     []struct {
			ContactpersonID string `json:"contactperson_id"`
			Email           string `json:"email"`
			Mobile          string `json:"mobile"`
			Phone           string `json:"phone"`
			ZcrmContactID   string `json:"zcrm_contact_id"`
		} `json:"contactpersons"`
		Coupons         []Coupon      `json:"coupons"`
		CreatedByID     string        `json:"created_by_id"`
		CreatedDate     string        `json:"created_date"`
		CreatedTime     string        `json:"created_time"`
		Credits         []interface{} `json:"credits"`
		CreditsApplied  float64       `json:"credits_applied"`
		CurrencyCode    string        `json:"currency_code"`
		CurrencyID      string        `json:"currency_id"`
		CurrencySymbol  string        `json:"currency_symbol"`
		CustomFieldHash struct {
		} `json:"custom_field_hash"`
		CustomFields            []CustomField `json:"custom_fields"`
		CustomerCustomFieldHash struct {
		} `json:"customer_custom_field_hash"`
		CustomerCustomFields        []CustomField `json:"customer_custom_fields"`
		CustomerID                  string        `json:"customer_id"`
		CustomerName                string        `json:"customer_name"`
		Date                        string        `json:"date"`
		DiscountPercent             float64       `json:"discount_percent"`
		DiscountTotal               float64       `json:"discount_total"`
		Documents                   []interface{} `json:"documents"`
		DueDate                     string        `json:"due_date"`
		Email                       string        `json:"email"`
		ExchangeRate                float64       `json:"exchange_rate"`
		InprocessTransactionPresent bool          `json:"inprocess_transaction_present"`
		InvoiceDate                 string        `json:"invoice_date"`
		InvoiceID                   string        `json:"invoice_id"`
		InvoiceItems                []struct {
			AccountID        string        `json:"account_id"`
			AccountName      string        `json:"account_name"`
			Code             string        `json:"code"`
			Description      string        `json:"description"`
			DiscountAmount   float64       `json:"discount_amount"`
			ItemCustomFields []CustomField `json:"item_custom_fields"`
			ItemID           string        `json:"item_id"`
			ItemTotal        float64       `json:"item_total"`
			Name             string        `json:"name"`
			Price            float64       `json:"price"`
			ProductID        string        `json:"product_id"`
			ProductType      string        `json:"product_type"`
			Quantity         float64       `json:"quantity"`
			Tags             []Tag         `json:"tags"`
			TaxID            string        `json:"tax_id"`
			TaxName          string        `json:"tax_name"`
			TaxPercentage    float64       `json:"tax_percentage"`
			TaxType          string        `json:"tax_type"`
			Unit             string        `json:"unit"`
		} `json:"invoice_items"`
		InvoiceNumber          string `json:"invoice_number"`
		InvoiceURL             string `json:"invoice_url"`
		IsInclusiveTax         bool   `json:"is_inclusive_tax"`
		IsReverseChargeApplied bool   `json:"is_reverse_charge_applied"`
		IsViewedByClient       bool   `json:"is_viewed_by_client"`
		LastModifiedByID       string `json:"last_modified_by_id"`
		Notes                  string `json:"notes"`
		Number                 string `json:"number"`
		PageWidth              string `json:"page_width"`
		PaymentExpectedDate    string `json:"payment_expected_date"`
		PaymentGateways        []struct {
			PaymentGateway string `json:"payment_gateway"`
		} `json:"payment_gateways"`
		PaymentMade            float64 `json:"payment_made"`
		PaymentReminderEnabled bool    `json:"payment_reminder_enabled"`
		PaymentTerms           int64   `json:"payment_terms"`
		PaymentTermsLabel      string  `json:"payment_terms_label"`
		Payments               []struct {
			Amount               float64 `json:"amount"`
			AmountRefunded       float64 `json:"amount_refunded"`
			BankCharges          float64 `json:"bank_charges"`
			CardType             string  `json:"card_type"`
			Date                 string  `json:"date"`
			Description          string  `json:"description"`
			ExchangeRate         float64 `json:"exchange_rate"`
			GatewayTransactionID string  `json:"gateway_transaction_id"`
			InvoicePaymentID     string  `json:"invoice_payment_id"`
			LastFourDigits       string  `json:"last_four_digits"`
			PaymentID            string  `json:"payment_id"`
			PaymentMode          string  `json:"payment_mode"`
			ReferenceNumber      string  `json:"reference_number"`
			SettlementStatus     string  `json:"settlement_status"`
		} `json:"payments"`
		PricePrecision  int64  `json:"price_precision"`
		PricebookID     string `json:"pricebook_id"`
		ReferenceID     string `json:"reference_id"`
		ReferenceNumber string `json:"reference_number"`
		SalespersonID   string `json:"salesperson_id"`
		SalespersonName string `json:"salesperson_name"`
		ShippingAddress struct {
			Address   string `json:"address"`
			Attention string `json:"attention"`
			City      string `json:"city"`
			Country   string `json:"country"`
			Fax       string `json:"fax"`
			Phone     string `json:"phone"`
			State     string `json:"state"`
			Street    string `json:"street"`
			Street2   string `json:"street2"`
			Zip       string `json:"zip"`
		} `json:"shipping_address"`
		ShippingCharge                        float64 `json:"shipping_charge"`
		ShippingChargeExclusiveOfTax          float64 `json:"shipping_charge_exclusive_of_tax"`
		ShippingChargeExclusiveOfTaxFormatted string  `json:"shipping_charge_exclusive_of_tax_formatted"`
		ShippingChargeInclusiveOfTax          float64 `json:"shipping_charge_inclusive_of_tax"`
		ShippingChargeInclusiveOfTaxFormatted string  `json:"shipping_charge_inclusive_of_tax_formatted"`
		ShippingChargeTax                     string  `json:"shipping_charge_tax"`
		ShippingChargeTaxFormatted            string  `json:"shipping_charge_tax_formatted"`
		ShippingChargeTaxID                   string  `json:"shipping_charge_tax_id"`
		ShippingChargeTaxName                 string  `json:"shipping_charge_tax_name"`
		ShippingChargeTaxPercentage           string  `json:"shipping_charge_tax_percentage"`
		ShippingChargeTaxType                 string  `json:"shipping_charge_tax_type"`
		Status                                string  `json:"status"`
		StopReminderUntilPaymentExpectedDate  bool    `json:"stop_reminder_until_payment_expected_date"`
		SubTotal                              float64 `json:"sub_total"`
		SubmitterID                           string  `json:"submitter_id"`
		Subscriptions                         []struct {
			SubscriptionID string `json:"subscription_id"`
		} `json:"subscriptions"`
		TaxRounding                   string        `json:"tax_rounding"`
		TaxTotal                      float64       `json:"tax_total"`
		Taxes                         []interface{} `json:"taxes"`
		TemplateID                    string        `json:"template_id"`
		TemplateName                  string        `json:"template_name"`
		TemplateType                  string        `json:"template_type"`
		Terms                         string        `json:"terms"`
		Total                         float64       `json:"total"`
		TransactionType               string        `json:"transaction_type"`
		UnbilledChargesID             string        `json:"unbilled_charges_id"`
		UnusedCreditsReceivableAmount float64       `json:"unused_credits_receivable_amount"`
		UpdatedTime                   string        `json:"updated_time"`
		VatTreatment                  string        `json:"vat_treatment"`
		WriteOffAmount                float64       `json:"write_off_amount"`
		ZcrmPotentialID               string        `json:"zcrm_potential_id"`
	} `json:"invoice"`
	UnbilledCharge struct {
		Balance        float64 `json:"balance"`
		BillingAddress struct {
			Attention string `json:"attention"`
			City      string `json:"city"`
			Country   string `json:"country"`
			Fax       string `json:"fax"`
			Phone     string `json:"phone"`
			State     string `json:"state"`
			Street    string `json:"street"`
			Street2   string `json:"street2"`
			Zip       string `json:"zip"`
		} `json:"billing_address"`
		Coupons         []Coupon `json:"coupons"`
		CreatedTime     string   `json:"created_time"`
		CurrencyCode    string   `json:"currency_code"`
		CurrencySymbol  string   `json:"currency_symbol"`
		CustomFieldHash struct {
		} `json:"custom_field_hash"`
		CustomFields            []CustomField `json:"custom_fields"`
		CustomerCustomFieldHash struct {
		} `json:"customer_custom_field_hash"`
		CustomerCustomFields   []CustomField `json:"customer_custom_fields"`
		CustomerID             string        `json:"customer_id"`
		CustomerName           string        `json:"customer_name"`
		Email                  string        `json:"email"`
		IsInclusiveTax         bool          `json:"is_inclusive_tax"`
		IsOnlineSubscription   bool          `json:"is_online_subscription"`
		IsReverseChargeApplied bool          `json:"is_reverse_charge_applied"`
		Number                 string        `json:"number"`
		PricePrecision         int64         `json:"price_precision"`
		SalespersonID          string        `json:"salesperson_id"`
		SalespersonName        string        `json:"salesperson_name"`
		ShippingAddress        struct {
			Attention string `json:"attention"`
			City      string `json:"city"`
			Country   string `json:"country"`
			Fax       string `json:"fax"`
			Phone     string `json:"phone"`
			State     string `json:"state"`
			Street    string `json:"street"`
			Street2   string `json:"street2"`
			Zip       string `json:"zip"`
		} `json:"shipping_address"`
		Status              string        `json:"status"`
		SubTotal            float64       `json:"sub_total"`
		SubscriptionID      string        `json:"subscription_id"`
		TaxRounding         string        `json:"tax_rounding"`
		TaxTotal            float64       `json:"tax_total"`
		Taxes               []interface{} `json:"taxes"`
		Total               float64       `json:"total"`
		TransactionType     string        `json:"transaction_type"`
		UnbilledChargeDate  string        `json:"unbilled_charge_date"`
		UnbilledChargeID    string        `json:"unbilled_charge_id"`
		UnbilledChargeItems []struct {
			AccountID            string  `json:"account_id"`
			Code                 string  `json:"code"`
			Description          string  `json:"description"`
			DiscountAmount       float64 `json:"discount_amount"`
			ItemTotal            float64 `json:"item_total"`
			Name                 string  `json:"name"`
			Price                float64 `json:"price"`
			ProductID            string  `json:"product_id"`
			ProductType          string  `json:"product_type"`
			Quantity             float64 `json:"quantity"`
			TaxID                string  `json:"tax_id"`
			TaxName              string  `json:"tax_name"`
			TaxPercentage        float64 `json:"tax_percentage"`
			TaxType              string  `json:"tax_type"`
			UnbilledChargeItemID string  `json:"unbilled_charge_item_id"`
		} `json:"unbilled_charge_items"`
		UnusedCreditsReceivableAmount float64 `json:"unused_credits_receivable_amount"`
		UpdatedTime                   string  `json:"updated_time"`
	} `json:"unbilled_charge"`
}

type AddItemsRequest

type AddItemsRequest struct {
	InvoiceItems []InvoiceItemRequest `json:"invoice_items,omitempty"`
}

type AddItemsResponse

type AddItemsResponse struct {
	Code    int64  `json:"code"`
	Message string `json:"message"`
	Invoice struct {
		InvoiceID           string `json:"invoice_id"`
		Number              string `json:"number"`
		Status              string `json:"status"`
		InvoiceDate         string `json:"invoice_date"`
		DueDate             string `json:"due_date"`
		PaymentExpectedDate string `json:"payment_expected_date"`
		AchPaymentInitiated bool   `json:"ach_payment_initiated"`
		TransactionType     string `json:"transaction_type"`
		CustomerID          string `json:"customer_id"`
		CustomerName        string `json:"customer_name"`
		Email               string `json:"email"`
		InvoiceItems        []struct {
			ItemID           string        `json:"item_id"`
			Name             string        `json:"name"`
			Description      string        `json:"description"`
			Tags             []Tag         `json:"tags"`
			ItemCustomFields []CustomField `json:"item_custom_fields"`
			Code             string        `json:"code"`
			Price            float64       `json:"price"`
			Quantity         float64       `json:"quantity"`
			DiscountAmount   float64       `json:"discount_amount"`
			ItemTotal        float64       `json:"item_total"`
			TaxID            string        `json:"tax_id"`
			ProductType      string        `json:"product_type"`
			HsnOrSac         string        `json:"hsn_or_sac"`
			TaxExemptionID   string        `json:"tax_exemption_id"`
			TaxExemptionCode string        `json:"tax_exemption_code"`
		} `json:"invoice_items"`
		Coupons []struct {
			CouponCode     string  `json:"coupon_code"`
			CouponName     string  `json:"coupon_name"`
			DiscountAmount float64 `json:"discount_amount"`
		} `json:"coupons"`
		Credits []struct {
			CreditnoteID      string  `json:"creditnote_id"`
			CreditnotesNumber string  `json:"creditnotes_number"`
			CreditedDate      string  `json:"credited_date"`
			CreditedAmount    float64 `json:"credited_amount"`
		} `json:"credits"`
		Total          float64 `json:"total"`
		PaymentMade    float64 `json:"payment_made"`
		Balance        float64 `json:"balance"`
		CreditsApplied float64 `json:"credits_applied"`
		WriteOffAmount float64 `json:"write_off_amount"`
		Payments       []struct {
			PaymentID            string  `json:"payment_id"`
			PaymentMode          string  `json:"payment_mode"`
			InvoicePaymentID     string  `json:"invoice_payment_id"`
			GatewayTransactionID string  `json:"gateway_transaction_id"`
			Description          string  `json:"description"`
			Date                 string  `json:"date"`
			ReferenceNumber      string  `json:"reference_number"`
			Amount               float64 `json:"amount"`
			BankCharges          float64 `json:"bank_charges"`
			ExchangeRate         float64 `json:"exchange_rate"`
		} `json:"payments"`
		CurrencyCode    string  `json:"currency_code"`
		CurrencySymbol  string  `json:"currency_symbol"`
		CreatedTime     string  `json:"created_time"`
		UpdatedTime     string  `json:"updated_time"`
		SalespersonID   string  `json:"salesperson_id"`
		SalespersonName string  `json:"salesperson_name"`
		InvoiceURL      string  `json:"invoice_url"`
		BillingAddress  Address `json:"billing_address"`
		ShippingAddress Address `json:"shipping_address"`
		Comments        []struct {
			CommentID       string `json:"comment_id"`
			Description     string `json:"description"`
			CommentedByID   string `json:"commented_by_id"`
			CommentedBy     string `json:"commented_by"`
			CommentType     string `json:"comment_type"`
			Time            string `json:"time"`
			OperationType   string `json:"operation_type"`
			TransactionID   string `json:"transaction_id"`
			TransactionType string `json:"transaction_type"`
		} `json:"comments"`
		CustomFields []CustomField `json:"custom_fields"`
	} `json:"invoice"`
}

type Addon

type Addon struct {
	AddonCode        string  `json:"addon_code,omitempty"`
	Name             string  `json:"name,omitempty"`
	AddonDescription string  `json:"addon_description,omitempty"`
	Quantity         float64 `json:"quantity,omitempty"`
	Price            float64 `json:"price,omitempty"`
	Discount         float64 `json:"discount,omitempty"`
	Total            float64 `json:"total,omitempty"`
	TaxID            string  `json:"tax_id,omitempty"`
}

type Address

type Address struct {
	Attention string `json:"attention,omitempty"`
	Street    string `json:"street,omitempty"`
	Street2   string `json:"street2,omitempty"`
	City      string `json:"city,omitempty"`
	State     string `json:"state,omitempty"`
	Country   string `json:"country,omitempty"`
	Zip       string `json:"zip,omitempty"`
	Fax       string `json:"fax,omitempty"`
}

type AttachementResponse

type AttachementResponse struct {
	Code      int64  `json:"code"`
	Message   string `json:"message"`
	Documents []struct {
		FileName          string `json:"file_name"`
		FileType          string `json:"file_type"`
		FileSize          int64  `json:"file_size"`
		FileSizeFormatted string `json:"file_size_formatted"`
		DocumentID        string `json:"document_id"`
		AttachmentOrder   int64  `json:"attachment_order"`
	} `json:"documents"`
}

type AttachmentRequest

type AttachmentRequest struct {
	CanSendInEmail bool `json:"can_send_in_mail"`
}

type CollectChargeInvoiceResponse

type CollectChargeInvoiceResponse struct {
	AchPaymentInitiated     bool    `json:"ach_payment_initiated"`
	Adjustment              float64 `json:"adjustment"`
	AdjustmentDescription   string  `json:"adjustment_description"`
	AllowPartialPayments    bool    `json:"allow_partial_payments"`
	ApproverID              string  `json:"approver_id"`
	AutoRemindersConfigured bool    `json:"auto_reminders_configured"`
	Balance                 float64 `json:"balance"`
	BcyAdjustment           float64 `json:"bcy_adjustment"`
	BcyDiscountTotal        float64 `json:"bcy_discount_total"`
	BcyShippingCharge       float64 `json:"bcy_shipping_charge"`
	BcySubTotal             float64 `json:"bcy_sub_total"`
	BcyTaxTotal             float64 `json:"bcy_tax_total"`
	BcyTotal                float64 `json:"bcy_total"`
	BillingAddress          struct {
		Address   string `json:"address"`
		Attention string `json:"attention"`
		City      string `json:"city"`
		Country   string `json:"country"`
		Fax       string `json:"fax"`
		Phone     string `json:"phone"`
		State     string `json:"state"`
		Street    string `json:"street"`
		Street2   string `json:"street2"`
		Zip       string `json:"zip"`
	} `json:"billing_address"`
	CanEditItems       bool   `json:"can_edit_items"`
	CanSendInMail      bool   `json:"can_send_in_mail"`
	CanSendInvoiceSms  bool   `json:"can_send_invoice_sms"`
	CanSkipPaymentInfo bool   `json:"can_skip_payment_info"`
	ClientViewedTime   string `json:"client_viewed_time"`
	Contactpersons     []struct {
		ContactpersonID string `json:"contactperson_id"`
		Email           string `json:"email"`
		Mobile          string `json:"mobile"`
		Phone           string `json:"phone"`
		ZcrmContactID   string `json:"zcrm_contact_id"`
	} `json:"contactpersons"`
	Coupons         []Coupon `json:"coupons"`
	CreatedByID     string   `json:"created_by_id"`
	CreatedDate     string   `json:"created_date"`
	CreatedTime     string   `json:"created_time"`
	Credits         []Credit `json:"credits"`
	CreditsApplied  float64  `json:"credits_applied"`
	CurrencyCode    string   `json:"currency_code"`
	CurrencyID      string   `json:"currency_id"`
	CurrencySymbol  string   `json:"currency_symbol"`
	CustomFieldHash struct {
	} `json:"custom_field_hash"`
	CustomFields            []CustomField `json:"custom_fields"`
	CustomerCustomFieldHash struct {
	} `json:"customer_custom_field_hash"`
	CustomerCustomFields        []CustomField `json:"customer_custom_fields"`
	CustomerID                  string        `json:"customer_id"`
	CustomerName                string        `json:"customer_name"`
	Date                        string        `json:"date"`
	DiscountPercent             float64       `json:"discount_percent"`
	DiscountTotal               float64       `json:"discount_total"`
	Documents                   []interface{} `json:"documents"`
	DueDate                     string        `json:"due_date"`
	Email                       string        `json:"email"`
	ExchangeRate                float64       `json:"exchange_rate"`
	InprocessTransactionPresent bool          `json:"inprocess_transaction_present"`
	InvoiceDate                 string        `json:"invoice_date"`
	InvoiceID                   string        `json:"invoice_id"`
	InvoiceItems                []struct {
		AccountID        string        `json:"account_id"`
		AccountName      string        `json:"account_name"`
		Code             string        `json:"code"`
		Description      string        `json:"description"`
		DiscountAmount   float64       `json:"discount_amount"`
		ItemCustomFields []CustomField `json:"item_custom_fields"`
		ItemID           string        `json:"item_id"`
		ItemTotal        float64       `json:"item_total"`
		Name             string        `json:"name"`
		Price            float64       `json:"price"`
		ProductID        string        `json:"product_id"`
		ProductType      string        `json:"product_type"`
		Quantity         int64         `json:"quantity"`
		Tags             []Tag         `json:"tags"`
		TaxID            string        `json:"tax_id"`
		TaxName          string        `json:"tax_name"`
		TaxPercentage    float64       `json:"tax_percentage"`
		TaxType          string        `json:"tax_type"`
		Unit             string        `json:"unit"`
	} `json:"invoice_items"`
	InvoiceNumber          string `json:"invoice_number"`
	InvoiceURL             string `json:"invoice_url"`
	IsInclusiveTax         bool   `json:"is_inclusive_tax"`
	IsReverseChargeApplied bool   `json:"is_reverse_charge_applied"`
	IsViewedByClient       bool   `json:"is_viewed_by_client"`
	IsViewedInMail         bool   `json:"is_viewed_in_mail"`
	LastModifiedByID       string `json:"last_modified_by_id"`
	MailFirstViewedTime    string `json:"mail_first_viewed_time"`
	MailLastViewedTime     string `json:"mail_last_viewed_time"`
	Notes                  string `json:"notes"`
	Number                 string `json:"number"`
	PageWidth              string `json:"page_width"`
	PaymentExpectedDate    string `json:"payment_expected_date"`
	PaymentGateways        []struct {
		PaymentGateway string `json:"payment_gateway"`
	} `json:"payment_gateways"`
	PaymentMade            int64  `json:"payment_made"`
	PaymentReminderEnabled bool   `json:"payment_reminder_enabled"`
	PaymentTerms           int64  `json:"payment_terms"`
	PaymentTermsLabel      string `json:"payment_terms_label"`
	Payments               []struct {
		Amount               float64 `json:"amount"`
		AmountRefunded       float64 `json:"amount_refunded"`
		BankCharges          float64 `json:"bank_charges"`
		CardType             string  `json:"card_type"`
		Date                 string  `json:"date"`
		Description          string  `json:"description"`
		ExchangeRate         float64 `json:"exchange_rate"`
		GatewayTransactionID string  `json:"gateway_transaction_id"`
		InvoicePaymentID     string  `json:"invoice_payment_id"`
		LastFourDigits       string  `json:"last_four_digits"`
		PaymentID            string  `json:"payment_id"`
		PaymentMode          string  `json:"payment_mode"`
		ReferenceNumber      string  `json:"reference_number"`
		SettlementStatus     string  `json:"settlement_status"`
	} `json:"payments"`
	PricePrecision  int64  `json:"price_precision"`
	PricebookID     string `json:"pricebook_id"`
	ReferenceID     string `json:"reference_id"`
	ReferenceNumber string `json:"reference_number"`
	SalespersonID   string `json:"salesperson_id"`
	SalespersonName string `json:"salesperson_name"`
	ShippingAddress struct {
		Address   string `json:"address"`
		Attention string `json:"attention"`
		City      string `json:"city"`
		Country   string `json:"country"`
		Fax       string `json:"fax"`
		Phone     string `json:"phone"`
		State     string `json:"state"`
		Street    string `json:"street"`
		Street2   string `json:"street2"`
		Zip       string `json:"zip"`
	} `json:"shipping_address"`
	ShippingCharge                        float64       `json:"shipping_charge"`
	ShippingChargeExclusiveOfTax          float64       `json:"shipping_charge_exclusive_of_tax"`
	ShippingChargeExclusiveOfTaxFormatted string        `json:"shipping_charge_exclusive_of_tax_formatted"`
	ShippingChargeInclusiveOfTax          float64       `json:"shipping_charge_inclusive_of_tax"`
	ShippingChargeInclusiveOfTaxFormatted string        `json:"shipping_charge_inclusive_of_tax_formatted"`
	ShippingChargeTax                     string        `json:"shipping_charge_tax"`
	ShippingChargeTaxFormatted            string        `json:"shipping_charge_tax_formatted"`
	ShippingChargeTaxID                   string        `json:"shipping_charge_tax_id"`
	ShippingChargeTaxName                 string        `json:"shipping_charge_tax_name"`
	ShippingChargeTaxPercentage           string        `json:"shipping_charge_tax_percentage"`
	ShippingChargeTaxType                 string        `json:"shipping_charge_tax_type"`
	Status                                string        `json:"status"`
	StopReminderUntilPaymentExpectedDate  bool          `json:"stop_reminder_until_payment_expected_date"`
	SubTotal                              float64       `json:"sub_total"`
	SubmitterID                           string        `json:"submitter_id"`
	Subscriptions                         []interface{} `json:"subscriptions"`
	TaxRounding                           string        `json:"tax_rounding"`
	TaxTotal                              float64       `json:"tax_total"`
	Taxes                                 []interface{} `json:"taxes"`
	TemplateID                            string        `json:"template_id"`
	TemplateName                          string        `json:"template_name"`
	TemplateType                          string        `json:"template_type"`
	Terms                                 string        `json:"terms"`
	Total                                 float64       `json:"total"`
	TransactionType                       string        `json:"transaction_type"`
	UnbilledChargesID                     string        `json:"unbilled_charges_id"`
	UnusedCreditsReceivableAmount         float64       `json:"unused_credits_receivable_amount"`
	UpdatedTime                           string        `json:"updated_time"`
	VatTreatment                          string        `json:"vat_treatment"`
	WriteOffAmount                        float64       `json:"write_off_amount"`
	ZcrmPotentialID                       string        `json:"zcrm_potential_id"`
}

type CollectChargeViaBankAccountRequest

type CollectChargeViaBankAccountRequest struct {
	AccountID string `json:"account_id"`
}

type CollectChargeViaBankAccountResponse

type CollectChargeViaBankAccountResponse struct {
	Code    int64                        `json:"code"`
	Message string                       `json:"message"`
	Invoice CollectChargeInvoiceResponse `json:"invoice,omitempty"`
	Payment struct {
		PaymentID       string  `json:"payment_id"`
		PaymentMode     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"`
		ReferenceNumber string  `json:"reference_number"`
		DueDate         string  `json:"due_date"`
		AmountDue       float64 `json:"amount_due"`
		Description     string  `json:"description"`
		CustomerID      string  `json:"customer_id"`
		CustomerName    string  `json:"customer_name"`
		Email           string  `json:"email"`
		Autotransaction struct {
			AutotransactionID    string `json:"autotransaction_id"`
			PaymentGateway       string `json:"payment_gateway"`
			GatewayTransactionID string `json:"gateway_transaction_id"`
			GatewayErrorMessage  string `json:"gateway_error_message"`
			AccountID            string `json:"account_id"`
		} `json:"autotransaction"`
		Invoices []struct {
			InvoiceID     string  `json:"invoice_id"`
			InvoiceNumber string  `json:"invoice_number"`
			Date          string  `json:"date"`
			InvoiceAmount float64 `json:"invoice_amount"`
			AmountApplied float64 `json:"amount_applied"`
			BalanceAmount float64 `json:"balance_amount"`
		} `json:"invoices"`
		CurrencyCode   string        `json:"currency_code"`
		CurrencySymbol string        `json:"currency_symbol"`
		CustomFields   []CustomField `json:"custom_fields"`
		CreatedTime    string        `json:"created_time"`
		UpdatedTime    string        `json:"updated_time"`
	} `json:"payment,omitempty"`
}

type CollectChargeViaCreditCardRequest

type CollectChargeViaCreditCardRequest struct {
	CardID string `json:"card_id"`
}

type CollectChargeViaCreditCardResponse

type CollectChargeViaCreditCardResponse struct {
	Code    int64                        `json:"code"`
	Message string                       `json:"message"`
	Invoice CollectChargeInvoiceResponse `json:"invoice,omitempty"`
	Payment struct {
		PaymentID       string  `json:"payment_id"`
		PaymentMode     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"`
		ReferenceNumber string  `json:"reference_number"`
		Description     string  `json:"description"`
		CustomerID      string  `json:"customer_id"`
		CustomerName    string  `json:"customer_name"`
		Email           string  `json:"email"`
		Autotransaction struct {
			AutotransactionID    string `json:"autotransaction_id"`
			PaymentGateway       string `json:"payment_gateway"`
			GatewayTransactionID string `json:"gateway_transaction_id"`
			GatewayErrorMessage  string `json:"gateway_error_message"`
			CardID               string `json:"card_id"`
			LastFourDigits       string `json:"last_four_digits"`
			ExpiryMonth          int64  `json:"expiry_month"`
			ExpiryYear           int64  `json:"expiry_year"`
		} `json:"autotransaction"`
		Invoices []struct {
			InvoiceID     string  `json:"invoice_id"`
			InvoiceNumber string  `json:"invoice_number"`
			Date          string  `json:"date"`
			InvoiceAmount float64 `json:"invoice_amount"`
			AmountApplied float64 `json:"amount_applied"`
			BalanceAmount float64 `json:"balance_amount"`
		} `json:"invoices"`
		CurrencyCode   string        `json:"currency_code"`
		CurrencySymbol string        `json:"currency_symbol"`
		CustomFields   []CustomField `json:"custom_fields"`
		CreatedTime    string        `json:"created_time"`
		UpdatedTime    string        `json:"updated_time"`
	} `json:"payment,omitempty"`
}

type Comment

type Comment struct {
	CommentID       string `json:"comment_id,omitempty"`
	Description     string `json:"description,omitempty"`
	CommentedByID   string `json:"commented_by_id,omitempty"`
	CommentedBy     string `json:"commented_by,omitempty"`
	CommentType     string `json:"comment_type,omitempty"`
	Time            string `json:"time,omitempty"`
	OperationType   string `json:"operation_type,omitempty"`
	TransactionID   string `json:"transaction_id,omitempty"`
	TransactionType string `json:"transaction_type,omitempty"`
}

type ContactPerson

type ContactPerson struct {
	ContactpersonID string `json:"contactperson_id,omitempty"`
}

type Coupon

type Coupon struct {
	CouponCode     string  `json:"coupon_code,omitempty"`
	CouponName     string  `json:"coupon_name,omitempty"`
	DiscountAmount float64 `json:"discount_amount,omitempty"`
}

type Credit

type Credit struct {
	CreditnoteID      string  `json:"creditnote_id,omitempty"`
	CreditnotesNumber string  `json:"creditnotes_number,omitempty"`
	CreditedDate      string  `json:"credited_date,omitempty"`
	CreditedAmount    float64 `json:"credited_amount,omitempty"`
}

type CustomField

type CustomField struct {
	Index    int64       `json:"index,omitempty"`
	Value    interface{} `json:"value,omitempty"`
	Label    string      `json:"label,omitempty"`
	DataType string      `json:"data_type,omitempty"`
}

type Customer

type Customer struct {
	CustomerID        string  `json:"customer_id,omitempty"`
	DisplayName       string  `json:"display_name,omitempty"`
	Salutation        string  `json:"salutation,omitempty"`
	FirstName         string  `json:"first_name,omitempty"`
	LastName          string  `json:"last_name,omitempty"`
	Email             string  `json:"email,omitempty"`
	CompanyName       string  `json:"company_name,omitempty"`
	BillingAddress    Address `json:"billing_address,omitempty"`
	ShippingAddress   Address `json:"shipping_address,omitempty"`
	PaymentTerms      int64   `json:"payment_terms,omitempty"`
	PaymentTermsLabel string  `json:"payment_terms_label,omitempty"`
}

type CustomerResponse

type CustomerResponse struct {
	Code     int64  `json:"code"`
	Message  string `json:"message"`
	Customer struct {
		CustomerID  string `json:"customer_id"`
		DisplayName string `json:"display_name"`
		Salutation  string `json:"salutation"`
		FirstName   string `json:"first_name"`
		LastName    string `json:"last_name"`
		Email       string `json:"email"`
		Tags        []struct {
			TagOptionID    string `json:"tag_option_id"`
			IsTagMandatory bool   `json:"is_tag_mandatory"`
			TagName        string `json:"tag_name"`
			TagID          string `json:"tag_id"`
			TagOptionName  string `json:"tag_option_name"`
		} `json:"tags"`
		CompanyName     string `json:"company_name"`
		Phone           string `json:"phone"`
		Mobile          string `json:"mobile"`
		Website         string `json:"website"`
		Designation     string `json:"designation"`
		Department      string `json:"department"`
		IsPortalEnabled bool   `json:"is_portal_enabled"`
		BillingAddress  struct {
			Attention   string `json:"attention"`
			Street      string `json:"street"`
			City        string `json:"city"`
			State       string `json:"state"`
			Zip         string `json:"zip"`
			Country     string `json:"country"`
			CountryCode string `json:"country_code"`
			StateCode   string `json:"state_code"`
			Fax         string `json:"fax"`
		} `json:"billing_address"`
		ShippingAddress struct {
			Attention   string `json:"attention"`
			Street      string `json:"street"`
			City        string `json:"city"`
			State       string `json:"state"`
			Zip         string `json:"zip"`
			Country     string `json:"country"`
			CountryCode string `json:"country_code"`
			StateCode   string `json:"state_code"`
			Fax         string `json:"fax"`
		} `json:"shipping_address"`
		CurrencyCode           string        `json:"currency_code"`
		CurrencyID             string        `json:"currency_id"`
		AchSupported           bool          `json:"ach_supported"`
		GstNo                  string        `json:"gst_no"`
		GstTreatment           string        `json:"gst_treatment"`
		PlaceOfContact         string        `json:"place_of_contact"`
		PricePrecision         int64         `json:"price_precision"`
		UnusedCredits          float64       `json:"unused_credits"`
		Outstanding            float64       `json:"outstanding"`
		Notes                  string        `json:"notes"`
		Status                 string        `json:"status"`
		CustomFields           []CustomField `json:"custom_fields"`
		ZcrmAccountID          string        `json:"zcrm_account_id"`
		ZcrmContactID          string        `json:"zcrm_contact_id"`
		UpdatedTime            string        `json:"updated_time"`
		CreatedTime            string        `json:"created_time"`
		Source                 string        `json:"source"`
		PaymentTermsLabel      string        `json:"payment_terms_label"`
		IsLinkedWithZohocrm    bool          `json:"is_linked_with_zohocrm"`
		PrimaryContactpersonID string        `json:"primary_contactperson_id"`
		CanAddCard             bool          `json:"can_add_card"`
		CanAddBankAccount      bool          `json:"can_add_bank_account"`
		DefaultTemplates       struct {
			InvoiceTemplateID    string `json:"invoice_template_id"`
			CreditnoteTemplateID string `json:"creditnote_template_id"`
		} `json:"default_templates"`
		Documents []struct {
			CanShowInPortal   bool   `json:"can_show_in_portal"`
			FileName          string `json:"file_name"`
			FileType          string `json:"file_type"`
			FileSize          int64  `json:"file_size"`
			FileSizeFormatted string `json:"file_size_formatted"`
			DocumentID        string `json:"document_id"`
			AttachmentOrder   int64  `json:"attachment_order"`
		} `json:"documents"`
	} `json:"customer"`
}

type Document

type Document struct {
	FileName          string `json:"file_name,omitempty"`
	FileType          string `json:"file_type,omitempty"`
	FileSize          int64  `json:"file_size,omitempty"`
	FileSizeFormatted string `json:"file_size_formatted,omitempty"`
	DocumentID        string `json:"document_id,omitempty"`
	AttachmentOrder   int64  `json:"attachment_order,omitempty"`
}

type EmailInvoiceRequest

type EmailInvoiceRequest struct {
	ToMailIds []string `json:"to_mail_ids"`
	CcMailIds []string `json:"cc_mail_ids"`
	Subject   string   `json:"subject"`
	Body      string   `json:"body"`
}

type EmailInvoiceResponse

type EmailInvoiceResponse struct {
	Code    int64  `json:"code"`
	Message string `json:"message"`
}

type Invoice

type Invoice struct {
	InvoiceID            string        `json:"invoice_id,omitempty"`
	Number               string        `json:"number,omitempty"`
	Status               string        `json:"status,omitempty"`
	InvoiceDate          string        `json:"invoice_date,omitempty"`
	DueDate              string        `json:"due_date,omitempty"`
	CustomerID           string        `json:"customer_id,omitempty"`
	CustomerName         string        `json:"customer_name,omitempty"`
	Email                string        `json:"email,omitempty"`
	Balance              float64       `json:"balance,omitempty"`
	Total                float64       `json:"total,omitempty"`
	PaymentMade          float64       `json:"payment_made,omitempty"`
	CreditsApplied       float64       `json:"credits_applied,omitempty"`
	WriteOffAmount       float64       `json:"write_off_amount,omitempty"`
	CurrencyCode         string        `json:"currency_code,omitempty"`
	CurrencySymbol       string        `json:"currency_symbol,omitempty"`
	HasAttachment        bool          `json:"has_attachment,omitempty"`
	CreatedTime          string        `json:"created_time,omitempty"`
	UpdatedTime          string        `json:"updated_time,omitempty"`
	SalespersonID        string        `json:"salesperson_id,omitempty"`
	SalespersonName      string        `json:"salesperson_name,omitempty"`
	InvoiceUrl           string        `json:"invoice_url,omitempty"`
	PaymentExpectedDate  string        `json:"payment_expected_date,omitempty"`
	ArchPaymentInitiated interface{}   `json:"ach_payment_initiated,omitempty"` // per documentation this field should be bool, but received empty string
	TransactionType      string        `json:"transaction_type,omitempty"`
	InvoiceItems         []InvoiceItem `json:"invoice_items,omitempty"`
	Coupons              []Coupon      `json:"coupons,omitempty"`
	Credits              []Credit      `json:"credits,omitempty"`
	Payments             []Payment     `json:"payments,omitempty"`
	BillingAddress       Address       `json:"billing_address,omitempty"`
	ShippingAddress      Address       `json:"shipping_address,omitempty"`
	Comments             []Comment     `json:"comments,omitempty"`
	CustomFields         []CustomField `json:"custom_fields,omitempty"`
	CanSendInEmail       bool          `json:"can_send_in_mail,omitempty"`
	Documents            []Document    `json:"documents,omitempty"`
}

type InvoiceItem

type InvoiceItem struct {
	ItemID           string        `json:"item_id,omitempty"`
	Name             string        `json:"name,omitempty"`
	Description      string        `json:"description,omitempty"`
	Code             string        `json:"code,omitempty"`
	Tags             []Tag         `json:"tags,omitempty"`
	ItemCustomFields []CustomField `json:"item_custom_fields,omitempty"`
	Price            float64       `json:"price,omitempty"`
	Quantity         float64       `json:"quantity,omitempty"`
	DiscountAmount   float64       `json:"discount_amount,omitempty"`
	ItemTotal        float64       `json:"item_total,omitempty"`
	TaxID            string        `json:"tax_id,omitempty"`
	TaxExemptionID   string        `json:"tax_exemption_id,omitempty"`
	TaxExemptionCode string        `json:"tax_exemption_code,omitempty"`
}

type InvoiceItemRequest

type InvoiceItemRequest struct {
	Code           string  `json:"code,omitempty"`
	ProductID      string  `json:"product_id,omitempty"`
	Name           string  `json:"name,omitempty"`
	Description    string  `json:"description,omitempty"`
	Price          float64 `json:"price,omitempty"`
	Quantity       float64 `json:"quantity,omitempty"`
	TaxID          string  `json:"tax_id,omitempty"`
	TaxExemptionID string  `json:"tax_exemption_id,omitempty"`
}

type InvoiceResponse

type InvoiceResponse struct {
	Invoice Invoice `json:"invoice"`
	Code    int64   `json:"code"`
	Message string  `json:"message"`
}

type InvoiceStatus

type InvoiceStatus string
const (
	InvoiceStatusAll           InvoiceStatus = "Status.All"
	InvoiceStatusSent          InvoiceStatus = "Status.Sent"
	InvoiceStatusDraft         InvoiceStatus = "Status.Draft"
	InvoiceStatusOverDue       InvoiceStatus = "Status.OverDue"
	InvoiceStatusPaid          InvoiceStatus = "Status.Paid"
	InvoiceStatusPartiallyPaid InvoiceStatus = "Status.PartiallyPaid"
	InvoiceStatusVoid          InvoiceStatus = "Status.Void"
	InvoiceStatusUnpaid        InvoiceStatus = "Status.Unpaid"
	InvoiceStatusPending       InvoiceStatus = "Status.Pending" // Pending status is not present in zoho documentation, but works
)

Proper names for Invoice statuses

type InvoicesResponse

type InvoicesResponse struct {
	Invoices []Invoice `json:"invoices"`
	Code     int64     `json:"code"`
	Message  string    `json:"message"`
}

type Payment

type Payment struct {
	PaymentID            string  `json:"payment_id,omitempty"`
	PaymentMode          string  `json:"payment_mode,omitempty"`
	InvoicePaymentID     string  `json:"invoice_payment_id,omitempty"`
	AmountRefunded       float64 `json:"amount_refunded,omitempty"`
	GatewayTransactionID string  `json:"gateway_transaction_id,omitempty"`
	Description          string  `json:"description,omitempty"`
	Date                 string  `json:"date,omitempty"`
	ReferenceNumber      string  `json:"reference_number,omitempty"`
	Amount               float64 `json:"amount,omitempty"`
	BankCharges          float64 `json:"bank_charges,omitempty"`
	ExchangeRate         float64 `json:"exchange_rate,omitempty"`
}

type PaymentGateway

type PaymentGateway struct {
	PaymentGateway string `json:"payment_gateway,omitempty"`
}

type Plan

type Plan struct {
	PlanCode        string  `json:"plan_code,omitempty"`
	Name            string  `json:"name,omitempty"`
	Quantity        float64 `json:"quantity,omitempty"`
	Price           float64 `json:"price,omitempty"`
	Discount        float64 `json:"discount,omitempty"`
	Total           float64 `json:"total,omitempty"`
	SetupFee        float64 `json:"setup_fee,omitempty"`
	PlanDescription string  `json:"plan_description,omitempty"`
	TaxID           string  `json:"tax_id,omitempty"`
	TrialDays       int64   `json:"trial_days,omitempty"`
}

type Subscription

type Subscription struct {
	SubscriptionID      string  `json:"subscription_id,omitempty"`
	Name                string  `json:"name,omitempty"`
	Status              string  `json:"status,omitempty"`
	Amount              float64 `json:"amount,omitempty"`
	CreatedAt           string  `json:"created_at,omitempty"`
	ActivatedAt         string  `json:"activated_at,omitempty"`
	CurrentTermStartsAt string  `json:"current_term_starts_at,omitempty"`
	CurrentTermEndsAt   string  `json:"current_term_ends_at,omitempty"`
	LastBillingAt       string  `json:"last_billing_at,omitempty"`
	NextBillingAt       string  `json:"next_billing_at,omitempty"`
	ExpiresAt           string  `json:"expires_at,omitempty"`
	Interval            int64   `json:"interval,omitempty"`
	IntervalUnit        string  `json:"interval_unit,omitempty"`
	AutoCollect         bool    `json:"auto_collect,omitempty"`
	CreatedTime         string  `json:"created_time,omitempty"`
	UpdatedTime         string  `json:"updated_time,omitempty"`
	ReferenceID         string  `json:"reference_id,omitempty"`
	SalespersonID       string  `json:"salesperson_id,omitempty"`
	SalespersonName     string  `json:"salesperson_name,omitempty"`
	ChildInvoiceID      string  `json:"child_invoice_id,omitempty"`
	CurrencyCode        string  `json:"currency_code,omitempty"`
	CurrencySymbol      string  `json:"currency_symbol,omitempty"`
	EndOfTerm           bool    `json:"end_of_term,omitempty"`
	ProductID           string  `json:"product_id,omitempty"`
	ProductName         string  `json:"product_name,omitempty"`
	Plan                Plan    `json:"plan,omitempty"`
	Addons              []Addon `json:"addons,omitempty"`
	Coupon              struct {
		CouponCode     string  `json:"coupon_code,omitempty"`
		DiscountAmount float64 `json:"discount_amount,omitempty"`
	} `json:"coupon,omitempty"`
	Card struct {
		CardID         string `json:"card_id,omitempty"`
		LastFourDigits string `json:"last_four_digits,omitempty"`
		PaymentGateway string `json:"payment_gateway,omitempty"`
		ExpiryMonth    int64  `json:"expiry_month,omitempty"`
		ExpiryYear     int64  `json:"expiry_year,omitempty"`
	} `json:"card,omitempty"`
	PaymentTerms      int64           `json:"payment_terms,omitempty"`
	PaymentTermsLabel string          `json:"payment_terms_label,omitempty"`
	CanAddBankAccount bool            `json:"can_add_bank_account,omitempty"`
	Customer          Customer        `json:"customer,omitempty"`
	CustomFields      []CustomField   `json:"custom_fields,omitempty"`
	Contactpersons    []ContactPerson `json:"contactpersons,omitempty"`
	Notes             []struct {
		NoteID        string `json:"note_id,omitempty"`
		Description   string `json:"description,omitempty"`
		CommentedBy   string `json:"commented_by,omitempty"`
		CommentedTime string `json:"commented_time,omitempty"`
	} `json:"notes,omitempty"`
	PaymentGateways        []PaymentGateway `json:"payment_gateways,omitempty"`
	CreateBackdatedInvoice bool             `json:"create_backdated_invoice,omitempty"`
	TemplateID             string           `json:"template_id,omitempty"`
}

type SubscriptionAddCharge

type SubscriptionAddCharge struct {
	Amount               float64       `json:"amount,omitempty"`
	Description          string        `json:"description,omitempty"`
	Tags                 []Tag         `json:"tags,omitempty"`
	ItemCustomFields     []CustomField `json:"item_custom_fields,omitempty"`
	AccountID            string        `json:"account_id,omitempty"`
	AddToUnbilledCharges bool          `json:"add_to_unbilled_charges,omitempty"`
}

type SubscriptionCancelResponse

type SubscriptionCancelResponse struct {
	Subscription Subscription `json:"subscription"`
	Code         int64        `json:"code"`
	Message      string       `json:"message"`
}

type SubscriptionCreate

type SubscriptionCreate struct {
	AddToUnbilledCharges bool   `json:"add_to_unbilled_charges,omitempty"`
	CustomerID           string `json:"customer_id,omitempty"`
	Customer             struct {
		DisplayName       string        `json:"display_name,omitempty"`
		Salutation        string        `json:"salutation,omitempty"`
		FirstName         string        `json:"first_name,omitempty"`
		LastName          string        `json:"last_name,omitempty"`
		Email             string        `json:"email,omitempty"`
		CompanyName       string        `json:"company_name,omitempty"`
		BillingAddress    Address       `json:"billing_address,omitempty"`
		ShippingAddress   Address       `json:"shipping_address,omitempty"`
		PaymentTerms      int64         `json:"payment_terms,omitempty"`
		PaymentTermsLabel string        `json:"payment_terms_label,omitempty"`
		CustomFields      []CustomField `json:"custom_fields,omitempty"`
		PlaceOfContact    string        `json:"place_of_contact,omitempty"`
		GstNo             string        `json:"gst_no,omitempty"`
		GstTreatment      string        `json:"gst_treatment,omitempty"`
		VatTreatment      string        `json:"vat_treatment,omitempty"`
		VatRegNo          int64         `json:"vat_reg_no,omitempty"`
		CountryCode       string        `json:"country_code,omitempty"`
		IsTaxable         bool          `json:"is_taxable,omitempty"`
		TaxID             string        `json:"tax_id,omitempty"`
		TaxAuthorityID    string        `json:"tax_authority_id,omitempty"`
		TaxAuthorityName  string        `json:"tax_authority_name,omitempty"`
		TaxExemptionID    string        `json:"tax_exemption_id,omitempty"`
		TaxExemptionCode  string        `json:"tax_exemption_code,omitempty"`
	} `json:"customer,omitempty"`
	PaymentTerms      int64         `json:"payment_terms,omitempty"`
	PaymentTermsLabel string        `json:"payment_terms_label,omitempty"`
	CustomFields      []CustomField `json:"custom_fields,omitempty"`
	Contactpersons    []struct {
		ContactpersonID string `json:"contactperson_id,omitempty"`
	} `json:"contactpersons,omitempty"`
	StartsAt      string `json:"starts_at,omitempty"`
	ExchangeRate  int64  `json:"exchange_rate,omitempty"`
	PlaceOfSupply string `json:"place_of_supply,omitempty"`
	Plan          struct {
		PlanCode                 string        `json:"plan_code,omitempty"`
		PlanDescription          string        `json:"plan_description,omitempty"`
		Price                    float64       `json:"price,omitempty"`
		SetupFee                 float64       `json:"setup_fee,omitempty"`
		SetupFeeTaxID            string        `json:"setup_fee_tax_id,omitempty"`
		Tags                     []Tag         `json:"tags,omitempty"`
		ItemCustomFields         []CustomField `json:"item_custom_fields,omitempty"`
		Quantity                 float64       `json:"quantity,omitempty"`
		TaxExemptionID           string        `json:"tax_exemption_id,omitempty"`
		TaxExemptionCode         string        `json:"tax_exemption_code,omitempty"`
		SetupFeeTaxExemptionID   string        `json:"setup_fee_tax_exemption_id,omitempty"`
		SetupFeeTaxExemptionCode string        `json:"setup_fee_tax_exemption_code,omitempty"`
		ExcludeTrial             bool          `json:"exclude_trial,omitempty"`
		ExcludeSetupFee          bool          `json:"exclude_setup_fee,omitempty"`
		BillingCycles            int64         `json:"billing_cycles,omitempty"`
		TrialDays                int64         `json:"trial_days,omitempty"`
	} `json:"plan,omitempty"`
	Addons []struct {
		AddonCode        string        `json:"addon_code,omitempty"`
		AddonDescription string        `json:"addon_description,omitempty"`
		Price            float64       `json:"price,omitempty"`
		Tags             []Tag         `json:"tags,omitempty"`
		ItemCustomFields []CustomField `json:"item_custom_fields,omitempty"`
		TaxExemptionID   string        `json:"tax_exemption_id,omitempty"`
		TaxExemptionCode string        `json:"tax_exemption_code,omitempty"`
	} `json:"addons,omitempty"`
	CouponCode             string           `json:"coupon_code,omitempty"`
	AutoCollect            bool             `json:"auto_collect,omitempty"`
	ReferenceID            string           `json:"reference_id,omitempty"`
	SalespersonName        string           `json:"salesperson_name,omitempty"`
	PaymentGateways        []PaymentGateway `json:"payment_gateways,omitempty"`
	CreateBackdatedInvoice bool             `json:"create_backdated_invoice,omitempty"`
	TemplateID             int64            `json:"template_id,omitempty"`
}

type SubscriptionDeleteResponse

type SubscriptionDeleteResponse struct {
	Code    int64  `json:"code"`
	Message string `json:"message"`
}

type SubscriptionResponse

type SubscriptionResponse struct {
	Subscription Subscription `json:"subscription"`
	Code         int64        `json:"code"`
	Message      string       `json:"message"`
}

type SubscriptionStatus

type SubscriptionStatus string
const (
	SubscriptionStatusAll                  SubscriptionStatus = "SubscriptionStatus.All"
	SubscriptionStatusActive               SubscriptionStatus = "SubscriptionStatus.ACTIVE"
	SubscriptionStatusLive                 SubscriptionStatus = "SubscriptionStatus.LIVE"
	SubscriptionStatusFuture               SubscriptionStatus = "SubscriptionStatus.FUTURE"
	SubscriptionStatusTrial                SubscriptionStatus = "SubscriptionStatus.TRIAL"
	SubscriptionStatusPastDue              SubscriptionStatus = "SubscriptionStatus.PAST_DUE"
	SubscriptionStatusUnpaid               SubscriptionStatus = "SubscriptionStatus.UNPAID"
	SubscriptionStatusNonRenewing          SubscriptionStatus = "SubscriptionStatus.NON_RENEWING"
	SubscriptionStatusCancelledFromDunning SubscriptionStatus = "SubscriptionStatus.CANCELLED_FROM_DUNNING"
	SubscriptionStatusCancelled            SubscriptionStatus = "SubscriptionStatus.CANCELLED"
	SubscriptionStatusExpired              SubscriptionStatus = "SubscriptionStatus.EXPIRED"
	SubscriptionStatusTrialExpired         SubscriptionStatus = "SubscriptionStatus.TRIAL_EXPIRED"
	SubscriptionStatusCancelledLastMonth   SubscriptionStatus = "SubscriptionStatus.CANCELLED_LAST_MONTH"
	SubscriptionStatusCancelledThisMonth   SubscriptionStatus = "SubscriptionStatus.CANCELLED_THIS_MONTH"

	SubscriptionModeOnline  SubscriptionStatus = "SubscriptionMode.ONLINE"
	SubscriptionModeOffline SubscriptionStatus = "SubscriptionMode.OFFLINE"
)

Proper names for Subscription statuses

type SubscriptionUpdate

type SubscriptionUpdate struct {
	ExchangeRate float64 `json:"exchange_rate,omitempty,omitempty"`
	Plan         struct {
		PlanCode                 string        `json:"plan_code,omitempty"`
		PlanDescription          string        `json:"plan_description,omitempty"`
		Price                    float64       `json:"price,omitempty"`
		SetupFee                 float64       `json:"setup_fee,omitempty"`
		Quantity                 float64       `json:"quantity,omitempty"`
		Tags                     []Tag         `json:"tags,omitempty"`
		ItemCustomFields         []CustomField `json:"item_custom_fields,omitempty"`
		TaxID                    string        `json:"tax_id,omitempty"`
		TaxExemptionID           string        `json:"tax_exemption_id,omitempty"`
		TaxExemptionCode         string        `json:"tax_exemption_code,omitempty"`
		SetupFeeTaxExemptionID   string        `json:"setup_fee_tax_exemption_id,omitempty"`
		SetupFeeTaxExemptionCode string        `json:"setup_fee_tax_exemption_code,omitempty"`
		ExcludeTrial             bool          `json:"exclude_trial,omitempty"`
		ExcludeSetupFee          bool          `json:"exclude_setup_fee,omitempty"`
		BillingCycles            int64         `json:"billing_cycles,omitempty"`
		TrialDays                int64         `json:"trial_days,omitempty"`
	} `json:"plan,omitempty"`
	Addons []struct {
		AddonCode        string        `json:"addon_code,omitempty"`
		AddonDescription string        `json:"addon_description,omitempty"`
		Price            float64       `json:"price,omitempty"`
		Tags             []Tag         `json:"tags,omitempty"`
		ItemCustomFields []CustomField `json:"item_custom_fields,omitempty"`
		TaxExemptionID   string        `json:"tax_exemption_id,omitempty"`
		TaxExemptionCode string        `json:"tax_exemption_code,omitempty"`
	} `json:"addons,omitempty"`
	AutoCollect     bool   `json:"auto_collect,omitempty"`
	CouponCode      string `json:"coupon_code,omitempty"`
	ReferenceID     string `json:"reference_id,omitempty"`
	SalespersonID   string `json:"salesperson_id,omitempty"`
	SalespersonName string `json:"salesperson_name,omitempty"`
	EndOfTerm       bool   `json:"end_of_term,omitempty"`
	Contactpersons  []struct {
		ContactpersonID string `json:"contactperson_id,omitempty"`
	} `json:"contactpersons,omitempty"`
	PaymentTerms      int64            `json:"payment_terms,omitempty"`
	PaymentTermsLabel string           `json:"payment_terms_label,omitempty"`
	PaymentGateways   []PaymentGateway `json:"payment_gateways,omitempty"`
	CustomFields      []CustomField    `json:"custom_fields,omitempty"`
	TemplateID        int64            `json:"template_id,omitempty"`
}

type SubscriptionsResponse

type SubscriptionsResponse struct {
	Subscriptions []Subscription `json:"subscriptions"`
	Code          int64          `json:"code"`
	Message       string         `json:"message"`
}

type Tag

type Tag struct {
	TagID       string `json:"tag_id,omitempty"`
	TagOptionID string `json:"tag_option_id,omitempty"`
}

Jump to

Keyboard shortcuts

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