payment gateway for rpn cn
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

38 líneas
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. }