unified gateway interfaces

This commit is contained in:
Stephan D
2026-01-04 12:47:43 +01:00
parent 743f683d92
commit 59c83e414a
41 changed files with 927 additions and 186 deletions

View File

@@ -10,6 +10,7 @@ import (
"github.com/tech/sendico/pkg/merrors"
"github.com/tech/sendico/pkg/payments/rail"
moneyv1 "github.com/tech/sendico/pkg/proto/common/money/v1"
unifiedv1 "github.com/tech/sendico/pkg/proto/gateway/unified/v1"
ledgerv1 "github.com/tech/sendico/pkg/proto/ledger/v1"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
@@ -81,7 +82,7 @@ func New(ctx context.Context, cfg Config, opts ...grpc.DialOption) (Client, erro
return &ledgerClient{
cfg: cfg,
conn: conn,
client: ledgerv1.NewLedgerServiceClient(conn),
client: unifiedv1.NewUnifiedGatewayServiceClient(conn),
}, nil
}

View File

@@ -24,6 +24,7 @@ import (
pmessaging "github.com/tech/sendico/pkg/messaging"
"github.com/tech/sendico/pkg/mlogger"
"github.com/tech/sendico/pkg/mservice"
unifiedv1 "github.com/tech/sendico/pkg/proto/gateway/unified/v1"
ledgerv1 "github.com/tech/sendico/pkg/proto/ledger/v1"
)
@@ -49,7 +50,7 @@ type Service struct {
cancel context.CancelFunc
publisher *outboxPublisher
}
ledgerv1.UnimplementedLedgerServiceServer
unifiedv1.UnimplementedUnifiedGatewayServiceServer
}
type feesDependency struct {
@@ -82,7 +83,7 @@ func NewService(logger mlogger.Logger, repo storage.Repository, prod pmessaging.
func (s *Service) Register(router routers.GRPC) error {
return router.Register(func(reg grpc.ServiceRegistrar) {
ledgerv1.RegisterLedgerServiceServer(reg, s)
unifiedv1.RegisterUnifiedGatewayServiceServer(reg, s)
})
}
@@ -204,6 +205,7 @@ func (s *Service) startDiscoveryAnnouncer() {
announce := discovery.Announcement{
Service: "LEDGER",
Operations: []string{"balance.read", "ledger.debit", "ledger.credit"},
InvokeURI: discovery.DefaultInvokeURI(string(mservice.Ledger)),
Version: appversion.Create().Short(),
}
s.announcer = discovery.NewAnnouncer(s.logger, s.producer, string(mservice.Ledger), announce)