Types

Figuring out what types are required in your app is the first step before you start writing any logic in your code. If you are unfamiliar with Types in Purescript, go back to the section on Types in the Purescript book and come back to this section.

Domain Types

type MobileNumber = String
type Amount = Number
type Operator = String
data BillPayStatus = SUCCESS | FAILURE
data BillPayFailure = FetchOperatorFailure String | BillPaymentFailure String | UserAbort

UI Types

ChooseOperator Screen

data ChooseOperatorScreen = ChooseOperatorScreen (Array Operator)
data ChooseOperatorScreenAction = OperatorSelected Operator | ChooseOperatorScreenAbort

MobileNumber Screen

data AskMobileNumberScreen = AskMobileNumberScreen
data AskMobileNumberScreenAction = SubmitMobileNumber MobileNumber | AskMobileNumberScreenAbort

Amount Screen

data AskAmountScreen = AskAmountScreen
data AskAmountScreenAction = SubmitAmount Amount | AskAmountScreenAbort

Status Screen

data StatusScreen = StatusScreen MobileNumber Amount BillPayStatus
data StatusScreenAction = SuccessResult | StatusScreenAbort

Api Types

BillPay Api

data BillPayRequest = BillPayRequest { operator :: Operator, mobileNumber :: MobileNumber, amount :: Amount }
data BillPayResponse = BillPayResponse { status :: BillPayStatus }

data FetchOperatorsRequest = FetchOperatorsRequest
data FetchOperatorsResponse = FetchOperatorsResponse { operators :: Array Operator }

results matching ""

    No results matching ""