Finance Collection Voucher Consumer Technical documentation

Objective:

The objective of this service is listen to the kafka topics, validate the data based on the configuration and make the voucher api call to create the voucher in finance erp and back update with the updated data.

Requirements:

  • 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. 

Setup:

Step 1: Start the service finance-collections-voucher-consumer present in the following repo:

https://github.com/egovernments/business-services/tree/master/finance-collections-voucher-consumer

Step 2: Start the egov-mdms service present in the following repo:

https://github.com/egovernments/core-services/tree/master/egov-mdms-service

Configuration of mdms data:

The business service and tax headmaster which are active in mdms json needs to be mapped with Finance related datas.

The business service related data mapped with the finance related data in git repo .

  1. 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.

  2. 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. 

  3. EgfInstrumentStatusMapping : This holds the status of Instruments.

 

Configurable Properties:

Following are the properties in application.properties file in egov-user-events service which are configurable. 

Property

Value

Remarks

egov.collection.receipt.voucher.save.topic

egov.collection.receipt-create

The topic which will be listened only for collection version v1 to process further to create the voucher.

egov.collection.receipt.voucher.cancel.topic

egov.collection.receipt-cancel

The topic which will be listened only for collection version v1 to cancel the voucher

kafka.topics.egf.instrument.completed.topic

egov.egf.instrument.completed

This will be listened to trace the activity of instrument updation.

If Instrument will get dishonor then it will try to create the dishonor voucher.

kafka.topics.payment.create.name

egov.collection.payment-create

The topic which will be listened when the data will get published from collection version -2 to create the voucher

kafka.topics.payment.cancel.name

egov.collection.payment-cancel

The topic which will be listened when the data will get published from collection version -2 to cancel the voucher

kafka.topics.payment.update.name

egov.collection.payment-update

The topic which will be listened when the data will get published from collection version -2 to cancel the voucher

fin.coe.erp.environment.name

dev/qa/uat

This is used to form the dynamic url for finance erp call.For Dev/QA/UAT env value will be dev/qa/uat.

for production keep it blank.

fin.coe.erp.domain.name

egovernments.org

Keep the domain name of the running server.

Example : if name is https://mseva.lgpunjab.gov.in/

Then keep the value lgpunjab.gov.in 



token.authorizaton.key

Basic baicAuthKey

Pass the Basic authorization key to generate the Admin Token for SIFINANCE user.

egov.services.egov.user.host

https://egov-micro-dev.egovernments.org/

Pass the host url where egov-user service is running

egov.services.mdms.hostname

https://egov-micro-dev.egovernments.org/



Pass the host url where egov-mdms service is running

egov.services.egfinstrument.hostname

https://egov-micro-dev.egovernments.org/



Pass the host url where egf-instrument service is running

egov.services.collections.hostname

https://egov-micro-dev.egovernments.org/



Pass the host url where collections service is running

egov.services.businessservice.hostname

https://egov-micro-dev.egovernments.org/

Pass the host url where business services are running

si.microservice.user

  • ******

Keep the System Finance Username

si.microservice.password

  • *******



Keep System Finance Password

 

How does it work?:

This service is implemented to listen to the specific kafka topic, fetch the data and perform the activity like create voucher, cancel voucher or reversal voucher for dishonoring.

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 call based on the services to get the configuration data and validate i.e whether voucher creation is enable for the service or not. If voucher creation is enabled then perform the following

  1. Prepare the voucher contract like master data i.e Dept,Fund, Function etc.

  2. Prepare the account specific data i.e glocode, amount etc.

  3. Then making a rest call to create a voucher to finance erp.

  4. 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.

  5. 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 contract.

  6. And finally it will store the logs i.e fetched data, status, message to log table egf_voucher_integration_log.

  7. If anywhere any exception occurred then error will get handled by 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 will cancel the payment/collections, it will push the data to egov.collection.payment-cancel/egov.collection.receipt-cancel

Listener will be listening to the topicegov.collection.payment-cancel/egov.collection.receipt-cancel.

Making mdms call based on the services to get the configuration data and validate i.e whether voucher creation is enable for the service or not. If voucher creation is enabled then perform the following.

  1. Try to fetch the voucher based on voucher number(which might be present inside the receipt contract) and business service reference document.

  2. If Voucher will be present inside the finance erp then it will make a call to cancel the voucher.

  3. Later it will cancel the corresponding instrument.

  4. And keep the log inside the table egf_voucher_integration_log.

ControlFlow Diagram: