Documentation ¶
Overview ¶
Package repository provides access to data available in SQL-based data store.
Index ¶
- type Issuer
- func (r *Issuer) Create(ctx context.Context, dbi sqlx.QueryerContext, req model.IssuerNew) (*model.Issuer, error)
- func (r *Issuer) GetByMerchID(ctx context.Context, dbi sqlx.QueryerContext, merchID string) (*model.Issuer, error)
- func (r *Issuer) GetByPubKey(ctx context.Context, dbi sqlx.QueryerContext, pubKey string) (*model.Issuer, error)
- type MockIssuer
- func (r *MockIssuer) Create(ctx context.Context, dbi sqlx.QueryerContext, req model.IssuerNew) (*model.Issuer, error)
- func (r *MockIssuer) GetByMerchID(ctx context.Context, dbi sqlx.QueryerContext, merchID string) (*model.Issuer, error)
- func (r *MockIssuer) GetByPubKey(ctx context.Context, dbi sqlx.QueryerContext, pubKey string) (*model.Issuer, error)
- type MockOrder
- func (r *MockOrder) AppendMetadata(ctx context.Context, dbi sqlx.ExecerContext, id uuid.UUID, key, val string) error
- func (r *MockOrder) AppendMetadataInt(ctx context.Context, dbi sqlx.ExecerContext, id uuid.UUID, key string, val int) error
- func (r *MockOrder) AppendMetadataInt64(ctx context.Context, dbi sqlx.ExecerContext, id uuid.UUID, key string, ...) error
- func (r *MockOrder) Create(ctx context.Context, dbi sqlx.QueryerContext, oreq *model.OrderNew) (*model.Order, error)
- func (r *MockOrder) Get(ctx context.Context, dbi sqlx.QueryerContext, id uuid.UUID) (*model.Order, error)
- func (r *MockOrder) GetByExternalID(ctx context.Context, dbi sqlx.QueryerContext, extID string) (*model.Order, error)
- func (r *MockOrder) GetExpiredStripeCheckoutSessionID(ctx context.Context, dbi sqlx.QueryerContext, orderID uuid.UUID) (string, error)
- func (r *MockOrder) IncrementNumPayFailed(ctx context.Context, dbi sqlx.ExecerContext, id uuid.UUID) error
- func (r *MockOrder) SetExpiresAt(ctx context.Context, dbi sqlx.ExecerContext, id uuid.UUID, when time.Time) error
- func (r *MockOrder) SetLastPaidAt(ctx context.Context, dbi sqlx.ExecerContext, id uuid.UUID, when time.Time) error
- func (r *MockOrder) SetStatus(ctx context.Context, dbi sqlx.ExecerContext, id uuid.UUID, status string) error
- func (r *MockOrder) SetTrialDays(ctx context.Context, dbi sqlx.ExecerContext, id uuid.UUID, ndays int64) error
- type MockOrderItem
- func (r *MockOrderItem) FindByOrderID(ctx context.Context, dbi sqlx.QueryerContext, orderID uuid.UUID) ([]model.OrderItem, error)
- func (r *MockOrderItem) Get(ctx context.Context, dbi sqlx.QueryerContext, id uuid.UUID) (*model.OrderItem, error)
- func (r *MockOrderItem) InsertMany(ctx context.Context, dbi sqlx.ExtContext, items ...model.OrderItem) ([]model.OrderItem, error)
- type MockOrderPayHistory
- type MockTLV2
- func (r *MockTLV2) DeleteLegacy(ctx context.Context, dbi sqlx.ExecerContext, orderID uuid.UUID) error
- func (r *MockTLV2) GetCredSubmissionReport(ctx context.Context, dbi sqlx.QueryerContext, orderID, itemID, reqID uuid.UUID, ...) (model.TLV2CredSubmissionReport, error)
- func (r *MockTLV2) UniqBatches(ctx context.Context, dbi sqlx.QueryerContext, orderID, itemID uuid.UUID, ...) (int, error)
- type Order
- func (r *Order) AppendMetadata(ctx context.Context, dbi sqlx.ExecerContext, id uuid.UUID, key, val string) error
- func (r *Order) AppendMetadataInt(ctx context.Context, dbi sqlx.ExecerContext, id uuid.UUID, key string, val int) error
- func (r *Order) AppendMetadataInt64(ctx context.Context, dbi sqlx.ExecerContext, id uuid.UUID, key string, ...) error
- func (r *Order) Create(ctx context.Context, dbi sqlx.QueryerContext, oreq *model.OrderNew) (*model.Order, error)
- func (r *Order) Get(ctx context.Context, dbi sqlx.QueryerContext, id uuid.UUID) (*model.Order, error)
- func (r *Order) GetByExternalID(ctx context.Context, dbi sqlx.QueryerContext, extID string) (*model.Order, error)
- func (r *Order) GetExpiredStripeCheckoutSessionID(ctx context.Context, dbi sqlx.QueryerContext, orderID uuid.UUID) (string, error)
- func (r *Order) GetExpiresAtAfterISOPeriod(ctx context.Context, dbi sqlx.QueryerContext, id uuid.UUID) (time.Time, error)
- func (r *Order) GetMetadata(ctx context.Context, dbi sqlx.QueryerContext, id uuid.UUID) (datastore.Metadata, error)
- func (r *Order) GetTimeBounds(ctx context.Context, dbi sqlx.QueryerContext, id uuid.UUID) (model.OrderTimeBounds, error)
- func (r *Order) HasExternalID(ctx context.Context, dbi sqlx.QueryerContext, extID string) (bool, error)
- func (r *Order) IncrementNumPayFailed(ctx context.Context, dbi sqlx.ExecerContext, id uuid.UUID) error
- func (r *Order) SetExpiresAt(ctx context.Context, dbi sqlx.ExecerContext, id uuid.UUID, when time.Time) error
- func (r *Order) SetLastPaidAt(ctx context.Context, dbi sqlx.ExecerContext, id uuid.UUID, when time.Time) error
- func (r *Order) SetStatus(ctx context.Context, dbi sqlx.ExecerContext, id uuid.UUID, status string) error
- func (r *Order) SetTrialDays(ctx context.Context, dbi sqlx.ExecerContext, id uuid.UUID, ndays int64) error
- func (r *Order) UpdateMetadata(ctx context.Context, dbi sqlx.ExecerContext, id uuid.UUID, ...) error
- type OrderItem
- func (r *OrderItem) FindByOrderID(ctx context.Context, dbi sqlx.QueryerContext, orderID uuid.UUID) ([]model.OrderItem, error)
- func (r *OrderItem) Get(ctx context.Context, dbi sqlx.QueryerContext, id uuid.UUID) (*model.OrderItem, error)
- func (r *OrderItem) InsertMany(ctx context.Context, dbi sqlx.ExtContext, items ...model.OrderItem) ([]model.OrderItem, error)
- type OrderPayHistory
- type TLV2
- func (r *TLV2) DeleteLegacy(ctx context.Context, dbi sqlx.ExecerContext, orderID uuid.UUID) error
- func (r *TLV2) GetCredSubmissionReport(ctx context.Context, dbi sqlx.QueryerContext, orderID, itemID, reqID uuid.UUID, ...) (model.TLV2CredSubmissionReport, error)
- func (r *TLV2) UniqBatches(ctx context.Context, dbi sqlx.QueryerContext, orderID, itemID uuid.UUID, ...) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockIssuer ¶
type MockIssuer struct { FnGetByMerchID func(ctx context.Context, dbi sqlx.QueryerContext, merchID string) (*model.Issuer, error) FnGetByPubKey func(ctx context.Context, dbi sqlx.QueryerContext, pubKey string) (*model.Issuer, error) FnCreate func(ctx context.Context, dbi sqlx.QueryerContext, req model.IssuerNew) (*model.Issuer, error) }
func (*MockIssuer) Create ¶
func (r *MockIssuer) Create(ctx context.Context, dbi sqlx.QueryerContext, req model.IssuerNew) (*model.Issuer, error)
func (*MockIssuer) GetByMerchID ¶
func (r *MockIssuer) GetByMerchID(ctx context.Context, dbi sqlx.QueryerContext, merchID string) (*model.Issuer, error)
func (*MockIssuer) GetByPubKey ¶
func (r *MockIssuer) GetByPubKey(ctx context.Context, dbi sqlx.QueryerContext, pubKey string) (*model.Issuer, error)
type MockOrder ¶
type MockOrder struct { FnGet func(ctx context.Context, dbi sqlx.QueryerContext, id uuid.UUID) (*model.Order, error) FnGetByExternalID func(ctx context.Context, dbi sqlx.QueryerContext, extID string) (*model.Order, error) FnCreate func(ctx context.Context, dbi sqlx.QueryerContext, oreq *model.OrderNew) (*model.Order, error) FnSetStatus func(ctx context.Context, dbi sqlx.ExecerContext, id uuid.UUID, status string) error FnSetExpiresAt func(ctx context.Context, dbi sqlx.ExecerContext, id uuid.UUID, when time.Time) error FnSetLastPaidAt func(ctx context.Context, dbi sqlx.ExecerContext, id uuid.UUID, when time.Time) error FnSetTrialDays func(ctx context.Context, dbi sqlx.ExecerContext, id uuid.UUID, ndays int64) error FnAppendMetadata func(ctx context.Context, dbi sqlx.ExecerContext, id uuid.UUID, key, val string) error FnAppendMetadataInt func(ctx context.Context, dbi sqlx.ExecerContext, id uuid.UUID, key string, val int) error FnAppendMetadataInt64 func(ctx context.Context, dbi sqlx.ExecerContext, id uuid.UUID, key string, val int64) error FnGetExpiredStripeCheckoutSessionID func(ctx context.Context, dbi sqlx.QueryerContext, orderID uuid.UUID) (string, error) FnIncrementNumPayFailed func(ctx context.Context, dbi sqlx.ExecerContext, id uuid.UUID) error }
func (*MockOrder) AppendMetadata ¶
func (*MockOrder) AppendMetadataInt ¶
func (*MockOrder) AppendMetadataInt64 ¶
func (*MockOrder) GetByExternalID ¶
func (*MockOrder) GetExpiredStripeCheckoutSessionID ¶
func (*MockOrder) IncrementNumPayFailed ¶
func (*MockOrder) SetExpiresAt ¶
func (*MockOrder) SetLastPaidAt ¶
type MockOrderItem ¶
type MockOrderItem struct { FnGet func(ctx context.Context, dbi sqlx.QueryerContext, id uuid.UUID) (*model.OrderItem, error) FnFindByOrderID func(ctx context.Context, dbi sqlx.QueryerContext, orderID uuid.UUID) ([]model.OrderItem, error) FnInsertMany func(ctx context.Context, dbi sqlx.ExtContext, items ...model.OrderItem) ([]model.OrderItem, error) }
func (*MockOrderItem) FindByOrderID ¶
func (r *MockOrderItem) FindByOrderID(ctx context.Context, dbi sqlx.QueryerContext, orderID uuid.UUID) ([]model.OrderItem, error)
func (*MockOrderItem) Get ¶
func (r *MockOrderItem) Get(ctx context.Context, dbi sqlx.QueryerContext, id uuid.UUID) (*model.OrderItem, error)
func (*MockOrderItem) InsertMany ¶
func (r *MockOrderItem) InsertMany(ctx context.Context, dbi sqlx.ExtContext, items ...model.OrderItem) ([]model.OrderItem, error)
type MockOrderPayHistory ¶
type MockTLV2 ¶
type MockTLV2 struct { FnGetCredSubmissionReport func(ctx context.Context, dbi sqlx.QueryerContext, orderID, itemID, reqID uuid.UUID, firstBCred string) (model.TLV2CredSubmissionReport, error) FnUniqBatches func(ctx context.Context, dbi sqlx.QueryerContext, orderID, itemID uuid.UUID, from, to time.Time) (int, error) FnDeleteLegacy func(ctx context.Context, dbi sqlx.ExecerContext, orderID uuid.UUID) error }
func (*MockTLV2) DeleteLegacy ¶
func (*MockTLV2) GetCredSubmissionReport ¶
type Order ¶
type Order struct{}
func (*Order) AppendMetadata ¶
func (r *Order) AppendMetadata(ctx context.Context, dbi sqlx.ExecerContext, id uuid.UUID, key, val string) error
AppendMetadata sets value by key to order's metadata, and might create metadata if it was missing.
func (*Order) AppendMetadataInt ¶
func (r *Order) AppendMetadataInt(ctx context.Context, dbi sqlx.ExecerContext, id uuid.UUID, key string, val int) error
AppendMetadataInt sets int value by key to order's metadata, and might create metadata if it was missing.
func (*Order) AppendMetadataInt64 ¶
func (r *Order) AppendMetadataInt64(ctx context.Context, dbi sqlx.ExecerContext, id uuid.UUID, key string, val int64) error
AppendMetadataInt64 sets int value by key to order's metadata, and might create metadata if it was missing.
func (*Order) Create ¶
func (r *Order) Create(ctx context.Context, dbi sqlx.QueryerContext, oreq *model.OrderNew) (*model.Order, error)
Create creates an order with the data in req.
func (*Order) Get ¶
func (r *Order) Get(ctx context.Context, dbi sqlx.QueryerContext, id uuid.UUID) (*model.Order, error)
Get retrieves the order for the given id.
func (*Order) GetByExternalID ¶
func (r *Order) GetByExternalID(ctx context.Context, dbi sqlx.QueryerContext, extID string) (*model.Order, error)
GetByExternalID retrieves the order by extID in metadata.externalID.
func (*Order) GetExpiredStripeCheckoutSessionID ¶
func (r *Order) GetExpiredStripeCheckoutSessionID(ctx context.Context, dbi sqlx.QueryerContext, orderID uuid.UUID) (string, error)
GetExpiredStripeCheckoutSessionID returns stripeCheckoutSessionId if it's found and expired.
func (*Order) GetExpiresAtAfterISOPeriod ¶
func (r *Order) GetExpiresAtAfterISOPeriod(ctx context.Context, dbi sqlx.QueryerContext, id uuid.UUID) (time.Time, error)
GetExpiresAtAfterISOPeriod returns a new value for expires_at that is last_paid_at plus ISO period.
It falls back to now() when last_paid_at is NULL. It uses the maximum of the order items' valid_for_iso as inverval, and falls back to 1 month.
func (*Order) GetMetadata ¶
func (r *Order) GetMetadata(ctx context.Context, dbi sqlx.QueryerContext, id uuid.UUID) (datastore.Metadata, error)
GetMetadata returns metadata of the order.
func (*Order) GetTimeBounds ¶
func (r *Order) GetTimeBounds(ctx context.Context, dbi sqlx.QueryerContext, id uuid.UUID) (model.OrderTimeBounds, error)
GetTimeBounds returns valid_for and last_paid_at for the order.
func (*Order) HasExternalID ¶
func (r *Order) HasExternalID(ctx context.Context, dbi sqlx.QueryerContext, extID string) (bool, error)
HasExternalID indicates whether an order with the metadata.externalID exists.
func (*Order) IncrementNumPayFailed ¶
func (*Order) SetExpiresAt ¶
func (r *Order) SetExpiresAt(ctx context.Context, dbi sqlx.ExecerContext, id uuid.UUID, when time.Time) error
SetExpiresAt sets expires_at.
func (*Order) SetLastPaidAt ¶
func (r *Order) SetLastPaidAt(ctx context.Context, dbi sqlx.ExecerContext, id uuid.UUID, when time.Time) error
SetLastPaidAt sets last_paid_at to when.
func (*Order) SetStatus ¶
func (r *Order) SetStatus(ctx context.Context, dbi sqlx.ExecerContext, id uuid.UUID, status string) error
SetStatus sets status to status.
type OrderItem ¶
type OrderItem struct{}
func NewOrderItem ¶
func NewOrderItem() *OrderItem
func (*OrderItem) FindByOrderID ¶
func (r *OrderItem) FindByOrderID(ctx context.Context, dbi sqlx.QueryerContext, orderID uuid.UUID) ([]model.OrderItem, error)
FindByOrderID returns order items for the given orderID.
type OrderPayHistory ¶
type OrderPayHistory struct{}
func NewOrderPayHistory ¶
func NewOrderPayHistory() *OrderPayHistory
type TLV2 ¶
type TLV2 struct{}
func (*TLV2) DeleteLegacy ¶
DeleteLegacy deletes creds where request_id matches the item_id.
Most of the time, there will be only one such set of creds for a given period of time because there is only one item in an order.
TODO(pavelb): Reconsider this when it's time for Bundles. By that time this method might be gone.