reputation

package
v0.0.0-...-f003305 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2024 License: MPL-2.0 Imports: 17 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// CohortNil - bad cohort
	CohortNil int
	// CohortOK - ok cohort
	CohortOK = 1
	// CohortTooYoung - too young cohort
	CohortTooYoung = 2
	// CohortWithdrawalLimits - limited cohort
	CohortWithdrawalLimits = 4
	// CohortGeoResetDifferent - different geo than orig
	CohortGeoResetDifferent = 7
)

Functions

func ProxyRouter

func ProxyRouter(
	reputationServer string,
	reputationToken string,
) http.HandlerFunc

ProxyRouter is a reverse proxy to reputation endpoints for client access

Types

type Client

type Client interface {
	IsWalletReputable(ctx context.Context, id uuid.UUID, platform string) (bool, error)
	IsWalletAdsReputable(ctx context.Context, id uuid.UUID, platform string) (bool, error)
	IsDrainReputable(ctx context.Context, id, promotionID uuid.UUID, withdrawAmount decimal.Decimal) (bool, []int, error)
	IsLinkingReputable(ctx context.Context, id uuid.UUID, country string) (bool, []int, error)
	IsWalletOnPlatform(ctx context.Context, id uuid.UUID, platform string) (bool, error)
	UpsertReputationSummary(ctx context.Context, paymentID, geoCountry string) error
	UpdateReputationSummary(ctx context.Context, paymentID string, verifiedWallet bool) error
}

Client abstracts over the underlying client

func New

func New() (Client, error)

New returns a new HTTPClient, retrieving the base URL from the environment

type ClientWithPrometheus

type ClientWithPrometheus struct {
	// contains filtered or unexported fields
}

ClientWithPrometheus implements Client interface with all methods wrapped with Prometheus metrics

func NewClientWithPrometheus

func NewClientWithPrometheus(base Client, instanceName string) ClientWithPrometheus

NewClientWithPrometheus returns an instance of the Client decorated with prometheus summary metric

func (ClientWithPrometheus) IsDrainReputable

func (_d ClientWithPrometheus) IsDrainReputable(ctx context.Context, id uuid.UUID, promotionID uuid.UUID, withdrawAmount decimal.Decimal) (b1 bool, ia1 []int, err error)

IsDrainReputable implements Client

func (ClientWithPrometheus) IsLinkingReputable

func (_d ClientWithPrometheus) IsLinkingReputable(ctx context.Context, id uuid.UUID, country string) (b1 bool, ia1 []int, err error)

IsLinkingReputable implements Client

func (ClientWithPrometheus) IsWalletAdsReputable

func (_d ClientWithPrometheus) IsWalletAdsReputable(ctx context.Context, id uuid.UUID, platform string) (b1 bool, err error)

IsWalletAdsReputable implements Client

func (ClientWithPrometheus) IsWalletOnPlatform

func (_d ClientWithPrometheus) IsWalletOnPlatform(ctx context.Context, id uuid.UUID, platform string) (b1 bool, err error)

IsWalletOnPlatform implements Client

func (ClientWithPrometheus) IsWalletReputable

func (_d ClientWithPrometheus) IsWalletReputable(ctx context.Context, id uuid.UUID, platform string) (b1 bool, err error)

IsWalletReputable implements Client

func (ClientWithPrometheus) UpdateReputationSummary

func (_d ClientWithPrometheus) UpdateReputationSummary(ctx context.Context, paymentID string, verifiedWallet bool) (err error)

UpdateReputationSummary implements Client

func (ClientWithPrometheus) UpsertReputationSummary

func (_d ClientWithPrometheus) UpsertReputationSummary(ctx context.Context, paymentID string, geoCountry string) (err error)

UpsertReputationSummary implements Client

type HTTPClient

type HTTPClient struct {
	// contains filtered or unexported fields
}

HTTPClient wraps http.Client for interacting with the reputation server

func (*HTTPClient) IsDrainReputable

func (c *HTTPClient) IsDrainReputable(
	ctx context.Context,
	paymentID, promotionID uuid.UUID,
	withdrawalAmount decimal.Decimal,
) (bool, []int, error)

IsDrainReputable makes the request to the reputation server and returns whether a paymentId has enough reputation to claim a grant

