lib/api/ops/ops_models/invoice_basic.go

245 lines
5.9 KiB
Go

// Code generated by go-swagger; DO NOT EDIT.
// All Code Copyright(c) 2018-2021 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed
package ops_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// InvoiceBasic invoice basic
//
// swagger:model InvoiceBasic
type InvoiceBasic struct {
// Account Identifier from Source System
AccountID string `json:"AccountID,omitempty"`
// Invoice Amount
Amount float64 `json:"Amount,omitempty"`
// Amount Due
AmountDue float64 `json:"AmountDue,omitempty"`
// business address
BusinessAddress *Address `json:"BusinessAddress,omitempty"`
// OEM Customer Identifier
CustomerID string `json:"CustomerID,omitempty"`
// Invoice Total from source system
EstimatedAmount float64 `json:"EstimatedAmount,omitempty"`
// Business tax from source system
EstimatedBusinessTax float64 `json:"EstimatedBusinessTax,omitempty"`
// Cost of Goods Sold from source system
EstimatedCOGS float64 `json:"EstimatedCOGS,omitempty"`
// Cannabis Tax from source system
EstimatedCannabisTax float64 `json:"EstimatedCannabisTax,omitempty"`
// Cannabis Tax from source system
EstimatedDiscount float64 `json:"EstimatedDiscount,omitempty"`
// Sales Tax from source system
EstimatedSalesTax float64 `json:"EstimatedSalesTax,omitempty"`
// Invoice Subtotal from source system
EstimatedSubtotal float64 `json:"EstimatedSubtotal,omitempty"`
// Taxnexus ID
ID string `json:"ID,omitempty"`
// ID of the Ingest which created this Invoice
IngestID string `json:"IngestID,omitempty"`
// Invoice Date; should be date only or correct time zone if in time notation
InvoiceDate string `json:"InvoiceDate,omitempty"`
// Source System Customer-Facing Invoice Number; ignored in tax calculation
InvoiceNumber string `json:"InvoiceNumber,omitempty"`
// The items associated with this Invoice
Items []*ItemBasic `json:"Items"`
// ID of the Job which created this Invoice
JobID string `json:"JobID,omitempty"`
// Reference the master record that owns this item
ParentFK string `json:"ParentFK,omitempty"`
// Taxnexus Period ID
PeriodID string `json:"PeriodID,omitempty"`
// The Taxnexus Geocode of the Place used for Situs
PlaceGeocode string `json:"PlaceGeocode,omitempty"`
// Source System identifier for this record, if any
Ref string `json:"Ref,omitempty"`
// Sales Regulation Type
SalesRegulation string `json:"SalesRegulation,omitempty"`
// Shipping and Handling fees for this document
ShippingHandling float64 `json:"ShippingHandling,omitempty"`
// Status used by for Billing Balances; ignored in tax calculation
Status string `json:"Status,omitempty"`
// Subtotal of items
Subtotal float64 `json:"Subtotal,omitempty"`
// The Tax Transactions "Source System identifier for this record, if any; copied to invoiceitemid in Tax Transaction result records"
TaxTransactions []*TaxTransaction `json:"TaxTransactions"`
// ID of the Tenant that owns this object
TenantID string `json:"TenantID,omitempty"`
// total
Total *Total `json:"Total,omitempty"`
// Invoice Type
Type string `json:"Type,omitempty"`
}
// Validate validates this invoice basic
func (m *InvoiceBasic) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateBusinessAddress(formats); err != nil {
res = append(res, err)
}
if err := m.validateItems(formats); err != nil {
res = append(res, err)
}
if err := m.validateTaxTransactions(formats); err != nil {
res = append(res, err)
}
if err := m.validateTotal(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *InvoiceBasic) validateBusinessAddress(formats strfmt.Registry) error {
if swag.IsZero(m.BusinessAddress) { // not required
return nil
}
if m.BusinessAddress != nil {
if err := m.BusinessAddress.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("BusinessAddress")
}
return err
}
}
return nil
}
func (m *InvoiceBasic) validateItems(formats strfmt.Registry) error {
if swag.IsZero(m.Items) { // not required
return nil
}
for i := 0; i < len(m.Items); i++ {
if swag.IsZero(m.Items[i]) { // not required
continue
}
if m.Items[i] != nil {
if err := m.Items[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Items" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *InvoiceBasic) validateTaxTransactions(formats strfmt.Registry) error {
if swag.IsZero(m.TaxTransactions) { // not required
return nil
}
for i := 0; i < len(m.TaxTransactions); i++ {
if swag.IsZero(m.TaxTransactions[i]) { // not required
continue
}
if m.TaxTransactions[i] != nil {
if err := m.TaxTransactions[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("TaxTransactions" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *InvoiceBasic) validateTotal(formats strfmt.Registry) error {
if swag.IsZero(m.Total) { // not required
return nil
}
if m.Total != nil {
if err := m.Total.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Total")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *InvoiceBasic) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *InvoiceBasic) UnmarshalBinary(b []byte) error {
var res InvoiceBasic
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}