dongfeng-pay/gateway/supplier/init.go

32 lines
834 B
Go
Raw Normal View History

2019-12-19 14:47:58 +08:00
/***************************************************
** @Desc : 注册上游支付接口
** @Time : 2019/10/28 14:48
** @Author : yuebin
** @File : init
** @Last Modified by : yuebin
** @Last Modified time: 2019/10/28 14:48
** @Software: GoLand
****************************************************/
package controller
import (
2021-04-27 15:33:49 +08:00
"github.com/beego/beego/v2/core/logs"
2019-12-19 14:47:58 +08:00
)
var registerSupplier = make(map[string]PayInterface)
//注册各种上游的支付接口
2021-04-27 15:33:49 +08:00
func init() {
2019-12-19 14:47:58 +08:00
registerSupplier["KF"] = new(KuaiFuImpl)
2021-04-27 15:33:49 +08:00
logs.Notice(CheckSupplierByCode("KF"))
2019-12-19 14:47:58 +08:00
registerSupplier["WEIXIN"] = new(WeiXinImpl)
2021-04-27 15:33:49 +08:00
logs.Notice(CheckSupplierByCode("WEIXIN"))
2019-12-19 14:47:58 +08:00
registerSupplier["ALIPAY"] = new(AlipayImpl)
2021-04-27 15:33:49 +08:00
logs.Notice(CheckSupplierByCode("ALIPAY"))
2019-12-19 14:47:58 +08:00
}
func GetPaySupplierByCode(code string) PayInterface {
return registerSupplier[code]
}