Documentation ¶
Overview ¶
Package promotion is a generated GoMock package.
Package promotion is a generated GoMock package.
Package promotion is a generated GoMock package.
Package promotion is a generated GoMock package.
Index ¶
- func ClaimPromotion(service *Service) handlers.AppHandler
- func CreatePromotion(service *Service) handlers.AppHandler
- func DrainSuggestion(service *Service) handlers.AppHandler
- func DrainSuggestionV2(service *Service) handlers.AppHandler
- func GetAvailablePromotions(service *Service) handlers.AppHandler
- func GetClaim(service *Service) handlers.AppHandler
- func GetClaimSummary(service *Service) handlers.AppHandler
- func GetCustodianDrainInfo(service *Service) handlers.AppHandler
- func MakeSuggestion(service *Service) handlers.AppHandler
- func NewPostgres() (Datastore, ReadOnlyDatastore, error)
- func PatchDrainJobErred(service *Service) handlers.AppHandler
- func PostReportBAPEvent(service *Service) handlers.AppHandler
- func PostReportClobberedClaims(service *Service, version int) handlers.AppHandler
- func PostReportWalletEvent(service *Service) handlers.AppHandler
- func Router(service *Service, vbatExpires time.Time) chi.Router
- func RouterV2(service *Service, vbatExpires time.Time) chi.Router
- func SetAdminAttestationTopic(newTopic string)
- func SetSuggestionTopic(newTopic string)
- func SuggestionsRouter(service *Service, vbatExpires time.Time) (chi.Router, error)
- func SuggestionsV2Router(service *Service, vbatExpires time.Time) (chi.Router, error)
- func WalletEventRouter(service *Service, vbatExpires time.Time) chi.Router
- type AdminAttestationEvent
- type BAPReport
- type BATLossEvent
- type BapReportPayload
- type BapReportResp
- type BatLossPayload
- type Claim
- type ClaimCreds
- type ClaimRequest
- type ClaimResponse
- type ClaimSummary
- type ClaimWorker
- type ClobberedClaimsRequest
- type ClobberedCreds
- type CreatePromotionRequest
- type CreatePromotionResponse
- type CredentialBinding
- type Custodian
- type CustodianDrain
- type CustodianDrainInfoResponse
- type Datastore
- type DatastoreWithPrometheus
- func (_d DatastoreWithPrometheus) ActivatePromotion(promotion *Promotion) (err error)
- func (_d DatastoreWithPrometheus) BeginTx() (tp1 *sqlx.Tx, err error)
- func (_d DatastoreWithPrometheus) ClaimForWallet(promotion *Promotion, issuer *Issuer, wallet *walletutils.Info, ...) (cp1 *Claim, err error)
- func (_d DatastoreWithPrometheus) CreateClaim(promotionID uuid.UUID, walletID string, value decimal.Decimal, ...) (cp1 *Claim, err error)
- func (_d DatastoreWithPrometheus) CreatePromotion(promotionType string, numGrants int, value decimal.Decimal, platform string) (pp1 *Promotion, err error)
- func (_d DatastoreWithPrometheus) CreateTransaction(orderID uuid.UUID, externalTransactionID string, status string, ...) (tp1 *Transaction, err error)
- func (_d DatastoreWithPrometheus) DeactivatePromotion(promotion *Promotion) (err error)
- func (_d DatastoreWithPrometheus) GetAvailablePromotions(platform string) (pa1 []Promotion, err error)
- func (_d DatastoreWithPrometheus) GetAvailablePromotionsForWallet(wallet *walletutils.Info, platform string) (pa1 []Promotion, err error)
- func (_d DatastoreWithPrometheus) GetClaimByWalletAndPromotion(wallet *walletutils.Info, promotionID *Promotion) (cp1 *Claim, err error)
- func (_d DatastoreWithPrometheus) GetClaimCreds(claimID uuid.UUID) (cp1 *ClaimCreds, err error)
- func (_d DatastoreWithPrometheus) GetClaimSummary(walletID uuid.UUID, grantType string) (cp1 *ClaimSummary, err error)
- func (_d DatastoreWithPrometheus) GetIssuer(promotionID uuid.UUID, cohort string) (ip1 *Issuer, err error)
- func (_d DatastoreWithPrometheus) GetIssuerByPublicKey(publicKey string) (ip1 *Issuer, err error)
- func (_d DatastoreWithPrometheus) GetOrder(orderID uuid.UUID) (op1 *Order, err error)
- func (_d DatastoreWithPrometheus) GetPreClaim(promotionID uuid.UUID, walletID string) (cp1 *Claim, err error)
- func (_d DatastoreWithPrometheus) GetPromotion(promotionID uuid.UUID) (pp1 *Promotion, err error)
- func (_d DatastoreWithPrometheus) GetPromotionsMissingIssuer(limit int) (ua1 []uuid.UUID, err error)
- func (_d DatastoreWithPrometheus) GetSumForTransactions(orderID uuid.UUID) (d1 decimal.Decimal, err error)
- func (_d DatastoreWithPrometheus) GetWithdrawalsAssociated(walletID *uuid.UUID, claimID *uuid.UUID) (up1 *uuid.UUID, d1 decimal.Decimal, err error)
- func (_d DatastoreWithPrometheus) InsertBAPReportEvent(ctx context.Context, paymentID uuid.UUID, amount decimal.Decimal) (up1 *uuid.UUID, err error)
- func (_d DatastoreWithPrometheus) InsertBATLossEvent(ctx context.Context, paymentID uuid.UUID, reportID int, amount decimal.Decimal, ...) (b1 bool, err error)
- func (_d DatastoreWithPrometheus) InsertClobberedClaims(ctx context.Context, ids []uuid.UUID, version int) (err error)
- func (_d DatastoreWithPrometheus) InsertIssuer(issuer *Issuer) (ip1 *Issuer, err error)
- func (_d DatastoreWithPrometheus) InsertSuggestion(credentials []cbr.CredentialRedemption, suggestionText string, ...) (err error)
- func (_d DatastoreWithPrometheus) Migrate(p1 ...uint) (err error)
- func (_d DatastoreWithPrometheus) NewMigrate() (mp1 *migrate.Migrate, err error)
- func (_d DatastoreWithPrometheus) RawDB() (dp1 *sqlx.DB)
- func (_d DatastoreWithPrometheus) RollbackTx(tx *sqlx.Tx)
- func (_d DatastoreWithPrometheus) RollbackTxAndHandle(tx *sqlx.Tx) (err error)
- func (_d DatastoreWithPrometheus) RunNextClaimJob(ctx context.Context, worker ClaimWorker) (b1 bool, err error)
- func (_d DatastoreWithPrometheus) RunNextSuggestionJob(ctx context.Context, worker SuggestionWorker) (b1 bool, err error)
- func (_d DatastoreWithPrometheus) SaveClaimCreds(claimCreds *ClaimCreds) (err error)
- func (_d DatastoreWithPrometheus) UpdateOrder(orderID uuid.UUID, status string) (err error)
- type DrainInfo
- type DrainJobRequest
- type DrainTransfer
- type FundingSource
- type GetClaimResponse
- type Issuer
- type MockClaimWorker
- type MockClaimWorkerMockRecorder
- type MockDatastore
- func (m *MockDatastore) ActivatePromotion(promotion *Promotion) error
- func (m *MockDatastore) BeginTx() (*sqlx.Tx, error)
- func (m *MockDatastore) ClaimForWallet(promotion *Promotion, issuer *Issuer, wallet *wallet.Info, ...) (*Claim, error)
- func (m *MockDatastore) CreateClaim(promotionID go_uuid.UUID, walletID string, value, bonus decimal.Decimal, ...) (*Claim, error)
- func (m *MockDatastore) CreatePromotion(promotionType string, numGrants int, value decimal.Decimal, platform string) (*Promotion, error)
- func (m *MockDatastore) CreateTransaction(orderID go_uuid.UUID, externalTransactionID, status, currency, kind string, ...) (*Transaction, error)
- func (m *MockDatastore) DeactivatePromotion(promotion *Promotion) error
- func (m *MockDatastore) EXPECT() *MockDatastoreMockRecorder
- func (m *MockDatastore) GetAvailablePromotions(platform string) ([]Promotion, error)
- func (m *MockDatastore) GetAvailablePromotionsForWallet(wallet *wallet.Info, platform string) ([]Promotion, error)
- func (m *MockDatastore) GetClaimByWalletAndPromotion(wallet *wallet.Info, promotionID *Promotion) (*Claim, error)
- func (m *MockDatastore) GetClaimCreds(claimID go_uuid.UUID) (*ClaimCreds, error)
- func (m *MockDatastore) GetClaimSummary(walletID go_uuid.UUID, grantType string) (*ClaimSummary, error)
- func (m *MockDatastore) GetIssuer(promotionID go_uuid.UUID, cohort string) (*Issuer, error)
- func (m *MockDatastore) GetIssuerByPublicKey(publicKey string) (*Issuer, error)
- func (m *MockDatastore) GetOrder(orderID go_uuid.UUID) (*Order, error)
- func (m *MockDatastore) GetPreClaim(promotionID go_uuid.UUID, walletID string) (*Claim, error)
- func (m *MockDatastore) GetPromotion(promotionID go_uuid.UUID) (*Promotion, error)
- func (m *MockDatastore) GetPromotionsMissingIssuer(limit int) ([]go_uuid.UUID, error)
- func (m *MockDatastore) GetSumForTransactions(orderID go_uuid.UUID) (decimal.Decimal, error)
- func (m *MockDatastore) GetWithdrawalsAssociated(walletID, claimID *go_uuid.UUID) (*go_uuid.UUID, decimal.Decimal, error)
- func (m *MockDatastore) InsertBAPReportEvent(ctx context.Context, paymentID go_uuid.UUID, amount decimal.Decimal) (*go_uuid.UUID, error)
- func (m *MockDatastore) InsertBATLossEvent(ctx context.Context, paymentID go_uuid.UUID, reportID int, ...) (bool, error)
- func (m *MockDatastore) InsertClobberedClaims(ctx context.Context, ids []go_uuid.UUID, version int) error
- func (m *MockDatastore) InsertIssuer(issuer *Issuer) (*Issuer, error)
- func (m *MockDatastore) InsertSuggestion(credentials []cbr.CredentialRedemption, suggestionText string, ...) error
- func (m *MockDatastore) Migrate(arg0 ...uint) error
- func (m *MockDatastore) NewMigrate() (*v4.Migrate, error)
- func (m *MockDatastore) RawDB() *sqlx.DB
- func (m *MockDatastore) RollbackTx(tx *sqlx.Tx)
- func (m *MockDatastore) RollbackTxAndHandle(tx *sqlx.Tx) error
- func (m *MockDatastore) RunNextClaimJob(ctx context.Context, worker ClaimWorker) (bool, error)
- func (m *MockDatastore) RunNextSuggestionJob(ctx context.Context, worker SuggestionWorker) (bool, error)
- func (m *MockDatastore) SaveClaimCreds(claimCreds *ClaimCreds) error
- func (m *MockDatastore) UpdateOrder(orderID go_uuid.UUID, status string) error
- type MockDatastoreMockRecorder
- func (mr *MockDatastoreMockRecorder) ActivatePromotion(promotion interface{}) *gomock.Call
- func (mr *MockDatastoreMockRecorder) BeginTx() *gomock.Call
- func (mr *MockDatastoreMockRecorder) ClaimForWallet(promotion, issuer, wallet, blindedCreds interface{}) *gomock.Call
- func (mr *MockDatastoreMockRecorder) CreateClaim(promotionID, walletID, value, bonus, legacy interface{}) *gomock.Call
- func (mr *MockDatastoreMockRecorder) CreatePromotion(promotionType, numGrants, value, platform interface{}) *gomock.Call
- func (mr *MockDatastoreMockRecorder) CreateTransaction(orderID, externalTransactionID, status, currency, kind, amount interface{}) *gomock.Call
- func (mr *MockDatastoreMockRecorder) DeactivatePromotion(promotion interface{}) *gomock.Call
- func (mr *MockDatastoreMockRecorder) GetAvailablePromotions(platform interface{}) *gomock.Call
- func (mr *MockDatastoreMockRecorder) GetAvailablePromotionsForWallet(wallet, platform interface{}) *gomock.Call
- func (mr *MockDatastoreMockRecorder) GetClaimByWalletAndPromotion(wallet, promotionID interface{}) *gomock.Call
- func (mr *MockDatastoreMockRecorder) GetClaimCreds(claimID interface{}) *gomock.Call
- func (mr *MockDatastoreMockRecorder) GetClaimSummary(walletID, grantType interface{}) *gomock.Call
- func (mr *MockDatastoreMockRecorder) GetIssuer(promotionID, cohort interface{}) *gomock.Call
- func (mr *MockDatastoreMockRecorder) GetIssuerByPublicKey(publicKey interface{}) *gomock.Call
- func (mr *MockDatastoreMockRecorder) GetOrder(orderID interface{}) *gomock.Call
- func (mr *MockDatastoreMockRecorder) GetPreClaim(promotionID, walletID interface{}) *gomock.Call
- func (mr *MockDatastoreMockRecorder) GetPromotion(promotionID interface{}) *gomock.Call
- func (mr *MockDatastoreMockRecorder) GetPromotionsMissingIssuer(limit interface{}) *gomock.Call
- func (mr *MockDatastoreMockRecorder) GetSumForTransactions(orderID interface{}) *gomock.Call
- func (mr *MockDatastoreMockRecorder) GetWithdrawalsAssociated(walletID, claimID interface{}) *gomock.Call
- func (mr *MockDatastoreMockRecorder) InsertBAPReportEvent(ctx, paymentID, amount interface{}) *gomock.Call
- func (mr *MockDatastoreMockRecorder) InsertBATLossEvent(ctx, paymentID, reportID, amount, platform interface{}) *gomock.Call
- func (mr *MockDatastoreMockRecorder) InsertClobberedClaims(ctx, ids, version interface{}) *gomock.Call
- func (mr *MockDatastoreMockRecorder) InsertIssuer(issuer interface{}) *gomock.Call
- func (mr *MockDatastoreMockRecorder) InsertSuggestion(credentials, suggestionText, suggestion interface{}) *gomock.Call
- func (mr *MockDatastoreMockRecorder) Migrate(arg0 ...interface{}) *gomock.Call
- func (mr *MockDatastoreMockRecorder) NewMigrate() *gomock.Call
- func (mr *MockDatastoreMockRecorder) RawDB() *gomock.Call
- func (mr *MockDatastoreMockRecorder) RollbackTx(tx interface{}) *gomock.Call
- func (mr *MockDatastoreMockRecorder) RollbackTxAndHandle(tx interface{}) *gomock.Call
- func (mr *MockDatastoreMockRecorder) RunNextClaimJob(ctx, worker interface{}) *gomock.Call
- func (mr *MockDatastoreMockRecorder) RunNextSuggestionJob(ctx, worker interface{}) *gomock.Call
- func (mr *MockDatastoreMockRecorder) SaveClaimCreds(claimCreds interface{}) *gomock.Call
- func (mr *MockDatastoreMockRecorder) UpdateOrder(orderID, status interface{}) *gomock.Call
- type MockReadOnlyDatastore
- func (m *MockReadOnlyDatastore) BeginTx() (*sqlx.Tx, error)
- func (m *MockReadOnlyDatastore) EXPECT() *MockReadOnlyDatastoreMockRecorder
- func (m *MockReadOnlyDatastore) GetAvailablePromotions(platform string) ([]Promotion, error)
- func (m *MockReadOnlyDatastore) GetAvailablePromotionsForWallet(wallet *wallet.Info, platform string) ([]Promotion, error)
- func (m *MockReadOnlyDatastore) GetClaimByWalletAndPromotion(wallet *wallet.Info, promotionID *Promotion) (*Claim, error)
- func (m *MockReadOnlyDatastore) GetClaimCreds(claimID go_uuid.UUID) (*ClaimCreds, error)
- func (m *MockReadOnlyDatastore) GetClaimSummary(walletID go_uuid.UUID, grantType string) (*ClaimSummary, error)
- func (m *MockReadOnlyDatastore) GetIssuer(promotionID go_uuid.UUID, cohort string) (*Issuer, error)
- func (m *MockReadOnlyDatastore) GetIssuerByPublicKey(publicKey string) (*Issuer, error)
- func (m *MockReadOnlyDatastore) GetPreClaim(promotionID go_uuid.UUID, walletID string) (*Claim, error)
- func (m *MockReadOnlyDatastore) GetPromotion(promotionID go_uuid.UUID) (*Promotion, error)
- func (m *MockReadOnlyDatastore) GetPromotionsMissingIssuer(limit int) ([]go_uuid.UUID, error)
- func (m *MockReadOnlyDatastore) GetWithdrawalsAssociated(walletID, claimID *go_uuid.UUID) (*go_uuid.UUID, decimal.Decimal, error)
- func (m *MockReadOnlyDatastore) Migrate(arg0 ...uint) error
- func (m *MockReadOnlyDatastore) NewMigrate() (*v4.Migrate, error)
- func (m *MockReadOnlyDatastore) RawDB() *sqlx.DB
- func (m *MockReadOnlyDatastore) RollbackTx(tx *sqlx.Tx)
- func (m *MockReadOnlyDatastore) RollbackTxAndHandle(tx *sqlx.Tx) error
- type MockReadOnlyDatastoreMockRecorder
- func (mr *MockReadOnlyDatastoreMockRecorder) BeginTx() *gomock.Call
- func (mr *MockReadOnlyDatastoreMockRecorder) GetAvailablePromotions(platform interface{}) *gomock.Call
- func (mr *MockReadOnlyDatastoreMockRecorder) GetAvailablePromotionsForWallet(wallet, platform interface{}) *gomock.Call
- func (mr *MockReadOnlyDatastoreMockRecorder) GetClaimByWalletAndPromotion(wallet, promotionID interface{}) *gomock.Call
- func (mr *MockReadOnlyDatastoreMockRecorder) GetClaimCreds(claimID interface{}) *gomock.Call
- func (mr *MockReadOnlyDatastoreMockRecorder) GetClaimSummary(walletID, grantType interface{}) *gomock.Call
- func (mr *MockReadOnlyDatastoreMockRecorder) GetIssuer(promotionID, cohort interface{}) *gomock.Call
- func (mr *MockReadOnlyDatastoreMockRecorder) GetIssuerByPublicKey(publicKey interface{}) *gomock.Call
- func (mr *MockReadOnlyDatastoreMockRecorder) GetPreClaim(promotionID, walletID interface{}) *gomock.Call
- func (mr *MockReadOnlyDatastoreMockRecorder) GetPromotion(promotionID interface{}) *gomock.Call
- func (mr *MockReadOnlyDatastoreMockRecorder) GetPromotionsMissingIssuer(limit interface{}) *gomock.Call
- func (mr *MockReadOnlyDatastoreMockRecorder) GetWithdrawalsAssociated(walletID, claimID interface{}) *gomock.Call
- func (mr *MockReadOnlyDatastoreMockRecorder) Migrate(arg0 ...interface{}) *gomock.Call
- func (mr *MockReadOnlyDatastoreMockRecorder) NewMigrate() *gomock.Call
- func (mr *MockReadOnlyDatastoreMockRecorder) RawDB() *gomock.Call
- func (mr *MockReadOnlyDatastoreMockRecorder) RollbackTx(tx interface{}) *gomock.Call
- func (mr *MockReadOnlyDatastoreMockRecorder) RollbackTxAndHandle(tx interface{}) *gomock.Call
- type Order
- type OrderItem
- type Postgres
- func (pg *Postgres) ActivatePromotion(promotion *Promotion) error
- func (pg *Postgres) ClaimForWallet(promotion *Promotion, issuer *Issuer, wallet *walletutils.Info, ...) (*Claim, error)
- func (pg *Postgres) CreateClaim(promotionID uuid.UUID, walletID string, value decimal.Decimal, ...) (*Claim, error)
- func (pg *Postgres) CreatePromotion(promotionType string, numGrants int, value decimal.Decimal, platform string) (*Promotion, error)
- func (pg *Postgres) CreateTransaction(orderID uuid.UUID, externalTransactionID string, status string, ...) (*Transaction, error)
- func (pg *Postgres) DeactivatePromotion(promotion *Promotion) error
- func (pg *Postgres) GetAvailablePromotions(platform string) ([]Promotion, error)
- func (pg *Postgres) GetAvailablePromotionsForWallet(wallet *walletutils.Info, platform string) ([]Promotion, error)
- func (pg *Postgres) GetClaimByWalletAndPromotion(wallet *walletutils.Info, promotion *Promotion) (*Claim, error)
- func (pg *Postgres) GetClaimCreds(claimID uuid.UUID) (*ClaimCreds, error)
- func (pg *Postgres) GetClaimSummary(walletID uuid.UUID, grantType string) (*ClaimSummary, error)
- func (pg *Postgres) GetIssuer(promotionID uuid.UUID, cohort string) (*Issuer, error)
- func (pg *Postgres) GetIssuerByPublicKey(publicKey string) (*Issuer, error)
- func (pg *Postgres) GetOrder(orderID uuid.UUID) (*Order, error)
- func (pg *Postgres) GetPreClaim(promotionID uuid.UUID, walletID string) (*Claim, error)
- func (pg *Postgres) GetPromotion(promotionID uuid.UUID) (*Promotion, error)
- func (pg *Postgres) GetPromotionsMissingIssuer(limit int) ([]uuid.UUID, error)
- func (pg *Postgres) GetSumForTransactions(orderID uuid.UUID) (decimal.Decimal, error)
- func (pg *Postgres) GetWithdrawalsAssociated(walletID, claimID *uuid.UUID) (*uuid.UUID, decimal.Decimal, error)
- func (pg *Postgres) InsertBAPReportEvent(ctx context.Context, paymentID uuid.UUID, amount decimal.Decimal) (*uuid.UUID, error)
- func (pg *Postgres) InsertBATLossEvent(ctx context.Context, paymentID uuid.UUID, reportID int, amount decimal.Decimal, ...) (bool, error)
- func (pg *Postgres) InsertClobberedClaims(ctx context.Context, ids []uuid.UUID, version int) error
- func (pg *Postgres) InsertIssuer(issuer *Issuer) (*Issuer, error)
- func (pg *Postgres) InsertSuggestion(credentials []cbr.CredentialRedemption, suggestionText string, ...) error
- func (pg *Postgres) RunNextClaimJob(ctx context.Context, worker ClaimWorker) (bool, error)
- func (pg *Postgres) RunNextSuggestionJob(ctx context.Context, worker SuggestionWorker) (bool, error)
- func (pg *Postgres) SaveClaimCreds(creds *ClaimCreds) error
- func (pg *Postgres) UpdateDrainJobAsRetriable(ctx context.Context, walletID uuid.UUID) error
- func (pg *Postgres) UpdateOrder(orderID uuid.UUID, status string) error
- type Promotion
- type PromotionsResponse
- type ReadOnlyDatastore
- type ReadOnlyDatastoreWithPrometheus
- func (_d ReadOnlyDatastoreWithPrometheus) BeginTx() (tp1 *sqlx.Tx, err error)
- func (_d ReadOnlyDatastoreWithPrometheus) GetAvailablePromotions(platform string) (pa1 []Promotion, err error)
- func (_d ReadOnlyDatastoreWithPrometheus) GetAvailablePromotionsForWallet(wallet *walletutils.Info, platform string) (pa1 []Promotion, err error)
- func (_d ReadOnlyDatastoreWithPrometheus) GetClaimByWalletAndPromotion(wallet *walletutils.Info, promotionID *Promotion) (cp1 *Claim, err error)
- func (_d ReadOnlyDatastoreWithPrometheus) GetClaimCreds(claimID uuid.UUID) (cp1 *ClaimCreds, err error)
- func (_d ReadOnlyDatastoreWithPrometheus) GetClaimSummary(walletID uuid.UUID, grantType string) (cp1 *ClaimSummary, err error)
- func (_d ReadOnlyDatastoreWithPrometheus) GetIssuer(promotionID uuid.UUID, cohort string) (ip1 *Issuer, err error)
- func (_d ReadOnlyDatastoreWithPrometheus) GetIssuerByPublicKey(publicKey string) (ip1 *Issuer, err error)
- func (_d ReadOnlyDatastoreWithPrometheus) GetPreClaim(promotionID uuid.UUID, walletID string) (cp1 *Claim, err error)
- func (_d ReadOnlyDatastoreWithPrometheus) GetPromotion(promotionID uuid.UUID) (pp1 *Promotion, err error)
- func (_d ReadOnlyDatastoreWithPrometheus) GetPromotionsMissingIssuer(limit int) (ua1 []uuid.UUID, err error)
- func (_d ReadOnlyDatastoreWithPrometheus) GetWithdrawalsAssociated(walletID *uuid.UUID, claimID *uuid.UUID) (up1 *uuid.UUID, d1 decimal.Decimal, err error)
- func (_d ReadOnlyDatastoreWithPrometheus) Migrate(p1 ...uint) (err error)
- func (_d ReadOnlyDatastoreWithPrometheus) NewMigrate() (mp1 *migrate.Migrate, err error)
- func (_d ReadOnlyDatastoreWithPrometheus) RawDB() (dp1 *sqlx.DB)
- func (_d ReadOnlyDatastoreWithPrometheus) RollbackTx(tx *sqlx.Tx)
- func (_d ReadOnlyDatastoreWithPrometheus) RollbackTxAndHandle(tx *sqlx.Tx) (err error)
- type Service
- func (service *Service) ClaimPromotionForWallet(ctx context.Context, promotionID uuid.UUID, walletID uuid.UUID, ...) (*uuid.UUID, error)
- func (service *Service) CreateIssuer(ctx context.Context, promotionID uuid.UUID, cohort string) (*Issuer, error)
- func (service *Service) FetchAdminAttestationWalletID(ctx context.Context) (*uuid.UUID, error)
- func (service *Service) GetAvailablePromotions(ctx context.Context, walletID *uuid.UUID, platform string, migrate bool) (*[]Promotion, error)
- func (service *Service) GetCredentialRedemptions(ctx context.Context, credentials []CredentialBinding) (total decimal.Decimal, requestCredentials []cbr.CredentialRedemption, ...)
- func (service *Service) GetOrCreateIssuer(ctx context.Context, promotionID uuid.UUID, cohort string) (*Issuer, error)
- func (service *Service) InitKafka(ctx context.Context) error
- func (service *Service) IsPaused() bool
- func (service *Service) LookupVerifier(ctx context.Context, keyID string) (context.Context, httpsignature.Verifier, error)
- func (service *Service) MintGrant(ctx context.Context, walletID uuid.UUID, total decimal.Decimal, ...) error
- func (service *Service) PauseWorker(until time.Time)
- func (service *Service) ReadableDatastore() ReadOnlyDatastore
- func (service *Service) RedeemAndCreateSuggestionEvent(ctx context.Context, credentials []cbr.CredentialRedemption, ...) error
- func (service *Service) SignClaimCreds(ctx context.Context, claimID uuid.UUID, issuer Issuer, blindedCreds []string) (*ClaimCreds, error)
- func (service *Service) Suggest(ctx context.Context, credentials []CredentialBinding, suggestionText string) error
- func (service *Service) TryUpgradeSuggestionEvent(suggestion []byte) ([]byte, error)
- func (service *Service) UpdateOrderStatus(orderID uuid.UUID) error
- type Suggestion
- type SuggestionEvent
- type SuggestionJob
- type SuggestionRequest
- type SuggestionWorker
- type Transaction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClaimPromotion ¶
func ClaimPromotion(service *Service) handlers.AppHandler
ClaimPromotion is the handler for claiming a particular promotion by a wallet
func CreatePromotion ¶
func CreatePromotion(service *Service) handlers.AppHandler
CreatePromotion is the handler for creating a promotion
func DrainSuggestion ¶
func DrainSuggestion(service *Service) handlers.AppHandler
DrainSuggestion is the handler for draining ad suggestions for a verified wallet
func DrainSuggestionV2 ¶
func DrainSuggestionV2(service *Service) handlers.AppHandler
DrainSuggestionV2 is the handler for draining ad suggestions for a verified wallet
func GetAvailablePromotions ¶
func GetAvailablePromotions(service *Service) handlers.AppHandler
GetAvailablePromotions is the handler for getting available promotions
func GetClaim ¶
func GetClaim(service *Service) handlers.AppHandler
GetClaim is the handler for checking on a particular claim's status
func GetClaimSummary ¶
func GetClaimSummary(service *Service) handlers.AppHandler
GetClaimSummary returns an summary of grants claimed by a given wallet
func GetCustodianDrainInfo ¶
func GetCustodianDrainInfo(service *Service) handlers.AppHandler
GetCustodianDrainInfo is the handler which provides information about a particular paymentId's drains
func MakeSuggestion ¶
func MakeSuggestion(service *Service) handlers.AppHandler
MakeSuggestion is the handler for making a suggestion using credentials
func NewPostgres ¶
func NewPostgres() (Datastore, ReadOnlyDatastore, error)
NewPostgres creates new postgres connections
func PatchDrainJobErred ¶
func PatchDrainJobErred(service *Service) handlers.AppHandler
PatchDrainJobErred is the handler for toggling a drain job as retriable
func PostReportBAPEvent ¶
func PostReportBAPEvent(service *Service) handlers.AppHandler
PostReportBAPEvent is the handler for reporting bat was lost by client bug
func PostReportClobberedClaims ¶
func PostReportClobberedClaims(service *Service, version int) handlers.AppHandler
PostReportClobberedClaims is the handler for reporting claims that were clobbered by client bug
func PostReportWalletEvent ¶
func PostReportWalletEvent(service *Service) handlers.AppHandler
PostReportWalletEvent is the handler for reporting bat was lost by client bug
func SetAdminAttestationTopic ¶
func SetAdminAttestationTopic(newTopic string)
SetAdminAttestationTopic set admin attestation topic
func SetSuggestionTopic ¶
func SetSuggestionTopic(newTopic string)
SetSuggestionTopic allows for a new topic to be suggested
func SuggestionsRouter ¶
SuggestionsRouter for suggestions endpoints
func SuggestionsV2Router ¶
SuggestionsV2Router for suggestions endpoints
Types ¶
type AdminAttestationEvent ¶
type AdminAttestationEvent struct { WalletID string `json:"wallet_id"` Service string `json:"service"` Signal string `json:"signal"` Score int32 `json:"score"` Justification string `json:"justification"` CreatedAt string `json:"created_at"` }
AdminAttestationEvent - kafka admin attestation event
type BAPReport ¶
type BAPReport struct { ID uuid.UUID `db:"id" json:"id"` WalletID uuid.UUID `db:"wallet_id" json:"walletId"` Amount decimal.Decimal `db:"amount" json:"amount"` CreatedAt time.Time `db:"created_at" json:"createdAt"` }
BAPReport holds info about wallet events
type BATLossEvent ¶
type BATLossEvent struct { ID uuid.UUID `db:"id" json:"id"` WalletID uuid.UUID `db:"wallet_id" json:"walletId"` ReportID int `db:"report_id" json:"reportId"` Amount decimal.Decimal `db:"amount" json:"amount"` Platform string `db:"platform" json:"platform"` }
BATLossEvent holds info about wallet events
type BapReportPayload ¶
BapReportPayload holds the data needed to report that bat has been lost by client bug
type BapReportResp ¶
BapReportResp holds the data needed to report that bat has been lost by client bug
type BatLossPayload ¶
BatLossPayload holds the data needed to report that bat has been lost by client bug
type Claim ¶
type Claim struct { ID uuid.UUID `db:"id"` CreatedAt time.Time `db:"created_at"` PromotionID uuid.UUID `db:"promotion_id"` WalletID uuid.UUID `db:"wallet_id"` ApproximateValue decimal.Decimal `db:"approximate_value"` Redeemed bool `db:"redeemed"` Bonus decimal.Decimal `db:"bonus"` LegacyClaimed bool `db:"legacy_claimed"` RedeemedAt pq.NullTime `db:"redeemed_at"` Drained bool `db:"drained"` DrainedAt pq.NullTime `db:"drained_at"` UpdatedAt pq.NullTime `db:"updated_at"` ClaimType *string `db:"claim_type"` }
Claim encapsulates a redeemed or unredeemed ("pre-registered") claim to a promotion by a wallet
type ClaimCreds ¶
type ClaimCreds struct { ID uuid.UUID `db:"claim_id"` IssuerID uuid.UUID `db:"issuer_id"` BlindedCreds jsonutils.JSONStringArray `db:"blinded_creds"` SignedCreds *jsonutils.JSONStringArray `db:"signed_creds"` BatchProof *string `db:"batch_proof"` PublicKey *string `db:"public_key"` CreatedAt pq.NullTime `db:"created_at"` UpdatedAt pq.NullTime `db:"updated_at"` }
ClaimCreds encapsulates the credentials to be signed in response to a valid claim
type ClaimRequest ¶
type ClaimRequest struct { WalletID uuid.UUID `json:"paymentId" valid:"-"` BlindedCreds []string `json:"blindedCreds" valid:"base64"` }
ClaimRequest includes the ID of the wallet attempting to claim and blinded credentials which to be signed
type ClaimResponse ¶
ClaimResponse includes a ClaimID which can later be used to check the status of the claim
type ClaimSummary ¶
type ClaimSummary struct { Amount decimal.Decimal `json:"amount" db:"amount"` Earnings decimal.Decimal `json:"earnings" db:"earnings"` LastClaim time.Time `json:"lastClaim" db:"last_claim"` Type string `json:"type" db:"type"` }
ClaimSummary outlines the state of a wallet's claims
type ClaimWorker ¶
type ClaimWorker interface {
SignClaimCreds(ctx context.Context, claimID uuid.UUID, issuer Issuer, blindedCreds []string) (*ClaimCreds, error)
}
ClaimWorker attempts to work on a claim job by signing the blinded credentials of the client
type ClobberedClaimsRequest ¶
ClobberedClaimsRequest holds the data needed to report claims that were clobbered by client bug
type ClobberedCreds ¶
type ClobberedCreds struct { ID uuid.UUID `db:"id"` CreatedAt time.Time `db:"created_at"` Version int `db:"version"` }
ClobberedCreds holds data of claims that have been clobbered and when they were first reported
type CreatePromotionRequest ¶
type CreatePromotionRequest struct { Type string `json:"type" valid:"in(ads|ugp)"` NumGrants int `json:"numGrants" valid:"required"` Value decimal.Decimal `json:"value" valid:"required"` Platform string `json:"platform" valid:"platform,optional"` Active bool `json:"active" valid:"-"` }
CreatePromotionRequest includes information needed to create a promotion
type CreatePromotionResponse ¶
type CreatePromotionResponse struct {
Promotion
}
CreatePromotionResponse includes information about the created promotion
type CredentialBinding ¶
type CredentialBinding struct { PublicKey string `json:"publicKey" valid:"base64"` TokenPreimage string `json:"t" valid:"base64"` Signature string `json:"signature" valid:"base64"` }
CredentialBinding includes info needed to redeem a single credential
func DeduplicateCredentialBindings ¶
func DeduplicateCredentialBindings(tokens ...CredentialBinding) []CredentialBinding
DeduplicateCredentialBindings - given a list of tokens return a deduplicated list
type Custodian ¶
type Custodian struct { Provider string `json:"provider,omitempty" db:"user_deposit_account_provider"` DepositDestination string `json:"deposit_destination,omitempty" db:"user_deposit_destination"` }
Custodian - generic custodian output data
type CustodianDrain ¶
type CustodianDrain struct { BatchID uuid.UUID `json:"batch_id"` Custodian Custodian `json:"custodian,omitempty"` PromotionsDrained []DrainInfo `json:"promotions_drained,omitempty"` Value decimal.Decimal `json:"value"` }
CustodianDrain - representation of a drain job
type CustodianDrainInfoResponse ¶
type CustodianDrainInfoResponse struct { responses.Meta Drains []CustodianDrain `json:"drains,omitempty"` }
CustodianDrainInfoResponse - the response to a custodian drain info request
type Datastore ¶
type Datastore interface { datastore.Datastore // ActivatePromotion marks a particular promotion as active ActivatePromotion(promotion *Promotion) error // DeactivatePromotion marks a particular promotion as inactive DeactivatePromotion(promotion *Promotion) error // ClaimForWallet is used to either create a new claim or convert a preregistered claim for a particular promotion ClaimForWallet(promotion *Promotion, issuer *Issuer, wallet *walletutils.Info, blindedCreds jsonutils.JSONStringArray) (*Claim, error) // CreateClaim is used to "pre-register" an unredeemed claim for a particular wallet CreateClaim(promotionID uuid.UUID, walletID string, value decimal.Decimal, bonus decimal.Decimal, legacy bool) (*Claim, error) // GetPreClaim is used to fetch a "pre-registered" claim for a particular wallet GetPreClaim(promotionID uuid.UUID, walletID string) (*Claim, error) // CreatePromotion given the promotion type, initial number of grants and the desired value of those grants CreatePromotion(promotionType string, numGrants int, value decimal.Decimal, platform string) (*Promotion, error) // GetAvailablePromotionsForWallet returns the list of available promotions for the wallet GetAvailablePromotionsForWallet(wallet *walletutils.Info, platform string) ([]Promotion, error) // GetAvailablePromotions returns the list of available promotions for all wallets GetAvailablePromotions(platform string) ([]Promotion, error) // GetWithdrawalsAssociated returns the promotion and total amount of claims drained for associated wallets GetWithdrawalsAssociated(walletID, claimID *uuid.UUID) (*uuid.UUID, decimal.Decimal, error) // GetPromotionsMissingIssuer returns the list of promotions missing an issuer GetPromotionsMissingIssuer(limit int) ([]uuid.UUID, error) // GetClaimCreds returns the claim credentials for a ClaimID GetClaimCreds(claimID uuid.UUID) (*ClaimCreds, error) // SaveClaimCreds updates the stored claim credentials SaveClaimCreds(claimCreds *ClaimCreds) error // GetPromotion by ID GetPromotion(promotionID uuid.UUID) (*Promotion, error) // InsertIssuer inserts the given issuer InsertIssuer(issuer *Issuer) (*Issuer, error) // GetIssuer by PromotionID and cohort GetIssuer(promotionID uuid.UUID, cohort string) (*Issuer, error) // GetIssuerByPublicKey GetIssuerByPublicKey(publicKey string) (*Issuer, error) // GetClaimSummary gets the number of grants for a specific type GetClaimSummary(walletID uuid.UUID, grantType string) (*ClaimSummary, error) // GetClaimByWalletAndPromotion gets whether a wallet has a claimed grants // with the given promotion and returns the grant if so GetClaimByWalletAndPromotion(wallet *walletutils.Info, promotionID *Promotion) (*Claim, error) // RunNextClaimJob to sign claim credentials if there is a claim waiting RunNextClaimJob(ctx context.Context, worker ClaimWorker) (bool, error) // InsertSuggestion inserts a transaction awaiting validation InsertSuggestion(credentials []cbr.CredentialRedemption, suggestionText string, suggestion []byte) error // RunNextSuggestionJob to process a suggestion if there is one waiting RunNextSuggestionJob(ctx context.Context, worker SuggestionWorker) (bool, error) // InsertClobberedClaims inserts clobbered claim ids into the clobbered_claims table InsertClobberedClaims(ctx context.Context, ids []uuid.UUID, version int) error // InsertBATLossEvent inserts claims of lost bat InsertBATLossEvent(ctx context.Context, paymentID uuid.UUID, reportID int, amount decimal.Decimal, platform string) (bool, error) // InsertBAPReportEvent inserts a BAP report InsertBAPReportEvent(ctx context.Context, paymentID uuid.UUID, amount decimal.Decimal) (*uuid.UUID, error) // GetOrder by ID GetOrder(orderID uuid.UUID) (*Order, error) // UpdateOrder updates an order when it has been paid UpdateOrder(orderID uuid.UUID, status string) error // CreateTransaction creates a transaction CreateTransaction(orderID uuid.UUID, externalTransactionID string, status string, currency string, kind string, amount decimal.Decimal) (*Transaction, error) // GetSumForTransactions gets a decimal sum of for transactions for an order GetSumForTransactions(orderID uuid.UUID) (decimal.Decimal, error) }
Datastore abstracts over the underlying datastore
type DatastoreWithPrometheus ¶
type DatastoreWithPrometheus struct {
// contains filtered or unexported fields
}
DatastoreWithPrometheus implements Datastore interface with all methods wrapped with Prometheus metrics
func NewDatastoreWithPrometheus ¶
func NewDatastoreWithPrometheus(base Datastore, instanceName string) DatastoreWithPrometheus
NewDatastoreWithPrometheus returns an instance of the Datastore decorated with prometheus summary metric
func (DatastoreWithPrometheus) ActivatePromotion ¶
func (_d DatastoreWithPrometheus) ActivatePromotion(promotion *Promotion) (err error)
ActivatePromotion implements Datastore
func (DatastoreWithPrometheus) BeginTx ¶
func (_d DatastoreWithPrometheus) BeginTx() (tp1 *sqlx.Tx, err error)
BeginTx implements Datastore
func (DatastoreWithPrometheus) ClaimForWallet ¶
func (_d DatastoreWithPrometheus) ClaimForWallet(promotion *Promotion, issuer *Issuer, wallet *walletutils.Info, blindedCreds jsonutils.JSONStringArray) (cp1 *Claim, err error)
ClaimForWallet implements Datastore
func (DatastoreWithPrometheus) CreateClaim ¶
func (_d DatastoreWithPrometheus) CreateClaim(promotionID uuid.UUID, walletID string, value decimal.Decimal, bonus decimal.Decimal, legacy bool) (cp1 *Claim, err error)
CreateClaim implements Datastore
func (DatastoreWithPrometheus) CreatePromotion ¶
func (_d DatastoreWithPrometheus) CreatePromotion(promotionType string, numGrants int, value decimal.Decimal, platform string) (pp1 *Promotion, err error)
CreatePromotion implements Datastore
func (DatastoreWithPrometheus) CreateTransaction ¶
func (_d DatastoreWithPrometheus) CreateTransaction(orderID uuid.UUID, externalTransactionID string, status string, currency string, kind string, amount decimal.Decimal) (tp1 *Transaction, err error)
CreateTransaction implements Datastore
func (DatastoreWithPrometheus) DeactivatePromotion ¶
func (_d DatastoreWithPrometheus) DeactivatePromotion(promotion *Promotion) (err error)
DeactivatePromotion implements Datastore
func (DatastoreWithPrometheus) GetAvailablePromotions ¶
func (_d DatastoreWithPrometheus) GetAvailablePromotions(platform string) (pa1 []Promotion, err error)
GetAvailablePromotions implements Datastore
func (DatastoreWithPrometheus) GetAvailablePromotionsForWallet ¶
func (_d DatastoreWithPrometheus) GetAvailablePromotionsForWallet(wallet *walletutils.Info, platform string) (pa1 []Promotion, err error)
GetAvailablePromotionsForWallet implements Datastore
func (DatastoreWithPrometheus) GetClaimByWalletAndPromotion ¶
func (_d DatastoreWithPrometheus) GetClaimByWalletAndPromotion(wallet *walletutils.Info, promotionID *Promotion) (cp1 *Claim, err error)
GetClaimByWalletAndPromotion implements Datastore
func (DatastoreWithPrometheus) GetClaimCreds ¶
func (_d DatastoreWithPrometheus) GetClaimCreds(claimID uuid.UUID) (cp1 *ClaimCreds, err error)
GetClaimCreds implements Datastore
func (DatastoreWithPrometheus) GetClaimSummary ¶
func (_d DatastoreWithPrometheus) GetClaimSummary(walletID uuid.UUID, grantType string) (cp1 *ClaimSummary, err error)
GetClaimSummary implements Datastore
func (DatastoreWithPrometheus) GetIssuer ¶
func (_d DatastoreWithPrometheus) GetIssuer(promotionID uuid.UUID, cohort string) (ip1 *Issuer, err error)
GetIssuer implements Datastore
func (DatastoreWithPrometheus) GetIssuerByPublicKey ¶
func (_d DatastoreWithPrometheus) GetIssuerByPublicKey(publicKey string) (ip1 *Issuer, err error)
GetIssuerByPublicKey implements Datastore
func (DatastoreWithPrometheus) GetOrder ¶
func (_d DatastoreWithPrometheus) GetOrder(orderID uuid.UUID) (op1 *Order, err error)
GetOrder implements Datastore
func (DatastoreWithPrometheus) GetPreClaim ¶
func (_d DatastoreWithPrometheus) GetPreClaim(promotionID uuid.UUID, walletID string) (cp1 *Claim, err error)
GetPreClaim implements Datastore
func (DatastoreWithPrometheus) GetPromotion ¶
func (_d DatastoreWithPrometheus) GetPromotion(promotionID uuid.UUID) (pp1 *Promotion, err error)
GetPromotion implements Datastore
func (DatastoreWithPrometheus) GetPromotionsMissingIssuer ¶
func (_d DatastoreWithPrometheus) GetPromotionsMissingIssuer(limit int) (ua1 []uuid.UUID, err error)
GetPromotionsMissingIssuer implements Datastore
func (DatastoreWithPrometheus) GetSumForTransactions ¶
func (_d DatastoreWithPrometheus) GetSumForTransactions(orderID uuid.UUID) (d1 decimal.Decimal, err error)
GetSumForTransactions implements Datastore
func (DatastoreWithPrometheus) GetWithdrawalsAssociated ¶
func (_d DatastoreWithPrometheus) GetWithdrawalsAssociated(walletID *uuid.UUID, claimID *uuid.UUID) (up1 *uuid.UUID, d1 decimal.Decimal, err error)
GetWithdrawalsAssociated implements Datastore
func (DatastoreWithPrometheus) InsertBAPReportEvent ¶
func (_d DatastoreWithPrometheus) InsertBAPReportEvent(ctx context.Context, paymentID uuid.UUID, amount decimal.Decimal) (up1 *uuid.UUID, err error)
InsertBAPReportEvent implements Datastore
func (DatastoreWithPrometheus) InsertBATLossEvent ¶
func (_d DatastoreWithPrometheus) InsertBATLossEvent(ctx context.Context, paymentID uuid.UUID, reportID int, amount decimal.Decimal, platform string) (b1 bool, err error)
InsertBATLossEvent implements Datastore
func (DatastoreWithPrometheus) InsertClobberedClaims ¶
func (_d DatastoreWithPrometheus) InsertClobberedClaims(ctx context.Context, ids []uuid.UUID, version int) (err error)
InsertClobberedClaims implements Datastore
func (DatastoreWithPrometheus) InsertIssuer ¶
func (_d DatastoreWithPrometheus) InsertIssuer(issuer *Issuer) (ip1 *Issuer, err error)
InsertIssuer implements Datastore
func (DatastoreWithPrometheus) InsertSuggestion ¶
func (_d DatastoreWithPrometheus) InsertSuggestion(credentials []cbr.CredentialRedemption, suggestionText string, suggestion []byte) (err error)
InsertSuggestion implements Datastore
func (DatastoreWithPrometheus) Migrate ¶
func (_d DatastoreWithPrometheus) Migrate(p1 ...uint) (err error)
Migrate implements Datastore
func (DatastoreWithPrometheus) NewMigrate ¶
func (_d DatastoreWithPrometheus) NewMigrate() (mp1 *migrate.Migrate, err error)
NewMigrate implements Datastore
func (DatastoreWithPrometheus) RawDB ¶
func (_d DatastoreWithPrometheus) RawDB() (dp1 *sqlx.DB)
RawDB implements Datastore
func (DatastoreWithPrometheus) RollbackTx ¶
func (_d DatastoreWithPrometheus) RollbackTx(tx *sqlx.Tx)
RollbackTx implements Datastore
func (DatastoreWithPrometheus) RollbackTxAndHandle ¶
func (_d DatastoreWithPrometheus) RollbackTxAndHandle(tx *sqlx.Tx) (err error)
RollbackTxAndHandle implements Datastore
func (DatastoreWithPrometheus) RunNextClaimJob ¶
func (_d DatastoreWithPrometheus) RunNextClaimJob(ctx context.Context, worker ClaimWorker) (b1 bool, err error)
RunNextClaimJob implements Datastore
func (DatastoreWithPrometheus) RunNextSuggestionJob ¶
func (_d DatastoreWithPrometheus) RunNextSuggestionJob(ctx context.Context, worker SuggestionWorker) (b1 bool, err error)
RunNextSuggestionJob implements Datastore
func (DatastoreWithPrometheus) SaveClaimCreds ¶
func (_d DatastoreWithPrometheus) SaveClaimCreds(claimCreds *ClaimCreds) (err error)
SaveClaimCreds implements Datastore
func (DatastoreWithPrometheus) UpdateOrder ¶
func (_d DatastoreWithPrometheus) UpdateOrder(orderID uuid.UUID, status string) (err error)
UpdateOrder implements Datastore
type DrainInfo ¶
type DrainInfo struct { PromotionID *uuid.UUID `json:"promotion_id,omitempty" db:"promotion_id"` TransactionID *uuid.UUID `json:"transaction_id,omitempty" db:"transaction_id"` CompletedAt *time.Time `json:"completed_at,omitempty" db:"completed_at"` State *string `json:"state,omitempty" db:"state"` ErrCode *string `json:"errcode,omitempty" db:"errcode"` Value decimal.Decimal `json:"value,omitempty" db:"value"` }
DrainInfo - generic custodian output data
type DrainJobRequest ¶
type DrainJobRequest struct {
Erred bool `json:"erred"`
}
DrainJobRequest holds data for drain job requests
type DrainTransfer ¶
type DrainTransfer struct { ID *uuid.UUID `db:"transaction_id" json:"transaction_id"` Total decimal.Decimal `db:"total" json:"total"` DepositID *string `db:"deposit_destination" json:"deposit_destination"` }
DrainTransfer info about the drains
type FundingSource ¶
type FundingSource struct { Type string `json:"type"` Amount decimal.Decimal `json:"amount"` Cohort string `json:"cohort"` PromotionID uuid.UUID `json:"promotion"` Credentials []cbr.CredentialRedemption `json:"-"` }
FundingSource describes where funds for this suggestion should come from
type GetClaimResponse ¶
type GetClaimResponse struct { SignedCreds jsonutils.JSONStringArray `json:"signedCreds"` BatchProof string `json:"batchProof"` PublicKey string `json:"publicKey"` }
GetClaimResponse includes signed credentials and a batch proof showing they were signed by the public key
type Issuer ¶
type Issuer struct { ID uuid.UUID `db:"id"` PromotionID uuid.UUID `db:"promotion_id"` Cohort string PublicKey string `db:"public_key"` }
Issuer includes information about a particular credential issuer
type MockClaimWorker ¶
type MockClaimWorker struct {
// contains filtered or unexported fields
}
MockClaimWorker is a mock of ClaimWorker interface.
func NewMockClaimWorker ¶
func NewMockClaimWorker(ctrl *gomock.Controller) *MockClaimWorker
NewMockClaimWorker creates a new mock instance.
func (*MockClaimWorker) EXPECT ¶
func (m *MockClaimWorker) EXPECT() *MockClaimWorkerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockClaimWorker) SignClaimCreds ¶
func (m *MockClaimWorker) SignClaimCreds(ctx context.Context, claimID go_uuid.UUID, issuer Issuer, blindedCreds []string) (*ClaimCreds, error)
SignClaimCreds mocks base method.
type MockClaimWorkerMockRecorder ¶
type MockClaimWorkerMockRecorder struct {
// contains filtered or unexported fields
}
MockClaimWorkerMockRecorder is the mock recorder for MockClaimWorker.
func (*MockClaimWorkerMockRecorder) SignClaimCreds ¶
func (mr *MockClaimWorkerMockRecorder) SignClaimCreds(ctx, claimID, issuer, blindedCreds interface{}) *gomock.Call
SignClaimCreds indicates an expected call of SignClaimCreds.
type MockDatastore ¶
type MockDatastore struct {
// contains filtered or unexported fields
}
MockDatastore is a mock of Datastore interface.
func NewMockDatastore ¶
func NewMockDatastore(ctrl *gomock.Controller) *MockDatastore
NewMockDatastore creates a new mock instance.
func (*MockDatastore) ActivatePromotion ¶
func (m *MockDatastore) ActivatePromotion(promotion *Promotion) error
ActivatePromotion mocks base method.
func (*MockDatastore) BeginTx ¶
func (m *MockDatastore) BeginTx() (*sqlx.Tx, error)
BeginTx mocks base method.
func (*MockDatastore) ClaimForWallet ¶
func (m *MockDatastore) ClaimForWallet(promotion *Promotion, issuer *Issuer, wallet *wallet.Info, blindedCreds jsonutils.JSONStringArray) (*Claim, error)
ClaimForWallet mocks base method.
func (*MockDatastore) CreateClaim ¶
func (m *MockDatastore) CreateClaim(promotionID go_uuid.UUID, walletID string, value, bonus decimal.Decimal, legacy bool) (*Claim, error)
CreateClaim mocks base method.
func (*MockDatastore) CreatePromotion ¶
func (m *MockDatastore) CreatePromotion(promotionType string, numGrants int, value decimal.Decimal, platform string) (*Promotion, error)
CreatePromotion mocks base method.
func (*MockDatastore) CreateTransaction ¶
func (m *MockDatastore) CreateTransaction(orderID go_uuid.UUID, externalTransactionID, status, currency, kind string, amount decimal.Decimal) (*Transaction, error)
CreateTransaction mocks base method.
func (*MockDatastore) DeactivatePromotion ¶
func (m *MockDatastore) DeactivatePromotion(promotion *Promotion) error
DeactivatePromotion mocks base method.
func (*MockDatastore) EXPECT ¶
func (m *MockDatastore) EXPECT() *MockDatastoreMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockDatastore) GetAvailablePromotions ¶
func (m *MockDatastore) GetAvailablePromotions(platform string) ([]Promotion, error)
GetAvailablePromotions mocks base method.
func (*MockDatastore) GetAvailablePromotionsForWallet ¶
func (m *MockDatastore) GetAvailablePromotionsForWallet(wallet *wallet.Info, platform string) ([]Promotion, error)
GetAvailablePromotionsForWallet mocks base method.
func (*MockDatastore) GetClaimByWalletAndPromotion ¶
func (m *MockDatastore) GetClaimByWalletAndPromotion(wallet *wallet.Info, promotionID *Promotion) (*Claim, error)
GetClaimByWalletAndPromotion mocks base method.
func (*MockDatastore) GetClaimCreds ¶
func (m *MockDatastore) GetClaimCreds(claimID go_uuid.UUID) (*ClaimCreds, error)
GetClaimCreds mocks base method.
func (*MockDatastore) GetClaimSummary ¶
func (m *MockDatastore) GetClaimSummary(walletID go_uuid.UUID, grantType string) (*ClaimSummary, error)
GetClaimSummary mocks base method.
func (*MockDatastore) GetIssuerByPublicKey ¶
func (m *MockDatastore) GetIssuerByPublicKey(publicKey string) (*Issuer, error)
GetIssuerByPublicKey mocks base method.
func (*MockDatastore) GetOrder ¶
func (m *MockDatastore) GetOrder(orderID go_uuid.UUID) (*Order, error)
GetOrder mocks base method.
func (*MockDatastore) GetPreClaim ¶
GetPreClaim mocks base method.
func (*MockDatastore) GetPromotion ¶
func (m *MockDatastore) GetPromotion(promotionID go_uuid.UUID) (*Promotion, error)
GetPromotion mocks base method.
func (*MockDatastore) GetPromotionsMissingIssuer ¶
func (m *MockDatastore) GetPromotionsMissingIssuer(limit int) ([]go_uuid.UUID, error)
GetPromotionsMissingIssuer mocks base method.
func (*MockDatastore) GetSumForTransactions ¶
GetSumForTransactions mocks base method.
func (*MockDatastore) GetWithdrawalsAssociated ¶
func (m *MockDatastore) GetWithdrawalsAssociated(walletID, claimID *go_uuid.UUID) (*go_uuid.UUID, decimal.Decimal, error)
GetWithdrawalsAssociated mocks base method.
func (*MockDatastore) InsertBAPReportEvent ¶
func (m *MockDatastore) InsertBAPReportEvent(ctx context.Context, paymentID go_uuid.UUID, amount decimal.Decimal) (*go_uuid.UUID, error)
InsertBAPReportEvent mocks base method.
func (*MockDatastore) InsertBATLossEvent ¶
func (m *MockDatastore) InsertBATLossEvent(ctx context.Context, paymentID go_uuid.UUID, reportID int, amount decimal.Decimal, platform string) (bool, error)
InsertBATLossEvent mocks base method.
func (*MockDatastore) InsertClobberedClaims ¶
func (m *MockDatastore) InsertClobberedClaims(ctx context.Context, ids []go_uuid.UUID, version int) error
InsertClobberedClaims mocks base method.
func (*MockDatastore) InsertIssuer ¶
func (m *MockDatastore) InsertIssuer(issuer *Issuer) (*Issuer, error)
InsertIssuer mocks base method.
func (*MockDatastore) InsertSuggestion ¶
func (m *MockDatastore) InsertSuggestion(credentials []cbr.CredentialRedemption, suggestionText string, suggestion []byte) error
InsertSuggestion mocks base method.
func (*MockDatastore) Migrate ¶
func (m *MockDatastore) Migrate(arg0 ...uint) error
Migrate mocks base method.
func (*MockDatastore) NewMigrate ¶
func (m *MockDatastore) NewMigrate() (*v4.Migrate, error)
NewMigrate mocks base method.
func (*MockDatastore) RollbackTx ¶
func (m *MockDatastore) RollbackTx(tx *sqlx.Tx)
RollbackTx mocks base method.
func (*MockDatastore) RollbackTxAndHandle ¶
func (m *MockDatastore) RollbackTxAndHandle(tx *sqlx.Tx) error
RollbackTxAndHandle mocks base method.
func (*MockDatastore) RunNextClaimJob ¶
func (m *MockDatastore) RunNextClaimJob(ctx context.Context, worker ClaimWorker) (bool, error)
RunNextClaimJob mocks base method.
func (*MockDatastore) RunNextSuggestionJob ¶
func (m *MockDatastore) RunNextSuggestionJob(ctx context.Context, worker SuggestionWorker) (bool, error)
RunNextSuggestionJob mocks base method.
func (*MockDatastore) SaveClaimCreds ¶
func (m *MockDatastore) SaveClaimCreds(claimCreds *ClaimCreds) error
SaveClaimCreds mocks base method.
func (*MockDatastore) UpdateOrder ¶
func (m *MockDatastore) UpdateOrder(orderID go_uuid.UUID, status string) error
UpdateOrder mocks base method.
type MockDatastoreMockRecorder ¶
type MockDatastoreMockRecorder struct {
// contains filtered or unexported fields
}
MockDatastoreMockRecorder is the mock recorder for MockDatastore.
func (*MockDatastoreMockRecorder) ActivatePromotion ¶
func (mr *MockDatastoreMockRecorder) ActivatePromotion(promotion interface{}) *gomock.Call
ActivatePromotion indicates an expected call of ActivatePromotion.
func (*MockDatastoreMockRecorder) BeginTx ¶
func (mr *MockDatastoreMockRecorder) BeginTx() *gomock.Call
BeginTx indicates an expected call of BeginTx.
func (*MockDatastoreMockRecorder) ClaimForWallet ¶
func (mr *MockDatastoreMockRecorder) ClaimForWallet(promotion, issuer, wallet, blindedCreds interface{}) *gomock.Call
ClaimForWallet indicates an expected call of ClaimForWallet.
func (*MockDatastoreMockRecorder) CreateClaim ¶
func (mr *MockDatastoreMockRecorder) CreateClaim(promotionID, walletID, value, bonus, legacy interface{}) *gomock.Call
CreateClaim indicates an expected call of CreateClaim.
func (*MockDatastoreMockRecorder) CreatePromotion ¶
func (mr *MockDatastoreMockRecorder) CreatePromotion(promotionType, numGrants, value, platform interface{}) *gomock.Call
CreatePromotion indicates an expected call of CreatePromotion.
func (*MockDatastoreMockRecorder) CreateTransaction ¶
func (mr *MockDatastoreMockRecorder) CreateTransaction(orderID, externalTransactionID, status, currency, kind, amount interface{}) *gomock.Call
CreateTransaction indicates an expected call of CreateTransaction.
func (*MockDatastoreMockRecorder) DeactivatePromotion ¶
func (mr *MockDatastoreMockRecorder) DeactivatePromotion(promotion interface{}) *gomock.Call
DeactivatePromotion indicates an expected call of DeactivatePromotion.
func (*MockDatastoreMockRecorder) GetAvailablePromotions ¶
func (mr *MockDatastoreMockRecorder) GetAvailablePromotions(platform interface{}) *gomock.Call
GetAvailablePromotions indicates an expected call of GetAvailablePromotions.
func (*MockDatastoreMockRecorder) GetAvailablePromotionsForWallet ¶
func (mr *MockDatastoreMockRecorder) GetAvailablePromotionsForWallet(wallet, platform interface{}) *gomock.Call
GetAvailablePromotionsForWallet indicates an expected call of GetAvailablePromotionsForWallet.
func (*MockDatastoreMockRecorder) GetClaimByWalletAndPromotion ¶
func (mr *MockDatastoreMockRecorder) GetClaimByWalletAndPromotion(wallet, promotionID interface{}) *gomock.Call
GetClaimByWalletAndPromotion indicates an expected call of GetClaimByWalletAndPromotion.
func (*MockDatastoreMockRecorder) GetClaimCreds ¶
func (mr *MockDatastoreMockRecorder) GetClaimCreds(claimID interface{}) *gomock.Call
GetClaimCreds indicates an expected call of GetClaimCreds.
func (*MockDatastoreMockRecorder) GetClaimSummary ¶
func (mr *MockDatastoreMockRecorder) GetClaimSummary(walletID, grantType interface{}) *gomock.Call
GetClaimSummary indicates an expected call of GetClaimSummary.
func (*MockDatastoreMockRecorder) GetIssuer ¶
func (mr *MockDatastoreMockRecorder) GetIssuer(promotionID, cohort interface{}) *gomock.Call
GetIssuer indicates an expected call of GetIssuer.
func (*MockDatastoreMockRecorder) GetIssuerByPublicKey ¶
func (mr *MockDatastoreMockRecorder) GetIssuerByPublicKey(publicKey interface{}) *gomock.Call
GetIssuerByPublicKey indicates an expected call of GetIssuerByPublicKey.
func (*MockDatastoreMockRecorder) GetOrder ¶
func (mr *MockDatastoreMockRecorder) GetOrder(orderID interface{}) *gomock.Call
GetOrder indicates an expected call of GetOrder.
func (*MockDatastoreMockRecorder) GetPreClaim ¶
func (mr *MockDatastoreMockRecorder) GetPreClaim(promotionID, walletID interface{}) *gomock.Call
GetPreClaim indicates an expected call of GetPreClaim.
func (*MockDatastoreMockRecorder) GetPromotion ¶
func (mr *MockDatastoreMockRecorder) GetPromotion(promotionID interface{}) *gomock.Call
GetPromotion indicates an expected call of GetPromotion.
func (*MockDatastoreMockRecorder) GetPromotionsMissingIssuer ¶
func (mr *MockDatastoreMockRecorder) GetPromotionsMissingIssuer(limit interface{}) *gomock.Call
GetPromotionsMissingIssuer indicates an expected call of GetPromotionsMissingIssuer.
func (*MockDatastoreMockRecorder) GetSumForTransactions ¶
func (mr *MockDatastoreMockRecorder) GetSumForTransactions(orderID interface{}) *gomock.Call
GetSumForTransactions indicates an expected call of GetSumForTransactions.
func (*MockDatastoreMockRecorder) GetWithdrawalsAssociated ¶
func (mr *MockDatastoreMockRecorder) GetWithdrawalsAssociated(walletID, claimID interface{}) *gomock.Call
GetWithdrawalsAssociated indicates an expected call of GetWithdrawalsAssociated.
func (*MockDatastoreMockRecorder) InsertBAPReportEvent ¶
func (mr *MockDatastoreMockRecorder) InsertBAPReportEvent(ctx, paymentID, amount interface{}) *gomock.Call
InsertBAPReportEvent indicates an expected call of InsertBAPReportEvent.
func (*MockDatastoreMockRecorder) InsertBATLossEvent ¶
func (mr *MockDatastoreMockRecorder) InsertBATLossEvent(ctx, paymentID, reportID, amount, platform interface{}) *gomock.Call
InsertBATLossEvent indicates an expected call of InsertBATLossEvent.
func (*MockDatastoreMockRecorder) InsertClobberedClaims ¶
func (mr *MockDatastoreMockRecorder) InsertClobberedClaims(ctx, ids, version interface{}) *gomock.Call
InsertClobberedClaims indicates an expected call of InsertClobberedClaims.
func (*MockDatastoreMockRecorder) InsertIssuer ¶
func (mr *MockDatastoreMockRecorder) InsertIssuer(issuer interface{}) *gomock.Call
InsertIssuer indicates an expected call of InsertIssuer.
func (*MockDatastoreMockRecorder) InsertSuggestion ¶
func (mr *MockDatastoreMockRecorder) InsertSuggestion(credentials, suggestionText, suggestion interface{}) *gomock.Call
InsertSuggestion indicates an expected call of InsertSuggestion.
func (*MockDatastoreMockRecorder) Migrate ¶
func (mr *MockDatastoreMockRecorder) Migrate(arg0 ...interface{}) *gomock.Call
Migrate indicates an expected call of Migrate.
func (*MockDatastoreMockRecorder) NewMigrate ¶
func (mr *MockDatastoreMockRecorder) NewMigrate() *gomock.Call
NewMigrate indicates an expected call of NewMigrate.
func (*MockDatastoreMockRecorder) RawDB ¶
func (mr *MockDatastoreMockRecorder) RawDB() *gomock.Call
RawDB indicates an expected call of RawDB.
func (*MockDatastoreMockRecorder) RollbackTx ¶
func (mr *MockDatastoreMockRecorder) RollbackTx(tx interface{}) *gomock.Call
RollbackTx indicates an expected call of RollbackTx.
func (*MockDatastoreMockRecorder) RollbackTxAndHandle ¶
func (mr *MockDatastoreMockRecorder) RollbackTxAndHandle(tx interface{}) *gomock.Call
RollbackTxAndHandle indicates an expected call of RollbackTxAndHandle.
func (*MockDatastoreMockRecorder) RunNextClaimJob ¶
func (mr *MockDatastoreMockRecorder) RunNextClaimJob(ctx, worker interface{}) *gomock.Call
RunNextClaimJob indicates an expected call of RunNextClaimJob.
func (*MockDatastoreMockRecorder) RunNextSuggestionJob ¶
func (mr *MockDatastoreMockRecorder) RunNextSuggestionJob(ctx, worker interface{}) *gomock.Call
RunNextSuggestionJob indicates an expected call of RunNextSuggestionJob.
func (*MockDatastoreMockRecorder) SaveClaimCreds ¶
func (mr *MockDatastoreMockRecorder) SaveClaimCreds(claimCreds interface{}) *gomock.Call
SaveClaimCreds indicates an expected call of SaveClaimCreds.
func (*MockDatastoreMockRecorder) UpdateOrder ¶
func (mr *MockDatastoreMockRecorder) UpdateOrder(orderID, status interface{}) *gomock.Call
UpdateOrder indicates an expected call of UpdateOrder.
type MockReadOnlyDatastore ¶
type MockReadOnlyDatastore struct {
// contains filtered or unexported fields
}
MockReadOnlyDatastore is a mock of ReadOnlyDatastore interface.
func NewMockReadOnlyDatastore ¶
func NewMockReadOnlyDatastore(ctrl *gomock.Controller) *MockReadOnlyDatastore
NewMockReadOnlyDatastore creates a new mock instance.
func (*MockReadOnlyDatastore) BeginTx ¶
func (m *MockReadOnlyDatastore) BeginTx() (*sqlx.Tx, error)
BeginTx mocks base method.
func (*MockReadOnlyDatastore) EXPECT ¶
func (m *MockReadOnlyDatastore) EXPECT() *MockReadOnlyDatastoreMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockReadOnlyDatastore) GetAvailablePromotions ¶
func (m *MockReadOnlyDatastore) GetAvailablePromotions(platform string) ([]Promotion, error)
GetAvailablePromotions mocks base method.
func (*MockReadOnlyDatastore) GetAvailablePromotionsForWallet ¶
func (m *MockReadOnlyDatastore) GetAvailablePromotionsForWallet(wallet *wallet.Info, platform string) ([]Promotion, error)
GetAvailablePromotionsForWallet mocks base method.
func (*MockReadOnlyDatastore) GetClaimByWalletAndPromotion ¶
func (m *MockReadOnlyDatastore) GetClaimByWalletAndPromotion(wallet *wallet.Info, promotionID *Promotion) (*Claim, error)
GetClaimByWalletAndPromotion mocks base method.
func (*MockReadOnlyDatastore) GetClaimCreds ¶
func (m *MockReadOnlyDatastore) GetClaimCreds(claimID go_uuid.UUID) (*ClaimCreds, error)
GetClaimCreds mocks base method.
func (*MockReadOnlyDatastore) GetClaimSummary ¶
func (m *MockReadOnlyDatastore) GetClaimSummary(walletID go_uuid.UUID, grantType string) (*ClaimSummary, error)
GetClaimSummary mocks base method.
func (*MockReadOnlyDatastore) GetIssuerByPublicKey ¶
func (m *MockReadOnlyDatastore) GetIssuerByPublicKey(publicKey string) (*Issuer, error)
GetIssuerByPublicKey mocks base method.
func (*MockReadOnlyDatastore) GetPreClaim ¶
func (m *MockReadOnlyDatastore) GetPreClaim(promotionID go_uuid.UUID, walletID string) (*Claim, error)
GetPreClaim mocks base method.
func (*MockReadOnlyDatastore) GetPromotion ¶
func (m *MockReadOnlyDatastore) GetPromotion(promotionID go_uuid.UUID) (*Promotion, error)
GetPromotion mocks base method.
func (*MockReadOnlyDatastore) GetPromotionsMissingIssuer ¶
func (m *MockReadOnlyDatastore) GetPromotionsMissingIssuer(limit int) ([]go_uuid.UUID, error)
GetPromotionsMissingIssuer mocks base method.
func (*MockReadOnlyDatastore) GetWithdrawalsAssociated ¶
func (m *MockReadOnlyDatastore) GetWithdrawalsAssociated(walletID, claimID *go_uuid.UUID) (*go_uuid.UUID, decimal.Decimal, error)
GetWithdrawalsAssociated mocks base method.
func (*MockReadOnlyDatastore) Migrate ¶
func (m *MockReadOnlyDatastore) Migrate(arg0 ...uint) error
Migrate mocks base method.
func (*MockReadOnlyDatastore) NewMigrate ¶
func (m *MockReadOnlyDatastore) NewMigrate() (*v4.Migrate, error)
NewMigrate mocks base method.
func (*MockReadOnlyDatastore) RawDB ¶
func (m *MockReadOnlyDatastore) RawDB() *sqlx.DB
RawDB mocks base method.
func (*MockReadOnlyDatastore) RollbackTx ¶
func (m *MockReadOnlyDatastore) RollbackTx(tx *sqlx.Tx)
RollbackTx mocks base method.
func (*MockReadOnlyDatastore) RollbackTxAndHandle ¶
func (m *MockReadOnlyDatastore) RollbackTxAndHandle(tx *sqlx.Tx) error
RollbackTxAndHandle mocks base method.
type MockReadOnlyDatastoreMockRecorder ¶
type MockReadOnlyDatastoreMockRecorder struct {
// contains filtered or unexported fields
}
MockReadOnlyDatastoreMockRecorder is the mock recorder for MockReadOnlyDatastore.
func (*MockReadOnlyDatastoreMockRecorder) BeginTx ¶
func (mr *MockReadOnlyDatastoreMockRecorder) BeginTx() *gomock.Call
BeginTx indicates an expected call of BeginTx.
func (*MockReadOnlyDatastoreMockRecorder) GetAvailablePromotions ¶
func (mr *MockReadOnlyDatastoreMockRecorder) GetAvailablePromotions(platform interface{}) *gomock.Call
GetAvailablePromotions indicates an expected call of GetAvailablePromotions.
func (*MockReadOnlyDatastoreMockRecorder) GetAvailablePromotionsForWallet ¶
func (mr *MockReadOnlyDatastoreMockRecorder) GetAvailablePromotionsForWallet(wallet, platform interface{}) *gomock.Call
GetAvailablePromotionsForWallet indicates an expected call of GetAvailablePromotionsForWallet.
func (*MockReadOnlyDatastoreMockRecorder) GetClaimByWalletAndPromotion ¶
func (mr *MockReadOnlyDatastoreMockRecorder) GetClaimByWalletAndPromotion(wallet, promotionID interface{}) *gomock.Call
GetClaimByWalletAndPromotion indicates an expected call of GetClaimByWalletAndPromotion.
func (*MockReadOnlyDatastoreMockRecorder) GetClaimCreds ¶
func (mr *MockReadOnlyDatastoreMockRecorder) GetClaimCreds(claimID interface{}) *gomock.Call
GetClaimCreds indicates an expected call of GetClaimCreds.
func (*MockReadOnlyDatastoreMockRecorder) GetClaimSummary ¶
func (mr *MockReadOnlyDatastoreMockRecorder) GetClaimSummary(walletID, grantType interface{}) *gomock.Call
GetClaimSummary indicates an expected call of GetClaimSummary.
func (*MockReadOnlyDatastoreMockRecorder) GetIssuer ¶
func (mr *MockReadOnlyDatastoreMockRecorder) GetIssuer(promotionID, cohort interface{}) *gomock.Call
GetIssuer indicates an expected call of GetIssuer.
func (*MockReadOnlyDatastoreMockRecorder) GetIssuerByPublicKey ¶
func (mr *MockReadOnlyDatastoreMockRecorder) GetIssuerByPublicKey(publicKey interface{}) *gomock.Call
GetIssuerByPublicKey indicates an expected call of GetIssuerByPublicKey.
func (*MockReadOnlyDatastoreMockRecorder) GetPreClaim ¶
func (mr *MockReadOnlyDatastoreMockRecorder) GetPreClaim(promotionID, walletID interface{}) *gomock.Call
GetPreClaim indicates an expected call of GetPreClaim.
func (*MockReadOnlyDatastoreMockRecorder) GetPromotion ¶
func (mr *MockReadOnlyDatastoreMockRecorder) GetPromotion(promotionID interface{}) *gomock.Call
GetPromotion indicates an expected call of GetPromotion.
func (*MockReadOnlyDatastoreMockRecorder) GetPromotionsMissingIssuer ¶
func (mr *MockReadOnlyDatastoreMockRecorder) GetPromotionsMissingIssuer(limit interface{}) *gomock.Call
GetPromotionsMissingIssuer indicates an expected call of GetPromotionsMissingIssuer.
func (*MockReadOnlyDatastoreMockRecorder) GetWithdrawalsAssociated ¶
func (mr *MockReadOnlyDatastoreMockRecorder) GetWithdrawalsAssociated(walletID, claimID interface{}) *gomock.Call
GetWithdrawalsAssociated indicates an expected call of GetWithdrawalsAssociated.
func (*MockReadOnlyDatastoreMockRecorder) Migrate ¶
func (mr *MockReadOnlyDatastoreMockRecorder) Migrate(arg0 ...interface{}) *gomock.Call
Migrate indicates an expected call of Migrate.
func (*MockReadOnlyDatastoreMockRecorder) NewMigrate ¶
func (mr *MockReadOnlyDatastoreMockRecorder) NewMigrate() *gomock.Call
NewMigrate indicates an expected call of NewMigrate.
func (*MockReadOnlyDatastoreMockRecorder) RawDB ¶
func (mr *MockReadOnlyDatastoreMockRecorder) RawDB() *gomock.Call
RawDB indicates an expected call of RawDB.
func (*MockReadOnlyDatastoreMockRecorder) RollbackTx ¶
func (mr *MockReadOnlyDatastoreMockRecorder) RollbackTx(tx interface{}) *gomock.Call
RollbackTx indicates an expected call of RollbackTx.
func (*MockReadOnlyDatastoreMockRecorder) RollbackTxAndHandle ¶
func (mr *MockReadOnlyDatastoreMockRecorder) RollbackTxAndHandle(tx interface{}) *gomock.Call
RollbackTxAndHandle indicates an expected call of RollbackTxAndHandle.
type Order ¶
type Order struct { ID uuid.UUID `json:"id" db:"id"` CreatedAt time.Time `json:"createdAt" db:"created_at"` Currency string `json:"currency" db:"currency"` UpdatedAt time.Time `json:"updatedAt" db:"updated_at"` TotalPrice decimal.Decimal `json:"totalPrice" db:"total_price"` MerchantID string `json:"merchantId" db:"merchant_id"` Location datastore.NullString `json:"location" db:"location"` Status string `json:"status" db:"status"` Items []OrderItem `json:"items"` AllowedPaymentMethods pq.StringArray `json:"allowedPaymentMethods" db:"allowed_payment_methods"` Metadata datastore.Metadata `json:"metadata" db:"metadata"` LastPaidAt *time.Time `json:"lastPaidAt" db:"last_paid_at"` ExpiresAt *time.Time `json:"expiresAt" db:"expires_at"` ValidFor *time.Duration `json:"validFor" db:"valid_for"` TrialDays *int64 `json:"-" db:"trial_days"` }
Order includes information about a particular order
type OrderItem ¶
type OrderItem struct { ID uuid.UUID `json:"id" db:"id"` OrderID uuid.UUID `json:"orderId" db:"order_id"` SKU string `json:"sku" db:"sku"` CreatedAt *time.Time `json:"createdAt" db:"created_at"` UpdatedAt *time.Time `json:"updatedAt" db:"updated_at"` Currency string `json:"currency" db:"currency"` Quantity int `json:"quantity" db:"quantity"` Price decimal.Decimal `json:"price" db:"price"` Subtotal decimal.Decimal `json:"subtotal"` Location datastore.NullString `json:"location" db:"location"` Description datastore.NullString `json:"description" db:"description"` CredentialType string `json:"credentialType" db:"credential_type"` ValidFor *time.Duration `json:"validFor" db:"valid_for"` ValidForISO *string `json:"validForIso" db:"valid_for_iso"` Metadata datastore.Metadata `json:"metadata" db:"metadata"` IssuanceIntervalISO *string `json:"issuanceInterval" db:"issuance_interval"` EachCredentialValidForISO *string `json:"-" db:"each_credential_valid_for_iso"` }
OrderItem includes information about a particular order item
type Postgres ¶
Postgres is a Datastore wrapper around a postgres database
func (*Postgres) ActivatePromotion ¶
ActivatePromotion marks a particular promotion as active
func (*Postgres) ClaimForWallet ¶
func (pg *Postgres) ClaimForWallet(promotion *Promotion, issuer *Issuer, wallet *walletutils.Info, blindedCreds jsonutils.JSONStringArray) (*Claim, error)
ClaimForWallet is used to either create a new claim or convert a preregistered claim for a particular promotion
func (*Postgres) CreateClaim ¶
func (pg *Postgres) CreateClaim(promotionID uuid.UUID, walletID string, value decimal.Decimal, bonus decimal.Decimal, legacy bool) (*Claim, error)
CreateClaim is used to "pre-register" an unredeemed claim for a particular wallet
func (*Postgres) CreatePromotion ¶
func (pg *Postgres) CreatePromotion(promotionType string, numGrants int, value decimal.Decimal, platform string) (*Promotion, error)
CreatePromotion given the promotion type, initial number of grants and the desired value of those grants
func (*Postgres) CreateTransaction ¶
func (pg *Postgres) CreateTransaction(orderID uuid.UUID, externalTransactionID string, status string, currency string, kind string, amount decimal.Decimal) (*Transaction, error)
CreateTransaction creates a transaction given an orderID, externalTransactionID, currency, and a kind of transaction
func (*Postgres) DeactivatePromotion ¶
DeactivatePromotion marks a particular promotion as not active
func (*Postgres) GetAvailablePromotions ¶
GetAvailablePromotions returns the list of available promotions for all wallets
func (*Postgres) GetAvailablePromotionsForWallet ¶
func (pg *Postgres) GetAvailablePromotionsForWallet(wallet *walletutils.Info, platform string) ([]Promotion, error)
GetAvailablePromotionsForWallet returns the list of available promotions for the wallet
func (*Postgres) GetClaimByWalletAndPromotion ¶
func (pg *Postgres) GetClaimByWalletAndPromotion( wallet *walletutils.Info, promotion *Promotion, ) (*Claim, error)
GetClaimByWalletAndPromotion gets whether a wallet has a claimed grants with the given promotion and returns the grant if so
func (*Postgres) GetClaimCreds ¶
func (pg *Postgres) GetClaimCreds(claimID uuid.UUID) (*ClaimCreds, error)
GetClaimCreds returns the claim credentials for a ClaimID
func (*Postgres) GetClaimSummary ¶
GetClaimSummary aggregates the values of a single wallet's claims
func (*Postgres) GetIssuerByPublicKey ¶
GetIssuerByPublicKey or return an error
func (*Postgres) GetPreClaim ¶
GetPreClaim is used to fetch a "pre-registered" claim for a particular wallet
func (*Postgres) GetPromotion ¶
GetPromotion by ID
func (*Postgres) GetPromotionsMissingIssuer ¶
GetPromotionsMissingIssuer returns the list of promotions missing an issuer
func (*Postgres) GetSumForTransactions ¶
GetSumForTransactions returns the calculated sum
func (*Postgres) GetWithdrawalsAssociated ¶
func (pg *Postgres) GetWithdrawalsAssociated(walletID, claimID *uuid.UUID) (*uuid.UUID, decimal.Decimal, error)
GetWithdrawalsAssociated returns the promotion and total amount of claims drained for associated wallets
func (*Postgres) InsertBAPReportEvent ¶
func (pg *Postgres) InsertBAPReportEvent(ctx context.Context, paymentID uuid.UUID, amount decimal.Decimal) (*uuid.UUID, error)
InsertBAPReportEvent inserts a BAP report
func (*Postgres) InsertBATLossEvent ¶
func (pg *Postgres) InsertBATLossEvent( ctx context.Context, paymentID uuid.UUID, reportID int, amount decimal.Decimal, platform string, ) (bool, error)
InsertBATLossEvent inserts claims of lost bat to db
func (*Postgres) InsertClobberedClaims ¶
InsertClobberedClaims inserts clobbered claims to the db
func (*Postgres) InsertIssuer ¶
InsertIssuer inserts the given issuer
func (*Postgres) InsertSuggestion ¶
func (pg *Postgres) InsertSuggestion(credentials []cbr.CredentialRedemption, suggestionText string, suggestionEvent []byte) error
InsertSuggestion inserts a transaction awaiting validation
func (*Postgres) RunNextClaimJob ¶
RunNextClaimJob to sign claim credentials if there is a claim waiting, returning true if a job was attempted
func (*Postgres) RunNextSuggestionJob ¶
func (pg *Postgres) RunNextSuggestionJob(ctx context.Context, worker SuggestionWorker) (bool, error)
RunNextSuggestionJob to process a suggestion if there is one waiting
func (*Postgres) SaveClaimCreds ¶
func (pg *Postgres) SaveClaimCreds(creds *ClaimCreds) error
SaveClaimCreds updates the stored claim credentials
func (*Postgres) UpdateDrainJobAsRetriable ¶
UpdateDrainJobAsRetriable - updates a drain job as retriable
type Promotion ¶
type Promotion struct { ID uuid.UUID `json:"id" db:"id"` CreatedAt time.Time `json:"createdAt" db:"created_at"` ExpiresAt time.Time `json:"expiresAt" db:"expires_at"` Version int `json:"version" db:"version"` SuggestionsPerGrant int `json:"suggestionsPerGrant" db:"suggestions_per_grant"` ApproximateValue decimal.Decimal `json:"approximateValue" db:"approximate_value"` Type string `json:"type" db:"promotion_type"` RemainingGrants int `json:"-" db:"remaining_grants"` Active bool `json:"-" db:"active"` Available bool `json:"available" db:"available"` Platform string `json:"platform" db:"platform"` PublicKeys jsonutils.JSONStringArray `json:"publicKeys" db:"public_keys"` // warning, legacy claimed is not defined in promotions, but rather as a claim attribute LegacyClaimed bool `json:"legacyClaimed" db:"legacy_claimed"` ClaimableUntil time.Time `json:"claimableUntil" db:"claimable_until"` ClaimableUntilOverride *time.Time `json:"-" db:"claimable_until_override"` }
Promotion includes information about a particular promotion
func (*Promotion) CredentialValue ¶
CredentialValue returns the approximate value of a credential
type PromotionsResponse ¶
type PromotionsResponse struct {
Promotions []Promotion `json:"promotions"`
}
PromotionsResponse is a list of known promotions to be consumed by the browser
type ReadOnlyDatastore ¶
type ReadOnlyDatastore interface { datastore.Datastore // GetPreClaim is used to fetch a "pre-registered" claim for a particular wallet GetPreClaim(promotionID uuid.UUID, walletID string) (*Claim, error) // GetAvailablePromotionsForWallet returns the list of available promotions for the wallet GetAvailablePromotionsForWallet(wallet *walletutils.Info, platform string) ([]Promotion, error) // GetWithdrawalsAssociated returns the promotion and total amount of claims drained for associated wallets GetWithdrawalsAssociated(walletID, claimID *uuid.UUID) (*uuid.UUID, decimal.Decimal, error) // GetAvailablePromotions returns the list of available promotions for all wallets GetAvailablePromotions(platform string) ([]Promotion, error) // GetPromotionsMissingIssuer returns the list of promotions missing an issuer GetPromotionsMissingIssuer(limit int) ([]uuid.UUID, error) // GetClaimCreds returns the claim credentials for a ClaimID GetClaimCreds(claimID uuid.UUID) (*ClaimCreds, error) // GetPromotion by ID GetPromotion(promotionID uuid.UUID) (*Promotion, error) // GetIssuer by PromotionID and cohort GetIssuer(promotionID uuid.UUID, cohort string) (*Issuer, error) // GetIssuerByPublicKey GetIssuerByPublicKey(publicKey string) (*Issuer, error) // GetClaimSummary gets the number of grants for a specific type GetClaimSummary(walletID uuid.UUID, grantType string) (*ClaimSummary, error) // GetClaimByWalletAndPromotion gets whether a wallet has a claimed grants // with the given promotion and returns the grant if so GetClaimByWalletAndPromotion(wallet *walletutils.Info, promotionID *Promotion) (*Claim, error) }
ReadOnlyDatastore includes all database methods that can be made with a read only db connection
type ReadOnlyDatastoreWithPrometheus ¶
type ReadOnlyDatastoreWithPrometheus struct {
// contains filtered or unexported fields
}
ReadOnlyDatastoreWithPrometheus implements ReadOnlyDatastore interface with all methods wrapped with Prometheus metrics
func NewReadOnlyDatastoreWithPrometheus ¶
func NewReadOnlyDatastoreWithPrometheus(base ReadOnlyDatastore, instanceName string) ReadOnlyDatastoreWithPrometheus
NewReadOnlyDatastoreWithPrometheus returns an instance of the ReadOnlyDatastore decorated with prometheus summary metric
func (ReadOnlyDatastoreWithPrometheus) BeginTx ¶
func (_d ReadOnlyDatastoreWithPrometheus) BeginTx() (tp1 *sqlx.Tx, err error)
BeginTx implements ReadOnlyDatastore
func (ReadOnlyDatastoreWithPrometheus) GetAvailablePromotions ¶
func (_d ReadOnlyDatastoreWithPrometheus) GetAvailablePromotions(platform string) (pa1 []Promotion, err error)
GetAvailablePromotions implements ReadOnlyDatastore
func (ReadOnlyDatastoreWithPrometheus) GetAvailablePromotionsForWallet ¶
func (_d ReadOnlyDatastoreWithPrometheus) GetAvailablePromotionsForWallet(wallet *walletutils.Info, platform string) (pa1 []Promotion, err error)
GetAvailablePromotionsForWallet implements ReadOnlyDatastore
func (ReadOnlyDatastoreWithPrometheus) GetClaimByWalletAndPromotion ¶
func (_d ReadOnlyDatastoreWithPrometheus) GetClaimByWalletAndPromotion(wallet *walletutils.Info, promotionID *Promotion) (cp1 *Claim, err error)
GetClaimByWalletAndPromotion implements ReadOnlyDatastore
func (ReadOnlyDatastoreWithPrometheus) GetClaimCreds ¶
func (_d ReadOnlyDatastoreWithPrometheus) GetClaimCreds(claimID uuid.UUID) (cp1 *ClaimCreds, err error)
GetClaimCreds implements ReadOnlyDatastore
func (ReadOnlyDatastoreWithPrometheus) GetClaimSummary ¶
func (_d ReadOnlyDatastoreWithPrometheus) GetClaimSummary(walletID uuid.UUID, grantType string) (cp1 *ClaimSummary, err error)
GetClaimSummary implements ReadOnlyDatastore
func (ReadOnlyDatastoreWithPrometheus) GetIssuer ¶
func (_d ReadOnlyDatastoreWithPrometheus) GetIssuer(promotionID uuid.UUID, cohort string) (ip1 *Issuer, err error)
GetIssuer implements ReadOnlyDatastore
func (ReadOnlyDatastoreWithPrometheus) GetIssuerByPublicKey ¶
func (_d ReadOnlyDatastoreWithPrometheus) GetIssuerByPublicKey(publicKey string) (ip1 *Issuer, err error)
GetIssuerByPublicKey implements ReadOnlyDatastore
func (ReadOnlyDatastoreWithPrometheus) GetPreClaim ¶
func (_d ReadOnlyDatastoreWithPrometheus) GetPreClaim(promotionID uuid.UUID, walletID string) (cp1 *Claim, err error)
GetPreClaim implements ReadOnlyDatastore
func (ReadOnlyDatastoreWithPrometheus) GetPromotion ¶
func (_d ReadOnlyDatastoreWithPrometheus) GetPromotion(promotionID uuid.UUID) (pp1 *Promotion, err error)
GetPromotion implements ReadOnlyDatastore
func (ReadOnlyDatastoreWithPrometheus) GetPromotionsMissingIssuer ¶
func (_d ReadOnlyDatastoreWithPrometheus) GetPromotionsMissingIssuer(limit int) (ua1 []uuid.UUID, err error)
GetPromotionsMissingIssuer implements ReadOnlyDatastore
func (ReadOnlyDatastoreWithPrometheus) GetWithdrawalsAssociated ¶
func (_d ReadOnlyDatastoreWithPrometheus) GetWithdrawalsAssociated(walletID *uuid.UUID, claimID *uuid.UUID) (up1 *uuid.UUID, d1 decimal.Decimal, err error)
GetWithdrawalsAssociated implements ReadOnlyDatastore
func (ReadOnlyDatastoreWithPrometheus) Migrate ¶
func (_d ReadOnlyDatastoreWithPrometheus) Migrate(p1 ...uint) (err error)
Migrate implements ReadOnlyDatastore
func (ReadOnlyDatastoreWithPrometheus) NewMigrate ¶
func (_d ReadOnlyDatastoreWithPrometheus) NewMigrate() (mp1 *migrate.Migrate, err error)
NewMigrate implements ReadOnlyDatastore
func (ReadOnlyDatastoreWithPrometheus) RawDB ¶
func (_d ReadOnlyDatastoreWithPrometheus) RawDB() (dp1 *sqlx.DB)
RawDB implements ReadOnlyDatastore
func (ReadOnlyDatastoreWithPrometheus) RollbackTx ¶
func (_d ReadOnlyDatastoreWithPrometheus) RollbackTx(tx *sqlx.Tx)
RollbackTx implements ReadOnlyDatastore
func (ReadOnlyDatastoreWithPrometheus) RollbackTxAndHandle ¶
func (_d ReadOnlyDatastoreWithPrometheus) RollbackTxAndHandle(tx *sqlx.Tx) (err error)
RollbackTxAndHandle implements ReadOnlyDatastore
type Service ¶
type Service struct { Datastore Datastore RoDatastore ReadOnlyDatastore // contains filtered or unexported fields }
Service contains datastore and challenge bypass client connections
func InitService ¶
func InitService( ctx context.Context, promotionDB Datastore, promotionRODB ReadOnlyDatastore, walletService *wallet.Service, ) (*Service, error)
InitService creates a service using the passed datastore and clients configured from the environment
func (*Service) ClaimPromotionForWallet ¶
func (service *Service) ClaimPromotionForWallet( ctx context.Context, promotionID uuid.UUID, walletID uuid.UUID, blindedCreds []string, ) (*uuid.UUID, error)
ClaimPromotionForWallet attempts to claim the promotion on behalf of a wallet and returning the ClaimID It kicks off asynchronous signing of the credentials on success
func (*Service) CreateIssuer ¶
func (service *Service) CreateIssuer(ctx context.Context, promotionID uuid.UUID, cohort string) (*Issuer, error)
CreateIssuer creates a new challenge bypass credential issuer, saving it's information into the datastore
func (*Service) FetchAdminAttestationWalletID ¶
FetchAdminAttestationWalletID - retrieves walletID from topic
func (*Service) GetAvailablePromotions ¶
func (service *Service) GetAvailablePromotions( ctx context.Context, walletID *uuid.UUID, platform string, migrate bool, ) (*[]Promotion, error)
GetAvailablePromotions first tries to look up the wallet and then retrieves available promotions
func (*Service) GetCredentialRedemptions ¶
func (service *Service) GetCredentialRedemptions(ctx context.Context, credentials []CredentialBinding) (total decimal.Decimal, requestCredentials []cbr.CredentialRedemption, fundingSources map[string]FundingSource, promotions map[string]*Promotion, err error)
GetCredentialRedemptions as well as total and funding sources from a list of credential bindings
func (*Service) GetOrCreateIssuer ¶
func (service *Service) GetOrCreateIssuer(ctx context.Context, promotionID uuid.UUID, cohort string) (*Issuer, error)
GetOrCreateIssuer gets a matching issuer if one exists and otherwise creates one
func (*Service) InitKafka ¶
InitKafka by creating a kafka writer and creating local copies of codecs
func (*Service) LookupVerifier ¶
func (service *Service) LookupVerifier(ctx context.Context, keyID string) (context.Context, httpsignature.Verifier, error)
LookupVerifier based on the HTTP signing keyID, which in our case is the walletID
func (*Service) MintGrant ¶
func (service *Service) MintGrant(ctx context.Context, walletID uuid.UUID, total decimal.Decimal, promotions ...uuid.UUID) error
MintGrant create a new grant for the wallet specified with the total specified
func (*Service) PauseWorker ¶
PauseWorker - pause worker until time specified
func (*Service) ReadableDatastore ¶
func (service *Service) ReadableDatastore() ReadOnlyDatastore
ReadableDatastore returns a read only datastore if available, otherwise a normal datastore
func (*Service) RedeemAndCreateSuggestionEvent ¶
func (service *Service) RedeemAndCreateSuggestionEvent(ctx context.Context, credentials []cbr.CredentialRedemption, suggestionText string, suggestion []byte) error
RedeemAndCreateSuggestionEvent after validating that all the credential bindings
func (*Service) SignClaimCreds ¶
func (service *Service) SignClaimCreds(ctx context.Context, claimID uuid.UUID, issuer Issuer, blindedCreds []string) (*ClaimCreds, error)
SignClaimCreds signs the blinded credentials
func (*Service) Suggest ¶
func (service *Service) Suggest(ctx context.Context, credentials []CredentialBinding, suggestionText string) error
Suggest that a contribution is made
func (*Service) TryUpgradeSuggestionEvent ¶
TryUpgradeSuggestionEvent from JSON format to Avro, filling in any potentially missing fields
type Suggestion ¶
type Suggestion struct { Type string `json:"type" valid:"in(auto-contribute|oneoff-tip|recurring-tip|payment)"` Channel string `json:"channel" valid:"-"` OrderID *uuid.UUID `json:"orderId,omitempty" valid:"-"` }
Suggestion encapsulates information from the user about where /how they want to contribute
func (*Suggestion) Base64Decode ¶
func (s *Suggestion) Base64Decode(text string) error
Base64Decode unmarshalls the suggestion from a string.
type SuggestionEvent ¶
type SuggestionEvent struct { ID uuid.UUID `json:"id"` CreatedAt time.Time `json:"createdAt"` Suggestion TotalAmount decimal.Decimal `json:"totalAmount"` Funding []FundingSource `json:"funding"` }
SuggestionEvent encapsulates user and server provided information about a request to contribute
type SuggestionJob ¶
type SuggestionJob struct { ID uuid.UUID `db:"id"` Credentials string `db:"credentials"` SuggestionText string `db:"suggestion_text"` SuggestionEvent []byte `db:"suggestion_event"` Erred bool `db:"erred"` ErrCode *string `db:"errcode"` CreatedAt time.Time `db:"created_at"` }
SuggestionJob - representation of a suggestion job
type SuggestionRequest ¶
type SuggestionRequest struct { Suggestion string `json:"suggestion" valid:"base64"` Credentials []CredentialBinding `json:"credentials"` }
SuggestionRequest includes a suggestion payload and credentials to be redeemed
type SuggestionWorker ¶
type SuggestionWorker interface { RedeemAndCreateSuggestionEvent(ctx context.Context, credentials []cbr.CredentialRedemption, suggestionText string, suggestion []byte) error PauseWorker(until time.Time) IsPaused() bool }
SuggestionWorker attempts to work on a suggestion job by redeeming the credentials and emitting the event
type Transaction ¶
type Transaction struct { ID uuid.UUID `json:"id" db:"id"` OrderID uuid.UUID `json:"order_id" db:"order_id"` CreatedAt time.Time `json:"createdAt" db:"created_at"` UpdatedAt time.Time `json:"updatedAt" db:"updated_at"` ExternalTransactionID string `json:"external_transaction_id" db:"external_transaction_id"` Status string `json:"status" db:"status"` Currency string `json:"currency" db:"currency"` Kind string `json:"kind" db:"kind"` Amount decimal.Decimal `json:"amount" db:"amount"` }
Transaction includes information about a particular order. Status can be pending, failure, completed, or error.