| @@ -33,7 +33,14 @@ func apiV1PayInPost(w http.ResponseWriter, r *http.Request, ss *loan.Session) { | |||
| log.Error("cannot save basic loan", e.Error()) | |||
| apiV1Client404Error(w, r, ss) | |||
| } else { | |||
| apiV1SendJson(input, w, r, ss) | |||
| piEx := loan.PayInEx{} | |||
| e = piEx.Read(input.Id) | |||
| if e != nil { | |||
| log.Error("weird failed to read PayInEx after successfuly write PayIn", input, piEx, e.Error()) | |||
| apiV1Client404Error(w, r, ss) | |||
| } else { | |||
| apiV1SendJson(piEx, w, r, ss) | |||
| } | |||
| } | |||
| } | |||
| @@ -29,7 +29,7 @@ func apiV1UploadAnalysis(w http.ResponseWriter, r *http.Request, ss *loan.Sessio | |||
| analysisMutex.Lock() | |||
| ai := AiDecodeIncome{} | |||
| e = ai.decodeUploadToPayIn(ul, true) | |||
| e = ai.decodeUploadToPayIn(ul, false) | |||
| analysisMutex.Unlock() | |||
| if e != nil { | |||
| log.Error("Invalid uploads Id cannot convert to integer", Id, e) | |||
| @@ -129,6 +129,7 @@ func (m *AiDecodeIncome) decodePdf() (e error) { | |||
| case loan.Funder_AAA: | |||
| m.Funders = append(m.Funders, loan.Funder_AAA) | |||
| e = m.decodeAAAPdf(raw) | |||
| // regardless of error, we pump in all available row successed so far | |||
| for _, row := range m.AAA { | |||
| pi := loan.PayIn{} | |||
| pi.Id = 0 | |||
| @@ -140,7 +141,6 @@ func (m *AiDecodeIncome) decodePdf() (e error) { | |||
| pi.OffsetBalance = -1 | |||
| pi.IncomeAmount = row.InTrail | |||
| pi.IncomeType = "Trail" | |||
| m.PayIn = append(m.PayIn, pi) | |||
| } | |||
| log.Println("AAA final result", m.AAA) | |||
| @@ -10,6 +10,6 @@ func TestDecodePayInMain(t *testing.T) { | |||
| ai := AiDecodeIncome{} | |||
| ul := loan.Uploads{} | |||
| ul.Read(30) | |||
| _ = ai.decodeUploadToPayIn(ul) | |||
| _ = ai.decodeUploadToPayIn(ul, false) | |||
| log.Println(ai) | |||
| } | |||