소스 검색

Lender list is casted into coin

master
sp 4 년 전
부모
커밋
220ce9397d
4개의 변경된 파일26개의 추가작업 그리고 11개의 파일을 삭제
  1. +11
    -0
      apiV1LenderList.go
  2. +1
    -1
      apiV1PayIn.go
  3. +4
    -0
      apiv1.go
  4. +10
    -10
      pay-in-decode.go

+ 11
- 0
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)
}

+ 1
- 1
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)

+ 4
- 0
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},
}
}

+ 10
- 10
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 {

Loading…
취소
저장