Преглед изворни кода

compilation bug fix

tags/v0.5
patrick пре 5 година
родитељ
комит
aaf0bd96e3
2 измењених фајлова са 23 додато и 8 уклоњено
  1. +5
    -3
      db.go
  2. +18
    -5
      rpn.go

+ 5
- 3
db.go Прегледај датотеку

} }


func (m *TransactionDB) addRpnOut(r RpnReq) error { func (m *TransactionDB) addRpnOut(r RpnReq) error {
return nil
} }


func (m *TransactionDB) updateRpnOutNameAndCard(orderid string, signature string, name string, card string) error {

func (m *TransactionDB) updateRpnOutNameAndCard(orderid string, signature string, name string, card string) (row RpnReq, err error) {
err = nil
row = RpnReq{}
return
} }

+ 18
- 5
rpn.go Прегледај датотеку

package main package main


import ( import (
"errors"
"fmt" "fmt"
"net/http" "net/http"
"net/url" "net/url"
return s return s
} }


func retrieveFormValue(form url.Values, key string) (r string, err error) {

if _, ok := form[key]; ok {
r = form[key][0]
err = nil
} else {
r = ""
err = errors.New("Key [" + key + "] not found in HTTP request")
}
return r, err
}

//receive RPN user name and card number //receive RPN user name and card number
func rpnNameAndCard(w http.ResponseWriter, r *http.Request) { func rpnNameAndCard(w http.ResponseWriter, r *http.Request) {
if r.Method != "POST" { if r.Method != "POST" {
return return
} }
r.ParseForm() r.ParseForm()
order_id, ok1 := r.Form["id"][0]
signature, ok2 := r.Form["si"][0]
user_name, ok3 := r.Form["name"][0]
user_card, ok4 := r.Form["card"][0]
order_id, ok1 := retrieveFormValue(r.Form, "id")
signature, ok2 := retrieveFormValue(r.Form, "si")
user_name, ok3 := retrieveFormValue(r.Form, "name")
user_card, ok4 := retrieveFormValue(r.Form, "card")


if !(ok1 && ok2 && ok3 && ok4) {
if !(ok1 == nil && ok2 == nil && ok3 == nil && ok4 == nil) {
fmt.Fprintf(w, "missing parameters") fmt.Fprintf(w, "missing parameters")
return return
} }

Loading…
Откажи
Сачувај