Merge pull request 'extended fields' (#438) from bff-437 into main
All checks were successful
ci/woodpecker/push/bff Pipeline was successful
ci/woodpecker/push/gateway_tron Pipeline was successful
ci/woodpecker/push/frontend Pipeline was successful

Reviewed-on: #438
This commit was merged in pull request #438.
This commit is contained in:
2026-02-05 18:04:05 +00:00
2 changed files with 47 additions and 6 deletions

View File

@@ -0,0 +1,36 @@
package shared
import "strings"
// NetworkRegistry provides network configuration lookup by name.
type NetworkRegistry struct {
networks map[string]Network
}
// NewNetworkRegistry creates a NetworkRegistry from a slice of network configs.
func NewNetworkRegistry(networks []Network) *NetworkRegistry {
m := make(map[string]Network, len(networks))
for _, n := range networks {
if n.Name.IsValid() {
m[strings.ToLower(n.Name.String())] = n
}
}
return &NetworkRegistry{networks: m}
}
// Network returns the configuration for the named network.
func (r *NetworkRegistry) Network(name string) (Network, bool) {
if r == nil || r.networks == nil {
return Network{}, false
}
n, ok := r.networks[strings.ToLower(strings.TrimSpace(name))]
return n, ok
}
// Networks returns all configured networks.
func (r *NetworkRegistry) Networks() map[string]Network {
if r == nil {
return nil
}
return r.networks
}

View File

@@ -2,6 +2,7 @@ package sresponse
import (
"net/http"
"time"
"github.com/tech/sendico/pkg/api/http/response"
"github.com/tech/sendico/pkg/mlogger"
@@ -57,12 +58,14 @@ type PaymentQuotes struct {
}
type Payment struct {
PaymentRef string `json:"paymentRef,omitempty"`
IdempotencyKey string `json:"idempotencyKey,omitempty"`
State string `json:"state,omitempty"`
FailureCode string `json:"failureCode,omitempty"`
FailureReason string `json:"failureReason,omitempty"`
LastQuote *PaymentQuote `json:"lastQuote,omitempty"`
PaymentRef string `json:"paymentRef,omitempty"`
IdempotencyKey string `json:"idempotencyKey,omitempty"`
State string `json:"state,omitempty"`
FailureCode string `json:"failureCode,omitempty"`
FailureReason string `json:"failureReason,omitempty"`
LastQuote *PaymentQuote `json:"lastQuote,omitempty"`
CreatedAt time.Time `json:"createdAt,omitempty"`
Meta map[string]string `json:"meta,omitempty"`
}
type paymentQuoteResponse struct {
@@ -251,5 +254,7 @@ func toPayment(p *orchestratorv1.Payment) *Payment {
FailureCode: p.GetFailureCode().String(),
FailureReason: p.GetFailureReason(),
LastQuote: toPaymentQuote(p.GetLastQuote()),
CreatedAt: p.GetCreatedAt().AsTime(),
Meta: p.GetMetadata(),
}
}