From 2a5888ed2c4e0c583a74e0ec0ab0fada360450b4 Mon Sep 17 00:00:00 2001 From: rohit-eGov Date: Tue, 12 Jan 2021 17:20:26 +0530 Subject: [PATCH] RAIN-1955 Changes in search payment function dur to changes in collection search URL --- egov-pdf/CHANGELOG.md | 3 +++ egov-pdf/package.json | 2 +- egov-pdf/src/api.js | 6 ++++-- egov-pdf/src/config.js | 2 +- egov-pdf/src/routes/payments.js | 3 ++- egov-pdf/src/routes/pt.js | 4 +++- egov-pdf/src/routes/tl.js | 4 +++- 7 files changed, 17 insertions(+), 7 deletions(-) diff --git a/egov-pdf/CHANGELOG.md b/egov-pdf/CHANGELOG.md index 875f556..184687d 100644 --- a/egov-pdf/CHANGELOG.md +++ b/egov-pdf/CHANGELOG.md @@ -1,6 +1,9 @@ # Changelog All notable changes to this module will be documented in this file. +## 1.0.1 -2021-01-12 +- Added changes due to collection service dependency + ## 1.0.0 - 2020-06-16 - Added this service with support for following PDFs - PT mutation cetificate diff --git a/egov-pdf/package.json b/egov-pdf/package.json index 00afa71..04d632b 100644 --- a/egov-pdf/package.json +++ b/egov-pdf/package.json @@ -1,6 +1,6 @@ { "name": "egov-pdf", - "version": "1.0.0", + "version": "1.0.1", "private": true, "main": "index.js", "scripts": { diff --git a/egov-pdf/src/api.js b/egov-pdf/src/api.js index 6266d19..f227418 100644 --- a/egov-pdf/src/api.js +++ b/egov-pdf/src/api.js @@ -71,11 +71,13 @@ async function search_workflow(applicationNumber, tenantId, requestinfo) { }); } -async function search_payment(consumerCodes, tenantId, requestinfo) { +async function search_payment(consumerCodes, tenantId, requestinfo, bussinessService) { var params = { tenantId: tenantId, consumerCodes: consumerCodes, }; + var searchEndpoint = config.paths.payment_search; + searchEndpoint = searchEndpoint.replace(/\$module/g,bussinessService); if (checkIfCitizen(requestinfo)) { var mobileNumber = requestinfo.RequestInfo.userInfo.mobileNumber; var userName = requestinfo.RequestInfo.userInfo.userName; @@ -83,7 +85,7 @@ async function search_payment(consumerCodes, tenantId, requestinfo) { } return await axios({ method: "post", - url: url.resolve(config.host.payments, config.paths.payment_search), + url: url.resolve(config.host.payments, searchEndpoint), data: requestinfo, params, }); diff --git a/egov-pdf/src/config.js b/egov-pdf/src/config.js index 19417c5..5482716 100644 --- a/egov-pdf/src/config.js +++ b/egov-pdf/src/config.js @@ -50,7 +50,7 @@ module.exports = { user_search: "/user/_search", mdms_search: "/egov-mdms-service/v1/_search", download_url: "/download/epass", - payment_search: "/collection-services/payments/_search", + payment_search: "/collection-services/payments/$module/_search", bill_search: "/egov-searcher/bill-genie/billswithaddranduser/_get", workflow_search: "/egov-workflow-v2/egov-wf/process/_search" }, diff --git a/egov-pdf/src/routes/payments.js b/egov-pdf/src/routes/payments.js index bd2a818..23255b6 100644 --- a/egov-pdf/src/routes/payments.js +++ b/egov-pdf/src/routes/payments.js @@ -18,6 +18,7 @@ router.post( asyncMiddleware(async function (req, res, next) { var tenantId = req.query.tenantId; var consumerCode = req.query.consumerCode; + var bussinessService = req.query.bussinessService; var requestinfo = req.body; if (requestinfo == undefined) { return renderError(res, "requestinfo can not be null", 400); @@ -31,7 +32,7 @@ router.post( } try { try { - resProperty = await search_payment(consumerCode, tenantId, requestinfo); + resProperty = await search_payment(consumerCode, tenantId, requestinfo, bussinessService); } catch (ex) { console.log(ex.stack); if (ex.response && ex.response.data) console.log(ex.response.data); diff --git a/egov-pdf/src/routes/pt.js b/egov-pdf/src/routes/pt.js index 5149ee6..b70072b 100644 --- a/egov-pdf/src/routes/pt.js +++ b/egov-pdf/src/routes/pt.js @@ -229,12 +229,14 @@ router.post( properties.Properties.length > 0 ) { var propertyid = properties.Properties[0].propertyId; + var bussinessService = "PT"; var paymentresponse; try { paymentresponse = await search_payment( propertyid, tenantId, - requestinfo + requestinfo, + bussinessService ); } catch (ex) { console.log(ex.stack); diff --git a/egov-pdf/src/routes/tl.js b/egov-pdf/src/routes/tl.js index 8e3ed4c..286be11 100644 --- a/egov-pdf/src/routes/tl.js +++ b/egov-pdf/src/routes/tl.js @@ -53,12 +53,14 @@ router.post( tradelicenses.Licenses.length > 0 ) { var applicationNumber = tradelicenses.Licenses[0].applicationNumber; + var bussinessService = "TL"; var paymentresponse; try { paymentresponse = await search_payment( applicationNumber, tenantId, - requestinfo + requestinfo, + bussinessService ); } catch (ex) { console.log(ex.stack);