v0.1.36
Vernon Keenan 2021-01-27 14:45:50 -08:00
parent b61112d1e3
commit 3d22cb0f8d
5 changed files with 24 additions and 6 deletions

View File

@ -6,6 +6,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/crm/crm_client/accounts" "code.tnxs.net/taxnexus/lib/api/crm/crm_client/accounts"
) )
// GetAccount is first class retrieval function
func GetAccount(key string, principal *User) Account { func GetAccount(key string, principal *User) Account {
if key == "" { if key == "" {
return Account{} return Account{}
@ -21,6 +22,7 @@ func GetAccount(key string, principal *User) Account {
return acct return acct
} }
// GetAccountByID is first class retrieval function
func GetAccountByID(recordID string, principal *User) (Account, error) { func GetAccountByID(recordID string, principal *User) (Account, error) {
sugar.Debug("app.GetAccountByID: 📥") sugar.Debug("app.GetAccountByID: 📥")
if recordID == "" { if recordID == "" {

View File

@ -7,6 +7,7 @@ import (
"code.tnxs.net/taxnexus/lib/api/geo/geo_models" "code.tnxs.net/taxnexus/lib/api/geo/geo_models"
) )
// GetCountyNameByGeocode is first class retrieval function
func GetCountyNameByGeocode(key string, principal *User) string { func GetCountyNameByGeocode(key string, principal *User) string {
if key == "" { if key == "" {
return "" return ""
@ -26,12 +27,14 @@ func GetCountyNameByGeocode(key string, principal *User) string {
if ok { if ok {
return obj.SalesTaxRate.County return obj.SalesTaxRate.County
} }
place, err := getPlaceByGeocode(key, principal) place, err := GetPlaceByGeocode(key, principal)
if err != nil { if err != nil {
return "" return ""
} }
return place.SalesTaxRate.County return place.SalesTaxRate.County
} }
// GetCountyByGeocode is first class retrieval function
func GetCountyByGeocode(recordID string, principal *User) (geo_models.County, error) { func GetCountyByGeocode(recordID string, principal *User) (geo_models.County, error) {
sugar.Debug("plex.getCountyByGeocode: 📥") sugar.Debug("plex.getCountyByGeocode: 📥")
if recordID == "" { if recordID == "" {

View File

@ -7,7 +7,8 @@ import (
"code.tnxs.net/taxnexus/lib/api/geo/geo_models" "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 { if key == "" || len(key) == 7 {
return "" return ""
} }
@ -15,13 +16,15 @@ func getPlaceNameByGeocode(key string, principal *User) string {
if ok { if ok {
return p.Name return p.Name
} }
thePlace, err := getPlaceByGeocode(key, principal) thePlace, err := GetPlaceByGeocode(key, principal)
if err != nil { if err != nil {
return "" return ""
} }
return thePlace.Name 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 { if key == "" || len(key) == 7 {
return false return false
} }
@ -29,14 +32,15 @@ func getPlaceHasDistrictTaxesByGeocode(key string, principal *User) bool {
if ok { if ok {
return p.HasDistrictTaxes return p.HasDistrictTaxes
} }
thePlace, err := getPlaceByGeocode(key, principal) thePlace, err := GetPlaceByGeocode(key, principal)
if err != nil { if err != nil {
return false return false
} }
return thePlace.HasDistrictTaxes 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: 📥") sugar.Debug("plex.getPlaceByGeocode: 📥")
if recordID == "" { if recordID == "" {
return geo_models.Place{}, fmt.Errorf("plex.getPlaceByID: 💣 ⛔ key is blank") return geo_models.Place{}, fmt.Errorf("plex.getPlaceByID: 💣 ⛔ key is blank")

View File

@ -32,6 +32,7 @@ var telecomCategories = map[string]string{
"wireless": "wireless", "wireless": "wireless",
} }
// GetTaxType is first class retrieval function
func GetTaxType(recordID string, principal *User) *TaxType { func GetTaxType(recordID string, principal *User) *TaxType {
obj, ok := taxTypeCache.get(recordID) obj, ok := taxTypeCache.get(recordID)
if ok { if ok {
@ -43,6 +44,8 @@ func GetTaxType(recordID string, principal *User) *TaxType {
} }
return obj return obj
} }
// GetTaxTypeByID is first class retrieval function
func GetTaxTypeByID(recordID string, principal *User) (*TaxType, error) { func GetTaxTypeByID(recordID string, principal *User) (*TaxType, error) {
sugar.Debugf("render.GetTaxTypesByID: 📥") sugar.Debugf("render.GetTaxTypesByID: 📥")
if recordID == "" { if recordID == "" {
@ -68,6 +71,7 @@ func GetTaxTypeByID(recordID string, principal *User) (*TaxType, error) {
return newObj, nil return newObj, nil
} }
// GetCannabisTaxTypes is first class retrieval function
func GetCannabisTaxTypes(taxTypes []*TaxType) []*TaxType { func GetCannabisTaxTypes(taxTypes []*TaxType) []*TaxType {
objList := []*TaxType{} objList := []*TaxType{}
for _, tt := range taxTypes { for _, tt := range taxTypes {
@ -84,6 +88,7 @@ func GetCannabisTaxTypes(taxTypes []*TaxType) []*TaxType {
return objList return objList
} }
// GetExciseTaxTypes is first class retrieval function
func GetExciseTaxTypes(taxTypes []*TaxType) []*TaxType { func GetExciseTaxTypes(taxTypes []*TaxType) []*TaxType {
objList := []*TaxType{} objList := []*TaxType{}
for _, tt := range taxTypes { for _, tt := range taxTypes {
@ -100,6 +105,7 @@ func GetExciseTaxTypes(taxTypes []*TaxType) []*TaxType {
return objList return objList
} }
// GetBusinessTaxTypes is first class retrieval function
func GetBusinessTaxTypes(taxTypes []*TaxType) []*TaxType { func GetBusinessTaxTypes(taxTypes []*TaxType) []*TaxType {
objList := []*TaxType{} objList := []*TaxType{}
for _, tt := range taxTypes { for _, tt := range taxTypes {
@ -116,6 +122,7 @@ func GetBusinessTaxTypes(taxTypes []*TaxType) []*TaxType {
return objList return objList
} }
// GetMerchTaxTypes is first class retrieval function
func GetMerchTaxTypes(taxTypes []*TaxType) []*TaxType { func GetMerchTaxTypes(taxTypes []*TaxType) []*TaxType {
objList := []*TaxType{} objList := []*TaxType{}
for _, tt := range taxTypes { for _, tt := range taxTypes {
@ -131,6 +138,8 @@ func GetMerchTaxTypes(taxTypes []*TaxType) []*TaxType {
} }
return objList return objList
} }
// GetTelecomTaxTypes is first class retrieval function
func GetTelecomTaxTypes(taxTypes []*TaxType) []*TaxType { func GetTelecomTaxTypes(taxTypes []*TaxType) []*TaxType {
objList := []*TaxType{} objList := []*TaxType{}
for _, tt := range taxTypes { for _, tt := range taxTypes {