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"
)
// 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 == "" {

View File

@ -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 == "" {

View File

@ -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")

View File

@ -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 {