Water calculator KT document

KT Document For Water Calculator Service: 

Description : 

This is the egov application, which is responsible for calculating fee estimation, creating meter reading, creating demands, applying time based tax heads on demands. This service is also responsible for sending notification after bill generation.

Application.properties entries :

Port of application: server.port=8083

 Application context path :  server.context.path=ws-calculator

 Application time zone : app.timezone=UTC

Postgresql driver : spring.datasource.driver-class-name=org.postgresql.Driver

Database URL : spring.datasource.url=jdbc:postgresql://localhost:5432/rainmaker_new

Database username :  spring.datasource.username=postgres

Database password :  spring.datasource.password=postgres

Meter reading save topic : 

egov.meterservice.createmeterconnection=save-ws-meter

Mdms host url : 

egov.mdms.host=https://egov-micro-dev.egovernments.org/

egov.mdms.search.endpoint=egov-mdms-service/v1/_search

Kafka application port :  kafka.config.bootstrap_server_config=localhost:9092

Kafka consumer value deserializer : spring.kafka.consumer.value-deserializer=org.egov.tracer.kafka.deserializer.HashMapDeserializer

Kafka consumer key deserializer : 

spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer

Kafka consumer group id :  spring.kafka.consumer.group-id=egov-mr-services

spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer

spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer

Pagination config for meter reading:

egov.ws_calculation.meterReading.default.limit=10

egov.ws_calculation.meterReading.default.offset=0

Billing Service url

egov.billingservice.host=http://localhost:8081

egov.taxhead.search.endpoint=billing-service/taxheads/_search

egov.taxperiod.search.endpoint=billing-service/taxperiods/_search

egov.demand.create.endpoint=billing-service/demand/_create

egov.demand.update.endpoint=billing-service/demand/_update

egov.demand.search.endpoint=billing-service/demand/_search

egov.bill.gen.endpoint=billing-service/bill/_generate

egov.bill.fetch.endpoint=/billing-service/bill/v2/_fetchbill

Water Service url

ws.module.code=ws-services-calculation

Demand Configuration

ws.module.minpayable.amount=1

ws.financialyear.start.month=04

egov.demand.billexpirytime=864000000

egov.demand.businessservice=WS

egov.demand.minimum.payable.amount=100

egov.watercalculatorservice.createdemand=ws-generate-demand

Flyway config :

flyway.url=jdbc:postgresql://localhost:5432/rainmaker_new

flyway.user=postgres

flyway.password=postgres

flyway.table=public31

flyway.baseline-on-migrate=true

flyway.outOfOrder=true

flyway.locations=db/migration/ddl

flyway.enabled=true

Water Service url

egov.ws.host=http://localhost:8090

egov.wc.search.endpoint=ws-services/wc/_search

Localization service config:

egov.localization.host=https://egov-micro-dev.egovernments.org/

egov.localization.workDir.path=localization/messages/v1

egov.localization.context.path=localization/messages/v1

egov.localization.search.endpoint=/_search

egov.localization.statelevel=true

Notification topics :

kafka.topics.notification.sms=egov.core.notification.sms

notification.sms.enabled=true

notification.sms.link=citizen/egov-common/pay?consumerCode=$consumerCode&tenantId=$tenantId&businessService=WS

User search url:

egov.user.host=http://localhost:8081/

egov.user.context.path=/user/users

egov.user.search.path=/user/_search

User search url:

kafka.topics.billgen.topic=bill-generation

User config:

egov.user.event.notification.enabled=true

egov.ui.app.host=https://egov-micro-dev.egovernments.org

egov.usr.events.create.topic=persist-user-events-async

egov.usr.events.pay.link=citizen/otpLogin?mobileNo=$mobile&redirectTo=egov-common/pay?consumerCode=$consumerCode&tenantId=$tenantId&businessService=WS

egov.usr.events.pay.code=PAY

egov.usr.events.pay.triggers=PENDINGPAYMENT

notification.url = https://egov-micro-dev.egovernments.org/

Demand Generation Config:

ws.demand.based.batch.size=10

persister.demand.based.dead.letter.topic.batch=ws-dead-letter-topic-batch

persister.demand.based.dead.letter.topic.single=ws-dead-letter-topic-single

Property registery host url : 

egov.property.service.host=https://egov-micro-dev.egovernments.org/

egov.property.searchendpoint=property-services/property/_search


