General description

Statement manager is used for monthly statement generation and retrieval.

Context

Statement manager exposes customer-facing REST API for accessing monthly statements and backend-facing REST API for triggering the statement generation.

The service processes customer and account snapshots for creating materialized views used for getting customer and account details required for the statement. There are also two internal Kafka commands used for batch trigger and single customer statement generation.

Statement generation is triggered by the Google Cloud Composer (Airflow). This is done using DAG statement_generation_trigger which is executed on the first day of the month at 5 a.m. PHT. This DAG calls the /statement/generate/batch POST endpoint.

Transaction processing

For statement management, the transactions are created on the service level. For account and customer snapshots processing, the transactions are created for the saveOrUpdate functions.

Transactions are mandatory on the repository level.

Scalability

SM can run in multiple instances. For the statement generation, there will be a single instance processing the initial batch trigger, but this instance will publish a separate command for each customer that needs a statement to be generated.

Approach to security

We are relying on the authorization library used throughout all SaFi back-end services and also Kafka ACL (managed outside SM scope).

Domain model

Current technical debt

  • Implement idempotent processing using the new common library