SaFi Bank Space : Decision: Product manager component

Status

DONE

Impact

HIGH

Driver

Juraj Macháč (Unlicensed)

Approver

Contributors

Ján Borovský (Unlicensed)

Informed

Due date

Resources

(blue star) Relevant data

(blue star) Background

The bank intends to provide customers with various banking products such as Saving account, Personal Loan, Overdraft, Cards, BNPL, number of free transactions/ATM withdrawals, and other similar products. The bank also offers customers various “subscription packages” with different pricing and parameters for these products (e.g. number of free transactions, cards available, …).

The product design hence suggests a centralized component managing the subscription packages, their mapping to product parameters, and also the relationship between customer and their selected subscription package.

Having such centralized component would also allow us to apply “loyalty mission bonuses” simply by temporarily modifying the product parameters of a customer.

The objective of this document is to define the responsibilities of such component and its communication patterns to respective domain services owning each specific product.

Basic responsibilities of product manager:

  • Source of truth (SoT) for product parameters per customer, which include (but are not limited to):

    • Number of cards available

    • Number of free:

      • transactions

      • top-ups

      • ATM withdrawals

      • cash-ins

    • Availability of products (implies feature flags):

      • BNPL

      • Personal loan

      • Overdraft

    • Interest rates in saving account (pocket / main acc)

    • Interest rate in personal loan

    • Price of subscription

  • SoT for base parameters per subscription package

  • SoT for subscription package selected per customer

(blue star) Options considered

The additional possible responsibilities of the service are explained in the options below with their benefits and issues briefly described

Synchronization via event choreography

Domain services always synchronously ask before applying the rule

Product manager as SoT for all product rules

Description

Upon changing the product parameter, an event is emitted and the domain microservices owning the specific product synchronize and apply the change.

Domain services do not sync the values upon changing product parameters in product manager, but rather always ask the product manager for the most up to date value whenever needed. However, the product manager does contain the parameters, and does not track the "progress" of parameters (e.g. how many free transactions were already used).

Domain services do not sync the values, but rather always ask the product service whether or not such action is allowed (e.g. creating another card), what's the cost of such action (e.g. issuing a new transaction), or what’s the current parameter set for a product (e.g. current interest rate for saving acct)

Pros and cons

(plus) Product manager does not need to know about the business logic which has to be applied to individual services. Decoupled from the domain business logic.

(minus) Does not fit into the architectural principles of choreography. The process is initiated upon changing the parameters and is not finished for the initiator until the change is applied. The initiator needs visibility over the full e2e process

(minus) Product manager might be out of sync with the actually applied changes within the domain services. While the product service should act as SoT, until the changes are applied the domain services do not use the new values.

(minus) No way to provide a full view on the customer’s “progress” within each package

(plus) Acts as true SSoT, the values are hence always what is really applied

(minus) Not possible for interest rates which are computed within smart contract. These need to be set in the smart contract imperatively upon every change. (info) The above issue could be possibly solved by orchestrating the changes from product manager to downstream for these specific use-cases

(minus) The service acts only as a storage for the settings, not tracking the progress which means that any business logic related to rules based on the parameters and their current usage (or a combination of parameters) needs to be applied in the domain services.

(minus) No way to provide a full view on the customer’s “progress” within each package

(plus) Product behavior logic is isolated and centralized within a single service, providing a holistic view on the products available to customer and their current usage (e.g. how many of the free transaction count was used)

(plus) Customer’s packages and progresses are centralized, hence making it possible to provide a full view on that

(minus) Not possible for interest rates which are computed within smart contract. These need to be set in the smart contract imperatively upon every change. (info) The above issue could be possibly solved by orchestrating the changes from product manager to downstream for these specific use-cases

(minus) Since the progress for each product parameter is tracked in the product service, but the action is performed in the domain service, "optimistic locking" of the product parameter needs to be implemented:

  • The product service will need to be informed twice - before the action is about to take place, and then whether the action was successful or requires a rollback.

  • Essentially, this constitutes a distributed transaction between product service and the domain service with the need of compensation mechanism.

Estimated cost

LOW

MEDIUM

MEDIUM

(blue star) Action items

(blue star) Outcome

The chosen approach is Product manager as SoT for all product rules

Centralizing the product definitions with their progress within a single service gives the service great power to define its own business logic for deciding the product behavior. This allows the service to answer questions such as “If the customer has made 7 transactions this month, has 5 free each month, and on top of that has 10 additional transactions for 50% of the price because of a mission bonus, what is the price of the next transaction?”

Proposed responsibilities of Product manager

On top of the basic responsibilities, the product manager will:

  • maintain the current “progress” per parameters where it makes sense

  • expose endpoints to be able to respond to specific questions related to product offering. E.g.:

    • What’s the cost of next transaction?

    • What’s the cost of creating another card?

    • Can the customer use BNPL?

    • What’s the cost of next ATM withdrawal?

  • expose endpoints for consumers to notify the product manager of:

    • an action to be taken

    • result of the action (done / reverse required)