Dependency on another microservices : 

Microservices

Dependency

Mdms service

Loading all  master data 

Property Service

For searching the property

Persister service

Persisting the data

WS service

For Searching the water connection

Billing Service

For demand related things

User service

For user search

Localization service

For searching the notification content

MDMS Configuration : 

File Name

Link

Purpose

billingPeriod.json

https://github.com/egovernments/egov-mdms-data/blob/master/data/pb/ws-services-masters/billingPeriod.json

Master Data for billing period.

CalculationAttribute.json

https://github.com/egovernments/egov-mdms-data/blob/master/data/pb/ws-services-calculation/CalculationAttribute.json

Master data for calculation attribute.

FeeSlab.json

https://github.com/egovernments/egov-mdms-data/blob/master/data/pb/ws-services-calculation/FeeSlab.json

Master data for fee slab.

Interest.json

https://github.com/egovernments/egov-mdms-data/blob/master/data/pb/ws-services-calculation/Interest.json

Master data for interest.

MeterStatus.json

https://github.com/egovernments/egov-mdms-data/blob/master/data/pb/ws-services-calculation/MeterStatus.json

Master data for meter status

Penalty.json

https://github.com/egovernments/egov-mdms-data/blob/master/data/pb/ws-services-calculation/Penalty.json

Master data for penalty.

PipeSize.json

https://github.com/egovernments/egov-mdms-data/blob/master/data/pb/ws-services-calculation/PipeSize.json

Master data for pipe size.

PropertyUsageType.json

https://github.com/egovernments/egov-mdms-data/blob/master/data/pb/ws-services-calculation/PropertyUsageType.json

Master data for property usage type.

Rebate.json

https://github.com/egovernments/egov-mdms-data/blob/master/data/pb/ws-services-calculation/Rebate.json

Master data for rebate

RoadType.json

https://github.com/egovernments/egov-mdms-data/blob/master/data/pb/ws-services-calculation/RoadType.json

Master data for road type

WCBillingSlab.json

https://github.com/egovernments/egov-mdms-data/blob/master/data/pb/ws-services-calculation/WCBillingSlab.json

Master data for billing slab

WaterCess.json

https://github.com/egovernments/egov-mdms-data/blob/master/data/pb/ws-services-calculation/WaterCess.json

Master data for water cess.

Other Config Files : 

Service

File

Description

Persister

https://github.com/egovernments/configs/blob/master/egov-persister/water-meter.yml

For saving meter objects we need to configure this persister file.

For more details please go to the technical documentation of persister.

Calculator API’s : 

  1. Creating meter reading (/meterConnection/_create)

  2. Meter reading search(/meterConnection/_search)

  3. Fee Estimation(/waterCalculator/_estimate)

  4. Tax calculation and demand generation (/waterCalculator/_calculate)

  5. Adding time based tax head on demand(/waterCalculator/_updateDemand)

  6. Job scheduler for demand generation of non-metered connection(/waterCalculator/_jobscheduler)

  7. Adhoc tax heads on demand (/waterCalculator/_applyAdhocTax)

Creating meter reading (/meterConnection/_create) : 

This API is responsible for creating meter reading and generating the demand for that meter reading. Demand generation based on billing cycle which is configured under billingPeriod.json. The billing cycle can be monthly, quarterly, or yearly.

Meter reading search(/meterConnection/_search) : 

This API is responsible for searching the meter reading based on the given criteria.

Fee Estimation(/waterCalculator/_estimate) : 

This API is responsible for estimating the fee for a given application based on configured master data. This API will not generate the demand it only returns the estimation of an application.

Tax calculation and demand generation (/waterCalculator/_calculate) :

This API is responsible for calculating the tax heads of given connections on a given billing cycle. After calculating the tax heads, Demand will be generated by this API.

Adding time based tax head on demand(/waterCalculator/_updateDemand) : 

This API is responsible for applying the time-based tax heads on demand. Penalty / Rebate will be added after the expiry of demand or after some given configuration time.

Job scheduler for demand generation of non-metered connection(/waterCalculator/_jobscheduler) :

This API is responsible for generating the demand for non-metered connections. Job scheduler will run on each and every billing cycle.

Adhoc tax heads on demand (/waterCalculator/_applyAdhocTax) :

This API is responsible for adding the Adhoc penalty/rebate of a given consumer code.