ussd

package
v0.4.0-beta Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FlagManager

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

FlagManager handles centralized flag management

func NewFlagManager

func NewFlagManager(csvPath string) (*FlagManager, error)

NewFlagManager creates a new FlagManager instance

func (*FlagManager) GetFlag

func (fm *FlagManager) GetFlag(label string) (uint32, error)

GetFlag retrieves a flag value by its label

type Handlers

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

func NewHandlers

func NewHandlers(appFlags *asm.FlagParser, userdataStore db.Db, adminstore *utils.AdminStore, accountService remote.AccountServiceInterface) (*Handlers, error)

func (*Handlers) Authorize

func (h *Handlers) Authorize(ctx context.Context, sym string, input []byte) (resource.Result, error)

Authorize attempts to unlock the next sequential nodes by verifying the provided PIN against the already set PIN. It sets the required flags that control the flow.

func (*Handlers) CheckAccountStatus

func (h *Handlers) CheckAccountStatus(ctx context.Context, sym string, input []byte) (resource.Result, error)

CheckAccountStatus queries the API using the TrackingId and sets flags based on the account status

func (*Handlers) CheckBalance

func (h *Handlers) CheckBalance(ctx context.Context, sym string, input []byte) (resource.Result, error)

CheckBalance retrieves the balance of the active voucher and sets the balance as the result content

func (*Handlers) CheckIdentifier

func (h *Handlers) CheckIdentifier(ctx context.Context, sym string, input []byte) (resource.Result, error)

CheckIdentifier retrieves the PublicKey from the JSON data file.

func (*Handlers) CheckPinMisMatch

func (h *Handlers) CheckPinMisMatch(ctx context.Context, sym string, input []byte) (resource.Result, error)

func (*Handlers) CheckTransactions

func (h *Handlers) CheckTransactions(ctx context.Context, sym string, input []byte) (resource.Result, error)

CheckTransactions retrieves the transactions from the API using the "PublicKey" and stores to prefixDb

func (*Handlers) CheckVouchers

func (h *Handlers) CheckVouchers(ctx context.Context, sym string, input []byte) (resource.Result, error)

CheckVouchers retrieves the token holdings from the API using the "PublicKey" and stores them to gdbm

func (*Handlers) ConfirmPinChange

func (h *Handlers) ConfirmPinChange(ctx context.Context, sym string, input []byte) (resource.Result, error)

func (*Handlers) CreateAccount

func (h *Handlers) CreateAccount(ctx context.Context, sym string, input []byte) (resource.Result, error)

CreateAccount checks if any account exists on the JSON data file, and if not creates an account on the API, sets the default values and flags

func (*Handlers) Exit

func (h *Handlers) Exit()

func (*Handlers) FetchCommunityBalance

func (h *Handlers) FetchCommunityBalance(ctx context.Context, sym string, input []byte) (resource.Result, error)

func (*Handlers) GetAmount

func (h *Handlers) GetAmount(ctx context.Context, sym string, input []byte) (resource.Result, error)

GetAmount retrieves the amount from teh Gdbm Db

func (*Handlers) GetCurrentProfileInfo

func (h *Handlers) GetCurrentProfileInfo(ctx context.Context, sym string, input []byte) (resource.Result, error)

func (*Handlers) GetProfileInfo

func (h *Handlers) GetProfileInfo(ctx context.Context, sym string, input []byte) (resource.Result, error)

func (*Handlers) GetRecipient

func (h *Handlers) GetRecipient(ctx context.Context, sym string, input []byte) (resource.Result, error)

GetRecipient returns the transaction recipient phone number from the gdbm.

func (*Handlers) GetSender

func (h *Handlers) GetSender(ctx context.Context, sym string, input []byte) (resource.Result, error)

GetSender returns the sessionId (phoneNumber)

func (*Handlers) GetTransactionsList

func (h *Handlers) GetTransactionsList(ctx context.Context, sym string, input []byte) (resource.Result, error)

GetTransactionsList fetches the list of transactions and formats them

func (*Handlers) GetVoucherDetails

func (h *Handlers) GetVoucherDetails(ctx context.Context, sym string, input []byte) (resource.Result, error)

GetVoucherDetails retrieves the voucher details

func (*Handlers) GetVoucherList

func (h *Handlers) GetVoucherList(ctx context.Context, sym string, input []byte) (resource.Result, error)

GetVoucherList fetches the list of vouchers and formats them

func (*Handlers) Init

func (h *Handlers) Init(ctx context.Context, sym string, input []byte) (resource.Result, error)

func (*Handlers) InitiateTransaction

func (h *Handlers) InitiateTransaction(ctx context.Context, sym string, input []byte) (resource.Result, error)

InitiateTransaction calls the TokenTransfer and returns a confirmation based on the result

func (*Handlers) InviteValidRecipient

func (h *Handlers) InviteValidRecipient(ctx context.Context, sym string, input []byte) (resource.Result, error)

InviteValidRecipient sends an invitation to the valid phone number.

func (*Handlers) MaxAmount

func (h *Handlers) MaxAmount(ctx context.Context, sym string, input []byte) (resource.Result, error)

MaxAmount gets the current balance from the API and sets it as the result content.

func (*Handlers) Quit

func (h *Handlers) Quit(ctx context.Context, sym string, input []byte) (resource.Result, error)

Quit displays the Thank you message and exits the menu

func (*Handlers) QuitWithHelp

func (h *Handlers) QuitWithHelp(ctx context.Context, sym string, input []byte) (resource.Result, error)

QuitWithHelp displays helpline information then exits the menu

func (*Handlers) ResetAccountAuthorized

func (h *Handlers) ResetAccountAuthorized(ctx context.Context, sym string, input []byte) (resource.Result, error)

ResetAccountAuthorized resets the account authorization flag after a successful PIN entry.

func (*Handlers) ResetAllowUpdate

func (h *Handlers) ResetAllowUpdate(ctx context.Context, sym string, input []byte) (resource.Result, error)

ResetAllowUpdate resets the allowupdate flag that allows a user to update profile data.

func (*Handlers) ResetIncorrectPin

func (h *Handlers) ResetIncorrectPin(ctx context.Context, sym string, input []byte) (resource.Result, error)

ResetIncorrectPin resets the incorrect pin flag after a new PIN attempt.

func (*Handlers) ResetIncorrectYob

func (h *Handlers) ResetIncorrectYob(ctx context.Context, sym string, input []byte) (resource.Result, error)

ResetIncorrectYob resets the incorrect date format flag after a new attempt

func (*Handlers) ResetOthersPin

func (h *Handlers) ResetOthersPin(ctx context.Context, sym string, input []byte) (resource.Result, error)

func (*Handlers) ResetTransactionAmount

func (h *Handlers) ResetTransactionAmount(ctx context.Context, sym string, input []byte) (resource.Result, error)

ResetTransactionAmount resets the transaction amount and invalid flag

func (*Handlers) ResetUnregisteredNumber

func (h *Handlers) ResetUnregisteredNumber(ctx context.Context, sym string, input []byte) (resource.Result, error)

func (*Handlers) ResetValidPin

func (h *Handlers) ResetValidPin(ctx context.Context, sym string, input []byte) (resource.Result, error)

ResetAllowUpdate resets the allowupdate flag that allows a user to update profile data.

func (*Handlers) RetrieveBlockedNumber

func (h *Handlers) RetrieveBlockedNumber(ctx context.Context, sym string, input []byte) (resource.Result, error)

RetrieveBlockedNumber gets the current number during the pin reset for other's is in progress.

func (*Handlers) SaveFamilyname

func (h *Handlers) SaveFamilyname(ctx context.Context, sym string, input []byte) (resource.Result, error)

SaveFamilyname updates the family name in the gdbm with the provided input.

func (*Handlers) SaveFirstname

func (h *Handlers) SaveFirstname(ctx context.Context, sym string, input []byte) (resource.Result, error)

SaveFirstname updates the first name in the gdbm with the provided input.

func (*Handlers) SaveGender

func (h *Handlers) SaveGender(ctx context.Context, sym string, input []byte) (resource.Result, error)

SaveGender updates the gender in the gdbm with the provided input.

func (*Handlers) SaveLocation

func (h *Handlers) SaveLocation(ctx context.Context, sym string, input []byte) (resource.Result, error)

SaveLocation updates the location in the gdbm with the provided input.

