How to use Flexstudio

Let's take the example of a simple fund transfer API in a hypothetical AlphaBank core banking system (CBS). This example will help you understand how to design APIs using Flexstudio.

Typically an action in an application is triggered when a user submits a form or system triggers an event.

In the fund transfer API requirement, the customer of AlphaBank (user) fills fund transfer form and presses a submit button.

To indicate this user action, in Flexstudio, the flow starts with a customer view stub. The green circle highlights the intent of the user - User wants to Transfer Fund. This is the starting point.

There are other parameters that you can specify at this point. For example, the domain model. In this example, the domain model will be Account.

For any user to transfer fund , the customer should have sufficient balance in their account, which is added as a plugin - “IsBalanceSufficient”

In plugin you specify the name of your business rule, policy or validation rule. In this case let us assume for simplicity that there is just one business rule to be validated - "IsBalanceSufficient"

(Note: Interestingly the names you set here become the names of the methods in the code. The code precisely reflects the requirement.)

Successful validation of business rule IsBalanceSufficient initiates fund transfer process. Flexbase follows pub-sub model. Hence the first event published is “Fund Transfer Initiated”

Subscriber “Transfer Fund” which has subscribed for “Fund Transfer Initiated” event, processes fund transfer request and publishes “Fund Transferred” on success of fund transfer , and “Fund Transfer Failed”, if fund transfer fails.

Subscriber “Notify Payer On Fund Transfer Success”, subscribed for event “Fund Transferred” sends an SMS to the customer and publishes another event “Payer Notified”.

This series of events and subscribers can continue until the functionality is fully addressed.