br

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecimalString added in v0.21.0

func DecimalString(value float64) string

DecimalString writes a price as the plain decimal the API takes, never in exponent form. The catalog's unit price goes through it too.

Types

type ApproximateTaxes added in v0.27.0

type ApproximateTaxes struct {
	SimplesPercent   *float64
	FederalPercent   *float64
	StatePercent     *float64
	MunicipalPercent *float64
	FederalAmount    *float64
	StateAmount      *float64
	MunicipalAmount  *float64
}

ApproximateTaxes is the approximate tax burden of Lei 12.741 (totTrib). Send exactly one shape: SimplesPercent; the federal, state and municipal percentages; or the federal, state and municipal amounts. A left-out member of the chosen group is written as 0 by the API.

type CofinsAliq

type CofinsAliq struct {
	CST     string `json:"cst"`
	VBC     string `json:"v_bc"`
	PCofins string `json:"p_cofins"`
	VCofins string `json:"v_cofins"`
}

CofinsAliq is COFINSAliq: COFINS taxed by rate.

func NewCofinsAliq added in v0.4.0

func NewCofinsAliq(cST, vBC, pCOFINS, vCOFINS string) CofinsAliq

NewCofinsAliq fills the fields the schema requires.

type CofinsGroup

type CofinsGroup interface {
	// contains filtered or unexported methods
}

CofinsGroup is any of the COFINS variants.

type CofinsNt

type CofinsNt struct {
	CST string `json:"cst"`
}

CofinsNt is COFINSNT: COFINS not taxed.

func NewCofinsNt added in v0.4.0

func NewCofinsNt(cST string) CofinsNt

NewCofinsNt fills the fields the schema requires.

type CofinsOutr

type CofinsOutr struct {
	CST       string  `json:"cst"`
	VBC       *string `json:"v_bc,omitempty"`
	PCofins   *string `json:"p_cofins,omitempty"`
	QBCProd   *string `json:"q_bc_prod,omitempty"`
	VAliqProd *string `json:"v_aliq_prod,omitempty"`
	VCofins   string  `json:"v_cofins"`
}

CofinsOutr is COFINSOutr: COFINS taxed some other way.

func NewCofinsOutr added in v0.4.0

func NewCofinsOutr(cST, vCOFINS string) CofinsOutr

NewCofinsOutr fills the fields the schema requires.

type CofinsQtde added in v0.4.0

type CofinsQtde struct {
	CST       string `json:"cst"`
	QBCProd   string `json:"q_bc_prod"`
	VAliqProd string `json:"v_aliq_prod"`
	VCofins   string `json:"v_cofins"`
}

CofinsQtde is COFINSQtde: COFINS taxed by quantity.

func NewCofinsQtde added in v0.4.0

func NewCofinsQtde(qBCProd, vAliqProd, vCOFINS string) CofinsQtde

NewCofinsQtde fills the fields the schema requires.

type CofinsSt added in v0.4.0

type CofinsSt struct {
	VBC             *string `json:"v_bc,omitempty"`
	PCofins         *string `json:"p_cofins,omitempty"`
	QBCProd         *string `json:"q_bc_prod,omitempty"`
	VAliqProd       *string `json:"v_aliq_prod,omitempty"`
	VCofins         string  `json:"v_cofins"`
	IndSomaCOFINSST *string `json:"ind_soma_cofins_st,omitempty"`
}

CofinsSt is COFINS withheld by substitution.

type Construction added in v0.27.0

type Construction struct {
	PropertyRegistration string
	WorkIDType           string
	WorkID               string
	Address              *ServiceAddress
}

Construction is the obra group. Identify the work by WorkID with WorkIDType ("cno" or "cib", a CIB being exactly 8 characters) or by Address, not both. PropertyRegistration is optional and not enough alone.

type DeductionDocument added in v0.27.0

type DeductionDocument struct {
	Type           int
	Description    string
	NfseKey        string
	NfeKey         string
	CteKey         string
	MunicipalNfse  *MunicipalNfse
	PaperInvoice   *PaperInvoice
	FiscalDocument *OtherFiscalDocument
	OtherDocument  *OtherDocument
	IssueDate      time.Time
	CompetenceDate time.Time
	TotalAmount    float64
	DeductedAmount float64
	Supplier       *DeductionSupplier
}

DeductionDocument is one document behind the deduction (docDedRed, or docAjusteBC in the homologation layout). Set exactly one of NfseKey, NfeKey, CteKey, MunicipalNfse, PaperInvoice, FiscalDocument and OtherDocument. Type is the tpDedRed code: 1 to 9, 99, 101 to 105 or 199.

type DeductionSupplier added in v0.27.0

type DeductionSupplier struct {
	TaxID     string
	ForeignID string
	Name      string
	Address   *PersonAddress
}

DeductionSupplier is fornec, who issued the deducted document: TaxID (CPF or CNPJ, masks dropped) with an address in Brazil, or ForeignID (NIF) with an address abroad. Exactly one of the two.

type DeductionSupplierAddress added in v0.27.0

type DeductionSupplierAddress = PersonAddress

DeductionSupplierAddress is the supplier's address (fornec/end).

type Deductions added in v0.27.0

type Deductions struct {
	Percent   *float64
	Amount    *float64
	Documents []DeductionDocument
}

Deductions is the ISSQN base deduction or reduction (vDedRed, or vAjusteBC in the homologation layout). Percent and Amount are exclusive; Documents are 1 to 1000. Send at least one of the three.

type Event added in v0.27.0

type Event struct {
	Name      string
	StartDate time.Time
	EndDate   time.Time
	EventID   string
	Address   *ServiceAddress
}

Event is the atvEvento group. Name, StartDate and EndDate are required; identify the place by EventID or by Address, one of the two. The dates carry only their day.

type FederalTaxes added in v0.27.0

type FederalTaxes struct {
	PisCofins                   *PisCofins
	SocialSecurityWithheld      *float64
	IrrfWithheld                *float64
	SocialContributionsWithheld *float64
}

FederalTaxes are the federal taxes of the service (tribFed). Send at least one member. The withheld amounts are in BRL and above 0.

type ForeignTrade added in v0.27.0

