diff --git a/db.go b/db.go index 6fc8fbf..d81aaf7 100644 --- a/db.go +++ b/db.go @@ -37,7 +37,7 @@ func (m *TransactionDB) close() { m.h = nil //clear it, very important to prevent multiple opening } -func (m *TransactionDB) addRequest(r *http.Request) (row LeanworkRequest, err error) { +func (m *TransactionDB) addRequest(r *http.Request) (row LeanworkIn, err error) { if err = m.conn(Config); err != nil { return row, err } @@ -45,7 +45,7 @@ func (m *TransactionDB) addRequest(r *http.Request) (row LeanworkRequest, err er r.ParseForm() //assuming form has been parsed - row = LeanworkRequest{} + row = LeanworkIn{} pickupUrl := r.FormValue("pickupUrl") receiveUrl := r.FormValue("receiveUrl") signType := r.FormValue("signType") @@ -57,7 +57,7 @@ func (m *TransactionDB) addRequest(r *http.Request) (row LeanworkRequest, err er valid := isLeanworkFormValid(r.Form) ip4 := getClientIPLong(r) - insForm, err := m.h.Prepare("INSERT INTO request(pickupUrl, receiveUrl, signType, orderNo, orderAmount, orderCurrency, customerId, sign, valid, ip4) VALUES(?,?,?,?,?,?,?,?,?,?)") + insForm, err := m.h.Prepare("INSERT INTO leanworkIn (pickupUrl, receiveUrl, signType, orderNo, orderAmount, orderCurrency, customerId, sign, valid, ip4) VALUES(?,?,?,?,?,?,?,?,?,?)") if err != nil { log.Printf("Failed to prepare SQL statment for insert") return @@ -65,7 +65,7 @@ func (m *TransactionDB) addRequest(r *http.Request) (row LeanworkRequest, err er res, err := insForm.Exec(pickupUrl, receiveUrl, signType, orderNo, orderAmount, orderCurrency, customerId, sign, valid, ip4) if err != nil { - log.Printf("Error inserting leanwork request with orderNo =%s \n", orderNo) + log.Printf("Error inserting leanworkIn with orderNo =%s \n", orderNo) return } diff --git a/leanwork_request.go b/leanworkIn.go similarity index 85% rename from leanwork_request.go rename to leanworkIn.go index 13cbf1d..64bebd7 100644 --- a/leanwork_request.go +++ b/leanworkIn.go @@ -5,7 +5,7 @@ import ( "time" ) -type LeanworkRequest struct { +type LeanworkIn struct { Id int64 PickupUrl string ReceiveUrl string @@ -27,11 +27,11 @@ func lrIsIdMatchSign(id string, sign string) bool { return err == nil } -func getRequestRowByIdAndSign(id string, sign string) (row LeanworkRequest, err error) { +func getRequestRowByIdAndSign(id string, sign string) (row LeanworkIn, err error) { //retrieve form DB - row = LeanworkRequest{} + row = LeanworkIn{} db.conn(Config) - selDB, err := db.h.Query("SELECT * FROM request WHERE id=? and sign=?", id, sign) + selDB, err := db.h.Query("SELECT * FROM leanworkIN WHERE id=? and sign=?", id, sign) if err != nil { return } diff --git a/leanworkOut.go b/leanworkOut.go new file mode 100644 index 0000000..c9ecbf5 --- /dev/null +++ b/leanworkOut.go @@ -0,0 +1,2 @@ +package main + diff --git a/purchase.go b/purchase.go index 9776b56..3b3ce52 100644 --- a/purchase.go +++ b/purchase.go @@ -43,13 +43,13 @@ func StartPay(w http.ResponseWriter, r *http.Request) { } -func askForPaymentSelection(w http.ResponseWriter, row LeanworkRequest) { +func askForPaymentSelection(w http.ResponseWriter, row LeanworkIn) { t := template.Must(template.ParseFiles("PG/StartPay.html")) //tmpl.ExecuteTemplate(w, "StartPay", row) t.Execute(w, row) } -func askForPaymentInfo(w http.ResponseWriter, row LeanworkRequest, rpn_type string) { +func askForPaymentInfo(w http.ResponseWriter, row LeanworkIn, rpn_type string) { var data struct { Id int64 Sign string diff --git a/ref/w.php b/ref/w.php new file mode 100644 index 0000000..f967ded --- /dev/null +++ b/ref/w.php @@ -0,0 +1,46 @@ +'200310160057TW002184000000000001', + 'order_time'=> date('YmdHis'), + 'order_amount'=> '120000', + 'deal_id' => "deal" + date('YmdHis'), + 'deal_time' => date('YmdHis'), + 'pay_amount' => '120000', + 'pay_result' => '3', +); + + +$params = array(); +foreach ($data as $field => $value) { +if( $value == '' ) continue; + $params[] = "$field=$value"; +} +$params[] = "key=p1j4A3mEMj+ft0xkSfVULQ"; //must to use your key + +$comp = implode('|', $params); +$data['signature'] = md5(implode('|', $params)); +?> + + +
+ + + + https://deposit.paylomo.net/pay.php?r=payEasy