Documentation
¶
Index ¶
- Variables
- type DisbursementInstructionsValidator
- type DisbursementQueryValidator
- 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 ¶
This section is empty.
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(contactType data.RegistrationContactType, verificationField data.VerificationType) *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 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 NewReCAPTCHAValidatorMock ¶
func NewReCAPTCHAValidatorMock(t testInterface) *ReCAPTCHAValidatorMock
NewReCAPTCHAValidatorMock creates a new instance of ReCAPTCHAValidatorMock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
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 UpdateReceiverRequest struct { // receiver_verifications fields: DateOfBirth string `json:"date_of_birth"` YearMonth string `json:"year_month"` Pin string `json:"pin"` NationalID string `json:"national_id"` // receivers fields: Email string `json:"email"` PhoneNumber string `json:"phone_number"` ExternalID string `json:"external_id"` }
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, enforceHTTPS bool) *WalletRequest
func (*WalletValidator) ValidatePatchWalletRequest ¶
func (wv *WalletValidator) ValidatePatchWalletRequest(reqBody *PatchWalletRequest)