// 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" ) // Invoice invoice // // swagger:model Invoice type Invoice struct { // Account ID AccountID string `json:"AccountID,omitempty"` // Advance? Advance bool `json:"Advance,omitempty"` // Invoice Amount Amount float64 `json:"Amount,omitempty"` // Amount Adjustment AmountAdjustment float64 `json:"AmountAdjustment,omitempty"` // Amount Due AmountDue float64 `json:"AmountDue,omitempty"` // Amount Paid AmountPaid float64 `json:"AmountPaid,omitempty"` // Audit Trail Message AuditMessage string `json:"AuditMessage,omitempty"` // billing address BillingAddress *Address `json:"BillingAddress,omitempty"` // Billing Contact ID BillingContactID string `json:"BillingContactID,omitempty"` // Billing Run BillingRunID string `json:"BillingRunID,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"` // Contract ContractID string `json:"ContractID,omitempty"` // The ID of the Coordinate used to rate this item CoordinateID string `json:"CoordinateID,omitempty"` // Created By User ID CreatedByID string `json:"CreatedByID,omitempty"` // Created Date CreatedDate string `json:"CreatedDate,omitempty"` // Customer ID CustomerID string `json:"CustomerID,omitempty"` // Date Issued DateIssued string `json:"DateIssued,omitempty"` // Days Due DaysDue int64 `json:"DaysDue,omitempty"` // Deposit Amount DepositAmount float64 `json:"DepositAmount,omitempty"` // Description Description string `json:"Description,omitempty"` // Discount Discount float64 `json:"Discount,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"` // ID of the Ingest which created this Invoice IngestID string `json:"IngestID,omitempty"` // Invoice Date InvoiceDate string `json:"InvoiceDate,omitempty"` // Invoice Number InvoiceNumber string `json:"InvoiceNumber,omitempty"` // Is International? IsInternational bool `json:"IsInternational,omitempty"` // Is Valid? IsValid bool `json:"IsValid,omitempty"` // Issued Account Balance IssuedAccountBalance float64 `json:"IssuedAccountBalance,omitempty"` // Issued Amount Due IssuedAmountDue float64 `json:"IssuedAmountDue,omitempty"` // Issued By IssuedByID string `json:"IssuedByID,omitempty"` // The items associated with this Invoice Items []*InvoiceItem `json:"Items"` // ID of the Job which created this Invoice JobID string `json:"JobID,omitempty"` // Last Modified By User ID LastModifiedByID string `json:"LastModifiedByID,omitempty"` // Last Modified Date LastModifiedDate string `json:"LastModifiedDate,omitempty"` // Minimum Payment Due MinimumPaymentDue float64 `json:"MinimumPaymentDue,omitempty"` // Monthly Amount MonthlyAmount float64 `json:"MonthlyAmount,omitempty"` // Opportunity OpportunityID string `json:"OpportunityID,omitempty"` // Order OrderID string `json:"OrderID,omitempty"` // Overdue0 OverDue0 float64 `json:"OverDue0,omitempty"` // Overdue 120 Days Amount OverDue120 float64 `json:"OverDue120,omitempty"` // Overdue 30 Days Amount OverDue30 float64 `json:"OverDue30,omitempty"` // Overdue 45 Days Amount OverDue45 float64 `json:"OverDue45,omitempty"` // Overdue 60 Days Amount OverDue60 float64 `json:"OverDue60,omitempty"` // Overdue 90 Days Amount OverDue90 float64 `json:"OverDue90,omitempty"` // Reference the master record that owns this item ParentFK string `json:"ParentFK,omitempty"` // Partner Account PartnerAccountID string `json:"PartnerAccountID,omitempty"` // Payment Due PaymentDue string `json:"PaymentDue,omitempty"` // Payment Method PaymentMethod string `json:"PaymentMethod,omitempty"` // Payment Method PaymentMethodID string `json:"PaymentMethodID,omitempty"` // Payment Terms PaymentTerms string `json:"PaymentTerms,omitempty"` // Period PeriodID string `json:"PeriodID,omitempty"` // The Taxnexus Geocode of the Place used for Situs PlaceGeocode string `json:"PlaceGeocode,omitempty"` // Posted to external system? Posted bool `json:"Posted,omitempty"` // Prior Account Balance PriorAccountBalance float64 `json:"PriorAccountBalance,omitempty"` // Prior Adjustments PriorAdjustments float64 `json:"PriorAdjustments,omitempty"` // Prior Invoice Amount PriorInvoiceAmount float64 `json:"PriorInvoiceAmount,omitempty"` // Prior Invoice Date PriorInvoiceDate string `json:"PriorInvoiceDate,omitempty"` // Prior Invoice PriorInvoiceID string `json:"PriorInvoiceID,omitempty"` // Prior Payment Amount PriorPaymentAmount float64 `json:"PriorPaymentAmount,omitempty"` // Prior Payment Date PriorPaymentDate string `json:"PriorPaymentDate,omitempty"` // Prior Payment PriorPaymentID string `json:"PriorPaymentID,omitempty"` // Prior Payment Memo PriorPaymentMemo string `json:"PriorPaymentMemo,omitempty"` // Prorated? Prorated bool `json:"Prorated,omitempty"` // Prorated Days ProtratedDays float64 `json:"ProtratedDays,omitempty"` // Purchase Amount PurchaseAmount float64 `json:"PurchaseAmount,omitempty"` // Quote QuoteID string `json:"QuoteID,omitempty"` // The ID of the Rating Engine that rated this invoice RatingEngineID string `json:"RatingEngineID,omitempty"` // Source System identifier for this record, if any Ref string `json:"Ref,omitempty"` // Reference Reference string `json:"Reference,omitempty"` // Sales Regulation Type (Medicinal or Recreational) SalesRegulation string `json:"SalesRegulation,omitempty"` // Sales Tax SalesTax float64 `json:"SalesTax,omitempty"` // Scheduled Payment Date ScheduledPaymentDate string `json:"ScheduledPaymentDate,omitempty"` // Service Term ServiceTerm string `json:"ServiceTerm,omitempty"` // shipping address ShippingAddress *Address `json:"ShippingAddress,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 Invoice 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"` // Type Type string `json:"Type,omitempty"` } // Validate validates this invoice func (m *Invoice) 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 *Invoice) 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 *Invoice) 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 *Invoice) 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 *Invoice) 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 *Invoice) 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 *Invoice) 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 invoice based on the context it is used func (m *Invoice) 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 *Invoice) 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 *Invoice) 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 *Invoice) 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 *Invoice) 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 *Invoice) 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 *Invoice) 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 *Invoice) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *Invoice) UnmarshalBinary(b []byte) error { var res Invoice if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil }