unified gateway interface
This commit is contained in:
47
api/payments/orchestrator/storage/model/route.go
Normal file
47
api/payments/orchestrator/storage/model/route.go
Normal file
@@ -0,0 +1,47 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/tech/sendico/pkg/db/storable"
|
||||
"github.com/tech/sendico/pkg/mservice"
|
||||
)
|
||||
|
||||
// PaymentRoute defines an allowed rail transition for orchestration.
|
||||
type PaymentRoute struct {
|
||||
storable.Base `bson:",inline" json:",inline"`
|
||||
|
||||
FromRail Rail `bson:"fromRail" json:"fromRail"`
|
||||
ToRail Rail `bson:"toRail" json:"toRail"`
|
||||
Network string `bson:"network,omitempty" json:"network,omitempty"`
|
||||
RequiresObserve bool `bson:"requiresObserve,omitempty" json:"requiresObserve,omitempty"`
|
||||
IsEnabled bool `bson:"isEnabled" json:"isEnabled"`
|
||||
}
|
||||
|
||||
// Collection implements storable.Storable.
|
||||
func (*PaymentRoute) Collection() string {
|
||||
return mservice.PaymentRoutes
|
||||
}
|
||||
|
||||
// Normalize standardizes route fields for consistent indexing and matching.
|
||||
func (r *PaymentRoute) Normalize() {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
r.FromRail = Rail(strings.ToUpper(strings.TrimSpace(string(r.FromRail))))
|
||||
r.ToRail = Rail(strings.ToUpper(strings.TrimSpace(string(r.ToRail))))
|
||||
r.Network = strings.ToUpper(strings.TrimSpace(r.Network))
|
||||
}
|
||||
|
||||
// PaymentRouteFilter selects routes for lookup.
|
||||
type PaymentRouteFilter struct {
|
||||
FromRail Rail
|
||||
ToRail Rail
|
||||
Network string
|
||||
IsEnabled *bool
|
||||
}
|
||||
|
||||
// PaymentRouteList holds route results.
|
||||
type PaymentRouteList struct {
|
||||
Items []*PaymentRoute
|
||||
}
|
||||
Reference in New Issue
Block a user