From 3d22cb0f8d261d0ff5223dfc1f8e58320188690e Mon Sep 17 00:00:00 2001 From: Vernon Keenan Date: Wed, 27 Jan 2021 14:45:50 -0800 Subject: [PATCH] fix it --- app/account-services.go | 2 ++ app/company-services.go | 0 app/county-services.go | 5 ++++- app/place-services.go | 14 +++++++++----- app/taxtype-services.go | 9 +++++++++ 5 files changed, 24 insertions(+), 6 deletions(-) delete mode 100644 app/company-services.go diff --git a/app/account-services.go b/app/account-services.go index 27e9964..f8167db 100644 --- a/app/account-services.go +++ b/app/account-services.go @@ -6,6 +6,7 @@ import ( "code.tnxs.net/taxnexus/lib/api/crm/crm_client/accounts" ) +// GetAccount is first class retrieval function func GetAccount(key string, principal *User) Account { if key == "" { return Account{} @@ -21,6 +22,7 @@ func GetAccount(key string, principal *User) Account { return acct } +// GetAccountByID is first class retrieval function func GetAccountByID(recordID string, principal *User) (Account, error) { sugar.Debug("app.GetAccountByID: 📥") if recordID == "" { diff --git a/app/company-services.go b/app/company-services.go deleted file mode 100644 index e69de29..0000000 diff --git a/app/county-services.go b/app/county-services.go index 52a091d..d5ef4a2 100644 --- a/app/county-services.go +++ b/app/county-services.go @@ -7,6 +7,7 @@ import ( "code.tnxs.net/taxnexus/lib/api/geo/geo_models" ) +// GetCountyNameByGeocode is first class retrieval function func GetCountyNameByGeocode(key string, principal *User) string { if key == "" { return "" @@ -26,12 +27,14 @@ func GetCountyNameByGeocode(key string, principal *User) string { if ok { return obj.SalesTaxRate.County } - place, err := getPlaceByGeocode(key, principal) + place, err := GetPlaceByGeocode(key, principal) if err != nil { return "" } return place.SalesTaxRate.County } + +// GetCountyByGeocode is first class retrieval function func GetCountyByGeocode(recordID string, principal *User) (geo_models.County, error) { sugar.Debug("plex.getCountyByGeocode: 📥") if recordID == "" { diff --git a/app/place-services.go b/app/place-services.go index 7b2aacd..ebbaef6 100644 --- a/app/place-services.go +++ b/app/place-services.go @@ -7,7 +7,8 @@ import ( "code.tnxs.net/taxnexus/lib/api/geo/geo_models" ) -func getPlaceNameByGeocode(key string, principal *User) string { +// GetPlaceNameByGeocode is first class retrieval function +func GetPlaceNameByGeocode(key string, principal *User) string { if key == "" || len(key) == 7 { return "" } @@ -15,13 +16,15 @@ func getPlaceNameByGeocode(key string, principal *User) string { if ok { return p.Name } - thePlace, err := getPlaceByGeocode(key, principal) + thePlace, err := GetPlaceByGeocode(key, principal) if err != nil { return "" } return thePlace.Name } -func getPlaceHasDistrictTaxesByGeocode(key string, principal *User) bool { + +// GetPlaceHasDistrictTaxesByGeocode is first class retrieval function +func GetPlaceHasDistrictTaxesByGeocode(key string, principal *User) bool { if key == "" || len(key) == 7 { return false } @@ -29,14 +32,15 @@ func getPlaceHasDistrictTaxesByGeocode(key string, principal *User) bool { if ok { return p.HasDistrictTaxes } - thePlace, err := getPlaceByGeocode(key, principal) + thePlace, err := GetPlaceByGeocode(key, principal) if err != nil { return false } return thePlace.HasDistrictTaxes } -func getPlaceByGeocode(recordID string, principal *User) (geo_models.Place, error) { +// GetPlaceByGeocode is first class retrieval function +func GetPlaceByGeocode(recordID string, principal *User) (geo_models.Place, error) { sugar.Debug("plex.getPlaceByGeocode: 📥") if recordID == "" { return geo_models.Place{}, fmt.Errorf("plex.getPlaceByID: 💣 ⛔ key is blank") diff --git a/app/taxtype-services.go b/app/taxtype-services.go index 7ea114a..80b5cba 100644 --- a/app/taxtype-services.go +++ b/app/taxtype-services.go @@ -32,6 +32,7 @@ var telecomCategories = map[string]string{ "wireless": "wireless", } +// GetTaxType is first class retrieval function func GetTaxType(recordID string, principal *User) *TaxType { obj, ok := taxTypeCache.get(recordID) if ok { @@ -43,6 +44,8 @@ func GetTaxType(recordID string, principal *User) *TaxType { } return obj } + +// GetTaxTypeByID is first class retrieval function func GetTaxTypeByID(recordID string, principal *User) (*TaxType, error) { sugar.Debugf("render.GetTaxTypesByID: 📥") if recordID == "" { @@ -68,6 +71,7 @@ func GetTaxTypeByID(recordID string, principal *User) (*TaxType, error) { return newObj, nil } +// GetCannabisTaxTypes is first class retrieval function func GetCannabisTaxTypes(taxTypes []*TaxType) []*TaxType { objList := []*TaxType{} for _, tt := range taxTypes { @@ -84,6 +88,7 @@ func GetCannabisTaxTypes(taxTypes []*TaxType) []*TaxType { return objList } +// GetExciseTaxTypes is first class retrieval function func GetExciseTaxTypes(taxTypes []*TaxType) []*TaxType { objList := []*TaxType{} for _, tt := range taxTypes { @@ -100,6 +105,7 @@ func GetExciseTaxTypes(taxTypes []*TaxType) []*TaxType { return objList } +// GetBusinessTaxTypes is first class retrieval function func GetBusinessTaxTypes(taxTypes []*TaxType) []*TaxType { objList := []*TaxType{} for _, tt := range taxTypes { @@ -116,6 +122,7 @@ func GetBusinessTaxTypes(taxTypes []*TaxType) []*TaxType { return objList } +// GetMerchTaxTypes is first class retrieval function func GetMerchTaxTypes(taxTypes []*TaxType) []*TaxType { objList := []*TaxType{} for _, tt := range taxTypes { @@ -131,6 +138,8 @@ func GetMerchTaxTypes(taxTypes []*TaxType) []*TaxType { } return objList } + +// GetTelecomTaxTypes is first class retrieval function func GetTelecomTaxTypes(taxTypes []*TaxType) []*TaxType { objList := []*TaxType{} for _, tt := range taxTypes {