selva-riskeval
Version:
Testing One MGA sdk creation
72 lines (66 loc) • 2.31 kB
JavaScript
const axios = require('axios')
export default class InsuranceRiskEval{
apiKey;
baseURL='https://vz1z84zy6f.execute-api.us-west-2.amazonaws.com/assess_risk/'
#headers={
'Content-Type': 'application/json'
}
constructor(apiKey , url){
this.apiKey= apiKey
}
async assesRisk(data){
try{
// let response = await axios.post(this.baseURL,data,this.#headers)
let mockResponse = {
"_id": "2ed333df-ea3b-4924-acd9-f14edff5d2b3"
}
return mockResponse['_id'];
}catch(err){
throw Error(err.message)
}
}
async getRiskEvalResult(id){
try{
// await axios.get(this.baseURL+id,this.#headers)
let mockResponse ={
"risk_pricing": {
"icc_premium_with_crs_discount": 3.4,
"subtotal_with_reserve": 298.33,
"primary_residence_indicator": "Yes",
"coverage_limit": 250000,
"coverage_deductible": 1250,
"premium_with_fees": 398.33,
"hfiaa_surcharge": 50,
"prior_claims_premium": 0,
"coverage_value": 250000,
"federal_policy_fee": 50,
"probation_surcharge": 0,
"reserve_fund": 1.15,
"subtotal": 294.93,
"icc_premium": 4
},
"risk_scoring": {
"tsunami": 0,
"coastal_erosion": 0.1,
"inland_flood": 0.3,
"great_lakes": 0,
"rating_engine_id": "FEMA34123",
"rating_engine_name": "FEMA_V1.0",
"acturial_analysis": "",
"storm_surge": 0
},
"product": {
"product_type": "flood",
"product_id": "FLR100008",
"description": "Flood Insurance",
"category": "dwelling"
},
"status": "completed"
}
return mockResponse
}catch(err){
throw Error(err.message)
}
}
}
// export {RiskEval}