dongfeng-pay/service/controller/init.go

33 lines
880 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 (
"github.com/astaxie/beego/logs"
2019-12-19 16:43:20 +08:00
"dongfeng-pay/service/common"
2019-12-19 14:47:58 +08:00
)
var registerSupplier = make(map[string]PayInterface)
//注册各种上游的支付接口
func Init() {
registerSupplier["KF"] = new(KuaiFuImpl)
logs.Notice(common.CheckSupplierByCode("KF"))
registerSupplier["WEIXIN"] = new(WeiXinImpl)
logs.Notice(common.CheckSupplierByCode("WEIXIN"))
registerSupplier["ALIPAY"] = new(AlipayImpl)
logs.Notice(common.CheckSupplierByCode("ALIPAY"))
}
func GetPaySupplierByCode(code string) PayInterface {
return registerSupplier[code]
}