Exemple #1
0
func AddPaymentMethod(paramMap map[string]string) {
	params := []string{paramMap["UserId"],
		lastFour([]byte(paramMap["CardNumber"])),
		paramMap["CardHolder"], paramMap["Expiration"],
		paramMap["Cvv"]}
	db.Execute(len(params), params, db.UserQ("AddPaymentMethod"))

}
Exemple #2
0
func LoginUser(paramMap map[string]string) model.User {
	params := []string{paramMap["Email"], util.MD5(paramMap["Password"])}
	rows := db.Execute(len(params), params, db.UserQ("CheckLoginDetails"))
	var id int64
	var age int32
	var email, password, name, auth_token, utype string
	var users []model.User
	for rows.Next() {
		err := rows.Scan(&id, &email, &password, &name, &age, &auth_token, &utype)
		if err != nil {
			log.Fatal(err)
		}
		users = append(users, model.User{id, email, name, age, auth_token, utype, ""})
	}
	return users[0]
}
Exemple #3
0
func CreateUser(paramMap map[string]string) (string, int64) {
	token := authToken(paramMap["Email"], paramMap["Name"])
	params := []string{paramMap["Email"],
		util.MD5(paramMap["Password"]),
		paramMap["Name"],
		paramMap["BirthYear"],
		token,
		"passenger", ""}
	var ids []int64
	var userId int64
	rows := db.Execute(len(params), params, db.UserQ("CreateUser"))
	for rows.Next() {
		err := rows.Scan(&userId)
		if err != nil {
			log.Fatal(err)
		}
		ids = append(ids, userId)
	}

	paramMap["AuthToken"] = token
	UpdateUser(paramMap)
	return token, ids[0]
}
Exemple #4
0
func UpdateUser(paramMap map[string]string) {
	params := []string{paramMap["AuthToken"]}
	db.Execute(1, params, db.UserQ("UpdateUser"))
}