PSPCL iFix Adapter
Overview
PSPCL iFix Adapter is a java standalone application, which will be running as a cron job to fetch the bills and payments from the PSPCL system and reconcile the same. And finally, publish them to the iFix core system.
Version
Current version : 1.0.0
Prerequisites
Before proceeding with the configuration, ensure the following pre-requisites are met.
Java 8
Postgres DB should be up and running
Features
pspcl-ifix-adapter fetches the pspcl bills and payments from the PSPCL system based on the account number that is mapped in MDMS (can be found in https://github.com/misdwss/mdms-mgramseva/blob/QA/data/pb/pspcl-integration/accountNumberGpMapping.json ). Once will get the bills and payments, the below steps are there to reconcile and publish to the iFix Core system.
Sort the pspcl bills and payments results based on 'BILL_ISSUE_DATE' and 'TXNDATE' respectively.
Get the latest i.e the 0th index bill and payment result And check - Is it already registered in the system by any previous job?
if reconciled already stop the reconciliation.
if not reconciled, calculate the current bill (since in the pspcl bill result, we are getting all the accumulated bills together). And this calculated bill will become the 'actual current bill' of the current month. if the previous bill has been cleared, then the calculated bill amount will come out to be same as the current bill.
Calculated bill = (Curr_Bill - Last_Bill + Last_Payment).
Curr_Bill: This is the pspcl bill that we get in the sorted 0th index pspcl bill result.
Last_Bill: Will get this bill based 'DATE_READING_PREV' date.
Last_Payment: Will pick up the record from the payment detail table with 'TXNDATE' as a range from 'DATE_READING_PREV' & 'Current time'. And then finally sort and take the latest payment TXNDATE as Last_Payment record.
Add that we are just noting down the response from the pspcl for historical purposes.
Publish the bill and payment as event type 'Demand' and 'Receipt' respectively with calculated actual bill and payment amount to the iFix Core system.
Log the success or failure of fiscal events to the DB.
Interaction Diagram
Environment
Below are the list of environment variables :
Key | Description |
---|---|
pspcl.fetch.bill.url | PSPCL fetch bill url. e.g : |
pspcl.fetch.payment.url | PSPCL fetch payment url. e.g : |
ifix.host | Fiscal event host address for specific environment. e.g : |
egov.mdms.host | MDMS host address for specific environment.
|
keycloak.host | Keycloak host address for specific address.
|
keycloak.credentials.clientid | Keycloak client id of pspcl-ifix-adapter.
|
keycloak.credentials.clientsecret | Keycloak client secret of pspcl-ifix-adapter. |
fiscal.event.tenantId | Fiscal event tenant id. e.g : ‘pb’ |
demand.coaCode | Chart of account code for ‘DEMAND’ event. e.g : |
receipt.coaCode | Chart of account code for ‘RECEIPT’ event. e.g : |
fiscal.event.receiver | mGramSeva keycloak client id e.g : |
timestamp.logging.enabled | Mark it as ‘false', if don’t want to log the PSPCL fetch bills and payments time. |
Configurations and Setup
Update all the configuration in the dev.yaml, qa.yaml, prod.yaml file.