lib/api/vendor-gw/vendor_gw_models/invoice_basic.go

182 lines
4.8 KiB
Go

// Code generated by go-swagger; DO NOT EDIT.
// All Code Copyright(c) 2018-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed
package vendor_gw_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; copied to the Tax Transaction result records
AccountID string `json:"AccountID,omitempty"`
// Account Name from source system (not used in tax calculations)
AccountName string `json:"AccountName,omitempty"`
// Invoice Amount; ignored in tax calculation
Amount float64 `json:"Amount,omitempty"`
// Amount Due; ignored in tax calculations
AmountDue float64 `json:"AmountDue,omitempty"`
// business address
BusinessAddress *Address `json:"BusinessAddress,omitempty"`
// The Customer ID linked to this invoice from the source system
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"`
// An amount the Invoice is discounted in source Invoice
EstimatedDiscount float64 `json:"EstimatedDiscount,omitempty"`
// Sales Tax from source system
EstimatedSalesTax float64 `json:"EstimatedSalesTax,omitempty"`
// Subtotal from source system
EstimatedSubtotal float64 `json:"EstimatedSubtotal,omitempty"`
// Taxnexus Record Id Only; not used in POST
ID string `json:"ID,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"`
// Taxnexus Job ID
JobID string `json:"JobID,omitempty"`
// UUID Reference to a master record that owns this item
ParentFK string `json:"ParentFK,omitempty"`
// Source System identifier for this record, if any; copied to invoiceid in Tax Transaction result records
Ref string `json:"Ref,omitempty"`
// Sales Regulation Type; must be one of the listed values
SalesRegulation string `json:"SalesRegulation,omitempty"`
// The total amount of shipping and delivery charges on this invoice from the source system
ShippingHandling float64 `json:"ShippingHandling,omitempty"`
// Status used by for Billing Balances; ignored in tax calculation
Status string `json:"Status,omitempty"`
// Subtotal (not used in tax calculation)
Subtotal float64 `json:"Subtotal,omitempty"`
// Invoice Type (not used in tax calculation)
Type string `json:"Type,omitempty"`
// Unique Taxnexus Id assigned during ingest
UUID string `json:"UUID,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 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
}
// 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
}