type ForeignTrade struct {
	ServiceMode        int
	Relationship       *int
	CurrencyCode       string
	ForeignAmount      float64
	ProviderSupport    int
	RecipientSupport   int
	TemporaryGoods     int
	ImportDeclaration  string
	ExportRegistration string
	ShareWithMdic      bool
}

ForeignTrade is the comExt group, for a service traded with someone abroad. The coded fields take what the layout lists: ServiceMode 1 to 4, Relationship 0 to 6 or 9 (a pointer so 0, none, can be sent), ProviderSupport 1 to 8, RecipientSupport 1 to 26 and TemporaryGoods 1 to 3, where 2 needs ImportDeclaration and 3 needs ExportRegistration. CurrencyCode is the 3-digit BACEN code. ShareWithMdic is sent only when true.

type Fuel added in v0.14.0

type Fuel struct {
	AnpCode                   string
	AnpDescription            string
	ConsumerState             string
	GlpPercent                *float64
	NaturalGasNationalPercent *float64
	NaturalGasImportedPercent *float64
	StartingValue             *float64
	Codif                     *string
	TemperatureQuantity       *float64
	BiodieselPercent          *float64
}

Fuel is the NF-e fuel group (comb), needed for a good on a fuel CFOP. AnpCode (cProdANP, 9 digits), AnpDescription (descANP) and ConsumerState (UFCons) are required; the others are sent only when set. It goes on the wire under the item's "fuel" key and never together with ExtraGroups["comb"].

type IbsCbs added in v0.9.0

type IbsCbs struct {
	CST            string
	Classification string
	Base           *float64
	// RateState (pIBSUF), RateCity (pIBSMun) and RateFederal (pCBS) are in
	// percent and sent only when set, so 0 is a rate a pointer can say. An
	// NF-e group carries all three; an NFS-e group carries none.
	RateState   *float64
	RateCity    *float64
	RateFederal *float64
	// OperationIndicator is the cIndOp, 6 digits. Sent only when set.
	OperationIndicator *string
	// ReductionIbs is the IBS pRedAliq (state and municipality), in percent:
	// the cClassTrib's pRedIBS. Sent only when set.
	ReductionIbs *float64
	// ReductionCbs is the CBS pRedAliq, in percent: the cClassTrib's pRedCBS.
	// Sent only when set.
	ReductionCbs *float64

	// The fields below are NFS-e only and sent only when set.
	PersonalUse     *bool
	Government      *IbsCbsGovernment
	ReferencedNfse  []string
	Recipient       *IbsCbsRecipient
	RealEstate      *RealEstate
	MovableGoods    []MovableGood
	RegularTaxation *IbsCbsRegularTaxation
	Deferral        *IbsCbsDeferral
	PresumedCredit  *string
}

func (IbsCbs) Validate added in v0.27.0

func (g IbsCbs) Validate(path string) error

Validate checks the NFS-e groups of the IBS/CBS group against the shape rules the API enforces, naming the path of the first one it breaks.

type IbsCbsDeferral added in v0.27.0

type IbsCbsDeferral struct {
	StatePercent float64
	CityPercent  float64
	CbsPercent   float64
}

IbsCbsDeferral is gDif: the deferred share of each tax, in percent.

type IbsCbsGovernment added in v0.27.0

type IbsCbsGovernment struct {
	OperationType string
	EntityType    string
}

IbsCbsGovernment is tpOper and tpEnteGov: OperationType "1" to "5" and EntityType "1" to "4". Send at least one.

type IbsCbsRecipient added in v0.27.0

type IbsCbsRecipient struct {
	TaxID       string
	NIF         string
	NoNifReason string
	Name        string
	Address     *IbsCbsRecipientAddress
	Phone       string
	Email       string
}

IbsCbsRecipient is the dest group: who receives the service when it is not the tomador. Send exactly one of TaxID, NIF or NoNifReason ("0", "1" or "2").

type IbsCbsRecipientAddress added in v0.27.0

type IbsCbsRecipientAddress struct {
	Street       string
	Number       string
	Complement   string
	Neighborhood string
	CityCode     string
	ZipCode      string
	CountryCode  string
	PostalCode   string
	City         string
	Region       string
}

IbsCbsRecipientAddress is the dest/end address: in Brazil (CityCode and ZipCode) or abroad (CountryCode, PostalCode, City and Region), never both. Street, Number and Neighborhood are required.

type IbsCbsRegularTaxation added in v0.27.0

type IbsCbsRegularTaxation struct {
	CST            string
	Classification string
}

IbsCbsRegularTaxation is gTribRegular: the CST (3 digits) and Classification (6 digits) the operation would have under regular taxation.

type Icms00

type Icms00 struct {
	Orig  string  `json:"orig"`
	CST   string  `json:"cst"`
	ModBC string  `json:"mod_bc"`
	VBC   string  `json:"v_bc"`
	PICMS string  `json:"p_icms"`
	VICMS string  `json:"v_icms"`
	PFCP  *string `json:"p_fcp,omitempty"`
	VFCP  *string `json:"v_fcp,omitempty"`
}

Icms00 is ICMS00: ICMS fully taxed.

func NewIcms00

func NewIcms00(orig, modBC, vBC, pICMS, vICMS string) Icms00

NewIcms00 fills the fields the schema requires.

type Icms02 added in v0.4.0

type Icms02 struct {
	Orig      string  `json:"orig"`
	CST       string  `json:"cst"`
	QBCMono   *string `json:"q_bc_mono,omitempty"`
	AdRemICMS string  `json:"ad_rem_icms"`
	VICMSMono string  `json:"v_icms_mono"`
}

Icms02 is ICMS02: ICMS monofasico, taxed by unit.

func NewIcms02 added in v0.4.0

func NewIcms02(orig, adRemICMS, vICMSMono string) Icms02

NewIcms02 fills the fields the schema requires.

type Icms10 added in v0.4.0

