소스 검색

ask for payment infor

tags/v0.5
patrick 5 년 전
부모
커밋
3083739f26
1개의 변경된 파일21개의 추가작업 그리고 10개의 파일을 삭제
  1. +21
    -10
      purchase.go

+ 21
- 10
purchase.go 파일 보기

@@ -2,8 +2,9 @@ package main

import (
"fmt"
"io"
"net/http"
"os"
"text/template"
)

func StartPay(w http.ResponseWriter, r *http.Request) {
@@ -23,18 +24,28 @@ func StartPay(w http.ResponseWriter, r *http.Request) {
//fmt.Fprintf(w, "%s= %s\n", key, value)
}
sign := md5LeanworkForm(r.Form)
fmt.Printf("my md5=%s, valid = %t", sign, isLeanworkFormValid(r.Form))

m := RpnReq{}
resp, err := m.SendReq(r.Form)
if err != nil {
fmt.Fprintf(w, "invalid response from RPN")
}
askForPaymentInfo(w, r)
return

w.Header().Set("Content-Type", resp.Header.Get("Content-Type"))
w.Header().Set("Content-Length", resp.Header.Get("Content-Length"))
io.Copy(w, resp.Body)
// m := RpnReq{}
// resp, err := m.SendReq(r.Form)
// if err != nil {
// fmt.Fprintf(w, "invalid response from RPN")
// }

// w.Header().Set("Content-Type", resp.Header.Get("Content-Type"))
// w.Header().Set("Content-Length", resp.Header.Get("Content-Length"))
// io.Copy(w, resp.Body)

fmt.Printf("my md5=%s, valid = %t", sign, isLeanworkFormValid(r.Form))
//fmt.Fprintf(w, "my md5=%s", sign)

}

func askForPaymentInfo(w http.ResponseWriter, r *http.Request) {

t := template.Must(template.New("askForPaymentInfo").ParseGlob("form/*.tmpl"))
t.ExecuteTemplate(os.Stdout, "rpnAskNameAndCard", r.Form)
t.ExecuteTemplate(w, "rpnAskNameAndCard", r.Form)
}

Loading…
취소
저장