mock

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeInfrastructure

type FakeInfrastructure struct {
	// StageProfileNudge stages nudges published from this service.
	StageProfileNudgeFn func(ctx context.Context, nudge *feedlib.Nudge) error

	// CreateRole creates a new role and persists it to the database
	CreateRoleFn func(
		ctx context.Context,
		profileID string,
		input dto.RoleInput,
	) (*profileutils.Role, error)

	// GetAllRoles returns a list of all created roles
	GetAllRolesFn func(ctx context.Context) (*[]profileutils.Role, error)

	// GetRoleByID gets role with matching id
	GetRoleByIDFn func(ctx context.Context, roleID string) (*profileutils.Role, error)

	// GetRoleByName retrieves a role using it's name
	GetRoleByNameFn func(ctx context.Context, roleName string) (*profileutils.Role, error)

	// GetRolesByIDs gets all roles matching provided roleIDs if specified otherwise all roles
	GetRolesByIDsFn func(ctx context.Context, roleIDs []string) (*[]profileutils.Role, error)

	// CheckIfRoleNameExists checks if a role with a similar name exists
	// Ensures unique name for each role during creation
	CheckIfRoleNameExistsFn func(ctx context.Context, name string) (bool, error)

	// UpdateRoleDetails  updates the details of a role
	UpdateRoleDetailsFn func(ctx context.Context, profileID string, role profileutils.Role) (*profileutils.Role, error)
	// DeleteRole removes a role permanently from the database
	DeleteRoleFn func(ctx context.Context, roleID string) (bool, error)

	//CheckIfUserHasPermission checks if a user has the required permission
	CheckIfUserHasPermissionFn func(
		ctx context.Context,
		UID string,
		requiredPermission profileutils.Permission,
	) (bool, error)

	// GetUserProfilesByRoleID returns a list of user profiles with the role ID
	// f.e users assigned a particular role
	GetUserProfilesByRoleIDFn func(ctx context.Context, role string) ([]*profileutils.UserProfile, error)

	// SaveRoleRevocation records a log for a role revocation
	//
	// userId is the ID of the user removing a role from a user
	SaveRoleRevocationFn func(ctx context.Context, userID string, revocation dto.RoleRevocationInput) error

	// CheckIfAdmin checks if a user has admin permissions
	CheckIfAdminFn func(profile *profileutils.UserProfile) bool

	// UpdateUserName updates the username of a profile that matches the id
	// this method should be called after asserting the username is unique and not associated with another userProfile
	UpdateUserNameFn func(ctx context.Context, id string, userName string) error

	// UpdatePrimaryPhoneNumber append a new primary phone number to the user profile
	// this method should be called after asserting the phone number is unique and not associated with another userProfile
	UpdatePrimaryPhoneNumberFn func(ctx context.Context, id string, phoneNumber string) error

	// UpdatePrimaryEmailAddress the primary email addresses of the profile that matches the id
	// this method should be called after asserting the emailAddress is unique and not associated with another userProfile
	UpdatePrimaryEmailAddressFn func(ctx context.Context, id string, emailAddress string) error

	// UpdateSecondaryPhoneNumbers updates the secondary phone numbers of the profile that matches the id
	// this method should be called after asserting the phone numbers are unique and not associated with another userProfile
	UpdateSecondaryPhoneNumbersFn func(ctx context.Context, id string, phoneNumbers []string) error

	// UpdateSecondaryEmailAddresses the secondary email addresses of the profile that matches the id
	// this method should be called after asserting the emailAddresses  as unique and not associated with another userProfile
	UpdateSecondaryEmailAddressesFn func(ctx context.Context, id string, emailAddresses []string) error

	// UpdateVerifiedIdentifiers adds a UID to a user profile during login if it does not exist
	UpdateVerifiedIdentifiersFn func(
		ctx context.Context,
		id string,
		identifiers []profileutils.VerifiedIdentifier,
	) error

	// UpdateVerifiedUIDS adds a UID to a user profile during login if it does not exist
	UpdateVerifiedUIDSFn func(ctx context.Context, id string, uids []string) error

	// UpdateSuspended updates the suspend attribute of the profile that matches the id
	UpdateSuspendedFn func(ctx context.Context, id string, status bool) error

	// UpdatePhotoUploadID updates the photoUploadID attribute of the profile that matches the id
	UpdatePhotoUploadIDFn func(ctx context.Context, id string, uploadID string) error

	// UpdatePushTokens updates the pushTokens attribute of the profile that matches the id. This function does a hard reset instead of prior
	// matching
	UpdatePushTokensFn func(ctx context.Context, id string, pushToken []string) error

	// UpdatePermissions update the permissions of the user profile
	UpdatePermissionsFn func(ctx context.Context, id string, perms []profileutils.PermissionType) error

	// UpdateRole update the permissions of the user profile
	UpdateRoleFn func(ctx context.Context, id string, role profileutils.RoleType) error

	// UpdateUserRoleIDs updates the roles for a user
	UpdateUserRoleIDsFn func(ctx context.Context, id string, roleIDs []string) error

	// UpdateBioData updates the biodate of the profile that matches the id
	UpdateBioDataFn func(ctx context.Context, id string, data profileutils.BioData) error

	// UpdateAddresses persists a user's home or work address information to the database
	UpdateAddressesFn func(
		ctx context.Context,
		id string,
		address profileutils.Address,
		addressType enumutils.AddressType,
	) error

	// UpdateFavNavActions update the permissions of the user profile
	UpdateFavNavActionsFn func(ctx context.Context, id string, favActions []string) error

	// ListUserProfiles fetches all users with the specified role from the database
	ListUserProfilesFn func(
		ctx context.Context,
		role profileutils.RoleType,
	) ([]*profileutils.UserProfile, error)

	// GetUserProfileByPhoneOrEmail gets usser profile by phone or email
	GetUserProfileByPhoneOrEmailFn func(ctx context.Context, payload *dto.RetrieveUserProfileInput) (*profileutils.UserProfile, error)

	// UpdateUserProfileEmail updates user profile's email
	UpdateUserProfileEmailFn func(ctx context.Context, phone string, email string) error

	// CreateUserProfile creates a user profile of using the provided phone number and uid
	CreateUserProfileFn func(
		ctx context.Context,
		phoneNumber, uid string,
	) (*profileutils.UserProfile, error)

	// CreateDetailedUserProfile creates a new user profile that is pre-filled using the provided phone number
	CreateDetailedUserProfileFn func(
		ctx context.Context,
		phoneNumber string,
		profile profileutils.UserProfile,
	) (*profileutils.UserProfile, error)

	// GetUserProfileByUID fetches a user profile by uid
	GetUserProfileByUIDFn func(
		ctx context.Context,
		uid string,
		suspended bool,
	) (*profileutils.UserProfile, error)

	// GetUserProfileByID fetches a user profile by id. returns the unsuspend profile
	GetUserProfileByIDFn func(
		ctx context.Context,
		id string,
		suspended bool,
	) (*profileutils.UserProfile, error)

	// GetUserProfileByPhoneNumber fetches a user profile by phone number
	GetUserProfileByPhoneNumberFn func(
		ctx context.Context,
		phoneNumber string,
		suspended bool,
	) (*profileutils.UserProfile, error)

	// GetUserProfileByPrimaryPhoneNumber fetches a user profile by primary phone number
	GetUserProfileByPrimaryPhoneNumberFn func(
		ctx context.Context,
		phoneNumber string,
		suspend bool,
	) (*profileutils.UserProfile, error)

	// CheckIfPhoneNumberExists checks if a specific phone number has already been registered to another user
	CheckIfPhoneNumberExistsFn func(ctx context.Context, phone string) (bool, error)

	// CheckIfEmailExists checks if a specific email has already been registered to another user
	CheckIfEmailExistsFn func(ctx context.Context, email string) (bool, error)

	// CheckIfUsernameExists checks if a specific username has already been registered to another user
	CheckIfUsernameExistsFn func(ctx context.Context, username string) (bool, error)

	// GenerateAuthCredentialsForAnonymousUser ...
	GenerateAuthCredentialsForAnonymousUserFn func(
		ctx context.Context,
	) (*profileutils.AuthCredentialResponse, error)

	// GenerateAuthCredentials ...
	GenerateAuthCredentialsFn func(
		ctx context.Context,
		phone string,
		profile *profileutils.UserProfile,
	) (*profileutils.AuthCredentialResponse, error)

	// FetchAdminUsers ...
	FetchAdminUsersFn func(ctx context.Context) ([]*profileutils.UserProfile, error)

	// PurgeUserByPhoneNumber removes user completely. This should be used only under testing environment
	PurgeUserByPhoneNumberFn func(ctx context.Context, phone string) error

	// HardResetSecondaryPhoneNumbers ...
	HardResetSecondaryPhoneNumbersFn func(
		ctx context.Context,
		profile *profileutils.UserProfile,
		newSecondaryPhones []string,
	) error

	// HardResetSecondaryEmailAddress ...
	HardResetSecondaryEmailAddressFn func(
		ctx context.Context,
		profile *profileutils.UserProfile,
		newSecondaryEmails []string,
	) error

	// GetPINByProfileID ...
	GetPINByProfileIDFn func(ctx context.Context, ProfileID string) (*domain.PIN, error)

	// RecordPostVisitSurvey records the  post visit survey
	RecordPostVisitSurveyFn func(ctx context.Context, input dto.PostVisitSurveyInput, UID string) error

	// SavePIN  User Pin methods
	SavePINFn func(ctx context.Context, pin *domain.PIN) (bool, error)

	// UpdatePIN ...
	UpdatePINFn func(ctx context.Context, id string, pin *domain.PIN) (bool, error)

	// ExchangeRefreshTokenForIDToken ...
	ExchangeRefreshTokenForIDTokenFn func(ctx context.Context, token string) (*profileutils.AuthCredentialResponse, error)

	// GetOrCreatePhoneNumberUser ...
	GetOrCreatePhoneNumberUserFn func(ctx context.Context, phone string) (*dto.CreatedUserResponse, error)

	// AddUserAsExperimentParticipant ...
	AddUserAsExperimentParticipantFn func(ctx context.Context, profile *profileutils.UserProfile) (bool, error)

	// RemoveUserAsExperimentParticipant ...
	RemoveUserAsExperimentParticipantFn func(ctx context.Context, profile *profileutils.UserProfile) (bool, error)

	// CheckIfExperimentParticipant ...
	CheckIfExperimentParticipantFn func(ctx context.Context, profileID string) (bool, error)

	// GetUserCommunicationsSettings ...
	GetUserCommunicationsSettingsFn func(ctx context.Context, profileID string) (*profileutils.UserCommunicationsSetting, error)

	// SetUserCommunicationsSettings ...
	SetUserCommunicationsSettingsFn func(ctx context.Context, profileID string,
		allowWhatsApp *bool, allowTextSms *bool, allowPush *bool, allowEmail *bool) (*profileutils.UserCommunicationsSetting, error)

	// ResolveDefaultNudgeByTitle ...
	ResolveDefaultNudgeByTitleFn func(ctx context.Context, UID string, flavour feedlib.Flavour, nudgeTitle string) error

	// SendMail ...
	SendMailFn func(ctx context.Context, email string, message string, subject string) error

	// GenerateAndSendOTP ...
	GenerateAndSendOTPFn func(ctx context.Context, phone string, appID *string) (*profileutils.OtpResponse, error)

	// SendRetryOTP ...
	SendRetryOTPFn func(ctx context.Context, msisdn string, retryStep int, appID *string) (*profileutils.OtpResponse, error)

	// VerifyOTP ...
	VerifyOTPFn func(ctx context.Context, phone, OTP string) (bool, error)

	// VerifyEmailOTP ...
	VerifyEmailOTPFn func(ctx context.Context, email, OTP string) (bool, error)

	// SendSMS ...
	SendSMSFn func(ctx context.Context, phoneNumbers []string, message string) error

	// AddEngagementPubsubNameSpace creates a namespaced topic that resembles the one in
	// engagement service, which is prepended with the word "engagement". This solves the problem
	// where namespaced topics from "onboarding" are different from the ones in engagement.
	// This fix allows for uniformity of topic names between the engagement and onboarding services.
	AddEngagementPubsubNameSpaceFn func(topic string) string

	// AddPubSubNamespace creates a namespaced topic name
	AddPubSubNamespaceFn func(topicName string) string

	// TopicIDs returns the known (registered) topic IDs
	TopicIDsFn func() []string

	// PublishToPubsub sends a message to a specifeid Topic
	PublishToPubsubFn func(ctx context.Context, topicID string, payload []byte) error

	// EnsureTopicsExist creates the topic(s) in the suppplied list if they do not
	// already exist.
	EnsureTopicsExistFn func(ctx context.Context, topicIDs []string) error

	// EnsureSubscriptionsExist ensures that the subscriptions named in the supplied
	// topic:subscription map exist. If any does not exist, it is created.
	EnsureSubscriptionsExistFn func(ctx context.Context) error

	// SubscriptionIDs returns a map of topic IDs to subscription IDs
	SubscriptionIDsFn func() map[string]string
}

