Skip to content

Instantly share code, notes, and snippets.

@spksoft
Created February 6, 2018 07:12
Show Gist options
  • Save spksoft/b936deb7b85ae749fe65b383f6c524de to your computer and use it in GitHub Desktop.
Save spksoft/b936deb7b85ae749fe65b383f6c524de to your computer and use it in GitHub Desktop.

ดึงข้อมูล Refinance Product

API Spec

URL

https://finstreet.co/api/search-product

Method

POST

Request Body

{
    "hasInsurance": <boolean>,
    "stepPayment": <boolean>,
    "lockPeriod": <number>,
    "repaymentYear": <string>,
    "sort": <string>,
    "lowerInterest": <boolean>,
    "lowerMonthly": <boolean>,
    "notSure": <boolean>,
    "age": <string>,
    "principal": <string>,
    "propertyWorth": <string>,
    "topup": <string>,
    "hasTopup": <boolean>,
    "monthlyInstallment": <string>,
    "remainingYear": <number>,
    "bankId": <string>,
    "occupation": <string>,
    "lowInstallment": <boolean>,
    "limit": <number>,
    "page": <number>
}

Response Body

{
  "data": {
    "result": [
      {
        "id": <number>,
        "name": <string>,
        "bank": {
          "id": <number>,
          "name": <string>,
          "rateMRR": <number>,
          "pathImage": <string>,
          "createBy": <string>,
          "createDate": <string>,
          "updateBy": <string>,
          "updateDate": <string>,
          "overdueDate": <number>,
        },
        "maxTopup": <number>,
        "year": <number>,
        "finalRound": {
          "mortgage": <number>,
          "countMortgage": <number>,
          "topup": <number>,
          "countTopup": <number>,
          "combine": <number>,
          "countCombine": <number>
        },
        "installment": {
          "mortgage": <number>,
          "countMortgage": <number>,
          "topup": <number>,
          "countTopup": <number>,
          "combine": <number>,
          "countCombine": <number>
        },
        "allYears": {
          "sumInterestPaid": {
            "mortgage": <number>,
            "countMortgage": <number>,
            "topup": <number>,
            "countTopup": <number>,
            "combine": <number>,
            "countCombine": <number>,
          },
          "effectiveInterestRate": {
            "mortgage": <number>,
            "countMortgage": <number>,
            "topup": <number>,
            "countTopup": <number>,
            "combine": <number>,
            "countCombine": <number>
          },
          "count": <number>,
          "principalRepayment": {
            "mortgage": <number>,
            "countMortgage": <number>,
            "topup": <number>,
            "countTopup": <number>,
            "combine": <number>,
            "countCombine": <number>
          },
          "ratePeriod": {
            "float": <boolean>,
            "mlrFloat": <boolean>,
            "rate": <number>,
            "start": <number>,
            "stop": <number>,
          }
        },
        "wholeSaving": <number>,
        "threeYears": {
          "sumInterestPaid": {
            "mortgage": <number>,
            "countMortgage": <number>,
            "topup": <number>,
            "countTopup": <number>,
            "combine": <number>,
            "countCombine": <number>
          },
          "effectiveInterestRate": {
            "mortgage": <number>,
            "countMortgage": <number>,
            "topup": <number>,
            "countTopup": <number>,
            "combine": <number>,
            "countCombine": <number>
          },
          "count": <number>,
          "principalRepayment": {
            "mortgage": <number>,
            "countMortgage": <number>,
            "topup": <number>,
            "countTopup": <number>,
            "combine": <number>,
            "countCombine": <number>
          },
          "ratePeriod": {
            "float": <boolean>,
            "mlrFloat": <boolean>,
            "rate": <number>,
            "start": <number>,
            "stop": <number>,
          }
        },
        "threeYearsSaving": <number>,
        "breakdownResults": [
          {
            "count": <number>,
            "effectiveInterestRate": {
              "mortgage": <number>,
              "countMortgage": <number>,
              "topup": <number>,
              "countTopup": <number>,
              "combine": <number>,
              "countCombine": <number>
            },
            "principalRepayment": {
              "mortgage": <number>,
              "countMortgage": <number>,
              "topup": <number>,
              "countTopup": <number>,
              "combine": <number>,
              "countCombine": <number>
            },
            "ratePeriod": {
              "float": <boolean>,
              "mlrFloat": <boolean>,
              "rate": <number>,
              "start": <number>,
              "stop": <number>,
            },
            "sumInterestPaid": {
              "mortgage": <number>,
              "countMortgage": <number>,
              "topup": <number>,
              "countTopup": <number>,
              "combine": <number>,
              "countCombine": <number>
            }
          }
        ],
        "otherYears": {
          "count": <number>,
          "effectiveInterestRate": {
            "mortgage": <number>,
            "countMortgage": <number>,
            "topup": <number>,
            "countTopup": <number>,
            "combine": <number>,
            "countCombine": <number>
          },
          "principalRepayment": {
            "mortgage": <number>,
            "countMortgage": <number>,
            "topup": <number>,
            "countTopup": <number>,
            "combine": <number>,
            "countCombine": <number>
          },
          "ratePeriod": {
            "float": <boolean>,
            "mlrFloat": <boolean>,
            "rate": <number>,
            "start": <number>,
            "stop": <number>,
          },
          "sumInterestPaid": {
            "mortgage": <number>,
            "countMortgage": <number>,
            "topup": <number>,
            "countTopup": <number>,
            "combine": <number>,
            "countCombine": <number>
          }
        },
        "fee": {
          "appraisalFee": <number>,
          "loanHandlingFee":<number>,
          "revenueStampFee":<number>
        },
        "review": {
          "service": <number>,
          "approvalSpeed": <number>,
          "countReview": <number>
        },
        "mostView": <boolean>,
        "bestMatch": <boolean>,
        "description": <string>,
        "promotion": <string>,
        "general": {
          "effectiveRate": {
            "year1": <number>,
            "year2": <number>,
            "year3": <number>,
            "otherYear": <number>
          },
          "fee": {
            "appraisalFee": <number>,
            "loanHandlingFee": <number>,
            "revenueStampFee": <number>
          },
          "maxLoan": <number>,
        }
      }
    ],
    "paramId": <number>
  },
  "pagination": {
    "currentPage": <number>,
    "totalItems": <number>,
    "itemsPerPage": <number>,
  }
}

