pay.go 722 B

12345678910111213141516171819202122232425262728293031
  1. package pendant
  2. import (
  3. "context"
  4. "net/url"
  5. "go-common/library/ecode"
  6. "go-common/library/log"
  7. )
  8. // PayBcoin pay coin
  9. func (d *Dao) PayBcoin(c context.Context, params url.Values, ip string) (orderNo, casherURL string, err error) {
  10. var res struct {
  11. Code int `json:"code"`
  12. Ts string `json:"ts"`
  13. OrderNum string `json:"order_no"`
  14. CasherURL string `json:"cashier_url"`
  15. }
  16. if err = d.client.Post(c, d.payURL, ip, params, &res); err != nil {
  17. log.Error("dao.client.Post(%s) error(%v)", d.payURL, err)
  18. return
  19. }
  20. if res.Code != 0 {
  21. log.Error("dao.client.Post(%s) error(%v)", d.payURL, res)
  22. err = ecode.Int(res.Code)
  23. return
  24. }
  25. orderNo = res.OrderNum
  26. casherURL = res.CasherURL
  27. return
  28. }