func (*HTTPClient) IsLinkingReputable

func (c *HTTPClient) IsLinkingReputable(
	ctx context.Context,
	paymentID uuid.UUID,
	country string,
) (bool, []int, error)

IsLinkingReputable makes the request to the reputation server and returns whether a paymentId has enough reputation to claim a grant

func (*HTTPClient) IsWalletAdsReputable

func (c *HTTPClient) IsWalletAdsReputable(
	ctx context.Context,
	paymentID uuid.UUID,
	platform string,
) (bool, error)

IsWalletAdsReputable makes the request to the reputation server and returns whether a paymentId has enough reputation to claim a grant

func (*HTTPClient) IsWalletOnPlatform

func (c *HTTPClient) IsWalletOnPlatform(
	ctx context.Context,
	paymentID uuid.UUID,
	platform string,
) (bool, error)

IsWalletOnPlatform makes the request to the reputation server and returns whether a paymentId is on a given platform

func (*HTTPClient) IsWalletReputable

func (c *HTTPClient) IsWalletReputable(
	ctx context.Context,
	paymentID uuid.UUID,
	platform string,
) (bool, error)

IsWalletReputable makes the request to the reputation server and returns whether a paymentId has enough reputation to claim a grant

func (*HTTPClient) UpdateReputationSummary

func (c *HTTPClient) UpdateReputationSummary(ctx context.Context, paymentID string, verifiedWallet bool) error

UpdateReputationSummary calls the reputation summary update endpoint with the values.

func (*HTTPClient) UpsertReputationSummary

func (c *HTTPClient) UpsertReputationSummary(ctx context.Context, paymentID, geoCountry string) error

UpsertReputationSummary calls the reputation summary upsert endpoint and creates or updates the reputation summary identified by the paymentID with the given geo country.

type IsDrainReputableOpts

type IsDrainReputableOpts struct {
	WithdrawalAmount string `url:"withdrawal_amount"`
	PromotionID      string `url:"promotion_id"`
}

IsDrainReputableOpts - the query string options for the is reputable api call

func (*IsDrainReputableOpts) GenerateQueryString

func (iro *IsDrainReputableOpts) GenerateQueryString() (url.Values, error)

GenerateQueryString - implement the QueryStringBody interface

type IsLinkingReputableRequestQSB

type IsLinkingReputableRequestQSB struct {
	Country string `url:"country,omitempty"`
}

IsLinkingReputableRequestQSB - query string "body" for is linking reputable requests

func (*IsLinkingReputableRequestQSB) GenerateQueryString

func (ilrrqsb *IsLinkingReputableRequestQSB) GenerateQueryString() (url.Values, error)

GenerateQueryString - implement the QueryStringBody interface

type IsReputableOpts

type IsReputableOpts struct {
	Platform string `url:"platform"`
}

IsReputableOpts - the query string options for the is reputable api call

func (*IsReputableOpts) GenerateQueryString

func (iro *IsReputableOpts) GenerateQueryString() (url.Values, error)

GenerateQueryString - implement the QueryStringBody interface

type IsReputableResponse

type IsReputableResponse struct {
	Cohorts []int `json:"cohorts"`
}

IsReputableResponse is what the reputation server will send back when we ask if a wallet is reputable

type IsWalletOnPlatformOpts

type IsWalletOnPlatformOpts struct {
	PriorTo string `url:"priorTo"`
}

IsWalletOnPlatformOpts - the query string options for the is reputable api call

func (*IsWalletOnPlatformOpts) GenerateQueryString

func (iwopo *IsWalletOnPlatformOpts) GenerateQueryString() (url.Values, error)

GenerateQueryString - implement the QueryStringBody interface

type IsWalletOnPlatformResponse

type IsWalletOnPlatformResponse struct {
	IsOnPlatform bool `json:"isOnPlatform"`
}

IsWalletOnPlatformResponse - will send back indication if wallet is on said platform

type IsWalletReputableResponse

type IsWalletReputableResponse struct {
	IsReputable bool `json:"isReputable"`
}

IsWalletReputableResponse is what the reputation server will send back when we ask if a wallet is reputable

Directories

Path Synopsis
Package mock_reputation is a generated GoMock package.
Package mock_reputation is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL