支付模块
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
806 B

  1. package boc
  2. import (
  3. zhios_pay_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_pay.git/utils"
  4. "fmt"
  5. )
  6. func Send(prd bool, appId, privateKeyStr string, param map[string]string) (string, error) {
  7. data := zhios_pay_utils.JoinStringsInASCII(param, "", "", false, false)
  8. sign, err := zhios_pay_utils.GetSign(privateKeyStr, data)
  9. if err != nil {
  10. return "", err
  11. }
  12. url := "https://cuaas.bocmacau.com/w/rsa/mercapi_ol"
  13. if prd {
  14. url = "https://aas.bocmacau.com/w/rsa/mercapi_ol"
  15. }
  16. headers := map[string]string{
  17. "Content-Type": "application/json",
  18. }
  19. param["merchantSign"] = sign
  20. fmt.Println(zhios_pay_utils.SerializeStr(param))
  21. fmt.Println(url)
  22. res, err := zhios_pay_utils.CurlPost(url, param, headers)
  23. if err != nil {
  24. return "", err
  25. }
  26. fmt.Println(string(res))
  27. return string(res), nil
  28. }