new payment methods service

This commit is contained in:
Stephan D
2026-02-12 21:10:33 +01:00
parent b80dca0ce9
commit a862e27087
106 changed files with 3262 additions and 414 deletions

View File

@@ -5,6 +5,7 @@ import (
"github.com/tech/sendico/payments/storage/model"
quotestorage "github.com/tech/sendico/payments/storage/quote"
pkgmodel "github.com/tech/sendico/pkg/model"
"go.mongodb.org/mongo-driver/v2/bson"
)
@@ -40,6 +41,7 @@ var (
type Repository interface {
Ping(ctx context.Context) error
Payments() PaymentsStore
PaymentMethods() PaymentMethodsStore
Quotes() quotestorage.QuotesStore
Routes() RoutesStore
PlanTemplates() PlanTemplatesStore
@@ -55,8 +57,19 @@ type PaymentsStore interface {
List(ctx context.Context, filter *model.PaymentFilter) (*model.PaymentList, error)
}
// Deprecated: use quote/storage.QuotesStore.
type QuotesStore = quotestorage.QuotesStore
// PaymentMethodsStore manages recipient-linked payment methods.
type PaymentMethodsStore interface {
Create(ctx context.Context, accountRef, organizationRef bson.ObjectID, method *pkgmodel.PaymentMethod) error
Get(ctx context.Context, accountRef, methodRef bson.ObjectID) (*pkgmodel.PaymentMethod, error)
Update(ctx context.Context, accountRef bson.ObjectID, method *pkgmodel.PaymentMethod) error
Delete(ctx context.Context, accountRef, methodRef bson.ObjectID) error
DeleteCascade(ctx context.Context, accountRef, methodRef bson.ObjectID) error
SetArchived(ctx context.Context, accountRef, organizationRef, methodRef bson.ObjectID, archived, cascade bool) error
List(ctx context.Context, accountRef, organizationRef, recipientRef bson.ObjectID, cursor *pkgmodel.ViewCursor) ([]pkgmodel.PaymentMethod, error)
SetArchivedByRecipient(ctx context.Context, recipientRef bson.ObjectID, archived bool) (int, error)
DeleteByRecipient(ctx context.Context, recipientRef bson.ObjectID) error
}
// RoutesStore manages allowed routing transitions.
type RoutesStore interface {