- legacy payment template fee lines picking
This commit is contained in:
@@ -29,7 +29,6 @@ type Store struct {
|
||||
methods storage.PaymentMethodsStore
|
||||
quotes quotestorage.QuotesStore
|
||||
routes storage.RoutesStore
|
||||
plans storage.PlanTemplatesStore
|
||||
}
|
||||
|
||||
type paymentMethodsConfig struct {
|
||||
@@ -70,22 +69,21 @@ func New(logger mlogger.Logger, conn *db.MongoConnection, opts ...Option) (*Stor
|
||||
paymentsRepo := repository.CreateMongoRepository(conn.Database(), (&model.Payment{}).Collection())
|
||||
quotesRepo := repository.CreateMongoRepository(conn.Database(), (&model.PaymentQuoteRecord{}).Collection())
|
||||
routesRepo := repository.CreateMongoRepository(conn.Database(), (&model.PaymentRoute{}).Collection())
|
||||
plansRepo := repository.CreateMongoRepository(conn.Database(), (&model.PaymentPlanTemplate{}).Collection())
|
||||
methodsRepo := repository.CreateMongoRepository(conn.Database(), mservice.PaymentMethods)
|
||||
|
||||
return newWithRepository(logger, conn.Ping, conn.Database(), paymentsRepo, methodsRepo, quotesRepo, routesRepo, plansRepo, opts...)
|
||||
return newWithRepository(logger, conn.Ping, conn.Database(), paymentsRepo, methodsRepo, quotesRepo, routesRepo, opts...)
|
||||
}
|
||||
|
||||
// NewWithRepository constructs a payments repository using the provided primitives.
|
||||
func NewWithRepository(logger mlogger.Logger, ping func(context.Context) error, paymentsRepo repository.Repository, quotesRepo repository.Repository, routesRepo repository.Repository, plansRepo repository.Repository, opts ...Option) (*Store, error) {
|
||||
return newWithRepository(logger, ping, nil, paymentsRepo, nil, quotesRepo, routesRepo, plansRepo, opts...)
|
||||
func NewWithRepository(logger mlogger.Logger, ping func(context.Context) error, paymentsRepo repository.Repository, quotesRepo repository.Repository, routesRepo repository.Repository, opts ...Option) (*Store, error) {
|
||||
return newWithRepository(logger, ping, nil, paymentsRepo, nil, quotesRepo, routesRepo, opts...)
|
||||
}
|
||||
|
||||
func newWithRepository(
|
||||
logger mlogger.Logger,
|
||||
ping func(context.Context) error,
|
||||
database *mongo.Database,
|
||||
paymentsRepo, methodsRepo, quotesRepo, routesRepo, plansRepo repository.Repository,
|
||||
paymentsRepo, methodsRepo, quotesRepo, routesRepo repository.Repository,
|
||||
opts ...Option,
|
||||
) (*Store, error) {
|
||||
if ping == nil {
|
||||
@@ -100,9 +98,6 @@ func newWithRepository(
|
||||
if routesRepo == nil {
|
||||
return nil, merrors.InvalidArgument("payments.storage.mongo: routes repository is nil")
|
||||
}
|
||||
if plansRepo == nil {
|
||||
return nil, merrors.InvalidArgument("payments.storage.mongo: plan templates repository is nil")
|
||||
}
|
||||
|
||||
cfg := options{}
|
||||
for _, opt := range opts {
|
||||
@@ -124,10 +119,6 @@ func newWithRepository(
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
plansStore, err := store.NewPlanTemplates(childLogger, plansRepo)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var methodsStore storage.PaymentMethodsStore
|
||||
if cfg.paymentMethodsAuth != nil {
|
||||
@@ -155,7 +146,6 @@ func newWithRepository(
|
||||
methods: methodsStore,
|
||||
quotes: quotesRepoStore.Quotes(),
|
||||
routes: routesStore,
|
||||
plans: plansStore,
|
||||
}
|
||||
|
||||
return result, nil
|
||||
@@ -189,11 +179,6 @@ func (s *Store) Routes() storage.RoutesStore {
|
||||
return s.routes
|
||||
}
|
||||
|
||||
// PlanTemplates returns the plan templates store.
|
||||
func (s *Store) PlanTemplates() storage.PlanTemplatesStore {
|
||||
return s.plans
|
||||
}
|
||||
|
||||
// MongoDatabase returns underlying Mongo database when available.
|
||||
func (s *Store) MongoDatabase() *mongo.Database {
|
||||
if s == nil {
|
||||
|
||||
Reference in New Issue
Block a user