separated quotation and payments
This commit is contained in:
34
api/payments/storage/quote/storage.go
Normal file
34
api/payments/storage/quote/storage.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package storage
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/tech/sendico/payments/storage/model"
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
)
|
||||
|
||||
type storageError string
|
||||
|
||||
func (e storageError) Error() string {
|
||||
return string(e)
|
||||
}
|
||||
|
||||
var (
|
||||
// ErrQuoteNotFound signals that a stored quote does not exist or expired.
|
||||
ErrQuoteNotFound = storageError("payments.storage.quote: quote not found")
|
||||
// ErrDuplicateQuote signals that a quote reference already exists.
|
||||
ErrDuplicateQuote = storageError("payments.storage.quote: duplicate quote")
|
||||
)
|
||||
|
||||
// Repository exposes persistence primitives for quote records.
|
||||
type Repository interface {
|
||||
Ping(ctx context.Context) error
|
||||
Quotes() QuotesStore
|
||||
}
|
||||
|
||||
// QuotesStore manages temporary stored payment quotes.
|
||||
type QuotesStore interface {
|
||||
Create(ctx context.Context, quote *model.PaymentQuoteRecord) error
|
||||
GetByRef(ctx context.Context, orgRef bson.ObjectID, quoteRef string) (*model.PaymentQuoteRecord, error)
|
||||
GetByIdempotencyKey(ctx context.Context, orgRef bson.ObjectID, idempotencyKey string) (*model.PaymentQuoteRecord, error)
|
||||
}
|
||||
Reference in New Issue
Block a user