FakeInfrastructure mocks the infrastructure interface

func (FakeInfrastructure) AddEngagementPubsubNameSpace

func (f FakeInfrastructure) AddEngagementPubsubNameSpace(
	topic string,
) string

AddEngagementPubsubNameSpace creates a namespaced topic that resembles the one in engagement service, which is prepended with the word "engagement". This solves the problem where namespaced topics from "onboarding" are different from the ones in engagement. This fix allows for uniformity of topic names between the engagement and onboarding services.

func (FakeInfrastructure) AddPubSubNamespace

func (f FakeInfrastructure) AddPubSubNamespace(topicName string) string

AddPubSubNamespace creates a namespaced topic name

func (FakeInfrastructure) AddUserAsExperimentParticipant

func (f FakeInfrastructure) AddUserAsExperimentParticipant(
	ctx context.Context,
	profile *profileutils.UserProfile,
) (bool, error)

AddUserAsExperimentParticipant ...

func (FakeInfrastructure) CheckIfAdmin

func (f FakeInfrastructure) CheckIfAdmin(profile *profileutils.UserProfile) bool

CheckIfAdmin checks if a user has admin permissions

func (FakeInfrastructure) CheckIfEmailExists

func (f FakeInfrastructure) CheckIfEmailExists(ctx context.Context, email string) (bool, error)

CheckIfEmailExists checks if a specific email has already been registered to another user

func (FakeInfrastructure) CheckIfExperimentParticipant

func (f FakeInfrastructure) CheckIfExperimentParticipant(ctx context.Context, profileID string) (bool, error)

CheckIfExperimentParticipant ...

func (FakeInfrastructure) CheckIfPhoneNumberExists

func (f FakeInfrastructure) CheckIfPhoneNumberExists(ctx context.Context, phone string) (bool, error)

CheckIfPhoneNumberExists checks if a specific phone number has already been registered to another user

func (FakeInfrastructure) CheckIfRoleNameExists

func (f FakeInfrastructure) CheckIfRoleNameExists(ctx context.Context, name string) (bool, error)

CheckIfRoleNameExists checks if a role with a similar name exists Ensures unique name for each role during creation

func (FakeInfrastructure) CheckIfUserHasPermission

func (f FakeInfrastructure) CheckIfUserHasPermission(
	ctx context.Context,
	UID string,
	requiredPermission profileutils.Permission,
) (bool, error)

CheckIfUserHasPermission checks if a user has the required permission

func (FakeInfrastructure) CheckIfUsernameExists

func (f FakeInfrastructure) CheckIfUsernameExists(ctx context.Context, username string) (bool, error)

CheckIfUsernameExists checks if a specific username has already been registered to another user

func (FakeInfrastructure) CreateDetailedUserProfile

func (f FakeInfrastructure) CreateDetailedUserProfile(
	ctx context.Context,
	phoneNumber string,
	profile profileutils.UserProfile,
) (*profileutils.UserProfile, error)

CreateDetailedUserProfile creates a new user profile that is pre-filled using the provided phone number

func (FakeInfrastructure) CreateRole

func (f FakeInfrastructure) CreateRole(
	ctx context.Context,
	profileID string,
	input dto.RoleInput,
) (*profileutils.Role, error)

CreateRole creates a new role and persists it to the database

func (FakeInfrastructure) CreateUserProfile

func (f FakeInfrastructure) CreateUserProfile(
	ctx context.Context,
	phoneNumber, uid string,
) (*profileutils.UserProfile, error)

CreateUserProfile creates a user profile of using the provided phone number and uid

func (FakeInfrastructure) DeleteRole

func (f FakeInfrastructure) DeleteRole(ctx context.Context, roleID string) (bool, error)

DeleteRole removes a role permanently from the database

func (FakeInfrastructure) EnsureSubscriptionsExist

func (f FakeInfrastructure) EnsureSubscriptionsExist(
	ctx context.Context,
) error

EnsureSubscriptionsExist ensures that the subscriptions named in the supplied topic:subscription map exist. If any does not exist, it is created.

func (FakeInfrastructure) EnsureTopicsExist

func (f FakeInfrastructure) EnsureTopicsExist(
	ctx context.Context,
	topicIDs []string,
) error

EnsureTopicsExist creates the topic(s) in the suppplied list if they do not already exist.

func (FakeInfrastructure) ExchangeRefreshTokenForIDToken

func (f FakeInfrastructure) ExchangeRefreshTokenForIDToken(
	ctx context.Context,
	token string,
) (*profileutils.AuthCredentialResponse, error)

ExchangeRefreshTokenForIDToken ...

func (FakeInfrastructure) FetchAdminUsers

func (f FakeInfrastructure) FetchAdminUsers(ctx context.Context) ([]*profileutils.UserProfile, error)

FetchAdminUsers ...

func (FakeInfrastructure) GenerateAndSendOTP

func (f FakeInfrastructure) GenerateAndSendOTP(ctx context.Context, phone string, appID *string) (*profileutils.OtpResponse, error)

GenerateAndSendOTP ...

func (FakeInfrastructure) GenerateAuthCredentials

func (f FakeInfrastructure) GenerateAuthCredentials(
	ctx context.Context,
	phone string,
	profile *profileutils.UserProfile,
) (*profileutils.AuthCredentialResponse, error)

GenerateAuthCredentials ...

func (FakeInfrastructure) GenerateAuthCredentialsForAnonymousUser

func (f FakeInfrastructure) GenerateAuthCredentialsForAnonymousUser(
	ctx context.Context,
) (*profileutils.AuthCredentialResponse, error)

GenerateAuthCredentialsForAnonymousUser ...

func (FakeInfrastructure) GetAllRoles

func (f FakeInfrastructure) GetAllRoles(ctx context.Context) (*[]profileutils.Role, error)

GetAllRoles returns a list of all created roles

func (FakeInfrastructure) GetOrCreatePhoneNumberUser

func (f FakeInfrastructure) GetOrCreatePhoneNumberUser(ctx context.Context, phone string) (*dto.CreatedUserResponse, error)

GetOrCreatePhoneNumberUser ...

func (FakeInfrastructure) GetPINByProfileID

func (f FakeInfrastructure) GetPINByProfileID(
	ctx context.Context,
	ProfileID string,
) (*domain.PIN, error)

GetPINByProfileID ...

func (FakeInfrastructure) GetRoleByID

func (f FakeInfrastructure) GetRoleByID(ctx context.Context, roleID string) (*profileutils.Role, error)

GetRoleByID gets role with matching id

func (FakeInfrastructure) GetRoleByName

func (f FakeInfrastructure) GetRoleByName(ctx context.Context, roleName string) (*profileutils.Role, error)

GetRoleByName retrieves a role using it's name

func (FakeInfrastructure) GetRolesByIDs

func (f FakeInfrastructure) GetRolesByIDs(ctx context.Context, roleIDs []string) (*[]profileutils.Role, error)

GetRolesByIDs gets all roles matching provided roleIDs if specified otherwise all roles

func (FakeInfrastructure) GetUserCommunicationsSettings

func (f FakeInfrastructure) GetUserCommunicationsSettings(
	ctx context.Context,
	profileID string,
) (*profileutils.UserCommunicationsSetting, error)

GetUserCommunicationsSettings ...

func (FakeInfrastructure) GetUserProfileByID

func (f FakeInfrastructure) GetUserProfileByID(
	ctx context.Context,
	id string,
	suspended bool,
) (*profileutils.UserProfile, error)

GetUserProfileByID fetches a user profile by id. returns the unsuspend profile

func (FakeInfrastructure) GetUserProfileByPhoneNumber

func (f FakeInfrastructure) GetUserProfileByPhoneNumber(
	ctx context.Context,
	phoneNumber string,
	suspended bool,
) (*profileutils.UserProfile, error)

GetUserProfileByPhoneNumber fetches a user profile by phone number

func (FakeInfrastructure) GetUserProfileByPhoneOrEmail

func (f FakeInfrastructure) GetUserProfileByPhoneOrEmail(ctx context.Context, payload *dto.RetrieveUserProfileInput) (*profileutils.UserProfile, error)

GetUserProfileByPhoneOrEmail gets usser profile by phone or email

func (FakeInfrastructure) GetUserProfileByPrimaryPhoneNumber

func (f FakeInfrastructure) GetUserProfileByPrimaryPhoneNumber(
	ctx context.Context,
	phoneNumber string,
	suspend bool,
) (*profileutils.UserProfile, error)

GetUserProfileByPrimaryPhoneNumber fetches a user profile by primary phone number

func (FakeInfrastructure) GetUserProfileByUID

func (f FakeInfrastructure) GetUserProfileByUID(
	ctx context.Context,
	uid string,
	suspended bool,
) (*profileutils.UserProfile, error)

GetUserProfileByUID fetches a user profile by uid

func (FakeInfrastructure) GetUserProfilesByRoleID

func (f FakeInfrastructure) GetUserProfilesByRoleID(ctx context.Context, role string) ([]*profileutils.UserProfile, error)

GetUserProfilesByRoleID returns a list of user profiles with the role ID f.e users assigned a particular role

func (FakeInfrastructure) HardResetSecondaryEmailAddress

func (f FakeInfrastructure) HardResetSecondaryEmailAddress(
	ctx context.Context,
	profile *profileutils.UserProfile,
	newSecondaryEmails []string,
) error

HardResetSecondaryEmailAddress ...

func (FakeInfrastructure) HardResetSecondaryPhoneNumbers

func (f FakeInfrastructure) HardResetSecondaryPhoneNumbers(
	ctx context.Context,
	profile *profileutils.UserProfile,
	newSecondaryPhones []string,
) error

HardResetSecondaryPhoneNumbers ...

func (FakeInfrastructure) ListUserProfiles

func (f FakeInfrastructure) ListUserProfiles(
	ctx context.Context,
	role profileutils.RoleType,
) ([]*profileutils.UserProfile, error)

ListUserProfiles fetches all users with the specified role from the database

func (FakeInfrastructure) PublishToPubsub

func (f FakeInfrastructure) PublishToPubsub(ctx context.Context, topicID string, payload []byte) error

PublishToPubsub sends a message to a specifeid Topic

func (FakeInfrastructure) PurgeUserByPhoneNumber

func (f FakeInfrastructure) PurgeUserByPhoneNumber(ctx context.Context, phone string) error

PurgeUserByPhoneNumber removes user completely. This should be used only under testing environment

func (FakeInfrastructure) RecordPostVisitSurvey

func (f FakeInfrastructure) RecordPostVisitSurvey(
	ctx context.Context,
	input dto.PostVisitSurveyInput,
	UID string,
) error

RecordPostVisitSurvey records the post visit survey

func (FakeInfrastructure) RemoveUserAsExperimentParticipant

func (f FakeInfrastructure) RemoveUserAsExperimentParticipant(
	ctx context.Context,
	profile *profileutils.UserProfile,
) (bool, error)

RemoveUserAsExperimentParticipant ...

func (FakeInfrastructure) ResolveDefaultNudgeByTitle

func (f FakeInfrastructure) ResolveDefaultNudgeByTitle(ctx context.Context, UID string, flavour feedlib.Flavour,
	nudgeTitle string) error

ResolveDefaultNudgeByTitle ...

func (FakeInfrastructure) SavePIN

func (f FakeInfrastructure) SavePIN(ctx context.Context, pin *domain.PIN) (bool, error)

SavePIN User Pin methods

func (FakeInfrastructure) SaveRoleRevocation

func (f FakeInfrastructure) SaveRoleRevocation(ctx context.Context, userID string, revocation dto.RoleRevocationInput) error

SaveRoleRevocation records a log for a role revocation

userId is the ID of the user removing a role from a user

func (FakeInfrastructure) SendMail

func (f FakeInfrastructure) SendMail(ctx context.Context, email string, message string, subject string) error

SendMail ...

func (FakeInfrastructure) SendRetryOTP

func (f FakeInfrastructure) SendRetryOTP(ctx context.Context, msisdn string, retryStep int, appID *string) (*profileutils.OtpResponse, error)

SendRetryOTP ...

func (FakeInfrastructure) SendSMS

func (f FakeInfrastructure) SendSMS(ctx context.Context, phoneNumbers []string, message string) error

SendSMS ...

func (FakeInfrastructure) SetUserCommunicationsSettings

func (f FakeInfrastructure) SetUserCommunicationsSettings(ctx context.Context, profileID string,
	allowWhatsApp *bool, allowTextSms *bool, allowPush *bool, allowEmail *bool) (*profileutils.UserCommunicationsSetting, error)

SetUserCommunicationsSettings ...

func (FakeInfrastructure) StageProfileNudge

func (f FakeInfrastructure) StageProfileNudge(ctx context.Context, nudge *feedlib.Nudge) error

StageProfileNudge stages nudges published from this service.

func (FakeInfrastructure) SubscriptionIDs

func (f FakeInfrastructure) SubscriptionIDs() map[string]string

SubscriptionIDs returns a map of topic IDs to subscription IDs

func (FakeInfrastructure) TopicIDs

func (f FakeInfrastructure) TopicIDs() []string

TopicIDs returns the known (registered) topic IDs

func (FakeInfrastructure) UpdateAddresses

func (f FakeInfrastructure) UpdateAddresses(
	ctx context.Context,
	id string,
	address profileutils.Address,
	addressType enumutils.AddressType,
) error

UpdateAddresses persists a user's home or work address information to the database

func (FakeInfrastructure) UpdateBioData

func (f FakeInfrastructure) UpdateBioData(ctx context.Context, id string, data profileutils.BioData) error

UpdateBioData updates the biodate of the profile that matches the id

func (FakeInfrastructure) UpdateFavNavActions

func (f FakeInfrastructure) UpdateFavNavActions(ctx context.Context, id string, favActions []string) error

UpdateFavNavActions update the permissions of the user profile

func (FakeInfrastructure) UpdatePIN

func (f FakeInfrastructure) UpdatePIN(ctx context.Context, id string, pin *domain.PIN) (bool, error)

UpdatePIN ...

func (FakeInfrastructure) UpdatePermissions

func (f FakeInfrastructure) UpdatePermissions(ctx context.Context, id string, perms []profileutils.PermissionType) error

UpdatePermissions update the permissions of the user profile

func (FakeInfrastructure) UpdatePhotoUploadID

func (f FakeInfrastructure) UpdatePhotoUploadID(ctx context.Context, id string, uploadID string) error

UpdatePhotoUploadID updates the photoUploadID attribute of the profile that matches the id

func (FakeInfrastructure) UpdatePrimaryEmailAddress

func (f FakeInfrastructure) UpdatePrimaryEmailAddress(ctx context.Context, id string, emailAddress string) error

UpdatePrimaryEmailAddress the primary email addresses of the profile that matches the id this method should be called after asserting the emailAddress is unique and not associated with another userProfile

func (FakeInfrastructure) UpdatePrimaryPhoneNumber

func (f FakeInfrastructure) UpdatePrimaryPhoneNumber(ctx context.Context, id string, phoneNumber string) error

UpdatePrimaryPhoneNumber append a new primary phone number to the user profile this method should be called after asserting the phone number is unique and not associated with another userProfile

func (FakeInfrastructure) UpdatePushTokens

func (f FakeInfrastructure) UpdatePushTokens(ctx context.Context, id string, pushToken []string) error

UpdatePushTokens updates the pushTokens attribute of the profile that matches the id. This function does a hard reset instead of prior matching

func (FakeInfrastructure) UpdateRole

func (f FakeInfrastructure) UpdateRole(ctx context.Context, id string, role profileutils.RoleType) error

UpdateRole update the permissions of the user profile

func (FakeInfrastructure) UpdateRoleDetails

func (f FakeInfrastructure) UpdateRoleDetails(ctx context.Context, profileID string, role profileutils.Role) (*profileutils.Role, error)

UpdateRoleDetails updates the details of a role

func (FakeInfrastructure) UpdateSecondaryEmailAddresses

func (f FakeInfrastructure) UpdateSecondaryEmailAddresses(ctx context.Context, id string, emailAddresses []string) error

UpdateSecondaryEmailAddresses the secondary email addresses of the profile that matches the id this method should be called after asserting the emailAddresses as unique and not associated with another userProfile

func (FakeInfrastructure) UpdateSecondaryPhoneNumbers

func (f FakeInfrastructure) UpdateSecondaryPhoneNumbers(ctx context.Context, id string, phoneNumbers []string) error

UpdateSecondaryPhoneNumbers updates the secondary phone numbers of the profile that matches the id this method should be called after asserting the phone numbers are unique and not associated with another userProfile

func (FakeInfrastructure) UpdateSuspended

func (f FakeInfrastructure) UpdateSuspended(ctx context.Context, id string, status bool) error

UpdateSuspended updates the suspend attribute of the profile that matches the id

func (FakeInfrastructure) UpdateUserName

func (f FakeInfrastructure) UpdateUserName(ctx context.Context, id string, userName string) error

UpdateUserName updates the username of a profile that matches the id this method should be called after asserting the username is unique and not associated with another userProfile

func (FakeInfrastructure) UpdateUserProfileEmail

func (f FakeInfrastructure) UpdateUserProfileEmail(ctx context.Context, phone string, email string) error

UpdateUserProfileEmail updates user profile's email

func (FakeInfrastructure) UpdateUserRoleIDs

func (f FakeInfrastructure) UpdateUserRoleIDs(ctx context.Context, id string, roleIDs []string) error

UpdateUserRoleIDs updates the roles for a user

func (FakeInfrastructure) UpdateVerifiedIdentifiers

func (f FakeInfrastructure) UpdateVerifiedIdentifiers(
	ctx context.Context,
	id string,
	identifiers []profileutils.VerifiedIdentifier,
) error

UpdateVerifiedIdentifiers adds a UID to a user profile during login if it does not exist

func (FakeInfrastructure) UpdateVerifiedUIDS

func (f FakeInfrastructure) UpdateVerifiedUIDS(ctx context.Context, id string, uids []string) error

UpdateVerifiedUIDS adds a UID to a user profile during login if it does not exist

func (FakeInfrastructure) VerifyEmailOTP

func (f FakeInfrastructure) VerifyEmailOTP(ctx context.Context, email, OTP string) (bool, error)

VerifyEmailOTP ...

func (FakeInfrastructure) VerifyOTP

func (f FakeInfrastructure) VerifyOTP(ctx context.Context, phone, OTP string) (bool, error)

VerifyOTP ...

Jump to

Keyboard shortcuts

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