Advertisement
Guest User

sdfsdf

a guest
Jan 24th, 2020
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. func ValidateTax(codes []string, data map[string]interface{}) bool {
  2. isValid := false
  3. if len(codes)==0 {
  4. isValid = true
  5. } else {
  6. if data["line_items"]!=nil {
  7. fmt.Println(data["line_items"])
  8. line_items, _ := data["line_items"].([]interface{})
  9. fmt.Println(line_items)
  10. for _, line_item := range line_items {
  11. i, _ := line_item.(map[string][]interface{})
  12. if i["taxes"]!=nil {
  13. for _, tax := range i["taxes"] {
  14. t := tax.(map[string]interface{})
  15. if t["code"]!=nil {
  16. if helper.InArray(t["code"], codes) {
  17. isValid = true
  18. }
  19. }
  20. }
  21. } else {
  22. isValid = true
  23. }
  24. }
  25. } else {
  26. isValid = true
  27. }
  28. }
  29. return isValid
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement