diff --git a/apiV1PayIn.go b/apiV1PayIn.go index fac9f61..ce70084 100644 --- a/apiV1PayIn.go +++ b/apiV1PayIn.go @@ -6,6 +6,7 @@ import ( log "github.com/sirupsen/logrus" "net/http" "strconv" + "time" ) func decodeJsonPayInEdit(r *http.Request) (ret loan.PayIn, e error) { @@ -28,6 +29,13 @@ func apiV1PayInPost(w http.ResponseWriter, r *http.Request, ss *loan.Session) { apiV1Client404Error(w, r, ss) return } else { + lowerBound, _ := time.Parse("2006-01-02", "1900-01-01") + if input.Settlement.Before(lowerBound) { + input.Settlement = lowerBound + } + if input.Ts.Before(lowerBound) { + input.Ts = time.Now() + } e = input.Write() if e != nil { log.Error("cannot save basic loan", e.Error())