|
- package main
-
- import (
- "log"
- "time"
- )
-
- func buildLeanworkOutByIn(in LeanworkIn) (ret LeanworkOut) {
- ret.Leanwork = in.Id
- ret.SignType = "MD5"
- ret.OrderNo = in.OrderNo
- ret.OrderAmount = in.OrderAmount
- ret.OrderCurrency = in.OrderCurrency
- ret.TransactionId = "DEMO" + time.Now().Format("20060102150405")
- ret.Status = "success"
- ret.UpdateSignature()
- return
- }
-
- //directly send leanwork success without contacting RPN
- func debugStartLeanworkCallBack(li LeanworkIn) {
- lo := buildLeanworkOutByIn(li)
-
- if lo.Status != "success" {
- log.Printf("Warning: Leanwork Status is not Success, skip notify leanwork %+v", lo)
- return
- }
-
- for i := 1; i <= 1; i++ {
- retry, err := lo.DoHttp()
- if !retry {
- break
- }
- time.Sleep(5 * time.Minute) //sleep 5 minute and try again
- log.Printf("Trying(%d) to report leanwork about transaction status %+v, encountered error %s \n", i, lo, err.Error())
- }
- }
|