payment gateway for rpn cn
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

41 lignes
832B

  1. package main
  2. import (
  3. "fmt"
  4. "io"
  5. "net/http"
  6. )
  7. func StartPay(w http.ResponseWriter, r *http.Request) {
  8. if r.Method != "POST" {
  9. fmt.Fprintf(w, "invalid request")
  10. return
  11. }
  12. r.ParseForm()
  13. db.addRequest(r)
  14. if !isLeanworkFormValid(r.Form) {
  15. fmt.Fprintf(w, "invalid request")
  16. return
  17. }
  18. for key, value := range r.Form {
  19. fmt.Printf("%s= %s\n", key, value)
  20. //fmt.Fprintf(w, "%s= %s\n", key, value)
  21. }
  22. sign := md5LeanworkForm(r.Form)
  23. m := RpnReq{}
  24. resp, err := m.SendReq(r.Form)
  25. if err != nil {
  26. fmt.Fprintf(w, "invalid response from RPN")
  27. }
  28. w.Header().Set("Content-Type", resp.Header.Get("Content-Type"))
  29. w.Header().Set("Content-Length", resp.Header.Get("Content-Length"))
  30. io.Copy(w, resp.Body)
  31. fmt.Printf("my md5=%s, valid = %t", sign, isLeanworkFormValid(r.Form))
  32. //fmt.Fprintf(w, "my md5=%s", sign)
  33. }