Sfoglia il codice sorgente

RPN test passed with P2P and FAT

master
patrick 5 anni fa
parent
commit
58f6084896
7 ha cambiato i file con 26 aggiunte e 2 eliminazioni
  1. +1
    -0
      checksum.go
  2. +1
    -0
      config.test.json
  3. +3
    -0
      leanworkOut.go
  4. +8
    -0
      ref/rpn-call-back.txt
  5. +11
    -0
      rpn.go
  6. +1
    -1
      rpnIn.go
  7. +1
    -1
      rpnOut.go

+ 1
- 0
checksum.go Vedi File

@@ -25,6 +25,7 @@ func md5LeanworkForm(form url.Values) string {
s += form["customerId"][0]
s += Config.LeanWork.MD5Key
}
fmt.Println("leanwork form: " + s)
return md5str(s)
}


+ 1
- 0
config.test.json Vedi File

@@ -8,6 +8,7 @@
"UrlCallBack": "http://debug.biukop.com:8080/rpn_notify"
},
"LeanWork": {
"MD5KEY2": "370296119874502",
"MD5Key": "492815086935204",
"MD5P2P": "370296119874502",
"MD5FAT": "207841502473198"

+ 3
- 0
leanworkOut.go Vedi File

@@ -55,11 +55,14 @@ func (m *LeanworkOut) DoHttp() (retry bool, err error) {
log.Println("Fatal: Cannot read leanwork Http Response " + err.Error())
}
bodyString := string(bodyBytes)
m.LeanworkResp = bodyString
m.add2db()
if strings.Contains(strings.ToLower(bodyString), "success") {
retry = false
} else {
log.Println("Leanwork response without success word : " + bodyString)
}
retry = false
}
return
}

+ 8
- 0
ref/rpn-call-back.txt Vedi File

@@ -0,0 +1,8 @@
POST /rpn_notify HTTP/1.1
Host: debug.biukop.com:8080
Accept: */*
Content-Length: 207
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:5.0) Gecko/20110619 Firefox/5.0

order_id=200311012853TW002184000000000001&order_time=20200311012906&order_amount=120000&deal_id=135104086958&deal_time=20200311013317&pay_amount=120000&pay_result=3&signature=4fd8f8e81e35d679370b957b019d4c7d

+ 11
- 0
rpn.go Vedi File

@@ -4,9 +4,12 @@ import (
"fmt"
"log"
"net/http"
"net/http/httputil"
)

func rpnNotify(w http.ResponseWriter, r *http.Request) {
logRequestDebug(httputil.DumpRequest(r, true))

if r.Method != "POST" {
errPage(w, http.StatusMethodNotAllowed, "invalid request")
return
@@ -30,6 +33,14 @@ func rpnNotify(w http.ResponseWriter, r *http.Request) {
return
}

func logRequestDebug(data []byte, err error) {
if err == nil {
fmt.Printf("%s\n\n", string(data))
} else {
log.Fatalf("%s\n\n", err)
}
}

//receive RPN user name and card number
func rpnNameAndCard(w http.ResponseWriter, r *http.Request) {
if r.Method != "POST" {

+ 1
- 1
rpnIn.go Vedi File

@@ -118,7 +118,7 @@ func (m *RpnIn) signature() (sig string) {
s += "|pay_result=" + m.Pay_result
s += "|key=" + m.md5key()
sig = md5str(s)
//log.Println("signature of rpnIn = " + sig + " using key " + m.md5key())
log.Println("signature of rpnIn = " + sig + " using key " + m.md5key())
return
}


+ 1
- 1
rpnOut.go Vedi File

@@ -107,7 +107,7 @@ func (m *RpnOut) sendRedirect(w http.ResponseWriter, row LeanworkIn) {
func (m *RpnOut) getMD5Key() string {
if m.Mid == Config.Rpn.MIDP2P {
return Config.Rpn.MD5P2P
} else if m.Mid == Config.Rpn.MD5FAT {
} else if m.Mid == Config.Rpn.MIDFAT {
return Config.Rpn.MD5FAT
} else {
return ""

Loading…
Annulla
Salva