quotation service fixed
This commit is contained in:
@@ -333,7 +333,7 @@ func resolveGatewayDescriptor(cfg gatewayConfig, monetixCfg monetix.Config) *gat
|
||||
|
||||
return &gatewayv1.GatewayInstanceDescriptor{
|
||||
Id: id,
|
||||
Rail: gatewayv1.Rail_RAIL_CARD_PAYOUT,
|
||||
Rail: gatewayv1.Rail_RAIL_CARD,
|
||||
Network: network,
|
||||
Currencies: currencies,
|
||||
Capabilities: &gatewayv1.RailCapabilities{
|
||||
|
||||
@@ -151,7 +151,7 @@ func (s *Service) startDiscoveryAnnouncer() {
|
||||
return
|
||||
}
|
||||
announce := discovery.Announcement{
|
||||
Service: "CARD_PAYOUT_RAIL_GATEWAY",
|
||||
Service: "CARD_RAIL_GATEWAY",
|
||||
Rail: discovery.RailCardPayout,
|
||||
Operations: discovery.CardPayoutRailGatewayOperations(),
|
||||
InvokeURI: s.invokeURI,
|
||||
@@ -164,7 +164,7 @@ func (s *Service) startDiscoveryAnnouncer() {
|
||||
announce.Currencies = currenciesFromDescriptor(s.gatewayDescriptor)
|
||||
}
|
||||
if strings.TrimSpace(announce.ID) == "" {
|
||||
announce.ID = "card_payout_rail_gateway"
|
||||
announce.ID = discovery.StablePaymentGatewayID(discovery.RailCardPayout)
|
||||
}
|
||||
s.announcer = discovery.NewAnnouncer(s.logger, s.producer, string(mservice.MntxGateway), announce)
|
||||
s.announcer.Start()
|
||||
|
||||
@@ -36,7 +36,7 @@ messaging:
|
||||
buffer_size: 1024
|
||||
|
||||
gateway:
|
||||
rail: "provider_settlement"
|
||||
rail: "SETTLEMENT"
|
||||
target_chat_id_env: TGSETTLE_GATEWAY_CHAT_ID
|
||||
timeout_seconds: 345600
|
||||
accepted_user_ids: []
|
||||
|
||||
@@ -36,7 +36,7 @@ messaging:
|
||||
buffer_size: 1024
|
||||
|
||||
gateway:
|
||||
rail: "provider_settlement"
|
||||
rail: "SETTLEMENT"
|
||||
target_chat_id_env: TGSETTLE_GATEWAY_CHAT_ID
|
||||
timeout_seconds: 345600
|
||||
accepted_user_ids: []
|
||||
|
||||
@@ -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