Finance Collections Voucher Consumer Service
Overview
The objective of this service is to listen to the Kafka topics, validate the data based on the configuration, make the voucher API call to create the voucher in finance ERP and update the backend data. It also creates vouchers and instruments for the receipts collected through the collection service.
Pre-requisites
Prior Knowledge of Java/J2EE
Prior Knowledge of SpringBoot
Prior Knowledge of REST APIs and related concepts like path parameters, headers, JSON, etc
Prior Knowledge of Kafka and related concepts like Producer, Consumer, Topic, etc.
Key functionalities
Create vouchers and instruments for the receipts collected.
Listen to Kafka topics and validate the data.
Update the data in finance ERP.
Setup Details
Step 1: Start the service finance-collections-voucher-consumer present in the following repo:
Step 2: Start the egov-mdms service present in the following repo:
MDMS Configurations
The business service and tax headmaster which are active in mdms json needs to be mapped with Finance related data.
The business service-related data is mapped with the finance-related data in git repo.
AccountheadMapping.json : This is used to map the taxhead data to glcodes. This holds one more property InstrumentGLcodeMapping, which is used to hold the mapping for transaction type i.e Cash/Cheque/DD to glcodes.
BusinessServiceMapping.json : This is used to map the business service to finance specific master data like Department, Fund and Function, etc. even it can manage to enable and disable the voucher creation for specific service by setting the property voucherCreationEnabled=true/false.
EgfInstrumentStatusMapping: This holds the status of Instruments.
Configuration Details
Following are the properties in the application.properties file in the egov-user-events service that is configurable.
Working
This service is implemented to listen to the specific Kafka topic, fetch the data and perform activities like creating vouchers, cancelling vouchers or reversing vouchers on dishonouring.
Create Voucher:
Once the collection-service will generate collection/payment,it will push the data to egov.collection.receipt-create/egov.collection.payment-create topic.
Listener will be listening to the topic egov.collection.receipt-create/egov.collection.payment-create.
Making MDMS calls based on the services to get the configuration data and validate i.e whether voucher creation is enabled for the service or not. If voucher creation is enabled then perform the following
Prepare the voucher contract like master data i.e Dept, Fund, Function etc.
Prepare the account-specific data i.e glocode, amount etc.
Then making a rest call to create a voucher to finance ERP.
Once the voucher is created successfully then it will prepare the instrument contract by adding the voucher reference, instrument type, status etc and will make a call to create the instrument.
Once the instrument is created later it will make the call to collection receipt update API to back update the receipt by adding the voucher reference in the contract.
And finally, it will store the logs i.e fetched data, status, message to log table egf_voucher_integration_log.
If anywhere any exception occurs then errors are handled by the Exception Handler. Exception Handler will store the fetched data and the error cause to log table egf_voucher_integration_log.
Cancel Voucher:
Once collection service cancels the payment/collections, it pushes the data to egov.collection.payment-cancel/egov.collection.receipt-cancel
Listeners are listening to the topicegov.collection.payment-cancel/egov.collection.receipt-cancel.
Making MDMS calls based on the services to get the configuration data and validate i.e whether voucher creation is enabled for the service or not. If voucher creation is enabled then perform the following.
Try to fetch the voucher based on the voucher number(which might be present inside the receipt contract) and the business service reference document.
If Voucher is present inside the finance ERP then it makes a call to cancel the voucher.
Later it cancels the corresponding instrument.
And keep the log inside the table egf_voucher_integration_log.
Interaction Diagram
Deployment details
Add MDMS configs required for Finance Collection Voucher Consumer service and restart MDMS service.
Deploy the latest version of the Finance Collection Voucher Consumer service.
Add Finance Collection Voucher Consumer service persister yaml path in persister configuration and restart persister service
Add Role-Action mapping for APIs.
Integration
Can perform service-specific business logic without impacting the other modules.
In the future, if we want to expose the application to citizens then it can be done easily.
The workflows or service-specific workflows can be enabled at the service level at any time without changing the design.