abr

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2018 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

A Go wrapper for the Australian Business Register

Index

Constants

View Source
const (
	BaseURL = "https://www.abn.business.gov.au/abrxmlsearch/ABRXMLSearch.asmx/"

	GUIDEnvName      = "ABR_GUID"
	MissingGUIDError = "The ABR_GUID environment variable must be set"
)

Variables

View Source
var Version = "0.1.0"

Functions

func ValidateABN added in v0.1.0

func ValidateABN(abn string) (bool, string)

ValidateABN tests a string to see if it is a valid ABN

func ValidateACN added in v0.1.0

func ValidateACN(acn string) (bool, string)

ValidateACN tests a string to see if it is a valid ACN

Types

type ABN

type ABN struct {
	IdentifierValue         string  `xml:"identifierValue,omitempty"`
	IsCurrentIndicator      string  `xml:"isCurrentIndicator,omitempty"`
	ReplacedIdentifierValue string  `xml:"replacedIdentifierValue,omitempty"`
	ReplacedFrom            abnDate `xml:"replacedFrom,omitempty"`
}

ABN represents an actual Australian Business Number

func (*ABN) IsValid added in v0.1.0

func (a *ABN) IsValid() (bool, string)

IsValid checks whether your ABN has a valid identifier (https://www.abr.business.gov.au/HelpAbnFormat.aspx)

type ACN added in v0.1.0

type ACN struct {
	IdentifierValue         string  `xml:"identifierValue,omitempty"`
	IsCurrentIndicator      string  `xml:"isCurrentIndicator,omitempty"`
	ReplacedIdentifierValue string  `xml:"replacedIdentifierValue,omitempty"`
	ReplacedFrom            abnDate `xml:"replacedFrom,omitempty"`
}

ACN represents an actual Australian Company Number

func (*ACN) IsValid added in v0.1.0

func (a *ACN) IsValid() (bool, string)

IsValid checks whether your ACN has a valid identifier (https://asic.gov.au/for-business/registering-a-company/steps-to-register-a-company/australian-company-numbers/australian-company-number-digit-check/)

type AddressDetails

type AddressDetails struct {
	StateCode string `xml:"stateCode,omitempty"`
	Postcode  string `xml:"postcode,omitempty"`

	EffectiveFrom abnDate `xml:"effectiveFrom,omitempty"`
	EffectiveTo   abnDate `xml:"effectiveTo,omitempty"`
}

Address details represents an address used by a BusinessEntity for a period of time

type BusinessEntity

type BusinessEntity struct {
	RecordLastUpdatedDate abnDate `xml:"recordLastUpdatedDate,omitempty"`

	// So many ways of naming a business!
	BusinessNames     []*BusinessName `xml:"businessName,omitempty"`
	HumanNames        []*HumanName    `xml:"legalName,omitempty"`
	MainNames         []*BusinessName `xml:"mainName,omitempty"`
	MainTradingNames  []*BusinessName `xml:"mainTradingName,omitempty"`
	OtherTradingNames []*BusinessName `xml:"otherTradingName,omitempty"`

	// Other details
	ABNs                 []*ABN                 `xml:"ABN,omitempty"`
	ASICNumber           string                 `xml:"ASICNumber,omitempty"`
	EntityStatuses       []*EntityStatus        `xml:"entityStatus,omitempty"`
	EntityType           *EntityType            `xml:"entityType,omitempty"`
	GSTRegisteredPeriods []*GSTRegisteredPeriod `xml:"goodsAndServicesTax,omitempty"`
	PhysicalAddresses    []*AddressDetails      `xml:"mainBusinessPhysicalAddress,omitempty"`
}

BusinessEntity represents a legal entity and encapsulates everything that the ABR knows about such an entity

func (*BusinessEntity) ABN

func (b *BusinessEntity) ABN() string

ABN returns the current ABN

func (*BusinessEntity) Name

func (b *BusinessEntity) Name() string

Name returns the most relevant name that is available

type BusinessName

type BusinessName struct {
	OrganisationName string  `xml:"organisationName"`
	EffectiveFrom    abnDate `xml:"effectiveFrom"`
	EffectiveTo      abnDate `xml:"effectiveTo"`
}

BusinessName represents some kind of name that was in use by a BusinessEntity at some point in history

type Client

type Client struct {
	BaseURL *url.URL
	GUID    string
	// contains filtered or unexported fields
}

Client provides a client connection to the ABR

func NewClient added in v0.1.0

func NewClient() (*Client, error)

NewClient returns a pointer to an initialized instance of a Client

func NewWithGuid added in v0.1.0

func NewWithGuid(guid string) (*Client, error)

NewClientWithGuid returns a pointer to an initalized instance of a Client, configured with a GUID

func (*Client) SearchByABN added in v0.1.0

func (c *Client) SearchByABN(abn string, hist bool) (*BusinessEntity, error)

SearchByABN is an alias for SearchByABNv201408

func (*Client) SearchByABNv201408

func (c *Client) SearchByABNv201408(abn string, hist bool) (*BusinessEntity, error)

SearchByABNv201408 wraps the API call to query an ABN

func (*Client) SearchByACN added in v0.1.0

func (c *Client) SearchByACN(abn string, hist bool) (*BusinessEntity, error)

SearchByACN is an alias for SearchByASICv201408

func (*Client) SearchByASIC added in v0.1.0

func (c *Client) SearchByASIC(abn string, hist bool) (*BusinessEntity, error)

SearchByASIC is an alias for SearchByASICv201408

func (*Client) SearchByASICv201408 added in v0.1.0

func (c *Client) SearchByASICv201408(acn string, hist bool) (*BusinessEntity, error)

SearchByASICv201408 wraps the API call to query an ACN

type EntityStatus

type EntityStatus struct {
	EntityStatusCode string  `xml:"entityStatusCode,omitempty"`
	EffectiveFrom    abnDate `xml:"effectiveFrom,omitempty"`
	EffectiveTo      abnDate `xml:"effectiveTo,omitempty"`
}

EntityStatus represents the status of an entity (Active or Cancelled)

type EntityType

type EntityType struct {
	EntityTypeCode    string `xml:"entityTypeCode,omitempty"`
	EntityDescription string `xml:"entityDescription,omitempty"`
}

EntityType represents the type of an entity - individal, pty ltd, etc.

type GSTRegisteredPeriod

type GSTRegisteredPeriod struct {
	EffectiveFrom abnDate `xml:"effectiveFrom,omitempty"`
	EffectiveTo   abnDate `xml:"effectiveTo,omitempty"`
}

GSTRegisteredPeriod represents a period during which the entity was registered for GST

type HumanName

type HumanName struct {
	GivenName      string `xml:"givenName"`
	OtherGivenName string `xml:"otherGivenName"`
	FamilyName     string `xml:"familyName"`

	EffectiveFrom abnDate `xml:"effectiveFrom"`
	EffectiveTo   abnDate `xml:"effectiveTo"`
}

HumanName represents the name of a human that was in use by a BusinessEntity at some point in history

type Payload

type Payload struct {
	Response *Response `xml:"response,omitempty"`
}

Payload encapsulates a Response from the API

type Response

type Response struct {
	UsageStatement          string    `xml:"usageStatement,omitempty"`
	DateRegisterLastUpdated abnDate   `xml:"dateRegisterLastUpdated,omitempty"`
	DateTimeRetrieved       time.Time `xml:"dateTimeRetrieved,omitempty"`

	BusinessEntity       *BusinessEntity            `xml:"businessEntity,omitempty"`
	BusinessEntity200506 *BusinessEntity            `xml:"businessEntity200506,omitempty"`
	BusinessEntity200709 *BusinessEntity            `xml:"businessEntity200709,omitempty"`
	BusinessEntity201205 *BusinessEntity            `xml:"businessEntity201205,omitempty"`
	BusinessEntity201408 *BusinessEntity            `xml:"businessEntity201408,omitempty"`
	Exception            *ResponseException         `xml:"exception,omitempty"`
	AbnList              *ResponseABNList           `xml:"abnList,omitempty"`
	SearchResultsList    *ResponseSearchResultsList `xml:"searchResultsList,omitempty"`
}

Response represents the XML responses available via the ABRXMLSearch

type ResponseABNList

type ResponseABNList struct {
	NumberOfRecords int32    `xml:"numberOfRecords,omitempty"`
	Abn             []string `xml:"abn,omitempty"`
}

type ResponseException

type ResponseException struct {
	ExceptionDescription string `xml:"exceptionDescription,omitempty"`
	ExceptionCode        string `xml:"exceptionCode,omitempty"`
}

type ResponseSearchResultsList

type ResponseSearchResultsList struct {
	NumberOfRecords int32  `xml:"numberOfRecords,omitempty"`
	ExceedsMaximum  string `xml:"exceedsMaximum,omitempty"`
}

Jump to

Keyboard shortcuts

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