554 lines
13 KiB
Go
554 lines
13 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 (
|
|
"context"
|
|
"strconv"
|
|
|
|
"github.com/go-openapi/errors"
|
|
"github.com/go-openapi/strfmt"
|
|
"github.com/go-openapi/swag"
|
|
)
|
|
|
|
// Order order
|
|
//
|
|
// swagger:model Order
|
|
type Order struct {
|
|
|
|
// Account ID
|
|
AccountID string `json:"AccountID,omitempty"`
|
|
|
|
// Activated By ID
|
|
ActivatedByID string `json:"ActivatedByID,omitempty"`
|
|
|
|
// Activated Date
|
|
ActivatedDate string `json:"ActivatedDate,omitempty"`
|
|
|
|
// Order Amount
|
|
Amount float64 `json:"Amount,omitempty"`
|
|
|
|
// Order Amount Due
|
|
AmountDue float64 `json:"AmountDue,omitempty"`
|
|
|
|
// billing address
|
|
BillingAddress *Address `json:"BillingAddress,omitempty"`
|
|
|
|
// Billing Contact ID
|
|
BillingContactID string `json:"BillingContactID,omitempty"`
|
|
|
|
// business address
|
|
BusinessAddress *Address `json:"BusinessAddress,omitempty"`
|
|
|
|
// The amount of Deferred Tax incurred with this invoice
|
|
BusinessTax float64 `json:"BusinessTax,omitempty"`
|
|
|
|
// Cannabis Tax
|
|
CannabisTax float64 `json:"CannabisTax,omitempty"`
|
|
|
|
// Company Authorized By
|
|
CompanyAuthorizedByID string `json:"CompanyAuthorizedByID,omitempty"`
|
|
|
|
// Company Authorized Date
|
|
CompanyAuthorizedDate string `json:"CompanyAuthorizedDate,omitempty"`
|
|
|
|
// Completion Status
|
|
Completion string `json:"Completion,omitempty"`
|
|
|
|
// Contract End Date
|
|
ContractEndDate string `json:"ContractEndDate,omitempty"`
|
|
|
|
// Contract Number
|
|
ContractID string `json:"ContractID,omitempty"`
|
|
|
|
// The ID of the Tax Nexus Coordinate record
|
|
CoordinateID string `json:"CoordinateID,omitempty"`
|
|
|
|
// Created By User ID
|
|
CreatedByID string `json:"CreatedByID,omitempty"`
|
|
|
|
// Created Date
|
|
CreatedDate string `json:"CreatedDate,omitempty"`
|
|
|
|
// Customer Authorized By
|
|
CustomerAuthorizedBy string `json:"CustomerAuthorizedBy,omitempty"`
|
|
|
|
// Customer Authorized Date
|
|
CustomerAuthorizedDate string `json:"CustomerAuthorizedDate,omitempty"`
|
|
|
|
// Partner customer ID, if any
|
|
CustomerID string `json:"CustomerID,omitempty"`
|
|
|
|
// Description
|
|
Description string `json:"Description,omitempty"`
|
|
|
|
// Discount Percentage
|
|
Discount float64 `json:"Discount,omitempty"`
|
|
|
|
// Discount Amount
|
|
DiscountAmount float64 `json:"DiscountAmount,omitempty"`
|
|
|
|
// Order Start Date
|
|
EffectiveDate string `json:"EffectiveDate,omitempty"`
|
|
|
|
// Order End Date
|
|
EndDate string `json:"EndDate,omitempty"`
|
|
|
|
// End User Contact ID
|
|
EndUserID string `json:"EndUserID,omitempty"`
|
|
|
|
// Invoice Total from source system
|
|
EstimatedAmount float64 `json:"EstimatedAmount,omitempty"`
|
|
|
|
// Invoice Total from source system
|
|
EstimatedBusinessTax float64 `json:"EstimatedBusinessTax,omitempty"`
|
|
|
|
// Invoice Total 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 Record Id
|
|
ID string `json:"ID,omitempty"`
|
|
|
|
// The ID of the Ingest generated by this order
|
|
IngestID string `json:"IngestID,omitempty"`
|
|
|
|
// Installation Date
|
|
InstallationDate string `json:"InstallationDate,omitempty"`
|
|
|
|
// Invoice ID
|
|
InvoiceID string `json:"InvoiceID,omitempty"`
|
|
|
|
// Reduction Order
|
|
IsReductionOrder bool `json:"IsReductionOrder,omitempty"`
|
|
|
|
// The Order Items
|
|
Items []*OrderItem `json:"Items"`
|
|
|
|
// The ID of the Job that generated this order, if any
|
|
JobID string `json:"JobID,omitempty"`
|
|
|
|
// Last Modified By User ID
|
|
LastModifiedByID string `json:"LastModifiedByID,omitempty"`
|
|
|
|
// Last Modified Date
|
|
LastModifiedDate string `json:"LastModifiedDate,omitempty"`
|
|
|
|
// Monthly Amount
|
|
MonthlyAmount float64 `json:"MonthlyAmount,omitempty"`
|
|
|
|
// Open Order?
|
|
Open bool `json:"Open,omitempty"`
|
|
|
|
// Opportunity
|
|
OpportunityID string `json:"OpportunityID,omitempty"`
|
|
|
|
// Order Number
|
|
OrderNumber string `json:"OrderNumber,omitempty"`
|
|
|
|
// Order Reference Number
|
|
OrderReferenceNumber string `json:"OrderReferenceNumber,omitempty"`
|
|
|
|
// Original Order
|
|
OriginalOrderID string `json:"OriginalOrderID,omitempty"`
|
|
|
|
// Order Owner
|
|
OwnerID string `json:"OwnerID,omitempty"`
|
|
|
|
// PO Date
|
|
PODate string `json:"PODate,omitempty"`
|
|
|
|
// Reference the master record that owns this item
|
|
ParentFK string `json:"ParentFK,omitempty"`
|
|
|
|
// Payment Method ID
|
|
PaymentMethodID string `json:"PaymentMethodID,omitempty"`
|
|
|
|
// Payment Terms
|
|
PaymentTerms string `json:"PaymentTerms,omitempty"`
|
|
|
|
// The ID of the Period in which this Order was made
|
|
PeriodID string `json:"PeriodID,omitempty"`
|
|
|
|
// Place GeoCode
|
|
PlaceGeoCode string `json:"PlaceGeoCode,omitempty"`
|
|
|
|
// Posted to external system?
|
|
Posted bool `json:"Posted,omitempty"`
|
|
|
|
// Provisioning Status
|
|
ProvisioningStatus string `json:"ProvisioningStatus,omitempty"`
|
|
|
|
// Purchase Amount
|
|
PurchaseAmount float64 `json:"PurchaseAmount,omitempty"`
|
|
|
|
// PO ID
|
|
PurchaseOrderID string `json:"PurchaseOrderID,omitempty"`
|
|
|
|
// Quote
|
|
QuoteID string `json:"QuoteID,omitempty"`
|
|
|
|
// The ID of the Rating Engine that rated this invoice
|
|
RatingEngineID string `json:"RatingEngineID,omitempty"`
|
|
|
|
// Order Record Type
|
|
RecordTypeID string `json:"RecordTypeID,omitempty"`
|
|
|
|
// Source System identifier for this record, if any
|
|
Ref string `json:"Ref,omitempty"`
|
|
|
|
// Sales Regulation Type
|
|
SalesRegulation string `json:"SalesRegulation,omitempty"`
|
|
|
|
// Sales Tax
|
|
SalesTax float64 `json:"SalesTax,omitempty"`
|
|
|
|
// Service Term
|
|
ServiceTerm string `json:"ServiceTerm,omitempty"`
|
|
|
|
// shipping address
|
|
ShippingAddress *Address `json:"ShippingAddress,omitempty"`
|
|
|
|
// Shipping Contact ID
|
|
ShippingContactID string `json:"ShippingContactID,omitempty"`
|
|
|
|
// Shipping & Handling
|
|
ShippingHandling float64 `json:"ShippingHandling,omitempty"`
|
|
|
|
// Status
|
|
Status string `json:"Status,omitempty"`
|
|
|
|
// Subtotal
|
|
Subtotal float64 `json:"Subtotal,omitempty"`
|
|
|
|
// The taxes associated with this Order
|
|
TaxTransactions []*TaxTransaction `json:"TaxTransactions"`
|
|
|
|
// Telecom Tax
|
|
TelecomTax float64 `json:"TelecomTax,omitempty"`
|
|
|
|
// Template
|
|
TemplateID string `json:"TemplateID,omitempty"`
|
|
|
|
// ID of the Tenant that owns this object
|
|
TenantID string `json:"TenantID,omitempty"`
|
|
|
|
// total
|
|
Total *Total `json:"Total,omitempty"`
|
|
|
|
// Order Type
|
|
Type string `json:"Type,omitempty"`
|
|
}
|
|
|
|
// Validate validates this order
|
|
func (m *Order) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.validateBillingAddress(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
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.validateShippingAddress(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 *Order) validateBillingAddress(formats strfmt.Registry) error {
|
|
if swag.IsZero(m.BillingAddress) { // not required
|
|
return nil
|
|
}
|
|
|
|
if m.BillingAddress != nil {
|
|
if err := m.BillingAddress.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("BillingAddress")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *Order) 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 *Order) 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 *Order) validateShippingAddress(formats strfmt.Registry) error {
|
|
if swag.IsZero(m.ShippingAddress) { // not required
|
|
return nil
|
|
}
|
|
|
|
if m.ShippingAddress != nil {
|
|
if err := m.ShippingAddress.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("ShippingAddress")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *Order) 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 *Order) 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
|
|
}
|
|
|
|
// ContextValidate validate this order based on the context it is used
|
|
func (m *Order) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.contextValidateBillingAddress(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.contextValidateBusinessAddress(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.contextValidateItems(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.contextValidateShippingAddress(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.contextValidateTaxTransactions(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.contextValidateTotal(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *Order) contextValidateBillingAddress(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
if m.BillingAddress != nil {
|
|
if err := m.BillingAddress.ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("BillingAddress")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *Order) contextValidateBusinessAddress(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
if m.BusinessAddress != nil {
|
|
if err := m.BusinessAddress.ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("BusinessAddress")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *Order) contextValidateItems(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
for i := 0; i < len(m.Items); i++ {
|
|
|
|
if m.Items[i] != nil {
|
|
if err := m.Items[i].ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("Items" + "." + strconv.Itoa(i))
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *Order) contextValidateShippingAddress(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
if m.ShippingAddress != nil {
|
|
if err := m.ShippingAddress.ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("ShippingAddress")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *Order) contextValidateTaxTransactions(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
for i := 0; i < len(m.TaxTransactions); i++ {
|
|
|
|
if m.TaxTransactions[i] != nil {
|
|
if err := m.TaxTransactions[i].ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("TaxTransactions" + "." + strconv.Itoa(i))
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *Order) contextValidateTotal(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
if m.Total != nil {
|
|
if err := m.Total.ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("Total")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *Order) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *Order) UnmarshalBinary(b []byte) error {
|
|
var res Order
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|