ifrequestMessage!="CANCEL RIDE"&&requestMessage!="YES"&&requestMessage!="NO"&&!strings.HasPrefix(requestMessage,"DRIVER")&&!strings.HasPrefix(requestMessage,"MEMBER")&&requestMessage!="I AM READY"{
fmt.Println("Error to get last driver ride: ",err.Error())
message=fmt.Sprintf("We received a request to cancel a ride from you at %s, but cannot find a ride for this mobile number.",libphonenumber.Format(num,libphonenumber.NATIONAL))
fmt.Println("Error to get last ride: ",err.Error())
message=fmt.Sprintf("We received a request to cancel a ride from you at %s, but cannot find a ride for this mobile number.",libphonenumber.Format(num,libphonenumber.NATIONAL))
message=fmt.Sprintf("We received a request to send the return ride from you at %s, but you do not have the a return ride prepared.",libphonenumber.Format(num,libphonenumber.NATIONAL))
}
}else{
readyRide=lastRide
}
switchreadyRide.Status.Key{
case"pending","accepted","scheduled":
message="We already request your return ride, you should receive updates soon."
message=fmt.Sprintf("Are you sure you want to cancel a ride to %s visit to %s scheduled for %s?\nReply YES to confirm this cancellation",visitDate.Format("01/02/2006 03:04 PM"),lastRide.Route.Destination.Name,pickupDate.Format("03:04 PM"))
fmt.Println("Error to cancel the ride: ",err.Error())
message="There was a problem to cancel your ride on our systems"
}
vardateToFormattime.Time
iflastRide.VisitTime!=nil{
dateToFormat=*lastRide.VisitTime
}else{
dateToFormat=*lastRide.VisitDate
}
varpickupDatetime.Time
iflastRide.PickupTime!=nil{
pickupDate=*lastRide.PickupTime
}
lastRide.Status.Key="cancelled"
message=fmt.Sprintf("A ride to a %s visit to %s scheduled for %s has been cancelled.",dateToFormat.Format("01/02/2006 03:04 PM"),lastRide.Route.Destination.Name,pickupDate.Format("03:04 PM"))
}
// if requestMessage == "NO" && lastRide.UUID != "" {
// var dateToFormat time.Time
// if lastRide.VisitTime != nil {
// dateToFormat = *lastRide.VisitTime
// } else {
// dateToFormat = *lastRide.VisitDate
// }
// message = fmt.Sprintf("You ride is still scheduled on %s at %s", lastRide.Route.Destination.Name, dateToFormat.Format("01/02/2006 03:04 PM"))
driverMessage=strings.TrimSpace(driverMessage)+"\nReply MEMBER and your message to send a message to the member."
notifications:=make([]viewmodel.Notification,0)
notifications=append(notifications,c.getDriverNotification(lastRide,"sms","Message to the driver",driverMessage,lastRide.Driver.PhoneNumber,twilioResponse.To))
notifications=append(notifications,c.getDriverNotification(lastRide,"sms","Message to the driver",requestMessage,*lastRide.CreatedUser.PhoneNumber,*lastRide.User.PhoneNumber))
notifications=append(notifications,c.getDriverNotification(lastRide,"email","Message to the driver",driverMessage,*lastRide.CreatedUser.Email,*lastRide.User.Email))
notifications=append(notifications,c.getDriverNotification(lastRide,"sms","Message to the member from the driver",driverMessage,userPhoneNumber,twilioResponse.To))
notifications=append(notifications,c.getDriverNotification(lastRide,"sms","Message to the member from the driver",requestMessage,createUserPhoneNumber,userPhoneNumber))
notifications=append(notifications,c.getDriverNotification(lastRide,"email","Message to the member from the driver",driverMessage,createdUserEmail,userEmail))