marshal methods

v0.1.7
Vernon Keenan 2021-01-13 22:36:35 -08:00
parent 021bac7bf4
commit 061af6b092
165 changed files with 11560 additions and 224 deletions

View File

@ -34,6 +34,12 @@ type Coordinate struct {
// Taxnexus County ID
CountyID string `json:"CountyID,omitempty"`
// The Taxnexus ID of the user who created this record
CreatedByID string `json:"CreatedByID,omitempty"`
// The creation date of this database record
CreatedDate string `json:"CreatedDate,omitempty"`
// Situs Focus for tax determination
Focus string `json:"Focus,omitempty"`
@ -46,6 +52,12 @@ type Coordinate struct {
// Situs Incorporated District?
IsDistrict bool `json:"IsDistrict,omitempty"`
// The Taxnexus ID of the user last modified this record
LastModifiedByID string `json:"LastModifiedByID,omitempty"`
// The last modification date of this database record
LastModifiedDate string `json:"LastModifiedDate,omitempty"`
// Latitude of coordinate
Latitude float64 `json:"Latitude,omitempty"`
@ -62,6 +74,9 @@ type Coordinate struct {
// Geocoder Neighborhood
Neighborhood string `json:"Neighborhood,omitempty"`
// The Taxnexus ID of the user who owns this record
OwnerID string `json:"OwnerID,omitempty"`
// Geocoder Place
Place string `json:"Place,omitempty"`

View File

@ -34,6 +34,12 @@ type Country struct {
// Contact
ContactID string `json:"ContactID,omitempty"`
// The Taxnexus ID of the user who created this record
CreatedByID string `json:"CreatedByID,omitempty"`
// The creation date of this database record
CreatedDate string `json:"CreatedDate,omitempty"`
// Enrollment Status
EnrollmentStatus string `json:"EnrollmentStatus,omitempty"`
@ -43,6 +49,12 @@ type Country struct {
// Interest
Interest float64 `json:"Interest,omitempty"`
// The Taxnexus ID of the user last modified this record
LastModifiedByID string `json:"LastModifiedByID,omitempty"`
// The last modification date of this database record
LastModifiedDate string `json:"LastModifiedDate,omitempty"`
// Latitude of the center of this geographic entity
Latitude float64 `json:"Latitude,omitempty"`
@ -52,6 +64,9 @@ type Country struct {
// Country Name
Name string `json:"Name,omitempty"`
// The Taxnexus ID of the user who owns this record
OwnerID string `json:"OwnerID,omitempty"`
// Penalty
Penalty float64 `json:"Penalty,omitempty"`

View File

@ -37,6 +37,12 @@ type County struct {
// Country Taxnexus ID
CountryID string `json:"CountryID,omitempty"`
// The Taxnexus ID of the user who created this record
CreatedByID string `json:"CreatedByID,omitempty"`
// The creation date of this database record
CreatedDate string `json:"CreatedDate,omitempty"`
// Enrollment Status
EnrollmentStatus string `json:"EnrollmentStatus,omitempty"`
@ -67,6 +73,12 @@ type County struct {
// Land Area
LandArea int64 `json:"LandArea,omitempty"`
// The Taxnexus ID of the user last modified this record
LastModifiedByID string `json:"LastModifiedByID,omitempty"`
// The last modification date of this database record
LastModifiedDate string `json:"LastModifiedDate,omitempty"`
// Latitude of the center of this geographic entity
Latitude float64 `json:"Latitude,omitempty"`
@ -79,6 +91,9 @@ type County struct {
// County Name
Name string `json:"Name,omitempty"`
// The Taxnexus ID of the user who owns this record
OwnerID string `json:"OwnerID,omitempty"`
// Penalty
Penalty float64 `json:"Penalty,omitempty"`

View File

@ -43,6 +43,12 @@ type Place struct {
// County
CountyID string `json:"CountyID,omitempty"`
// The Taxnexus ID of the user who created this record
CreatedByID string `json:"CreatedByID,omitempty"`
// The creation date of this database record
CreatedDate string `json:"CreatedDate,omitempty"`
// Enrollment Status
EnrollmentStatus string `json:"EnrollmentStatus,omitempty"`
@ -73,6 +79,12 @@ type Place struct {
// Land Area
LandArea int64 `json:"LandArea,omitempty"`
// The Taxnexus ID of the user last modified this record
LastModifiedByID string `json:"LastModifiedByID,omitempty"`
// The last modification date of this database record
LastModifiedDate string `json:"LastModifiedDate,omitempty"`
// Latitude of the center of this geographic entity
Latitude float64 `json:"Latitude,omitempty"`
@ -85,6 +97,9 @@ type Place struct {
// Place Name
Name string `json:"Name,omitempty"`
// The Taxnexus ID of the user who owns this record
OwnerID string `json:"OwnerID,omitempty"`
// Penalty
Penalty float64 `json:"Penalty,omitempty"`
@ -118,6 +133,9 @@ type Place struct {
// sales tax rate
SalesTaxRate *TaxRate `json:"SalesTaxRate,omitempty"`
// State Code
StateCode string `json:"StateCode,omitempty"`
// State
StateID string `json:"StateID,omitempty"`

View File

@ -37,6 +37,12 @@ type State struct {
// Country
CountryID string `json:"CountryID,omitempty"`
// The Taxnexus ID of the user who created this record
CreatedByID string `json:"CreatedByID,omitempty"`
// The creation date of this database record
CreatedDate string `json:"CreatedDate,omitempty"`
// Division
Division string `json:"Division,omitempty"`
@ -61,6 +67,12 @@ type State struct {
// Land Area
LandArea int64 `json:"LandArea,omitempty"`
// The Taxnexus ID of the user last modified this record
LastModifiedByID string `json:"LastModifiedByID,omitempty"`
// The last modification date of this database record
LastModifiedDate string `json:"LastModifiedDate,omitempty"`
// Latitude of the center of this geographic entity
Latitude float64 `json:"Latitude,omitempty"`
@ -70,6 +82,9 @@ type State struct {
// State Name
Name string `json:"Name,omitempty"`
// The Taxnexus ID of the user who owns this record
OwnerID string `json:"OwnerID,omitempty"`
// Penalty
Penalty float64 `json:"Penalty,omitempty"`

View File

@ -31,6 +31,9 @@ type TaxInstance struct {
// The creation date of this database record
CreatedDate string `json:"CreatedDate,omitempty"`
// Taxnexus Record ID
ID string `json:"ID,omitempty"`
// last modified by ID
LastModifiedByID string `json:"LastModifiedByID,omitempty"`

View File

@ -25,12 +25,18 @@ type TaxType struct {
// The Accounting Rule Code for this Tax Type
AccountingRuleCode string `json:"AccountingRuleCode,omitempty"`
// Is this tax type currently active? (not used for tax ratings)
Active bool `json:"Active,omitempty"`
// Agency Type
AgencyType string `json:"AgencyType,omitempty"`
// Collection Agent Id
AgentID string `json:"AgentID,omitempty"`
// Total tax amount
Amount float64 `json:"Amount,omitempty"`
// Category
Category string `json:"Category,omitempty"`
@ -115,6 +121,9 @@ type TaxType struct {
// Tax Type Name (unique)
Name string `json:"Name,omitempty"`
// User ID of the owner of this TaxType
OwnerID string `json:"OwnerID,omitempty"`
// Is this tax allowed to be passed-through to retail customers?
PassThrough bool `json:"PassThrough,omitempty"`
@ -130,6 +139,15 @@ type TaxType struct {
// Tax Authority Website Reference
Reference string `json:"Reference,omitempty"`
// Revenue Base for this Tax Type
RevenueBase float64 `json:"RevenueBase,omitempty"`
// Revenue Net
RevenueNet float64 `json:"RevenueNet,omitempty"`
// Revenue Not Taxable
RevenueNotTaxable float64 `json:"RevenueNotTaxable,omitempty"`
// Salesregulation Code for this TaxType
SalesRegulation string `json:"SalesRegulation,omitempty"`
@ -145,6 +163,9 @@ type TaxType struct {
// Rendering Template Id
TemplateID string `json:"TemplateID,omitempty"`
// Unit Base
UnitBase float64 `json:"UnitBase,omitempty"`
// Units
Units string `json:"Units,omitempty"`
}

View File

@ -154,9 +154,9 @@ func (a *Client) PostOrders(params *PostOrdersParams, authInfo runtime.ClientAut
}
/*
PutOrders creates new orders
PutOrders updates orders
Create new Orders
Update orders
*/
func (a *Client) PutOrders(params *PutOrdersParams, authInfo runtime.ClientAuthInfoWriter) (*PutOrdersOK, error) {
// TODO: Validate the params before sending

View File

@ -80,7 +80,7 @@ func (a *Client) DeleteQuote(params *DeleteQuoteParams, authInfo runtime.ClientA
}
/*
GetQuotes gets a list of invoices
GetQuotes gets a list of quotes
Return a list of available quotes
*/

View File

@ -28,18 +28,12 @@ type CashReceipt struct {
// Applied Amount
AppliedAmount float64 `json:"AppliedAmount,omitempty"`
// Attempt Number
AttemptNumber float64 `json:"AttemptNumber,omitempty"`
// Audit Trail Message
AuditMessage string `json:"AuditMessage,omitempty"`
// Autopay?
AutoPay bool `json:"AutoPay,omitempty"`
// Billing Contact
BillingContactID string `json:"BillingContactID,omitempty"`
// The ID of the Billing Run that generated this Cash Receipt
BillingRunID string `json:"BillingRunID,omitempty"`
// Journal Date
CashReceiptDate string `json:"CashReceiptDate,omitempty"`
@ -67,9 +61,12 @@ type CashReceipt struct {
// GatewayTxn?
GatewayTransaction bool `json:"GatewayTransaction,omitempty"`
// Salesforce Record Id
// Taxnexus Record Id
ID string `json:"ID,omitempty"`
// Invoice paid by this cash receipt
InvoiceID string `json:"InvoiceID,omitempty"`
// Is Valid?
IsValid bool `json:"IsValid,omitempty"`
@ -82,36 +79,21 @@ type CashReceipt struct {
// Partner Account
PartnerAccountID string `json:"PartnerAccountID,omitempty"`
// Payment Method
// ID of the Payment Method used for this Cash Receipt
PaymentMethodID string `json:"PaymentMethodID,omitempty"`
// Payment Number
PaymentNumber string `json:"PaymentNumber,omitempty"`
// Pending?
Pending bool `json:"Pending,omitempty"`
// Period
PeriodID string `json:"PeriodID,omitempty"`
// Posted to external system?
Posted bool `json:"Posted,omitempty"`
// Processed
Processed bool `json:"Processed,omitempty"`
// Processing
Processing bool `json:"Processing,omitempty"`
// Record Type
RecordTypeID string `json:"RecordTypeID,omitempty"`
RecordType string `json:"RecordType,omitempty"`
// Reference
Ref string `json:"Ref,omitempty"`
// Reference Number
ReferenceNumber string `json:"ReferenceNumber,omitempty"`
// Rejected?
Rejected bool `json:"Rejected,omitempty"`
@ -121,6 +103,9 @@ type CashReceipt struct {
// Payment Status
Status string `json:"Status,omitempty"`
// ID of the Template to be used for rendering this cashreceipt
TemplateID string `json:"TemplateID,omitempty"`
// ID of the Tenant that owns this object
TenantID string `json:"TenantID,omitempty"`

View File

@ -22,12 +22,24 @@ type Charge struct {
// Account
AccountID string `json:"AccountID,omitempty"`
// The Accounting Ruleset Code
AccountingRulesetCode string `json:"AccountingRulesetCode,omitempty"`
// Amount
Amount float64 `json:"Amount,omitempty"`
// Billing Contact ID
BillingContactID string `json:"BillingContactID,omitempty"`
// The Email Address to send this charge notification
BillingEmail string `json:"BillingEmail,omitempty"`
// The ID of the BillingRun that generated this Charge
BillingRunID string `json:"BillingRunID,omitempty"`
// The Contract Hourly Rate
ContractHourlyRate float64 `json:"ContractHourlyRate,omitempty"`
// Contract
ContractID string `json:"ContractID,omitempty"`
@ -43,10 +55,7 @@ type Charge struct {
// Email Message
EmailMessage string `json:"EmailMessage,omitempty"`
// External Message
ExternalMessage string `json:"ExternalMessage,omitempty"`
// Salesforce Record Id
// Taxnexus Record Id
ID string `json:"ID,omitempty"`
// Journal Date
@ -76,9 +85,18 @@ type Charge struct {
// Quantity
Quantity float64 `json:"Quantity,omitempty"`
// external reference, if any
Ref string `json:"Ref,omitempty"`
// The 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"`
// Charge Type
Type string `json:"Type,omitempty"`
// Unit Price
UnitPrice float64 `json:"UnitPrice,omitempty"`
}

View File

@ -64,12 +64,12 @@ type Product struct {
// isGeneric
IsGeneric bool `json:"IsGeneric,omitempty"`
// Last Modified Date
LastModifiedByDate string `json:"LastModifiedByDate,omitempty"`
// Last modified by ID
LastModifiedByID string `json:"LastModifiedByID,omitempty"`
// Last Modified Date
LastModifiedDate string `json:"LastModifiedDate,omitempty"`
// MRC Interval
MRCInterval int64 `json:"MRCInterval,omitempty"`

View File

@ -61,6 +61,9 @@ type PurchaseOrderItem struct {
// Product ID
ProductID string `json:"ProductID,omitempty"`
// Product Name
ProductName string `json:"ProductName,omitempty"`
// Purchase Order
PurchaseOrderID string `json:"PurchaseOrderID,omitempty"`

211
app/account-helpers.go Normal file
View File

@ -0,0 +1,211 @@
package app
import (
"database/sql"
"time"
"code.tnxs.net/taxnexus/lib/api/crm/crm_models"
"github.com/google/uuid"
)
// UnMarshalAccount decodes swagger to a first class object
func UnMarshalAccount(s *crm_models.Account) *Account { //nolint:funlen // too bad
if s.ID == "" {
s.ID = uuid.New().String()
}
createdDate, e0 := time.Parse(dateTimeFormat, s.CreatedDate)
lastModfiedDate, e1 := time.Parse(dateTimeFormat, s.LastModifiedDate)
clientEndDate, e2 := time.Parse(dateTimeFormat, s.ClientEndDate)
clientStartDate, e3 := time.Parse(dateTimeFormat, s.ClientStartDate)
return &Account{
AccountNumber: s.AccountNumber,
AccountSource: s.AccountSource,
Active: s.Active,
AdministrativeLevel: s.AdministrativeLevel,
Amount: s.Amount,
AmountInvoiced: s.AmountInvoiced,
AmountPaid: s.AmountPaid,
AnnualRevenue: s.AnnualRevenue,
Balance: s.Balance,
BillingAddress: UnMarshalCrmAddress(s.BillingAddress),
BillingContactID: s.BillingContactID,
BillingPreference: s.BillingPreference,
BusinessAddress: UnMarshalCrmAddress(s.BusinessAddress),
CannabisCustomer: s.CannabisCustomer,
ChannelProgramLevelName: s.ChannelProgramLevelName,
ChannelProgramName: s.ChannelProgramName,
CompanyID: s.CompanyID,
CoordinateID: s.CoordinateID,
CreatedByID: s.CreatedByID,
CustomerID: s.CustomerID,
CustomerPriority: s.CustomerPriority,
DandBCompanyID: s.DandBCompanyID,
DBA: s.DBA,
DefaultAddress: UnMarshalCrmAddress(s.DefaultAddress),
DefaultBackendID: s.DefaultBackendID,
DefaultDeliveryContactID: s.DefaultDeliveryContactID,
DefaultEndUserID: s.DefaultEndUserID,
Description: s.Description,
DunsNumber: s.DUNSNumber,
EIN: s.EIN,
Email: s.Email,
EnrollmentStatus: s.EnrollmentStatus,
Fax: s.Fax,
ID: s.ID,
Industry: s.Industry,
IsCustomerPortal: s.IsCustomerPortal,
IsPartner: s.IsPartner,
ISPCustomer: s.ISPCustomer,
Jigsaw: s.JigSaw,
LastModifiedByID: s.LastModifiedByID,
MSPCustomer: s.MSPCustomer,
NaicsCode: s.NAICSCode,
NaicsDesc: s.NAICSDesc,
Name: s.Name,
NumberOfEmployees: s.NumberOfEmployees,
NumberOfLocations: s.NumberOfLocations,
OpenCharges: s.OpenCharges,
OrderContactID: s.OrderContactID,
OrderEmail: s.OrderEmail,
OwnerID: s.OwnerID,
Ownership: s.Ownership,
ParentFK: s.ParentFK,
ParentID: s.ParentID,
Phone: s.Phone,
PlaceID: s.PlaceID,
PreparerID: s.PreparerID,
Rating: s.Rating,
RatingEngineID: s.RatingEngineID,
Ref: s.Ref,
RevenueBase: s.RevenueBase,
RevenueNet: s.RevenueNet,
RevenueNotTaxable: s.RevenueNotTaxable,
ShippingAddress: UnMarshalCrmAddress(s.ShippingAddress),
ShippingCensusTract: s.ShippingCensusTract,
ShippingContactID: s.ShippingCensusTract,
ShippingCounty: s.ShippingCounty,
SIC: s.SIC,
SicDesc: s.SICDesc,
Site: s.Site,
Status: s.Status,
TaxExemption: s.TaxExemption,
TaxOnTax: s.TaxOnTax,
TelecomCustomer: s.TelecomCustomer,
TenantID: s.TenantID,
TickerSymbol: s.TickerSymbol,
TradeStyle: s.TradeStyle,
Type: s.Type,
UnappliedPayments: s.UnappliedPayments,
UnitBase: s.UnitBase,
UpsellOpportunity: s.UpsellOpportunity,
Website: s.Website,
WHMCSClientID: s.WHMCSClientID,
XeroContactID: s.XeroContactID,
YearStarted: s.YearStarted,
ClientEndDate: sql.NullTime{
Time: clientEndDate, Valid: e2 == nil,
},
ClientStartDate: sql.NullTime{
Time: clientStartDate, Valid: e3 == nil,
},
LastModifiedDate: sql.NullTime{
Time: lastModfiedDate, Valid: e1 == nil,
},
CreatedDate: sql.NullTime{
Time: createdDate, Valid: e0 == nil,
},
}
}
// MarshalToSwagger encodes a first class object to swagger
func (obj *Account) MarshalToSwagger() *crm_models.Account {
return &crm_models.Account{
ID: obj.ID,
AccountNumber: obj.AccountNumber,
AccountSource: obj.AccountSource,
Active: obj.Active,
AdministrativeLevel: obj.AdministrativeLevel,
Amount: obj.Amount,
AmountInvoiced: obj.AmountInvoiced,
AmountPaid: obj.AmountPaid,
AnnualRevenue: obj.AnnualRevenue,
Balance: obj.Balance,
BillingAddress: obj.BillingAddress.MarshalToCrm(),
BillingContactID: obj.BillingContactID,
BillingPreference: obj.BillingPreference,
BusinessAddress: obj.BusinessAddress.MarshalToCrm(),
CannabisCustomer: obj.CannabisCustomer,
ChannelProgramLevelName: obj.ChannelProgramLevelName,
ChannelProgramName: obj.ChannelProgramName,
ClientEndDate: obj.ClientEndDate.Time.Format(dateTimeFormat),
ClientStartDate: obj.ClientStartDate.Time.Format(dateTimeFormat),
CompanyID: obj.CompanyID,
CoordinateID: obj.CoordinateID,
CreatedByID: obj.CreatedByID,
CreatedDate: obj.CreatedDate.Time.Format(dateTimeFormat),
CustomerID: obj.CompanyID,
CustomerPriority: obj.CustomerPriority,
DandBCompanyID: obj.DandBCompanyID,
DBA: obj.DBA,
DefaultAddress: obj.DefaultAddress.MarshalToCrm(),
DefaultBackendID: obj.DefaultBackendID,
DefaultDeliveryContactID: obj.DefaultDeliveryContactID,
DefaultEndUserID: obj.DefaultEndUserID,
Description: obj.Description,
DUNSNumber: obj.DunsNumber,
EIN: obj.EIN,
Email: obj.Email,
EnrollmentStatus: obj.EnrollmentStatus,
Fax: obj.Fax,
Industry: obj.Industry,
IsCustomerPortal: obj.IsCustomerPortal,
IsPartner: obj.IsPartner,
ISPCustomer: obj.ISPCustomer,
JigSaw: obj.Jigsaw,
LastModifiedByID: obj.LastModifiedByID,
LastModifiedDate: obj.LastModifiedDate.Time.Format(dateTimeFormat),
MSPCustomer: obj.MSPCustomer,
NAICSCode: obj.NaicsCode,
NAICSDesc: obj.NaicsDesc,
Name: obj.Name,
NumberOfEmployees: obj.NumberOfEmployees,
NumberOfLocations: obj.NumberOfLocations,
OpenCharges: obj.OpenCharges,
OrderContactID: obj.OrderContactID,
OrderEmail: obj.OrderEmail,
OwnerID: obj.OwnerID,
Ownership: obj.Ownership,
ParentFK: obj.ParentFK,
ParentID: obj.ParentID,
Phone: obj.Phone,
PlaceID: obj.PlaceID,
PreparerID: obj.PreparerID,
Rating: obj.Rating,
RatingEngineID: obj.RatingEngineID,
Ref: obj.Ref,
RevenueBase: obj.RevenueBase,
RevenueNet: obj.RevenueNet,
RevenueNotTaxable: obj.RevenueNotTaxable,
ShippingAddress: obj.ShippingAddress.MarshalToCrm(),
ShippingCensusTract: obj.ShippingCensusTract,
ShippingConactID: obj.ShippingContactID,
SIC: obj.SIC,
SICDesc: obj.SicDesc,
Site: obj.Site,
Status: obj.Status,
TaxExemption: obj.TaxExemption,
TaxOnTax: obj.TaxOnTax,
TelecomCustomer: obj.TelecomCustomer,
TenantID: obj.TenantID,
TickerSymbol: obj.TickerSymbol,
TradeStyle: obj.TradeStyle,
Type: obj.Type,
UnappliedPayments: obj.UnappliedPayments,
UnitBase: obj.UnitBase,
UpsellOpportunity: obj.UpsellOpportunity,
Website: obj.Website,
WHMCSClientID: obj.WHMCSClientID,
XeroContactID: obj.XeroContactID,
YearStarted: obj.YearStarted,
}
}

View File

@ -9,7 +9,7 @@ import (
// NewAccountActivity is an activity identifier
const NewAccountActivity = "NEW_ACCOUNT_ACTIVITY"
// AccountChannelWrapper wraps the object with the security principal
// AccountChannelWrapper wraps the object with workflow params
type AccountChannelWrapper struct {
Obj crm_models.Account
Principal User
@ -29,10 +29,10 @@ type Account struct {
AmountPaid float64
AnnualRevenue float64
Balance float64
BillingAddress Address
BillingAddress *Address
BillingContactID string
BillingPreference string
BusinessAddress Address
BusinessAddress *Address
CannabisCustomer bool
ChannelProgramLevelName string
ChannelProgramName string
@ -46,7 +46,7 @@ type Account struct {
CustomerPriority string
DandBCompanyID string
DBA string
DefaultAddress Address
DefaultAddress *Address
DefaultBackendID string
DefaultDeliveryContactID string
DefaultEndUserID string
@ -85,7 +85,7 @@ type Account struct {
RevenueBase float64
RevenueNet float64
RevenueNotTaxable float64
ShippingAddress Address
ShippingAddress *Address
ShippingCensusTract string
ShippingContactID string
ShippingCounty string

View File

@ -0,0 +1,69 @@
package app
import (
"database/sql"
"time"
"code.tnxs.net/taxnexus/lib/api/ledger/ledger_models"
"github.com/google/uuid"
)
func UnMarshalAccountingRule(s *ledger_models.AccountingRule) *AccountingRule {
if s.ID == "" {
s.ID = uuid.New().String()
}
createdDate, e0 := time.Parse(dateTimeFormat, s.CreatedDate)
lastModfiedDate, e1 := time.Parse(dateTimeFormat, s.LastModifiedDate)
return &AccountingRule{
ID: s.ID,
AccountID: s.AcountID,
Code: s.Code,
COGSaccountID: s.COGSAccountID,
COGSaccountName: s.COGSAccountName,
CreatedByID: s.CreatedByID,
CreditAccountID: s.CreditAccountID,
CreditAccountName: s.CreditAccountName,
DebitAccountID: s.DebitAccountID,
DebitAccountName: s.DebitAccountName,
Description: s.Description,
InventoryAccountID: s.InventoryAccountID,
InventoryAccountName: s.InventoryAccountName,
IsDeferred: s.IsDeferred,
LastModifiedByID: s.LastModifiedByID,
ParentFK: s.ParentFK,
Proportion: s.Proportion,
TenantID: s.TenantID,
CreatedDate: sql.NullTime{
Time: createdDate,
Valid: e0 == nil,
},
LastModifiedDate: sql.NullTime{
Time: lastModfiedDate,
Valid: e1 == nil,
},
}
}
func (obj *AccountingRule) marshalToSwagger() *ledger_models.AccountingRule {
return &ledger_models.AccountingRule{
ID: obj.ID,
AcountID: obj.AccountID,
Code: obj.Code,
COGSAccountID: obj.COGSaccountID,
COGSAccountName: obj.COGSaccountName,
CreatedByID: obj.CreatedByID,
CreatedDate: obj.CreatedDate.Time.Format(dateTimeFormat),
CreditAccountID: obj.CreditAccountID,
CreditAccountName: obj.CreditAccountName,
DebitAccountID: obj.DebitAccountID,
DebitAccountName: obj.DebitAccountName,
Description: obj.Description,
InventoryAccountID: obj.InventoryAccountID,
InventoryAccountName: obj.InventoryAccountName,
IsDeferred: obj.IsDeferred,
LastModifiedByID: obj.LastModifiedByID,
LastModifiedDate: obj.LastModifiedDate.Time.Format(dateTimeFormat),
ParentFK: obj.ParentFK,
Proportion: obj.Proportion,
TenantID: obj.TenantID,
}
}

View File

@ -6,7 +6,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/ledger/ledger_models"
)
// AccountingRuleChannelWrapper wraps the object with the security principal
// AccountingRuleChannelWrapper wraps the object with workflow params
type AccountingRuleChannelWrapper struct {
Obj ledger_models.AccountingRule
Principal User

View File

@ -0,0 +1,62 @@
package app
import (
"database/sql"
"time"
"code.tnxs.net/taxnexus/lib/api/ledger/ledger_models"
"github.com/google/uuid"
)
func UnMarshalAccountingRuleset(s *ledger_models.AccountingRuleset) *AccountingRuleset {
if s.ID == "" {
s.ID = uuid.New().String()
}
createdDate, e0 := time.Parse(dateTimeFormat, s.CreatedDate)
lastModfiedDate, e1 := time.Parse(dateTimeFormat, s.LastModifiedDate)
theItems := []*AccountingRulesetItem{}
for _, itm := range s.Items {
theItems = append(theItems, &AccountingRulesetItem{
ID: itm.ID,
AccountingRuleCode: itm.AccountingRuleCode,
})
}
return &AccountingRuleset{
ID: s.ID,
AccountID: s.AccountID,
Code: s.Code,
Description: s.Description,
Items: theItems,
CreatedDate: sql.NullTime{
Time: createdDate,
Valid: e0 == nil,
},
LastModifiedDate: sql.NullTime{
Time: lastModfiedDate,
Valid: e1 == nil,
},
}
}
func (obj *AccountingRuleset) marshalToSwagger() *ledger_models.AccountingRuleset {
theItems := []*ledger_models.AccountingRulesetItem{}
for _, itm := range obj.Items {
theItems = append(theItems,
&ledger_models.AccountingRulesetItem{
ID: itm.ID,
AccountingRuleCode: itm.AccountingRuleCode,
TenantID: itm.TenantID,
})
}
return &ledger_models.AccountingRuleset{
ID: obj.ID,
AccountID: obj.AccountID,
Code: obj.Code,
CreatedByID: obj.CreatedByID,
CreatedDate: obj.CreatedDate.Time.Format(dateTimeFormat),
Description: obj.Description,
Items: theItems,
LastModifiedByID: obj.LastModifiedByID,
LastModifiedDate: obj.LastModifiedDate.Time.Format(dateTimeFormat),
TenantID: obj.TenantID,
}
}

View File

@ -6,7 +6,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/ledger/ledger_models"
)
// AccountingRulesetChannelWrapper wraps the object with the security principal
// AccountingRulesetChannelWrapper wraps the object with workflow params
type AccountingRulesetChannelWrapper struct {
Obj ledger_models.AccountingRuleset
Principal User

View File

@ -6,7 +6,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/ledger/ledger_models"
)
// AccountingRulesetItemChannelWrapper wraps the object with the security principal
// AccountingRulesetItemChannelWrapper wraps the object with workflow params
type AccountingRulesetItemChannelWrapper struct {
Obj ledger_models.AccountingRulesetItem
Principal User

View File

@ -1,5 +1,10 @@
package app
import (
"code.tnxs.net/taxnexus/lib/api/crm/crm_models"
"code.tnxs.net/taxnexus/lib/api/ops/ops_models"
)
// Address address struct
type Address struct {
City string
@ -10,3 +15,67 @@ type Address struct {
StateCode string
Street string
}
// MarshalToCrm converts a first class object to swagger
func (obj *Address) MarshalToCrm() *crm_models.Address {
if obj == nil {
return nil
}
return &crm_models.Address{
City: obj.City,
Country: obj.Country,
CountryCode: obj.CountryCode,
PostalCode: obj.PostalCode,
State: obj.State,
StateCode: obj.StateCode,
Street: obj.Street,
}
}
// MarshalToOps converts a first class object to swagger
func (obj *Address) MarshalToOps() *ops_models.Address {
if obj == nil {
return nil
}
return &ops_models.Address{
City: obj.City,
Country: obj.Country,
CountryCode: obj.CountryCode,
PostalCode: obj.PostalCode,
State: obj.State,
StateCode: obj.StateCode,
Street: obj.Street,
}
}
// UnMarshalCrmAddress converts a first class object to swagger
func UnMarshalCrmAddress(s *crm_models.Address) *Address {
if s == nil {
return nil
}
return &Address{
City: s.City,
Country: s.Country,
CountryCode: s.CountryCode,
PostalCode: s.PostalCode,
State: s.State,
StateCode: s.StateCode,
Street: s.Street,
}
}
// UnMarshalOpsAddress converts a first class object to swagger
func UnMarshalOpsAddress(s *ops_models.Address) *Address {
if s == nil {
return nil
}
return &Address{
City: s.City,
Country: s.Country,
CountryCode: s.CountryCode,
PostalCode: s.PostalCode,
State: s.State,
StateCode: s.StateCode,
Street: s.Street,
}
}

52
app/applog-helpers.go Normal file
View File

@ -0,0 +1,52 @@
package app
import (
"database/sql"
"time"
"code.tnxs.net/taxnexus/lib/api/workflow/workflow_models"
"github.com/google/uuid"
)
func unMarshalAppLog(s *workflow_models.AppLog) *AppLog {
if s.ID == "" {
s.ID = uuid.New().String()
}
createdDate, e0 := time.Parse(dateTimeFormat, s.CreatedDate)
sourceTimestamp, e1 := time.Parse(dateTimeFormat, s.SourceTimestamp)
return &AppLog{
AccountID: s.AccountID,
CompanyID: s.CompanyID,
CreatedByID: s.CreatedByID,
ID: s.ID,
Message: s.Message,
ObjectID: s.ObjectID,
ObjectType: s.ObjectType,
Severity: s.Severity,
Source: s.Source,
CreatedDate: sql.NullTime{
Time: createdDate,
Valid: e0 == nil,
},
SourceTimestamp: sql.NullTime{
Time: sourceTimestamp,
Valid: e1 == nil,
},
}
}
func (obj *AppLog) marshalToSwagger() *workflow_models.AppLog {
return &workflow_models.AppLog{
ID: obj.ID,
AccountID: obj.AccountID,
CompanyID: obj.CompanyID,
CreatedByID: obj.CreatedByID,
CreatedDate: obj.CreatedDate.Time.Format(dateTimeFormat),
Message: obj.Message,
ObjectType: obj.ObjectType,
ObjectID: obj.ObjectID,
Severity: obj.Severity,
Source: obj.Source,
SourceTimestamp: obj.SourceTimestamp.Time.Format(dateTimeFormat),
}
}

18
app/applog.go Normal file
View File

@ -0,0 +1,18 @@
package app
import "database/sql"
// AppLog is a first class object type
type AppLog struct {
ID string
AccountID string
CompanyID string
CreatedByID string
CreatedDate sql.NullTime
Message string
ObjectType string
ObjectID string
Severity string
Source string
SourceTimestamp sql.NullTime
}

107
app/authority-helpers.go Normal file
View File

@ -0,0 +1,107 @@
package app
import (
"database/sql"
"time"
"code.tnxs.net/taxnexus/lib/api/regs/regs_models"
"github.com/google/uuid"
)
func UnMarshalSwaggerAuthority(s *regs_models.Authority) *Authority {
if s.ID == "" {
s.ID = uuid.New().String()
}
authorityDate, e4 := time.Parse(dateFormat, s.Date)
createdDate, e0 := time.Parse(dateTimeFormat, s.CreatedDate)
dateApproved, e2 := time.Parse(dateFormat, s.DateApproved)
if e2 != nil {
dateApproved, e2 = time.Parse(dateFormatAlt, s.DateApproved)
}
lastModfiedDate, e1 := time.Parse(dateTimeFormat, s.LastModifiedDate)
transferDate, e3 := time.Parse(dateFormat, s.TransferDate)
if e3 != nil {
transferDate, e3 = time.Parse(dateFormatAlt, s.TransferDate)
}
return &Authority{
ID: s.ID,
AccountID: s.AccountID,
AddressLine1: s.AddressLine1,
AddressLine2: s.AddressLine2,
BTN: s.BTN,
City: s.City,
ContactID: s.ContactID,
Country: s.Country,
CreatedByID: s.CreatedByID,
LastModifiedByID: s.LastModifiedByID,
LosingCarrier: s.LosingCarrier,
Name: s.Name,
NameLine1: s.NameLine1,
NameLine2: s.NameLine2,
OpportunityID: s.OpportunityID,
OrderID: s.OrderID,
ParentFK: s.ParentFK,
PostalCode: s.PostalCode,
QuoteID: s.QuoteID,
Ref: s.Ref,
State: s.State,
Status: s.Status,
TemplateID: s.TemplateID,
TenantID: s.TenantID,
Type: s.Type,
Date: sql.NullTime{
Time: authorityDate,
Valid: e4 == nil,
},
CreatedDate: sql.NullTime{
Time: createdDate,
Valid: e0 == nil,
},
LastModifiedDate: sql.NullTime{
Time: lastModfiedDate,
Valid: e1 == nil,
},
DateApproved: sql.NullTime{
Time: dateApproved,
Valid: e2 == nil,
},
TransferDate: sql.NullTime{
Time: transferDate,
Valid: e3 == nil,
},
}
}
func (obj *Authority) MarshalToSwagger() *regs_models.Authority {
return &regs_models.Authority{
ID: obj.ID,
AccountID: obj.AccountID,
AddressLine1: obj.AddressLine1,
AddressLine2: obj.AddressLine2,
BTN: obj.BTN,
City: obj.City,
ContactID: obj.ContactID,
Country: obj.Country,
CreatedByID: obj.CreatedByID,
CreatedDate: obj.CreatedDate.Time.Format(dateTimeFormat),
Date: obj.Date.Time.Format(dateFormat),
DateApproved: obj.DateApproved.Time.Format(dateFormat),
LastModifiedByID: obj.LastModifiedByID,
LastModifiedDate: obj.LastModifiedDate.Time.Format(dateTimeFormat),
LosingCarrier: obj.LosingCarrier,
Name: obj.Name,
NameLine1: obj.NameLine1,
NameLine2: obj.NameLine2,
OpportunityID: obj.OpportunityID,
OrderID: obj.OrderID,
ParentFK: obj.ParentFK,
PostalCode: obj.PostalCode,
QuoteID: obj.QuoteID,
Ref: obj.Ref,
State: obj.State,
Status: obj.Status,
TransferDate: obj.TransferDate.Time.Format(dateFormat),
TenantID: obj.TenantID,
TemplateID: obj.TemplateID,
Type: obj.Type,
}
}

37
app/authority.go Normal file
View File

@ -0,0 +1,37 @@
package app
import "database/sql"
// Authority is a first class object type
type Authority struct {
ID string
AccountID string
AddressLine1 string
AddressLine2 string
BTN string
City string
ContactID string
Country string
CreatedByID string
CreatedDate sql.NullTime
Date sql.NullTime
DateApproved sql.NullTime
LastModifiedByID string
LastModifiedDate sql.NullTime
LosingCarrier string
Name string
NameLine1 string
NameLine2 string
OpportunityID string
OrderID string
ParentFK string
PostalCode string
QuoteID string
Ref string
State string
Status string
TemplateID string
TransferDate sql.NullTime
Type string
TenantID string
}

106
app/backend-helpers.go Normal file
View File

@ -0,0 +1,106 @@
package app
import (
"database/sql"
"time"
"code.tnxs.net/taxnexus/lib/api/regs/regs_models"
"github.com/google/uuid"
)
// UnMarshalBackend decodes swagger to a first class object
func UnMarshalBackend(s *regs_models.Backend) *Backend {
if s.ID == "" {
s.ID = uuid.New().String()
}
createdDate, e0 := time.Parse(dateTimeFormat, s.CreatedDate)
lastModfiedDate, e1 := time.Parse(dateTimeFormat, s.LastModifiedDate)
return &Backend{
ID: s.ID,
AccountID: s.AccountID,
Active: s.Active,
APIKey: s.APIKey,
ApplicationName: s.ApplicationName,
AuthType: s.AuthType,
BackendName: s.BackendName,
BaseURL: s.BaseURL,
CallbackURL: s.CallbackURL,
ClientID: s.ClientID,
ClientSecret: s.ClientSecret,
CompanyID: s.CompanyID,
CreatedByID: s.CreatedByID,
Description: s.Description,
LastModifiedByID: s.LastModifiedByID,
LoginURL: s.LoginURL,
ManagementPassword: s.ManagementPassword,
ManagementURL: s.ManagementURL,
ManagementUsername: s.ManagementUsername,
MetrcLicense: s.MetrcLicense,
MetrcState: s.MetrcState,
OwnerID: s.OwnerID,
Password: s.Password,
ProjectID: s.ProjectID,
ProviderCredentials: s.ProviderCredentials,
Realm: s.Realm,
Ref: s.Ref,
ResellerBackendID: s.ResellerBackendID,
SecurityToken: s.SecurityToken,
Timeout: s.Timeout,
TokenURI: s.TokenURI,
Type: s.Type,
Username: s.Username,
Vendor: s.Vendor,
TenantID: s.TenantID,
CreatedDate: sql.NullTime{
Time: createdDate,
Valid: e0 == nil,
},
LastModifiedDate: sql.NullTime{
Time: lastModfiedDate,
Valid: e1 == nil,
},
}
}
// MarshalToSwagger encodes a first class object to swagger
func (obj *Backend) MarshalToSwagger() *regs_models.Backend {
return &regs_models.Backend{
ID: obj.ID,
AccountID: obj.AccountID,
Active: obj.Active,
APIKey: obj.APIKey,
ApplicationName: obj.ApplicationName,
AuthType: obj.AuthType,
BackendName: obj.BackendName,
BaseURL: obj.BaseURL,
CallbackURL: obj.CallbackURL,
ClientID: obj.ClientID,
ClientSecret: obj.ClientSecret,
CompanyID: obj.CompanyID,
CreatedByID: obj.CreatedByID,
CreatedDate: obj.CreatedDate.Time.Format(dateTimeFormat),
Description: obj.Description,
LastModifiedByID: obj.LastModifiedByID,
LastModifiedDate: obj.LastModifiedDate.Time.Format(dateTimeFormat),
LoginURL: obj.LoginURL,
ManagementPassword: obj.ManagementPassword,
ManagementURL: obj.ManagementURL,
ManagementUsername: obj.ManagementUsername,
MetrcLicense: obj.MetrcLicense,
MetrcState: obj.MetrcState,
OwnerID: obj.OwnerID,
Password: obj.Password,
ProjectID: obj.ProjectID,
ProviderCredentials: obj.ProviderCredentials,
Realm: obj.Realm,
Ref: obj.Ref,
ResellerBackendID: obj.ResellerBackendID,
SecurityToken: obj.SecurityToken,
TenantID: obj.TenantID,
Timeout: obj.Timeout,
TokenURI: obj.TokenURI,
Type: obj.Type,
Username: obj.Username,
Vendor: obj.Vendor,
}
}

View File

@ -6,7 +6,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/regs/regs_models"
)
// BackendChannelWrapper wraps the object with the security principal
// BackendChannelWrapper wraps the object with workflow params
type BackendChannelWrapper struct {
Obj regs_models.Backend
Principal User

104
app/cashreceipt-helpers.go Normal file
View File

@ -0,0 +1,104 @@
package app
import (
"database/sql"
"time"
"code.tnxs.net/taxnexus/lib/api/ops/ops_models"
"github.com/google/uuid"
)
// UnMarshalCashReceipt decodes swagger to a first class object
func UnMarshalCashReceipt(s *ops_models.CashReceipt) *CashReceipt {
if s.ID == "" {
s.ID = uuid.New().String()
}
createdDate, e0 := time.Parse(dateTimeFormat, s.CreatedDate)
lastModfiedDate, e1 := time.Parse(dateTimeFormat, s.LastModifiedDate)
cashReceiptDate, e2 := time.Parse(dateTimeFormat, s.CashReceiptDate)
return &CashReceipt{
ID: s.ID,
AccountID: s.AccountID,
Amount: s.Amount,
AppliedAmount: s.AppliedAmount,
BillingContactID: s.BillingContactID,
CashReceiptNumber: s.CashReceiptNumber,
CreatedByID: s.CreatedByID,
Description: s.Description,
Gateway: s.Gateway,
GatewayKey: s.GatewayKey,
GatewayMessage: s.GatewayMessage,
GatewayTransaction: s.GatewayTransaction,
IsValid: s.IsValid,
LastModifiedByID: s.LastModifiedByID,
PartnerAccountID: s.PartnerAccountID,
PaymentMethodID: s.PaymentMethodID,
PeriodID: s.PeriodID,
Posted: s.Posted,
RecordType: s.RecordType,
Ref: s.Ref,
Rejected: s.Rejected,
Source: s.Source,
Status: s.Status,
TenantID: s.TenantID,
TemplateID: s.TemplateID,
Type: s.Type,
UnappliedAmount: s.UnappliedAmount,
ValidPayment: s.ValidPayment,
XeroID: s.XeroID,
BillingRunID: s.BillingRunID,
InvoiceID: s.InvoiceID,
CreatedDate: sql.NullTime{
Time: createdDate,
Valid: e0 == nil,
},
LastModifiedDate: sql.NullTime{
Time: lastModfiedDate,
Valid: e1 == nil,
},
CashReceiptDate: sql.NullTime{
Time: cashReceiptDate,
Valid: e2 == nil,
},
}
}
// MarshalToSwagger encodes a first class object to swagger
func (obj *CashReceipt) MarshalToSwagger() *ops_models.CashReceipt {
return &ops_models.CashReceipt{
ID: obj.ID,
AccountID: obj.AccountID,
Amount: obj.Amount,
AppliedAmount: obj.AppliedAmount,
BillingContactID: obj.BillingContactID,
BillingRunID: obj.BillingRunID,
CashReceiptDate: obj.CashReceiptDate.Time.Format(dateTimeFormat),
CashReceiptNumber: obj.CashReceiptNumber,
CreatedByID: obj.CreatedByID,
CreatedDate: obj.CreatedDate.Time.Format(dateTimeFormat),
Description: obj.Description,
Gateway: obj.Gateway,
GatewayKey: obj.GatewayKey,
GatewayMessage: obj.GatewayMessage,
GatewayTransaction: obj.GatewayTransaction,
InvoiceID: obj.InvoiceID,
IsValid: obj.IsValid,
LastModifiedByID: obj.LastModifiedByID,
LastModifiedDate: obj.LastModifiedDate.Time.Format(dateTimeFormat),
PartnerAccountID: obj.PartnerAccountID,
PaymentMethodID: obj.PaymentMethodID,
PeriodID: obj.PeriodID,
Posted: obj.Posted,
RecordType: obj.RecordType,
Ref: obj.Ref,
Rejected: obj.Rejected,
Source: obj.Source,
Status: obj.Status,
TemplateID: obj.TemplateID,
TenantID: obj.TenantID,
Type: obj.Type,
UnappliedAmount: obj.UnappliedAmount,
ValidPayment: obj.ValidPayment,
XeroID: obj.XeroID,
}
}

View File

@ -6,7 +6,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/ops/ops_models"
)
// CashReceiptChannelWrapper wraps the object with the security principal
// CashReceiptChannelWrapper wraps the object with workflow params
type CashReceiptChannelWrapper struct {
Obj ops_models.CashReceipt
Principal User

88
app/charge-helpers.go Normal file
View File

@ -0,0 +1,88 @@
package app
import (
"database/sql"
"time"
"code.tnxs.net/taxnexus/lib/api/ops/ops_models"
"github.com/google/uuid"
)
// UnMarshalCharge decodes swagger to a first class object
func UnMarshalCharge(s *ops_models.Charge) *Charge {
if s.ID == "" {
s.ID = uuid.New().String()
}
createdDate, e0 := time.Parse(dateTimeFormat, s.CreatedDate)
lastModfiedDate, e1 := time.Parse(dateTimeFormat, s.LastModifiedDate)
journalDate, e2 := time.Parse(dateTimeFormat, s.JournalDate)
return &Charge{
ID: s.ID,
AccountID: s.AccountID,
Amount: s.Amount,
BillingContactID: s.BillingContactID,
ContractID: s.ContractID,
CreatedByID: s.CreatedByID,
Description: s.Description,
EmailMessage: s.EmailMessage,
LastModifiedByID: s.LastModifiedByID,
PartnerAccountID: s.PartnerAccountID,
PaymentTerms: s.PaymentTerms,
PeriodID: s.PeriodID,
Posted: s.Posted,
ProductID: s.ProductID,
Quantity: s.Quantity,
TenantID: s.TenantID,
UnitPrice: s.UnitPrice,
AccountingRulesetCode: s.AccountingRulesetCode,
BillingEmail: s.BillingEmail,
BillingRunID: s.BillingRunID,
ContractHourlyRate: s.ContractHourlyRate,
Ref: s.Ref,
TemplateID: s.TemplateID,
Type: s.Type,
CreatedDate: sql.NullTime{
Time: createdDate,
Valid: e0 == nil,
},
LastModifiedDate: sql.NullTime{
Time: lastModfiedDate,
Valid: e1 == nil,
},
JournalDate: sql.NullTime{
Time: journalDate,
Valid: e2 == nil,
},
}
}
// MarshalToSwagger encodes a first class object to swagger
func (obj *Charge) MarshalToSwagger() *ops_models.Charge {
return &ops_models.Charge{
ID: obj.ID,
AccountID: obj.AccountID,
Amount: obj.Amount,
BillingContactID: obj.BillingContactID,
ContractID: obj.ContractID,
CreatedByID: obj.CreatedByID,
CreatedDate: obj.CreatedDate.Time.Format(dateTimeFormat),
Description: obj.Description,
EmailMessage: obj.EmailMessage,
JournalDate: obj.JournalDate.Time.Format(dateTimeFormat),
LastModifiedByID: obj.LastModifiedByID,
LastModifiedDate: obj.LastModifiedDate.Time.Format(dateTimeFormat),
PartnerAccountID: obj.PartnerAccountID,
PaymentTerms: obj.PaymentTerms,
PeriodID: obj.PeriodID,
Posted: obj.Posted,
ProductID: obj.ProductID,
Quantity: obj.Quantity,
TenantID: obj.TenantID,
UnitPrice: obj.UnitPrice,
AccountingRulesetCode: obj.AccountingRulesetCode,
BillingEmail: obj.BillingEmail,
BillingRunID: obj.BillingRunID,
ContractHourlyRate: obj.ContractHourlyRate,
Ref: obj.Ref,
}
}

View File

@ -6,7 +6,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/ops/ops_models"
)
// ChargeChannelWrapper wraps the object with the security principal
// ChargeChannelWrapper wraps the object with workflow params
type ChargeChannelWrapper struct {
Obj ops_models.Charge
Principal User

64
app/cluster-helpers.go Normal file
View File

@ -0,0 +1,64 @@
package app
import (
"database/sql"
"time"
"code.tnxs.net/taxnexus/lib/api/devops/devops_models"
"github.com/google/uuid"
)
// UnMarshalCluster decodes swagger to first class object
func UnMarshalCluster(s *devops_models.Cluster) *Cluster {
if s.ID == "" {
s.ID = uuid.New().String()
}
createdDate, e0 := time.Parse(dateTimeFormat, s.CreatedDate)
lastModfiedDate, e1 := time.Parse(dateTimeFormat, s.LastModifiedDate)
return &Cluster{
ID: s.ID,
CreatedByID: s.CreatedByID,
Description: s.Description,
Environment: s.Environment,
Gateway: s.Gateway,
IPAddress: s.IPAddress,
LastModifiedByID: s.LastModifiedDate,
Name: s.Name,
OwnerID: s.OwnerID,
Ref: s.Ref,
Status: s.Status,
Subnet: s.Subnet,
Type: s.Type,
Zone: s.Zone,
CreatedDate: sql.NullTime{
Time: createdDate,
Valid: e0 == nil,
},
LastModifiedDate: sql.NullTime{
Time: lastModfiedDate,
Valid: e1 == nil,
},
}
}
// MarshalToSwagger encodes a first class object to swagger
func (obj *Cluster) MarshalToSwagger() *devops_models.Cluster {
return &devops_models.Cluster{
ID: obj.ID,
CreatedByID: obj.CreatedByID,
CreatedDate: obj.CreatedDate.Time.Format(dateTimeFormat),
Description: obj.Description,
Environment: obj.Environment,
Gateway: obj.Gateway,
IPAddress: obj.IPAddress,
LastModifiedByID: obj.LastModifiedByID,
LastModifiedDate: obj.LastModifiedDate.Time.Format(dateTimeFormat),
Name: obj.Name,
OwnerID: obj.OwnerID,
Ref: obj.Ref,
Status: obj.Status,
Subnet: obj.Subnet,
Type: obj.Type,
Zone: obj.Zone,
}
}

View File

@ -6,7 +6,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/devops/devops_models"
)
// ClusterChannelWrapper wraps the object with the security principal
// ClusterChannelWrapper wraps the object with workflow params
type ClusterChannelWrapper struct {
Obj devops_models.Cluster
Principal User

108
app/company-helpers.go Normal file
View File

@ -0,0 +1,108 @@
package app
import (
"database/sql"
"time"
"code.tnxs.net/taxnexus/lib/api/crm/crm_models"
"github.com/google/uuid"
)
// UnMarshalCompany decodes swagger to first class object
func UnMarshalCompany(s *crm_models.Company) *Company {
if s.ID == "" {
s.ID = uuid.New().String()
}
createdDate, e0 := time.Parse(dateTimeFormat, s.CreatedDate)
lastModfiedDate, e1 := time.Parse(dateTimeFormat, s.LastModifiedDate)
dateClosed, e2 := time.Parse(dateTimeFormat, s.DateClosed)
return &Company{
ID: s.ID,
AccountID: s.AccountID,
AccountNumberPrefix: s.AccountNumberPrefix,
BillingAddress: UnMarshalCrmAddress(s.BillingAddress),
BillingAdvice: s.BillingAdvice,
BillingContactID: s.BillingContactID,
BillingEmail: s.BillingEmail,
BillingPhone: s.BillingPhone,
BillingWebsite: s.BillingWebsite,
CoaTemplateID: s.COATemplateID,
ColorAccent1: s.ColorAccent1,
ColorAccent2: s.ColorAccent2,
ColorPrimary: s.ColorPrimary,
CreatedByID: s.CreatedByID,
CustomerSuccessID: s.CustomerSuccessID,
DefaultAddress: UnMarshalCrmAddress(s.DefaultAddress),
DefaultCompany: s.DefaultCompany,
FontBody: s.FontBody,
FontHeading: s.FontBody,
FontHeadingNarrow: s.FontHeadingNarrow,
FontLink: s.FontLink,
FontMono: s.FontMono,
International: s.International,
LastAccountNumber: s.LastAccountNumber,
LastModifiedByID: s.LastModifiedByID,
LastTaxtypeNumber: s.LastTaxTypeNumber,
Logo: s.Logo,
Name: s.Name,
OwnerID: s.OwnerID,
PreparerID: s.PreparerID,
PricebookID: s.PricebookID,
TenantID: s.TenantID,
UserTechLeadID: s.UserTechLeadID,
CreatedDate: sql.NullTime{
Time: createdDate,
Valid: e0 == nil,
},
LastModifiedDate: sql.NullTime{
Time: lastModfiedDate,
Valid: e1 == nil,
},
DateClosed: sql.NullTime{
Time: dateClosed,
Valid: e2 == nil,
},
}
}
// MarshalToSwagger encodes a first class object to swagger
func (obj *Company) MarshalToSwagger() *crm_models.Company {
return &crm_models.Company{
ID: obj.ID,
AccountID: obj.AccountID,
AccountNumberPrefix: obj.AccountNumberPrefix,
BillingAddress: obj.BillingAddress.MarshalToCrm(),
BillingAdvice: obj.BillingAdvice,
BillingContactID: obj.BillingContactID,
BillingEmail: obj.BillingEmail,
BillingPhone: obj.BillingPhone,
BillingWebsite: obj.BillingWebsite,
COATemplateID: obj.CoaTemplateID,
ColorAccent1: obj.ColorAccent1,
ColorAccent2: obj.ColorAccent2,
ColorPrimary: obj.ColorPrimary,
CreatedByID: obj.CreatedByID,
CreatedDate: obj.CreatedDate.Time.Format(dateTimeFormat),
CustomerSuccessID: obj.CustomerSuccessID,
DateClosed: obj.DateClosed.Time.Format(dateTimeFormat),
DefaultAddress: obj.DefaultAddress.MarshalToCrm(),
DefaultCompany: obj.DefaultCompany,
FontBody: obj.FontBody,
FontHeading: obj.FontHeading,
FontHeadingNarrow: obj.FontHeadingNarrow,
FontLink: obj.FontLink,
FontMono: obj.FontMono,
International: obj.International,
LastAccountNumber: obj.LastAccountNumber,
LastModifiedByID: obj.LastModifiedByID,
LastModifiedDate: obj.LastModifiedDate.Time.Format(dateTimeFormat),
LastTaxTypeNumber: obj.LastTaxtypeNumber,
Logo: obj.Logo,
Name: obj.Name,
OwnerID: obj.OwnerID,
PreparerID: obj.PreparerID,
PricebookID: obj.PricebookID,
TenantID: obj.TenantID,
UserTechLeadID: obj.UserTechLeadID,
}
}

View File

@ -6,7 +6,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/crm/crm_models"
)
// CompanyChannelWrapper wraps the object with the security principal
// CompanyChannelWrapper wraps the object with workflow params
type CompanyChannelWrapper struct {
Obj crm_models.Company
Principal User
@ -20,7 +20,7 @@ type Company struct {
AccountID string
AccountNumberPrefix string
AdvancePeriodID string
BillingAddress Address
BillingAddress *Address
BillingAdvice string
BillingContactID string
BillingEmail string
@ -37,7 +37,7 @@ type Company struct {
CurrentPeriodStatus string
CustomerSuccessID string
DateClosed sql.NullTime
DefaultAddress Address
DefaultAddress *Address
DefaultCompany bool
FontBody string
FontHeading string

126
app/contact-helpers.go Normal file
View File

@ -0,0 +1,126 @@
package app
import (
"database/sql"
"time"
"code.tnxs.net/taxnexus/lib/api/crm/crm_models"
"github.com/google/uuid"
)
func UnMarshalContact(s *crm_models.Contact) *Contact {
if s.ID == "" {
s.ID = uuid.New().String()
}
createdDate, e0 := time.Parse(dateTimeFormat, s.CreatedDate)
lastModfiedDate, e1 := time.Parse(dateTimeFormat, s.LastModifiedDate)
birthDate, e2 := time.Parse(dateTimeFormat, s.BirthDate)
emailBounceDate, e3 := time.Parse(dateTimeFormat, s.EmailBounceDate)
return &Contact{
ID: s.ID,
AccountID: s.AccountID,
AssistantName: s.AssistantName,
AssistantPhone: s.AssistantPhone,
CreatedByID: s.CreatedByID,
Department: s.Department,
Description: s.Description,
DoNotCall: s.DoNotCall,
Email: s.Email,
EmailBouncedReason: s.EmailBouncedReason,
EnrollmentStatus: s.EnrollmentStatus,
Fax: s.Fax,
FirstName: s.FirstName,
HasOptedOutOfEmail: s.HasOptedOutOfEmail,
HasOptedOutOfFax: s.HasOptedOutOfFax,
HomePhone: s.HomePhone,
IsEmailBounced: s.IsEmailBounced,
IsProvisioned: s.IsProvisioned,
LastModifiedByID: s.LastModifiedByID,
LastName: s.LastName,
LeadSource: s.LeadSource,
Level: s.Level,
LinkedIn: s.LinkedIn,
MailingAddress: UnMarshalCrmAddress(s.MailingAddress),
MailingLists: s.MailingLists,
MobilePhone: s.MobilePhone,
Name: s.Name,
OtherAddress: UnMarshalCrmAddress(s.OtherAddress),
OtherPhone: s.OtherPhone,
OwnerID: s.OwnerID,
PersonalEmail: s.PersonalEmail,
Phone: s.Phone,
PhotoURL: s.PhotoURL,
RecruitingStatus: s.RecruitingStatus,
Ref: s.Ref,
ReportsToID: s.ReportsToID,
Salutation: s.Salutation,
Status: s.Status,
Title: s.Title,
Type: s.Type,
CreatedDate: sql.NullTime{
Time: createdDate,
Valid: e0 == nil,
},
LastModifiedDate: sql.NullTime{
Time: lastModfiedDate,
Valid: e1 == nil,
},
BirthDate: sql.NullTime{
Time: birthDate,
Valid: e2 == nil,
},
EmailBounceDate: sql.NullTime{
Time: emailBounceDate,
Valid: e3 == nil,
},
}
}
func (obj *Contact) MarshalToSwagger() *crm_models.Contact {
return &crm_models.Contact{
ID: obj.ID,
AccountID: obj.AccountID,
AssistantName: obj.AssistantName,
AssistantPhone: obj.AssistantPhone,
BirthDate: obj.BirthDate.Time.Format(dateTimeFormat),
CreatedByID: obj.CreatedByID,
CreatedDate: obj.CreatedDate.Time.Format(dateTimeFormat),
Department: obj.Department,
Description: obj.Description,
DoNotCall: obj.DoNotCall,
Email: obj.Email,
EmailBounceDate: obj.EmailBounceDate.Time.Format(dateTimeFormat),
EmailBouncedReason: obj.EmailBouncedReason,
EnrollmentStatus: obj.EnrollmentStatus,
Fax: obj.Fax,
FirstName: obj.FirstName,
HasOptedOutOfEmail: obj.HasOptedOutOfEmail,
HasOptedOutOfFax: obj.HasOptedOutOfFax,
HomePhone: obj.HomePhone,
IsEmailBounced: obj.IsEmailBounced,
IsProvisioned: obj.IsProvisioned,
LastModifiedByID: obj.LastModifiedByID,
LastModifiedDate: obj.LastModifiedDate.Time.Format(dateTimeFormat),
LastName: obj.LastName,
LeadSource: obj.LeadSource,
Level: obj.Level,
LinkedIn: obj.LinkedIn,
MailingAddress: obj.MailingAddress.MarshalToCrm(),
MailingLists: obj.MailingLists,
MobilePhone: obj.MobilePhone,
Name: obj.Name,
OtherAddress: obj.OtherAddress.MarshalToCrm(),
OtherPhone: obj.OtherPhone,
OwnerID: obj.OwnerID,
PersonalEmail: obj.PersonalEmail,
Phone: obj.Phone,
PhotoURL: obj.PhotoURL,
RecruitingStatus: obj.RecruitingStatus,
Ref: obj.Ref,
ReportsToID: obj.ReportsToID,
Salutation: obj.Salutation,
Status: obj.Status,
TenantID: obj.TenantID,
Title: obj.Title,
Type: obj.Type,
}
}

View File

@ -9,7 +9,7 @@ import (
// NewContactActivity is an activity identifier
const NewContactActivity = "NEW_CONTACT_ACTIVITY"
// ContactChannelWrapper wraps the object with the security principal
// ContactChannelWrapper wraps the object with workflow params
type ContactChannelWrapper struct {
Obj crm_models.Contact
Principal User
@ -46,11 +46,11 @@ type Contact struct {
LeadSource string
Level string
LinkedIn string
MailingAddress Address
MailingAddress *Address
MailingLists string
MobilePhone string
Name string
OtherAddress Address
OtherAddress *Address
OtherPhone string
OwnerID string
PersonalEmail string

53
app/coordinate-helpers.go Normal file
View File

@ -0,0 +1,53 @@
package app
import "code.tnxs.net/taxnexus/lib/api/geo/geo_models"
// Coordinate is never ingested, hence no UnMarshal method
// MarshalToSwagger encodes a first class object to swagger
func (obj *Coordinate) MarshalToSwagger() *geo_models.Coordinate {
theTaxTypes := []*geo_models.TaxType{}
if obj.TaxTypes != nil {
for _, itm := range obj.TaxTypes {
theTaxTypes = append(theTaxTypes, itm.MarshalToSwagger())
}
}
var taxRate geo_models.TaxRate
if obj.TaxRate != nil {
taxRate = geo_models.TaxRate{
CombinedRate: obj.TaxRate.CombinedRate,
County: obj.TaxRate.County,
CountyID: obj.TaxRate.CountyID,
CountyRate: obj.TaxRate.CountyRate,
Date: obj.TaxRate.Date,
}
}
return &geo_models.Coordinate{
ID: obj.ID,
Country: obj.Country,
CountryID: obj.CountryID,
County: obj.County,
CountyID: obj.CountyID,
Focus: obj.Focus,
FormattedAddress: obj.FormattedAddress,
IsDistrict: obj.IsDistrict,
Latitude: obj.Latitude,
Longitude: obj.Longitude,
Map: obj.Map,
Name: obj.Name,
Neighborhood: obj.Neighborhood,
Place: obj.Place,
PlaceGeocode: obj.Geocode,
PlaceID: obj.PlaceID,
PostalCode: obj.PostalCode,
Ref: obj.Ref,
State: obj.State,
StateID: obj.StateID,
Status: obj.Status,
Street: obj.Street,
StreetNumber: obj.StreetNumber,
StreetView: obj.StreetView,
TaxTypes: theTaxTypes,
TaxRate: &taxRate,
}
}

View File

@ -6,7 +6,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/geo/geo_models"
)
// CoordinateBasicChannelWrapper wraps the object with the security principal
// CoordinateBasicChannelWrapper wraps the object with workflow params
type CoordinateBasicChannelWrapper struct {
Obj geo_models.CoordinateBasic
Principal User
@ -29,7 +29,7 @@ type CoordinateBasic struct {
TaxTypes []*string
}
// CoordinateChannelWrapper wraps the object with the security principal
// CoordinateChannelWrapper wraps the object with workflow params
type CoordinateChannelWrapper struct {
Obj geo_models.Coordinate
Principal User

99
app/country-helpers.go Normal file
View File

@ -0,0 +1,99 @@
package app
import (
"database/sql"
"time"
"code.tnxs.net/taxnexus/lib/api/geo/geo_models"
"github.com/google/uuid"
)
func unMarshalCountry(s *geo_models.Country) *Country {
if s.ID == "" {
s.ID = uuid.New().String()
}
createdDate, e0 := time.Parse(dateTimeFormat, s.CreatedDate)
lastModfiedDate, e1 := time.Parse(dateTimeFormat, s.LastModifiedDate)
theInstances := []*TaxInstance{}
for _, itm := range s.TaxInstances {
theInstances = append(theInstances, unMarshalTaxInstance(itm))
}
return &Country{
ID: s.ID,
AccountID: s.AccountID,
Amount: s.Amount,
Code: s.Code,
ContactID: s.ContactID,
CreatedByID: s.CreatedByID,
EnrollmentStatus: s.EnrollmentStatus,
Interest: s.Interest,
LastModifiedByID: s.LastModifiedByID,
Latitude: s.Latitude,
Longitude: s.Longitude,
Name: s.Name,
OwnerID: s.OwnerID,
Penalty: s.Penalty,
Ref: s.Ref,
ReportedAdjustments: s.ReportedAdjustments,
ReportedDeductions: s.ReportedDeductions,
ReportedNetRevenue: s.ReportedNetRevenue,
ReportedRate: s.ReportedRate,
ReportedRevenue: s.ReportedRevenue,
RevenueBase: s.RevenueBase,
RevenueNet: s.RevenueNet,
RevenueNotTaxable: s.RevenueNotTaxable,
Status: s.Status,
Subtotal: s.Subtotal,
TaxInstances: theInstances,
TemplateID: s.TemplateID,
TotalAmount: s.TotalAmount,
UnitBase: s.UnitBase,
CreatedDate: sql.NullTime{
Time: createdDate,
Valid: e0 == nil,
},
LastModifiedDate: sql.NullTime{
Time: lastModfiedDate,
Valid: e1 == nil,
},
}
}
func (obj *Country) marshalToSwagger() *geo_models.Country {
taxInstances := []*geo_models.TaxInstance{}
for _, itm := range obj.TaxInstances {
taxInstances = append(taxInstances, itm.marshalToSwagger())
}
return &geo_models.Country{
ID: obj.ID,
AccountID: obj.AccountID,
Amount: obj.Amount,
Code: obj.Code,
ContactID: obj.ContactID,
CreatedByID: obj.CreatedByID,
CreatedDate: obj.CreatedDate.Time.Format(dateTimeFormat),
EnrollmentStatus: obj.EnrollmentStatus,
Interest: obj.Interest,
LastModifiedByID: obj.LastModifiedByID,
LastModifiedDate: obj.LastModifiedDate.Time.Format(dateTimeFormat),
Latitude: obj.Latitude,
Longitude: obj.Longitude,
Name: obj.Name,
OwnerID: obj.OwnerID,
Penalty: obj.Penalty,
Ref: obj.Ref,
ReportedAdjustments: obj.ReportedAdjustments,
ReportedDeductions: obj.ReportedDeductions,
ReportedNetRevenue: obj.ReportedNetRevenue,
ReportedRate: obj.ReportedRate,
ReportedRevenue: obj.ReportedRevenue,
RevenueBase: obj.RevenueBase,
RevenueNet: obj.RevenueNet,
RevenueNotTaxable: obj.RevenueNotTaxable,
Status: obj.Status,
Subtotal: obj.Subtotal,
TaxInstances: taxInstances,
TemplateID: obj.TemplateID,
TotalAmount: obj.TotalAmount,
UnitBase: obj.UnitBase,
}
}

View File

@ -6,7 +6,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/geo/geo_models"
)
// CountryChannelWrapper wraps the object with the security principal
// CountryChannelWrapper wraps the object with workflow params
type CountryChannelWrapper struct {
Obj geo_models.Country
Principal User

141
app/county-helpers.go Normal file
View File

@ -0,0 +1,141 @@
package app
import (
"database/sql"
"time"
"code.tnxs.net/taxnexus/lib/api/geo/geo_models"
"github.com/google/uuid"
)
func unMarshalCounty(s *geo_models.County) *County {
if s.ID == "" {
s.ID = uuid.New().String()
}
createdDate, e0 := time.Parse(dateTimeFormat, s.CreatedDate)
lastModfiedDate, e1 := time.Parse(dateTimeFormat, s.LastModifiedDate)
theInstances := []*TaxInstance{}
for _, itm := range s.TaxInstances {
theInstances = append(theInstances, unMarshalTaxInstance(itm))
}
return &County{
ID: s.ID,
AccountID: s.AccountID,
Amount: s.Amount,
AreaDescription: s.AreaDescription,
ContactID: s.ContactID,
CountryID: s.CountryID,
EnrollmentStatus: s.EnrollmentStatus,
FIPS: s.FIPS,
FIPSclass: s.FIPSclass,
FunctionalStatus: s.FunctionalStatus,
Geocode: s.Geocode,
GNIS: s.GNIS,
Interest: s.Interest,
LandArea: s.LandArea,
LegalName: s.LegalName,
Latitude: s.Latitude,
Longitude: s.Longitude,
Name: s.Name,
Penalty: s.Penalty,
Ref: s.Ref,
ReportedAdjustments: s.ReportedAdjustments,
ReportedDeductions: s.ReportedDeductions,
ReportedNetRevenue: s.ReportedNetRevenue,
ReportedRate: s.ReportedRate,
ReportedRevenue: s.ReportedNetRevenue,
RevenueBase: s.RevenueBase,
RevenueNet: s.RevenueNet,
RevenueNotTaxable: s.RevenueNotTaxable,
StateID: s.StateID,
Status: s.Status,
Subtotal: s.Subtotal,
TaxInstances: theInstances,
TemplateID: s.TemplateID,
TotalAmount: s.TotalAmount,
TotalArea: s.TotalArea,
UnitBase: s.UnitBase,
WaterArea: s.WaterArea,
CreatedByID: s.CreatedByID,
HasDistrictTaxes: s.HasDistrictTaxes,
LastModifiedByID: s.LastModifiedByID,
CreatedDate: sql.NullTime{
Time: createdDate,
Valid: e0 == nil,
},
LastModifiedDate: sql.NullTime{
Time: lastModfiedDate,
Valid: e1 == nil,
},
}
}
func (obj *County) marshalToSwagger() *geo_models.County {
theInstances := []*geo_models.TaxInstance{}
for _, itm := range obj.TaxInstances {
theInstances = append(theInstances, itm.marshalToSwagger())
}
var salesTaxRate *geo_models.TaxRate
if obj.SalesTaxRate != nil {
salesTaxRate = &geo_models.TaxRate{
CombinedRate: obj.SalesTaxRate.CombinedRate,
County: obj.SalesTaxRate.County,
CountyID: obj.SalesTaxRate.CountyID,
CountyRate: obj.SalesTaxRate.CountyRate,
Date: obj.SalesTaxRate.Date,
Focus: obj.SalesTaxRate.Focus,
Geocode: obj.SalesTaxRate.Geocode,
Place: obj.SalesTaxRate.Place,
PlaceID: obj.SalesTaxRate.PlaceID,
PlaceRate: obj.SalesTaxRate.PlaceRate,
State: obj.SalesTaxRate.State,
StateID: obj.SalesTaxRate.StateID,
StateRate: obj.SalesTaxRate.StateRate,
}
}
return &geo_models.County{
ID: obj.ID,
AccountID: obj.AccountID,
Amount: obj.Amount,
AreaDescription: obj.AreaDescription,
ContactID: obj.ContactID,
CountryID: obj.CountryID,
EnrollmentStatus: obj.EnrollmentStatus,
FIPS: obj.FIPS,
FIPSclass: obj.FIPSclass,
FunctionalStatus: obj.FunctionalStatus,
Geocode: obj.Geocode,
GNIS: obj.GNIS,
HasDistrictTaxes: obj.HasDistrictTaxes,
Interest: obj.Interest,
LandArea: obj.LandArea,
LegalName: obj.LegalName,
Latitude: obj.Latitude,
Longitude: obj.Longitude,
Name: obj.Name,
Penalty: obj.Penalty,
Ref: obj.Ref,
ReportedAdjustments: obj.ReportedAdjustments,
ReportedDeductions: obj.ReportedDeductions,
ReportedNetRevenue: obj.ReportedNetRevenue,
ReportedRate: obj.ReportedRate,
ReportedRevenue: obj.ReportedRevenue,
RevenueBase: obj.RevenueBase,
RevenueNet: obj.RevenueNet,
RevenueNotTaxable: obj.RevenueNotTaxable,
SalesTaxRate: salesTaxRate,
StateID: obj.StateID,
Status: obj.Status,
Subtotal: obj.Subtotal,
TaxInstances: theInstances,
TemplateID: obj.TemplateID,
TotalAmount: obj.TotalAmount,
TotalArea: obj.TotalArea,
UnitBase: obj.UnitBase,
WaterArea: obj.WaterArea,
CreatedByID: obj.CreatedByID,
CreatedDate: obj.CreatedDate.Time.Format(dateTimeFormat),
LastModifiedByID: obj.LastModifiedByID,
LastModifiedDate: obj.LastModifiedDate.Time.Format(dateTimeFormat),
OwnerID: obj.OwnerID,
}
}

View File

@ -6,7 +6,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/geo/geo_models"
)
// CountyChannelWrapper wraps the object with the security principal
// CountyChannelWrapper wraps the object with workflow params
type CountyChannelWrapper struct {
Obj geo_models.County
Principal User
@ -39,6 +39,7 @@ type County struct {
Latitude float64
LegalName string
Name string
OwnerID string
Penalty float64
Ref string
ReportedAdjustments float64

58
app/database-helpers.go Normal file
View File

@ -0,0 +1,58 @@
package app
import (
"database/sql"
"time"
"code.tnxs.net/taxnexus/lib/api/devops/devops_models"
"github.com/google/uuid"
)
// UnMarshalDatabase decodes swagger to a first class object
func UnMarshalDatabase(s *devops_models.Database) *Database {
if s.ID == "" {
s.ID = uuid.New().String()
}
createdDate, e0 := time.Parse(dateTimeFormat, s.CreatedDate)
lastModfiedDate, e1 := time.Parse(dateTimeFormat, s.LastModifiedDate)
return &Database{
ID: s.ID,
Active: s.Active,
ClusterID: s.ClusterID,
CreatedByID: s.CreatedByID,
DatabaseName: s.DatabaseName,
DSN: s.DSN,
LastModifiedByID: s.LastModifiedByID,
Microservices: s.Microservices,
Status: s.Status,
TenantID: s.TenantID,
Type: s.Type,
CreatedDate: sql.NullTime{
Time: createdDate,
Valid: e0 == nil,
},
LastModifiedDate: sql.NullTime{
Time: lastModfiedDate,
Valid: e1 == nil,
},
}
}
// MarshalToSwagger encodes a first class object to swagger
func (obj *Database) MarshalToSwagger() *devops_models.Database {
return &devops_models.Database{
ID: obj.ID,
Active: obj.Active,
ClusterID: obj.ClusterID,
CreatedByID: obj.CreatedByID,
CreatedDate: obj.CreatedDate.Time.Format(dateTimeFormat),
DatabaseName: obj.DatabaseName,
DSN: obj.DSN,
LastModifiedByID: obj.LastModifiedByID,
LastModifiedDate: obj.LastModifiedDate.Time.Format(dateTimeFormat),
Microservices: obj.Microservices,
Status: obj.Status,
TenantID: obj.TenantID,
Type: obj.Type,
}
}

View File

@ -6,7 +6,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/devops/devops_models"
)
// DatabaseChannelWrapper wraps the object with the security principal
// DatabaseChannelWrapper wraps the object with workflow params
type DatabaseChannelWrapper struct {
Obj devops_models.Database
Principal User

20
app/domain-helpers.go Normal file
View File

@ -0,0 +1,20 @@
package app
import "code.tnxs.net/taxnexus/lib/api/geo/geo_models"
func unMarshalDomain(swag *geo_models.Domain) *Domain {
return &Domain{
Description: swag.Description,
Active: swag.Active,
ID: swag.ID,
Name: swag.Name,
}
}
func (obj *Domain) marshalToSwagger() *geo_models.Domain {
return &geo_models.Domain{
ID: obj.ID,
Active: obj.Active,
Description: obj.Description,
Name: obj.Name,
}
}

View File

@ -2,7 +2,7 @@ package app
import "code.tnxs.net/taxnexus/lib/api/geo/geo_models"
// DomainChannelWrapper wraps the object with the security principal
// DomainChannelWrapper wraps the object with workflow params
type DomainChannelWrapper struct {
Obj geo_models.Domain
Principal User

94
app/eft-helpers.go Normal file
View File

@ -0,0 +1,94 @@
package app
import (
"database/sql"
"time"
"code.tnxs.net/taxnexus/lib/api/ops/ops_models"
"github.com/google/uuid"
)
// UnMarshalEft decodes swagger to a first class object
func UnMarshalEft(s *ops_models.Eft) *Eft {
if s.ID == "" {
s.ID = uuid.New().String()
}
items := []*EftItem{}
for _, itm := range s.Items {
items = append(items, UnMarshalEftItem(itm))
}
createdDate, e0 := time.Parse(dateTimeFormat, s.CreatedDate)
lastModfiedDate, e1 := time.Parse(dateTimeFormat, s.LastModifiedDate)
journalDate, e2 := time.Parse(dateTimeFormat, s.JournalDate)
executed, e3 := time.Parse(dateTimeFormat, s.Executed)
return &Eft{
ID: s.ID,
AccountID: s.AccountID,
Amount: s.Amount,
AttemptNumber: s.AttemptNumber,
BackendID: s.BackendID,
BillingRunID: s.BillingRunID,
CashReceiptID: s.CashReceiptID,
CreatedByID: s.CreatedByID,
Fee: s.Fee,
Gateway: s.Gateway,
GatewayKey: s.GatewayKey,
GatewayMessage: s.GatewayMessage,
Items: items,
LastModifiedByID: s.LastModifiedByID,
PaymentMethodID: s.PaymentMethodID,
Ref: s.Ref,
Status: s.Status,
TenantID: s.TenantID,
TransactionID: s.TransactionID,
CreatedDate: sql.NullTime{
Time: createdDate,
Valid: e0 == nil,
},
LastModifiedDate: sql.NullTime{
Time: lastModfiedDate,
Valid: e1 == nil,
},
JournalDate: sql.NullTime{
Time: journalDate,
Valid: e2 == nil,
},
Executed: sql.NullTime{
Time: executed,
Valid: e3 == nil,
},
}
}
// MarshalToSwagger encodes a first class object to swagger
func (obj *Eft) MarshalToSwagger() *ops_models.Eft {
items := []*ops_models.EftItem{}
for _, itm := range obj.Items {
items = append(items, itm.MarshalToSwagger())
}
return &ops_models.Eft{
ID: obj.ID,
AccountID: obj.AccountID,
Amount: obj.Amount,
AttemptNumber: obj.AttemptNumber,
BackendID: obj.BackendID,
BillingRunID: obj.BillingRunID,
CashReceiptID: obj.CashReceiptID,
CreatedByID: obj.CreatedByID,
CreatedDate: obj.CreatedDate.Time.Format(dateTimeFormat),
Executed: obj.Executed.Time.Format(dateTimeFormat),
Fee: obj.Fee,
Gateway: obj.Gateway,
GatewayKey: obj.GatewayKey,
GatewayMessage: obj.GatewayMessage,
Items: items,
JournalDate: obj.JournalDate.Time.Format(dateTimeFormat),
LastModifiedByID: obj.LastModifiedByID,
LastModifiedDate: obj.LastModifiedDate.Time.Format(dateTimeFormat),
PaymentMethodID: obj.PaymentMethodID,
Ref: obj.Ref,
Status: obj.Status,
TenantID: obj.TenantID,
TransactionID: obj.TransactionID,
}
}

View File

@ -6,7 +6,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/ops/ops_models"
)
// EftChannelWrapper wraps the object with the security principal
// EftChannelWrapper wraps the object with workflow params
type EftChannelWrapper struct {
Obj ops_models.Eft
Principal User

50
app/eftitem-helpers.go Normal file
View File

@ -0,0 +1,50 @@
package app
import (
"database/sql"
"time"
"code.tnxs.net/taxnexus/lib/api/ops/ops_models"
"github.com/google/uuid"
)
// UnMarshalEftItem decodes swagger to a first class object
func UnMarshalEftItem(s *ops_models.EftItem) *EftItem {
if s.ID == "" {
s.ID = uuid.New().String()
}
createdDate, e0 := time.Parse(dateTimeFormat, s.CreatedDate)
lastModfiedDate, e1 := time.Parse(dateTimeFormat, s.LastModifiedDate)
return &EftItem{
ID: s.ID,
Amount: s.Amount,
CreatedByID: s.CreatedByID,
EftID: s.EftID,
InvoiceID: s.InvoiceID,
LastModifiedByID: s.LastModifiedByID,
TenantID: s.TenantID,
CreatedDate: sql.NullTime{
Time: createdDate,
Valid: e0 == nil,
},
LastModifiedDate: sql.NullTime{
Time: lastModfiedDate,
Valid: e1 == nil,
},
}
}
// MarshalToSwagger encodes a first class object to swagger
func (obj *EftItem) MarshalToSwagger() *ops_models.EftItem {
return &ops_models.EftItem{
ID: obj.ID,
Amount: obj.Amount,
CreatedByID: obj.CreatedByID,
CreatedDate: obj.CreatedDate.Time.Format(dateTimeFormat),
EftID: obj.EftID,
InvoiceID: obj.InvoiceID,
LastModifiedByID: obj.LastModifiedByID,
LastModifiedDate: obj.LastModifiedDate.Time.Format(dateTimeFormat),
TenantID: obj.TenantID,
}
}

View File

@ -6,7 +6,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/ops/ops_models"
)
// EftItemChannelWrapper wraps the object with the security principal
// EftItemChannelWrapper wraps the object with workflow params
type EftItemChannelWrapper struct {
Obj ops_models.EftItem
Principal User

View File

@ -0,0 +1,55 @@
package app
import "code.tnxs.net/taxnexus/lib/api/workflow/workflow_models"
func (obj *EmailMessage) MarshalToSwagger() *workflow_models.EmailMessage {
headers := &workflow_models.Headers{}
// for _, itm := range obj.Headers {
// val := []string{}
// for _, s := range itm.Values {
// val = append(val, s)
// }
// values := []string{}
// for _, i := range itm.Values {
// values = append(values, i)
// }
// headers = &workflow_models.Headers{
// Key: itm.Key,
// Values: values,
// }
// }
return &workflow_models.EmailMessage{
ID: obj.ID,
ActivityID: obj.ActivityID,
BCCAddress: obj.BCCAddress,
CCAddress: obj.CCAddress,
CreatedByID: obj.CreatedByID,
CreatedDate: obj.CreatedDate.Time.Format(dateTimeFormat),
EmailMessageID: obj.EmailMessageID,
FromAddress: obj.FromAddress,
FromName: obj.FromName,
HasAttachment: obj.HasAttachment,
Headers: headers,
HTML: obj.HTML,
Incoming: obj.Incoming,
IsClientManaged: obj.IsClientManaged,
IsExternallyManaged: obj.IsExternallyManaged,
LastModifiedByID: obj.LastModifiedByID,
LastModifiedDate: obj.LastModifiedDate.Time.Format(dateTimeFormat),
MessageDate: obj.MessageDate.Time.Format(dateTimeFormat),
MessageIdentifier: obj.MessageIdentifier,
ParentID: obj.ParentID,
RelatedToID: obj.RelatedToID,
RelationAddress: obj.RelationAddress,
RelationID: obj.RelationID,
RelationObjectType: obj.RelationObjectType,
RelationType: obj.RelationType,
ReplyToEmailMessageID: obj.ReplyToEmailMessageID,
Status: obj.Status,
Subject: obj.Subject,
Text: obj.Text,
ThreadIdentifier: obj.ThreadIdentifier,
ToAddress: obj.ToAddress,
ValidatedFromAddress: obj.ValidatedFromAddress,
}
}

View File

@ -6,7 +6,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/workflow/workflow_models"
)
// EmailMessageChannelWrapper wraps the object with the security principal
// EmailMessageChannelWrapper wraps the object with workflow params
type EmailMessageChannelWrapper struct {
Obj workflow_models.EmailMessage
Principal User

View File

@ -4,7 +4,7 @@ import (
"database/sql"
)
// EmailTemplateChannelWrapper wraps the object with the security principal
// EmailTemplateChannelWrapper wraps the object with workflow params
type EmailTemplateChannelWrapper struct {
// Obj workflow_models.EmailTemplate
Principal User

128
app/filing-helpers.go Normal file
View File

@ -0,0 +1,128 @@
package app
import (
"database/sql"
"time"
"code.tnxs.net/taxnexus/lib/api/regs/regs_models"
"github.com/google/uuid"
)
func unMarshalSwaggerFiling(s *regs_models.Filing) *Filing {
if s.ID == "" {
s.ID = uuid.New().String()
}
createdDate, e0 := time.Parse(dateTimeFormat, s.CreatedDate)
lastModfiedDate, e1 := time.Parse(dateTimeFormat, s.LastModifiedDate)
date, e2 := time.Parse(dateFormat, s.Date)
if e2 != nil {
date, e2 = time.Parse(dateFormatAlt, s.Date)
}
dueDate, e3 := time.Parse(dateFormat, s.DueDate)
if e3 != nil {
dueDate, e3 = time.Parse(dateFormatAlt, s.DueDate)
}
return &Filing{
ID: s.ID,
AccountName: s.AccountName,
Amount: s.Amount,
ContactID: s.ContactID,
CreatedByID: s.CreatedByID,
FilingNumber: s.FilingNumber,
FilingTypeID: s.FilingTypeID,
Frequency: s.Frequency,
Interest: s.Interest,
InterestRate: s.InterestRate,
LastModifiedByID: s.LastModifiedByID,
MonthNumber: s.MonthNumber,
OwnerID: s.OwnerID,
Penalty: s.Penalty,
PenaltyDays: s.PenaltyDays,
PenaltyRate: s.PenaltyRate,
PeriodID: s.PeriodID,
PreparerID: s.PreparerID,
QuarterNumber: s.QuarterNumber,
Ref: s.Ref,
ReportedAdjustments: s.ReportedAdjustments,
ReportedDeductions: s.ReportedDeductions,
ReportedNetRevenue: s.ReportedNetRevenue,
ReportedRate: s.ReportedRate,
ReportedRevenue: s.ReportedRevenue,
RevenueBase: s.RevenueBase,
RevenueNet: s.RevenueNet,
RevenueNotTaxable: s.RevenueNotTaxable,
SemiannualNumber: s.SemiannualNumber,
Status: s.Status,
SubmissionID: s.SubmissionID,
Subtotal: s.Subtotal,
TaxOnTax: s.TaxOnTax,
TaxTypeAccountID: s.TaxTypeAccountID,
TenantID: s.TenantID,
TotalAmount: s.TotalAmount,
UnitBase: s.UnitBase,
YearNumber: s.YearNumber,
CreatedDate: sql.NullTime{
Time: createdDate,
Valid: e0 == nil,
},
LastModifiedDate: sql.NullTime{
Time: lastModfiedDate,
Valid: e1 == nil,
},
Date: sql.NullTime{
Time: date,
Valid: e2 == nil,
},
DueDate: sql.NullTime{
Time: dueDate,
Valid: e3 == nil,
},
}
}
func (obj *Filing) marshalToSwagger() *regs_models.Filing {
return &regs_models.Filing{
ID: obj.ID,
AccountName: obj.AccountName,
Amount: obj.Amount,
ContactID: obj.ContactID,
CreatedByID: obj.CreatedByID,
CreatedDate: obj.CreatedDate.Time.Format(dateTimeFormat),
Date: obj.Date.Time.Format(dateFormat),
DueDate: obj.DueDate.Time.Format(dateFormat),
FilingNumber: obj.FilingNumber,
FilingTypeID: obj.FilingTypeID,
Frequency: obj.Frequency,
Interest: obj.Interest,
InterestRate: obj.InterestRate,
LastModifiedByID: obj.LastModifiedByID,
LastModifiedDate: obj.LastModifiedDate.Time.Format(dateTimeFormat),
MonthNumber: obj.MonthNumber,
OwnerID: obj.OwnerID,
Penalty: obj.Penalty,
PenaltyDays: obj.PenaltyDays,
PenaltyRate: obj.PenaltyRate,
PeriodID: obj.PeriodID,
PreparerID: obj.PreparerID,
QuarterNumber: obj.QuarterNumber,
Ref: obj.Ref,
ReportedAdjustments: obj.ReportedAdjustments,
ReportedDeductions: obj.ReportedDeductions,
ReportedNetRevenue: obj.ReportedNetRevenue,
ReportedRate: obj.ReportedRate,
ReportedRevenue: obj.ReportedRevenue,
RevenueBase: obj.RevenueBase,
RevenueNet: obj.RevenueNet,
RevenueNotTaxable: obj.RevenueNotTaxable,
SemiannualNumber: obj.SemiannualNumber,
Status: obj.Status,
SubmissionID: obj.SubmissionID,
Subtotal: obj.Subtotal,
TaxOnTax: obj.TaxOnTax,
TaxTypeAccountID: obj.TaxTypeAccountID,
TenantID: obj.TenantID,
TotalAmount: obj.TotalAmount,
UnitBase: obj.UnitBase,
YearNumber: obj.YearNumber,
}
}

View File

@ -6,7 +6,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/regs/regs_models"
)
// FilingChannelWrapper wraps the object with the security principal
// FilingChannelWrapper wraps the object with workflow params
type FilingChannelWrapper struct {
Obj regs_models.Filing
Principal User

View File

View File

@ -6,7 +6,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/regs/regs_models"
)
// FilingScheduleItemChannelWrapper wraps the object with the security principal
// FilingScheduleItemChannelWrapper wraps the object with workflow params
type FilingScheduleItemChannelWrapper struct {
Obj regs_models.FilingScheduleItem
Principal User

133
app/filingtype-helpers.go Normal file
View File

@ -0,0 +1,133 @@
package app
import (
"database/sql"
"time"
"code.tnxs.net/taxnexus/lib/api/regs/regs_models"
"github.com/google/uuid"
)
func unMarshalFilingType(s *regs_models.FilingType) *FilingType {
if s.ID == "" {
s.ID = uuid.New().String()
}
createdDate, e0 := time.Parse(dateTimeFormat, s.CreatedDate)
lastModfiedDate, e1 := time.Parse(dateTimeFormat, s.LastModifiedDate)
var instances []*FilingTypeInstance
var dueDates []*FilingScheduleItem
if s.Instances != nil {
instances = []*FilingTypeInstance{}
for _, itm := range s.Instances {
instances = append(instances, &FilingTypeInstance{
CountryID: itm.CountryID,
CountyID: itm.CountyID,
FilingTypeID: itm.FilingTypeID,
ObjectType: itm.ObjectType,
PlaceID: itm.PlaceID,
StateID: itm.StateID,
})
}
for _, itm := range s.DueDates {
dueDates = []*FilingScheduleItem{}
dueDate, e0 := time.Parse(dateTimeFormat, itm.DueDate)
if e0 != nil {
dueDate, e0 = time.Parse(dateFormatAlt, itm.DueDate)
}
dueDates = append(dueDates, &FilingScheduleItem{
Description: itm.Description,
DueDate: sql.NullTime{
Time: dueDate,
Valid: e0 == nil,
},
})
}
}
return &FilingType{
AccountID: s.AccountID,
ContactID: s.ContactID,
CreatedByID: s.CreatedByID,
DueDates: dueDates,
FilingCity: s.FilingCity,
FilingCountry: s.FilingCountry,
FilingPostalCode: s.FilingPostalCode,
FilingState: s.FilingState,
FilingStreet: s.FilingStreet,
FormName: s.FormName,
FormVersion: s.FormVersion,
Frequency: s.Frequency,
FullName: s.FullName,
ID: s.ID,
Instances: instances,
LastModifiedByID: s.LastModifiedByID,
Level: s.Level,
Name: s.Name,
OwnerID: s.OwnerID,
SagaType: s.SagaType,
SubmissionMethod: s.SubmissionMethod,
TemplateInstructionsID: s.TemplateInstructionsID,
TemplateReturnID: s.TemplateReturnID,
CreatedDate: sql.NullTime{
Time: createdDate,
Valid: e0 == nil,
},
LastModifiedDate: sql.NullTime{
Time: lastModfiedDate,
Valid: e1 == nil,
},
}
}
func (obj *FilingType) marshal() *regs_models.FilingType {
var instances []*regs_models.FilingTypeInstance
if obj.Instances != nil {
instances = []*regs_models.FilingTypeInstance{}
for _, itm := range obj.Instances {
instances = append(instances, &regs_models.FilingTypeInstance{
CountryID: itm.CountryID,
CountyID: itm.CountyID,
FilingTypeID: itm.FilingTypeID,
ObjectType: itm.ObjectType,
PlaceID: itm.PlaceID,
StateID: itm.StateID,
})
}
}
var dueDates []*regs_models.FilingScheduleItem
if obj.DueDates != nil {
dueDates = []*regs_models.FilingScheduleItem{}
for _, itm := range obj.DueDates {
dueDates = append(dueDates, &regs_models.FilingScheduleItem{
DueDate: itm.DueDate.Time.Format(dateFormat),
Description: itm.Description,
})
}
}
return &regs_models.FilingType{
ID: obj.ID,
AccountID: obj.AccountID,
ContactID: obj.ContactID,
CreatedByID: obj.CreatedByID,
CreatedDate: obj.CreatedDate.Time.Format(dateTimeFormat),
DueDates: dueDates,
FilingCity: obj.FilingCity,
FilingCountry: obj.FilingCountry,
FilingPostalCode: obj.FilingPostalCode,
FilingState: obj.FilingState,
FilingStreet: obj.FilingStreet,
FormName: obj.FormName,
FormVersion: obj.FormVersion,
Frequency: obj.Frequency,
FullName: obj.FullName,
Instances: instances,
LastModifiedByID: obj.LastModifiedByID,
LastModifiedDate: obj.LastModifiedDate.Time.Format(dateTimeFormat),
Level: obj.Level,
Name: obj.Name,
OwnerID: obj.OwnerID,
SagaType: obj.SagaType,
SubmissionMethod: obj.SubmissionMethod,
TemplateInstructionsID: obj.TemplateInstructionsID,
TemplateReturnID: obj.TemplateReturnID,
}
}

View File

@ -6,7 +6,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/regs/regs_models"
)
// FilingTypeChannelWrapper wraps the object with the security principal
// FilingTypeChannelWrapper wraps the object with workflow params
type FilingTypeChannelWrapper struct {
Obj regs_models.FilingType
Principal User

View File

View File

@ -6,7 +6,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/regs/regs_models"
)
// FilingTypeInstanceChannelWrapper wraps the object with the security principal
// FilingTypeInstanceChannelWrapper wraps the object with workflow params
type FilingTypeInstanceChannelWrapper struct {
Obj regs_models.FilingTypeInstance
Principal User

0
app/folder-helpers.go Normal file
View File

View File

@ -4,7 +4,7 @@ import (
"database/sql"
)
// FolderChannelWrapper wraps the object with the security principal
// FolderChannelWrapper wraps the object with workflow params
type FolderChannelWrapper struct {
// Obj workflow_models.Folder
Principal User

73
app/glaccount-helpers.go Normal file
View File

@ -0,0 +1,73 @@
package app
import (
"database/sql"
"time"
"code.tnxs.net/taxnexus/lib/api/ledger/ledger_models"
"github.com/google/uuid"
)
func unMarshalGlAccount(s *ledger_models.GlAccount) *GlAccount {
if s.ID == "" {
s.ID = uuid.New().String()
}
createdDate, err1 := time.Parse(dateTimeFormat, s.CreatedDate)
lastModifiedDate, err2 := time.Parse(dateTimeFormat, s.LastModifiedDate)
return &GlAccount{
ID: s.ID,
AccountID: s.AccountID,
AccountLevel: s.AccountLevel,
AccountName: s.AccountName,
AccountNumber: s.AccountNumber,
AccountSign: s.AccountSign,
AccountType: s.AccountType,
CreatedByID: s.CreatedByID,
Description: s.Description,
IsActive: s.IsActive,
IsBankAccount: s.IsBankAccount,
IsSummary: s.IsSummary,
LastModifiedByID: s.LastModifiedByID,
Name: s.Name,
ParentFK: s.ParentFK,
ParentGlAccountID: s.ParentGLAccountID,
Ref: s.Ref,
Status: s.Status,
TenantID: s.TenantID,
CreatedDate: sql.NullTime{
Time: createdDate,
Valid: err1 == nil,
},
LastModifiedDate: sql.NullTime{
Time: lastModifiedDate,
Valid: err2 == nil,
},
}
}
func (obj *GlAccount) MarshalToSwagger() *ledger_models.GlAccount {
return &ledger_models.GlAccount{
ID: obj.ID,
AccountID: obj.AccountID,
AccountLevel: obj.AccountLevel,
AccountName: obj.AccountName,
AccountNumber: obj.AccountNumber,
AccountSign: obj.AccountSign,
AccountType: obj.AccountType,
Balances: []*ledger_models.GlBalance{},
CreatedByID: obj.CreatedByID,
CreatedDate: obj.CreatedDate.Time.Format(dateTimeFormat),
Description: obj.Description,
IsActive: obj.IsActive,
IsBankAccount: obj.IsBankAccount,
IsSummary: obj.IsSummary,
LastModifiedByID: obj.LastModifiedByID,
LastModifiedDate: obj.LastModifiedDate.Time.Format(dateTimeFormat),
Name: obj.Name,
ParentFK: obj.ParentFK,
ParentGLAccountID: obj.ParentGlAccountID,
Ref: obj.Ref,
Status: obj.Status,
TenantID: obj.TenantID,
}
}

View File

@ -6,7 +6,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/ledger/ledger_models"
)
// GlAccountChannelWrapper wraps the object with the security principal
// GlAccountChannelWrapper wraps the object with workflow params
type GlAccountChannelWrapper struct {
Obj ledger_models.GlAccount
Principal User

71
app/glbalance-helpers.go Normal file
View File

@ -0,0 +1,71 @@
package app
import (
"database/sql"
"time"
"code.tnxs.net/taxnexus/lib/api/ledger/ledger_models"
"github.com/google/uuid"
)
func unMarshalGlBalance(s *ledger_models.GlBalance) *GlBalance {
if s.ID == "" {
s.ID = uuid.New().String()
}
closeDate, err0 := time.Parse(dateTimeFormat, s.CloseDate)
createdDate, err1 := time.Parse(dateTimeFormat, s.CreatedDate)
lastModifiedDate, err2 := time.Parse(dateTimeFormat, s.LastModifiedDate)
return &GlBalance{
ID: s.ID,
AccountName: s.AccountName,
Amount: s.Amount,
CreatedByID: s.CreatedByID,
Credits: s.Credits,
Debits: s.Debits,
Description: s.Description,
GlAccountDisplay: s.GLAccountDisplay,
GlAccountID: s.GLAccountID,
LastModifiedByID: s.LastModifiedByID,
PeriodID: s.PeriodID,
Ref: s.Ref,
RollupCredits: s.RollupCredits,
RollupDebits: s.RollupDebits,
Status: s.Status,
TenantID: s.TenantID,
CloseDate: sql.NullTime{
Time: closeDate,
Valid: err0 == nil,
},
CreatedDate: sql.NullTime{
Time: createdDate,
Valid: err1 == nil,
},
LastModifiedDate: sql.NullTime{
Time: lastModifiedDate,
Valid: err2 == nil,
},
}
}
func (obj *GlBalance) marshalToSwagger() *ledger_models.GlBalance {
return &ledger_models.GlBalance{
ID: obj.ID,
AccountName: obj.AccountName,
Amount: obj.Amount,
CloseDate: obj.CloseDate.Time.Format(dateTimeFormat),
CreatedByID: obj.CreatedByID,
CreatedDate: obj.CreatedDate.Time.Format(dateTimeFormat),
Credits: obj.Credits,
Debits: obj.Debits,
Description: obj.Description,
GLAccountDisplay: obj.GlAccountDisplay,
GLAccountID: obj.GlAccountID,
LastModifiedByID: obj.LastModifiedByID,
LastModifiedDate: obj.LastModifiedDate.Time.Format(dateTimeFormat),
PeriodID: obj.PeriodID,
Ref: obj.Ref,
RollupCredits: obj.RollupCredits,
RollupDebits: obj.RollupDebits,
Status: obj.Status,
TenantID: obj.TenantID,
}
}

View File

@ -6,7 +6,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/ledger/ledger_models"
)
// GlBalanceChannelWrapper wraps the object with the security principal
// GlBalanceChannelWrapper wraps the object with workflow params
type GlBalanceChannelWrapper struct {
Obj ledger_models.GlBalance
Principal User

137
app/ingest-helpers.go Normal file
View File

@ -0,0 +1,137 @@
package app
import (
"database/sql"
"time"
"code.tnxs.net/taxnexus/lib/api/devops/devops_models"
"github.com/google/uuid"
)
// UnmarshalIngest decodes swagger to a first class object
func UnmarshalIngest(s *devops_models.Ingest) *Ingest {
if s.ID == "" {
s.ID = uuid.New().String()
}
createdDate, e0 := time.Parse(dateTimeFormat, s.CreatedDate)
lastModfiedDate, e1 := time.Parse(dateTimeFormat, s.LastModifiedDate)
endDate, e2 := time.Parse(dateTimeFormat, s.EndDate)
startDate, e3 := time.Parse(dateTimeFormat, s.StartDate)
ingestDate, e4 := time.Parse(dateTimeFormat, s.IngestDate)
m1, e5 := time.Parse(dateTimeFormat, s.MetrcLastModifiedEnd)
m2, e6 := time.Parse(dateTimeFormat, s.MetrcLastModifiedStart)
return &Ingest{
ID: s.ID,
AccountID: *s.AccountID,
Amount: s.Amount,
BackendID: s.BackendID,
CompanyID: s.CompanyID,
CreatedByID: s.CreatedByID,
Description: s.Description,
Filename: s.Filename,
IngestFailureReason: s.IngestFailureReason,
IngestType: s.IngestType,
InvoiceCount: s.InvoiceCount,
JobID: s.JobID,
LastModifiedByID: s.LastModifiedByID,
MetrcLicense: s.MetrcLicense,
MetrcSalesReceiptID: s.MetrcSalesreceiptID,
MetrcState: s.MetrcState,
ObjectType: *s.ObjectType,
ParentFK: s.ParentFK,
PeriodID: s.PeriodID,
PoCount: s.POCount,
PostFailureReason: s.PostFalureReason,
RatingEngineID: s.RatingEngineID,
Ref: s.Ref,
RevenueBase: s.RevenueBase,
RevenueNet: s.RevenueNet,
RevenueNotTaxable: s.RevenueNotTaxable,
SagaID: s.SagaID,
SagaType: s.SagaType,
Source: s.Source,
Status: s.Status,
Tax: s.Tax,
TaxOnTax: s.TaxOnTax,
TaxTransactionCount: s.TaxTransactionCount,
TemplateID: s.TemplateID,
TenantID: s.TenantID,
UnitBase: s.UnitBase,
CreatedDate: sql.NullTime{
Time: createdDate,
Valid: e0 == nil,
},
LastModifiedDate: sql.NullTime{
Time: lastModfiedDate,
Valid: e1 == nil,
},
EndDate: sql.NullTime{
Time: endDate,
Valid: e2 == nil,
},
StartDate: sql.NullTime{
Time: startDate,
Valid: e3 == nil,
},
IngestDate: sql.NullTime{
Time: ingestDate,
Valid: e4 == nil,
},
MetrcLastModifiedEnd: sql.NullTime{
Time: m1,
Valid: e5 == nil,
},
MetrcLastModifiedStart: sql.NullTime{
Time: m2,
Valid: e6 == nil,
},
}
}
// MarshalToSwagger encodes a first class object to swagger
func (obj *Ingest) marshalToSwagger() *devops_models.Ingest {
return &devops_models.Ingest{
ID: obj.ID,
AccountID: &obj.AccountID,
Amount: obj.Amount,
BackendID: obj.BackendID,
CompanyID: obj.CompanyID,
CreatedByID: obj.CreatedByID,
CreatedDate: obj.CreatedDate.Time.Format(dateTimeFormat),
Description: obj.Description,
EndDate: obj.EndDate.Time.Format(dateTimeFormat),
Filename: obj.Filename,
IngestDate: obj.IngestDate.Time.Format(dateTimeFormat),
IngestFailureReason: obj.IngestFailureReason,
IngestType: obj.IngestType,
InvoiceCount: obj.InvoiceCount,
JobID: obj.JobID,
LastModifiedByID: obj.LastModifiedByID,
LastModifiedDate: obj.LastModifiedDate.Time.Format(dateTimeFormat),
MetrcLastModifiedEnd: obj.MetrcLastModifiedEnd.Time.Format(dateTimeFormat),
MetrcLastModifiedStart: obj.MetrcLastModifiedStart.Time.Format(dateTimeFormat),
MetrcLicense: obj.MetrcLicense,
MetrcSalesreceiptID: obj.MetrcSalesReceiptID,
MetrcState: obj.MetrcState,
ObjectType: &obj.ObjectType,
ParentFK: obj.ParentFK,
PeriodID: obj.PeriodID,
POCount: obj.PoCount,
PostFalureReason: obj.PostFailureReason,
RatingEngineID: obj.RatingEngineID,
Ref: obj.Ref,
RevenueBase: obj.RevenueBase,
RevenueNet: obj.RevenueNet,
RevenueNotTaxable: obj.RevenueNotTaxable,
SagaID: obj.SagaID,
SagaType: obj.SagaType,
Source: obj.Source,
StartDate: obj.StartDate.Time.Format(dateTimeFormat),
Status: obj.Status,
Tax: obj.Tax,
TaxOnTax: obj.TaxOnTax,
TaxTransactionCount: obj.TaxTransactionCount,
TemplateID: obj.TemplateID,
UnitBase: obj.UnitBase,
}
}

View File

@ -6,7 +6,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/devops/devops_models"
)
// IngestChannelWrapper wraps the object with the security principal
// IngestChannelWrapper wraps the object with workflow params
type IngestChannelWrapper struct {
Obj devops_models.Ingest
Principal User
@ -48,11 +48,15 @@ type Ingest struct {
RevenueBase float64
RevenueNet float64
RevenueNotTaxable float64
SagaID string
SagaType string
Source string
StartDate sql.NullTime
Status string
Tax float64
TaxOnTax float64
TaxTransactionCount int64
TenantID string
TemplateID string
TenantID string
UnitBase int64
}

115
app/invoice-helpers.go Normal file
View File

@ -0,0 +1,115 @@
package app
import "code.tnxs.net/taxnexus/lib/api/ops/ops_models"
// Invoice unMarshal does validation in the Ops microservice only
func (obj *Invoice) marshalToSwagger() *ops_models.Invoice { //nolint:funlen // big object
var items []*ops_models.InvoiceItem
if obj.Items != nil {
items = []*ops_models.InvoiceItem{}
for _, itm := range obj.Items {
items = append(items, itm.MarshalToSwagger())
}
}
var taxTransactions []*ops_models.TaxTransaction
if obj.TaxTransactions != nil {
taxTransactions = []*ops_models.TaxTransaction{}
for _, txn := range obj.TaxTransactions {
taxTransactions = append(taxTransactions, txn.MarshalToSwagger())
}
}
return &ops_models.Invoice{
ID: obj.ID,
AccountID: obj.AccountID,
Advance: obj.Advance,
Amount: obj.Amount,
AmountAdjustment: obj.AmountAdjustment,
AmountDue: obj.AmountDue,
AmountPaid: obj.AmountPaid,
AuditMessage: obj.AuditMessage,
BillingAddress: obj.BillingAddress.MarshalToOps(),
BillingContactID: obj.BillingContact,
BillingRunID: obj.BillingRunID,
BusinessAddress: obj.BusinessAddress.MarshalToOps(),
BusinessTax: obj.BusinessTax,
CannabisTax: obj.CannabisTax,
ContractID: obj.ContractID,
CoordinateID: obj.CoordinateID,
CreatedByID: obj.CreatedByID,
CreatedDate: obj.CreatedDate.Time.Format(dateTimeFormat),
CustomerID: obj.CustomerID,
DateIssued: obj.DateIssued.Time.Format(dateTimeFormat),
DaysDue: obj.DaysDue,
DepositAmount: obj.DepositAmount,
Description: obj.Description,
Discount: obj.Discount,
EstimatedAmount: obj.EstimatedAmount,
EstimatedBusinessTax: obj.EstimatedBusinessTax,
EstimatedCannabisTax: obj.EstimatedCannabisTax,
EstimatedCOGS: obj.EstimatedCOGS,
EstimatedDiscount: obj.EstimatedDiscount,
EstimatedSalesTax: obj.EstimatedSalesTax,
EstimatedSubtotal: obj.EstimatedSubtotal,
IngestID: obj.IngestID,
InvoiceDate: obj.InvoiceDate.Time.Format(dateFormat),
InvoiceNumber: obj.InvoiceNumber,
IsInternational: obj.IsInternational,
IssuedAccountBalance: obj.IssuedAccountBalance,
IssuedAmountDue: obj.IssuedAmountDue,
IssuedByID: obj.IssuedByID,
IsValid: obj.IsValid,
Items: items,
JobID: obj.JobID,
LastModifiedByID: obj.LastModifiedByID,
LastModifiedDate: obj.LastModifiedDate.Time.Format(dateTimeFormat),
MinimumPaymentDue: obj.MinimumPaymentDue,
MonthlyAmount: obj.MonthlyAmount,
OpportunityID: obj.OpportunityID,
OrderID: obj.OrderID,
OverDue0: obj.OverDue0,
OverDue120: obj.OverDue120,
OverDue30: obj.OverDue30,
OverDue45: obj.OverDue45,
OverDue60: obj.OverDue60,
OverDue90: obj.OverDue90,
ParentFK: obj.ParentFK,
PartnerAccountID: obj.PartnerAccountID,
PaymentDue: obj.PaymentDue.Time.Format(dateTimeFormat),
PaymentMethod: obj.PaymentMethodDescription,
PaymentMethodID: obj.PaymentMethodID,
PaymentTerms: obj.PaymentTerms,
PeriodID: obj.PeriodID,
PlaceGeocode: obj.PlaceGeoCode,
Posted: obj.Posted,
PriorAccountBalance: obj.PriorAccountBalance,
PriorAdjustments: obj.PriorAdjustments,
PriorInvoiceAmount: obj.PriorInvoiceAmount,
PriorInvoiceDate: obj.PriorInvoiceDate.Time.Format(dateFormat),
PriorInvoiceID: obj.PriorInvoiceID,
PriorPaymentAmount: obj.PriorPaymentAmount,
PriorPaymentDate: obj.PriorPaymentDate.Time.Format(dateFormat),
PriorPaymentID: obj.PriorPaymentID,
PriorPaymentMemo: obj.PriorPaymentMemo,
Prorated: obj.Prorated,
ProtratedDays: obj.ProratedDays,
PurchaseAmount: obj.PurchaseAmount,
QuoteID: obj.QuoteID,
RatingEngineID: obj.RatingEngineID,
Ref: obj.Ref,
Reference: obj.Reference,
SalesRegulation: obj.SalesRegulation,
SalesTax: obj.SalesTax,
ScheduledPaymentDate: obj.ScheduledPaymentDate.Time.Format(dateFormat),
ServiceTerm: obj.ServiceTerm,
ShippingAddress: obj.ShippingAddress.MarshalToOps(),
ShippingHandling: obj.ShippingHandling,
Status: obj.Status,
Subtotal: obj.Subtotal,
TaxTransactions: taxTransactions,
TelecomTax: obj.TelecomTax,
TemplateID: obj.TemplateID,
Total: obj.Total.MarshalToSwagger(),
Type: obj.Type,
}
}

View File

@ -6,7 +6,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/ops/ops_models"
)
// InvoiceChannelWrapper wraps the object with the security principal
// InvoiceChannelWrapper wraps the object with workflow params
type InvoiceChannelWrapper struct {
Obj ops_models.Invoice
Principal User

View File

@ -0,0 +1,39 @@
package app
import "code.tnxs.net/taxnexus/lib/api/ops/ops_models"
// Invoice unMarshal does validation in the Ops microservice only
func (obj *InvoiceItem) MarshalToSwagger() *ops_models.InvoiceItem {
return &ops_models.InvoiceItem{
ID: obj.ID,
COGS: obj.COGS,
CreatedByID: obj.CreatedByID,
CreatedDate: obj.CreatedDate.Time.Format(dateTimeFormat),
Description: obj.Description,
Family: obj.Family,
InvoiceID: obj.InvoiceID,
LastModifiedByID: obj.LastModifiedByID,
LastModifiedDate: obj.LastModifiedDate.Time.Format(dateTimeFormat),
ListPrice: obj.ListPrice,
MRCInterval: obj.MRCInterval,
OrderItemID: obj.OrderItemID,
ParentFK: obj.ParentFK,
ProductCode: obj.ProductCode,
ProductID: obj.ProductID,
Quantity: obj.Quantity,
QuoteItemID: obj.QuoteItemID,
Ref: obj.Ref,
RejectedQuantity: obj.RejectedQuantity,
ShippedQuantity: obj.ShippedQuantity,
ShippingHandling: obj.ShippingHandling,
SKU: obj.SKU,
SubscriptionID: obj.SubscriptionID,
Subtotal: obj.Subtotal,
TaxnexusCode: obj.TaxnexusCodeDisplay,
TenantID: obj.TenantID,
TotalPrice: obj.TotalPrice,
UnitPrice: obj.UnitPrice,
Units: obj.Units,
}
}

View File

@ -6,7 +6,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/ops/ops_models"
)
// InvoiceItemChannelWrapper wraps the object with the security principal
// InvoiceItemChannelWrapper wraps the object with workflow params
type InvoiceItemChannelWrapper struct {
Obj ops_models.InvoiceItem
Principal User

112
app/job-helpers.go Normal file
View File

@ -0,0 +1,112 @@
package app
import (
"database/sql"
"time"
"code.tnxs.net/taxnexus/lib/api/devops/devops_models"
"github.com/google/uuid"
)
// UnmarshalJob decodes swagger to a first class object
func UnmarshalJob(s *devops_models.Job) *Job {
if s.ID == "" {
s.ID = uuid.New().String()
}
endDate, e2 := time.Parse(dateFormat, s.EndDate)
startDate, e3 := time.Parse(dateFormat, s.StartDate)
createdDate, e0 := time.Parse(dateTimeFormat, s.CreatedDate)
lastModfiedDate, e1 := time.Parse(dateTimeFormat, s.LastModifiedDate)
jobDate, e4 := time.Parse(dateTimeFormat, s.JobDate)
return &Job{
ID: s.ID,
AccountID: *s.AccountID,
BackendID: s.BackendID,
CompanyID: s.CompanyID,
CoordinateID: s.CoordinateID,
CreatedByID: s.CreatedByID,
Duration: *s.Duration,
ErrorReason: s.ErrorReason,
Interval: s.Interval,
LastModifiedByID: s.LastModifiedByID,
Month: s.Month,
NextJobID: s.NextJobID,
OwnerID: s.OwnerID,
Parameters: s.Parameters,
PeriodID: s.PeriodID,
Quarter: s.Quarter,
RatingEngineID: s.RatingEngineID,
Ref: s.Ref,
Reschedule: s.Reschedule,
RescheduleInterval: s.RescheduleInterval,
SagaID: s.SagaID,
SagaType: *s.SagaType,
Semiannual: s.Semiannual,
Source: s.Source,
Status: s.Status,
Target: s.Target,
TenantID: s.TenantID,
Type: *s.SagaType,
Year: s.Year,
CreatedDate: sql.NullTime{
Time: createdDate,
Valid: e0 == nil,
},
LastModifiedDate: sql.NullTime{
Time: lastModfiedDate,
Valid: e1 == nil,
},
EndDate: sql.NullTime{
Time: endDate,
Valid: e2 == nil,
},
StartDate: sql.NullTime{
Time: startDate,
Valid: e3 == nil,
},
JobDate: sql.NullTime{
Time: jobDate,
Valid: e4 == nil,
},
}
}
// MarshalToSwagger encodes a first class object to swagger
func (obj *Job) MarshalToSwagger() *devops_models.Job {
startDate := obj.StartDate.Time.Format(dateTimeFormat)
return &devops_models.Job{
ID: obj.ID,
AccountID: &obj.AccountID,
BackendID: obj.BackendID,
CompanyID: obj.CompanyID,
CoordinateID: obj.CoordinateID,
CreatedByID: obj.CreatedByID,
CreatedDate: obj.CreatedDate.Time.Format(dateTimeFormat),
Duration: &obj.Duration,
EndDate: obj.EndDate.Time.Format(dateTimeFormat),
ErrorReason: obj.ErrorReason,
Interval: obj.Interval,
JobDate: obj.JobDate.Time.Format(dateTimeFormat),
LastModifiedByID: obj.LastModifiedDate.Time.Format(dateTimeFormat),
LastModifiedDate: obj.LastModifiedByID,
Month: obj.Month,
NextJobID: obj.NextJobID,
OwnerID: obj.OwnerID,
Parameters: obj.Parameters,
PeriodID: obj.PeriodID,
Quarter: obj.Quarter,
RatingEngineID: obj.RatingEngineID,
Ref: obj.Ref,
Reschedule: obj.Reschedule,
RescheduleInterval: obj.RescheduleInterval,
SagaID: obj.SagaID,
SagaType: &obj.SagaType,
Semiannual: obj.Semiannual,
Source: obj.Source,
StartDate: startDate,
Status: obj.Status,
Target: obj.Target,
TenantID: obj.TenantID,
Year: obj.Year,
}
}

View File

@ -6,7 +6,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/devops/devops_models"
)
// JobChannelWrapper wraps the object with the security principal
// JobChannelWrapper wraps the object with workflow params
type JobChannelWrapper struct {
Obj devops_models.Job
Principal User
@ -32,7 +32,6 @@ type Job struct {
LastModifiedDate sql.NullTime
Month int64
NextJobID string
ObjectType string
OwnerID string
Parameters string
PeriodID string

View File

@ -0,0 +1,90 @@
package app
import (
"database/sql"
"fmt"
"time"
"code.tnxs.net/taxnexus/lib/api/ledger/ledger_models"
"github.com/google/uuid"
)
func UnMarshalJournalEntry(s *ledger_models.JournalEntry) *JournalEntry {
if s.ID == "" {
s.ID = uuid.New().String()
}
journalDate, dateErr := time.Parse(dateFormat, s.JournalDate)
if dateErr != nil {
err := fmt.Errorf("ledger.unMarshalJournalEntry: 💣 ⛔ journal date error: %w", dateErr)
sugar.Error(err)
return nil
}
createdDate, err1 := time.Parse(dateTimeFormat, s.CreatedDate)
lastModifiedDate, err2 := time.Parse(dateTimeFormat, s.LastModifiedDate)
items := []*JournalItem{}
for _, swagItm := range s.Items {
itm := UnMarshalJournalItem(swagItm)
itm.JournalEntryID = s.ID
items = append(items, itm)
}
return &JournalEntry{
ID: s.ID,
AccountID: s.AccountID,
Balanced: s.Balanced,
CreatedByID: s.CreatedByID,
Credits: s.Credits,
Debits: s.Debits,
Description: s.Description,
IngestID: s.IngestID,
Items: items,
LastModifiedByID: s.LastModifiedDate,
ParentFK: s.ParentFK,
PeriodID: s.PeriodID,
Posted: s.Posted,
Ref: s.Ref,
SalesRegulation: s.SalesRegulation,
Status: s.Status,
TenantID: s.TenantID,
JournalDate: sql.NullTime{
Time: journalDate,
Valid: true,
},
CreatedDate: sql.NullTime{
Time: createdDate,
Valid: err1 == nil,
},
LastModifiedDate: sql.NullTime{
Time: lastModifiedDate,
Valid: err2 == nil,
},
}
}
func (obj *JournalEntry) MarshalToSwagger() *ledger_models.JournalEntry {
swag := &ledger_models.JournalEntry{
ID: obj.ID,
AccountID: obj.AccountID,
Balanced: obj.Balanced,
CreatedByID: obj.CreatedByID,
CreatedDate: obj.CreatedDate.Time.Format(dateTimeFormat),
Credits: obj.Credits,
Debits: obj.Debits,
Description: obj.Description,
IngestID: obj.IngestID,
Items: []*ledger_models.JournalItem{},
JournalDate: obj.JournalDate.Time.Format(dateTimeFormat),
LastModifiedByID: obj.LastModifiedByID,
LastModifiedDate: obj.LastModifiedDate.Time.Format(dateTimeFormat),
ParentFK: obj.ParentFK,
PeriodID: obj.PeriodID,
Posted: obj.Posted,
Ref: obj.Ref,
SalesRegulation: obj.SalesRegulation,
Status: obj.Status,
TenantID: obj.TenantID,
}
for _, itm := range obj.Items {
swag.Items = append(swag.Items, itm.MarshalToSwgger())
}
return swag
}

View File

@ -6,7 +6,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/ledger/ledger_models"
)
// JournalEntryChannelWrapper wraps the object with the security principal
// JournalEntryChannelWrapper wraps the object with workflow params
type JournalEntryChannelWrapper struct {
Obj ledger_models.JournalEntry
Principal User

View File

@ -0,0 +1,72 @@
package app
import (
"database/sql"
"time"
"code.tnxs.net/taxnexus/lib/api/ledger/ledger_models"
"github.com/google/uuid"
)
func UnMarshalJournalItem(s *ledger_models.JournalItem) *JournalItem {
if s.ID == "" {
s.ID = uuid.New().String()
}
createdDate, err1 := time.Parse(dateTimeFormat, s.CreatedDate)
lastModifiedDate, err2 := time.Parse(dateTimeFormat, s.LastModifiedDate)
return &JournalItem{
ID: s.ID,
CreatedByID: s.CreatedByID,
Credit: s.Credit,
Debit: s.Debit,
GlAccountID: s.GLAccountID,
GlAccountDisplay: s.GLAccountDisplay,
GlBalance: s.GLBalanceID,
InvoiceItemID: s.InvoiceItemID,
JournalEntryID: s.JournalEntryID,
LastModifiedByID: s.LastModifiedByID,
PoItemID: s.POItemID,
ProductCode: s.ProducCode,
ProductID: s.ProductID,
ReferenceType: s.ReferenceType,
SalesRegulation: s.SalesRegulation,
TaxnexusCodeID: s.TaxnexusCodeID,
TaxnexusCodeDisplay: s.TaxnexusCodeDisplay,
TaxTransactionID: s.TaxTransactionID,
TenantID: s.TenantID,
CreatedDate: sql.NullTime{
Time: createdDate,
Valid: err1 == nil,
},
LastModifiedDate: sql.NullTime{
Time: lastModifiedDate,
Valid: err2 == nil,
},
}
}
func (obj *JournalItem) MarshalToSwgger() *ledger_models.JournalItem {
return &ledger_models.JournalItem{
ID: obj.ID,
CreatedByID: obj.CreatedByID,
CreatedDate: obj.CreatedDate.Time.Format(dateTimeFormat),
Credit: obj.Credit,
Debit: obj.Debit,
GLAccountDisplay: obj.GlAccountDisplay,
GLAccountID: obj.GlAccountID,
GLBalanceID: obj.GlBalance,
InvoiceItemID: obj.InvoiceItemID,
JournalEntryID: obj.JournalEntryID,
LastModifiedByID: obj.LastModifiedByID,
LastModifiedDate: obj.LastModifiedDate.Time.Format(dateTimeFormat),
POItemID: obj.PoItemID,
ProducCode: obj.ProductCode,
ProductID: obj.ProductID,
ReferenceType: obj.ReferenceType,
SalesRegulation: obj.SalesRegulation,
TaxnexusCodeDisplay: obj.TaxnexusCodeDisplay,
TaxnexusCodeID: obj.TaxnexusCodeID,
TaxTransactionID: obj.TaxTransactionID,
TenantID: obj.TenantID,
}
}

View File

@ -6,7 +6,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/ledger/ledger_models"
)
// JournalItemChannelWrapper wraps the object with the security principal
// JournalItemChannelWrapper wraps the object with workflow params
type JournalItemChannelWrapper struct {
Obj ledger_models.JournalItem
Principal User

86
app/lead-helpers.go Normal file
View File

@ -0,0 +1,86 @@
package app
import (
"database/sql"
"time"
"code.tnxs.net/taxnexus/lib/api/crm/crm_models"
"github.com/google/uuid"
)
func unMarshalLead(s *crm_models.Lead) *Lead {
if s.ID == "" {
s.ID = uuid.New().String()
}
createdDate, e0 := time.Parse(dateTimeFormat, s.CreatedDate)
lastModfiedDate, e1 := time.Parse(dateTimeFormat, s.LastModifiedDate)
return &Lead{
ID: s.ID,
Address: UnMarshalCrmAddress(s.Address),
Company: s.Company,
Description: s.Description,
Email: s.Email,
FirstName: s.FirstName,
LastName: s.LastName,
MobilePhone: s.MobilePhone,
Name: s.Name,
OwnerID: s.OwnerID,
PartnerAccountID: s.PartnerAccountID,
Phone: s.Phone,
ProductID: s.ProductID,
RefererURL: s.RefererURL,
Status: s.Status,
Title: s.Title,
Type: s.Type,
UTMCampaign: s.UTMCampaign,
UTMContent: s.UTMContent,
UTMMedium: s.UTMMedium,
UTMSource: s.UTMSource,
UTMTerm: s.UTMTerm,
Website: s.Website,
CreatedByID: s.CreatedByID,
LastModifiedByID: s.LastModifiedByID,
TenantID: s.TenantID,
CreatedDate: sql.NullTime{
Time: createdDate,
Valid: e0 == nil,
},
LastModifiedDate: sql.NullTime{
Time: lastModfiedDate,
Valid: e1 == nil,
},
}
}
func (obj *Lead) MarshalToSwagger() *crm_models.Lead {
return &crm_models.Lead{
ID: obj.ID,
Address: obj.Address.MarshalToCrm(),
Company: obj.Company,
CreatedByID: obj.CreatedByID,
CreatedDate: obj.CreatedDate.Time.Format(dateTimeFormat),
Description: obj.Description,
Email: obj.Email,
FirstName: obj.FirstName,
LastName: obj.LastName,
LastModifiedByID: obj.LastModifiedByID,
LastModifiedDate: obj.LastModifiedDate.Time.Format(dateTimeFormat),
MobilePhone: obj.MobilePhone,
Name: obj.Name,
OwnerID: obj.OwnerID,
PartnerAccountID: obj.PartnerAccountID,
Phone: obj.Phone,
ProductID: obj.ProductID,
RefererURL: obj.RefererURL,
Status: obj.Status,
TenantID: obj.TenantID,
Title: obj.Title,
Type: obj.Type,
UTMCampaign: obj.UTMCampaign,
UTMContent: obj.UTMContent,
UTMMedium: obj.UTMMedium,
UTMSource: obj.UTMSource,
UTMTerm: obj.UTMTerm,
Website: obj.Website,
}
}

View File

@ -6,7 +6,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/crm/crm_models"
)
// LeadChannelWrapper wraps the object with the security principal
// LeadChannelWrapper wraps the object with workflow params
type LeadChannelWrapper struct {
Obj crm_models.Lead
Principal User
@ -17,7 +17,7 @@ type LeadChannelWrapper struct {
// Lead is a first-class object type
type Lead struct {
ID string
Address Address
Address *Address
Company string
CreatedByID string
CreatedDate sql.NullTime

83
app/license-helpers.go Normal file
View File

@ -0,0 +1,83 @@
package app
import (
"database/sql"
"time"
"code.tnxs.net/taxnexus/lib/api/regs/regs_models"
"github.com/google/uuid"
)
func UnMarshalLicense(s *regs_models.License) *License {
if s.ID == "" {
s.ID = uuid.New().String()
}
createdDate, e0 := time.Parse(dateTimeFormat, s.CreatedDate)
lastModfiedDate, e1 := time.Parse(dateTimeFormat, s.LastModifiedDate)
expirationDate, e2 := time.Parse(dateFormat, s.ExpirationDate)
if e2 != nil {
expirationDate, e2 = time.Parse(dateFormatAlt, s.ExpirationDate)
}
dateIssued, e3 := time.Parse(dateFormat, s.DateIssued)
if e3 != nil {
dateIssued, e3 = time.Parse(dateFormatAlt, s.DateIssued)
}
return &License{
ID: s.ID,
AccountID: s.AccountID,
BackendID: s.BackendID,
ContactID: s.ContactID,
CreatedByID: s.CreatedByID,
Designation: s.Designation,
IsCanceled: s.IsCanceled,
IsRevoked: s.IsRevoked,
LastModifiedByID: s.LastModifiedByID,
LicenseNumber: s.Name,
LicenseTypeID: s.LicenseTypeID,
OwnerID: s.OwnerID,
ParentFK: s.ParentFK,
Ref: s.Ref,
Status: s.Status,
TenantID: s.TenantID,
CreatedDate: sql.NullTime{
Time: createdDate,
Valid: e0 == nil,
},
LastModifiedDate: sql.NullTime{
Time: lastModfiedDate,
Valid: e1 == nil,
},
ExpirationDate: sql.NullTime{
Time: expirationDate,
Valid: e2 == nil,
},
DateIssued: sql.NullTime{
Time: dateIssued,
Valid: e3 == nil,
},
}
}
func (obj *License) MarshalToSwagger() *regs_models.License {
return &regs_models.License{
ID: obj.ID,
AccountID: obj.AccountID,
BackendID: obj.BackendID,
ContactID: obj.ContactID,
CreatedByID: obj.CreatedByID,
CreatedDate: obj.CreatedDate.Time.Format(dateTimeFormat),
DateIssued: obj.DateIssued.Time.Format(dateFormat),
Designation: obj.Designation,
ExpirationDate: obj.ExpirationDate.Time.Format(dateFormat),
IsCanceled: obj.IsCanceled,
IsRevoked: obj.IsRevoked,
LastModifiedByID: obj.LastModifiedByID,
LastModifiedDate: obj.LastModifiedDate.Time.Format(dateTimeFormat),
LicenseTypeID: obj.LicenseTypeID,
Name: obj.LicenseNumber,
OwnerID: obj.OwnerID,
ParentFK: obj.ParentFK,
Ref: obj.Ref,
Status: obj.Status,
TenantID: obj.TenantID,
}
}

View File

@ -6,7 +6,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/regs/regs_models"
)
// LicenseChannelWrapper wraps the object with the security principal
// LicenseChannelWrapper wraps the object with workflow params
type LicenseChannelWrapper struct {
Obj regs_models.License
Principal User

View File

@ -0,0 +1,96 @@
package app
import (
"database/sql"
"time"
"code.tnxs.net/taxnexus/lib/api/regs/regs_models"
"github.com/google/uuid"
)
func UnMarshalLicenseType(s *regs_models.LicenseType) *LicenseType {
if s.ID == "" {
s.ID = uuid.New().String()
}
var jurisdictions []*GeoLicenseTypeInstance
if s.Jurisdictions != nil {
jurisdictions = []*GeoLicenseTypeInstance{}
for _, itm := range s.Jurisdictions {
jurisdictions = append(jurisdictions, &GeoLicenseTypeInstance{
CountryID: itm.CountryID,
CountyID: itm.CountyID,
ObjectType: itm.ObjectType,
PlaceID: itm.PlaceID,
StateID: itm.StateID,
})
}
}
createdDate, e0 := time.Parse(dateTimeFormat, s.CreatedDate)
lastModfiedDate, e1 := time.Parse(dateTimeFormat, s.LastModifiedDate)
return &LicenseType{
ID: s.ID,
AccountID: s.AccountID,
AgentID: s.AgentID,
ContactID: s.ContactID,
Cost: s.Cost,
CreatedByID: s.CreatedByID,
DomainID: s.DomainID,
Domains: s.Domains,
Frequency: s.Frequency,
Jurisdictions: jurisdictions,
LastModifiedByID: s.LastModifiedByID,
Level: s.Level,
MetrcName: s.MetrcName,
Name: s.Name,
PicklistValue: s.PicklistValue,
Ref: s.Ref,
Restriction: s.Restriction,
Tier: s.Tier,
CreatedDate: sql.NullTime{
Time: createdDate,
Valid: e0 == nil,
},
LastModifiedDate: sql.NullTime{
Time: lastModfiedDate,
Valid: e1 == nil,
},
}
}
func (obj *LicenseType) MarshalToSwagger() *regs_models.LicenseType {
var jurisdictions []*regs_models.GeoLicenseTypeInstance
if obj.Jurisdictions != nil {
jurisdictions = []*regs_models.GeoLicenseTypeInstance{}
for _, itm := range obj.Jurisdictions {
jurisdictions = append(jurisdictions, &regs_models.GeoLicenseTypeInstance{
CountryID: itm.CountryID,
CountyID: itm.CountyID,
ObjectType: itm.ObjectType,
PlaceID: itm.PlaceID,
StateID: itm.StateID,
})
}
}
return &regs_models.LicenseType{
ID: obj.ID,
AccountID: obj.AccountID,
AgentID: obj.AgentID,
ContactID: obj.ContactID,
Cost: obj.Cost,
CreatedByID: obj.CreatedByID,
CreatedDate: obj.CreatedDate.Time.Format(dateTimeFormat),
DomainID: obj.DomainID,
Domains: obj.Domains,
Frequency: obj.Frequency,
Jurisdictions: jurisdictions,
LastModifiedByID: obj.LastModifiedByID,
LastModifiedDate: obj.LastModifiedDate.Time.Format(dateTimeFormat),
Level: obj.Level,
MetrcName: obj.MetrcName,
Name: obj.Name,
PicklistValue: obj.PicklistValue,
Ref: obj.Ref,
Restriction: obj.Restriction,
Tier: obj.Tier,
}
}

View File

@ -6,7 +6,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/regs/regs_models"
)
// LicenseTypeChannelWrapper wraps the object with the security principal
// LicenseTypeChannelWrapper wraps the object with workflow params
type LicenseTypeChannelWrapper struct {
Obj regs_models.LicenseType
Principal User
@ -39,7 +39,7 @@ type LicenseType struct {
Tier string
}
// GeoLicenseTypeInstanceChannelWrapper wraps the object with the security principal
// GeoLicenseTypeInstanceChannelWrapper wraps the object with workflow params
type GeoLicenseTypeInstanceChannelWrapper struct {
Obj regs_models.GeoLicenseTypeInstance
Principal User
@ -64,7 +64,7 @@ type GeoLicenseTypeInstance struct {
StateID string
}
// DomainLicenseTypeInstanceChannelWrapper wraps the object with the security principal
// DomainLicenseTypeInstanceChannelWrapper wraps the object with workflow params
type DomainLicenseTypeInstanceChannelWrapper struct {
// Obj regs_models.DomainLicenseTypeInstance
Principal User

View File

@ -2,7 +2,7 @@ package app
import "database/sql"
// LogChannelWrapper wraps the object with the security principal
// LogChannelWrapper wraps the object with workflow params
type LogChannelWrapper struct {
// Obj devops_models.AppLog
Principal User

97
app/notebook-helpers.go Normal file
View File

@ -0,0 +1,97 @@
package app
import (
"database/sql"
"time"
"code.tnxs.net/taxnexus/lib/api/regs/regs_models"
)
func UnMarshalNotebook(s *regs_models.Notebook) *Notebook {
createdDate, e0 := time.Parse(dateTimeFormat, s.CreatedDate)
lastModfiedDate, e1 := time.Parse(dateTimeFormat, s.LastModifiedDate)
date, e2 := time.Parse(dateFormat, s.Date)
datestart, e3 := time.Parse(dateFormat, s.DateStart)
dateend, e4 := time.Parse(dateFormat, s.DateEnd)
var items []*NotebookItem
if s.Items != nil {
items = []*NotebookItem{}
for _, itm := range s.Items {
items = append(items, &NotebookItem{
ID: itm.ID,
ItemName: itm.ItemName,
Title: itm.Title,
NotebookID: itm.NotebookID,
})
}
}
return &Notebook{
ID: s.ID,
AccountID: s.AccountID,
ContactID: s.ContactID,
CreatedByID: s.CreatedByID,
Description: s.Description,
Items: items,
LastModifiedByID: s.LastModifiedByID,
PeriodEndID: s.PeriodEndID,
PeriodStartID: s.PeriodStartID,
PreparerID: s.PreparerID,
TenantID: s.TenantID,
Title: s.Title,
CreatedDate: sql.NullTime{
Time: createdDate,
Valid: e0 == nil,
},
LastModifiedDate: sql.NullTime{
Time: lastModfiedDate,
Valid: e1 == nil,
},
Date: sql.NullTime{
Time: date,
Valid: e2 == nil,
},
DateStart: sql.NullTime{
Time: datestart,
Valid: e3 == nil,
},
DateEnd: sql.NullTime{
Time: dateend,
Valid: e4 == nil,
},
}
}
func (obj Notebook) MarshalToSwagger() *regs_models.Notebook {
var items []*regs_models.NotebookItem
if obj.Items != nil {
items = []*regs_models.NotebookItem{}
for _, itm := range obj.Items {
items = append(items, &regs_models.NotebookItem{
ID: itm.ID,
ItemName: itm.ItemName,
Title: itm.Title,
NotebookID: itm.NotebookID,
})
}
}
return &regs_models.Notebook{
ID: obj.ID,
AccountID: obj.AccountID,
ContactID: obj.ContactID,
CreatedByID: obj.CreatedByID,
CreatedDate: obj.CreatedDate.Time.Format(dateTimeFormat),
Date: obj.Date.Time.Format(dateFormat),
DateEnd: obj.DateEnd.Time.Format(dateFormat),
DateStart: obj.DateStart.Time.Format(dateFormat),
Description: obj.Description,
Items: items,
LastModifiedByID: obj.LastModifiedByID,
LastModifiedDate: obj.LastModifiedDate.Time.Format(dateTimeFormat),
PeriodEndID: obj.PeriodEndID,
PeriodStartID: obj.PeriodStartID,
PreparerID: obj.PreparerID,
TenantID: obj.TenantID,
Title: obj.Title,
}
}

View File

@ -6,7 +6,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/regs/regs_models"
)
// NotebookChannelWrapper wraps the object with the security principal
// NotebookChannelWrapper wraps the object with workflow params
type NotebookChannelWrapper struct {
Obj regs_models.Notebook
Principal User

View File

@ -6,7 +6,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/regs/regs_models"
)
// NotebookItemChannelWrapper wraps the object with the security principal
// NotebookItemChannelWrapper wraps the object with workflow params
type NotebookItemChannelWrapper struct {
Obj regs_models.NotebookItem
Principal User

235
app/order-helpers.go Normal file
View File

@ -0,0 +1,235 @@
package app
import (
"database/sql"
"time"
"code.tnxs.net/taxnexus/lib/api/ops/ops_models"
"github.com/google/uuid"
)
func unMarshalOrder(s *ops_models.Order) *Order { //nolint:funlen // big object
if s.ID == "" {
s.ID = uuid.New().String()
}
var items []*OrderItem
if s.Items != nil {
items = make([]*OrderItem, 5)
for _, itm := range s.Items {
items = append(items, unMarshalOrderItem(itm))
}
}
createdDate, e0 := time.Parse(dateTimeFormat, s.CreatedDate)
lastModifiedDate, e1 := time.Parse(dateTimeFormat, s.LastModifiedDate)
poDate, e2 := time.Parse(dateTimeFormat, s.PODate)
activatedDate, e3 := time.Parse(dateTimeFormat, s.ActivatedDate)
effectiveDate, e4 := time.Parse(dateTimeFormat, s.EffectiveDate)
customerAuthorizedDate, e5 := time.Parse(dateTimeFormat, s.CustomerAuthorizedDate)
companyAuthorizedDate, e6 := time.Parse(dateTimeFormat, s.CompanyAuthorizedDate)
endDate, e7 := time.Parse(dateTimeFormat, s.EndDate)
installationDate, e8 := time.Parse(dateTimeFormat, s.InstallationDate)
contractEndDate, e9 := time.Parse(dateTimeFormat, s.ContractEndDate)
return &Order{
ID: s.ID,
AccountID: s.AccountID,
ActivatedByID: s.ActivatedByID,
Amount: s.Amount,
AmountDue: s.AmountDue,
BillingAddress: UnMarshalOpsAddress(s.BillingAddress),
BillingContactID: s.BillingContactID,
BusinessAddress: UnMarshalOpsAddress(s.BusinessAddress),
BusinessTax: s.BusinessTax,
CannabisTax: s.CannabisTax,
CompanyAuthorizedByID: s.CompanyAuthorizedByID,
Completion: s.Completion,
ContractID: s.ContractID,
CoordinateID: s.CoordinateID,
CreatedByID: s.CreatedByID,
CustomerAuthorizedByID: s.CustomerAuthorizedBy,
CustomerID: s.CustomerID,
Description: s.Description,
Discount: s.Discount,
DiscountAmount: s.DiscountAmount,
EndUserID: s.EndUserID,
EstimatedAmount: s.EstimatedAmount,
EstimatedBusinessTax: s.EstimatedBusinessTax,
EstimatedCannabisTax: s.EstimatedCannabisTax,
EstimatedCOGS: s.EstimatedCOGS,
EstimatedDiscount: s.EstimatedDiscount,
EstimatedSalesTax: s.EstimatedSalesTax,
EstimatedSubtotal: s.EstimatedSubtotal,
IngestID: s.IngestID,
InvoiceID: s.InvoiceID,
IsReductionOrder: s.IsReductionOrder,
Items: items,
JobID: s.JobID,
LastModifiedByID: s.LastModifiedByID,
MonthlyAmount: s.MonthlyAmount,
Open: s.Open,
OpportunityID: s.OpportunityID,
OrderNumber: s.OrderNumber,
OrderReferenceNumber: s.OrderReferenceNumber,
OriginalOrderID: s.OriginalOrderID,
OwnerID: s.OwnerID,
ParentFK: s.ParentFK,
PaymentMethodID: s.PaymentMethodID,
PaymentTerms: s.PaymentTerms,
PeriodID: s.PeriodID,
PlaceGeoCode: s.PlaceGeoCode,
Posted: s.Posted,
ProvisioningStatus: s.ProvisioningStatus,
PurchaseAmount: s.PurchaseAmount,
PurchaseOrderID: s.PurchaseOrderID,
QuoteID: s.QuoteID,
RatingEngineID: s.RatingEngineID,
RecordTypeID: s.RecordTypeID,
Ref: s.Ref,
SalesRegulation: s.SalesRegulation,
SalesTax: s.SalesTax,
ServiceTerm: s.ServiceTerm,
ShippingAddress: UnMarshalOpsAddress(s.ShippingAddress),
ShippingContactID: s.ShippingContactID,
ShippingHandling: s.ShippingHandling,
Status: s.Status,
Subtotal: s.Subtotal,
TelecomTax: s.TelecomTax,
TemplateID: s.TemplateID,
Type: s.Type,
CreatedDate: sql.NullTime{
Time: createdDate,
Valid: e0 == nil,
},
LastModifiedDate: sql.NullTime{
Time: lastModifiedDate,
Valid: e1 == nil,
},
PODate: sql.NullTime{
Time: poDate,
Valid: e2 == nil,
},
ActivatedDate: sql.NullTime{
Time: activatedDate,
Valid: e3 == nil,
},
EffectiveDate: sql.NullTime{
Time: effectiveDate,
Valid: e4 == nil,
},
CustomerAuthorizedDate: sql.NullTime{
Time: customerAuthorizedDate,
Valid: e5 == nil,
},
CompanyAuthorizedDate: sql.NullTime{
Time: companyAuthorizedDate,
Valid: e6 == nil,
},
EndDate: sql.NullTime{
Time: endDate,
Valid: e7 == nil,
},
InstallationDate: sql.NullTime{
Time: installationDate,
Valid: e8 == nil,
},
ContractEndDate: sql.NullTime{
Time: contractEndDate,
Valid: e9 == nil,
},
}
}
func (obj *Order) MarshalToSwagger() *ops_models.Order {
var items []*ops_models.OrderItem
if obj.Items != nil {
items = []*ops_models.OrderItem{}
for _, itm := range obj.Items {
items = append(items, itm.MarshalToSwagger())
}
}
var taxTransactions []*ops_models.TaxTransaction
if obj.TaxTransactions != nil {
taxTransactions = []*ops_models.TaxTransaction{}
for _, txn := range obj.TaxTransactions {
taxTransactions = append(taxTransactions, txn.MarshalToSwagger())
}
}
return &ops_models.Order{
ID: obj.ID,
AccountID: obj.AccountID,
ActivatedByID: obj.ActivatedByID,
ActivatedDate: obj.ActivatedDate.Time.Format(dateTimeFormat),
Amount: obj.Amount,
AmountDue: obj.AmountDue,
BillingAddress: obj.BillingAddress.MarshalToOps(),
BillingContactID: obj.BillingContactID,
BusinessAddress: obj.BusinessAddress.MarshalToOps(),
BusinessTax: obj.BusinessTax,
CannabisTax: obj.CannabisTax,
CompanyAuthorizedByID: obj.CompanyAuthorizedByID,
CompanyAuthorizedDate: obj.CompanyAuthorizedDate.Time.Format(dateTimeFormat),
Completion: obj.Completion,
ContractEndDate: obj.ContractEndDate.Time.Format(dateTimeFormat),
ContractID: obj.ContractID,
CoordinateID: obj.CoordinateID,
CreatedByID: obj.CreatedByID,
CreatedDate: obj.CreatedDate.Time.Format(dateTimeFormat),
CustomerAuthorizedBy: obj.CustomerAuthorizedByID,
CustomerAuthorizedDate: obj.CustomerAuthorizedDate.Time.Format(dateTimeFormat),
CustomerID: obj.CustomerID,
Description: obj.Description,
Discount: obj.Discount,
DiscountAmount: obj.DiscountAmount,
EffectiveDate: obj.EffectiveDate.Time.Format(dateTimeFormat),
EndDate: obj.EndDate.Time.Format(dateTimeFormat),
EndUserID: obj.EndUserID,
EstimatedAmount: obj.EstimatedAmount,
EstimatedBusinessTax: obj.EstimatedBusinessTax,
EstimatedCannabisTax: obj.EstimatedCannabisTax,
EstimatedCOGS: obj.EstimatedCOGS,
EstimatedDiscount: obj.EstimatedDiscount,
EstimatedSalesTax: obj.EstimatedSalesTax,
EstimatedSubtotal: obj.EstimatedSubtotal,
IngestID: obj.IngestID,
InstallationDate: obj.InstallationDate.Time.Format(dateTimeFormat),
InvoiceID: obj.InvoiceID,
IsReductionOrder: obj.IsReductionOrder,
Items: items,
JobID: obj.JobID,
LastModifiedByID: obj.LastModifiedByID,
LastModifiedDate: obj.LastModifiedDate.Time.Format(dateTimeFormat),
MonthlyAmount: obj.MonthlyAmount,
Open: obj.Open,
OpportunityID: obj.OpportunityID,
OrderNumber: obj.OrderNumber,
OrderReferenceNumber: obj.OrderReferenceNumber,
OriginalOrderID: obj.OriginalOrderID,
OwnerID: obj.OwnerID,
ParentFK: obj.ParentFK,
PaymentMethodID: obj.PaymentMethodID,
PaymentTerms: obj.PaymentTerms,
PeriodID: obj.PeriodID,
PlaceGeoCode: obj.PlaceGeoCode,
PODate: obj.PODate.Time.Format(dateTimeFormat),
Posted: obj.Posted,
ProvisioningStatus: obj.ProvisioningStatus,
PurchaseAmount: obj.PurchaseAmount,
PurchaseOrderID: obj.PurchaseOrderID,
QuoteID: obj.QuoteID,
RatingEngineID: obj.RatingEngineID,
RecordTypeID: obj.RecordTypeID,
Ref: obj.Ref,
SalesRegulation: obj.SalesRegulation,
SalesTax: obj.SalesTax,
ServiceTerm: obj.ServiceTerm,
ShippingAddress: obj.ShippingAddress.MarshalToOps(),
ShippingContactID: obj.ShippingContactID,
ShippingHandling: obj.ShippingHandling,
Status: obj.Status,
Subtotal: obj.Subtotal,
TaxTransactions: taxTransactions,
TelecomTax: obj.TelecomTax,
TemplateID: obj.TemplateID,
TenantID: obj.TenantID,
Total: obj.Total.MarshalToSwagger(),
Type: obj.Type,
}
}

View File

@ -6,7 +6,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/ops/ops_models"
)
// OrderChannelWrapper wraps the object with the security principal
// OrderChannelWrapper wraps the object with workflow params
type OrderChannelWrapper struct {
Obj ops_models.Order
Principal User

130
app/orderitem-helpers.go Normal file
View File

@ -0,0 +1,130 @@
package app
import (
"database/sql"
"time"
"code.tnxs.net/taxnexus/lib/api/ops/ops_models"
"github.com/google/uuid"
)
func unMarshalOrderItem(s *ops_models.OrderItem) *OrderItem {
if s.ID == "" {
s.ID = uuid.New().String()
}
createdDate, e0 := time.Parse(dateTimeFormat, s.CreatedDate)
lastModifiedDate, e1 := time.Parse(dateTimeFormat, s.LastModifiedDate)
dateDelivered, e2 := time.Parse(dateTimeFormat, s.DateDelivered)
dateOrdered, e3 := time.Parse(dateTimeFormat, s.DateDelivered)
datePromised, e4 := time.Parse(dateTimeFormat, s.DatePromised)
serviceDate, e5 := time.Parse(dateTimeFormat, s.ServiceDate)
return &OrderItem{
ID: s.ID,
Activated: s.Activated,
ActiveatedByID: s.ActiveatedByID,
AvailableQuantity: s.AvailableQuantity,
COGS: s.COGS,
CreatedByID: s.CreatedByID,
CreateReservation: s.CreateReservation,
Description: s.Description,
Discount: s.Discount,
Family: s.Family,
InvoiceItemID: s.InvoiceItemID,
LastModifiedByID: s.LastModifiedByID,
ListPrice: s.ListPrice,
LocationID: s.LocationID,
MRCInterval: s.MRCInterval,
OrderID: s.OrderID,
OriginalOrderItemID: s.OriginalOrderItemID,
ParentFK: s.ParentFK,
Posted: s.Posted,
ProductCode: s.ProductCode,
ProductID: s.ProductID,
ProductName: s.ProductName,
Quantity: s.Quantity,
QuantityOnHand: s.QuantityOnHand,
QuoteItemID: s.QuoteItemID,
Ref: s.Ref,
ShippingHandling: s.ShippingHandling,
Status: s.Status,
SubscriptionID: s.SubscriptionID,
Subtotal: s.Subtotal,
TaxnexusCodeDisplay: s.TaxnexusCodeDisplay,
TaxnexusCodeID: s.TaxnexusCodeID,
TenantID: s.TenantID,
TotalPrice: s.TotalPrice,
UnitPrice: s.UnitPrice,
Units: s.Units,
CreatedDate: sql.NullTime{
Time: createdDate,
Valid: e0 == nil,
},
LastModifiedDate: sql.NullTime{
Time: lastModifiedDate,
Valid: e1 == nil,
},
DateDelivered: sql.NullTime{
Time: dateDelivered,
Valid: e2 == nil,
},
DateOrdered: sql.NullTime{
Time: dateOrdered,
Valid: e3 == nil,
},
DatePromised: sql.NullTime{
Time: datePromised,
Valid: e4 == nil,
},
ServiceDate: sql.NullTime{
Time: serviceDate,
Valid: e5 == nil,
},
}
}
func (obj *OrderItem) MarshalToSwagger() *ops_models.OrderItem {
return &ops_models.OrderItem{
ID: obj.ID,
Activated: obj.Activated,
ActiveatedByID: obj.ActiveatedByID,
AvailableQuantity: obj.AvailableQuantity,
COGS: obj.COGS,
CreatedByID: obj.CreatedByID,
CreatedDate: obj.CreatedDate.Time.Format(dateTimeFormat),
CreateReservation: obj.CreateReservation,
DateDelivered: obj.DateDelivered.Time.Format(dateTimeFormat),
DateOrdered: obj.DateOrdered.Time.Format(dateTimeFormat),
DatePromised: obj.DatePromised.Time.Format(dateTimeFormat),
Description: obj.Description,
Discount: obj.Discount,
Family: obj.Family,
InvoiceItemID: obj.InvoiceItemID,
LastModifiedByID: obj.LastModifiedByID,
LastModifiedDate: obj.LastModifiedDate.Time.Format(dateTimeFormat),
ListPrice: obj.ListPrice,
LocationID: obj.LocationID,
MRCInterval: obj.MRCInterval,
OrderID: obj.OrderID,
OriginalOrderItemID: obj.OriginalOrderItemID,
ParentFK: obj.ParentFK,
Posted: obj.Posted,
ProductCode: obj.ProductCode,
ProductID: obj.ProductID,
ProductName: obj.ProductName,
Quantity: obj.Quantity,
QuantityOnHand: obj.QuantityOnHand,
QuoteItemID: obj.QuoteItemID,
Ref: obj.Ref,
ServiceDate: obj.ServiceDate.Time.Format(dateTimeFormat),
ShippingHandling: obj.ShippingHandling,
Status: obj.Status,
SubscriptionID: obj.SubscriptionID,
Subtotal: obj.Subtotal,
TaxnexusCodeDisplay: obj.TaxnexusCodeDisplay,
TaxnexusCodeID: obj.TaxnexusCodeID,
TenantID: obj.TenantID,
TotalPrice: obj.TotalPrice,
UnitPrice: obj.UnitPrice,
Units: obj.Units,
}
}

View File

@ -6,7 +6,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/ops/ops_models"
)
// OrderItemChannelWrapper wraps the object with the security principal
// OrderItemChannelWrapper wraps the object with workflow params
type OrderItemChannelWrapper struct {
Obj ops_models.OrderItem
Principal User

View File

@ -0,0 +1,22 @@
package app
import "code.tnxs.net/taxnexus/lib/api/workflow/workflow_models"
func unMarshalSwaggerOutgoingEmailMessage(s *workflow_models.OutgoingEmailMessage) *OutgoingEmailMessage {
return &OutgoingEmailMessage{
ID: s.ID,
BCCAddress: s.BCCAddress,
CCAddress: s.CCAddress,
EmailTemplateID: s.EmailTemplateID,
ExternalID: s.ExternalID,
HTML: []byte(s.HTML),
EmailMessageID: s.EmailMessageID,
FromContactID: s.FromContactID,
FromName: s.FromName,
Subject: s.Subject,
Text: s.Text,
ToAddress: s.ToAddress,
ValidatedFromAddress: s.ValidatedFromAddress,
WhoID: s.WhoID,
}
}

View File

@ -2,7 +2,7 @@ package app
import "code.tnxs.net/taxnexus/lib/api/workflow/workflow_models"
// OutgoingEmailMessageChannelWrapper wraps the object with the security principal
// OutgoingEmailMessageChannelWrapper wraps the object with workflow params
type OutgoingEmailMessageChannelWrapper struct {
Obj workflow_models.OutgoingEmailMessage
Principal User

View File

@ -0,0 +1,14 @@
package app
import "code.tnxs.net/taxnexus/lib/api/workflow/workflow_models"
func (obj *OutgoingEmailMessageReceipt) marshalToSwagger() *workflow_models.EmailMessage {
return &workflow_models.EmailMessage{
ID: obj.ID,
EmailMessageID: obj.EmailMessageID,
Status: obj.Status,
Subject: obj.Subject,
ToAddress: obj.ToAddress,
ValidatedFromAddress: obj.ValidatedFromAddress,
}
}

View File

@ -1,6 +1,6 @@
package app
// OutgoingEmailMessageReceiptChannelWrapper wraps the object with the security principal
// OutgoingEmailMessageReceiptChannelWrapper wraps the object with workflow params
type OutgoingEmailMessageReceiptChannelWrapper struct {
// Obj workflow_models.OutgoingEmailMessageReceipt
Principal User

View File

@ -0,0 +1,88 @@
package app
import (
"database/sql"
"time"
"code.tnxs.net/taxnexus/lib/api/ops/ops_models"
"github.com/google/uuid"
)
func unMarshalPaymentMethod(s *ops_models.PaymentMethod) *PaymentMethod {
if s.ID == "" {
s.ID = uuid.New().String()
}
createdDate, e0 := time.Parse(dateTimeFormat, s.CreatedDate)
lastModfiedDate, e1 := time.Parse(dateTimeFormat, s.LastModifiedDate)
expirationDate, e2 := time.Parse(dateTimeFormat, s.ExpirationDate)
return &PaymentMethod{
ID: s.ID,
AccountID: s.AccountID,
AchAccountType: s.AchAccountType,
AchBankAccount: s.AchBankAccount,
AchRouting: s.AchRouting,
Active: s.Active,
Autopay: s.Autopay,
BankName: s.BankName,
BillingContactID: s.BillingContactID,
CCnumber: s.CCnumber,
CCtype: s.CCtype,
CompanyID: s.CompanyID,
ContractID: s.ContractID,
CreatedByID: s.CreatedByID,
Default: s.Default,
ExpirationMonth: s.ExpirationMonth,
ExpirationYear: s.ExpirationYear,
Gateway: s.Gateway,
GatewayKey: s.GatewayKey,
LastModifiedByID: s.LastModifiedByID,
Nickname: s.Nickname,
RecordType: s.RecordType,
Ref: s.Ref,
TenantID: s.TenantID,
CreatedDate: sql.NullTime{
Time: createdDate,
Valid: e0 == nil,
},
LastModifiedDate: sql.NullTime{
Time: lastModfiedDate,
Valid: e1 == nil,
},
ExpirationDate: sql.NullTime{
Time: expirationDate,
Valid: e2 == nil,
},
}
}
// MarshalToSwagger encodes a first class object to swagger
func (obj *PaymentMethod) MarshalToSwagger() *ops_models.PaymentMethod {
return &ops_models.PaymentMethod{
ID: obj.ID,
AccountID: obj.AccountID,
AchAccountType: obj.AchAccountType,
AchBankAccount: obj.AchBankAccount,
AchRouting: obj.AchRouting,
Active: obj.Active,
Autopay: obj.Autopay,
BankName: obj.BankName,
BillingContactID: obj.BillingContactID,
CCnumber: obj.CCnumber,
CCtype: obj.CCtype,
CompanyID: obj.CompanyID,
ContractID: obj.ContractID,
CreatedByID: obj.CreatedByID,
CreatedDate: obj.CreatedDate.Time.Format(dateTimeFormat),
Default: obj.Default,
ExpirationDate: obj.ExpirationDate.Time.Format(dateTimeFormat),
ExpirationMonth: obj.ExpirationMonth,
ExpirationYear: obj.ExpirationYear,
Gateway: obj.Gateway,
GatewayKey: obj.GatewayKey,
LastModifiedByID: obj.LastModifiedByID,
LastModifiedDate: obj.LastModifiedDate.Time.Format(dateTimeFormat),
Nickname: obj.Nickname,
RecordType: obj.RecordType,
Ref: obj.Ref,
}
}

View File

@ -6,7 +6,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/ops/ops_models"
)
// PaymentMethodChannelWrapper wraps the object with the security principal
// PaymentMethodChannelWrapper wraps the object with workflow params
type PaymentMethodChannelWrapper struct {
Obj ops_models.PaymentMethod
Principal User

Some files were not shown because too many files have changed in this diff Show More