Compare commits
1 Commits
self-regis
...
ZIP-partic
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ecf57cdc30 |
@@ -2,7 +2,6 @@ package selfregisterroute
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
b64 "encoding/base64"
|
b64 "encoding/base64"
|
||||||
@@ -23,10 +22,6 @@ const (
|
|||||||
notificationSmsBody = "You have registered as a Visit Reporter for CHM NEMT. Login: https://portal.bcbsinstitute.com Reset PW: https://portal.bcbsinstitute.com/forgot"
|
notificationSmsBody = "You have registered as a Visit Reporter for CHM NEMT. Login: https://portal.bcbsinstitute.com Reset PW: https://portal.bcbsinstitute.com/forgot"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
phoneNumberMaxLength = 12
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
instance *controller
|
instance *controller
|
||||||
once sync.Once
|
once sync.Once
|
||||||
@@ -49,34 +44,12 @@ func controllerInstance(svc *applicationservice.Service, cfg *config.Config) *co
|
|||||||
return instance
|
return instance
|
||||||
}
|
}
|
||||||
|
|
||||||
func removeNonNumberChars(input string) string {
|
|
||||||
result := ""
|
|
||||||
for _, char := range input {
|
|
||||||
if char >= '0' && char <= '9' {
|
|
||||||
result += string(char)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *controller) handle(ctx echo.Context) error {
|
func (c *controller) handle(ctx echo.Context) error {
|
||||||
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)
|
||||||
}
|
}
|
||||||
|
|
||||||
//format phone number - max length in database is 12 chars
|
|
||||||
formatedPhoneNumber := strings.TrimSpace(*user.PhoneNumber)
|
|
||||||
formatedPhoneNumber = strings.Replace(formatedPhoneNumber, "+1", "", -1)
|
|
||||||
formatedPhoneNumber = removeNonNumberChars(formatedPhoneNumber)
|
|
||||||
|
|
||||||
if len(formatedPhoneNumber) > phoneNumberMaxLength {
|
|
||||||
formatedPhoneNumber = formatedPhoneNumber[:phoneNumberMaxLength]
|
|
||||||
}
|
|
||||||
|
|
||||||
*user.PhoneNumber = formatedPhoneNumber
|
|
||||||
|
|
||||||
authUser, err := c.svc.Users.GetByUUID("573c70ff-733d-11e7-ba8f-0a6ad3fcdeaa", "")
|
authUser, err := c.svc.Users.GetByUUID("573c70ff-733d-11e7-ba8f-0a6ad3fcdeaa", "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return routeutils.HandleAPIError(ctx, err)
|
return routeutils.HandleAPIError(ctx, err)
|
||||||
@@ -159,14 +132,10 @@ func (c *controller) handle(ctx echo.Context) error {
|
|||||||
|
|
||||||
notification, err = c.svc.Notification.SendNotificationWithoutWritingToDatabase(notification)
|
notification, err = c.svc.Notification.SendNotificationWithoutWritingToDatabase(notification)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger := ctx.Logger()
|
return routeutils.HandleAPIError(ctx, err)
|
||||||
logger.Warnf("Application Error: Could not send email notification to user email : %s", *user.Email)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Send sms notification to Authorized user
|
//Send sms notification to Authorized user
|
||||||
|
|
||||||
formatedPhoneNumber = *user.PhoneNumber
|
|
||||||
|
|
||||||
notification = viewmodel.Notification{
|
notification = viewmodel.Notification{
|
||||||
Type: applicationservice.NOtificationTypeSMS,
|
Type: applicationservice.NOtificationTypeSMS,
|
||||||
To: *user.PhoneNumber,
|
To: *user.PhoneNumber,
|
||||||
@@ -175,8 +144,7 @@ func (c *controller) handle(ctx echo.Context) error {
|
|||||||
|
|
||||||
notification, err = c.svc.Notification.SendNotificationWithoutWritingToDatabase(notification)
|
notification, err = c.svc.Notification.SendNotificationWithoutWritingToDatabase(notification)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger := ctx.Logger()
|
return routeutils.HandleAPIError(ctx, err)
|
||||||
logger.Warnf("Application Error: Could not send sms notification to user mobile : %s", *user.PhoneNumber)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return routeutils.ResponseAPIOK(ctx, user)
|
return routeutils.ResponseAPIOK(ctx, user)
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
zipcodeTrimLength = 5
|
zipcodeTrimLength = 5
|
||||||
|
enableZipParticipationCheck = true
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -408,14 +409,6 @@ 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"}
|
||||||
|
|
||||||
/*
|
|
||||||
resp, err := c.bcbsi.BXE.Get271(eligibility)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println("Eligibility Not Found or Error: ", err.Error())
|
|
||||||
return routeutils.ResponseAPINotEligibleError(ctx)
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
//This part is emulating eligibility check for testing purposes
|
//This part is emulating eligibility check for testing purposes
|
||||||
client := &http.Client{}
|
client := &http.Client{}
|
||||||
eligibilityJson, err := json.Marshal(eligibility)
|
eligibilityJson, err := json.Marshal(eligibility)
|
||||||
@@ -468,10 +461,11 @@ func (c *controller) handleMember(ctx echo.Context) error {
|
|||||||
trimmedZipcode = cleanZipcode[:zipcodeTrimLength]
|
trimmedZipcode = cleanZipcode[:zipcodeTrimLength]
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = c.svc.Zipcodes.GetByParticipatingZipcode(trimmedZipcode)
|
if enableZipParticipationCheck {
|
||||||
|
_, err = c.svc.Zipcodes.GetByParticipatingZipcode(trimmedZipcode)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return routeutils.ResponseAPINotEligibleWithMessageError(ctx, "Member's Home zipcode, "+trimmedZipcode+", is not currently eligible for participation in this program")
|
return routeutils.ResponseAPINotEligibleWithMessageError(ctx, "Member's Home zipcode, "+trimmedZipcode+", is not currently eligible for participation in this program")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
googleMapsAPI, err := maps.NewClient(maps.WithClientIDAndSignature("gme-bluecrossandblue1", "msqgD-jdqCyR0M_1u5C1HION5iI="))
|
googleMapsAPI, err := maps.NewClient(maps.WithClientIDAndSignature("gme-bluecrossandblue1", "msqgD-jdqCyR0M_1u5C1HION5iI="))
|
||||||
|
|||||||
Reference in New Issue
Block a user