Documentation

Simple Loan Application

Examples

Here we present an illustration of a simple workflow. The client selects which type of application (Loan or Credit Card) to complete and will see a "Success" page at the end of the workflow.

Version 1 — All commands are in one workflow script

simple-app.wf


values.applicationTypes << [
        "card": "Credit Card",
        "loan": "Loan",
]

route('Application Type') {
    namespace application
    uri '/application-type'
    validate {
        selectedType
    }
    export types: values.applicationTypes
}

match(application.selectedType == 'card') {
    route('Credit Card Application') {
        namespace application
        uri '/credit-card-application'
        validate {
            email
            personalId
            amount
        }
    }
}

match(application.selectedType == 'loan') {
    route('Loan Application') {
        namespace application
        uri '/loan-application'
        validate {
            email
            personalId
            amount
            term
            purpose
        }
    }
}

route('Successful') {
    uri '/successful'
    terminal()
}

Version 2 - DSL commands are separated to .init file to keep .wf easy to read.

simple-app.wf


values.applicationTypes << [
        "card": "Credit Card",
        "loan": "Loan",
]

route('Application Type')

match(application.selectedType == 'card') {
    route('Credit Card Application')
}

match(application.selectedType == 'loan') {
    route('Loan Application')
}

route('Successful')

simple-app.init


route('Application Type') {
    namespace application
    uri '/application-type'
    validate {
        selectedType
    }
    export types: values.applicationTypes
}

route('Credit Card Application') {
    namespace application
    uri '/credit-card-application'
    validate {
        email
        personalId
        amount
    }
}

route('Loan Application') {
    namespace application
    uri '/loan-application'
    validate {
        email
        personalId
        amount
        term
        purpose
    }
}

route('Successful') {
    uri '/successful'
    terminal()
}