Fields Mapping

image of mapping

cURL

curl -X POST \
  https://finstreet.co/api/search-product \
  -H 'Cache-Control: no-cache' \
  -H 'Content-Type: application/json' \
  -d '{
    "hasInsurance":true,
    "stepPayment":false,
    "lockPeriod":0,
    "repaymentYear":"0",
    "sort":"3yearsEffectiveInterestRate",
    "lowerInterest":true,
    "lowerMonthly":false,
    "notSure":false,
    "age":"26",
    "principal":"2800000",
    "propertyWorth":"3200000",
    "topup":"",
    "hasTopup":false,
    "monthlyInstallment":"20000",
    "remainingYear":29,
    "bankId":"1",
    "occupation":"SA",
    "lowInstallment":true,
    "limit":1000,
    "page":0
}'

Usage Recommendation

แนะนำให้ใส่ค่า default ของแต่ล่ะ fields ตามนี้ครับเพื่อที่จะได้ให้ user ไม่ต้อกรอกเยอะ

{
    "hasInsurance":true,
    "stepPayment":false,
    "lockPeriod":0,
    "repaymentYear":"0",
    "sort":"wholeSaving",
    "lowerInterest":true,
    "lowerMonthly":false,
    "notSure":false,
    "age":"รับจาก user",
    "principal":"รับจาก user",
    "propertyWorth":"",
    "topup":"",
    "hasTopup":false,
    "monthlyInstallment":"รับจาก user",
    "remainingYear":รับจาก user,
    "bankId":"5",
    "occupation":"All",
    "lowInstallment":false,
    "limit":1000,
    "page":0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment