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.

34 lines
716 B

4 years ago
  1. // @Time : 2020/7/9 16:08
  2. // @Author : 黑白配
  3. // @File : main.go
  4. // @PackageName:WXPay
  5. // @Description:微信支付
  6. package WXPay
  7. import (
  8. "git.ouxuan.net/3136352472/wxpay/src/V2"
  9. "git.ouxuan.net/3136352472/wxpay/src/V3"
  10. "git.ouxuan.net/3136352472/wxpay/src/config"
  11. "git.ouxuan.net/3136352472/wxpay/src/entity"
  12. )
  13. type WXPayApi struct {
  14. V2 *V2.WxPay // V2接口
  15. V3 *V3.API // V3接口
  16. Config *entity.PayConfig // 配置
  17. }
  18. func Init(params entity.PayConfig) (api WXPayApi) {
  19. api.V2 = V2.Init(params)
  20. api.V3 = V3.Init(&config.V3{
  21. MchID: params.MchID,
  22. ClientKeyPath: params.APIClientPath.Key,
  23. SerialNo: params.SerialNo,
  24. })
  25. api.Config = &params
  26. return
  27. }