|
|
|
@@ -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,44 +396,56 @@ 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{}
|
|
|
|
}
|
|
|
|
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
|
|
|
|
address := viewmodel.Address{}
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
address.Address = fmt.Sprintf("%s, %s", header.N301, body.N401)
|
|
|
|
address.Address = fmt.Sprintf("%s, %s", header.N301, body.N401)
|
|
|
|
address.CreatedUserUUID = authUser.ID
|
|
|
|
address.CreatedUserUUID = authUser.ID
|
|
|
|
address.User = user
|
|
|
|
address.User = user
|
|
|
|
|
|
|
|
|
|
|
|
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 {
|
|
|
|
|
|
|
|
fmt.Println("Error to instantiate googles api: ", err.Error())
|
|
|
|
|
|
|
|
return routeutils.ResponseAPINotEligibleError(ctx)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
r := &maps.GeocodingRequest{
|
|
|
|
|
|
|
|
Address: address.Address + " " + body.N402 + ", " + body.N403,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result, err := googleMapsAPI.Geocode(context.Background(), r)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
fmt.Println("Error to instantiate googles api: ", err.Error())
|
|
|
|
|
|
|
|
return routeutils.ResponseAPINotEligibleError(ctx)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if len(result) > 0 {
|
|
|
|
|
|
|
|
address.Latitude = result[0].Geometry.Location.Lat
|
|
|
|
|
|
|
|
address.Longitude = result[0].Geometry.Location.Lng
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_, err := c.svc.Users.SaveAddress(address)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
fmt.Println("Error to instantiate googles api: ", err.Error())
|
|
|
|
fmt.Println("Error to save address: ", err.Error())
|
|
|
|
|
|
|
|
return routeutils.ResponseAPINotEligibleError(ctx)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
r := &maps.GeocodingRequest{
|
|
|
|
//Get ZIP code and check if it is participating
|
|
|
|
Address: address.Address + " " + body.N402 + ", " + body.N403,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result, err := googleMapsAPI.Geocode(context.Background(), r)
|
|
|
|
user, err = c.svc.Users.Create(user, authUser)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
fmt.Println("Error to instantiate googles api: ", err.Error())
|
|
|
|
return routeutils.HandleAPIError(ctx, err)
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if len(result) > 0 {
|
|
|
|
|
|
|
|
address.Latitude = result[0].Geometry.Location.Lat
|
|
|
|
|
|
|
|
address.Longitude = result[0].Geometry.Location.Lng
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_, err := c.svc.Users.SaveAddress(address)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
fmt.Println("Error to save address: ", err.Error())
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return routeutils.ResponseAPIOK(ctx, user)
|
|
|
|
return routeutils.ResponseAPIOK(ctx, user)
|
|
|
|
|