Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

36 lines
798B

  1. package main
  2. import (
  3. "biukop.com/sfm/loan"
  4. log "github.com/sirupsen/logrus"
  5. "net/http"
  6. "strconv"
  7. )
  8. func apiV1UploadAnalysis(w http.ResponseWriter, r *http.Request, ss *loan.Session) {
  9. strId := r.URL.Path[len(apiV1Prefix+"upload-analysis/"):] //remove prefix
  10. Id, e := strconv.Atoi(strId)
  11. if e != nil {
  12. log.Error("Invalid uploads Id cannot convert to integer", Id, e)
  13. apiV1Client403Error(w, r, ss)
  14. return
  15. }
  16. ul := loan.Uploads{}
  17. e = ul.Read(int64(Id))
  18. if e != nil {
  19. log.Error("Upload not found or read error from db", Id, e)
  20. apiV1Client404Error(w, r, ss)
  21. return
  22. }
  23. ai := AiDecodeIncome{}
  24. e = ai.decodeUploadToPayIn(ul)
  25. if e != nil {
  26. log.Error("Invalid uploads Id cannot conver to integer", Id, e)
  27. apiV1Server500Error(w, r)
  28. return
  29. }
  30. apiV1SendJson(ai, w, r, ss)
  31. }