type Icms10 struct {
	Orig         string  `json:"orig"`
	CST          string  `json:"cst"`
	ModBC        string  `json:"mod_bc"`
	VBC          string  `json:"v_bc"`
	PICMS        string  `json:"p_icms"`
	VICMS        string  `json:"v_icms"`
	VBCFCP       *string `json:"v_bc_fcp,omitempty"`
	PFCP         *string `json:"p_fcp,omitempty"`
	VFCP         *string `json:"v_fcp,omitempty"`
	ModBCST      string  `json:"mod_bc_st"`
	PMVAST       *string `json:"p_mva_st,omitempty"`
	PRedBCST     *string `json:"p_red_bc_st,omitempty"`
	VBCST        string  `json:"v_bc_st"`
	PICMSST      string  `json:"p_icms_st"`
	VICMSST      string  `json:"v_icms_st"`
	VBCFCPST     *string `json:"v_bc_fcp_st,omitempty"`
	PFCPST       *string `json:"p_fcp_st,omitempty"`
	VFCPST       *string `json:"v_fcp_st,omitempty"`
	VICMSSTDeson *string `json:"v_icms_st_deson,omitempty"`
	MotDesICMSST *string `json:"mot_des_icms_st,omitempty"`
}

Icms10 is ICMS10: ICMS taxed with substitution.

func NewIcms10 added in v0.4.0

func NewIcms10(orig, modBC, vBC, pICMS, vICMS, modBCST, vBCST, pICMSST, vICMSST string) Icms10

NewIcms10 fills the fields the schema requires.

type Icms15 added in v0.4.0

type Icms15 struct {
	Orig           string  `json:"orig"`
	CST            string  `json:"cst"`
	QBCMono        *string `json:"q_bc_mono,omitempty"`
	AdRemICMS      string  `json:"ad_rem_icms"`
	VICMSMono      string  `json:"v_icms_mono"`
	QBCMonoReten   *string `json:"q_bc_mono_reten,omitempty"`
	AdRemICMSReten string  `json:"ad_rem_icms_reten"`
	VICMSMonoReten string  `json:"v_icms_mono_reten"`
	PRedAdRem      *string `json:"p_red_ad_rem,omitempty"`
	MotRedAdRem    *string `json:"mot_red_ad_rem,omitempty"`
}

Icms15 is ICMS15: ICMS monofasico with retention.

func NewIcms15 added in v0.4.0

func NewIcms15(orig, adRemICMS, vICMSMono, adRemICMSReten, vICMSMonoReten string) Icms15

NewIcms15 fills the fields the schema requires.

type Icms20 added in v0.4.0

type Icms20 struct {
	Orig          string  `json:"orig"`
	CST           string  `json:"cst"`
	ModBC         string  `json:"mod_bc"`
	PRedBC        string  `json:"p_red_bc"`
	VBC           string  `json:"v_bc"`
	PICMS         string  `json:"p_icms"`
	VICMS         string  `json:"v_icms"`
	VBCFCP        *string `json:"v_bc_fcp,omitempty"`
	PFCP          *string `json:"p_fcp,omitempty"`
	VFCP          *string `json:"v_fcp,omitempty"`
	VICMSDeson    *string `json:"v_icms_deson,omitempty"`
	MotDesICMS    *string `json:"mot_des_icms,omitempty"`
	IndDeduzDeson *string `json:"ind_deduz_deson,omitempty"`
}

Icms20 is ICMS20: ICMS with a reduced base.

func NewIcms20 added in v0.4.0

func NewIcms20(orig, modBC, pRedBC, vBC, pICMS, vICMS string) Icms20

NewIcms20 fills the fields the schema requires.

type Icms30 added in v0.4.0

type Icms30 struct {
	Orig          string  `json:"orig"`
	CST           string  `json:"cst"`
	ModBCST       string  `json:"mod_bc_st"`
	PMVAST        *string `json:"p_mva_st,omitempty"`
	PRedBCST      *string `json:"p_red_bc_st,omitempty"`
	VBCST         string  `json:"v_bc_st"`
	PICMSST       string  `json:"p_icms_st"`
	VICMSST       string  `json:"v_icms_st"`
	VBCFCPST      *string `json:"v_bc_fcp_st,omitempty"`
	PFCPST        *string `json:"p_fcp_st,omitempty"`
	VFCPST        *string `json:"v_fcp_st,omitempty"`
	VICMSDeson    *string `json:"v_icms_deson,omitempty"`
	MotDesICMS    *string `json:"mot_des_icms,omitempty"`
	IndDeduzDeson *string `json:"ind_deduz_deson,omitempty"`
}

Icms30 is ICMS30: ICMS exempt with substitution.

func NewIcms30 added in v0.4.0

func NewIcms30(orig, modBCST, vBCST, pICMSST, vICMSST string) Icms30

NewIcms30 fills the fields the schema requires.

type Icms40

type Icms40 struct {
	Orig          string  `json:"orig"`
	CST           string  `json:"cst"`
	VICMSDeson    *string `json:"v_icms_deson,omitempty"`
	MotDesICMS    *string `json:"mot_des_icms,omitempty"`
	IndDeduzDeson *string `json:"ind_deduz_deson,omitempty"`
}

Icms40 is ICMS40: ICMS exempt or not taxed.

func NewIcms40 added in v0.4.0

func NewIcms40(orig, cST string) Icms40

NewIcms40 fills the fields the schema requires.

type Icms51 added in v0.4.0

type Icms51 struct {
	Orig      string  `json:"orig"`
	CST       string  `json:"cst"`
	ModBC     *string `json:"mod_bc,omitempty"`
	PRedBC    *string `json:"p_red_bc,omitempty"`
	CBenefRBC *string `json:"c_benef_rbc,omitempty"`
	VBC       *string `json:"v_bc,omitempty"`
	PICMS     *string `json:"p_icms,omitempty"`
	VICMSOp   *string `json:"v_icms_op,omitempty"`
	PDif      *string `json:"p_dif,omitempty"`
	VICMSDif  *string `json:"v_icms_dif,omitempty"`
	VICMS     *string `json:"v_icms,omitempty"`
	VBCFCP    *string `json:"v_bc_fcp,omitempty"`
	PFCP      *string `json:"p_fcp,omitempty"`
	VFCP      *string `json:"v_fcp,omitempty"`
	PFCPDif   *string `json:"p_fcp_dif,omitempty"`
	VFCPDif   *string `json:"v_fcp_dif,omitempty"`
	VFCPEfet  *string `json:"v_fcp_efet,omitempty"`
}

