45 lines
948 B
Go
45 lines
948 B
Go
package gateway
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/tech/sendico/gateway/mntx/internal/service/monetix"
|
|
"github.com/tech/sendico/pkg/clock"
|
|
msg "github.com/tech/sendico/pkg/messaging"
|
|
)
|
|
|
|
// Option configures optional service dependencies.
|
|
type Option func(*Service)
|
|
|
|
// WithClock injects a custom clock (useful for tests).
|
|
func WithClock(c clock.Clock) Option {
|
|
return func(s *Service) {
|
|
if c != nil {
|
|
s.clock = c
|
|
}
|
|
}
|
|
}
|
|
|
|
// WithProducer attaches a messaging producer to the service.
|
|
func WithProducer(p msg.Producer) Option {
|
|
return func(s *Service) {
|
|
s.producer = p
|
|
}
|
|
}
|
|
|
|
// WithHTTPClient injects a custom HTTP client (useful for tests).
|
|
func WithHTTPClient(client *http.Client) Option {
|
|
return func(s *Service) {
|
|
if client != nil {
|
|
s.httpClient = client
|
|
}
|
|
}
|
|
}
|
|
|
|
// WithMonetixConfig sets the Monetix connectivity options.
|
|
func WithMonetixConfig(cfg monetix.Config) Option {
|
|
return func(s *Service) {
|
|
s.config = cfg
|
|
}
|
|
}
|