quotation service fixed
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
gatewaymongo "github.com/tech/sendico/gateway/tgsettle/storage/mongo"
|
||||
"github.com/tech/sendico/pkg/api/routers"
|
||||
"github.com/tech/sendico/pkg/db"
|
||||
"github.com/tech/sendico/pkg/discovery"
|
||||
"github.com/tech/sendico/pkg/merrors"
|
||||
msg "github.com/tech/sendico/pkg/messaging"
|
||||
mb "github.com/tech/sendico/pkg/messaging/broker"
|
||||
@@ -141,8 +142,12 @@ func (i *Imp) loadConfig() (*config, error) {
|
||||
if cfg.Metrics == nil {
|
||||
cfg.Metrics = &grpcapp.MetricsConfig{Address: ":9406"}
|
||||
}
|
||||
cfg.Gateway.Rail = discovery.NormalizeRail(cfg.Gateway.Rail)
|
||||
if cfg.Gateway.Rail == "" {
|
||||
return nil, merrors.InvalidArgument("gateway rail is required", "gateway.rail")
|
||||
}
|
||||
if !discovery.IsKnownRail(cfg.Gateway.Rail) {
|
||||
return nil, merrors.InvalidArgument("gateway rail must be a known token", "gateway.rail")
|
||||
}
|
||||
return cfg, nil
|
||||
}
|
||||
|
||||
@@ -95,9 +95,12 @@ func NewService(logger mlogger.Logger, repo storage.Repository, producer msg.Pro
|
||||
broker: broker,
|
||||
cfg: cfg,
|
||||
msgCfg: cfg.MessagingSettings,
|
||||
rail: strings.TrimSpace(cfg.Rail),
|
||||
rail: discovery.NormalizeRail(cfg.Rail),
|
||||
invokeURI: strings.TrimSpace(cfg.InvokeURI),
|
||||
}
|
||||
if svc.rail == "" {
|
||||
svc.rail = strings.TrimSpace(cfg.Rail)
|
||||
}
|
||||
svc.chatID = strings.TrimSpace(readEnv(cfg.TargetChatIDEnv))
|
||||
svc.successReaction = strings.TrimSpace(cfg.SuccessReaction)
|
||||
if svc.successReaction == "" {
|
||||
@@ -526,11 +529,12 @@ func (s *Service) startAnnouncer() {
|
||||
if s == nil || s.producer == nil {
|
||||
return
|
||||
}
|
||||
caps := discovery.CardPayoutRailGatewayOperations()
|
||||
rail := discovery.RailProviderSettlement
|
||||
caps := discovery.ProviderSettlementRailGatewayOperations()
|
||||
announce := discovery.Announcement{
|
||||
ID: discovery.StablePaymentGatewayID(discovery.NormalizeRail(s.rail)),
|
||||
ID: discovery.StablePaymentGatewayID(rail),
|
||||
Service: string(mservice.PaymentGateway),
|
||||
Rail: discovery.NormalizeRail(s.rail),
|
||||
Rail: rail,
|
||||
Operations: caps,
|
||||
InvokeURI: s.invokeURI,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user