Compare commits
4 Commits
verify-eli
...
check-zip-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
924ddaded1 | ||
|
|
d6301ebbf3 | ||
|
|
78d6a45ebb | ||
|
|
22a79cf658 |
@@ -62,4 +62,4 @@ func (c *zipcodeRepo) GetAll() ([]entity.Zipcode, error) {
|
||||
|
||||
func (c *zipcodeRepo) GetByParticipatingZipcode(zipcode string) (entity.Zipcode, error) {
|
||||
return c.parseEntity(c.conn.QueryRow(c.getQuery()+"WHERE a.participating = 1 AND a.zipcode = ?", zipcode))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,12 +92,11 @@ func ResponseAPINotFoundError(c echo.Context) error {
|
||||
return ResponseAPIError(c, http.StatusNotFound, "Not Found", false)
|
||||
}
|
||||
|
||||
//ResponseAPINotEligibleError returns a standard API not eligible to the response
|
||||
//ResponseAPINotEligible returns a standard API not eligible to the response
|
||||
func ResponseAPINotEligibleError(c echo.Context) error {
|
||||
return ResponseAPIError(c, http.StatusForbidden, "Member does not have active insurance coverage", false)
|
||||
return ResponseAPIError(c, http.StatusForbidden, "Eligibility Not Found or Error", false)
|
||||
}
|
||||
|
||||
//ResponseAPINotEligibleWithMessageError returns a standard API not eligible to the response with custom message
|
||||
func ResponseAPINotEligibleWithMessageError(c echo.Context, message string) error {
|
||||
return ResponseAPIError(c, http.StatusForbidden, message, false)
|
||||
}
|
||||
|
||||
@@ -420,7 +420,7 @@ func (c *controller) handleMember(ctx echo.Context) error {
|
||||
client := &http.Client{}
|
||||
eligibilityJson, err := json.Marshal(eligibility)
|
||||
if err != nil {
|
||||
return routeutils.ResponseAPINotEligibleError(ctx)
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
req, _ := http.NewRequest("POST", c.cfg.Eligibility.Url, bytes.NewBuffer(eligibilityJson))
|
||||
req.Header.Add("App", c.cfg.HTTP.Auth.AppKey)
|
||||
@@ -429,24 +429,24 @@ func (c *controller) handleMember(ctx echo.Context) error {
|
||||
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
return routeutils.ResponseAPINotEligibleError(ctx)
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode < 200 || resp.StatusCode > 300 {
|
||||
return routeutils.ResponseAPINotEligibleError(ctx)
|
||||
return routeutils.ResponseAPINotEligibleWithMessageError(ctx, "Cannot check eligibility")
|
||||
}
|
||||
|
||||
eligibilityResponse := viewmodel.Interchange271{}
|
||||
decoder := json.NewDecoder(resp.Body)
|
||||
err = decoder.Decode(&eligibilityResponse)
|
||||
if err != nil {
|
||||
return routeutils.ResponseAPINotEligibleError(ctx)
|
||||
return routeutils.ResponseAPINotEligibleWithMessageError(ctx, "Cannot check eligibility")
|
||||
}
|
||||
//================================================================
|
||||
|
||||
if len(eligibilityResponse.Division.HealthCareEligibilityResponse.LoopHL0030) < 1 {
|
||||
return routeutils.ResponseAPINotEligibleError(ctx)
|
||||
return routeutils.ResponseAPINotEligibleWithMessageError(ctx, "Cannot check eligibility")
|
||||
}
|
||||
|
||||
address := viewmodel.Address{}
|
||||
|
||||
Reference in New Issue
Block a user