func (*Handlers) SaveOfferings

func (h *Handlers) SaveOfferings(ctx context.Context, sym string, input []byte) (resource.Result, error)

SaveOfferings updates the offerings(goods and services provided by the user) in the gdbm with the provided input.

func (*Handlers) SaveOthersTemporaryPin

func (h *Handlers) SaveOthersTemporaryPin(ctx context.Context, sym string, input []byte) (resource.Result, error)

func (*Handlers) SaveTemporaryPin

func (h *Handlers) SaveTemporaryPin(ctx context.Context, sym string, input []byte) (resource.Result, error)

SaveTemporaryPin saves the valid PIN input to the DATA_TEMPORARY_VALUE during the account creation process and during the change PIN process

func (*Handlers) SaveYob

func (h *Handlers) SaveYob(ctx context.Context, sym string, input []byte) (resource.Result, error)

SaveYOB updates the Year of Birth(YOB) in the gdbm with the provided input.

func (*Handlers) SetBack

func (h *Handlers) SetBack(ctx context.Context, sym string, input []byte) (resource.Result, error)

Setback sets the flag_back_set flag when the navigation is back

func (*Handlers) SetDefaultVoucher

func (h *Handlers) SetDefaultVoucher(ctx context.Context, sym string, input []byte) (resource.Result, error)

SetDefaultVoucher retrieves the current vouchers and sets the first as the default voucher, if no active voucher is set

func (*Handlers) SetLanguage

func (h *Handlers) SetLanguage(ctx context.Context, sym string, input []byte) (resource.Result, error)

SetLanguage sets the language across the menu

func (*Handlers) SetVoucher

func (h *Handlers) SetVoucher(ctx context.Context, sym string, input []byte) (resource.Result, error)

SetVoucher retrieves the temp voucher data and sets it as the active data

func (*Handlers) TransactionReset

func (h *Handlers) TransactionReset(ctx context.Context, sym string, input []byte) (resource.Result, error)

TransactionReset resets the previous transaction data (Recipient and Amount) as well as the invalid flags

func (*Handlers) UpdateAllProfileItems

func (h *Handlers) UpdateAllProfileItems(ctx context.Context, sym string, input []byte) (resource.Result, error)

UpdateAllProfileItems is used to persist all the new profile information and setup the required profile flags

func (*Handlers) ValidateAmount

func (h *Handlers) ValidateAmount(ctx context.Context, sym string, input []byte) (resource.Result, error)

ValidateAmount ensures that the given input is a valid amount and that it is not more than the current balance.

func (*Handlers) ValidateBlockedNumber

func (h *Handlers) ValidateBlockedNumber(ctx context.Context, sym string, input []byte) (resource.Result, error)

func (*Handlers) ValidateRecipient

func (h *Handlers) ValidateRecipient(ctx context.Context, sym string, input []byte) (resource.Result, error)

ValidateRecipient validates that the given input is valid.

func (*Handlers) VerifyCreatePin

func (h *Handlers) VerifyCreatePin(ctx context.Context, sym string, input []byte) (resource.Result, error)

VerifyCreatePin checks whether the confirmation PIN is similar to the temporary PIN If similar, it sets the USERFLAG_PIN_SET flag and writes the account PIN allowing the user to access the main menu

func (*Handlers) VerifyNewPin

func (h *Handlers) VerifyNewPin(ctx context.Context, sym string, input []byte) (resource.Result, error)

func (*Handlers) VerifyYob

func (h *Handlers) VerifyYob(ctx context.Context, sym string, input []byte) (resource.Result, error)

VerifyYob verifies the length of the given input

func (*Handlers) ViewTransactionStatement

func (h *Handlers) ViewTransactionStatement(ctx context.Context, sym string, input []byte) (resource.Result, error)

ViewTransactionStatement retrieves the transaction statement and displays it to the user

func (*Handlers) ViewVoucher

func (h *Handlers) ViewVoucher(ctx context.Context, sym string, input []byte) (resource.Result, error)

ViewVoucher retrieves the token holding and balance from the subprefixDB and displays it to the user for them to select it

func (*Handlers) WithPersister

func (h *Handlers) WithPersister(pe *persist.Persister) *Handlers

Jump to

Keyboard shortcuts

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