diff --git a/apiV1LenderList.go b/apiV1LenderList.go new file mode 100644 index 0000000..be8a0d4 --- /dev/null +++ b/apiV1LenderList.go @@ -0,0 +1,11 @@ +package main + +import ( + "biukop.com/sfm/loan" + "net/http" +) + +func apiV1LenderList(w http.ResponseWriter, r *http.Request, ss *loan.Session) { + + apiV1SendJson(loan.LenderList(), w, r, ss) +} diff --git a/apiV1PayIn.go b/apiV1PayIn.go index 09b632f..fac9f61 100644 --- a/apiV1PayIn.go +++ b/apiV1PayIn.go @@ -36,7 +36,7 @@ func apiV1PayInPost(w http.ResponseWriter, r *http.Request, ss *loan.Session) { 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()) + log.Error("weird failed to read PayInEx after successfully write PayIn", input, piEx, e.Error()) apiV1Client404Error(w, r, ss) } else { apiV1SendJson(piEx, w, r, ss) diff --git a/apiv1.go b/apiv1.go index bc1d8f3..07017f6 100644 --- a/apiv1.go +++ b/apiv1.go @@ -90,6 +90,8 @@ func setupApiV1Handler() []apiV1HandlerMap { {"DELETE", "upload/", apiV1UploadDelete}, {"POST", "upload-meta-list/", apiV1UploadMetaList}, + {"GET", "lender-list/", apiV1LenderList}, + {"GET", "login", apiV1DumpRequest}, } } else { //production @@ -157,6 +159,8 @@ func setupApiV1Handler() []apiV1HandlerMap { {"DELETE", "upload/", apiV1UploadDelete}, {"POST", "upload-meta-list/", apiV1UploadMetaList}, + {"GET", "lender-list/", apiV1LenderList}, + {"GET", "login", apiV1EmptyResponse}, } } diff --git a/pay-in-decode.go b/pay-in-decode.go index 6c56c1c..d7734a0 100644 --- a/pay-in-decode.go +++ b/pay-in-decode.go @@ -21,7 +21,7 @@ type AiDecodeIncome struct { } type DecodeIncomeDetails struct { - Funders []loan.FunderType + Funders []loan.LenderType AAA []PayInAAARow Connective_ANZ []ConnectiveRow Connective_BOC []ConnectiveRow @@ -43,7 +43,7 @@ func (m *AiDecodeIncome) decodeUploadToPayIn(ulMeta loan.Uploads, allowCachedRes m.Input = ulMeta m.ul.Upload = ulMeta m.PayIn = make([]loan.PayIn, 0, 100) // finalized payIns, generated - m.Funders = make([]loan.FunderType, 0, 50) // array of valid funders + m.Funders = make([]loan.LenderType, 0, 50) // array of valid funders if allowCachedResult { e = m.ReadJson() @@ -126,8 +126,8 @@ func (m *AiDecodeIncome) decodePdf() (e error) { raw := string(out) switch m.detectFunder(raw) { - case loan.Funder_AAA: - m.Funders = append(m.Funders, loan.Funder_AAA) + case loan.Lender_AAA: + m.Funders = append(m.Funders, loan.Lender_AAA) e = m.decodeAAAPdf(raw) // regardless of error, we pump in all available row successed so far for _, row := range m.AAA { @@ -135,7 +135,7 @@ func (m *AiDecodeIncome) decodePdf() (e error) { pi.Id = 0 pi.Ts = row.Period pi.Amount = row.LoanAmount - pi.Lender = loan.Funder_AAA + pi.Lender = loan.Lender_AAA pi.Settlement = row.Settlement pi.Balance = row.Balance pi.OffsetBalance = -1 @@ -145,8 +145,8 @@ func (m *AiDecodeIncome) decodePdf() (e error) { } log.Println("AAA final result", m.AAA) break - case loan.Funder_Unknown: - e = errors.New(loan.Funder_Unknown) + case loan.Lender_Unknown: + e = errors.New(loan.Lender_Unknown) break // not able to detect Funder } return @@ -157,12 +157,12 @@ func (m *AiDecodeIncome) decodeXls() (e error) { return } -func (m *AiDecodeIncome) detectFunder(raw string) loan.FunderType { +func (m *AiDecodeIncome) detectFunder(raw string) loan.LenderType { if m.isAAA(raw) { - return loan.Funder_AAA + return loan.Lender_AAA } - return loan.Funder_Unknown + return loan.Lender_Unknown } func (m *AiDecodeIncome) isAAA(raw string) bool {