niki/domain/payment/gateway/factory.go

25 lines
460 B
Go

package gateway
import (
"fmt"
"git.gocasts.ir/ebhomengo/niki/domain/payment/service"
)
type gatewayFactoryImpl struct{}
func NewGatewayFactory() service.GatewayFactory {
return &gatewayFactoryImpl{}
}
func (f gatewayFactoryImpl) GetGatewayAdapter(code string) (service.GatewayPort, error) {
switch code {
case "melat":
return nil, nil
case "zarinpal":
return nil, nil
default:
return nil, fmt.Errorf("Gateway Code(%s) is wrong!", code)
}
}