Documentation ¶
Index ¶
- Constants
- Variables
- type DisbursementInstructionsValidator
- type DisbursementQueryValidator
- type DisbursementRequestValidator
- type GoogleReCAPTCHAValidator
- type HTTPClient
- type PatchWalletRequest
- type PaymentQueryValidator
- type QueryValidator
- type ReCAPTCHAValidator
- type ReCAPTCHAValidatorMock
- type ReceiverQueryValidator
- type ReceiverRegistrationValidator
- type UpdateReceiverRequest
- type UpdateReceiverValidator
- type UserQueryValidator
- type Validator
- type WalletRequest
- type WalletValidator
Constants ¶
const ( VERIFICATION_FIELD_PIN_MIN_LENGTH = 4 VERIFICATION_FIELD_PIN_MAX_LENGTH = 8 VERIFICATION_FIELD_MAX_ID_LENGTH = 50 )
Variables ¶
var ( DefaultUserSortField = data.SortFieldEmail DefaultUserSortOrder = data.SortOrderASC AllowedUserSorts = []data.SortField{data.SortFieldEmail, data.SortFieldIsActive} )
Functions ¶
This section is empty.
Types ¶
type DisbursementInstructionsValidator ¶
type DisbursementInstructionsValidator struct { *Validator // contains filtered or unexported fields }
func NewDisbursementInstructionsValidator ¶
func NewDisbursementInstructionsValidator(verificationField data.VerificationField) *DisbursementInstructionsValidator
func (*DisbursementInstructionsValidator) SanitizeInstruction ¶
func (iv *DisbursementInstructionsValidator) SanitizeInstruction(instruction *data.DisbursementInstruction) *data.DisbursementInstruction
func (*DisbursementInstructionsValidator) ValidateInstruction ¶
func (iv *DisbursementInstructionsValidator) ValidateInstruction(instruction *data.DisbursementInstruction, lineNumber int)
type DisbursementQueryValidator ¶
type DisbursementQueryValidator struct {
QueryValidator
}
func NewDisbursementQueryValidator ¶
func NewDisbursementQueryValidator() *DisbursementQueryValidator
NewDisbursementQueryValidator creates a new DisbursementQueryValidator with the provided configuration.
func (*DisbursementQueryValidator) ValidateAndGetDisbursementFilters ¶
func (qv *DisbursementQueryValidator) ValidateAndGetDisbursementFilters(filters map[data.FilterKey]interface{}) map[data.FilterKey]interface{}
ValidateAndGetDisbursementFilters validates the filters and returns a map of valid filters.
type DisbursementRequestValidator ¶
type DisbursementRequestValidator struct { *Validator // contains filtered or unexported fields }
func NewDisbursementRequestValidator ¶
func NewDisbursementRequestValidator(verificationField data.VerificationField) *DisbursementRequestValidator
func (*DisbursementRequestValidator) ValidateAndGetVerificationType ¶
func (dv *DisbursementRequestValidator) ValidateAndGetVerificationType() data.VerificationField
ValidateAndGetVerificationType validates if the verification type field is a valid value.
type GoogleReCAPTCHAValidator ¶
type GoogleReCAPTCHAValidator struct { SiteSecretKey string VerifyTokenURL string BaseURL string HTTPClient HTTPClient }
func NewGoogleReCAPTCHAValidator ¶
func NewGoogleReCAPTCHAValidator(siteSecretKey string, httpClient HTTPClient) *GoogleReCAPTCHAValidator
func (*GoogleReCAPTCHAValidator) IsTokenValid ¶
type PatchWalletRequest ¶
type PatchWalletRequest struct {
Enabled *bool `json:"enabled"`
}
type PaymentQueryValidator ¶
type PaymentQueryValidator struct {
QueryValidator
}
func NewPaymentQueryValidator ¶
func NewPaymentQueryValidator() *PaymentQueryValidator
NewPaymentQueryValidator creates a new PaymentQueryValidator with the provided configuration.
func (*PaymentQueryValidator) ValidateAndGetPaymentFilters ¶
func (qv *PaymentQueryValidator) ValidateAndGetPaymentFilters(filters map[data.FilterKey]interface{}) map[data.FilterKey]interface{}
ValidateAndGetPaymentFilters validates the filters and returns a map of valid filters.
type QueryValidator ¶
type QueryValidator struct { *Validator DefaultSortField data.SortField DefaultSortOrder data.SortOrder AllowedSortFields []data.SortField AllowedFilters []data.FilterKey }
func (*QueryValidator) ParseParametersFromRequest ¶
func (qv *QueryValidator) ParseParametersFromRequest(r *http.Request) *data.QueryParams
ParseParametersFromRequest parses query parameters from the request and returns a QueryParams struct.
func (*QueryValidator) ValidateAndGetTimeParams ¶
func (qv *QueryValidator) ValidateAndGetTimeParams(param string, value interface{}) time.Time
ValidateAndGetTimeParams validates the query parameter and returns the value as a time.Time.
type ReCAPTCHAValidator ¶
type ReCAPTCHAValidatorMock ¶
func (*ReCAPTCHAValidatorMock) IsTokenValid ¶
type ReceiverQueryValidator ¶
type ReceiverQueryValidator struct {
QueryValidator
}
func NewReceiverQueryValidator ¶
func NewReceiverQueryValidator() *ReceiverQueryValidator
NewReceiverQueryValidator creates a new ReceiverQueryValidator with the provided configuration.
func (*ReceiverQueryValidator) ValidateAndGetReceiverFilters ¶
func (qv *ReceiverQueryValidator) ValidateAndGetReceiverFilters(filters map[data.FilterKey]interface{}) map[data.FilterKey]interface{}
ValidateAndGetReceiverFilters validates the filters and returns a map of valid filters.
type ReceiverRegistrationValidator ¶
type ReceiverRegistrationValidator struct {
*Validator
}
func NewReceiverRegistrationValidator ¶
func NewReceiverRegistrationValidator() *ReceiverRegistrationValidator
NewReceiverRegistrationValidator creates a new ReceiverRegistrationValidator with the provided configuration.
func (*ReceiverRegistrationValidator) ValidateReceiver ¶
func (rv *ReceiverRegistrationValidator) ValidateReceiver(receiverInfo *data.ReceiverRegistrationRequest)
ValidateReceiver validates if the infos present in the ReceiverRegistrationRequest are valids.
type UpdateReceiverRequest ¶
type UpdateReceiverValidator ¶
type UpdateReceiverValidator struct {
*Validator
}
func NewUpdateReceiverValidator ¶
func NewUpdateReceiverValidator() *UpdateReceiverValidator
NewReceiverRegistrationValidator creates a new ReceiverRegistrationValidator with the provided configuration.
func (*UpdateReceiverValidator) ValidateReceiver ¶
func (ur *UpdateReceiverValidator) ValidateReceiver(updateReceiverRequest *UpdateReceiverRequest)
ValidateReceiver validates if the infos present in the ReceiverRegistrationRequest are valids.
type UserQueryValidator ¶
type UserQueryValidator struct {
QueryValidator
}
func NewUserQueryValidator ¶
func NewUserQueryValidator() *UserQueryValidator
NewUserQueryValidator creates a new UserQueryValidator with the provided configuration.
type Validator ¶
type Validator struct {
Errors map[string]interface{}
}
func NewValidator ¶
func NewValidator() *Validator
func (*Validator) CheckError ¶
CheckError is a convenience method for checking if an error is nil
type WalletRequest ¶
type WalletValidator ¶
type WalletValidator struct {
*Validator
}
func NewWalletValidator ¶
func NewWalletValidator() *WalletValidator
func (*WalletValidator) ValidateCreateWalletRequest ¶
func (wv *WalletValidator) ValidateCreateWalletRequest(ctx context.Context, reqBody *WalletRequest) *WalletRequest
func (*WalletValidator) ValidatePatchWalletRequest ¶
func (wv *WalletValidator) ValidatePatchWalletRequest(reqBody *PatchWalletRequest)
Source Files ¶
- disbursement_instructions_validator.go
- disbursement_query_validator.go
- disbursement_request_validator.go
- mock.go
- payment_query_validator.go
- query_validator.go
- recaptcha.go
- receiver_query_validator.go
- receiver_registration_validator.go
- receiver_update_validator.go
- user_query_validator.go
- validator.go
- wallet_validator.go