2021-01-08 17:40:28 +00:00
|
|
|
// Code generated by go-swagger; DO NOT EDIT.
|
|
|
|
|
2021-01-19 16:58:40 +00:00
|
|
|
// All Code Copyright(c) 2018-2021 by Taxnexus, Inc.
|
2021-01-08 17:40:28 +00:00
|
|
|
// 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 (
|
2021-02-09 16:56:57 +00:00
|
|
|
"context"
|
2021-01-08 17:40:28 +00:00
|
|
|
"strconv"
|
|
|
|
|
|
|
|
"github.com/go-openapi/errors"
|
|
|
|
"github.com/go-openapi/strfmt"
|
|
|
|
"github.com/go-openapi/swag"
|
|
|
|
)
|
|
|
|
|
|
|
|
// PurchaseOrder purchase order
|
|
|
|
//
|
|
|
|
// swagger:model PurchaseOrder
|
|
|
|
type PurchaseOrder struct {
|
|
|
|
|
|
|
|
// Account ID
|
|
|
|
AccountID string `json:"AccountID,omitempty"`
|
|
|
|
|
|
|
|
// PO Amount
|
|
|
|
Amount float64 `json:"Amount,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"`
|
|
|
|
|
|
|
|
// 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"`
|
|
|
|
|
|
|
|
// CC used for payment to vendor
|
|
|
|
CreditCardID string `json:"CreditCardID,omitempty"`
|
|
|
|
|
|
|
|
// Customer ID
|
|
|
|
CustomerID string `json:"CustomerID,omitempty"`
|
|
|
|
|
|
|
|
// Date Expires
|
|
|
|
DateExpires string `json:"DateExpires,omitempty"`
|
|
|
|
|
|
|
|
// Date Promised
|
|
|
|
DatePromised string `json:"DatePromised,omitempty"`
|
|
|
|
|
|
|
|
// Date Requested
|
|
|
|
DateRequested string `json:"DateRequested,omitempty"`
|
|
|
|
|
|
|
|
// Description
|
|
|
|
Description string `json:"Description,omitempty"`
|
|
|
|
|
|
|
|
// Discount Percentage
|
|
|
|
Discount float64 `json:"Discount,omitempty"`
|
|
|
|
|
|
|
|
// Discount Amount
|
|
|
|
DiscountAmount float64 `json:"DiscountAmount,omitempty"`
|
|
|
|
|
|
|
|
// Due Date
|
|
|
|
DueDate string `json:"DueDate,omitempty"`
|
|
|
|
|
|
|
|
// End User Contact ID
|
|
|
|
EndUserID string `json:"EndUserID,omitempty"`
|
|
|
|
|
|
|
|
// Invoice Total from source system
|
|
|
|
EstimatedAmount float64 `json:"EstimatedAmount,omitempty"`
|
|
|
|
|
|
|
|
// Business tax from source system
|
|
|
|
EstimatedBusinessTax float64 `json:"EstimatedBusinessTax,omitempty"`
|
|
|
|
|
|
|
|
// Cannabis Tax from source system
|
|
|
|
EstimatedCannabisTax float64 `json:"EstimatedCannabisTax,omitempty"`
|
|
|
|
|
|
|
|
// Discount 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"`
|
|
|
|
|
|
|
|
// Expiration Date
|
|
|
|
ExpirationDate string `json:"ExpirationDate,omitempty"`
|
|
|
|
|
|
|
|
// Taxnexus Record Id
|
|
|
|
ID string `json:"ID,omitempty"`
|
|
|
|
|
|
|
|
// The ID of the Ingest generated by this PO
|
|
|
|
IngestID string `json:"IngestID,omitempty"`
|
|
|
|
|
|
|
|
// items
|
|
|
|
Items []*PurchaseOrderItem `json:"Items"`
|
|
|
|
|
|
|
|
// ID of the Job which created this PO
|
|
|
|
JobID string `json:"JobID,omitempty"`
|
|
|
|
|
|
|
|
// Last Modified By User ID
|
|
|
|
LastModifiedByID string `json:"LastModifiedByID,omitempty"`
|
|
|
|
|
|
|
|
// Last Modified Date
|
|
|
|
LastModifiedDate string `json:"LastModifiedDate,omitempty"`
|
|
|
|
|
|
|
|
// Opportunity Name
|
|
|
|
OpportunityID string `json:"OpportunityID,omitempty"`
|
|
|
|
|
|
|
|
// Order Number
|
|
|
|
OrderID string `json:"OrderID,omitempty"`
|
|
|
|
|
|
|
|
// Date
|
|
|
|
PODate string `json:"PODate,omitempty"`
|
|
|
|
|
|
|
|
// Number
|
|
|
|
PONumber string `json:"PONumber,omitempty"`
|
|
|
|
|
|
|
|
// The record identifier from the source system
|
|
|
|
ParentFK string `json:"ParentFK,omitempty"`
|
|
|
|
|
|
|
|
// Payment Terms
|
|
|
|
PaymentTerms string `json:"PaymentTerms,omitempty"`
|
|
|
|
|
|
|
|
// Taxnexus Period ID
|
|
|
|
PeriodID string `json:"PeriodID,omitempty"`
|
|
|
|
|
|
|
|
// Place GeoCode
|
|
|
|
PlaceGeoCode string `json:"PlaceGeoCode,omitempty"`
|
|
|
|
|
|
|
|
// Posted to external system?
|
|
|
|
Posted bool `json:"Posted,omitempty"`
|
|
|
|
|
|
|
|
// Quote Name
|
|
|
|
QuoteID string `json:"QuoteID,omitempty"`
|
|
|
|
|
|
|
|
// Source System identifier for this record, if any
|
|
|
|
Ref string `json:"Ref,omitempty"`
|
|
|
|
|
|
|
|
// Sales Regulation Type (Medicinal or Recreational)
|
|
|
|
SalesRegulation string `json:"SalesRegulation,omitempty"`
|
|
|
|
|
|
|
|
// Sales Tax
|
|
|
|
SalesTax float64 `json:"SalesTax,omitempty"`
|
|
|
|
|
|
|
|
// Service Term
|
|
|
|
ServiceTerm string `json:"ServiceTerm,omitempty"`
|
|
|
|
|
|
|
|
// Ship Date
|
|
|
|
ShipDate string `json:"ShipDate,omitempty"`
|
|
|
|
|
|
|
|
// shipping address
|
|
|
|
ShippingAddress *Address `json:"ShippingAddress,omitempty"`
|
|
|
|
|
|
|
|
// Shipping Contact ID
|
|
|
|
ShippingContactID string `json:"ShippingContactID,omitempty"`
|
|
|
|
|
|
|
|
// Shipping & Handling
|
|
|
|
ShippingHandling float64 `json:"ShippingHandling,omitempty"`
|
|
|
|
|
|
|
|
// Shipping Special Instructions
|
|
|
|
ShippingSpecialInstructions string `json:"ShippingSpecialInstructions,omitempty"`
|
|
|
|
|
|
|
|
// Status
|
|
|
|
Status string `json:"Status,omitempty"`
|
|
|
|
|
|
|
|
// Subtotal
|
|
|
|
Subtotal float64 `json:"Subtotal,omitempty"`
|
|
|
|
|
|
|
|
// The taxes associated with this Purchase Order
|
|
|
|
TaxTransactions []*TaxTransaction `json:"TaxTransactions"`
|
|
|
|
|
|
|
|
// Telecom Tax
|
|
|
|
TelecomTax float64 `json:"TelecomTax,omitempty"`
|
|
|
|
|
|
|
|
// ID of the Template used to render this object
|
|
|
|
TemplateID string `json:"TemplateID,omitempty"`
|
|
|
|
|
|
|
|
// ID of the Tenant that owns this object
|
|
|
|
TenantID string `json:"TenantID,omitempty"`
|
|
|
|
|
|
|
|
// total
|
|
|
|
Total *Total `json:"Total,omitempty"`
|
|
|
|
|
|
|
|
// The ID of the totaling struct for this object
|
|
|
|
TotalID string `json:"TotalID,omitempty"`
|
|
|
|
|
|
|
|
// Type
|
|
|
|
Type string `json:"Type,omitempty"`
|
|
|
|
|
|
|
|
// Vendor Account ID
|
|
|
|
VendorID string `json:"VendorID,omitempty"`
|
|
|
|
|
|
|
|
// Vendor Quote Number
|
|
|
|
VendorQuoteNumber string `json:"VendorQuoteNumber,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// Validate validates this purchase order
|
|
|
|
func (m *PurchaseOrder) 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 *PurchaseOrder) 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 *PurchaseOrder) 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 *PurchaseOrder) 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 *PurchaseOrder) 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 *PurchaseOrder) 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 *PurchaseOrder) 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
|
|
|
|
}
|
|
|
|
|
2021-02-09 16:56:57 +00:00
|
|
|
// ContextValidate validate this purchase order based on the context it is used
|
|
|
|
func (m *PurchaseOrder) 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 *PurchaseOrder) 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 *PurchaseOrder) 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 *PurchaseOrder) 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 *PurchaseOrder) 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 *PurchaseOrder) 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 *PurchaseOrder) 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
|
|
|
|
}
|
|
|
|
|
2021-01-08 17:40:28 +00:00
|
|
|
// MarshalBinary interface implementation
|
|
|
|
func (m *PurchaseOrder) MarshalBinary() ([]byte, error) {
|
|
|
|
if m == nil {
|
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
return swag.WriteJSON(m)
|
|
|
|
}
|
|
|
|
|
|
|
|
// UnmarshalBinary interface implementation
|
|
|
|
func (m *PurchaseOrder) UnmarshalBinary(b []byte) error {
|
|
|
|
var res PurchaseOrder
|
|
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
*m = res
|
|
|
|
return nil
|
|
|
|
}
|