Version: v0.0.24 Latest Latest

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

Go to latest
Published: Oct 10, 2021 License: MIT Imports: 23 Imported by: 0




View Source
const (
	CoreEDIClientIDEnvVarName     = "CORE_CLIENT_ID"
	CoreEDIClientSecretEnvVarName = "CORE_CLIENT_SECRET"
	CoreEDIUsernameEnvVarName     = "CORE_USERNAME"
	CoreEDIPasswordEnvVarName     = "CORE_PASSWORD"
	CoreEDIGrantTypeEnvVarName    = "CORE_GRANT_TYPE"
	CoreEDIAPISchemeEnvVarName    = "CORE_API_SCHEME"
	CoreEDITokenURLEnvVarName     = "CORE_TOKEN_URL"
	CoreEDIAPIHostEnvVarName      = "CORE_HOST"

Default login client settings (env var names)

View Source
const AcknowledgementKYCEmail = `` /* 15978-byte string literal not displayed */

AcknowledgementKYCEmail ...

View Source
const AdminApprovalEmail = `` /* 15961-byte string literal not displayed */

AdminApprovalEmail is the email sent to an admin once registered

View Source
const AdminKYCSubmittedEmail = `` /* 16525-byte string literal not displayed */

AdminKYCSubmittedEmail ...

View Source
const AgentApprovalEmail = `` /* 12842-byte string literal not displayed */

AgentApprovalEmail is the email sent to an agent once registered

View Source
const ProcessKYCApprovalEmail = `` /* 15588-byte string literal not displayed */

ProcessKYCApprovalEmail ...

View Source
const ProcessKYCRejectionEmail = `` /* 16179-byte string literal not displayed */

ProcessKYCRejectionEmail ...

View Source
const SupplierSuspensionEmail = `` /* 15969-byte string literal not displayed */

SupplierSuspensionEmail ...


This section is empty.


func AddHashToCovers

func AddHashToCovers(unHashedCovers []profileutils.Cover) []profileutils.Cover

AddHashToCovers add a hash identifier to provided unhashed covers

func CheckEmptyString

func CheckEmptyString(text string) (*string, error)

CheckEmptyString check that the string isn't empty

func CheckIdentifierExists

func CheckIdentifierExists(profile *profileutils.UserProfile, UID string) bool

CheckIdentifierExists check if an identifier exists

func CheckUserHasPermission added in v0.0.2

func CheckUserHasPermission(roles []profileutils.Role, permission profileutils.Permission) bool

CheckUserHasPermission takes in the user roles and a permission and verifies that the user has required permissions

func FindItem

func FindItem(slice []string, value string) (int, bool)

FindItem is a linear search implementation that checks if a string is contained in a slice and returns its index and a boolean The index can be used for slicing out an item from a slice.

func GetRandomName

func GetRandomName() *string

GetRandomName generates a random name from the list of adjectives and surnames in this package formatted as "adjective_surname". For example '@focused_turing23254'. If retry is non-zero, a random integer between 0 and 10 will be added to the end of the name, e.g `focused_turing3`

func GetUserNavigationActions added in v0.0.2

func GetUserNavigationActions(
	ctx context.Context,
	user profileutils.UserProfile,
	roles []profileutils.Role,
) (*dto.GroupedNavigationActions, error)

GetUserNavigationActions returns a sorted primary and secondary user navigation actions

func GetUserPermissions added in v0.0.2

func GetUserPermissions(roles []profileutils.Role) []string

GetUserPermissions returns all the scopes of user permissions

func GetUserResponse

func GetUserResponse(text string) string

GetUserResponse gets the concatenated text from Africans Talking and splits it to get the current user input

func GroupNested added in v0.0.2

func GroupNested(
	actions []domain.NavigationAction,
) []domain.NavigationAction

GroupNested groups navigation actions into parents and children

func GroupPriority added in v0.0.2

func GroupPriority(actions []domain.NavigationAction) (primary, secondary []domain.NavigationAction)

GroupPriority groups navigation actions into primary and secondary actions

func IfCoverExistsInSlice

func IfCoverExistsInSlice(srcCovers []profileutils.Cover, cover profileutils.Cover) bool

IfCoverExistsInSlice checks is a cover is in a slice. In a slice of covers of a given length (srcCovers), the cover is question will only match one if it does exist in the srcCovers. Hence; - if the difference between `coversThatExists` and `coversThatDontExist` is less than 0, it means the cover is question does not exist in srcCovers . - if the difference between `coversThatExists` and `coversThatDontExist` is equal than 0, it means the cover is question does exist in srcCovers.

func IsFavNavAction added in v0.0.2

func IsFavNavAction(u *profileutils.UserProfile, title string) bool

IsFavNavAction checks if user has book marked the provided navaction

func IsLetter

func IsLetter(s string) bool

IsLetter ...

func LoginClient

func LoginClient(username string, password string, baseExt extension.BaseExtension) (apiclient.Client, error)

LoginClient returns an API client that is logged in with the supplied username and password to EDI Core authserver

func MatchAndReturn

func MatchAndReturn(old bool, new bool) bool

MatchAndReturn checks is the new is not equal to old and returns it. Otherwise the old used when setting communication settings

func NewActionsMapper added in v0.0.2

NewActionsMapper maps the new navigation actions mapper to the old navigation actions implementation It is meant to be used as a transition and ease changes made without affecting the frontend

func NewInterServiceClient

func NewInterServiceClient(serviceName string, baseExt extension.BaseExtension) *interserviceclient.InterServiceClient

NewInterServiceClient initializes an external service in the correct environment given its name

func ParseUSSDDateInput

func ParseUSSDDateInput(date string) string

ParseUSSDDateInput ...

func RecordSpanError

func RecordSpanError(span trace.Span, err error)

RecordSpanError is a helper function to capture errors in a span

func RemoveDuplicateStrings added in v0.0.2

func RemoveDuplicateStrings(strings []string) []string

RemoveDuplicateStrings removes duplicate strings from a list of strings

func ServiceHealthEndPoint

func ServiceHealthEndPoint(input string) (string, error)

ServiceHealthEndPoint creates a url to the service health endpoint

func UniquePermissionsArray

func UniquePermissionsArray(arr []profileutils.PermissionType) []profileutils.PermissionType

UniquePermissionsArray removes duplicate permissions in an array of permissions

func ValidateAficasTalkingSMSData

func ValidateAficasTalkingSMSData(input *dto.AfricasTalkingMessage) (*dto.AfricasTalkingMessage, error)

ValidateAficasTalkingSMSData returns AIT validated SMS data

func ValidateCoverLinkingEvent

func ValidateCoverLinkingEvent(input *dto.CoverLinkingEvent) (*dto.CoverLinkingEvent, error)

ValidateCoverLinkingEvent validates a coverlinking event

func ValidateDateDigits

func ValidateDateDigits(pin string) error

ValidateDateDigits validates user pin to ensure a PIN only contains digits

func ValidateDateLength

func ValidateDateLength(date string) error

ValidateDateLength ensures that the dates are of only 8 numbers

func ValidatePIN

func ValidatePIN(pin string) error

ValidatePIN ...

func ValidatePINLength

func ValidatePINLength(pin string) error

ValidatePINLength ...

func ValidateRegisterUserInput added in v0.0.10

func ValidateRegisterUserInput(input dto.RegisterUserInput) (bool, error)

ValidateRegisterUserInput validates the user registration input

func ValidateSignUpInput

func ValidateSignUpInput(input *dto.SignUpInput) (*dto.SignUpInput, error)

ValidateSignUpInput returns a valid sign up input

func ValidateUID

func ValidateUID(w http.ResponseWriter, r *http.Request) (*dto.UIDPayload, error)

ValidateUID checks that the uid supplied in the indicated request is valid

func ValidateUSSDDetails

func ValidateUSSDDetails(payload *dto.SessionDetails) (*dto.SessionDetails, error)

ValidateUSSDDetails checks if the phonenumber supplied is valid , that a session ID is provided and returns valid USSD session details.

func ValidateUSSDEvent

func ValidateUSSDEvent(input *dto.USSDEvent) (*dto.USSDEvent, error)

ValidateUSSDEvent validates a USSD event

func ValidateUSSDInput

func ValidateUSSDInput(text string) error

ValidateUSSDInput ...

func ValidateYearOfBirth

func ValidateYearOfBirth(date string) string

ValidateYearOfBirth validates that the year enter is 18 years and above


This section is empty.

Jump to

Keyboard shortcuts

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