Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func ValidateTax(codes []string, data map[string]interface{}) bool {
- isValid := false
- if len(codes)==0 {
- isValid = true
- } else {
- if data["line_items"]!=nil {
- fmt.Println(data["line_items"])
- line_items, _ := data["line_items"].([]interface{})
- fmt.Println(line_items)
- for _, line_item := range line_items {
- i, _ := line_item.(map[string][]interface{})
- if i["taxes"]!=nil {
- for _, tax := range i["taxes"] {
- t := tax.(map[string]interface{})
- if t["code"]!=nil {
- if helper.InArray(t["code"], codes) {
- isValid = true
- }
- }
- }
- } else {
- isValid = true
- }
- }
- } else {
- isValid = true
- }
- }
- return isValid
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement