tron driver removed

This commit is contained in:
Stephan D
2026-01-30 15:42:50 +01:00
parent 51f5b0804a
commit bc46eccbe0
25 changed files with 247 additions and 894 deletions

View File

@@ -5,6 +5,7 @@ import (
"strings"
"github.com/tech/sendico/pkg/merrors"
pmodel "github.com/tech/sendico/pkg/model"
"github.com/tech/sendico/pkg/payments/rail"
moneyv1 "github.com/tech/sendico/pkg/proto/common/money/v1"
chainv1 "github.com/tech/sendico/pkg/proto/gateway/chain/v1"
@@ -106,7 +107,7 @@ func (g *chainRailGateway) Send(ctx context.Context, req rail.TransferRequest) (
Amount: amountValue,
},
Fees: fees,
Metadata: cloneMetadata(req.Metadata),
Metadata: transferMetadataWithRoles(req.Metadata, req.FromRole, req.ToRole),
ClientReference: strings.TrimSpace(req.ClientReference),
})
if err != nil {
@@ -254,6 +255,26 @@ func railMoneyFromProto(m *moneyv1.Money) *rail.Money {
}
}
func transferMetadataWithRoles(metadata map[string]string, fromRole, toRole pmodel.AccountRole) map[string]string {
result := cloneMetadata(metadata)
if strings.TrimSpace(string(fromRole)) != "" {
if result == nil {
result = map[string]string{}
}
result[pmodel.MetadataKeyFromRole] = strings.TrimSpace(string(fromRole))
}
if strings.TrimSpace(string(toRole)) != "" {
if result == nil {
result = map[string]string{}
}
result[pmodel.MetadataKeyToRole] = strings.TrimSpace(string(toRole))
}
if len(result) == 0 {
return nil
}
return result
}
func cloneMetadata(input map[string]string) map[string]string {
if len(input) == 0 {
return nil