Icms51 is ICMS51: ICMS deferred.

func NewIcms51 added in v0.4.0

func NewIcms51(orig string) Icms51

NewIcms51 fills the fields the schema requires.

type Icms53 added in v0.4.0

type Icms53 struct {
	Orig         string  `json:"orig"`
	CST          string  `json:"cst"`
	QBCMono      *string `json:"q_bc_mono,omitempty"`
	AdRemICMS    *string `json:"ad_rem_icms,omitempty"`
	VICMSMonoOp  *string `json:"v_icms_mono_op,omitempty"`
	PDif         *string `json:"p_dif,omitempty"`
	VICMSMonoDif *string `json:"v_icms_mono_dif,omitempty"`
	VICMSMono    *string `json:"v_icms_mono,omitempty"`
	QBCMonoDif   *string `json:"q_bc_mono_dif,omitempty"`
	AdRemICMSDif *string `json:"ad_rem_icms_dif,omitempty"`
}

Icms53 is ICMS53: ICMS monofasico deferred.

func NewIcms53 added in v0.4.0

func NewIcms53(orig string) Icms53

NewIcms53 fills the fields the schema requires.

type Icms60

type Icms60 struct {
	Orig            string  `json:"orig"`
	CST             string  `json:"cst"`
	VBCSTRet        *string `json:"v_bc_st_ret,omitempty"`
	PST             *string `json:"p_st,omitempty"`
	VICMSSubstituto *string `json:"v_icms_substituto,omitempty"`
	VICMSSTRet      *string `json:"v_icms_st_ret,omitempty"`
	VBCFCPSTRet     *string `json:"v_bc_fcp_st_ret,omitempty"`
	PFCPSTRet       *string `json:"p_fcp_st_ret,omitempty"`
	VFCPSTRet       *string `json:"v_fcp_st_ret,omitempty"`
	PRedBCEfet      *string `json:"p_red_bc_efet,omitempty"`
	VBCEfet         *string `json:"v_bc_efet,omitempty"`
	PICMSEfet       *string `json:"p_icms_efet,omitempty"`
	VICMSEfet       *string `json:"v_icms_efet,omitempty"`
}

Icms60 is ICMS60: ICMS already charged by an earlier substitution.

func NewIcms60

func NewIcms60(orig string) Icms60

NewIcms60 fills the fields the schema requires.

type Icms61 added in v0.4.0

type Icms61 struct {
	Orig         string  `json:"orig"`
	CST          string  `json:"cst"`
	QBCMonoRet   *string `json:"q_bc_mono_ret,omitempty"`
	AdRemICMSRet string  `json:"ad_rem_icms_ret"`
	VICMSMonoRet string  `json:"v_icms_mono_ret"`
}

Icms61 is ICMS61: ICMS monofasico already charged earlier.

func NewIcms61 added in v0.4.0

func NewIcms61(orig, adRemICMSRet, vICMSMonoRet string) Icms61

NewIcms61 fills the fields the schema requires.

type Icms70 added in v0.4.0

type Icms70 struct {
	Orig          string  `json:"orig"`
	CST           string  `json:"cst"`
	ModBC         string  `json:"mod_bc"`
	PRedBC        string  `json:"p_red_bc"`
	VBC           string  `json:"v_bc"`
	PICMS         string  `json:"p_icms"`
	VICMS         string  `json:"v_icms"`
	VBCFCP        *string `json:"v_bc_fcp,omitempty"`
	PFCP          *string `json:"p_fcp,omitempty"`
	VFCP          *string `json:"v_fcp,omitempty"`
	ModBCST       string  `json:"mod_bc_st"`
	PMVAST        *string `json:"p_mva_st,omitempty"`
	PRedBCST      *string `json:"p_red_bc_st,omitempty"`
	VBCST         string  `json:"v_bc_st"`
	PICMSST       string  `json:"p_icms_st"`
	VICMSST       string  `json:"v_icms_st"`
	VBCFCPST      *string `json:"v_bc_fcp_st,omitempty"`
	PFCPST        *string `json:"p_fcp_st,omitempty"`
	VFCPST        *string `json:"v_fcp_st,omitempty"`
	VICMSDeson    *string `json:"v_icms_deson,omitempty"`
	MotDesICMS    *string `json:"mot_des_icms,omitempty"`
	IndDeduzDeson *string `json:"ind_deduz_deson,omitempty"`
	VICMSSTDeson  *string `json:"v_icms_st_deson,omitempty"`
	MotDesICMSST  *string `json:"mot_des_icms_st,omitempty"`
}

Icms70 is ICMS70: ICMS with a reduced base and substitution.

func NewIcms70 added in v0.4.0

func NewIcms70(orig, modBC, pRedBC, vBC, pICMS, vICMS, modBCST, vBCST, pICMSST, vICMSST string) Icms70

NewIcms70 fills the fields the schema requires.

type Icms90 added in v0.4.0

type Icms90 struct {
	Orig          string  `json:"orig"`
	CST           string  `json:"cst"`
	ModBC         *string `json:"mod_bc,omitempty"`
	VBC           *string `json:"v_bc,omitempty"`
	PRedBC        *string `json:"p_red_bc,omitempty"`
	CBenefRBC     *string `json:"c_benef_rbc,omitempty"`
	PICMS         *string `json:"p_icms,omitempty"`
	VICMSOp       *string `json:"v_icms_op,omitempty"`
	PDif          *string `json:"p_dif,omitempty"`
	VICMSDif      *string `json:"v_icms_dif,omitempty"`
	VICMS         *string `json:"v_icms,omitempty"`
	VBCFCP        *string `json:"v_bc_fcp,omitempty"`
	PFCP          *string `json:"p_fcp,omitempty"`
	VFCP          *string `json:"v_fcp,omitempty"`
	PFCPDif       *string `json:"p_fcp_dif,omitempty"`
	VFCPDif       *string `json:"v_fcp_dif,omitempty"`
	VFCPEfet      *string `json:"v_fcp_efet,omitempty"`
	ModBCST       *string `json:"mod_bc_st,omitempty"`
	PMVAST        *string `json:"p_mva_st,omitempty"`
	PRedBCST      *string `json:"p_red_bc_st,omitempty"`
	VBCST         *string `json:"v_bc_st,omitempty"`
	PICMSST       *string `json:"p_icms_st,omitempty"`
	VICMSST       *string `json:"v_icms_st,omitempty"`
	VBCFCPST      *string `json:"v_bc_fcp_st,omitempty"`
	PFCPST        *string `json:"p_fcp_st,omitempty"`
	VFCPST        *string `json:"v_fcp_st,omitempty"`
	VICMSDeson    *string `json:"v_icms_deson,omitempty"`
	MotDesICMS    *string `json:"mot_des_icms,omitempty"`
	IndDeduzDeson *string `json:"ind_deduz_deson,omitempty"`
	VICMSSTDeson  *string `json:"v_icms_st_deson,omitempty"`
	MotDesICMSST  *string `json:"mot_des_icms_st,omitempty"`
}

