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.

38 lignes
902B

  1. package main
  2. import (
  3. "log"
  4. "time"
  5. )
  6. func buildLeanworkOutByIn(in LeanworkIn) (ret LeanworkOut) {
  7. ret.Leanwork = in.Id
  8. ret.SignType = "MD5"
  9. ret.OrderNo = in.OrderNo
  10. ret.OrderAmount = in.OrderAmount
  11. ret.OrderCurrency = in.OrderCurrency
  12. ret.TransactionId = "DEMO" + time.Now().Format("20060102150405")
  13. ret.Status = "success"
  14. ret.UpdateSignature()
  15. return
  16. }
  17. //directly send leanwork success without contacting RPN
  18. func debugStartLeanworkCallBack(li LeanworkIn) {
  19. lo := buildLeanworkOutByIn(li)
  20. if lo.Status != "success" {
  21. log.Printf("Warning: Leanwork Status is not Success, skip notify leanwork %+v", lo)
  22. return
  23. }
  24. for i := 1; i <= 1; i++ {
  25. retry, err := lo.DoHttp()
  26. if !retry {
  27. break
  28. }
  29. time.Sleep(5 * time.Minute) //sleep 5 minute and try again
  30. log.Printf("Trying(%d) to report leanwork about transaction status %+v, encountered error %s \n", i, lo, err.Error())
  31. }
  32. }