MGramSeva iFix Adapter Service (PSPCL Enhancement)

This adapter service will be supporting exiting feature, on top of that it add another functionality which support PSPCL event flow from iFix service to mGramSeva service.

Release summary

It supports PSPCL event flow. It collects events from fiscal event(PSPCL) service and pushes it to mGramSeva service.
This process triggered by cron job has a configurable Quartz time interval. It does not depend on the external scheduler. Time interval depends on what time is being passed in the quartz interval.

Fiscal event search time interval - This depends on Quartz cron expression. It add some extra overlap time to the cron time interval. Overlap time addition is configurable and it’s time unit minute - we can only provide time in minute. Right now it has not been added to the helm chart - it is being set in properties file - ifix.fiscal.event.search.time.overlap.minutes.

When quartz triggers its scheduler, it starts by collecting PSPCL events from fiscal event service (iFix Core).
It calls the fiscal event search API and It passes tenantId, event type, receiver name and time interval. It does not collect all events(PSPCL) at once. It collects chunks of events based on time intervals, which has been mentioned above. Events from the fiscal event are not compatible with mGramSeva events. Events can have two types Demand and Receipt, it does different calculation or conversion based on event type.

Demand event type
When it finds event type is demand, it tries to create challan in challan service through create challan API. To create challan, we require a few attributes i.e. tenantId, business service, consumer type, vendor details, amount details, referenceId, bill date and time period. Here are two major attributes that require calculation.
First one is vendor id - to get the vendor id we have to call a third party(Vendor service). Vendor search API mainly depends (in our scenario) on tenantId and it’s name - it gives us a list of vendors for particular tenantId. We take the first one from the list and attach it to the "Create Challan API" attribute. If it does not find any tenant detail. It will create new one with tenant id and configured tenant name.
Second one is reference id - It is actually a PSPCL account number which is coming through the fiscal event search API, it is tagged in an additional attribute of event. This plays a main role in the overall process. It works as a tracker for payment and bill.

Receipt event type
When system found event type is receipt, it tries to get cumulative bill id against PSPCL account number. To get the bill id, it calls the fetch bill API of Billing service.
The received bill id should have a cumulative amount which has been generated before for the same PSPCL account number. After receiving the bill id, it tries to make payment through the collection service by providing the same bill id and the amount which has been received in the receipt event. If paid amount is not equal to amount which has been generated for bill id then challan status will be not set as PAID.

Log persistence
It logs every event which has been processed. It also captures the activity, when no event is found from the iFix fiscal event service. It stores success message as well as failure message in “pspcl_event_detail” table.

Deployment Details

  1. Deploy the latest version of ifix-reference-adapter

 

Environment Variables

Description

pspcl.ifix.event.receiver.name

It collect only those event from ifix service which matches to this receiver value.

mgramseva.oauth.token.username

mGramSeva OAuth token username.

mgramseva.oauth.token.password

mGramSeva OAuth token password.

mgramseva.oauth.token.scope

mGramSeva OAuth token scope.

mgramseva.oauth.token.grantType

mGramSeva OAuth token grant type.

mgramseva.oauth.token.tenantId

mGramSeva OAuth token tenant id.

mgramseva.oauth.token.userType

mGramSeva OAuth token user type.

samplejob.frequency

It is a quartz job time interval value.

spring.quartz.jdbc.initialize.schema

It has two values “Never” or “Always” for Quartz table creation.

Never - It wont create any table

Always - It will create table every time when service deploy and erase every existing details. (Not recommended).

 

mgramseva.host

Host name of mGramSeva

 

Related Page

https://digit-discuss.atlassian.net/wiki/spaces/DD/pages/2180743169

https://digit-discuss.atlassian.net/wiki/spaces/DD/pages/2075000867

https://digit-discuss.atlassian.net/wiki/spaces/DD/pages/2075918337