Icms90 is ICMS90: ICMS, other cases.

func NewIcms90 added in v0.4.0

func NewIcms90(orig string) Icms90

NewIcms90 fills the fields the schema requires.

type IcmsGroup

type IcmsGroup interface {
	// contains filtered or unexported methods
}

IcmsGroup is any of the ICMS variants.

type IcmsPart added in v0.4.0

type IcmsPart struct {
	Orig          string  `json:"orig"`
	CST           string  `json:"cst"`
	ModBC         string  `json:"mod_bc"`
	VBC           string  `json:"v_bc"`
	PRedBC        *string `json:"p_red_bc,omitempty"`
	PICMS         string  `json:"p_icms"`
	VICMS         string  `json:"v_icms"`
	ModBCST       string  `json:"mod_bc_st"`
	PMVAST        *string `json:"p_mva_st,omitempty"`
	PRedBCST      *string `json:"p_red_bc_st,omitempty"`
	VBCST         string  `json:"v_bc_st"`
	PICMSST       string  `json:"p_icms_st"`
	VICMSST       string  `json:"v_icms_st"`
	VBCFCPST      *string `json:"v_bc_fcp_st,omitempty"`
	PFCPST        *string `json:"p_fcp_st,omitempty"`
	VFCPST        *string `json:"v_fcp_st,omitempty"`
	PBCOp         string  `json:"p_bc_op"`
	UFST          string  `json:"uf_st"`
	VICMSDeson    *string `json:"v_icms_deson,omitempty"`
	MotDesICMS    *string `json:"mot_des_icms,omitempty"`
	IndDeduzDeson *string `json:"ind_deduz_deson,omitempty"`
}

IcmsPart is ICMSPart: ICMS split between the origin and destination states.

func NewIcmsPart added in v0.4.0

func NewIcmsPart(orig, cST, modBC, vBC, pICMS, vICMS, modBCST, vBCST, pICMSST, vICMSST, pBCOp, uFST string) IcmsPart

NewIcmsPart fills the fields the schema requires.

type IcmsSn101

type IcmsSn101 struct {
	Orig        string `json:"orig"`
	CSOSN       string `json:"csosn"`
	PCredSN     string `json:"p_cred_sn"`
	VCredICMSSN string `json:"v_cred_icms_sn"`
}

IcmsSn101 is ICMSSN101: Simples Nacional ICMS with a credit.

func NewIcmsSn101

func NewIcmsSn101(orig, pCredSN, vCredICMSSN string) IcmsSn101

NewIcmsSn101 fills the fields the schema requires.

type IcmsSn102

type IcmsSn102 struct {
	Orig  *string `json:"orig,omitempty"`
	CSOSN string  `json:"csosn"`
}

IcmsSn102 is ICMSSN102: Simples Nacional ICMS without a credit.

func NewIcmsSn102 added in v0.4.0

func NewIcmsSn102(cSOSN string) IcmsSn102

NewIcmsSn102 fills the fields the schema requires.

type IcmsSn201 added in v0.4.0

type IcmsSn201 struct {
	Orig        string  `json:"orig"`
	CSOSN       string  `json:"csosn"`
	ModBCST     string  `json:"mod_bc_st"`
	PMVAST      *string `json:"p_mva_st,omitempty"`
	PRedBCST    *string `json:"p_red_bc_st,omitempty"`
	VBCST       string  `json:"v_bc_st"`
	PICMSST     string  `json:"p_icms_st"`
	VICMSST     string  `json:"v_icms_st"`
	VBCFCPST    *string `json:"v_bc_fcp_st,omitempty"`
	PFCPST      *string `json:"p_fcp_st,omitempty"`
	VFCPST      *string `json:"v_fcp_st,omitempty"`
	PCredSN     string  `json:"p_cred_sn"`
	VCredICMSSN string  `json:"v_cred_icms_sn"`
}

IcmsSn201 is ICMSSN201: Simples Nacional ICMS with a credit and substitution.

func NewIcmsSn201 added in v0.4.0

func NewIcmsSn201(orig, modBCST, vBCST, pICMSST, vICMSST, pCredSN, vCredICMSSN string) IcmsSn201

NewIcmsSn201 fills the fields the schema requires.

type IcmsSn202 added in v0.4.0

type IcmsSn202 struct {
	Orig     string  `json:"orig"`
	CSOSN    string  `json:"csosn"`
	ModBCST  string  `json:"mod_bc_st"`
	PMVAST   *string `json:"p_mva_st,omitempty"`
	PRedBCST *string `json:"p_red_bc_st,omitempty"`
	VBCST    string  `json:"v_bc_st"`
	PICMSST  string  `json:"p_icms_st"`
	VICMSST  string  `json:"v_icms_st"`
	VBCFCPST *string `json:"v_bc_fcp_st,omitempty"`
	PFCPST   *string `json:"p_fcp_st,omitempty"`
	VFCPST   *string `json:"v_fcp_st,omitempty"`
}

IcmsSn202 is ICMSSN202: Simples Nacional ICMS without a credit, with substitution.

func NewIcmsSn202 added in v0.4.0

func NewIcmsSn202(orig, cSOSN, modBCST, vBCST, pICMSST, vICMSST string) IcmsSn202

NewIcmsSn202 fills the fields the schema requires.

type IcmsSn500 added in v0.4.0

type IcmsSn500 struct {
	Orig            string  `json:"orig"`
	CSOSN           string  `json:"csosn"`
	VBCSTRet        *string `json:"v_bc_st_ret,omitempty"`
	PST             *string `json:"p_st,omitempty"`
	VICMSSubstituto *string `json:"v_icms_substituto,omitempty"`
	VICMSSTRet      *string `json:"v_icms_st_ret,omitempty"`
	VBCFCPSTRet     *string `json:"v_bc_fcp_st_ret,omitempty"`
	PFCPSTRet       *string `json:"p_fcp_st_ret,omitempty"`
	VFCPSTRet       *string `json:"v_fcp_st_ret,omitempty"`
	PRedBCEfet      *string `json:"p_red_bc_efet,omitempty"`
	VBCEfet         *string `json:"v_bc_efet,omitempty"`
	PICMSEfet       *string `json:"p_icms_efet,omitempty"`
	VICMSEfet       *string `json:"v_icms_efet,omitempty"`
}

IcmsSn500 is ICMSSN500: Simples Nacional ICMS already charged by substitution.

func NewIcmsSn500 added in v0.4.0

func NewIcmsSn500(orig string) IcmsSn500

NewIcmsSn500 fills the fields the schema requires.

type IcmsSn900 added in v0.1.1

type IcmsSn900 struct {
	Orig        *string `json:"orig,omitempty"`
	CSOSN       string  `json:"csosn"`
	ModBC       *string `json:"mod_bc,omitempty"`
	VBC         *string `json:"v_bc,omitempty"`
	PRedBC      *string `json:"p_red_bc,omitempty"`
	PICMS       *string `json:"p_icms,omitempty"`
	VICMS       *string `json:"v_icms,omitempty"`
	ModBCST     *string `json:"mod_bc_st,omitempty"`
	PMVAST      *string `json:"p_mva_st,omitempty"`
	PRedBCST    *string `json:"p_red_bc_st,omitempty"`
	VBCST       *string `json:"v_bc_st,omitempty"`
	PICMSST     *string `json:"p_icms_st,omitempty"`
	VICMSST     *string `json:"v_icms_st,omitempty"`
	VBCFCPST    *string `json:"v_bc_fcp_st,omitempty"`
	PFCPST      *string `json:"p_fcp_st,omitempty"`
	VFCPST      *string `json:"v_fcp_st,omitempty"`
	PCredSN     *string `json:"p_cred_sn,omitempty"`
	VCredICMSSN *string `json:"v_cred_icms_sn,omitempty"`
}

IcmsSn900 is ICMSSN900: Simples Nacional ICMS, other cases.

type IcmsSt added in v0.4.0

type IcmsSt struct {
	Orig            string  `json:"orig"`
	CST             string  `json:"cst"`
	VBCSTRet        string  `json:"v_bc_st_ret"`
	PST             *string `json:"p_st,omitempty"`
	VICMSSubstituto *string `json:"v_icms_substituto,omitempty"`
	VICMSSTRet      string  `json:"v_icms_st_ret"`
	VBCFCPSTRet     *string `json:"v_bc_fcp_st_ret,omitempty"`
	PFCPSTRet       *string `json:"p_fcp_st_ret,omitempty"`
	VFCPSTRet       *string `json:"v_fcp_st_ret,omitempty"`
	VBCSTDest       string  `json:"v_bc_st_dest"`
	VICMSSTDest     string  `json:"v_icms_st_dest"`
	PRedBCEfet      *string `json:"p_red_bc_efet,omitempty"`
	VBCEfet         *string `json:"v_bc_efet,omitempty"`
	PICMSEfet       *string `json:"p_icms_efet,omitempty"`
	VICMSEfet       *string `json:"v_icms_efet,omitempty"`
}

IcmsSt is ICMSST: ICMS charged earlier, for the substituted taxpayer.

func NewIcmsSt added in v0.4.0

func NewIcmsSt(orig, cST, vBCSTRet, vICMSSTRet, vBCSTDest, vICMSSTDest string) IcmsSt

NewIcmsSt fills the fields the schema requires.

type IcmsUfDest

type IcmsUfDest struct {
	VBCUFDest      string  `json:"v_bc_uf_dest"`
	VBCFCPUFDest   *string `json:"v_bc_fcp_uf_dest,omitempty"`
	PFCPUFDest     *string `json:"p_fcp_uf_dest,omitempty"`
	PICMSUFDest    string  `json:"p_icms_uf_dest"`
	PICMSInter     string  `json:"p_icms_inter"`
	PICMSInterPart string  `json:"p_icms_inter_part"`
	VFCPUFDest     *string `json:"v_fcp_uf_dest,omitempty"`
	VICMSUFDest    string  `json:"v_icms_uf_dest"`
	VICMSUFRemet   string  `json:"v_icms_uf_remet"`
}

IcmsUfDest is the interstate ICMS share owed to the destination state.

type IntermediaryAddress added in v0.27.0

type IntermediaryAddress = PersonAddress

IntermediaryAddress is the intermediary's address (interm/end).

type Ipi

type Ipi struct {
	CNPJProd *string    `json:"cnpj_prod,omitempty"`
	CSelo    *string    `json:"c_selo,omitempty"`
	QSelo    *string    `json:"q_selo,omitempty"`
	CEnq     string     `json:"c_enq"`
	Trib     IpiVariant `json:"-"`
}

Ipi is this item's IPI.

type IpiNt

type IpiNt struct {
	CST string `json:"cst"`
}

IpiNt is IPINT: IPI not taxed.

func NewIpiNt added in v0.4.0

func NewIpiNt(cST string) IpiNt

NewIpiNt fills the fields the schema requires.

type IpiTrib

type IpiTrib struct {
	CST   string  `json:"cst"`
	VBC   *string `json:"v_bc,omitempty"`
	PIPI  *string `json:"p_ipi,omitempty"`
	QUnid *string `json:"q_unid,omitempty"`
	VUnid *string `json:"v_unid,omitempty"`
	VIPI  string  `json:"v_ipi"`
}

IpiTrib is IPITrib: IPI taxed by rate or by quantity.

func NewIpiTrib added in v0.4.0

func NewIpiTrib(cST, vIPI string) IpiTrib

NewIpiTrib fills the fields the schema requires.

