custom elig. api error msg ; first check elig. then create user
This commit is contained in:
@@ -92,6 +92,11 @@ func ResponseAPINotFoundError(c echo.Context) error {
|
|||||||
return ResponseAPIError(c, http.StatusNotFound, "Not Found", false)
|
return ResponseAPIError(c, http.StatusNotFound, "Not Found", false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//ResponseAPINotEligible returns a standard API not eligible to the response
|
||||||
|
func ResponseAPINotEligibleError(c echo.Context) error {
|
||||||
|
return ResponseAPIError(c, http.StatusForbidden, "Eligibility Not Found or Error", false)
|
||||||
|
}
|
||||||
|
|
||||||
func ignoreDefaultWrappedErrors(c echo.Context, errorToHandle *errors.WrappedError, handler func(echo.Context, error) error) error {
|
func ignoreDefaultWrappedErrors(c echo.Context, errorToHandle *errors.WrappedError, handler func(echo.Context, error) error) error {
|
||||||
err := errorToHandle.GetOriginalError()
|
err := errorToHandle.GetOriginalError()
|
||||||
|
|
||||||
|
|||||||
@@ -332,6 +332,7 @@ func (c *controller) handleGetPortal(ctx echo.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *controller) handleMember(ctx echo.Context) error {
|
func (c *controller) handleMember(ctx echo.Context) error {
|
||||||
|
fmt.Println("\n\nHandle member\n\n")
|
||||||
var user viewmodel.User
|
var user viewmodel.User
|
||||||
if err := ctx.Bind(&user); err != nil {
|
if err := ctx.Bind(&user); err != nil {
|
||||||
return routeutils.HandleAPIError(ctx, err)
|
return routeutils.HandleAPIError(ctx, err)
|
||||||
@@ -382,11 +383,6 @@ func (c *controller) handleMember(ctx echo.Context) error {
|
|||||||
}
|
}
|
||||||
user.Profiles = append(user.Profiles, profile)
|
user.Profiles = append(user.Profiles, profile)
|
||||||
|
|
||||||
user, err = c.svc.Users.Create(user, authUser)
|
|
||||||
if err != nil {
|
|
||||||
return routeutils.HandleAPIError(ctx, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
eligibility := viewmodel.Eligibility{}
|
eligibility := viewmodel.Eligibility{}
|
||||||
eligibility.Provider.ProviderNPI = "1699849786"
|
eligibility.Provider.ProviderNPI = "1699849786"
|
||||||
eligibility.Provider.ProviderName = "LITHOLINK CORPORATION"
|
eligibility.Provider.ProviderName = "LITHOLINK CORPORATION"
|
||||||
@@ -400,14 +396,20 @@ func (c *controller) handleMember(ctx echo.Context) error {
|
|||||||
eligibility.ServiceInfo.DateOfService = time.Now()
|
eligibility.ServiceInfo.DateOfService = time.Now()
|
||||||
eligibility.ServiceInfo.ServiceTypeCodes = []string{"30"}
|
eligibility.ServiceInfo.ServiceTypeCodes = []string{"30"}
|
||||||
|
|
||||||
|
fmt.Println("\n\nGet271\n\n")
|
||||||
resp, err := c.bcbsi.BXE.Get271(eligibility)
|
resp, err := c.bcbsi.BXE.Get271(eligibility)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Eligibility Not Found or Error: ", err.Error())
|
fmt.Println("Eligibility Not Found or Error: ", err.Error())
|
||||||
} else {
|
return routeutils.ResponseAPINotEligibleError(ctx)
|
||||||
|
}
|
||||||
|
|
||||||
address := viewmodel.Address{}
|
address := viewmodel.Address{}
|
||||||
header := resp.Division.HealthCareEligibilityResponse.LoopHL0030[0].HL_0460[0].HL_0890[0].NM1_0920[0].N3_0950
|
header := resp.Division.HealthCareEligibilityResponse.LoopHL0030[0].HL_0460[0].HL_0890[0].NM1_0920[0].N3_0950
|
||||||
body := resp.Division.HealthCareEligibilityResponse.LoopHL0030[0].HL_0460[0].HL_0890[0].NM1_0920[0].N4_0960
|
body := resp.Division.HealthCareEligibilityResponse.LoopHL0030[0].HL_0460[0].HL_0890[0].NM1_0920[0].N4_0960
|
||||||
|
|
||||||
|
fmt.Println("\n\n",header.N301,"\n\n---\n",body.N401)
|
||||||
|
return routeutils.ResponseAPIAuthError(ctx, "STOPPED HERE INTENTIONALLY", false)
|
||||||
|
|
||||||
address.AddressTypeName = "Home"
|
address.AddressTypeName = "Home"
|
||||||
address.AddressType = "home"
|
address.AddressType = "home"
|
||||||
address.Name = fmt.Sprintf("%s, %s", header.N301, body.N401)
|
address.Name = fmt.Sprintf("%s, %s", header.N301, body.N401)
|
||||||
@@ -418,6 +420,7 @@ func (c *controller) handleMember(ctx echo.Context) error {
|
|||||||
googleMapsAPI, err := maps.NewClient(maps.WithClientIDAndSignature("gme-bluecrossandblue1", "msqgD-jdqCyR0M_1u5C1HION5iI="))
|
googleMapsAPI, err := maps.NewClient(maps.WithClientIDAndSignature("gme-bluecrossandblue1", "msqgD-jdqCyR0M_1u5C1HION5iI="))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Error to instantiate googles api: ", err.Error())
|
fmt.Println("Error to instantiate googles api: ", err.Error())
|
||||||
|
return routeutils.ResponseAPINotEligibleError(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
r := &maps.GeocodingRequest{
|
r := &maps.GeocodingRequest{
|
||||||
@@ -427,6 +430,7 @@ func (c *controller) handleMember(ctx echo.Context) error {
|
|||||||
result, err := googleMapsAPI.Geocode(context.Background(), r)
|
result, err := googleMapsAPI.Geocode(context.Background(), r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Error to instantiate googles api: ", err.Error())
|
fmt.Println("Error to instantiate googles api: ", err.Error())
|
||||||
|
return routeutils.ResponseAPINotEligibleError(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(result) > 0 {
|
if len(result) > 0 {
|
||||||
@@ -436,8 +440,13 @@ func (c *controller) handleMember(ctx echo.Context) error {
|
|||||||
_, err := c.svc.Users.SaveAddress(address)
|
_, err := c.svc.Users.SaveAddress(address)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Error to save address: ", err.Error())
|
fmt.Println("Error to save address: ", err.Error())
|
||||||
|
return routeutils.ResponseAPINotEligibleError(ctx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
user, err = c.svc.Users.Create(user, authUser)
|
||||||
|
if err != nil {
|
||||||
|
return routeutils.HandleAPIError(ctx, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return routeutils.ResponseAPIOK(ctx, user)
|
return routeutils.ResponseAPIOK(ctx, user)
|
||||||
|
|||||||
Reference in New Issue
Block a user