type IpiVariant

type IpiVariant interface {
	// contains filtered or unexported methods
}

IpiVariant is any of the IPI variants.

type IssDetails added in v0.27.0

type IssDetails struct {
	Taxation          string
	ImmunityType      *int
	ResultCountryCode string
	Suspension        *IssSuspension
	Rate              *float64
	Retention         string
	MunicipalBenefit  *IssMunicipalBenefit
}

IssDetails is the ISSQN of the service (tribMun). Taxation is "taxable" (the default when empty), "immune", "export" or "not_levied"; Retention is "none", "tomador" or "intermediary".

type IssMunicipalBenefit added in v0.27.0

type IssMunicipalBenefit struct {
	ID               string
	ReductionAmount  *float64
	ReductionPercent *float64
}

IssMunicipalBenefit is the municipality's registered benefit (BM): ID is the 14-digit nBM, and at most one of ReductionAmount and ReductionPercent goes with it.

type IssSuspension added in v0.27.0

type IssSuspension struct {
	Type          string
	ProcessNumber string
}

IssSuspension is exigSusp: Type is "judicial" or "administrative" and ProcessNumber the 30-digit proceeding number.

type MovableGood added in v0.27.0

type MovableGood struct {
	NCM         string
	Description string
	Quantity    int
}

MovableGood is one bensMoveis entry: NCM (8 digits), Description and a Quantity from 1 to 999.

type MunicipalNfse added in v0.27.0

type MunicipalNfse struct {
	CityCode         string
	Number           string
	VerificationCode string
}

MunicipalNfse is a municipal NFS-e outside the national repository.

type NfseDetails added in v0.27.0

type NfseDetails struct {
	ApproximateTaxes   *ApproximateTaxes
	CompetenceDate     time.Time
	ServiceCityCode    string
	ServiceCountryCode string
	Iss                *IssDetails
	Federal            *FederalTaxes
	Deductions         *Deductions
	Substitution       *Substitution
	Construction       *Construction
	Event              *Event
	References         *References
	Intermediary       *NfseIntermediary
	ForeignTrade       *ForeignTrade
}

NfseDetails are the NFS-e document-level fields beyond the lines. Every group is optional and left out when nil; NFS-e only, refused for an NF-e. CompetenceDate (dCompet) carries only its day. ServiceCityCode and ServiceCountryCode are exclusive, and the country is never BR.

func (NfseDetails) ToDict added in v0.27.0

func (d NfseDetails) ToDict() (map[string]any, error)

ToDict returns the group as the request body carries it, or the first shape rule it breaks. A group with nothing set is left out.

type NfseIntermediary added in v0.27.0

type NfseIntermediary struct {
	TaxID                  string
	ForeignID              string
	ForeignIDMissingReason *int
	Caepf                  string
	MunicipalRegistration  string
	Name                   string
	Address                *PersonAddress
	Phone                  string
	Email                  string
}

NfseIntermediary is the interm group, identified by exactly one of TaxID (CPF or CNPJ, masks dropped), ForeignID (NIF) or ForeignIDMissingReason (1 exempt, 2 not required). A ForeignID or ForeignIDMissingReason needs an Address abroad, and a TaxID one in Brazil or none.

type OtherDocument added in v0.27.0

type OtherDocument struct {
	Number      string
	Description string
}

OtherDocument is a non-fiscal document. Description is read by the homologation layout only.

type OtherFiscalDocument added in v0.27.0

type OtherFiscalDocument struct {
	Number      string
	CityCode    string
	Description string
}

OtherFiscalDocument is a fiscal document outside the national repository. CityCode and Description are read by the homologation layout only.

type PaperInvoice added in v0.27.0

type PaperInvoice struct {
	Number string
	Model  string
	Series string
}

PaperInvoice is a paper service invoice (NFNFS).

type PersonAddress added in v0.27.0

type PersonAddress struct {
	Street       string
	Number       string
	Complement   string
	Neighborhood string
	CityCode     string
	ZipCode      string
	CountryCode  string
	PostalCode   string
	City         string
	State        string
}

PersonAddress is a person's address: in Brazil (CityCode and ZipCode) or abroad (CountryCode, PostalCode, City and State), never both. Street, Number and Neighborhood are required.

type PisAliq

type PisAliq struct {
	CST  string `json:"cst"`
	VBC  string `json:"v_bc"`
	PPIS string `json:"p_pis"`
	VPIS string `json:"v_pis"`
}

PisAliq is PISAliq: PIS taxed by rate.

func NewPisAliq added in v0.4.0

func NewPisAliq(cST, vBC, pPIS, vPIS string) PisAliq

NewPisAliq fills the fields the schema requires.

type PisCofins added in v0.27.0

type PisCofins struct {
	CST             string
	Base            *float64
	PisRate         *float64
	CofinsRate      *float64
	PisAmount       *float64
	CofinsAmount    *float64
	WithholdingType *int
}

PisCofins is the PIS and COFINS of the service. CST is required. WithholdingType is tpRetPisCofins, 0 to 9.

type PisGroup

type PisGroup interface {
	// contains filtered or unexported methods
}

PisGroup is any of the PIS variants.

type PisNt

type PisNt struct {
	CST string `json:"cst"`
}

PisNt is PISNT: PIS not taxed.

func NewPisNt added in v0.4.0

func NewPisNt(cST string) PisNt

NewPisNt fills the fields the schema requires.

type PisOutr

type PisOutr struct {
	CST       string  `json:"cst"`
	VBC       *string `json:"v_bc,omitempty"`
	PPIS      *string `json:"p_pis,omitempty"`
	QBCProd   *string `json:"q_bc_prod,omitempty"`
	VAliqProd *string `json:"v_aliq_prod,omitempty"`
	VPIS      string  `json:"v_pis"`
}

PisOutr is PISOutr: PIS taxed some other way.

func NewPisOutr added in v0.4.0

func NewPisOutr(cST, vPIS string) PisOutr

NewPisOutr fills the fields the schema requires.

type PisQtde added in v0.4.0

type PisQtde struct {
	CST       string `json:"cst"`
	QBCProd   string `json:"q_bc_prod"`
	VAliqProd string `json:"v_aliq_prod"`
	VPIS      string `json:"v_pis"`
}

PisQtde is PISQtde: PIS taxed by quantity.

func NewPisQtde added in v0.4.0

func NewPisQtde(qBCProd, vAliqProd, vPIS string) PisQtde

NewPisQtde fills the fields the schema requires.

type PisSt added in v0.4.0

type PisSt struct {
	VBC          *string `json:"v_bc,omitempty"`
	PPIS         *string `json:"p_pis,omitempty"`
	QBCProd      *string `json:"q_bc_prod,omitempty"`
	VAliqProd    *string `json:"v_aliq_prod,omitempty"`
	VPIS         string  `json:"v_pis"`
	IndSomaPISST *string `json:"ind_soma_pis_st,omitempty"`
}

PisSt is PIS withheld by substitution.

type PresumedCredit

type PresumedCredit struct {
	Code       string  `json:"code"`
	Percentage float64 `json:"percentage"`
	Amount     float64 `json:"amount"`
}

type Product

type Product struct {
	// ItemID names a catalog item of the company (see stackin.Items). With
	// it, Description is optional and the item fills whatever the line
	// leaves out: Unit, Barcode, NCM, CFOP, CEST, Tax, ServiceCode,
	// TaxRetained and, when neither Amount nor UnitPrice is set, the price.
	// A field set here wins. Unit is then not defaulted to UN and
	// TaxRetained is sent only when set (nil), so the item's values are not
	// overridden by the SDK's own defaults.
	ItemID string

	Description       string
	Amount            float64
	UnitPrice         *float64
	Unit              string
	Quantity          float64
	Barcode           *string
	Freight           *float64
	Insurance         *float64
	Discount          *float64
	OtherExpenses     *float64
	UsedMovableAsset  bool
	PurchaseOrder     *string
	PurchaseOrderItem *string

	// NetWeight and GrossWeight are one unit's weight in kg, NF-e only. A
	// pointer so a real 0 can be sent.
	NetWeight   *float64
	GrossWeight *float64

	NCM                        *string
	CFOP                       *string
	CEST                       *string
	NVECodes                   []string
	IndEscala                  *string
	ManufacturerCNPJ           *string
	TaxBenefitCode             *string
	PresumedCredits            []PresumedCredit
	ExTipi                     *string
	ImportContentControlNumber *string
	RecopiNumber               *string
	ExtraGroups                map[string]any
	Tax                        *Tax
	IbsCbs                     *IbsCbs
	Fuel                       *Fuel

	ServiceCode     *string // LC 116/2003 item.subitem, nfse only
	NBS             string
	ServiceDiscount *float64 // unconditional discount, nfse only
	// MunicipalServiceCode is cTribMun, three digits; InternalCode is
	// cIntContrib, up to 20 letters or digits; ConditionalDiscount is
	// vDescCond in BRL, above 0. All nfse only; the API refuses the first on
	// an MEI.
	MunicipalServiceCode string
	InternalCode         string
	ConditionalDiscount  *float64
	// TaxRetained is a pointer so false can be sent on a line with an ItemID
	// (turning off a retention the item has). nil is left to the item, or
	// sent as false when there is no ItemID.
	TaxRetained  *bool   // ISSQN retained by the tomador, nfse only
	Observations *string // nfse only
}

func (Product) ToDict

func (p Product) ToDict() map[string]any

type RealEstate added in v0.27.0

type RealEstate struct {
	CityCode string
	Lease    *RealEstateLease
	Units    []RealEstateUnit
}

RealEstate is the imovel group. CityCode and Lease are read by the homologation layout only; Units are 1 to 99, and the production layout takes exactly one.

type RealEstateBaseAdjustment added in v0.27.0

type RealEstateBaseAdjustment struct {
	Type        string
	Description string
	Amount      float64
}

RealEstateBaseAdjustment is gAjusteBCLocImoveis: Type is "01" to "04" or "99", and Description goes with "99".

type RealEstateLease added in v0.27.0

type RealEstateLease struct {
	CoOwnershipPercent    float64
	TotalAmount           float64
	UnconditionalDiscount *float64
	ConditionalDiscount   *float64
	OriginalDueDate       time.Time
}

RealEstateLease is gLocacao, for a lease, onerous assignment or rental of real estate. CoOwnershipPercent is 100 with a single lessor. The day of OriginalDueDate is the only part sent.

type RealEstateUnit added in v0.27.0

type RealEstateUnit struct {
	PropertyRegistration string
	CIB                  string
	Address              *ServiceAddress
	BaseAdjustments      []RealEstateBaseAdjustment
}

RealEstateUnit is one property: identify it by CIB (8 characters) or by Address, one of the two. BaseAdjustments are 1 to 1000 and read by the homologation layout only.

type References added in v0.27.0

type References struct {
	OrderNumber       string
	OrderItems        []string
	ReferenceDocument string
	TechnicalDocument string
}

References are the infoCompl references: OrderNumber (xPed), OrderItems (gItemPed, up to 99), ReferenceDocument (docRef) and TechnicalDocument (idDocTec). The free text stays in Product.Observations.

type ServiceAddress added in v0.27.0

type ServiceAddress struct {
	ZipCode      string
	Street       string
	Number       string
	Complement   string
	Neighborhood string
}

ServiceAddress is a Brazilian address of a construction, an event or a property: ZipCode (8 digits), Street, Number and Neighborhood are required.

type Substitution added in v0.27.0

type Substitution struct {
	AccessKey  string
	ReasonCode string
	Reason     string
}

Substitution is the subst group: the access key of the authorized NFS-e this one replaces, the ReasonCode (01 to 05 or 99) and, with 99, a Reason of 15 to 255 Latin-1 characters.

type Tax

type Tax struct {
	VTotTrib   *string
	Icms       IcmsGroup
	IcmsUfDest *IcmsUfDest
	Ipi        *Ipi
	Pis        PisGroup
	PisSt      *PisSt
	Cofins     CofinsGroup
	CofinsSt   *CofinsSt
}

Tax is this item's taxes, already computed by the caller.

func (Tax) ToDict

func (t Tax) ToDict() map[string]any

ToDict returns the taxes as a plain map.

Jump to

Keyboard shortcuts

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