diff --git a/tutorials/Assignment-5/README.md b/tutorials/Assignment-5/README.md new file mode 100644 index 00000000000..2008a4f7879 --- /dev/null +++ b/tutorials/Assignment-5/README.md @@ -0,0 +1 @@ +Run the services and all the necessary dependencies and figure out why desired response is not returned. Clear out any previously added configuration files(such as indexer.yml, persister.yml etc) and add the files present in this assignment. \ No newline at end of file diff --git a/tutorials/Assignment-5/btr-calculator/README.md b/tutorials/Assignment-5/btr-calculator/README.md new file mode 100644 index 00000000000..815750ea6cc --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/README.md @@ -0,0 +1,25 @@ +# BTR Calculator + +This module calculates the birth registration application +charges and creates bill for the application. + +### Service Dependencies +- egov-mdms +- billing service + +## Service Details + +The service generates demand based on input amount from +mdms. + +### API Details + +`BasePath` /birth-calculator/v1/[API endpoint] + +#### Method + +a) `_calculate` +- Calculates the amount due and generates the demand. + +b) `_getbill` +- Fetches the bill for given application number. diff --git a/tutorials/Assignment-5/btr-calculator/birth-registration-calculator-stage-4-postman-collection.json b/tutorials/Assignment-5/btr-calculator/birth-registration-calculator-stage-4-postman-collection.json new file mode 100644 index 00000000000..c62248095c9 --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/birth-registration-calculator-stage-4-postman-collection.json @@ -0,0 +1,111 @@ +{ + "info": { + "_postman_id": "52113373-99fa-4f7c-a3ff-e9f0feb39183", + "name": "DIGIT Developer Birth Registration Calculator Stage 4", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "21170203" + }, + "item": [ + { + "name": "Calculate", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"RequestInfo\": {\n \"apiId\": \"asset-services\",\n \"ver\": null,\n \"ts\": null,\n \"action\": null,\n \"did\": null,\n \"key\": null,\n \"msgId\": \"search with from and to values\",\n \"authToken\": \"{{authToken}}\",\n \"userInfo\": {\n \"id\": 24226,\n \"uuid\": \"11b0e02b-0145-4de2-bc42-c97b96264807\",\n \"userName\": \"amr001\",\n \"name\": \"leela\",\n \"mobileNumber\": \"9814424443\",\n \"emailId\": \"leela@llgmail.com\",\n \"type\": \"EMPLOYEE\",\n \"roles\": [\n {\n \"name\": \"CSC Collection Operator\",\n \"code\": \"CSC_COLL_OPERATOR\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Employee\",\n \"code\": \"EMPLOYEE\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Grievance Routing Officer\",\n \"code\": \"GRO\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"NoC counter employee\",\n \"code\": \"NOC_CEMP\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"TL Counter Employee\",\n \"code\": \"TL_CEMP\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"TL Counter Employee\",\n \"code\": \"TL_CEMP\",\n \"tenantId\": \"pb.jalandhar\"\n },\n {\n \"name\": \"TL Field Inspector\",\n \"code\": \"TL_FIELD_INSPECTOR\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"TL Creator\",\n \"code\": \"TL_CREATOR\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Customer Support Representative\",\n \"code\": \"CSR\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"NoC counter Approver\",\n \"code\": \"NOC_APPROVER\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"TL Approver\",\n \"code\": \"TL_APPROVER\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Super User\",\n \"code\": \"SUPERUSER\",\n \"tenantId\": \"pb\"\n },\n {\n \"name\": \"BPA Services Approver\",\n \"code\": \"BPA_APPROVER\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Field Employee\",\n \"code\": \"FEMP\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Counter Employee\",\n \"code\": \"CEMP\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"NoC Field Inpector\",\n \"code\": \"NOC_FIELD_INSPECTOR\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"NOC Department Approver\",\n \"code\": \"NOC_DEPT_APPROVER\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Super User\",\n \"code\": \"SUPERUSER\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Grievance Officer\",\n \"code\": \"GO\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Anonymous User\",\n \"code\": \"ANONYMOUS\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Collection Operator\",\n \"code\": \"COLL_OPERATOR\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"NoC Doc Verifier\",\n \"code\": \"NOC_DOC_VERIFIER\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"TL doc verifier\",\n \"code\": \"TL_DOC_VERIFIER\",\n \"tenantId\": \"pb.amritsar\"\n }\n ],\n \"active\": true,\n \"tenantId\": \"pb.amritsar\"\n }\n },\n \"CalculationCriteria\": [\n {\n \"tenantId\": \"{{tenantId}}\",\n \"applicationNumber\": \"PB-BTR-2022-12-27-000661\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:2345/birth-calculator/v1/_calculate", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "2345", + "path": [ + "birth-calculator", + "v1", + "_calculate" + ] + } + }, + "response": [] + }, + { + "name": "MDMS search", + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"RequestInfo\": {\n \"apiId\": \"asset-services\",\n \"ver\": null,\n \"ts\": null,\n \"action\": null,\n \"did\": null,\n \"key\": null,\n \"msgId\": \"search with from and to values\",\n \"authToken\": \"{{authToken}}\",\n \"userInfo\": {\n \"id\": 24226,\n \"uuid\": \"11b0e02b-0145-4de2-bc42-c97b96264807\",\n \"userName\": \"amr001\",\n \"name\": \"leela\",\n \"mobileNumber\": \"9814424443\",\n \"emailId\": \"leela@llgmail.com\",\n \"type\": \"EMPLOYEE\",\n \"roles\": [\n {\n \"name\": \"CSC Collection Operator\",\n \"code\": \"CSC_COLL_OPERATOR\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Employee\",\n \"code\": \"EMPLOYEE\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Grievance Routing Officer\",\n \"code\": \"GRO\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"NoC counter employee\",\n \"code\": \"NOC_CEMP\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"TL Counter Employee\",\n \"code\": \"TL_CEMP\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"TL Counter Employee\",\n \"code\": \"TL_CEMP\",\n \"tenantId\": \"pb.jalandhar\"\n },\n {\n \"name\": \"TL Field Inspector\",\n \"code\": \"TL_FIELD_INSPECTOR\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"TL Creator\",\n \"code\": \"TL_CREATOR\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Customer Support Representative\",\n \"code\": \"CSR\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"NoC counter Approver\",\n \"code\": \"NOC_APPROVER\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"TL Approver\",\n \"code\": \"TL_APPROVER\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Super User\",\n \"code\": \"SUPERUSER\",\n \"tenantId\": \"pb\"\n },\n {\n \"name\": \"BPA Services Approver\",\n \"code\": \"BPA_APPROVER\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Field Employee\",\n \"code\": \"FEMP\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Counter Employee\",\n \"code\": \"CEMP\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"NoC Field Inpector\",\n \"code\": \"NOC_FIELD_INSPECTOR\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"NOC Department Approver\",\n \"code\": \"NOC_DEPT_APPROVER\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Super User\",\n \"code\": \"SUPERUSER\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Grievance Officer\",\n \"code\": \"GO\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Anonymous User\",\n \"code\": \"ANONYMOUS\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Collection Operator\",\n \"code\": \"COLL_OPERATOR\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"NoC Doc Verifier\",\n \"code\": \"NOC_DOC_VERIFIER\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"TL doc verifier\",\n \"code\": \"TL_DOC_VERIFIER\",\n \"tenantId\": \"pb.amritsar\"\n }\n ],\n \"active\": true,\n \"tenantId\": \"pb.amritsar\"\n }\n },\n \"MdmsCriteria\": {\n \"tenantId\": \"pb\",\n \"moduleDetails\": [\n {\n \"moduleName\": \"BTR\",\n \"masterDetails\": [\n {\n \"name\": \"RegistrationCharges\"\n }\n ]\n }\n ]\n }\n}" + }, + "url": { + "raw": "https://dev.digit.org/egov-mdms-service/v1/_search", + "protocol": "https", + "host": [ + "dev", + "digit", + "org" + ], + "path": [ + "egov-mdms-service", + "v1", + "_search" + ] + } + }, + "response": [] + }, + { + "name": "Get Bill", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"RequestInfo\": {\n \"apiId\": \"asset-services\",\n \"ver\": null,\n \"ts\": null,\n \"action\": null,\n \"did\": null,\n \"key\": null,\n \"msgId\": \"search with from and to values\",\n \"authToken\": \"{{authToken}}\",\n \"userInfo\": {\n \"id\": 24226,\n \"uuid\": \"11b0e02b-0145-4de2-bc42-c97b96264807\",\n \"userName\": \"amr001\",\n \"name\": \"leela\",\n \"mobileNumber\": \"9814424443\",\n \"emailId\": \"leela@llgmail.com\",\n \"type\": \"EMPLOYEE\",\n \"roles\": [\n {\n \"name\": \"CSC Collection Operator\",\n \"code\": \"CSC_COLL_OPERATOR\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Employee\",\n \"code\": \"EMPLOYEE\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Grievance Routing Officer\",\n \"code\": \"GRO\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"NoC counter employee\",\n \"code\": \"NOC_CEMP\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"TL Counter Employee\",\n \"code\": \"TL_CEMP\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"TL Counter Employee\",\n \"code\": \"TL_CEMP\",\n \"tenantId\": \"pb.jalandhar\"\n },\n {\n \"name\": \"TL Field Inspector\",\n \"code\": \"TL_FIELD_INSPECTOR\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"TL Creator\",\n \"code\": \"TL_CREATOR\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Customer Support Representative\",\n \"code\": \"CSR\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"NoC counter Approver\",\n \"code\": \"NOC_APPROVER\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"TL Approver\",\n \"code\": \"TL_APPROVER\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Super User\",\n \"code\": \"SUPERUSER\",\n \"tenantId\": \"pb\"\n },\n {\n \"name\": \"BPA Services Approver\",\n \"code\": \"BPA_APPROVER\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Field Employee\",\n \"code\": \"FEMP\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Counter Employee\",\n \"code\": \"CEMP\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"NoC Field Inpector\",\n \"code\": \"NOC_FIELD_INSPECTOR\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"NOC Department Approver\",\n \"code\": \"NOC_DEPT_APPROVER\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Super User\",\n \"code\": \"SUPERUSER\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Grievance Officer\",\n \"code\": \"GO\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Anonymous User\",\n \"code\": \"ANONYMOUS\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Collection Operator\",\n \"code\": \"COLL_OPERATOR\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"NoC Doc Verifier\",\n \"code\": \"NOC_DOC_VERIFIER\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"TL doc verifier\",\n \"code\": \"TL_DOC_VERIFIER\",\n \"tenantId\": \"pb.amritsar\"\n }\n ],\n \"active\": true,\n \"tenantId\": \"pb.amritsar\"\n }\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:2345/birth-calculator/v1/_getbill?tenantId={{tenantId}}&applicationNumber=PB-BTR-2022-12-27-000661", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "2345", + "path": [ + "birth-calculator", + "v1", + "_getbill" + ], + "query": [ + { + "key": "tenantId", + "value": "{{tenantId}}" + }, + { + "key": "applicationNumber", + "value": "PB-BTR-2022-12-27-000661" + } + ] + } + }, + "response": [] + } + ] +} \ No newline at end of file diff --git a/tutorials/Assignment-5/btr-calculator/pom.xml b/tutorials/Assignment-5/btr-calculator/pom.xml new file mode 100644 index 00000000000..03fee5be347 --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/pom.xml @@ -0,0 +1,111 @@ + + 4.0.0 + org.egov + birth-calculator + jar + birth-calculator + 1.0.0 + + 1.8 + ${java.version} + ${java.version} + + + org.springframework.boot + spring-boot-starter-parent + 2.2.6.RELEASE + + + src/main/java + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + + io.swagger + swagger-core + 1.5.18 + + + + org.egov.services + tracer + 2.0.0-SNAPSHOT + + + org.egov.services + services-common + 1.0.1-SNAPSHOT + + + org.egov.services + digit-models + 1.0.0-SNAPSHOT + + + org.egov + mdms-client + 0.0.2-SNAPSHOT + compile + + + org.projectlombok + lombok + true + + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + + + + javax.validation + validation-api + + + + + repo.egovernments.org + eGov ERP Releases Repository + https://nexus-repo.egovernments.org/nexus/content/repositories/releases/ + + + repo.egovernments.org.snapshots + eGov ERP Releases Repository + https://nexus-repo.egovernments.org/nexus/content/repositories/snapshots/ + + + repo.egovernments.org.public + eGov Public Repository Group + https://nexus-repo.egovernments.org/nexus/content/groups/public/ + + + repo.digit.org + eGov DIGIT Releases Repository + https://nexus-repo.digit.org/nexus/content/repositories/snapshots/ + + + diff --git a/tutorials/Assignment-5/btr-calculator/src/main/java/digit/Main.java b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/Main.java new file mode 100644 index 00000000000..4081c839a36 --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/Main.java @@ -0,0 +1,20 @@ +package digit; + + +import org.egov.tracer.config.TracerConfiguration; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Import; + +@Import({TracerConfiguration.class}) +@SpringBootApplication +@ComponentScan(basePackages = {"digit", "digit.web.controllers", "digit.config"}) +public class Main { + + + public static void main(String[] args) throws Exception { + SpringApplication.run(Main.class, args); + } + +} diff --git a/tutorials/Assignment-5/btr-calculator/src/main/java/digit/config/BTRCalculatorConfigs.java b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/config/BTRCalculatorConfigs.java new file mode 100644 index 00000000000..7112c361005 --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/config/BTRCalculatorConfigs.java @@ -0,0 +1,26 @@ +package digit.config; + +import lombok.Getter; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; + +@Configuration +@Getter +public class BTRCalculatorConfigs { + + @Value("${egov.billingservice.host}") + private String billingServiceHost; + + @Value("${egov.demand.create.endpoint}") + private String demandCreateEndpoint; + + @Value("${egov.billingservice.fetch.bill}") + private String fetchBillEndpoint; + + @Value("${btr.taxhead.master.code}") + private String taxHeadMasterCode; + + @Value("${btr.module.code}") + private String moduleCode; + +} diff --git a/tutorials/Assignment-5/btr-calculator/src/main/java/digit/config/MainConfiguration.java b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/config/MainConfiguration.java new file mode 100644 index 00000000000..0a59c792c3b --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/config/MainConfiguration.java @@ -0,0 +1,39 @@ +package digit.config; + +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.egov.tracer.config.TracerConfiguration; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Import; +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; + +import javax.annotation.PostConstruct; +import java.util.TimeZone; + + +@Import({TracerConfiguration.class}) +public class MainConfiguration { + + @Value("${app.timezone}") + private String timeZone; + + @PostConstruct + public void initialize() { + TimeZone.setDefault(TimeZone.getTimeZone(timeZone)); + } + + @Bean + public ObjectMapper objectMapper() { + return new ObjectMapper().disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES).setTimeZone(TimeZone.getTimeZone(timeZone)); + } + + @Bean + @Autowired + public MappingJackson2HttpMessageConverter jacksonConverter(ObjectMapper objectMapper) { + MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); + converter.setObjectMapper(objectMapper); + return converter; + } +} \ No newline at end of file diff --git a/tutorials/Assignment-5/btr-calculator/src/main/java/digit/repository/ServiceRequestRepository.java b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/repository/ServiceRequestRepository.java new file mode 100644 index 00000000000..08643ca8995 --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/repository/ServiceRequestRepository.java @@ -0,0 +1,45 @@ +package digit.repository; + + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import lombok.extern.slf4j.Slf4j; +import org.egov.tracer.model.ServiceCallException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Repository; +import org.springframework.web.client.HttpClientErrorException; +import org.springframework.web.client.RestTemplate; + +import java.util.Map; + +@Repository +@Slf4j +public class ServiceRequestRepository { + + private final ObjectMapper mapper; + + private final RestTemplate restTemplate; + + + @Autowired + public ServiceRequestRepository(ObjectMapper mapper, RestTemplate restTemplate) { + this.mapper = mapper; + this.restTemplate = restTemplate; + } + + + public Object fetchResult(StringBuilder uri, Object request) { + mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); + Object response = null; + try { + response = restTemplate.postForObject(uri.toString(), request, Map.class); + } catch (HttpClientErrorException e) { + log.error("External Service threw an Exception: ", e); + throw new ServiceCallException(e.getResponseBodyAsString()); + } catch (Exception e) { + log.error("Exception while fetching from searcher: ", e); + } + + return response; + } +} \ No newline at end of file diff --git a/tutorials/Assignment-5/btr-calculator/src/main/java/digit/service/CalculationService.java b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/service/CalculationService.java new file mode 100644 index 00000000000..9a831570049 --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/service/CalculationService.java @@ -0,0 +1,51 @@ +package digit.service; + +import digit.util.MdmsUtil; +import digit.util.ResponseInfoFactory; +import digit.web.models.Calculation; +import digit.web.models.CalculationCriteria; +import digit.web.models.CalculationReq; +import digit.web.models.CalculationRes; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.LinkedList; +import java.util.List; + +@Service +public class CalculationService { + + @Autowired + private MdmsUtil mdmsUtil; + + @Autowired + private ResponseInfoFactory responseInfoFactory; + + @Autowired + private DemandService demandService; + + public List calculate(CalculationReq calculationReq){ + List calculations = getCalculations(calculationReq); + CalculationRes calculationRes = CalculationRes.builder().responseInfo(responseInfoFactory.createResponseInfoFromRequestInfo(calculationReq.getRequestInfo(),true)).calculation(calculations).build(); + + demandService.generateDemands(calculationReq.getRequestInfo(),calculations); + return calculations; + } + + public List getCalculations(CalculationReq calculationReq){ + List calculations = new LinkedList<>(); + for(CalculationCriteria calculationCriteria : calculationReq.getCalculationCriteria()) { + Calculation calculation = new Calculation(); + calculation.setApplicationNumber(calculationCriteria.getApplicationNumber()); + calculation.setTenantId(calculationCriteria.getTenantId()); + calculation.setTotalAmount(Double.valueOf(getAmount(calculationReq))); + calculations.add(calculation); + } + return calculations; + } + + private Integer getAmount(CalculationReq calculationReq) { + return mdmsUtil.fetchRegistrationChargesFromMdms(calculationReq.getRequestInfo(), calculationReq.getCalculationCriteria().get(0).getTenantId()); + } + +} diff --git a/tutorials/Assignment-5/btr-calculator/src/main/java/digit/service/DemandService.java b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/service/DemandService.java new file mode 100644 index 00000000000..0b0b310eb4d --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/service/DemandService.java @@ -0,0 +1,89 @@ +package digit.service; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import digit.config.BTRCalculatorConfigs; +import digit.repository.ServiceRequestRepository; +import digit.web.models.*; +import lombok.extern.slf4j.Slf4j; +import org.egov.common.contract.request.RequestInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +@Slf4j +@Service +public class DemandService { + + @Autowired + private BTRCalculatorConfigs btrCalculatorConfigs; + + @Autowired + private ObjectMapper mapper = new ObjectMapper(); + + @Autowired + private ServiceRequestRepository repository; + + public List generateDemands(RequestInfo requestInfo, List calculations){ + List demands = new ArrayList<>(); + + for(Calculation calculation : calculations){ + DemandDetail demandDetail = DemandDetail.builder() + .tenantId(calculation.getTenantId()) + .taxAmount(BigDecimal.valueOf(calculation.getTotalAmount())) + .taxHeadMasterCode(btrCalculatorConfigs.getTaxHeadMasterCode()).build(); + + Demand demand = Demand.builder() + .tenantId(calculation.getTenantId()).consumerCode(calculation.getApplicationNumber()) + .consumerType("PAYMENT_BND_CONSUMER_CODE") + .businessService(btrCalculatorConfigs.getModuleCode()) + .taxPeriodFrom(System.currentTimeMillis()).taxPeriodTo(System.currentTimeMillis()) + .demandDetails(Collections.singletonList(demandDetail)) + .build(); + + demands.add(demand); + } + + StringBuilder url = new StringBuilder().append(btrCalculatorConfigs.getBillingServiceHost()) + .append(btrCalculatorConfigs.getDemandCreateEndpoint()); + + DemandRequest demandRequest = DemandRequest.builder().requestInfo(requestInfo).demands(demands).build(); + + Object response = repository.fetchResult(url,demandRequest); + + DemandResponse demandResponse = mapper.convertValue(response,DemandResponse.class); + return demandResponse.getDemands(); + } + + public BillResponse getBill(RequestInfoWrapper requestInfoWrapper, String tenantId, String applicationNumber) { + String uri = getFetchBillURI(); + uri = uri.replace("{1}", tenantId); + uri = uri.replace("{2}", applicationNumber); + uri = uri.replace("{3}", btrCalculatorConfigs.getModuleCode()); + + Object response = repository.fetchResult(new StringBuilder(uri), requestInfoWrapper); + BillResponse billResponse = mapper.convertValue(response, BillResponse.class); + + return billResponse; + } + + public String getFetchBillURI(){ + StringBuilder url = new StringBuilder(btrCalculatorConfigs.getBillingServiceHost()); + url.append(btrCalculatorConfigs.getFetchBillEndpoint()); + url.append("?"); + url.append("tenantId="); + url.append("{1}"); + url.append("&"); + url.append("consumerCode="); + url.append("{2}"); + url.append("&"); + url.append("businessService="); + url.append("{3}"); + + return url.toString(); + } +} diff --git a/tutorials/Assignment-5/btr-calculator/src/main/java/digit/util/MdmsUtil.java b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/util/MdmsUtil.java new file mode 100644 index 00000000000..63442472db6 --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/util/MdmsUtil.java @@ -0,0 +1,78 @@ +package digit.util; + +import com.jayway.jsonpath.JsonPath; +import lombok.extern.slf4j.Slf4j; +import org.egov.common.contract.request.RequestInfo; +import org.egov.mdms.model.MasterDetail; +import org.egov.mdms.model.MdmsCriteria; +import org.egov.mdms.model.MdmsCriteriaReq; +import org.egov.mdms.model.ModuleDetail; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Slf4j +@Component +public class MdmsUtil { + + @Autowired + private RestTemplate restTemplate; + + @Value("${egov.mdms.host}") + private String mdmsHost; + + @Value("${egov.mdms.search.endpoint}") + private String mdmsUrl; + + @Value("${egov.mdms.master.name}") + private String masterName; + + @Value("${egov.mdms.module.name}") + private String moduleName; + + + public Integer fetchRegistrationChargesFromMdms(RequestInfo requestInfo, String tenantId) { + StringBuilder uri = new StringBuilder(); + uri.append(mdmsHost).append(mdmsUrl); + MdmsCriteriaReq mdmsCriteriaReq = getMdmsRequestForCategoryList(requestInfo, tenantId); + Object response = new HashMap<>(); + Integer rate = 0; + try { + response = restTemplate.postForObject(uri.toString(), mdmsCriteriaReq, Map.class); + rate = JsonPath.read(response, "$.MdmsRes.BTR.RegistrationCharges.[0].amount"); + } catch (Exception e) { + log.error("Exception occurred while fetching category lists from mdms: ", e); + } + //log.info(ulbToCategoryListMap.toString()); + return rate; + } + + private MdmsCriteriaReq getMdmsRequestForCategoryList(RequestInfo requestInfo, String tenantId) { + MasterDetail masterDetail = new MasterDetail(); + masterDetail.setName(masterName); + List masterDetailList = new ArrayList<>(); + masterDetailList.add(masterDetail); + + ModuleDetail moduleDetail = new ModuleDetail(); + moduleDetail.setMasterDetails(masterDetailList); + moduleDetail.setModuleName(moduleName); + List moduleDetailList = new ArrayList<>(); + moduleDetailList.add(moduleDetail); + + MdmsCriteria mdmsCriteria = new MdmsCriteria(); + mdmsCriteria.setTenantId(tenantId.split("\\.")[0]); + mdmsCriteria.setModuleDetails(moduleDetailList); + + MdmsCriteriaReq mdmsCriteriaReq = new MdmsCriteriaReq(); + mdmsCriteriaReq.setMdmsCriteria(mdmsCriteria); + mdmsCriteriaReq.setRequestInfo(requestInfo); + + return mdmsCriteriaReq; + } +} \ No newline at end of file diff --git a/tutorials/Assignment-5/btr-calculator/src/main/java/digit/util/ResponseInfoFactory.java b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/util/ResponseInfoFactory.java new file mode 100644 index 00000000000..5246bd6a9b5 --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/util/ResponseInfoFactory.java @@ -0,0 +1,25 @@ +package digit.util; + +import org.egov.common.contract.request.RequestInfo; +import org.egov.common.contract.response.ResponseInfo; +import org.springframework.stereotype.Component; + +@Component +public class ResponseInfoFactory { + + public ResponseInfo createResponseInfoFromRequestInfo(final RequestInfo requestInfo, final Boolean success) { + + final String apiId = requestInfo != null ? requestInfo.getApiId() : ""; + final String ver = requestInfo != null ? requestInfo.getVer() : ""; + Long ts = null; + if (requestInfo != null) + ts = requestInfo.getTs(); + final String resMsgId = "uief87324"; // FIXME : Hard-coded + final String msgId = requestInfo != null ? requestInfo.getMsgId() : ""; + final String responseStatus = success ? "successful" : "failed"; + + return ResponseInfo.builder().apiId(apiId).ver(ver).ts(ts).resMsgId(resMsgId).msgId(msgId).resMsgId(resMsgId) + .status(responseStatus).build(); + } + +} \ No newline at end of file diff --git a/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/controllers/V1ApiController.java b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/controllers/V1ApiController.java new file mode 100644 index 00000000000..81ae7f4e311 --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/controllers/V1ApiController.java @@ -0,0 +1,64 @@ +package digit.web.controllers; + + +import com.fasterxml.jackson.databind.ObjectMapper; +import digit.service.CalculationService; +import digit.service.DemandService; +import digit.util.ResponseInfoFactory; +import digit.web.models.*; +import io.swagger.annotations.ApiParam; +import org.egov.common.contract.request.RequestInfo; +import org.egov.common.contract.response.ResponseInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; + +import javax.servlet.http.HttpServletRequest; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import java.util.List; + +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-11-04T14:15:45.774+05:30") + +@Controller +@RequestMapping("/v1") +public class V1ApiController { + + private final ObjectMapper objectMapper; + + private final HttpServletRequest request; + + @Autowired + private CalculationService calculationService; + @Autowired + private DemandService demandService; + + @Autowired + private ResponseInfoFactory responseInfoFactory; + + @Autowired + public V1ApiController(ObjectMapper objectMapper, HttpServletRequest request) { + this.objectMapper = objectMapper; + this.request = request; + } + + @RequestMapping(value = "/_calculate", method = RequestMethod.POST) + public ResponseEntity v1CalculatePost(@ApiParam(value = "required parameters have to be populated", required = true) @Valid @RequestBody CalculationReq calculationReq) { + List calculations = calculationService.calculate(calculationReq); + ResponseInfo responseInfo = responseInfoFactory.createResponseInfoFromRequestInfo(calculationReq.getRequestInfo(),true); + CalculationRes calculationRes = CalculationRes.builder().responseInfo(responseInfo).calculation(calculations).build(); + return new ResponseEntity(calculationRes, HttpStatus.OK); + } + + @RequestMapping(value = "/_getbill", method = RequestMethod.POST) + public ResponseEntity v1GetbillPost(@NotNull @ApiParam(value = "Unique id for a tenant.", required = true) @Valid @RequestParam(value = "tenantId", required = true) String tenantId, @NotNull @ApiParam(value = "Unique birth registration application number.", required = true) @Valid @RequestParam(value = "applicationNumber", required = true) String applicationNumber, @ApiParam(value = "Parameter to carry Request metadata in the request body") @Valid @RequestBody RequestInfoWrapper requestInfoWrapper) { + BillResponse billResponse = demandService.getBill(requestInfoWrapper, tenantId, applicationNumber); + return new ResponseEntity(billResponse, HttpStatus.OK); + } + +} diff --git a/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/Address.java b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/Address.java new file mode 100644 index 00000000000..48939a7025f --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/Address.java @@ -0,0 +1,71 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import lombok.*; +import org.springframework.validation.annotation.Validated; + +/** + * Representation of a address. Indiavidual APIs may choose to extend from this using allOf if more details needed to be added in their case. + */ +@ApiModel(description = "Representation of a address. Indiavidual APIs may choose to extend from this using allOf if more details needed to be added in their case. ") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-11-04T14:15:45.774+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class Address { + @JsonProperty("tenantId") + private String tenantId = null; + + @JsonProperty("doorNo") + private String doorNo = null; + + @JsonProperty("latitude") + private Double latitude = null; + + @JsonProperty("longitude") + private Double longitude = null; + + @JsonProperty("addressId") + private String addressId = null; + + @JsonProperty("addressNumber") + private String addressNumber = null; + + @JsonProperty("type") + private String type = null; + + @JsonProperty("addressLine1") + private String addressLine1 = null; + + @JsonProperty("addressLine2") + private String addressLine2 = null; + + @JsonProperty("landmark") + private String landmark = null; + + @JsonProperty("city") + private String city = null; + + @JsonProperty("pincode") + private String pincode = null; + + @JsonProperty("detail") + private String detail = null; + + @JsonProperty("buildingName") + private String buildingName = null; + + @JsonProperty("street") + private String street = null; + + @JsonProperty("locality") + private Boundary locality = null; + + +} + diff --git a/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/Applicant.java b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/Applicant.java new file mode 100644 index 00000000000..b5faef81826 --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/Applicant.java @@ -0,0 +1,142 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import lombok.*; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.List; + +/** + * Details of the user applying for birth registration + */ +@ApiModel(description = "Details of the user applying for birth registration") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-11-04T14:15:45.774+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class Applicant { + @JsonProperty("id") + private Long id = null; + + @JsonProperty("userName") + private String userName = null; + + @JsonProperty("password") + private String password = null; + + @JsonProperty("salutation") + private String salutation = null; + + @JsonProperty("name") + private String name = null; + + @JsonProperty("gender") + private String gender = null; + + @JsonProperty("mobileNumber") + private String mobileNumber = null; + + @JsonProperty("emailId") + private String emailId = null; + + @JsonProperty("altContactNumber") + private String altContactNumber = null; + + @JsonProperty("pan") + private String pan = null; + + @JsonProperty("aadhaarNumber") + private String aadhaarNumber = null; + + @JsonProperty("permanentAddress") + private String permanentAddress = null; + + @JsonProperty("permanentCity") + private String permanentCity = null; + + @JsonProperty("permanentPincode") + private String permanentPincode = null; + + @JsonProperty("correspondenceCity") + private String correspondenceCity = null; + + @JsonProperty("correspondencePincode") + private String correspondencePincode = null; + + @JsonProperty("correspondenceAddress") + private String correspondenceAddress = null; + + @JsonProperty("active") + private Boolean active = null; + + @JsonProperty("dob") + private LocalDate dob = null; + + @JsonProperty("pwdExpiryDate") + private LocalDate pwdExpiryDate = null; + + @JsonProperty("locale") + private String locale = null; + + @JsonProperty("type") + private String type = null; + + @JsonProperty("signature") + private String signature = null; + + @JsonProperty("accountLocked") + private Boolean accountLocked = null; + + @JsonProperty("roles") + @Valid + private List roles = null; + + @JsonProperty("fatherOrHusbandName") + private String fatherOrHusbandName = null; + + @JsonProperty("bloodGroup") + private String bloodGroup = null; + + @JsonProperty("identificationMark") + private String identificationMark = null; + + @JsonProperty("photo") + private String photo = null; + + @JsonProperty("createdBy") + private Long createdBy = null; + + @JsonProperty("createdDate") + private LocalDate createdDate = null; + + @JsonProperty("lastModifiedBy") + private Long lastModifiedBy = null; + + @JsonProperty("lastModifiedDate") + private LocalDate lastModifiedDate = null; + + @JsonProperty("otpReference") + private String otpReference = null; + + @JsonProperty("tenantId") + private String tenantId = null; + + + public Applicant addRolesItem(Role rolesItem) { + if (this.roles == null) { + this.roles = new ArrayList<>(); + } + this.roles.add(rolesItem); + return this; + } + +} + diff --git a/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/AuditDetails.java b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/AuditDetails.java new file mode 100644 index 00000000000..6cf772169a1 --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/AuditDetails.java @@ -0,0 +1,35 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import lombok.*; +import org.springframework.validation.annotation.Validated; + +/** + * Collection of audit related fields used by most models + */ +@ApiModel(description = "Collection of audit related fields used by most models") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-11-04T14:15:45.774+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class AuditDetails { + @JsonProperty("createdBy") + private String createdBy = null; + + @JsonProperty("lastModifiedBy") + private String lastModifiedBy = null; + + @JsonProperty("createdTime") + private Long createdTime = null; + + @JsonProperty("lastModifiedTime") + private Long lastModifiedTime = null; + + +} + diff --git a/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/AuditDetails2.java b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/AuditDetails2.java new file mode 100644 index 00000000000..9d8a4d997fd --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/AuditDetails2.java @@ -0,0 +1,35 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import lombok.*; +import org.springframework.validation.annotation.Validated; + +/** + * Collection of audit related fields used by most models + */ +@ApiModel(description = "Collection of audit related fields used by most models") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-11-04T14:15:45.774+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class AuditDetails2 { + @JsonProperty("createdBy") + private String createdBy = null; + + @JsonProperty("lastModifiedBy") + private String lastModifiedBy = null; + + @JsonProperty("createdTime") + private Long createdTime = null; + + @JsonProperty("lastModifiedTime") + private Long lastModifiedTime = null; + + +} + diff --git a/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/Bill.java b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/Bill.java new file mode 100644 index 00000000000..d58fa3e9a18 --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/Bill.java @@ -0,0 +1,79 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import java.util.ArrayList; +import java.util.List; + +/** + * Bill + */ +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-11-04T14:15:45.774+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class Bill { + @JsonProperty("id") + private String id = null; + + @JsonProperty("mobileNumber") + private String mobileNumber = null; + + @JsonProperty("payerName") + private String payerName = null; + + @JsonProperty("payerAddress") + private String payerAddress = null; + + @JsonProperty("payerEmail") + private String payerEmail = null; + + @JsonProperty("isActive") + private Boolean isActive = null; + + @JsonProperty("isCancelled") + private Boolean isCancelled = null; + + @JsonProperty("additionalDetails") + private Object additionalDetails = null; + + @JsonProperty("taxAndPayments") + @Valid + private List taxAndPayments = null; + + @JsonProperty("billDetails") + @Valid + private List billDetails = null; + + @JsonProperty("tenantId") + private String tenantId = null; + + @JsonProperty("auditDetails") + private AuditDetails auditDetails = null; + + + public Bill addTaxAndPaymentsItem(TaxAndPayment taxAndPaymentsItem) { + if (this.taxAndPayments == null) { + this.taxAndPayments = new ArrayList<>(); + } + this.taxAndPayments.add(taxAndPaymentsItem); + return this; + } + + public Bill addBillDetailsItem(BillDetail billDetailsItem) { + if (this.billDetails == null) { + this.billDetails = new ArrayList<>(); + } + this.billDetails.add(billDetailsItem); + return this; + } + +} + diff --git a/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/BillAccountDetail.java b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/BillAccountDetail.java new file mode 100644 index 00000000000..1e9fa4636f3 --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/BillAccountDetail.java @@ -0,0 +1,93 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import lombok.*; +import org.springframework.validation.annotation.Validated; + +import java.math.BigDecimal; + +/** + * BillAccountDetail + */ +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-11-04T14:15:45.774+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class BillAccountDetail { + @JsonProperty("id") + private String id = null; + + @JsonProperty("tenantId") + private String tenantId = null; + + @JsonProperty("billDetail") + private String billDetail = null; + + @JsonProperty("demandDetailId") + private String demandDetailId = null; + + @JsonProperty("order") + private Integer order = null; + + @JsonProperty("amount") + private BigDecimal amount = null; + + @JsonProperty("adjustedAmount") + private BigDecimal adjustedAmount = null; + + @JsonProperty("isActualDemand") + private Boolean isActualDemand = null; + + @JsonProperty("glcode") + private String glcode = null; + + @JsonProperty("taxHeadCode") + private String taxHeadCode = null; + + @JsonProperty("additionalDetails") + private Object additionalDetails = null; + @JsonProperty("purpose") + private PurposeEnum purpose = null; + + /** + * Purpose of Account head. + */ + public enum PurposeEnum { + ARREAR("ARREAR"), + + CURRENT("CURRENT"), + + ADVANCE("ADVANCE"); + + private String value; + + PurposeEnum(String value) { + this.value = value; + } + + @JsonCreator + public static PurposeEnum fromValue(String text) { + for (PurposeEnum b : PurposeEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + } + + +} + diff --git a/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/BillDetail.java b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/BillDetail.java new file mode 100644 index 00000000000..d6bb5f98134 --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/BillDetail.java @@ -0,0 +1,134 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import lombok.*; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +/** + * BillDetail + */ +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-11-04T14:15:45.774+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class BillDetail { + @JsonProperty("id") + private String id = null; + + @JsonProperty("tenantId") + private String tenantId = null; + + @JsonProperty("demandId") + private String demandId = null; + + @JsonProperty("bill") + private String bill = null; + + @JsonProperty("businessService") + private String businessService = null; + + @JsonProperty("billNumber") + private String billNumber = null; + + @JsonProperty("billDate") + private BigDecimal billDate = null; + + @JsonProperty("consumerCode") + private String consumerCode = null; + + @JsonProperty("consumerType") + private String consumerType = null; + + @JsonProperty("minimumAmount") + private BigDecimal minimumAmount = null; + + @JsonProperty("totalAmount") + private BigDecimal totalAmount = null; + + @JsonProperty("fromPeriod") + private BigDecimal fromPeriod = null; + + @JsonProperty("toPeriod") + private BigDecimal toPeriod = null; + + @JsonProperty("collectedAmount") + private BigDecimal collectedAmount = null; + + @JsonProperty("collectionModesNotAllowed") + @Valid + private List collectionModesNotAllowed = null; + + @JsonProperty("partPaymentAllowed") + private Boolean partPaymentAllowed = null; + + @JsonProperty("additionalDetails") + private Object additionalDetails = null; + + @JsonProperty("billAccountDetails") + @Valid + private List billAccountDetails = null; + @JsonProperty("status") + private StatusEnum status = null; + + public BillDetail addCollectionModesNotAllowedItem(String collectionModesNotAllowedItem) { + if (this.collectionModesNotAllowed == null) { + this.collectionModesNotAllowed = new ArrayList<>(); + } + this.collectionModesNotAllowed.add(collectionModesNotAllowedItem); + return this; + } + + public BillDetail addBillAccountDetailsItem(BillAccountDetail billAccountDetailsItem) { + if (this.billAccountDetails == null) { + this.billAccountDetails = new ArrayList<>(); + } + this.billAccountDetails.add(billAccountDetailsItem); + return this; + } + + /** + * status if the bill detail + */ + public enum StatusEnum { + CREATED("CREATED"), + + CANCELLED("CANCELLED"), + + INSTRUMENT_BOUNCED("INSTRUMENT_BOUNCED"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonCreator + public static StatusEnum fromValue(String text) { + for (StatusEnum b : StatusEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + } + +} + diff --git a/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/BillResponse.java b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/BillResponse.java new file mode 100644 index 00000000000..3a2b7e94b5e --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/BillResponse.java @@ -0,0 +1,29 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.egov.common.contract.response.ResponseInfo; + +import java.util.ArrayList; +import java.util.List; + +/** + * BillResponse + */ + +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class BillResponse { + + @JsonProperty("ResposneInfo") + private ResponseInfo resposneInfo = null; + + @JsonProperty("Bill") + private List bill = new ArrayList<>(); + +} diff --git a/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/BirthRegistrationApplication.java b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/BirthRegistrationApplication.java new file mode 100644 index 00000000000..667ab64d0ce --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/BirthRegistrationApplication.java @@ -0,0 +1,65 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import lombok.*; +import org.springframework.validation.annotation.Validated; + +/** + * A Object holds the basic data for a Birth Registration Application + */ +@ApiModel(description = "A Object holds the basic data for a Birth Registration Application") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-11-04T14:15:45.774+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class BirthRegistrationApplication { + @JsonProperty("id") + private String id = null; + + @JsonProperty("tenantId") + private String tenantId = null; + + @JsonProperty("applicationNumber") + private String applicationNumber = null; + + @JsonProperty("babyFirstName") + private String babyFirstName = null; + + @JsonProperty("babyLastName") + private String babyLastName = null; + + @JsonProperty("fathertName") + private String fathertName = null; + + @JsonProperty("motherName") + private String motherName = null; + + @JsonProperty("doctorAttendingBirth") + private String doctorAttendingBirth = null; + + @JsonProperty("hospitalName") + private String hospitalName = null; + + @JsonProperty("placeOfBirth") + private String placeOfBirth = null; + + @JsonProperty("dateOfBirth") + private Integer dateOfBirth = null; + + @JsonProperty("address") + private Address address = null; + + @JsonProperty("applicant") + private Applicant applicant = null; + + @JsonProperty("auditDetails") + private AuditDetails2 auditDetails = null; + + +} + diff --git a/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/Boundary.java b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/Boundary.java new file mode 100644 index 00000000000..975d89407c2 --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/Boundary.java @@ -0,0 +1,55 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import java.util.ArrayList; +import java.util.List; + +/** + * Boundary + */ +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-11-04T14:15:45.774+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class Boundary { + @JsonProperty("code") + private String code = null; + + @JsonProperty("name") + private String name = null; + + @JsonProperty("label") + private String label = null; + + @JsonProperty("latitude") + private String latitude = null; + + @JsonProperty("longitude") + private String longitude = null; + + @JsonProperty("children") + @Valid + private List children = null; + + @JsonProperty("materializedPath") + private String materializedPath = null; + + + public Boundary addChildrenItem(Boundary childrenItem) { + if (this.children == null) { + this.children = new ArrayList<>(); + } + this.children.add(childrenItem); + return this; + } + +} + diff --git a/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/Calculation.java b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/Calculation.java new file mode 100644 index 00000000000..78fc5103e69 --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/Calculation.java @@ -0,0 +1,30 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; +import org.springframework.validation.annotation.Validated; + +/** + * Calculation + */ +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-11-04T14:15:45.774+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class Calculation { + @JsonProperty("applicationNumber") + private String applicationNumber = null; + + @JsonProperty("totalAmount") + private Double totalAmount = null; + + @JsonProperty("tenantId") + private String tenantId = null; + + +} + diff --git a/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/CalculationCriteria.java b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/CalculationCriteria.java new file mode 100644 index 00000000000..6795983fcc7 --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/CalculationCriteria.java @@ -0,0 +1,32 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import lombok.*; +import org.springframework.validation.annotation.Validated; + +/** + * Criteria to calculate charges for birth registration. + */ +@ApiModel(description = "Criteria to calculate charges for birth registration.") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-11-04T14:15:45.774+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class CalculationCriteria { + @JsonProperty("birthregistrationapplication") + private BirthRegistrationApplication birthregistrationapplication = null; + + @JsonProperty("applicationNumber") + private String applicationNumber = null; + + @JsonProperty("tenantId") + private String tenantId = null; + + +} + diff --git a/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/CalculationReq.java b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/CalculationReq.java new file mode 100644 index 00000000000..8f521ac8020 --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/CalculationReq.java @@ -0,0 +1,38 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; +import org.egov.common.contract.request.RequestInfo; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import java.util.ArrayList; +import java.util.List; + +/** + * CalculationReq + */ +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-11-04T14:15:45.774+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class CalculationReq { + @JsonProperty("RequestInfo") + private RequestInfo requestInfo = null; + + @JsonProperty("CalculationCriteria") + @Valid + private List calculationCriteria = new ArrayList<>(); + + + public CalculationReq addCalculationCriteriaItem(CalculationCriteria calculationCriteriaItem) { + this.calculationCriteria.add(calculationCriteriaItem); + return this; + } + +} + diff --git a/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/CalculationRes.java b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/CalculationRes.java new file mode 100644 index 00000000000..bba37735840 --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/CalculationRes.java @@ -0,0 +1,41 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; +import org.egov.common.contract.response.ResponseInfo; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import java.util.ArrayList; +import java.util.List; + +/** + * CalculationRes + */ +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-11-04T14:15:45.774+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class CalculationRes { + @JsonProperty("ResponseInfo") + private ResponseInfo responseInfo = null; + + @JsonProperty("Calculation") + @Valid + private List calculation = null; + + + public CalculationRes addCalculationItem(Calculation calculationItem) { + if (this.calculation == null) { + this.calculation = new ArrayList<>(); + } + this.calculation.add(calculationItem); + return this; + } + +} + diff --git a/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/Demand.java b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/Demand.java new file mode 100644 index 00000000000..085b3fda522 --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/Demand.java @@ -0,0 +1,145 @@ +/* + * eGov suite of products aim to improve the internal efficiency,transparency, + * accountability and the service delivery of the government organizations. + * + * Copyright (C) <2015> eGovernments Foundation + * + * The updated version of eGov suite of products as by eGovernments Foundation + * is available at http://www.egovernments.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/ or + * http://www.gnu.org/licenses/gpl.html . + * + * In addition to the terms of the GPL license to be adhered to in using this + * program, the following additional terms are to be complied with: + * + * 1) All versions of this program, verbatim or modified must carry this + * Legal Notice. + * + * 2) Any misrepresentation of the origin of the material is prohibited. It + * is required that all modified versions of this material be marked in + * reasonable ways as different from the original version. + * + * 3) This license does not grant any rights to any user of the program + * with regards to rights under trademark law for use of the trade names + * or trademarks of eGovernments Foundation. + * + * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. + */ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.egov.common.contract.request.User; + +import javax.validation.Valid; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class Demand { + + @JsonProperty("id") + private String id; + + @JsonProperty("tenantId") + private String tenantId; + + @JsonProperty("consumerCode") + private String consumerCode; + + @JsonProperty("consumerType") + private String consumerType; + + @JsonProperty("businessService") + private String businessService; + + @Valid + @JsonProperty("payer") + private User payer; + + @JsonProperty("taxPeriodFrom") + private Long taxPeriodFrom; + + @JsonProperty("taxPeriodTo") + private Long taxPeriodTo; + + @Builder.Default + @JsonProperty("demandDetails") + @Valid + private List demandDetails = new ArrayList<>(); + + @JsonProperty("auditDetails") + private AuditDetails auditDetails; + + @JsonProperty("additionalDetails") + private Object additionalDetails; + + @Builder.Default + @JsonProperty("minimumAmountPayable") + private BigDecimal minimumAmountPayable = BigDecimal.ZERO; + + /** + * Gets or Sets status + */ + public enum DemandStatusEnum { + + ACTIVE("ACTIVE"), + + CANCELLED("CANCELLED"), + + ADJUSTED("ADJUSTED"); + + private String value; + + DemandStatusEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static DemandStatusEnum fromValue(String text) { + for (DemandStatusEnum b : DemandStatusEnum.values()) { + if (String.valueOf(b.value).equalsIgnoreCase(text)) { + return b; + } + } + return null; + } + } + + @JsonProperty("status") + private DemandStatusEnum status; + + + public Demand addDemandDetailsItem(DemandDetail demandDetailsItem) { + this.demandDetails.add(demandDetailsItem); + return this; + } + +} diff --git a/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/DemandDetail.java b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/DemandDetail.java new file mode 100644 index 00000000000..646870dc44d --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/DemandDetail.java @@ -0,0 +1,73 @@ +/* + * eGov suite of products aim to improve the internal efficiency,transparency, + * accountability and the service delivery of the government organizations. + * + * Copyright (C) <2015> eGovernments Foundation + * + * The updated version of eGov suite of products as by eGovernments Foundation + * is available at http://www.egovernments.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/ or + * http://www.gnu.org/licenses/gpl.html . + * + * In addition to the terms of the GPL license to be adhered to in using this + * program, the following additional terms are to be complied with: + * + * 1) All versions of this program, verbatim or modified must carry this + * Legal Notice. + * + * 2) Any misrepresentation of the origin of the material is prohibited. It + * is required that all modified versions of this material be marked in + * reasonable ways as different from the original version. + * + * 3) This license does not grant any rights to any user of the program + * with regards to rights under trademark law for use of the trade names + * or trademarks of eGovernments Foundation. + * + * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. + */ +package digit.web.models; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; + +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class DemandDetail { + + private String id; + + private String demandId; + + @NotNull + private String taxHeadMasterCode; + + @NotNull + private BigDecimal taxAmount; + + @NotNull + @Builder.Default + private BigDecimal collectionAmount = BigDecimal.valueOf(0d); + + private AuditDetails auditDetails; + + private String tenantId; +} \ No newline at end of file diff --git a/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/DemandRequest.java b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/DemandRequest.java new file mode 100644 index 00000000000..fd41366cdb3 --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/DemandRequest.java @@ -0,0 +1,68 @@ +/* + * eGov suite of products aim to improve the internal efficiency,transparency, + * accountability and the service delivery of the government organizations. + * + * Copyright (C) <2015> eGovernments Foundation + * + * The updated version of eGov suite of products as by eGovernments Foundation + * is available at http://www.egovernments.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/ or + * http://www.gnu.org/licenses/gpl.html . + * + * In addition to the terms of the GPL license to be adhered to in using this + * program, the following additional terms are to be complied with: + * + * 1) All versions of this program, verbatim or modified must carry this + * Legal Notice. + * + * 2) Any misrepresentation of the origin of the material is prohibited. It + * is required that all modified versions of this material be marked in + * reasonable ways as different from the original version. + * + * 3) This license does not grant any rights to any user of the program + * with regards to rights under trademark law for use of the trade names + * or trademarks of eGovernments Foundation. + * + * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. + */ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.egov.common.contract.request.RequestInfo; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import java.util.ArrayList; +import java.util.List; + +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class DemandRequest { + + @NotNull + @JsonProperty("RequestInfo") + private RequestInfo requestInfo; + + @Valid + @NotNull + @JsonProperty("Demands") + private List demands = new ArrayList<>(); +} diff --git a/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/DemandResponse.java b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/DemandResponse.java new file mode 100644 index 00000000000..a6e8f4a3e84 --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/DemandResponse.java @@ -0,0 +1,64 @@ +/* + * eGov suite of products aim to improve the internal efficiency,transparency, + * accountability and the service delivery of the government organizations. + * + * Copyright (C) <2015> eGovernments Foundation + * + * The updated version of eGov suite of products as by eGovernments Foundation + * is available at http://www.egovernments.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/ or + * http://www.gnu.org/licenses/gpl.html . + * + * In addition to the terms of the GPL license to be adhered to in using this + * program, the following additional terms are to be complied with: + * + * 1) All versions of this program, verbatim or modified must carry this + * Legal Notice. + * + * 2) Any misrepresentation of the origin of the material is prohibited. It + * is required that all modified versions of this material be marked in + * reasonable ways as different from the original version. + * + * 3) This license does not grant any rights to any user of the program + * with regards to rights under trademark law for use of the trade names + * or trademarks of eGovernments Foundation. + * + * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. + */ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.egov.common.contract.response.ResponseInfo; + +import java.util.ArrayList; +import java.util.List; + +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class DemandResponse { + + @JsonProperty("ResponseInfo") + private ResponseInfo responseInfo; + + @JsonProperty("Demands") + private List demands = new ArrayList<>(); + +} diff --git a/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/Error.java b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/Error.java new file mode 100644 index 00000000000..a0ec8f68b18 --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/Error.java @@ -0,0 +1,48 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import lombok.*; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import java.util.ArrayList; +import java.util.List; + +/** + * Error object will be returned as a part of reponse body in conjunction with ResponseInfo as part of ErrorResponse whenever the request processing status in the ResponseInfo is FAILED. HTTP return in this scenario will usually be HTTP 400. + */ +@ApiModel(description = "Error object will be returned as a part of reponse body in conjunction with ResponseInfo as part of ErrorResponse whenever the request processing status in the ResponseInfo is FAILED. HTTP return in this scenario will usually be HTTP 400.") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-11-04T14:15:45.774+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class Error { + @JsonProperty("code") + private String code = null; + + @JsonProperty("message") + private String message = null; + + @JsonProperty("description") + private String description = null; + + @JsonProperty("params") + @Valid + private List params = null; + + + public Error addParamsItem(String paramsItem) { + if (this.params == null) { + this.params = new ArrayList<>(); + } + this.params.add(paramsItem); + return this; + } + +} + diff --git a/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/ErrorRes.java b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/ErrorRes.java new file mode 100644 index 00000000000..900e4b7864e --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/ErrorRes.java @@ -0,0 +1,43 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import lombok.*; +import org.egov.common.contract.response.ResponseInfo; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import java.util.ArrayList; +import java.util.List; + +/** + * All APIs will return ErrorRes in case of failure which will carry ResponseInfo as metadata and Error object as actual representation of error. In case of bulk apis, some apis may chose to return the array of Error objects to indicate individual failure. + */ +@ApiModel(description = "All APIs will return ErrorRes in case of failure which will carry ResponseInfo as metadata and Error object as actual representation of error. In case of bulk apis, some apis may chose to return the array of Error objects to indicate individual failure.") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-11-04T14:15:45.774+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class ErrorRes { + @JsonProperty("ResponseInfo") + private ResponseInfo responseInfo = null; + + @JsonProperty("Errors") + @Valid + private List errors = null; + + + public ErrorRes addErrorsItem(Error errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); + } + this.errors.add(errorsItem); + return this; + } + +} + diff --git a/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/RequestInfoWrapper.java b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/RequestInfoWrapper.java new file mode 100644 index 00000000000..159afaa299f --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/RequestInfoWrapper.java @@ -0,0 +1,22 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.egov.common.contract.request.RequestInfo; + +import javax.validation.constraints.NotNull; + +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class RequestInfoWrapper { + + @NotNull + @JsonProperty("RequestInfo") + private RequestInfo requestInfo; + +} diff --git a/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/Role.java b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/Role.java new file mode 100644 index 00000000000..80bf1ebfd30 --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/Role.java @@ -0,0 +1,50 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; +import org.springframework.validation.annotation.Validated; + +import java.time.LocalDate; + +/** + * Role + */ +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-11-04T14:15:45.774+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class Role { + @JsonProperty("id") + private Long id = null; + + @JsonProperty("name") + private String name = null; + + @JsonProperty("code") + private String code = null; + + @JsonProperty("description") + private String description = null; + + @JsonProperty("createdBy") + private Long createdBy = null; + + @JsonProperty("createdDate") + private LocalDate createdDate = null; + + @JsonProperty("lastModifiedBy") + private Long lastModifiedBy = null; + + @JsonProperty("lastModifiedDate") + private LocalDate lastModifiedDate = null; + + @JsonProperty("tenantId") + private String tenantId = null; + + +} + diff --git a/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/Role2.java b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/Role2.java new file mode 100644 index 00000000000..c2fc5f8e641 --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/Role2.java @@ -0,0 +1,32 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import lombok.*; +import org.springframework.validation.annotation.Validated; + +/** + * minimal representation of the Roles in the system to be carried along in UserInfo with RequestInfo meta data. Actual authorization service to extend this to have more role related attributes + */ +@ApiModel(description = "minimal representation of the Roles in the system to be carried along in UserInfo with RequestInfo meta data. Actual authorization service to extend this to have more role related attributes ") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-11-04T14:15:45.774+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class Role2 { + @JsonProperty("name") + private String name = null; + + @JsonProperty("code") + private String code = null; + + @JsonProperty("description") + private String description = null; + + +} + diff --git a/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/TaxAndPayment.java b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/TaxAndPayment.java new file mode 100644 index 00000000000..6ca8f0591d6 --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/TaxAndPayment.java @@ -0,0 +1,30 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; +import org.springframework.validation.annotation.Validated; + +/** + * TaxAndPayment + */ +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-11-04T14:15:45.774+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class TaxAndPayment { + @JsonProperty("businessService") + private String businessService = null; + + @JsonProperty("taxAmount") + private String taxAmount = null; + + @JsonProperty("amountPaid") + private String amountPaid = null; + + +} + diff --git a/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/TenantRole.java b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/TenantRole.java new file mode 100644 index 00000000000..ca143571325 --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/TenantRole.java @@ -0,0 +1,39 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import lombok.*; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import java.util.ArrayList; +import java.util.List; + +/** + * User role carries the tenant related role information for the user. A user can have multiple roles per tenant based on the need of the tenant. A user may also have multiple roles for multiple tenants. + */ +@ApiModel(description = "User role carries the tenant related role information for the user. A user can have multiple roles per tenant based on the need of the tenant. A user may also have multiple roles for multiple tenants.") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-11-04T14:15:45.774+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class TenantRole { + @JsonProperty("tenantId") + private String tenantId = null; + + @JsonProperty("roles") + @Valid + private List roles = new ArrayList<>(); + + + public TenantRole addRolesItem(Role rolesItem) { + this.roles.add(rolesItem); + return this; + } + +} + diff --git a/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/User.java b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/User.java new file mode 100644 index 00000000000..d09708f429a --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/User.java @@ -0,0 +1,140 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.List; + +/** + * User + */ +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-11-04T14:15:45.774+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class User { + @JsonProperty("id") + private Long id = null; + + @JsonProperty("userName") + private String userName = null; + + @JsonProperty("password") + private String password = null; + + @JsonProperty("salutation") + private String salutation = null; + + @JsonProperty("name") + private String name = null; + + @JsonProperty("gender") + private String gender = null; + + @JsonProperty("mobileNumber") + private String mobileNumber = null; + + @JsonProperty("emailId") + private String emailId = null; + + @JsonProperty("altContactNumber") + private String altContactNumber = null; + + @JsonProperty("pan") + private String pan = null; + + @JsonProperty("aadhaarNumber") + private String aadhaarNumber = null; + + @JsonProperty("permanentAddress") + private String permanentAddress = null; + + @JsonProperty("permanentCity") + private String permanentCity = null; + + @JsonProperty("permanentPincode") + private String permanentPincode = null; + + @JsonProperty("correspondenceCity") + private String correspondenceCity = null; + + @JsonProperty("correspondencePincode") + private String correspondencePincode = null; + + @JsonProperty("correspondenceAddress") + private String correspondenceAddress = null; + + @JsonProperty("active") + private Boolean active = null; + + @JsonProperty("dob") + private LocalDate dob = null; + + @JsonProperty("pwdExpiryDate") + private LocalDate pwdExpiryDate = null; + + @JsonProperty("locale") + private String locale = null; + + @JsonProperty("type") + private String type = null; + + @JsonProperty("signature") + private String signature = null; + + @JsonProperty("accountLocked") + private Boolean accountLocked = null; + + @JsonProperty("roles") + @Valid + private List roles = null; + + @JsonProperty("fatherOrHusbandName") + private String fatherOrHusbandName = null; + + @JsonProperty("bloodGroup") + private String bloodGroup = null; + + @JsonProperty("identificationMark") + private String identificationMark = null; + + @JsonProperty("photo") + private String photo = null; + + @JsonProperty("createdBy") + private Long createdBy = null; + + @JsonProperty("createdDate") + private LocalDate createdDate = null; + + @JsonProperty("lastModifiedBy") + private Long lastModifiedBy = null; + + @JsonProperty("lastModifiedDate") + private LocalDate lastModifiedDate = null; + + @JsonProperty("otpReference") + private String otpReference = null; + + @JsonProperty("tenantId") + private String tenantId = null; + + + public User addRolesItem(Role rolesItem) { + if (this.roles == null) { + this.roles = new ArrayList<>(); + } + this.roles.add(rolesItem); + return this; + } + +} + diff --git a/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/UserInfo.java b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/UserInfo.java new file mode 100644 index 00000000000..61c4dc45cfb --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/src/main/java/digit/web/models/UserInfo.java @@ -0,0 +1,69 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import lombok.*; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import java.util.ArrayList; +import java.util.List; + +/** + * This is acting ID token of the authenticated user on the server. Any value provided by the clients will be ignored and actual user based on authtoken will be used on the server. + */ +@ApiModel(description = "This is acting ID token of the authenticated user on the server. Any value provided by the clients will be ignored and actual user based on authtoken will be used on the server.") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-11-04T14:15:45.774+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class UserInfo { + @JsonProperty("tenantId") + private String tenantId = null; + + @JsonProperty("uuid") + private String uuid = null; + + @JsonProperty("userName") + private String userName = null; + + @JsonProperty("password") + private String password = null; + + @JsonProperty("idToken") + private String idToken = null; + + @JsonProperty("mobile") + private String mobile = null; + + @JsonProperty("email") + private String email = null; + + @JsonProperty("primaryrole") + @Valid + private List primaryrole = new ArrayList<>(); + + @JsonProperty("additionalroles") + @Valid + private List additionalroles = null; + + + public UserInfo addPrimaryroleItem(Role primaryroleItem) { + this.primaryrole.add(primaryroleItem); + return this; + } + + public UserInfo addAdditionalrolesItem(TenantRole additionalrolesItem) { + if (this.additionalroles == null) { + this.additionalroles = new ArrayList<>(); + } + this.additionalroles.add(additionalrolesItem); + return this; + } + +} + diff --git a/tutorials/Assignment-5/btr-calculator/src/main/resources/application.properties b/tutorials/Assignment-5/btr-calculator/src/main/resources/application.properties new file mode 100644 index 00000000000..964a85e0478 --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/src/main/resources/application.properties @@ -0,0 +1,17 @@ +server.servlet.contextPath=/birth-calculator +server.port=2345 +app.timezone=UTC + +#mdms urls +egov.mdms.host=https://dev.digit.org +egov.mdms.search.endpoint=/egov-mdms-service/v1/_search +egov.mdms.master.name=RegistrationCharges +egov.mdms.module.name=BTR + +# Billing Service +egov.billingservice.host=http://localhost:8031 +egov.demand.create.endpoint=/billing-service/demand/_create +egov.billingservice.fetch.bill=/billing-service/bill/v2/_fetchbill + +btr.taxhead.master.code=BIRTH_CERT_FEE +btr.module.code=BIRTH_CERT diff --git a/tutorials/Assignment-5/btr-calculator/src/test/java/digit/TestConfiguration.java b/tutorials/Assignment-5/btr-calculator/src/test/java/digit/TestConfiguration.java new file mode 100644 index 00000000000..570236cfc94 --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/src/test/java/digit/TestConfiguration.java @@ -0,0 +1,16 @@ +package digit; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.kafka.core.KafkaTemplate; + +import static org.mockito.Mockito.mock; + +@Configuration +public class TestConfiguration { + @Bean + @SuppressWarnings("unchecked") + public KafkaTemplate kafkaTemplate() { + return mock(KafkaTemplate.class); + } +} \ No newline at end of file diff --git a/tutorials/Assignment-5/btr-calculator/src/test/java/digit/web/controllers/V1ApiControllerTest.java b/tutorials/Assignment-5/btr-calculator/src/test/java/digit/web/controllers/V1ApiControllerTest.java new file mode 100644 index 00000000000..1effa89f8c4 --- /dev/null +++ b/tutorials/Assignment-5/btr-calculator/src/test/java/digit/web/controllers/V1ApiControllerTest.java @@ -0,0 +1,58 @@ +package digit.web.controllers; + +import org.junit.Test; +import org.junit.Ignore; +import org.junit.runner.RunWith; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.context.annotation.Import; +import org.springframework.http.MediaType; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import digit.TestConfiguration; + +import static org.mockito.Matchers.any; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +/** +* API tests for V1ApiController +*/ +@Ignore +@RunWith(SpringRunner.class) +@WebMvcTest(V1ApiController.class) +@Import(TestConfiguration.class) +public class V1ApiControllerTest { + + @Autowired + private MockMvc mockMvc; + + @Test + public void v1CalculatePostSuccess() throws Exception { + mockMvc.perform(post("/btr-calculator//v1/_calculate").contentType(MediaType + .APPLICATION_JSON_UTF8)) + .andExpect(status().isOk()); + } + + @Test + public void v1CalculatePostFailure() throws Exception { + mockMvc.perform(post("/btr-calculator//v1/_calculate").contentType(MediaType + .APPLICATION_JSON_UTF8)) + .andExpect(status().isBadRequest()); + } + + @Test + public void v1GetbillPostSuccess() throws Exception { + mockMvc.perform(post("/btr-calculator//v1/_getbill").contentType(MediaType + .APPLICATION_JSON_UTF8)) + .andExpect(status().isOk()); + } + + @Test + public void v1GetbillPostFailure() throws Exception { + mockMvc.perform(post("/btr-calculator//v1/_getbill").contentType(MediaType + .APPLICATION_JSON_UTF8)) + .andExpect(status().isBadRequest()); + } + +} diff --git a/tutorials/Assignment-5/btr-services/README.md b/tutorials/Assignment-5/btr-services/README.md new file mode 100644 index 00000000000..76cdd375214 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/README.md @@ -0,0 +1,49 @@ +# Birth Registration Service + +This service is used to issue birth certificate. + +### Service Dependencies + +- egov-idgen +- egov-user +- egov-workflow +- btr-calculator + +### Swagger API Contract + +[API Contract](./birth-registration-api-spec.yaml) + +## Service Details + +The service is integrated with User service, IdGen service and +Workflow service to create, update and search a birth registration application. +It is also integrated with btr-calculator to calculate the amount to be +paid. + +### API Details + +`BasePath` /birth-registration/birth-services/v1/registration/[API endpoint] + +#### Method + +a) `_create` +- Creates birth registration application and return the application number + +b) `_update` +- Updates birth registration application based on application number + +c) `_search` +- Searches birth registration application based on application number + +### Kafka Consumers + +- Following are the Consumer topics. + - **kafka.topics.receipt.create** + - **btr.kafka.create.topic** + +### Kafka Producers + +- Following are the Producer topics. + - **save-bt-application** + - **update-bt-application** + diff --git a/tutorials/Assignment-5/btr-services/birth-certificate-pdf.json b/tutorials/Assignment-5/btr-services/birth-certificate-pdf.json new file mode 100644 index 00000000000..823fe8ce302 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/birth-certificate-pdf.json @@ -0,0 +1,527 @@ +{ + "key": "birth-certificate", + "DataConfigs": { + "serviceName": "rainmaker-common", + "version": "1.0.0", + "baseKeyPath": "$.BirthCertificate.*", + "entityIdPath":"$.id", + "isCommonTableBorderRequired": true, + "mappings": [ + { + "topic": "common-pdf-generation-3", + "mappings": [ + { + "direct": [ + { + "variable": "logoImage", + "url":"https://raw.githubusercontent.com/egovernments/egov-web-app/master/web/rainmaker/dev-packages/egov-ui-kit-dev/src/assets/images/pblogo.png", + "type":"image" + }, + { + "variable": "name", + "value": { + "path": "$.fullName" + }, + "type":"setEmpty" + }, + { + "variable": "embeddedUrl", + "value": { + "path": "$.embeddedUrl" + } + }, + { + "variable": "dob", + "value": { + "path": "$.dateofbirth" + }, + "type": "date" + }, + { + "variable": "gender", + "value": { + "path": "$.genderStr" + }, + "type":"setEmpty" + }, + { + "variable": "registrationNo", + "value": { + "path": "$.registrationno" + }, + "type":"setEmpty" + }, + { + "variable": "registration_date", + "value": { + "path": "$.dateofreport" + }, + "type": "date" + }, + { + "variable": "updatedOn", + "value": { + "path": "$.dateofissue" + }, + "type": "date" + }, + { + "variable": "year", + "value": { + "path": "$.year" + }, + "type": "setEmpty" + }, + { + "variable": "fatherName", + "value": { + "path": "$.birthFatherInfo.fullName" + }, + "type":"setEmpty" + }, + { + "variable": "motherName", + "value": { + "path": "$.birthMotherInfo.fullName" + }, + "type":"setEmpty" + }, + { + "variable": "childAddress", + "value": { + "path": "$.birthPresentaddr.fullAddress" + }, + "type":"setEmpty" + }, + { + "variable": "parentsAddress", + "value": { + "path": "$.birthPermaddr.fullAddress" + }, + "type":"setEmpty" + }, + { + "variable": "parentsCity", + "value": { + "path": "$.birthPermaddr.city" + }, + "type":"setEmpty" + }, + { + "variable": "parentsStreet", + "value": { + "path": "$.birthPermaddr.street" + }, + "type":"setEmpty" + }, + { + "variable": "parentsTehsil", + "value": { + "path": "$.birthPermaddr.tehsil" + }, + "type":"setEmpty" + }, + { + "variable": "parentsDistrict", + "value": { + "path": "$.birthPermaddr.district" + }, + "type":"setEmpty" + }, + { + "variable": "fatherUid", + "value": { + "path": "$.birthFatherInfo.aadharno" + }, + "type":"setEmpty" + }, + { + "variable": "motherUid", + "value": { + "path": "$.birthMotherInfo.aadharno" + }, + "type":"setEmpty" + }, + { + "variable": "remarks", + "value": { + "path": "$.remarks" + }, + "type":"setEmpty" + }, + { + "variable": "placeOfBirth", + "value": { + "path": "$.placeofbirth" + }, + "type":"setEmpty" + }, + { + "variable": "issueDate", + "value": { + "path": "$.dateofissue" + }, + "type": "date" + }, + + { + "variable": "certificateType", + "value": { + "path": "$.certificateType" + }, + "type":"setEmpty" + }, + { + "variable": "cantonment-board", + "value": { + "path": "PDF_STATIC_LABEL_CONSOLIDATED_TLCERTIFICATE_MUNICIPAL_CORPORATION" + }, + "type": "label", + "localisation":{ + "required":true, + "prefix": null, + "module":"rainmaker-pdf" + } + }, + { + "variable": "govt_label", + "value": { + "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_GOVT_UP" + }, + "type": "label", + "localisation":{ + "required":true, + "prefix": null, + "module":"rainmaker-pdf" + } + }, + + { + "variable": "dept_label", + "value": { + "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_DEPT" + }, + "type": "label", + "localisation":{ + "required":true, + "prefix": null, + "module":"rainmaker-pdf" + } + }, + + + + { + "variable": "certificate_label", + "value": { + "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_CERTIFICATE_BIRTH" + }, + "type": "label", + "localisation":{ + "required":true, + "prefix": null, + "module":"rainmaker-pdf" + } + }, + + { + "variable": "certificate_label", + "value": { + "path": "PDF_STATIC_LABEL_BD_EN_CERTIFICATE" + }, + "type": "label", + "localisation":{ + "required":true, + "prefix": null, + "module":"rainmaker-pdf" + } + }, + { + "variable": "rule1_label", + "value": { + "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_RULE_1" + }, + "type": "label", + "localisation":{ + "required":true, + "prefix": null, + "module":"rainmaker-pdf" + } + }, + + { + "variable": "rule2_label", + "value": { + "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_RULE_2" + }, + "type": "label", + "localisation":{ + "required":true, + "prefix": null, + "module":"rainmaker-pdf" + } + }, + + { + "variable": "name_label", + "value": { + "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_NAME" + }, + "type": "label", + "localisation":{ + "required":true, + "prefix": null, + "module":"rainmaker-pdf" + } + }, + + { + "variable": "gender_label", + "value": { + "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_GENDER" + }, + "type": "label", + "localisation":{ + "required":true, + "prefix": null, + "module":"rainmaker-pdf" + } + }, + + { + "variable": "dob_label", + "value": { + "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_DOB" + }, + "type": "label", + "localisation":{ + "required":true, + "prefix": null, + "module":"rainmaker-pdf" + } + }, + + { + "variable": "pob_label", + "value": { + "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_POB" + }, + "type": "label", + "localisation":{ + "required":true, + "prefix": null, + "module":"rainmaker-pdf" + } + }, + + { + "variable": "mother_name_label", + "value": { + "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_MOTHER_NAME" + }, + "type": "label", + "localisation":{ + "required":true, + "prefix": null, + "module":"rainmaker-pdf" + } + }, + + { + "variable": "father_name_label", + "value": { + "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_FATHER_NAME" + }, + "type": "label", + "localisation":{ + "required":true, + "prefix": null, + "module":"rainmaker-pdf" + } + }, + + { + "variable": "mother_uid_label", + "value": { + "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_MOTHER_UID" + }, + "type": "label", + "localisation":{ + "required":true, + "prefix": null, + "module":"rainmaker-pdf" + } + }, + + { + "variable": "father_uid_label", + "value": { + "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_FATHER_UID" + }, + "type": "label", + "localisation":{ + "required":true, + "prefix": null, + "module":"rainmaker-pdf" + } + }, + + { + "variable": "child_address_label", + "value": { + "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_ADDRESS_OF_CHILD_BIRTH" + }, + "type": "label", + "localisation":{ + "required":true, + "prefix": null, + "module":"rainmaker-pdf" + } + }, + + { + "variable": "parent_address_label", + "value": { + "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_PERMENENT_ADDRESS_OF_PARENT" + }, + "type": "label", + "localisation":{ + "required":true, + "prefix": null, + "module":"rainmaker-pdf" + } + }, + + { + "variable": "registration_label", + "value": { + "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_REGISTRATION_NUMBER" + }, + "type": "label", + "localisation":{ + "required":true, + "prefix": null, + "module":"rainmaker-pdf" + } + }, + + { + "variable": "registration_date_label", + "value": { + "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_REGISTRATION_DATE" + }, + "type": "label", + "localisation":{ + "required":true, + "prefix": null, + "module":"rainmaker-pdf" + } + }, + + { + "variable": "remarks_label", + "value": { + "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_REMARKS" + }, + "type": "label", + "localisation":{ + "required":true, + "prefix": null, + "module":"rainmaker-pdf" + } + }, + + { + "variable": "issue_date_label", + "value": { + "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_ISSUE_DATE" + }, + "type": "label", + "localisation":{ + "required":true, + "prefix": null, + "module":"rainmaker-pdf" + } + }, + + { + "variable": "issuing_authority_label", + "value": { + "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_ISSUING_AUTHORITY_NAME" + }, + "type": "label", + "localisation":{ + "required":true, + "prefix": null, + "module":"rainmaker-pdf" + } + }, + + { + "variable": "instruction1_label", + "value": { + "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_INSTRUCTION_1" + }, + "type": "label", + "localisation":{ + "required":true, + "prefix": null, + "module":"rainmaker-pdf" + } + }, + + { + "variable": "instruction2_label", + "value": { + "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_INSTRUCTION_2" + }, + "type": "label", + "localisation":{ + "required":true, + "prefix": null, + "module":"rainmaker-pdf" + } + }, + + { + "variable": "issuing_authority", + "value": { + "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_ISSUING_AUTHORITY" + }, + "type": "label", + "localisation":{ + "required":true, + "prefix": null, + "module":"rainmaker-pdf" + } + }, + + + { + "variable": "cb_letter_label", + "value": { + "path": "PDF_STATIC_LABEL_BD_EN_CB" + }, + "type": "label", + "localisation":{ + "required":true, + "prefix": null, + "module":"rainmaker-pdf" + } + } + + ] + }, + { + "qrcodeConfig": [ + { + "variable": "qr_code_image", + "value":"{{embeddedUrl}}" + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/tutorials/Assignment-5/btr-services/birth-registration-api-spec.yaml b/tutorials/Assignment-5/btr-services/birth-registration-api-spec.yaml new file mode 100644 index 00000000000..ab4c57a07fd --- /dev/null +++ b/tutorials/Assignment-5/btr-services/birth-registration-api-spec.yaml @@ -0,0 +1,237 @@ +swagger: '2.0' +info: + version: 1.0.0 + title: Birth Registration Service. + description: | + This service provides APIs to register new births in the system. + contact: + name: eGovernments Foundation + email: contacts@egovernments.org +schemes: + - https +basePath: /birth-services +x-api-id: org.egov.birth.services +x-common-path: https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-1-1.yml +paths: + /v1/registration/_search: + post: + summary: Get the list of Birth registration applications + description: 1. Search and get birth registration applications(s) based on defined search criteria. 2. In case multiple parameters are passed voter registration applications will be searched as an AND combination of all the parameters. + parameters: + - $ref: https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-1-1.yml#/parameters/requestInfo + - $ref: https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-1-1.yml#/parameters/tenantId + - name: status + in: query + description: Search based on status. + type: string + allowEmptyValue: true + - name: ids + type: array + items: + type: integer + format: int64 + in: query + maxItems: 50 + description: unique identifier of birth registration + - name: applicationNumber + in: query + description: Unique application number for the Birth Registration Application + type: string + minLength: 2 + maxLength: 64 + responses: + '200': + description: Birth registration applications(s) Retrived Successfully + schema: + $ref: '#/definitions/BirthRegistrationRequest' + '400': + description: Invalid input + schema: + $ref: https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-1-1.yml#/definitions/ErrorRes + tags: + - Birth Registration Application + /v1/registration/_create: + post: + summary: Create new Birth Registration Application + description: | + To create new birth registration applications in the system. API supports bulk creation with max limit as defined in the Birth Registration Request. Please note that either whole batch succeeds or fails, there's no partial batch success. + + parameters: + - name: BirthRegistrationRequest + in: body + description: Details for the new Birth Registration Application(s) + RequestInfo meta data. + required: true + schema: + $ref: '#/definitions/BirthRegistrationRequest' + responses: + '201': + description: ReponseInfo with Birth Registration Application(s) created successfully + schema: + $ref: '#/definitions/BirthRegistrationResponse' + '400': + description: Birth Registration Application(s) creation failed + schema: + $ref: https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-1-1.yml#/definitions/ErrorRes + tags: + - Birth Registration Application + /v1/registration/_update: + post: + summary: update existing Birth Registration Applications. + description: | + To update existing birth registration applications in the system. API supports bulk updation with max limit as defined in the birth registration Request. Please note that either whole batch succeeds or fails, there's no partial batch success. + parameters: + - name: BirthRegistrationRequest + in: body + description: Details for the new (s) + RequestInfo meta data. + required: true + schema: + $ref: '#/definitions/BirthRegistrationRequest' + responses: + '201': + description: ReponseInfo with Birth Registration Application(s) updated sudcessfully + schema: + $ref: '#/definitions/BirthRegistrationResponse' + '400': + description: (s) updation failed + schema: + $ref: https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-1-1.yml#/definitions/ErrorRes + tags: + - Birth Registration Application +definitions: + Applicant: + description: Details of the user applying for birth registration + allOf: + - $ref: https://raw.githubusercontent.com/egovernments/egov-services/master/docs/egov-user/contracts/v1-0-0.yml#/definitions/User + BirthRegistrationApplication: + type: object + description: A Object holds the basic data for a Birth Registration Application + properties: + id: + type: string + minLength: 2 + maxLength: 64 + description: Unique Identifier of the Birth Registration Application (UUID) + readOnly: true + tenantId: + type: string + description: Unique Identifier of ULB + maxLength: 128 + minLength: 2 + applicationNumber: + type: string + description: Unique application number + maxLength: 128 + minLength: 2 + readOnly: true + babyFirstName: + type: string + description: Baby’s first name + maxLength: 128 + minLength: 2 + babyLastName: + type: string + description: Baby’s last name + maxLength: 128 + minLength: 2 + fatherOfApplicant: + type: string + description: Name of father + maxLength: 128 + minLength: 2 + motherOfApplicant: + type: string + description: Name of mother + maxLength: 128 + minLength: 2 + fatherMobileNumber: + type: string + description: Number of father + maxLength: 128 + minLength: 2 + motherMobileNumber: + type: string + description: Number of mother + maxLength: 128 + minLength: 2 + doctorName: + type: string + description: Name of doctor + maxLength: 128 + minLength: 2 + hospitalName: + type: string + description: Name of hospital + maxLength: 128 + minLength: 2 + placeOfBirth: + type: string + description: Place of birth + maxLength: 128 + minLength: 2 + timeOfBirth: + type: integer + description: Date of birth epoch + address: + $ref: https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-1-1.yml#/definitions/Address + applicant: + $ref: '#/definitions/Applicant' + auditDetails: + $ref: https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-1-1.yml#/definitions/AuditDetails + required: + - tenantId + - applicant + - babyFirstName + - babyLastName + - fatherOfApplicant + - motherOfApplicant + - fatherMobileNumber + - motherMobileNumber + - doctorName + - hospitalName + - placeOfBirth + - timeOfBirth + Workflow: + type: object + description: Fields related to workflow service + properties: + action: + type: string + description: Action on the application in certain + minLength: 1 + maxLength: 64 + status: + type: string + description: status of the application + comments: + type: string + description: Unique Identifier scrutinized number + minLength: 1 + maxLength: 64 + documents: + description: Attach the workflow verification documents. + type: array + items: + $ref: https://raw.githubusercontent.com/egovernments/municipal-services/common-contract/docs/common-contract-v2-0-0.yml#/components/schemas/Document + BirthRegistrationRequest: + description: Contract class to receive request. Array of items are used in case of create, whereas single item is used for update + properties: + RequestInfo: + $ref: https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-1-1.yml#/definitions/RequestInfo + BirthRegistrationApplications: + description: Used for search result and create only + type: array + minimum: 1 + maximum: 100 + items: + $ref: '#/definitions/BirthRegistrationApplication' + BirthRegistrationResponse: + description: Contract class to send response. Array of items are used in case of search results or response for create, whereas single item is used for update + properties: + ResponseInfo: + $ref: https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-1-1.yml#/definitions/ResponseInfo + BirthRegistrationApplications: + description: Used for search result and create only + type: array + maximum: 500 + items: + $ref: '#/definitions/BirthRegistrationApplication' diff --git a/tutorials/Assignment-5/btr-services/birth-registration-service-stage-4-postman-collection.json b/tutorials/Assignment-5/btr-services/birth-registration-service-stage-4-postman-collection.json new file mode 100644 index 00000000000..b9aa23eb0b8 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/birth-registration-service-stage-4-postman-collection.json @@ -0,0 +1,256 @@ +{ + "info": { + "_postman_id": "92f31cce-d65b-4a82-b582-0011832075f9", + "name": "DIGIT Developer Birth Registration Service Stage 4", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "21170203" + }, + "item": [ + { + "name": "Create Birth Application", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"userInfo\": {\r\n \"id\": 24226,\r\n \"uuid\": \"11b0e02b-0145-4de2-bc42-c97b96264807\",\r\n \"userName\": \"amr001\",\r\n \"name\": \"leela\",\r\n \"mobileNumber\": \"9814424443\",\r\n \"emailId\": \"leela@llgmail.com\",\r\n \"type\": \"EMPLOYEE\",\r\n \"roles\": [\r\n {\r\n \"name\": \"CSC Collection Operator\",\r\n \"code\": \"CSC_COLL_OPERATOR\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"Employee\",\r\n \"code\": \"EMPLOYEE\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"Grievance Routing Officer\",\r\n \"code\": \"GRO\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"NoC counter employee\",\r\n \"code\": \"NOC_CEMP\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"TL Counter Employee\",\r\n \"code\": \"TL_CEMP\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"TL Counter Employee\",\r\n \"code\": \"TL_CEMP\",\r\n \"tenantId\": \"pb.jalandhar\"\r\n },\r\n {\r\n \"name\": \"TL Field Inspector\",\r\n \"code\": \"TL_FIELD_INSPECTOR\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"TL Creator\",\r\n \"code\": \"TL_CREATOR\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"Customer Support Representative\",\r\n \"code\": \"CSR\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"NoC counter Approver\",\r\n \"code\": \"NOC_APPROVER\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"TL Approver\",\r\n \"code\": \"TL_APPROVER\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"Super User\",\r\n \"code\": \"SUPERUSER\",\r\n \"tenantId\": \"pb\"\r\n },\r\n {\r\n \"name\": \"BPA Services Approver\",\r\n \"code\": \"BPA_APPROVER\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"Field Employee\",\r\n \"code\": \"FEMP\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"Counter Employee\",\r\n \"code\": \"CEMP\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"NoC Field Inpector\",\r\n \"code\": \"NOC_FIELD_INSPECTOR\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"NOC Department Approver\",\r\n \"code\": \"NOC_DEPT_APPROVER\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"Super User\",\r\n \"code\": \"SUPERUSER\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"Grievance Officer\",\r\n \"code\": \"GO\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"Anonymous User\",\r\n \"code\": \"ANONYMOUS\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"Collection Operator\",\r\n \"code\": \"COLL_OPERATOR\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"NoC Doc Verifier\",\r\n \"code\": \"NOC_DOC_VERIFIER\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"TL doc verifier\",\r\n \"code\": \"TL_DOC_VERIFIER\",\r\n \"tenantId\": \"pb.amritsar\"\r\n }\r\n ],\r\n \"active\": true,\r\n \"tenantId\": \"pb.amritsar\"\r\n }\r\n },\r\n \"BirthRegistrationApplications\": [\r\n { \r\n \"tenantId\": \"{{tenantId}}\",\r\n \"timeOfBirth\": 12072001,\r\n \"babyFirstName\": \"Rahul\",\r\n \"babyLastName\": \"Singh\",\r\n \"doctorName\": \"Dr. Ram\",\r\n \"hospitalName\": \"Fortis\",\r\n \"placeOfBirth\": \"Palampur\",\r\n \"address\": {\r\n \"tenantId\": \"{{tenantId}}\",\r\n \"doorNo\": \"1010\",\r\n \"latitude\": null,\r\n \"longitude\": null,\r\n \"addressNumber\": \"34 GA\",\r\n \"type\": \"RESIDENTIAL\",\r\n \"addressLine1\": \"KP Layout\",\r\n \"addressLine2\": \"\",\r\n \"landmark\": \"Petrol pump\",\r\n \"city\": \"Amritsar\",\r\n \"pincode\": 143501,\r\n \"detail\": \"\",\r\n \"buildingName\": \"Avigna Residence\",\r\n \"street\": \"12th Main\",\r\n \"locality\": {\r\n \"code\": \"AMR001\",\r\n \"name\": \"New Amritsar Locality\"\r\n }\r\n },\r\n \"fatherOfApplicant\": {\r\n \"name\": \"Abhay\",\r\n \"userName\": \"91300114\",\r\n \"mobileNumber\": \"9230011254\",\r\n \"emailId\": \"xyz@egovernments.org\",\r\n \"altContactNumber\": \"\",\r\n \"tenantId\": \"{{tenantId}}\",\r\n \"type\" : \"CITIZEN\",\r\n \"roles\": [\r\n {\r\n \"code\": \"CITIZEN\"\r\n }\r\n ]\r\n },\r\n \"motherOfApplicant\": {\r\n \"name\": \"Amita\",\r\n \"userName\": \"92300114\",\r\n \"mobileNumber\": \"9230051254\",\r\n \"emailId\": \"xyz@egovernments.org\",\r\n \"altContactNumber\": \"\",\r\n \"tenantId\": \"{{tenantId}}\",\r\n \"type\": \"CITIZEN\",\r\n \"roles\": [\r\n {\r\n \"code\": \"CITIZEN\"\r\n }\r\n ]\r\n },\r\n \"workflow\": {\r\n \"action\": \"APPLY\",\r\n \"assignes\": [],\r\n \"comments\": \"Applying for birth registration\",\r\n \"verificationDocuments\": [\r\n {\r\n \"documentType\": \"PDF\",\r\n \"fileStoreId\": \"b0c5a846-c75a-11ea-87d0-0242ac130003\",\r\n \"documentUid\": \"\",\r\n \"additionalDetails\": {}\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:8280/birth-registration/birth-services/v1/registration/_create", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "8280", + "path": [ + "birth-registration", + "birth-services", + "v1", + "registration", + "_create" + ] + } + }, + "response": [] + }, + { + "name": "Update Birth Application", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"userInfo\": {\r\n \"id\": 24226,\r\n \"uuid\": \"{{userUuid}}\",\r\n \"userName\": \"{{username}}\",\r\n \"name\": \"{{name}}\",\r\n \"mobileNumber\": \"{{mobileNumber}}\",\r\n \"emailId\": \"{{emailId}}\",\r\n \"type\": \"EMPLOYEE\",\r\n \"roles\": [\r\n {\r\n \"name\": \"CSC Collection Operator\",\r\n \"code\": \"CSC_COLL_OPERATOR\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"Employee\",\r\n \"code\": \"EMPLOYEE\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"Grievance Routing Officer\",\r\n \"code\": \"GRO\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"NoC counter employee\",\r\n \"code\": \"NOC_CEMP\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"TL Counter Employee\",\r\n \"code\": \"TL_CEMP\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"TL Counter Employee\",\r\n \"code\": \"TL_CEMP\",\r\n \"tenantId\": \"pb.jalandhar\"\r\n },\r\n {\r\n \"name\": \"TL Field Inspector\",\r\n \"code\": \"TL_FIELD_INSPECTOR\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"TL Creator\",\r\n \"code\": \"TL_CREATOR\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"Customer Support Representative\",\r\n \"code\": \"CSR\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"NoC counter Approver\",\r\n \"code\": \"NOC_APPROVER\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"TL Approver\",\r\n \"code\": \"TL_APPROVER\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"Super User\",\r\n \"code\": \"SUPERUSER\",\r\n \"tenantId\": \"pb\"\r\n },\r\n {\r\n \"name\": \"BPA Services Approver\",\r\n \"code\": \"BPA_APPROVER\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"Field Employee\",\r\n \"code\": \"FEMP\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"Counter Employee\",\r\n \"code\": \"CEMP\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"NoC Field Inpector\",\r\n \"code\": \"NOC_FIELD_INSPECTOR\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"NOC Department Approver\",\r\n \"code\": \"NOC_DEPT_APPROVER\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"Super User\",\r\n \"code\": \"SUPERUSER\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"Grievance Officer\",\r\n \"code\": \"GO\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"Anonymous User\",\r\n \"code\": \"ANONYMOUS\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"Collection Operator\",\r\n \"code\": \"COLL_OPERATOR\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"NoC Doc Verifier\",\r\n \"code\": \"NOC_DOC_VERIFIER\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"TL doc verifier\",\r\n \"code\": \"TL_DOC_VERIFIER\",\r\n \"tenantId\": \"pb.amritsar\"\r\n }\r\n ],\r\n \"active\": true,\r\n \"tenantId\": \"{{tenantId}}\"\r\n }\r\n },\r\n \"BirthRegistrationApplications\": [\r\n {\r\n \"id\": \"d258d06c-355c-4612-9cc1-40df6666463a\",\r\n \"tenantId\": \"{{tenantId}}\",\r\n \"applicationNumber\": \"1321af1a-5a09-4c54-93e3-67301721e483\",\r\n \"babyFirstName\": \"Ravi\",\r\n \"babyLastName\": \"Singh\",\r\n \"fatherMobileNumber\": null,\r\n \"motherMobileNumber\": null,\r\n \"doctorName\": \"Dr. Ram\",\r\n \"hospitalName\": \"Fortis\",\r\n \"placeOfBirth\": \"Palampur\",\r\n \"timeOfBirth\": 12072001,\r\n \"address\": {\r\n \"id\": \"cbb884b2-f5cd-4579-a56c-842bbd75c320\",\r\n \"tenantId\": \"{{tenantId}}\",\r\n \"doorNo\": \"1010\",\r\n \"latitude\": 0.0,\r\n \"longitude\": 0.0,\r\n \"addressId\": null,\r\n \"addressNumber\": \"34 GA\",\r\n \"type\": \"RESIDENTIAL\",\r\n \"addressLine1\": \"KP Layout\",\r\n \"addressLine2\": \"\",\r\n \"landmark\": \"Petrol pump\",\r\n \"city\": \"Amritsar\",\r\n \"pincode\": \"143501\",\r\n \"detail\": \"adetail\",\r\n \"buildingName\": \"Avigna Residence\",\r\n \"street\": \"12th Main\",\r\n \"locality\": null,\r\n \"registrationId\": \"aregistrationid\"\r\n },\r\n \"fatherOfApplicant\": {\r\n \"id\": null,\r\n \"userName\": null,\r\n \"password\": null,\r\n \"salutation\": null,\r\n \"name\": null,\r\n \"gender\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"altContactNumber\": null,\r\n \"pan\": null,\r\n \"aadhaarNumber\": null,\r\n \"permanentAddress\": null,\r\n \"permanentCity\": null,\r\n \"permanentPincode\": null,\r\n \"correspondenceCity\": null,\r\n \"correspondencePincode\": null,\r\n \"correspondenceAddress\": null,\r\n \"active\": null,\r\n \"dob\": null,\r\n \"pwdExpiryDate\": null,\r\n \"locale\": null,\r\n \"type\": null,\r\n \"signature\": null,\r\n \"accountLocked\": null,\r\n \"roles\": null,\r\n \"fatherOrHusbandName\": null,\r\n \"bloodGroup\": null,\r\n \"identificationMark\": null,\r\n \"photo\": null,\r\n \"createdBy\": null,\r\n \"createdDate\": null,\r\n \"lastModifiedBy\": null,\r\n \"lastModifiedDate\": null,\r\n \"otpReference\": null,\r\n \"tenantId\": {{tenantId}}\r\n },\r\n \"motherOfApplicant\": {\r\n \"id\": null,\r\n \"userName\": null,\r\n \"password\": null,\r\n \"salutation\": null,\r\n \"name\": null,\r\n \"gender\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"altContactNumber\": null,\r\n \"pan\": null,\r\n \"aadhaarNumber\": null,\r\n \"permanentAddress\": null,\r\n \"permanentCity\": null,\r\n \"permanentPincode\": null,\r\n \"correspondenceCity\": null,\r\n \"correspondencePincode\": null,\r\n \"correspondenceAddress\": null,\r\n \"active\": null,\r\n \"dob\": null,\r\n \"pwdExpiryDate\": null,\r\n \"locale\": null,\r\n \"type\": null,\r\n \"signature\": null,\r\n \"accountLocked\": null,\r\n \"roles\": null,\r\n \"fatherOrHusbandName\": null,\r\n \"bloodGroup\": null,\r\n \"identificationMark\": null,\r\n \"photo\": null,\r\n \"createdBy\": null,\r\n \"createdDate\": null,\r\n \"lastModifiedBy\": null,\r\n \"lastModifiedDate\": null,\r\n \"otpReference\": null,\r\n \"tenantId\": {{tenantId}}\r\n },\r\n \"auditDetails\": {\r\n \"createdBy\": \"11b0e02b-0145-4de2-bc42-c97b96264807\",\r\n \"lastModifiedBy\": \"11b0e02b-0145-4de2-bc42-c97b96264807\",\r\n \"createdTime\": 1666727840790,\r\n \"lastModifiedTime\": 1666727840790\r\n },\r\n \"workflow\": null\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:8280/birth-registration/birth-services/v1/registration/_update", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "8280", + "path": [ + "birth-registration", + "birth-services", + "v1", + "registration", + "_update" + ] + } + }, + "response": [] + }, + { + "name": "Search Birth Application", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"userInfo\": {\r\n \"id\": 24226,\r\n \"uuid\": \"{{userUuid}}\",\r\n \"userName\": \"{{username}}\",\r\n \"name\": \"{{name}}\",\r\n \"mobileNumber\": \"{{mobileNumber}}\",\r\n \"emailId\": \"{{emailId}}\",\r\n \"type\": \"EMPLOYEE\",\r\n \"roles\": [\r\n {\r\n \"name\": \"CSC Collection Operator\",\r\n \"code\": \"CSC_COLL_OPERATOR\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"Employee\",\r\n \"code\": \"EMPLOYEE\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"Grievance Routing Officer\",\r\n \"code\": \"GRO\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"NoC counter employee\",\r\n \"code\": \"NOC_CEMP\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"TL Counter Employee\",\r\n \"code\": \"TL_CEMP\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"TL Counter Employee\",\r\n \"code\": \"TL_CEMP\",\r\n \"tenantId\": \"pb.jalandhar\"\r\n },\r\n {\r\n \"name\": \"TL Field Inspector\",\r\n \"code\": \"TL_FIELD_INSPECTOR\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"TL Creator\",\r\n \"code\": \"TL_CREATOR\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"Customer Support Representative\",\r\n \"code\": \"CSR\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"NoC counter Approver\",\r\n \"code\": \"NOC_APPROVER\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"TL Approver\",\r\n \"code\": \"TL_APPROVER\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"Super User\",\r\n \"code\": \"SUPERUSER\",\r\n \"tenantId\": \"pb\"\r\n },\r\n {\r\n \"name\": \"BPA Services Approver\",\r\n \"code\": \"BPA_APPROVER\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"Field Employee\",\r\n \"code\": \"FEMP\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"Counter Employee\",\r\n \"code\": \"CEMP\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"NoC Field Inpector\",\r\n \"code\": \"NOC_FIELD_INSPECTOR\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"NOC Department Approver\",\r\n \"code\": \"NOC_DEPT_APPROVER\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"Super User\",\r\n \"code\": \"SUPERUSER\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"Grievance Officer\",\r\n \"code\": \"GO\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"Anonymous User\",\r\n \"code\": \"ANONYMOUS\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"Collection Operator\",\r\n \"code\": \"COLL_OPERATOR\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"NoC Doc Verifier\",\r\n \"code\": \"NOC_DOC_VERIFIER\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"TL doc verifier\",\r\n \"code\": \"TL_DOC_VERIFIER\",\r\n \"tenantId\": \"pb.amritsar\"\r\n }\r\n ],\r\n \"active\": true,\r\n \"tenantId\": \"{{tenantId}}\"\r\n }\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:8280/birth-registration/birth-services/v1/registration/_search?tenantid=pb.amritsar&ids=0732da6f-ba21-4ddf-b47e-e74b7a9806d4&ids=qwe", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "8280", + "path": [ + "birth-registration", + "birth-services", + "v1", + "registration", + "_search" + ], + "query": [ + { + "key": "tenantid", + "value": "pb.amritsar" + }, + { + "key": "applicationnumber", + "value": "PB-BTR-2022-08-30-000307", + "disabled": true + }, + { + "key": "ids", + "value": "0732da6f-ba21-4ddf-b47e-e74b7a9806d4" + }, + { + "key": "ids", + "value": "qwe" + } + ] + } + }, + "response": [] + }, + { + "name": "IdGen", + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"RequestInfo\": {\n \"apiId\": \"asset-services\",\n \"ver\": null,\n \"ts\": null,\n \"action\": null,\n \"did\": null,\n \"key\": null,\n \"msgId\": \"search with from and to values\",\n \"authToken\": \"{{authToken}}\",\n \"userInfo\": {\n \"id\": 24226,\n \"uuid\": \"{{userUuid}}\",\n \"userName\": \"{{username}}\",\n \"name\": \"{{name}}\",\n \"mobileNumber\": \"{{mobileNumber}}\",\n \"emailId\": \"{{emailId}}\",\n \"type\": \"EMPLOYEE\",\n \"roles\": [\n {\n \"name\": \"CSC Collection Operator\",\n \"code\": \"CSC_COLL_OPERATOR\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Employee\",\n \"code\": \"EMPLOYEE\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Grievance Routing Officer\",\n \"code\": \"GRO\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"NoC counter employee\",\n \"code\": \"NOC_CEMP\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"TL Counter Employee\",\n \"code\": \"TL_CEMP\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"TL Counter Employee\",\n \"code\": \"TL_CEMP\",\n \"tenantId\": \"pb.jalandhar\"\n },\n {\n \"name\": \"TL Field Inspector\",\n \"code\": \"TL_FIELD_INSPECTOR\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"TL Creator\",\n \"code\": \"TL_CREATOR\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Customer Support Representative\",\n \"code\": \"CSR\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"NoC counter Approver\",\n \"code\": \"NOC_APPROVER\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"TL Approver\",\n \"code\": \"TL_APPROVER\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Super User\",\n \"code\": \"SUPERUSER\",\n \"tenantId\": \"pb\"\n },\n {\n \"name\": \"BPA Services Approver\",\n \"code\": \"BPA_APPROVER\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Field Employee\",\n \"code\": \"FEMP\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Counter Employee\",\n \"code\": \"CEMP\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"NoC Field Inpector\",\n \"code\": \"NOC_FIELD_INSPECTOR\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"NOC Department Approver\",\n \"code\": \"NOC_DEPT_APPROVER\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Super User\",\n \"code\": \"SUPERUSER\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Grievance Officer\",\n \"code\": \"GO\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Anonymous User\",\n \"code\": \"ANONYMOUS\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Collection Operator\",\n \"code\": \"COLL_OPERATOR\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"NoC Doc Verifier\",\n \"code\": \"NOC_DOC_VERIFIER\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"TL doc verifier\",\n \"code\": \"TL_DOC_VERIFIER\",\n \"tenantId\": \"pb.amritsar\"\n }\n ],\n \"active\": true,\n \"tenantId\": \"{{tenantId}}\"\n }\n },\n \"idRequests\": [\n {\n \"tenantId\": \"pb.amritsar\",\n \"idName\": \"btr.registrationid\"\n }\n ]\n}" + }, + "url": { + "raw": "http://localhost:8285/egov-idgen/id/_generate", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "8285", + "path": [ + "egov-idgen", + "id", + "_generate" + ] + } + }, + "response": [] + }, + { + "name": "Worklow business service create", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"userInfo\": {\r\n \"id\": 24226,\r\n \"uuid\": \"{{userUuid}}\",\r\n \"userName\": \"{{username}}\",\r\n \"name\": \"{{name}}\",\r\n \"mobileNumber\": \"{{mobileNumber}}\",\r\n \"emailId\": \"{{emailId}}\",\r\n \"type\": \"EMPLOYEE\",\r\n \"roles\": [\r\n {\r\n \"name\": \"CSC Collection Operator\",\r\n \"code\": \"CSC_COLL_OPERATOR\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"Employee\",\r\n \"code\": \"EMPLOYEE\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"Grievance Routing Officer\",\r\n \"code\": \"GRO\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"NoC counter employee\",\r\n \"code\": \"NOC_CEMP\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"TL Counter Employee\",\r\n \"code\": \"TL_CEMP\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"TL Counter Employee\",\r\n \"code\": \"TL_CEMP\",\r\n \"tenantId\": \"pb.jalandhar\"\r\n },\r\n {\r\n \"name\": \"TL Field Inspector\",\r\n \"code\": \"TL_FIELD_INSPECTOR\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"TL Creator\",\r\n \"code\": \"TL_CREATOR\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"Customer Support Representative\",\r\n \"code\": \"CSR\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"NoC counter Approver\",\r\n \"code\": \"NOC_APPROVER\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"TL Approver\",\r\n \"code\": \"TL_APPROVER\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"Super User\",\r\n \"code\": \"SUPERUSER\",\r\n \"tenantId\": \"pb\"\r\n },\r\n {\r\n \"name\": \"BPA Services Approver\",\r\n \"code\": \"BPA_APPROVER\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"Field Employee\",\r\n \"code\": \"FEMP\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"Counter Employee\",\r\n \"code\": \"CEMP\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"NoC Field Inpector\",\r\n \"code\": \"NOC_FIELD_INSPECTOR\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"NOC Department Approver\",\r\n \"code\": \"NOC_DEPT_APPROVER\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"Super User\",\r\n \"code\": \"SUPERUSER\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"Grievance Officer\",\r\n \"code\": \"GO\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"Anonymous User\",\r\n \"code\": \"ANONYMOUS\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"Collection Operator\",\r\n \"code\": \"COLL_OPERATOR\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"NoC Doc Verifier\",\r\n \"code\": \"NOC_DOC_VERIFIER\",\r\n \"tenantId\": \"pb.amritsar\"\r\n },\r\n {\r\n \"name\": \"TL doc verifier\",\r\n \"code\": \"TL_DOC_VERIFIER\",\r\n \"tenantId\": \"pb.amritsar\"\r\n }\r\n ],\r\n \"active\": true,\r\n \"tenantId\": \"{{tenantId}}\"\r\n }\r\n },\r\n \"BusinessServices\": [\r\n {\r\n \"tenantId\": \"pb\",\r\n \"businessService\": \"BTR\",\r\n \"business\": \"birth-services\",\r\n \"businessServiceSla\": 432000000,\r\n \"states\": [\r\n {\r\n \"sla\": null,\r\n \"state\": null,\r\n \"applicationStatus\": null,\r\n \"docUploadRequired\": true,\r\n \"isStartState\": true,\r\n \"isTerminateState\": false,\r\n \"isStateUpdatable\": true,\r\n \"actions\": [\r\n {\r\n \"action\": \"APPLY\",\r\n \"nextState\": \"APPLIED\",\r\n \"roles\": [\r\n \"CITIZEN\",\r\n \"EMPLOYEE\"\r\n ]\r\n }\r\n ]\r\n },\r\n {\r\n \"sla\": null,\r\n \"state\": \"APPLIED\",\r\n \"applicationStatus\": \"APPLIED\",\r\n \"docUploadRequired\": false,\r\n \"isStartState\": false,\r\n \"isTerminateState\": true,\r\n \"isStateUpdatable\": false,\r\n \"actions\": [\r\n {\r\n \"action\": \"APPROVE\",\r\n \"nextState\": \"APPROVED\",\r\n \"roles\": [\r\n \"EMPLOYEE\"\r\n ]\r\n },\r\n {\r\n \"action\": \"REJECT\",\r\n \"nextState\": \"REJECTED\",\r\n \"roles\": [\r\n \"EMPLOYEE\"\r\n ]\r\n }\r\n ]\r\n },\r\n {\r\n \"sla\": null,\r\n \"state\": \"APPROVED\",\r\n \"applicationStatus\": \"APPROVED\",\r\n \"docUploadRequired\": false,\r\n \"isStartState\": false,\r\n \"isTerminateState\": false,\r\n \"isStateUpdatable\": false,\r\n \"actions\": [\r\n {\r\n \"action\": \"PAY\",\r\n \"nextState\": \"REGISTRATIONCOMPLETED\",\r\n \"roles\": [\r\n \"SYSTEM_PAYMENT\",\r\n \"CITIZEN\",\r\n \"EMPLOYEE\"\r\n ]\r\n }\r\n ]\r\n },\r\n {\r\n \"sla\": null,\r\n \"state\": \"REJECTED\",\r\n \"applicationStatus\": \"REJECTED\",\r\n \"docUploadRequired\": false,\r\n \"isStartState\": false,\r\n \"isTerminateState\": true,\r\n \"isStateUpdatable\": false,\r\n \"actions\": null\r\n },\r\n {\r\n \"sla\": null,\r\n \"state\": \"REGISTRATIONCOMPLETED\",\r\n \"applicationStatus\": \"REGISTRATIONCOMPLETED\",\r\n \"docUploadRequired\": false,\r\n \"isStartState\": false,\r\n \"isTerminateState\": true,\r\n \"isStateUpdatable\": false,\r\n \"actions\": null\r\n }\r\n ]\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:8013/egov-workflow-v2/egov-wf/businessservice/_create", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "8013", + "path": [ + "egov-workflow-v2", + "egov-wf", + "businessservice", + "_create" + ] + } + }, + "response": [] + }, + { + "name": "Workflow business service search", + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"RequestInfo\": {\n \"apiId\": \"asset-services\",\n \"ver\": null,\n \"ts\": null,\n \"action\": null,\n \"did\": null,\n \"key\": null,\n \"msgId\": \"search with from and to values\",\n \"authToken\": \"{{authToken}}\",\n \"userInfo\": {\n \"id\": 24226,\n \"uuid\": \"{{userUuid}}\",\n \"userName\": \"{{username}}\",\n \"name\": \"{{name}}\",\n \"mobileNumber\": \"{{mobileNumber}}\",\n \"emailId\": \"{{emailId}}\",\n \"type\": \"EMPLOYEE\",\n \"roles\": [\n {\n \"name\": \"CSC Collection Operator\",\n \"code\": \"CSC_COLL_OPERATOR\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Employee\",\n \"code\": \"EMPLOYEE\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Grievance Routing Officer\",\n \"code\": \"GRO\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"NoC counter employee\",\n \"code\": \"NOC_CEMP\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"TL Counter Employee\",\n \"code\": \"TL_CEMP\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"TL Counter Employee\",\n \"code\": \"TL_CEMP\",\n \"tenantId\": \"pb.jalandhar\"\n },\n {\n \"name\": \"TL Field Inspector\",\n \"code\": \"TL_FIELD_INSPECTOR\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"TL Creator\",\n \"code\": \"TL_CREATOR\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Customer Support Representative\",\n \"code\": \"CSR\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"NoC counter Approver\",\n \"code\": \"NOC_APPROVER\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"TL Approver\",\n \"code\": \"TL_APPROVER\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Super User\",\n \"code\": \"SUPERUSER\",\n \"tenantId\": \"pb\"\n },\n {\n \"name\": \"BPA Services Approver\",\n \"code\": \"BPA_APPROVER\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Field Employee\",\n \"code\": \"FEMP\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Counter Employee\",\n \"code\": \"CEMP\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"NoC Field Inpector\",\n \"code\": \"NOC_FIELD_INSPECTOR\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"NOC Department Approver\",\n \"code\": \"NOC_DEPT_APPROVER\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Super User\",\n \"code\": \"SUPERUSER\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Grievance Officer\",\n \"code\": \"GO\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Anonymous User\",\n \"code\": \"ANONYMOUS\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Collection Operator\",\n \"code\": \"COLL_OPERATOR\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"NoC Doc Verifier\",\n \"code\": \"NOC_DOC_VERIFIER\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"TL doc verifier\",\n \"code\": \"TL_DOC_VERIFIER\",\n \"tenantId\": \"pb.amritsar\"\n }\n ],\n \"active\": true,\n \"tenantId\": \"{{tenantId}}\"\n }\n }\n}" + }, + "url": { + "raw": "http://localhost:8282/egov-workflow-v2/egov-wf/businessservice/_search?tenantId=pb.amritsar&businessServices=BTR", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "8282", + "path": [ + "egov-workflow-v2", + "egov-wf", + "businessservice", + "_search" + ], + "query": [ + { + "key": "tenantId", + "value": "pb.amritsar" + }, + { + "key": "businessServices", + "value": "BTR" + } + ] + } + }, + "response": [] + }, + { + "name": "Payment Create", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"RequestInfo\": {\n \"apiId\": \"asset-services\",\n \"ver\": null,\n \"ts\": null,\n \"action\": null,\n \"did\": null,\n \"key\": null,\n \"msgId\": \"search with from and to values\",\n \"authToken\": \"{{authToken}}\",\n \"userInfo\": {\n \"id\": 24226,\n \"uuid\": \"11b0e02b-0145-4de2-bc42-c97b96264807\",\n \"userName\": \"amr001\",\n \"name\": \"leela\",\n \"mobileNumber\": \"9814424443\",\n \"emailId\": \"leela@llgmail.com\",\n \"type\": \"EMPLOYEE\",\n \"roles\": [\n {\n \"name\": \"CSC Collection Operator\",\n \"code\": \"CSC_COLL_OPERATOR\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Employee\",\n \"code\": \"EMPLOYEE\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Grievance Routing Officer\",\n \"code\": \"GRO\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"NoC counter employee\",\n \"code\": \"NOC_CEMP\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"TL Counter Employee\",\n \"code\": \"TL_CEMP\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"TL Counter Employee\",\n \"code\": \"TL_CEMP\",\n \"tenantId\": \"pb.jalandhar\"\n },\n {\n \"name\": \"TL Field Inspector\",\n \"code\": \"TL_FIELD_INSPECTOR\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"TL Creator\",\n \"code\": \"TL_CREATOR\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Customer Support Representative\",\n \"code\": \"CSR\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"NoC counter Approver\",\n \"code\": \"NOC_APPROVER\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"TL Approver\",\n \"code\": \"TL_APPROVER\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Super User\",\n \"code\": \"SUPERUSER\",\n \"tenantId\": \"pb\"\n },\n {\n \"name\": \"BPA Services Approver\",\n \"code\": \"BPA_APPROVER\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Field Employee\",\n \"code\": \"FEMP\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Counter Employee\",\n \"code\": \"CEMP\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"NoC Field Inpector\",\n \"code\": \"NOC_FIELD_INSPECTOR\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"NOC Department Approver\",\n \"code\": \"NOC_DEPT_APPROVER\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Super User\",\n \"code\": \"SUPERUSER\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Grievance Officer\",\n \"code\": \"GO\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Anonymous User\",\n \"code\": \"ANONYMOUS\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"Collection Operator\",\n \"code\": \"COLL_OPERATOR\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"NoC Doc Verifier\",\n \"code\": \"NOC_DOC_VERIFIER\",\n \"tenantId\": \"pb.amritsar\"\n },\n {\n \"name\": \"TL doc verifier\",\n \"code\": \"TL_DOC_VERIFIER\",\n \"tenantId\": \"pb.amritsar\"\n }\n ],\n \"active\": true,\n \"tenantId\": \"pb.amritsar\"\n }\n },\n \"Payment\": {\n \"tenantId\": \"{{tenantId}}\",\n \"totalAmountPaid\": \"100\",\n \"paymentMode\": \"CASH\",\n \"paidBy\": \"11b0e02b-0145-4de2-bc42-c97b96264807\",\n \"paymentDetails\": [\n {\n \"billId\": \"bbf3ea52-f0b0-4a6f-8b2a-f4b2389339cb\",\n \"totalAmountPaid\": \"1000\"\n }\n ]\n }\n\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8015/collection-services/payments/_create", + "host": [ + "localhost" + ], + "port": "8015", + "path": [ + "collection-services", + "payments", + "_create" + ] + } + }, + "response": [] + } + ] +} \ No newline at end of file diff --git a/tutorials/Assignment-5/btr-services/btr-indexer.yml b/tutorials/Assignment-5/btr-services/btr-indexer.yml new file mode 100644 index 00000000000..b0549b8cdb5 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/btr-indexer.yml @@ -0,0 +1,47 @@ +ServiceMaps: + serviceName: Birth Registration Service + version: 1.0.0 + mappings: + - topic: save-bt-application + configKey: INDEX + indexes: + - name: btindex-v1 + type: general + id: $.id + isBulk: true + timeStampField: $.auditDetails.createdTime + jsonPath: $.BirthRegistrationApplications + customJsonMapping: + indexMapping: {"Data":{"birthapplication":{},"history":{}}} + fieldMapping: + - inJsonPath: $ + outJsonPath: $.Data.birthapplication + externalUriMapping: + - path: http://localhost:8282/egov-workflow-v2/egov-wf/process/_search + queryParam: businessIds=$.applicationNumber,history=true,tenantId=$.tenantId + apiRequest: {"RequestInfo":{"apiId":"org.egov.pt","ver":"1.0","ts":1502890899493,"action":"asd","did":"4354648646","key":"xyz","msgId":"654654","requesterId":"61","authToken":"d9994555-7656-4a67-ab3a-a952a0d4dfc8","userInfo":{"id":1,"uuid":"1fec8102-0e02-4d0a-b283-cd80d5dab067","type":"EMPLOYEE","tenantId":"pb.amritsar","roles":[{"name":"Employee","code":"EMPLOYEE","tenantId":"pb.amritsar"}]}}} + uriResponseMapping: + - inJsonPath: $.ProcessInstances + outJsonPath: $.Data.history + + - topic: update-bt-application + configKey: INDEX + indexes: + - name: btindex-v1 + type: general + id: $.id + isBulk: true + timeStampField: $.auditDetails.createdTime + jsonPath: $.BirthRegistrationApplications + customJsonMapping: + indexMapping: {"Data":{"birthapplication":{},"history":{}}} + fieldMapping: + - inJsonPath: $ + outJsonPath: $.Data.birthapplication + externalUriMapping: + - path: http://egov-workflow-v2.egov:8080/egov-workflow-v2/egov-wf/process/_search + queryParam: businessIds=$.applicationNumber,history=true,tenantId=$.tenantId + apiRequest: {"RequestInfo":{"apiId":"org.egov.pt","ver":"1.0","ts":1502890899493,"action":"asd","did":"4354648646","key":"xyz","msgId":"654654","requesterId":"61","authToken":"d9994555-7656-4a67-ab3a-a952a0d4dfc8","userInfo":{"id":1,"uuid":"1fec8102-0e02-4d0a-b283-cd80d5dab067","type":"EMPLOYEE","tenantId":"pb.amritsar","roles":[{"name":"Employee","code":"EMPLOYEE","tenantId":"pb.amritsar"}]}}} + uriResponseMapping: + - inJsonPath: $.ProcessInstances + outJsonPath: $.Data.history \ No newline at end of file diff --git a/tutorials/Assignment-5/btr-services/btr-persister.yml b/tutorials/Assignment-5/btr-services/btr-persister.yml new file mode 100644 index 00000000000..cec7620a19b --- /dev/null +++ b/tutorials/Assignment-5/btr-services/btr-persister.yml @@ -0,0 +1,104 @@ +serviceMaps: + serviceName: btr-services + mappings: + - version: 1.0 + description: Persists birth details in tables + fromTopic: save-bt-application + isTransaction: true + queryMaps: + + - query: INSERT INTO eg_bt_registration(id,tenantid,applicationnumber,babyfirstname,babylastname,fatherid,motherid,doctorname,hospitalname,placeofbirth,timeofbirth,createdby,lastmodifiedby,createdtime, lastmodifiedtime) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?,?); + basePath: BirthRegistrationApplications.* + jsonMaps: + - jsonPath: $.BirthRegistrationApplications.*.id + + - jsonPath: $.BirthRegistrationApplications.*.tenantId + + - jsonPath: $.BirthRegistrationApplications.*.applicationNumber + + - jsonPath: $.BirthRegistrationApplications.*.babyFirstName + + - jsonPath: $.BirthRegistrationApplications.*.babyLastName + + - jsonPath: $.BirthRegistrationApplications.*.fatherOfApplicant.id + + - jsonPath: $.BirthRegistrationApplications.*.motherOfApplicant.id + + - jsonPath: $.BirthRegistrationApplications.*.doctorName + + - jsonPath: $.BirthRegistrationApplications.*.hospitalName + + - jsonPath: $.BirthRegistrationApplications.*.placeOfBirth + + - jsonPath: $.BirthRegistrationApplications.*.timeOfBirth + + - jsonPath: $.BirthRegistrationApplications.*.auditDetails.createdBy + + - jsonPath: $.BirthRegistrationApplications.*.auditDetails.lastModifiedBy + + - jsonPath: $.BirthRegistrationApplications.*.auditDetails.createdTime + + - jsonPath: $.BirthRegistrationApplications.*.auditDetails.lastModifiedTime + + - query: INSERT INTO eg_bt_address(id, tenantid, doorno, latitude, longitude, buildingname, addressid, addressnumber, type, addressline1, addressline2, landmark, street, city, locality, pincode, detail, registrationid, createdby, lastmodifiedby, createdtime, lastmodifiedtime) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); + basePath: BirthRegistrationApplications.* + jsonMaps: + - jsonPath: $.BirthRegistrationApplications.*.address.id + + - jsonPath: $.BirthRegistrationApplications.*.address.tenantId + + - jsonPath: $.BirthRegistrationApplications.*.address.doorNo + + - jsonPath: $.BirthRegistrationApplications.*.address.latitude + + - jsonPath: $.BirthRegistrationApplications.*.address.longitude + + - jsonPath: $.BirthRegistrationApplications.*.address.buildingName + + - jsonPath: $.BirthRegistrationApplications.*.address.addressId + + - jsonPath: $.BirthRegistrationApplications.*.address.addressNumber + + - jsonPath: $.BirthRegistrationApplications.*.address.type + + - jsonPath: $.BirthRegistrationApplications.*.address.addressLine1 + + - jsonPath: $.BirthRegistrationApplications.*.address.addressLine2 + + - jsonPath: $.BirthRegistrationApplications.*.address.landmark + + - jsonPath: $.BirthRegistrationApplications.*.address.street + + - jsonPath: $.BirthRegistrationApplications.*.address.city + + - jsonPath: $.BirthRegistrationApplications.*.address.locality.name + + - jsonPath: $.BirthRegistrationApplications.*.address.pincode + + - jsonPath: $.BirthRegistrationApplications.*.address.detail + + - jsonPath: $.BirthRegistrationApplications.*.id + + - jsonPath: $.BirthRegistrationApplications.*.address.createdBy + + - jsonPath: $.BirthRegistrationApplications.*.address.lastModifiedBy + + - jsonPath: $.BirthRegistrationApplications.*.address.createdTime + + - jsonPath: $.BirthRegistrationApplications.*.address.lastModifiedTime + + - version: 1.0 + description: Update birth registration applications in table + fromTopic: update-bt-application + isTransaction: true + queryMaps: + - query: UPDATE eg_bt_registration SET tenantid = ?,babyFirstName = ?, timeOfBirth = ? WHERE id=?; + basePath: BirthRegistrationApplications.* + jsonMaps: + - jsonPath: $.BirthRegistrationApplications.*.tenantId + + - jsonPath: $.BirthRegistrationApplications.*.babyFirstName + + - jsonPath: $.BirthRegistrationApplications.*.timeOfBirth + + - jsonPath: $.BirthRegistrationApplications.*.id \ No newline at end of file diff --git a/tutorials/Assignment-5/btr-services/pom.xml b/tutorials/Assignment-5/btr-services/pom.xml new file mode 100644 index 00000000000..9aac623e7d1 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/pom.xml @@ -0,0 +1,113 @@ + + 4.0.0 + org.egov + birth-registration + jar + birth-registration + 1.0.0 + + 1.8 + ${java.version} + ${java.version} + + + org.springframework.boot + spring-boot-starter-parent + 1.5.9.RELEASE + + + src/main/java + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-jdbc + + + org.flywaydb + flyway-core + + + org.postgresql + postgresql + 42.2.2.jre7 + + + org.springframework.boot + spring-boot-starter-test + test + + + + io.swagger + swagger-core + 1.5.18 + + + + org.egov.services + tracer + 2.0.0-SNAPSHOT + + + org.egov.services + services-common + 1.0.1-SNAPSHOT + + + org.egov + mdms-client + 0.0.2-SNAPSHOT + compile + + + org.projectlombok + lombok + true + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + + + + javax.validation + validation-api + + + + + + repo.egovernments.org + eGov ERP Releases Repository + https://nexus-repo.egovernments.org/nexus/content/repositories/releases/ + + + repo.egovernments.org.snapshots + eGov ERP Releases Repository + https://nexus-repo.egovernments.org/nexus/content/repositories/snapshots/ + + + repo.egovernments.org.public + eGov Public Repository Group + https://nexus-repo.egovernments.org/nexus/content/groups/public/ + + + diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/Main.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/Main.java new file mode 100644 index 00000000000..48f4e7a1bd5 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/Main.java @@ -0,0 +1,19 @@ +package digit; + + +import org.egov.tracer.config.TracerConfiguration; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Import; + +@Import({TracerConfiguration.class}) +@SpringBootApplication +@ComponentScan(basePackages = {"digit", "digit.web.controllers", "digit.config"}) +public class Main { + + public static void main(String[] args) throws Exception { + SpringApplication.run(Main.class, args); + } + +} diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/config/BTRConfiguration.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/config/BTRConfiguration.java new file mode 100644 index 00000000000..e18d1d4b6f8 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/config/BTRConfiguration.java @@ -0,0 +1,112 @@ +package digit.config; + +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.*; +import org.egov.tracer.config.TracerConfiguration; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Import; +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +import org.springframework.stereotype.Component; + +import javax.annotation.PostConstruct; +import java.util.TimeZone; + +@Component +@Data +@Import({TracerConfiguration.class}) +@NoArgsConstructor +@AllArgsConstructor +@Setter +@Getter +public class BTRConfiguration { + + @Value("${app.timezone}") + private String timeZone; + + // BTR Variables + + @Value("${btr.kafka.create.topic}") + private String createTopic; + + @Value("${btr.kafka.update.topic}") + private String updateTopic; + + @Value("${btr.default.offset}") + private Integer defaultOffset; + + @Value("${btr.default.limit}") + private Integer defaultLimit; + + @Value("${btr.search.max.limit}") + private Integer maxLimit; + + // User Config + @Value("${egov.user.host}") + private String userHost; + + @Value("${egov.user.context.path}") + private String userContextPath; + + @Value("${egov.user.create.path}") + private String userCreateEndpoint; + + @Value("${egov.user.search.path}") + private String userSearchEndpoint; + + @Value("${egov.user.update.path}") + private String userUpdateEndpoint; + + //Idgen Config + @Value("${egov.idgen.host}") + private String idGenHost; + + @Value("${egov.idgen.path}") + private String idGenPath; + + //Workflow Config + @Value("${egov.workflow.host}") + private String wfHost; + + @Value("${egov.workflow.transition.path}") + private String wfTransitionPath; + + @Value("${egov.workflow.businessservice.search.path}") + private String wfBusinessServiceSearchPath; + + @Value("${egov.workflow.processinstance.search.path}") + private String wfProcessInstanceSearchPath; + + @Value("${is.workflow.enabled}") + private Boolean isWorkflowEnabled; + + //MDMS + @Value("${egov.mdms.host}") + private String mdmsHost; + + @Value("${egov.mdms.search.endpoint}") + private String mdmsEndPoint; + +// //HRMS +// @Value("${egov.hrms.host}") +// private String hrmsHost; +// +// @Value("${egov.hrms.search.endpoint}") +// private String hrmsEndPoint; + + @Value("${egov.url.shortner.host}") + private String urlShortnerHost; + + @Value("${egov.url.shortner.endpoint}") + private String urlShortnerEndpoint; + + @Value("${egov.btrcalculator.host}") + private String btrCalculatorHost; + + @Value("${egov.btrcalculator.endpoint}") + private String btrCalculatorCalculateEndpoint; + + @Value("${egov.sms.notification.topic}") + private String smsNotificationTopic; +} diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/config/MainConfiguration.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/config/MainConfiguration.java new file mode 100644 index 00000000000..0a59c792c3b --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/config/MainConfiguration.java @@ -0,0 +1,39 @@ +package digit.config; + +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.egov.tracer.config.TracerConfiguration; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Import; +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; + +import javax.annotation.PostConstruct; +import java.util.TimeZone; + + +@Import({TracerConfiguration.class}) +public class MainConfiguration { + + @Value("${app.timezone}") + private String timeZone; + + @PostConstruct + public void initialize() { + TimeZone.setDefault(TimeZone.getTimeZone(timeZone)); + } + + @Bean + public ObjectMapper objectMapper() { + return new ObjectMapper().disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES).setTimeZone(TimeZone.getTimeZone(timeZone)); + } + + @Bean + @Autowired + public MappingJackson2HttpMessageConverter jacksonConverter(ObjectMapper objectMapper) { + MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); + converter.setObjectMapper(objectMapper); + return converter; + } +} \ No newline at end of file diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/consumer/NotificationConsumer.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/consumer/NotificationConsumer.java new file mode 100644 index 00000000000..cd93d21c87d --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/consumer/NotificationConsumer.java @@ -0,0 +1,40 @@ +package digit.consumer; + +import com.fasterxml.jackson.databind.ObjectMapper; +import digit.service.NotificationService; +import digit.web.models.BirthRegistrationRequest; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.kafka.annotation.KafkaListener; +import org.springframework.kafka.support.KafkaHeaders; +import org.springframework.messaging.handler.annotation.Header; +import org.springframework.stereotype.Component; + +import java.util.HashMap; + +@Component +@Slf4j +public class NotificationConsumer { + + @Autowired + private ObjectMapper mapper; + + @Autowired + private NotificationService notificationService; + + @KafkaListener(topics = {"${btr.kafka.create.topic}"}) + public void listen(final HashMap record, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) { + + try { + + BirthRegistrationRequest request = mapper.convertValue(record, BirthRegistrationRequest.class); + //log.info(request.toString()); + notificationService.prepareEventAndSend(request); + + } catch (final Exception e) { + + log.error("Error while listening to value: " + record + " on topic: " + topic + ": ", e); + } + } + +} diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/consumer/PaymentBackUpdateConsumer.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/consumer/PaymentBackUpdateConsumer.java new file mode 100644 index 00000000000..8d08d6711b7 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/consumer/PaymentBackUpdateConsumer.java @@ -0,0 +1,22 @@ +package digit.consumer; + +import digit.service.PaymentUpdateService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.kafka.annotation.KafkaListener; +import org.springframework.kafka.support.KafkaHeaders; +import org.springframework.messaging.handler.annotation.Header; +import org.springframework.stereotype.Component; + +import java.util.HashMap; + +@Component +public class PaymentBackUpdateConsumer { + + @Autowired + private PaymentUpdateService paymentUpdateService; + + @KafkaListener(topics = {"${kafka.topics.receipt.create}"}) + public void listenPayments(final HashMap record, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) { + paymentUpdateService.process(record); + } +} diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/enrichment/BirthApplicationEnrichment.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/enrichment/BirthApplicationEnrichment.java new file mode 100644 index 00000000000..f00c25159e2 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/enrichment/BirthApplicationEnrichment.java @@ -0,0 +1,95 @@ +package digit.enrichment; + +import digit.service.UserService; +import digit.util.IdgenUtil; +import digit.util.UserUtil; +import digit.web.models.*; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.UUID; + +@Slf4j +@Component +public class BirthApplicationEnrichment { + + @Autowired + private IdgenUtil idgenUtil; + @Autowired + private UserService userService; + @Autowired + private UserUtil userUtils; + + public void enrichBirthApplication(BirthRegistrationRequest birthRegistrationRequest) { + List birthRegistrationIdList = idgenUtil.getIdList(birthRegistrationRequest.getRequestInfo(), birthRegistrationRequest.getBirthRegistrationApplications().get(0).getTenantId(), "btr.registrationid", "", birthRegistrationRequest.getBirthRegistrationApplications().size()); + Integer index = 0; + for(BirthRegistrationApplication application : birthRegistrationRequest.getBirthRegistrationApplications()) { + // Enrich audit details + AuditDetails auditDetails = AuditDetails.builder().createdBy(birthRegistrationRequest.getRequestInfo().getUserInfo().getUuid()).createdTime(System.currentTimeMillis()).lastModifiedBy(birthRegistrationRequest.getRequestInfo().getUserInfo().getUuid()).lastModifiedTime(System.currentTimeMillis()).build(); + application.setAuditDetails(auditDetails); + + // Enrich UUID + application.setId(UUID.randomUUID().toString()); + + // Set application number from IdGen + application.setApplicationNumber(birthRegistrationIdList.get(index++)); + + // Enrich registration Id + application.getAddress().setRegistrationId(application.getId()); + + // Enrich address UUID + application.getAddress().setId(UUID.randomUUID().toString()); + } + } + + public void enrichBirthApplicationUponUpdate(BirthRegistrationRequest birthRegistrationRequest) { + // Enrich lastModifiedTime and lastModifiedBy in case of update + for(BirthRegistrationApplication application : birthRegistrationRequest.getBirthRegistrationApplications()) { + application.getAuditDetails().setLastModifiedTime(System.currentTimeMillis()); + application.getAuditDetails().setLastModifiedBy(birthRegistrationRequest.getRequestInfo().getUserInfo().getUuid()); + } + } + + public void enrichFatherApplicantOnSearch(BirthRegistrationApplication application) { + UserDetailResponse fatherUserResponse = userService.searchUser(userUtils.getStateLevelTenant(application.getTenantId()),application.getFather().getId(),null); + User fatherUser = fatherUserResponse.getUser().get(0); + log.info(fatherUser.toString()); + FatherApplicant fatherApplicant = FatherApplicant.builder().aadhaarNumber(fatherUser.getAadhaarNumber()) + .accountLocked(fatherUser.getAccountLocked()) + .active(fatherUser.getActive()) + .altContactNumber(fatherUser.getAltContactNumber()) + .bloodGroup(fatherUser.getBloodGroup()) + .correspondenceAddress(fatherUser.getCorrespondenceAddress()) + .correspondenceCity(fatherUser.getCorrespondenceCity()) + .correspondencePincode(fatherUser.getCorrespondencePincode()) + .gender(fatherUser.getGender()) + .id(fatherUser.getUuid()) + .name(fatherUser.getName()) + .type(fatherUser.getType()) + .roles(fatherUser.getRoles()).build(); + application.setFather(fatherApplicant); + } + + public void enrichMotherApplicantOnSearch(BirthRegistrationApplication application) { + UserDetailResponse motherUserResponse = userService.searchUser(userUtils.getStateLevelTenant(application.getTenantId()),application.getMother().getId(),null); + User motherUser = motherUserResponse.getUser().get(0); + log.info(motherUser.toString()); + MotherApplicant motherApplicant = MotherApplicant.builder().aadhaarNumber(motherUser.getAadhaarNumber()) + .accountLocked(motherUser.getAccountLocked()) + .active(motherUser.getActive()) + .altContactNumber(motherUser.getAltContactNumber()) + .bloodGroup(motherUser.getBloodGroup()) + .correspondenceAddress(motherUser.getCorrespondenceAddress()) + .correspondenceCity(motherUser.getCorrespondenceCity()) + .correspondencePincode(motherUser.getCorrespondencePincode()) + .gender(motherUser.getGender()) + .id(motherUser.getUuid()) + .name(motherUser.getName()) + .type(motherUser.getType()) + .roles(motherUser.getRoles()).build(); + application.setMother(motherApplicant); + } + +} diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/producer/Producer.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/producer/Producer.java new file mode 100644 index 00000000000..e0ae8f7232a --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/producer/Producer.java @@ -0,0 +1,18 @@ +package digit.producer; + +import lombok.extern.slf4j.Slf4j; +import org.egov.tracer.kafka.CustomKafkaTemplate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +@Slf4j +public class Producer { + + @Autowired + private CustomKafkaTemplate kafkaTemplate; + + public void push(String topic, Object value) { + kafkaTemplate.send(topic, value); + } +} diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/repository/BirthRegistrationRepository.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/repository/BirthRegistrationRepository.java new file mode 100644 index 00000000000..d9bc21cc2b3 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/repository/BirthRegistrationRepository.java @@ -0,0 +1,35 @@ +package digit.repository; + +import digit.repository.querybuilder.BirthApplicationQueryBuilder; +import digit.repository.rowmapper.BirthApplicationRowMapper; +import digit.web.models.BirthApplicationSearchCriteria; +import digit.web.models.BirthRegistrationApplication; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.stereotype.Repository; + +import java.util.ArrayList; +import java.util.List; + + +@Slf4j +@Repository +public class BirthRegistrationRepository { + + @Autowired + private BirthApplicationQueryBuilder queryBuilder; + + @Autowired + private JdbcTemplate jdbcTemplate; + + @Autowired + private BirthApplicationRowMapper rowMapper; + + public ListgetApplications(BirthApplicationSearchCriteria searchCriteria){ + List preparedStmtList = new ArrayList<>(); + String query = queryBuilder.getBirthApplicationSearchQuery(searchCriteria, preparedStmtList); + log.info("Final query: " + query); + return jdbcTemplate.query(query, preparedStmtList.toArray(), rowMapper); + } +} \ No newline at end of file diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/repository/ServiceRequestRepository.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/repository/ServiceRequestRepository.java new file mode 100644 index 00000000000..284ee77bfc2 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/repository/ServiceRequestRepository.java @@ -0,0 +1,44 @@ +package digit.repository; + + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import lombok.extern.slf4j.Slf4j; +import org.egov.tracer.model.ServiceCallException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Repository; +import org.springframework.web.client.HttpClientErrorException; +import org.springframework.web.client.RestTemplate; + +import java.util.Map; + +@Repository +@Slf4j +public class ServiceRequestRepository { + + private ObjectMapper mapper; + + private RestTemplate restTemplate; + + @Autowired + public ServiceRequestRepository(ObjectMapper mapper, RestTemplate restTemplate) { + this.mapper = mapper; + this.restTemplate = restTemplate; + } + + + public Object fetchResult(StringBuilder uri, Object request) { + mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); + Object response = null; + try { + response = restTemplate.postForObject(uri.toString(), request, Map.class); + } catch (HttpClientErrorException e) { + log.error("External Service threw an Exception: ", e); + throw new ServiceCallException(e.getResponseBodyAsString()); + } catch (Exception e) { + log.error("Exception while fetching from searcher: ", e); + } + + return response; + } +} \ No newline at end of file diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/repository/querybuilder/BirthApplicationQueryBuilder.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/repository/querybuilder/BirthApplicationQueryBuilder.java new file mode 100644 index 00000000000..42fe935579e --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/repository/querybuilder/BirthApplicationQueryBuilder.java @@ -0,0 +1,77 @@ +package digit.repository.querybuilder; + +import digit.web.models.BirthApplicationSearchCriteria; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; +import org.springframework.util.ObjectUtils; + +import java.util.List; + +@Component +public class BirthApplicationQueryBuilder { + + private static final String BASE_BTR_QUERY = " SELECT btr.id as bid, btr.tenantid as btenantid, btr.applicationnumber as bapplicationnumber, btr.babyfirstname as bbabyfirstname, btr.babylastname as bbabylastname, btr.fatherid as bfatherid, btr.motherid as bmotherid, btr.doctorname as bdoctorname, btr.hospitalname as bhospitalname, btr.placeofbirth as bplaceofbirth, btr.timeofbirth as btimeofbirth, btr.createdby as bcreatedby, btr.lastmodifiedby as blastmodifiedby, btr.createdtime as bcreatedtime, btr.lastmodifiedtime as blastmodifiedtime, "; + + private static final String ADDRESS_SELECT_QUERY = " add.id as aid, add.tenantid as atenantid, add.doorno as adoorno, add.latitude as alatitude, add.longitude as alongitude, add.buildingname as abuildingname, add.addressid as aaddressid, add.addressnumber as aaddressnumber, add.type as atype, add.addressline1 as aaddressline1, add.addressline2 as aaddressline2, add.landmark as alandmark, add.street as astreet, add.city as acity, add.locality as alocality, add.pincode as apincode, add.detail as adetail, add.registrationid as aregistrationid "; + + private static final String FROM_TABLES = " FROM eg_bt_registration btr LEFT JOIN eg_bt_address add ON btr.id = add.registrationid "; + + private final String ORDERBY_CREATEDTIME = " ORDER BY btr.createdtime DESC "; + + public String getBirthApplicationSearchQuery(BirthApplicationSearchCriteria criteria, List preparedStmtList){ + StringBuilder query = new StringBuilder(BASE_BTR_QUERY); + query.append(ADDRESS_SELECT_QUERY); + query.append(FROM_TABLES); + + if(!ObjectUtils.isEmpty(criteria.getTenantId())){ + addClauseIfRequired(query, preparedStmtList); + query.append(" btr.tenantid = ? "); + preparedStmtList.add(criteria.getTenantId()); + } + if(!ObjectUtils.isEmpty(criteria.getStatus())){ + addClauseIfRequired(query, preparedStmtList); + query.append(" btr.status = ? "); + preparedStmtList.add(criteria.getStatus()); + } + if(!CollectionUtils.isEmpty(criteria.getIds())){ + addClauseIfRequired(query, preparedStmtList); + query.append(" btr.id IN ( ").append(createQuery(criteria.getIds())).append(" ) "); + addToPreparedStatement(preparedStmtList, criteria.getIds()); + } + if(!ObjectUtils.isEmpty(criteria.getApplicationNumber())){ + addClauseIfRequired(query, preparedStmtList); + query.append(" btr.applicationnumber = ? "); + preparedStmtList.add(criteria.getApplicationNumber()); + } + + // order birth registration applications based on their createdtime in latest first manner + query.append(ORDERBY_CREATEDTIME); + + return query.toString(); + } + + private void addClauseIfRequired(StringBuilder query, List preparedStmtList){ + if(preparedStmtList.isEmpty()){ + query.append(" WHERE "); + }else{ + query.append(" AND "); + } + } + + private String createQuery(List ids) { + StringBuilder builder = new StringBuilder(); + int length = ids.size(); + for (int i = 0; i < length; i++) { + builder.append(" ?"); + if (i != length - 1) + builder.append(","); + } + return builder.toString(); + } + + private void addToPreparedStatement(List preparedStmtList, List ids) { + ids.forEach(id -> { + preparedStmtList.add(id); + }); + } +} diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/repository/rowmapper/BirthApplicationRowMapper.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/repository/rowmapper/BirthApplicationRowMapper.java new file mode 100644 index 00000000000..e1b472dc86e --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/repository/rowmapper/BirthApplicationRowMapper.java @@ -0,0 +1,93 @@ +package digit.repository.rowmapper; + +import digit.web.models.*; +import org.springframework.dao.DataAccessException; +import org.springframework.jdbc.core.ResultSetExtractor; +import org.springframework.stereotype.Component; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +@Component +public class BirthApplicationRowMapper implements ResultSetExtractor> { + public List extractData(ResultSet rs) throws SQLException, DataAccessException { + Map birthRegistrationApplicationMap = new LinkedHashMap<>(); + + while (rs.next()){ + String uuid = rs.getString("bapplicationnumber"); + BirthRegistrationApplication birthRegistrationApplication = birthRegistrationApplicationMap.get(uuid); + + if(birthRegistrationApplication == null) { + + Long lastModifiedTime = rs.getLong("blastModifiedTime"); + if (rs.wasNull()) { + lastModifiedTime = null; + } + + + FatherApplicant father = FatherApplicant.builder().id(rs.getString("bfatherid")).build(); + MotherApplicant mother = MotherApplicant.builder().id(rs.getString("bmotherid")).build(); + + AuditDetails auditdetails = AuditDetails.builder() + .createdBy(rs.getString("createdBy")) + .createdTime(rs.getLong("createdTime")) + .lastModifiedBy(rs.getString("lastModifiedBy")) + .lastModifiedTime(lastModifiedTime) + .build(); + + birthRegistrationApplication = BirthRegistrationApplication.builder() + .applicationNumber(rs.getString("bapplicationnumber")) + .tenantId(rs.getString("tenantid")) + .id(rs.getString("bid")) + .babyFirstName(rs.getString("bbabyfirstname")) + .babyLastName(rs.getString("bbabylastname")) + .father(father) + .mother(mother) + .doctorName(rs.getString("bdoctorname")) + .hospitalName(rs.getString("bhospitalname")) + .placeOfBirth(rs.getString("bplaceofbirth")) + .timeOfBirth(rs.getInt("btimeofbirth")) + .auditDetails(auditdetails) + .build(); + } + addChildrenToProperty(rs, birthRegistrationApplication); + birthRegistrationApplicationMap.put(uuid, birthRegistrationApplication); + } + return new ArrayList<>(birthRegistrationApplicationMap.values()); + } + + private void addChildrenToProperty(ResultSet rs, BirthRegistrationApplication birthRegistrationApplication) + throws SQLException { + addAddressToApplication(rs, birthRegistrationApplication); + } + + private void addAddressToApplication(ResultSet rs, BirthRegistrationApplication birthRegistrationApplication) throws SQLException { + Address address = Address.builder() + .id(rs.getString("aid")) + .tenantId(rs.getString("atenantid")) + .doorNo(rs.getString("adoorno")) + .latitude(rs.getDouble("alatitude")) + .longitude(rs.getDouble("alongitude")) + .buildingName(rs.getString("abuildingname")) + .addressId(rs.getString("aaddressid")) + .addressNumber(rs.getString("aaddressnumber")) + .type(rs.getString("atype")) + .addressLine1(rs.getString("aaddressline1")) + .addressLine2(rs.getString("aaddressline2")) + .landmark(rs.getString("alandmark")) + .street(rs.getString("astreet")) + .city(rs.getString("acity")) + .pincode(rs.getString("apincode")) + .detail("adetail") + .registrationId("aregistrationid") + .build(); + + birthRegistrationApplication.setAddress(address); + + } + +} diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/service/BirthRegistrationService.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/service/BirthRegistrationService.java new file mode 100644 index 00000000000..78e0ab59c06 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/service/BirthRegistrationService.java @@ -0,0 +1,94 @@ +package digit.service; + +import digit.config.BTRConfiguration; +import digit.enrichment.BirthApplicationEnrichment; +import digit.producer.Producer; +import digit.repository.BirthRegistrationRepository; +import digit.validator.BirthApplicationValidator; +import digit.web.models.BirthApplicationSearchCriteria; +import digit.web.models.BirthRegistrationApplication; +import digit.web.models.BirthRegistrationRequest; +import digit.web.models.Workflow; +import org.egov.common.contract.request.RequestInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.List; + +@Service +public class BirthRegistrationService { + + @Autowired + private BirthApplicationValidator birthApplicationValidator; + @Autowired + private BirthApplicationEnrichment birthApplicationEnrichment; + @Autowired + private Producer producer; + @Autowired + private BTRConfiguration configuration; + @Autowired + private BirthRegistrationRepository birthRegistrationRepository; + @Autowired + private UserService userService; + @Autowired + private WorkflowService workflowService; + @Autowired + private CalculationService calculationService; + + public List registerBtRequest(BirthRegistrationRequest birthRegistrationRequest) { + birthApplicationValidator.validateBirthApplication(birthRegistrationRequest); + birthApplicationEnrichment.enrichBirthApplication(birthRegistrationRequest); + + // Enrich/Upsert user in upon birth registration + userService.callUserService(birthRegistrationRequest); + + // Initiate workflow for the new application + workflowService.updateWorkflowStatus(birthRegistrationRequest); + + //Call calculator to calculate and create demand + calculationService.getCalculation(birthRegistrationRequest); + + // Push the application to the topic for persister to listen and persist + producer.push(configuration.getCreateTopic(), birthRegistrationRequest); + + // Return the response back to user + return birthRegistrationRequest.getBirthRegistrationApplications(); + } + + public List searchBtApplications(RequestInfo requestInfo, BirthApplicationSearchCriteria birthApplicationSearchCriteria) { + // Fetch applications from database according to the given search criteria + List applications = birthRegistrationRepository.getApplications(birthApplicationSearchCriteria); + + // If no applications are found matching the given criteria, return an empty list + if(CollectionUtils.isEmpty(applications)) + return new ArrayList<>(); + + // Enrich mother and father of applicant objects + applications.forEach(application -> { + birthApplicationEnrichment.enrichFatherApplicantOnSearch(application); + birthApplicationEnrichment.enrichMotherApplicantOnSearch(application); + }); + + applications.forEach(application -> { + application.setWorkflow(Workflow.builder().status(workflowService.getCurrentWorkflow(requestInfo, application.getTenantId(), application.getApplicationNumber()).getState().getState()).build()); + }); + + // Otherwise, return the found applications + return applications; + } + + public List updateBtApplication(BirthRegistrationRequest birthRegistrationRequest) { + // Validate whether the application that is being requested for update indeed exists + List existingApplication = birthApplicationValidator.validateApplicationUpdateRequest(birthRegistrationRequest); + // Enrich application upon update + birthApplicationEnrichment.enrichBirthApplicationUponUpdate(birthRegistrationRequest); + workflowService.updateWorkflowStatus(birthRegistrationRequest); + // Just like create request, update request will be handled asynchronously by the persister + producer.push(configuration.getUpdateTopic(), birthRegistrationRequest); + + return birthRegistrationRequest.getBirthRegistrationApplications(); + } + +} diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/service/CalculationService.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/service/CalculationService.java new file mode 100644 index 00000000000..b198aeb57cd --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/service/CalculationService.java @@ -0,0 +1,50 @@ +package digit.service; + +import com.fasterxml.jackson.databind.ObjectMapper; +import digit.config.BTRConfiguration; +import digit.repository.ServiceRequestRepository; +import digit.web.models.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +@Service +public class CalculationService { + + @Autowired + private BTRConfiguration btrConfiguration; + + @Autowired + private ObjectMapper mapper; + + @Autowired + private ServiceRequestRepository serviceRequestRepository; + + public CalculationRes getCalculation(BirthRegistrationRequest request){ + + List calculationCriteriaList = new ArrayList<>(); + for(BirthRegistrationApplication application : request.getBirthRegistrationApplications()) { + CalculationCriteria calculationCriteria = CalculationCriteria.builder() + .birthregistrationapplication(application) + .tenantId(application.getTenantId()) + .applicationNumber(application.getApplicationNumber()) + .build(); + calculationCriteriaList.add(calculationCriteria); + } + + CalculationReq calculationReq = CalculationReq.builder() + .requestInfo(request.getRequestInfo()) + .calculationCriteria(calculationCriteriaList) + .build(); + + StringBuilder url = new StringBuilder().append(btrConfiguration.getBtrCalculatorHost()) + .append(btrConfiguration.getBtrCalculatorCalculateEndpoint()); + + Object response = serviceRequestRepository.fetchResult(url, calculationReq); + CalculationRes calculationRes = mapper.convertValue(response, CalculationRes.class); + + return calculationRes; + } +} diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/service/NotificationService.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/service/NotificationService.java new file mode 100644 index 00000000000..30be125cf83 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/service/NotificationService.java @@ -0,0 +1,52 @@ +package digit.service; + +import digit.config.BTRConfiguration; +import digit.producer.Producer; +import digit.web.models.BirthRegistrationApplication; +import digit.web.models.BirthRegistrationRequest; +import digit.web.models.SMSRequest; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.web.client.RestTemplate; + +import java.util.ArrayList; +import java.util.List; + +@Slf4j +@Service +public class NotificationService { + + @Autowired + private Producer producer; + + @Autowired + private BTRConfiguration config; + + @Autowired + private RestTemplate restTemplate; + + private static final String smsTemplate = "Dear {FATHER_NAME} and {MOTHER_NAME} your birth registration application has been successfully created on the system with application number - {APPNUMBER}."; + + public void prepareEventAndSend(BirthRegistrationRequest request){ + List smsRequestList = new ArrayList<>(); + request.getBirthRegistrationApplications().forEach(application -> { + SMSRequest smsRequestForFather = SMSRequest.builder().mobileNumber(application.getFatherMobileNumber()).message(getCustomMessage(smsTemplate, application)).build(); + SMSRequest smsRequestForMother = SMSRequest.builder().mobileNumber(application.getMotherMobileNumber()).message(getCustomMessage(smsTemplate, application)).build(); + smsRequestList.add(smsRequestForFather); + smsRequestList.add(smsRequestForMother); + }); + for (SMSRequest smsRequest : smsRequestList) { + producer.push(config.getSmsNotificationTopic(), smsRequest); + log.info("Messages: " + smsRequest.getMessage()); + } + } + + private String getCustomMessage(String template, BirthRegistrationApplication application) { + template = template.replace("{APPNUMBER}", application.getApplicationNumber()); + template = template.replace("{FATHER_NAME}", application.getFather().getName()); + template = template.replace("{MOTHER_NAME}", application.getMother().getName()); + return template; + } + +} \ No newline at end of file diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/service/PaymentUpdateService.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/service/PaymentUpdateService.java new file mode 100644 index 00000000000..ba6db196f42 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/service/PaymentUpdateService.java @@ -0,0 +1,80 @@ +package digit.service; + +import com.fasterxml.jackson.databind.ObjectMapper; +import digit.repository.BirthRegistrationRepository; +import digit.web.models.*; +import lombok.extern.slf4j.Slf4j; +import org.egov.common.contract.request.RequestInfo; +import org.egov.common.contract.request.Role; +import org.egov.tracer.model.CustomException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.Collections; +import java.util.HashMap; +import java.util.List; + +@Slf4j +@Service +public class PaymentUpdateService { + + @Autowired + private WorkflowService workflowService; + + @Autowired + private ObjectMapper mapper; + + @Autowired + private BirthRegistrationRepository repository; + + public void process(HashMap record) { + + try { + + PaymentRequest paymentRequest = mapper.convertValue(record, PaymentRequest.class); + RequestInfo requestInfo = paymentRequest.getRequestInfo(); + + List paymentDetails = paymentRequest.getPayment().getPaymentDetails(); + String tenantId = paymentRequest.getPayment().getTenantId(); + + for (PaymentDetail paymentDetail : paymentDetails) { + updateWorkflowForBirthRegistrationPayment(requestInfo, tenantId, paymentDetail); + } + } catch (Exception e) { + log.error("KAFKA_PROCESS_ERROR:", e); + } + + } + + private void updateWorkflowForBirthRegistrationPayment(RequestInfo requestInfo, String tenantId, PaymentDetail paymentDetail) { + + Bill bill = paymentDetail.getBill(); + + BirthApplicationSearchCriteria criteria = BirthApplicationSearchCriteria.builder() + .applicationNumber(bill.getConsumerCode()) + .tenantId(tenantId) + .build(); + + List birthRegistrationApplicationList = repository.getApplications(criteria); + + if (CollectionUtils.isEmpty(birthRegistrationApplicationList)) + throw new CustomException("INVALID RECEIPT", + "No applications found for the consumerCode " + criteria.getApplicationNumber()); + + Role role = Role.builder().code("SYSTEM_PAYMENT").tenantId(tenantId).build(); + requestInfo.getUserInfo().getRoles().add(role); + + birthRegistrationApplicationList.forEach( application -> { + + BirthRegistrationRequest updateRequest = BirthRegistrationRequest.builder().requestInfo(requestInfo) + .birthRegistrationApplications(Collections.singletonList(application)).build(); + + ProcessInstanceRequest wfRequest = workflowService.getProcessInstanceForBirthRegistrationPayment(updateRequest); + + State state = workflowService.callWorkFlow(wfRequest); + + }); + } + +} diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/service/UserService.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/service/UserService.java new file mode 100644 index 00000000000..0ee08b3c454 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/service/UserService.java @@ -0,0 +1,232 @@ +package digit.service; + +import digit.config.BTRConfiguration; +import digit.util.UserUtil; +import digit.web.models.*; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang.StringUtils; +import org.egov.common.contract.request.RequestInfo; +import org.egov.tracer.model.CustomException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; + + +@Service +@Slf4j +public class UserService { + private UserUtil userUtils; + + private BTRConfiguration config; + + @Autowired + public UserService(UserUtil userUtils, BTRConfiguration config) { + this.userUtils = userUtils; + this.config = config; + } + + /** + * Calls user service to enrich user from search or upsert user + * @param request + */ + public void callUserService(BirthRegistrationRequest request){ + request.getBirthRegistrationApplications().forEach(application -> { + if(!StringUtils.isEmpty(application.getFather().getId())) + enrichUser(application, request.getRequestInfo()); + else { + User user = createFatherUser(application); + application.getFather().setId(upsertUser(user, request.getRequestInfo())); + } + }); + + request.getBirthRegistrationApplications().forEach(application -> { + if(!StringUtils.isEmpty(application.getMother().getId())) + enrichUser(application, request.getRequestInfo()); + else { + User user = createMotherUser(application); + application.getMother().setId(upsertUser(user, request.getRequestInfo())); + } + }); + } + + private User createFatherUser(BirthRegistrationApplication application){ + FatherApplicant father = application.getFather(); + User user = User.builder().userName(father.getUserName()) + .name(father.getName()) + .mobileNumber(father.getMobileNumber()) + .emailId(father.getEmailId()) + .altContactNumber(father.getAltContactNumber()) + .tenantId(father.getTenantId()) + .type(father.getType()) + .roles(father.getRoles()) + .build(); +// String tenantId = father.getTenantId(); + return user; + } + + private User createMotherUser(BirthRegistrationApplication application){ + MotherApplicant mother = application.getMother(); + User user = User.builder().userName(mother.getUserName()) + .name(mother.getName()) + .mobileNumber(mother.getMobileNumber()) + .emailId(mother.getEmailId()) + .altContactNumber(mother.getAltContactNumber()) + .tenantId(mother.getTenantId()) + .type(mother.getType()) + .roles(mother.getRoles()) + .build(); +// String tenantId = father.getTenantId(); + return user; + } + private String upsertUser(User user, RequestInfo requestInfo){ + + String tenantId = user.getTenantId(); + User userServiceResponse = null; + + // Search on mobile number as user name + UserDetailResponse userDetailResponse = searchUser(userUtils.getStateLevelTenant(tenantId),null, user.getMobileNumber()); + if (!userDetailResponse.getUser().isEmpty()) { + User userFromSearch = userDetailResponse.getUser().get(0); + log.info(userFromSearch.toString()); + if(!user.getUserName().equalsIgnoreCase(userFromSearch.getUserName())){ + userServiceResponse = updateUser(requestInfo,user,userFromSearch); + } + else userServiceResponse = userDetailResponse.getUser().get(0); + } + else { + userServiceResponse = createUser(requestInfo,tenantId,user); + } + + // Enrich the accountId + // user.setId(userServiceResponse.getUuid()); + return userServiceResponse.getUuid(); + } + + + private void enrichUser(BirthRegistrationApplication application, RequestInfo requestInfo){ + String accountIdFather = application.getFather().getId(); + String accountIdMother = application.getMother().getId(); + String tenantId = application.getTenantId(); + + UserDetailResponse userDetailResponseFather = searchUser(userUtils.getStateLevelTenant(tenantId),accountIdFather,null); + UserDetailResponse userDetailResponseMother = searchUser(userUtils.getStateLevelTenant(tenantId),accountIdMother,null); + if(userDetailResponseFather.getUser().isEmpty()) + throw new CustomException("INVALID_ACCOUNTID","No user exist for the given accountId"); + + else application.getFather().setId(userDetailResponseFather.getUser().get(0).getUuid()); + + if(userDetailResponseMother.getUser().isEmpty()) + throw new CustomException("INVALID_ACCOUNTID","No user exist for the given accountId"); + + else application.getMother().setId(userDetailResponseMother.getUser().get(0).getUuid()); + + } + + /** + * Creates the user from the given userInfo by calling user service + * @param requestInfo + * @param tenantId + * @param userInfo + * @return + */ + private User createUser(RequestInfo requestInfo,String tenantId, User userInfo) { + + userUtils.addUserDefaultFields(userInfo.getMobileNumber(),tenantId, userInfo); + StringBuilder uri = new StringBuilder(config.getUserHost()) + .append(config.getUserContextPath()) + .append(config.getUserCreateEndpoint()); + + CreateUserRequest user = new CreateUserRequest(requestInfo, userInfo); + log.info(user.getUser().toString()); + UserDetailResponse userDetailResponse = userUtils.userCall(user, uri); + + return userDetailResponse.getUser().get(0); + + } + + /** + * Updates the given user by calling user service + * @param requestInfo + * @param user + * @param userFromSearch + * @return + */ + private User updateUser(RequestInfo requestInfo,User user,User userFromSearch) { + + userFromSearch.setName(user.getName()); + userFromSearch.setActive(true); + + StringBuilder uri = new StringBuilder(config.getUserHost()) + .append(config.getUserContextPath()) + .append(config.getUserUpdateEndpoint()); + + + UserDetailResponse userDetailResponse = userUtils.userCall(new CreateUserRequest(requestInfo, userFromSearch), uri); + + return userDetailResponse.getUser().get(0); + + } + + /** + * calls the user search API based on the given accountId and userName + * @param stateLevelTenant + * @param accountId + * @param userName + * @return + */ + public UserDetailResponse searchUser(String stateLevelTenant, String accountId, String userName){ + + UserSearchRequest userSearchRequest =new UserSearchRequest(); + userSearchRequest.setActive(true); + userSearchRequest.setUserType("CITIZEN"); + userSearchRequest.setTenantId(stateLevelTenant); + + if(StringUtils.isEmpty(accountId) && StringUtils.isEmpty(userName)) + return null; + + if(!StringUtils.isEmpty(accountId)) + userSearchRequest.setUuid(Collections.singletonList(accountId)); + + if(!StringUtils.isEmpty(userName)) + userSearchRequest.setUserName(userName); + + StringBuilder uri = new StringBuilder(config.getUserHost()).append(config.getUserSearchEndpoint()); + return userUtils.userCall(userSearchRequest,uri); + + } + + /** + * calls the user search API based on the given list of user uuids + * @param uuids + * @return + */ + private Map searchBulkUser(List uuids){ + + UserSearchRequest userSearchRequest =new UserSearchRequest(); + userSearchRequest.setActive(true); + userSearchRequest.setUserType("CITIZEN"); + + + if(!CollectionUtils.isEmpty(uuids)) + userSearchRequest.setUuid(uuids); + + + StringBuilder uri = new StringBuilder(config.getUserHost()).append(config.getUserSearchEndpoint()); + UserDetailResponse userDetailResponse = userUtils.userCall(userSearchRequest,uri); + List users = userDetailResponse.getUser(); + + if(CollectionUtils.isEmpty(users)) + throw new CustomException("USER_NOT_FOUND","No user found for the uuids"); + + Map idToUserMap = users.stream().collect(Collectors.toMap(User::getUuid, Function.identity())); + + return idToUserMap; + } + +} \ No newline at end of file diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/service/WorkflowService.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/service/WorkflowService.java new file mode 100644 index 00000000000..55e3f4d6db2 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/service/WorkflowService.java @@ -0,0 +1,159 @@ +package digit.service; + +import com.fasterxml.jackson.databind.ObjectMapper; +import digit.config.BTRConfiguration; +import digit.repository.ServiceRequestRepository; +import digit.web.models.*; +import lombok.extern.slf4j.Slf4j; +import org.egov.common.contract.request.RequestInfo; +import org.egov.tracer.model.CustomException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +@Component +@Slf4j +public class WorkflowService { + + @Autowired + private ObjectMapper mapper; + + @Autowired + private ServiceRequestRepository repository; + + @Autowired + private BTRConfiguration config; + + public void updateWorkflowStatus(BirthRegistrationRequest birthRegistrationRequest) { + birthRegistrationRequest.getBirthRegistrationApplications().forEach(application -> { + ProcessInstance processInstance = getProcessInstanceForBTR(application, birthRegistrationRequest.getRequestInfo()); + ProcessInstanceRequest workflowRequest = new ProcessInstanceRequest(birthRegistrationRequest.getRequestInfo(), Collections.singletonList(processInstance)); + callWorkFlow(workflowRequest); + }); + } + + public State callWorkFlow(ProcessInstanceRequest workflowReq) { + + ProcessInstanceResponse response = null; + StringBuilder url = new StringBuilder(config.getWfHost().concat(config.getWfTransitionPath())); + Object optional = repository.fetchResult(url, workflowReq); + response = mapper.convertValue(optional, ProcessInstanceResponse.class); + return response.getProcessInstances().get(0).getState(); + } + + private ProcessInstance getProcessInstanceForBTR(BirthRegistrationApplication application, RequestInfo requestInfo) { + Workflow workflow = application.getWorkflow(); + + ProcessInstance processInstance = new ProcessInstance(); + processInstance.setBusinessId(application.getApplicationNumber()); + processInstance.setAction(workflow.getAction()); + processInstance.setModuleName("birth-services"); + processInstance.setTenantId(application.getTenantId()); + processInstance.setBusinessService("BTR"); + processInstance.setDocuments(workflow.getDocuments()); + processInstance.setComment(workflow.getComments()); + + if(!CollectionUtils.isEmpty(workflow.getAssignes())){ + List users = new ArrayList<>(); + + workflow.getAssignes().forEach(uuid -> { + User user = new User(); + user.setUuid(uuid); + users.add(user); + }); + + processInstance.setAssignes(users); + } + + return processInstance; + + } + + private BusinessService getBusinessService(BirthRegistrationApplication application, RequestInfo requestInfo) { + String tenantId = application.getTenantId(); + StringBuilder url = getSearchURLWithParams(tenantId, "BTR"); + RequestInfoWrapper requestInfoWrapper = RequestInfoWrapper.builder().requestInfo(requestInfo).build(); + Object result = repository.fetchResult(url, requestInfoWrapper); + BusinessServiceResponse response = null; + try { + response = mapper.convertValue(result, BusinessServiceResponse.class); + } catch (IllegalArgumentException e) { + throw new CustomException("PARSING ERROR", "Failed to parse response of workflow business service search"); + } + + if (CollectionUtils.isEmpty(response.getBusinessServices())) + throw new CustomException("BUSINESSSERVICE_NOT_FOUND", "The businessService " + "BTR" + " is not found"); + + return response.getBusinessServices().get(0); + } + + private StringBuilder getSearchURLWithParams(String tenantId, String businessService) { + + StringBuilder url = new StringBuilder(config.getWfHost()); + url.append(config.getWfBusinessServiceSearchPath()); + url.append("?tenantId="); + url.append(tenantId); + url.append("&businessServices="); + url.append(businessService); + return url; + } + + public ProcessInstanceRequest getProcessInstanceForBirthRegistrationPayment(BirthRegistrationRequest updateRequest) { + + BirthRegistrationApplication application = updateRequest.getBirthRegistrationApplications().get(0); + + ProcessInstance process = ProcessInstance.builder() + .businessService("BTR") + .businessId(application.getApplicationNumber()) + .comment("Payment for birth registration processed") + .moduleName("birth-services") + .tenantId(application.getTenantId()) + .action("PAY") + .build(); + + return ProcessInstanceRequest.builder() + .requestInfo(updateRequest.getRequestInfo()) + .processInstances(Arrays.asList(process)) + .build(); + + } + + private StringBuilder getWorkflowSearchURLWithParams(String tenantId, String businessId) { + + StringBuilder url = new StringBuilder(config.getWfHost()); + url.append(config.getWfProcessInstanceSearchPath()); + url.append("?tenantId="); + url.append(tenantId); + url.append("&businessIds="); + url.append(businessId); + return url; + } + + public ProcessInstance getCurrentWorkflow(RequestInfo requestInfo, String tenantId, String businessId) { + + RequestInfoWrapper requestInfoWrapper = RequestInfoWrapper.builder().requestInfo(requestInfo).build(); + + StringBuilder url = getWorkflowSearchURLWithParams(tenantId, businessId); + + Object res = repository.fetchResult(url, requestInfoWrapper); + ProcessInstanceResponse response = null; + + try{ + response = mapper.convertValue(res, ProcessInstanceResponse.class); + } + catch (Exception e){ + throw new CustomException("PARSING_ERROR","Failed to parse workflow search response"); + } + + if(response!=null && !CollectionUtils.isEmpty(response.getProcessInstances()) && response.getProcessInstances().get(0)!=null) + return response.getProcessInstances().get(0); + + return null; + } + +} \ No newline at end of file diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/util/IdgenUtil.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/util/IdgenUtil.java new file mode 100644 index 00000000000..224456b5f5e --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/util/IdgenUtil.java @@ -0,0 +1,52 @@ +package digit.util; + +import com.fasterxml.jackson.databind.ObjectMapper; +import digit.repository.ServiceRequestRepository; +import digit.web.models.IdGenerationRequest; +import digit.web.models.IdGenerationResponse; +import digit.web.models.IdRequest; +import digit.web.models.IdResponse; +import org.egov.common.contract.request.RequestInfo; +import org.egov.tracer.model.CustomException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +@Component +public class IdgenUtil { + + @Value("${egov.idgen.host}") + private String idGenHost; + + @Value("${egov.idgen.path}") + private String idGenPath; + + @Autowired + private ObjectMapper mapper; + + @Autowired + private ServiceRequestRepository restRepo; + + public List getIdList(RequestInfo requestInfo, String tenantId, String idName, String idformat, Integer count) { + List reqList = new ArrayList<>(); + for (int i = 0; i < count; i++) { + reqList.add(IdRequest.builder().idName(idName).format(idformat).tenantId(tenantId).build()); + } + + IdGenerationRequest request = IdGenerationRequest.builder().idRequests(reqList).requestInfo(requestInfo).build(); + StringBuilder uri = new StringBuilder(idGenHost).append(idGenPath); + IdGenerationResponse response = mapper.convertValue(restRepo.fetchResult(uri, request), IdGenerationResponse.class); + + List idResponses = response.getIdResponses(); + + if (CollectionUtils.isEmpty(idResponses)) + throw new CustomException("IDGEN ERROR", "No ids returned from idgen Service"); + + return idResponses.stream().map(IdResponse::getId).collect(Collectors.toList()); + } +} \ No newline at end of file diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/util/MdmsUtil.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/util/MdmsUtil.java new file mode 100644 index 00000000000..865bdff28e7 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/util/MdmsUtil.java @@ -0,0 +1,70 @@ +package digit.util; + +import com.jayway.jsonpath.JsonPath; +import org.egov.common.contract.request.RequestInfo; +import org.egov.mdms.model.MasterDetail; +import org.egov.mdms.model.MdmsCriteria; +import org.egov.mdms.model.MdmsCriteriaReq; +import org.egov.mdms.model.ModuleDetail; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +@Component +public class MdmsUtil { + @Autowired + private RestTemplate restTemplate; + + @Value("${egov.mdms.host}") + private String mdmsHost; + + @Value("${egov.mdms.search.endpoint}") + private String mdmsUrl; + + + public Integer fetchRegistrationChargesFromMdms(RequestInfo requestInfo, String tenantId) { + StringBuilder uri = new StringBuilder(); + uri.append(mdmsHost).append(mdmsUrl); + MdmsCriteriaReq mdmsCriteriaReq = getMdmsRequestForCategoryList(requestInfo, tenantId); + Object response = new HashMap<>(); + Integer rate = 0; + try { + response = restTemplate.postForObject(uri.toString(), mdmsCriteriaReq, Map.class); + rate = JsonPath.read(response, "$.MdmsRes.BTR.RegistrationCharges.[0].amount"); + }catch(Exception e) { + return null; + } + return rate; + } + + private MdmsCriteriaReq getMdmsRequestForCategoryList(RequestInfo requestInfo, String tenantId) { + MasterDetail masterDetail = new MasterDetail(); + masterDetail.setName("RegistrationCharges"); + List masterDetailList = new ArrayList<>(); + masterDetailList.add(masterDetail); + + ModuleDetail moduleDetail = new ModuleDetail(); + moduleDetail.setMasterDetails(masterDetailList); + moduleDetail.setModuleName("BTR"); + List moduleDetailList = new ArrayList<>(); + moduleDetailList.add(moduleDetail); + + MdmsCriteria mdmsCriteria = new MdmsCriteria(); + mdmsCriteria.setTenantId(tenantId.split("\\.")[0]); + mdmsCriteria.setModuleDetails(moduleDetailList); + + MdmsCriteriaReq mdmsCriteriaReq = new MdmsCriteriaReq(); + mdmsCriteriaReq.setMdmsCriteria(mdmsCriteria); + mdmsCriteriaReq.setRequestInfo(requestInfo); + + return mdmsCriteriaReq; + } +} + diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/util/ResponseInfoFactory.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/util/ResponseInfoFactory.java new file mode 100644 index 00000000000..5246bd6a9b5 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/util/ResponseInfoFactory.java @@ -0,0 +1,25 @@ +package digit.util; + +import org.egov.common.contract.request.RequestInfo; +import org.egov.common.contract.response.ResponseInfo; +import org.springframework.stereotype.Component; + +@Component +public class ResponseInfoFactory { + + public ResponseInfo createResponseInfoFromRequestInfo(final RequestInfo requestInfo, final Boolean success) { + + final String apiId = requestInfo != null ? requestInfo.getApiId() : ""; + final String ver = requestInfo != null ? requestInfo.getVer() : ""; + Long ts = null; + if (requestInfo != null) + ts = requestInfo.getTs(); + final String resMsgId = "uief87324"; // FIXME : Hard-coded + final String msgId = requestInfo != null ? requestInfo.getMsgId() : ""; + final String responseStatus = success ? "successful" : "failed"; + + return ResponseInfo.builder().apiId(apiId).ver(ver).ts(ts).resMsgId(resMsgId).msgId(msgId).resMsgId(resMsgId) + .status(responseStatus).build(); + } + +} \ No newline at end of file diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/util/UrlShortnerUtil.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/util/UrlShortnerUtil.java new file mode 100644 index 00000000000..28bd16fa1d3 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/util/UrlShortnerUtil.java @@ -0,0 +1,35 @@ +package digit.util; + +import digit.config.BTRConfiguration; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; + +import java.util.HashMap; + +@Slf4j +@Component +public class UrlShortnerUtil { + @Autowired + private RestTemplate restTemplate; + + @Autowired + private BTRConfiguration config; + + public String getShortenedUrl(String url){ + + HashMap body = new HashMap<>(); + body.put("url",url); + StringBuilder builder = new StringBuilder(config.getUrlShortnerHost()); + builder.append(config.getUrlShortnerEndpoint()); + String res = restTemplate.postForObject(builder.toString(), body, String.class); + + if(StringUtils.isEmpty(res)){ + log.error("URL_SHORTENING_ERROR", "Unable to shorten url: " + url); + return url; + } + else return res; + } +} diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/util/UserUtil.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/util/UserUtil.java new file mode 100644 index 00000000000..e949c062793 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/util/UserUtil.java @@ -0,0 +1,135 @@ +package digit.util; + +import com.fasterxml.jackson.databind.ObjectMapper; +import digit.config.BTRConfiguration; +import digit.repository.ServiceRequestRepository; +import digit.web.models.Role; +import digit.web.models.User; +import digit.web.models.UserDetailResponse; +import org.egov.tracer.model.CustomException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Collections; +import java.util.Date; +import java.util.LinkedHashMap; +import java.util.List; + +@Component +public class UserUtil { + + + private ObjectMapper mapper; + + private ServiceRequestRepository serviceRequestRepository; + + private BTRConfiguration config; + + @Autowired + public UserUtil(ObjectMapper mapper, ServiceRequestRepository serviceRequestRepository, BTRConfiguration config) { + this.mapper = mapper; + this.serviceRequestRepository = serviceRequestRepository; + this.config = config; + } + + /** + * Returns UserDetailResponse by calling user service with given uri and object + * @param userRequest Request object for user service + * @param uri The address of the endpoint + * @return Response from user service as parsed as userDetailResponse + */ + + public UserDetailResponse userCall(Object userRequest, StringBuilder uri) { + String dobFormat = null; + + if(uri.toString().contains(config.getUserSearchEndpoint()) || uri.toString().contains(config.getUserUpdateEndpoint())) + dobFormat="yyyy-MM-dd"; + else if(uri.toString().contains(config.getUserCreateEndpoint())) + dobFormat = "dd/MM/yyyy"; + try{ + LinkedHashMap responseMap = (LinkedHashMap)serviceRequestRepository.fetchResult(uri, userRequest); + parseResponse(responseMap,dobFormat); + UserDetailResponse userDetailResponse = mapper.convertValue(responseMap,UserDetailResponse.class); + return userDetailResponse; + } + catch(IllegalArgumentException e) + { + throw new CustomException("IllegalArgumentException","ObjectMapper not able to convertValue in userCall"); + } + } + + + /** + * Parses date formats to long for all users in responseMap + * @param responeMap LinkedHashMap got from user api response + */ + + public void parseResponse(LinkedHashMap responeMap, String dobFormat){ + List users = (List)responeMap.get("user"); + String format1 = "dd-MM-yyyy HH:mm:ss"; + if(users!=null){ + users.forEach( map -> { + map.put("createdDate",dateTolong((String)map.get("createdDate"),format1)); + if((String)map.get("lastModifiedDate")!=null) + map.put("lastModifiedDate",dateTolong((String)map.get("lastModifiedDate"),format1)); + if((String)map.get("dob")!=null) + map.put("dob",dateTolong((String)map.get("dob"),dobFormat)); + if((String)map.get("pwdExpiryDate")!=null) + map.put("pwdExpiryDate",dateTolong((String)map.get("pwdExpiryDate"),format1)); + } + ); + } + } + + /** + * Converts date to long + * @param date date to be parsed + * @param format Format of the date + * @return Long value of date + */ + private Long dateTolong(String date,String format){ + SimpleDateFormat f = new SimpleDateFormat(format); + Date d = null; + try { + d = f.parse(date); + } catch (ParseException e) { + throw new CustomException("INVALID_DATE_FORMAT","Failed to parse date format in user"); + } + return d.getTime(); + } + + /** + * enriches the userInfo with statelevel tenantId and other fields + * @param mobileNumber + * @param tenantId + * @param userInfo + */ + public void addUserDefaultFields(String mobileNumber,String tenantId, User userInfo){ + Role role = getCitizenRole(tenantId); + userInfo.setRoles(Collections.singletonList(role)); + userInfo.setType("CITIZEN"); + userInfo.setUserName(mobileNumber); + userInfo.setTenantId(getStateLevelTenant(tenantId)); + userInfo.setActive(true); + } + + /** + * Returns role object for citizen + * @param tenantId + * @return + */ + private Role getCitizenRole(String tenantId){ + Role role = new Role(); + role.setCode("CITIZEN"); + role.setName("Citizen"); + role.setTenantId(getStateLevelTenant(tenantId)); + return role; + } + + public String getStateLevelTenant(String tenantId){ + return tenantId.split("\\.")[0]; + } + +} \ No newline at end of file diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/validator/BirthApplicationValidator.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/validator/BirthApplicationValidator.java new file mode 100644 index 00000000000..dd48b2a24b2 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/validator/BirthApplicationValidator.java @@ -0,0 +1,36 @@ +package digit.validator; + +import digit.repository.BirthRegistrationRepository; +import digit.web.models.BirthApplicationSearchCriteria; +import digit.web.models.BirthRegistrationApplication; +import digit.web.models.BirthRegistrationRequest; +import org.egov.tracer.model.CustomException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.ObjectUtils; + +import java.util.List; +import java.util.stream.Collectors; + +@Component +public class BirthApplicationValidator { + + @Autowired + private BirthRegistrationRepository repository; + + public void validateBirthApplication(BirthRegistrationRequest birthRegistrationRequest) { + birthRegistrationRequest.getBirthRegistrationApplications().forEach(application -> { + if(ObjectUtils.isEmpty(application.getTenantId())) + throw new CustomException("EG_BT_APP_ERR", "tenantId is mandatory for creating birth registration applications"); + }); + } + + public List validateApplicationUpdateRequest(BirthRegistrationRequest birthRegistrationRequest) { + List ids = birthRegistrationRequest.getBirthRegistrationApplications().stream().map(BirthRegistrationApplication::getId).collect(Collectors.toList()); + List birthRegistrationApplications = repository.getApplications(BirthApplicationSearchCriteria.builder().ids(ids).build()); + if(birthRegistrationApplications.size() != ids.size()) + throw new CustomException("APPLICATION_DOES_NOT_EXIST", "One of the application ids does not exist."); + return birthRegistrationApplications; + } + +} diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/controllers/V1ApiController.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/controllers/V1ApiController.java new file mode 100644 index 00000000000..00e98e24e9c --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/controllers/V1ApiController.java @@ -0,0 +1,72 @@ +package digit.web.controllers; + + +import com.fasterxml.jackson.databind.ObjectMapper; +import digit.service.BirthRegistrationService; +import digit.util.ResponseInfoFactory; +import digit.web.models.*; +import io.swagger.annotations.ApiParam; +import lombok.ToString; +import lombok.extern.slf4j.Slf4j; +import org.egov.common.contract.response.ResponseInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +import javax.servlet.http.HttpServletRequest; +import javax.validation.Valid; +import java.util.Collections; +import java.util.List; +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-07-26T12:39:05.988+05:30") +@Slf4j +@ToString +@Controller +@RequestMapping("/birth-services") +public class V1ApiController{ + + private final ObjectMapper objectMapper; + + private final HttpServletRequest request; + + private BirthRegistrationService birthRegistrationService; + + @Autowired + private ResponseInfoFactory responseInfoFactory; + + @Autowired + public V1ApiController(ObjectMapper objectMapper, HttpServletRequest request, BirthRegistrationService birthRegistrationService) { + this.objectMapper = objectMapper; + this.request = request; + this.birthRegistrationService = birthRegistrationService; + } + + @RequestMapping(value="/v1/registration/_create", method = RequestMethod.POST) + public ResponseEntity v1RegistrationCreatePost(@ApiParam(value = "Details for the new Birth Registration Application(s) + RequestInfo meta data." ,required=true ) @Valid @RequestBody BirthRegistrationRequest birthRegistrationRequest) { + List applications = birthRegistrationService.registerBtRequest(birthRegistrationRequest); + ResponseInfo responseInfo = responseInfoFactory.createResponseInfoFromRequestInfo(birthRegistrationRequest.getRequestInfo(), true); + BirthRegistrationResponse response = BirthRegistrationResponse.builder().birthRegistrationApplications(applications).responseInfo(responseInfo).build(); + return new ResponseEntity<>(response, HttpStatus.OK); + } + + @RequestMapping(value="/v1/registration/_search", method = RequestMethod.POST) + public ResponseEntity v1RegistrationSearchPost(@RequestBody RequestInfoWrapper requestInfoWrapper, @Valid @ModelAttribute BirthApplicationSearchCriteria birthApplicationSearchCriteria) { + List applications = birthRegistrationService.searchBtApplications(requestInfoWrapper.getRequestInfo(), birthApplicationSearchCriteria); + ResponseInfo responseInfo = responseInfoFactory.createResponseInfoFromRequestInfo(requestInfoWrapper.getRequestInfo(), true); + BirthRegistrationResponse response = BirthRegistrationResponse.builder().birthRegistrationApplications(applications).responseInfo(responseInfo).build(); + return new ResponseEntity<>(response,HttpStatus.OK); + } + + @RequestMapping(value="/v1/registration/_update", method = RequestMethod.POST) + public ResponseEntity v1RegistrationUpdatePost(@ApiParam(value = "Details for the new (s) + RequestInfo meta data." ,required=true ) @Valid @RequestBody BirthRegistrationRequest birthRegistrationRequest) { + List applications = birthRegistrationService.updateBtApplication(birthRegistrationRequest); + ResponseInfo responseInfo = responseInfoFactory.createResponseInfoFromRequestInfo(birthRegistrationRequest.getRequestInfo(), true); + BirthRegistrationResponse response = BirthRegistrationResponse.builder().birthRegistrationApplications(applications).responseInfo(responseInfo).build(); + return new ResponseEntity<>(response, HttpStatus.OK); + } + +} diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/Action.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/Action.java new file mode 100644 index 00000000000..4fe5eab073a --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/Action.java @@ -0,0 +1,56 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; + +import javax.validation.Valid; +import javax.validation.constraints.Size; +import java.util.ArrayList; +import java.util.List; + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +@ToString +@EqualsAndHashCode(of = {"tenantId","currentState","action"}) +public class Action { + + @Size(max=256) + @JsonProperty("uuid") + private String uuid; + + @Size(max=256) + @JsonProperty("tenantId") + private String tenantId; + + @Size(max=256) + @JsonProperty("currentState") + private String currentState; + + @Size(max=256) + @JsonProperty("action") + private String action; + + @Size(max=256) + @JsonProperty("nextState") + private String nextState; + + @Size(max=1024) + @JsonProperty("roles") + @Valid + private List roles; + + private AuditDetails auditDetails; + + + public Action addRolesItem(String rolesItem) { + if (this.roles == null) { + this.roles = new ArrayList<>(); + } + this.roles.add(rolesItem); + return this; + } + +} \ No newline at end of file diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/Address.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/Address.java new file mode 100644 index 00000000000..6f8561c1dd3 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/Address.java @@ -0,0 +1,76 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import lombok.*; +import org.springframework.validation.annotation.Validated; + +/** + * Representation of a address. Indiavidual APIs may choose to extend from this using allOf if more details needed to be added in their case. + */ +@ApiModel(description = "Representation of a address. Indiavidual APIs may choose to extend from this using allOf if more details needed to be added in their case. ") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-10-25T21:43:19.662+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class Address { + + @JsonProperty("id") + private String id; + + @JsonProperty("tenantId") + private String tenantId = null; + + @JsonProperty("doorNo") + private String doorNo = null; + + @JsonProperty("latitude") + private Double latitude = null; + + @JsonProperty("longitude") + private Double longitude = null; + + @JsonProperty("addressId") + private String addressId = null; + + @JsonProperty("addressNumber") + private String addressNumber = null; + + @JsonProperty("type") + private String type = null; + + @JsonProperty("addressLine1") + private String addressLine1 = null; + + @JsonProperty("addressLine2") + private String addressLine2 = null; + + @JsonProperty("landmark") + private String landmark = null; + + @JsonProperty("city") + private String city = null; + + @JsonProperty("pincode") + private String pincode = null; + + @JsonProperty("detail") + private String detail = null; + + @JsonProperty("buildingName") + private String buildingName = null; + + @JsonProperty("street") + private String street = null; + + @JsonProperty("locality") + private Boundary locality = null; + + @JsonProperty("registrationId") + private String registrationId; + +} diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/Applicant.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/Applicant.java new file mode 100644 index 00000000000..c89a2f8cace --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/Applicant.java @@ -0,0 +1,142 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import lombok.*; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.List; + +/** + * Details of the user applying for birth registration + */ +@ApiModel(description = "Details of the user applying for birth registration") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-10-25T21:43:19.662+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class Applicant { + @JsonProperty("id") + private Long id = null; + + @JsonProperty("userName") + private String userName = null; + + @JsonProperty("password") + private String password = null; + + @JsonProperty("salutation") + private String salutation = null; + + @JsonProperty("name") + private String name = null; + + @JsonProperty("gender") + private String gender = null; + + @JsonProperty("mobileNumber") + private String mobileNumber = null; + + @JsonProperty("emailId") + private String emailId = null; + + @JsonProperty("altContactNumber") + private String altContactNumber = null; + + @JsonProperty("pan") + private String pan = null; + + @JsonProperty("aadhaarNumber") + private String aadhaarNumber = null; + + @JsonProperty("permanentAddress") + private String permanentAddress = null; + + @JsonProperty("permanentCity") + private String permanentCity = null; + + @JsonProperty("permanentPincode") + private String permanentPincode = null; + + @JsonProperty("correspondenceCity") + private String correspondenceCity = null; + + @JsonProperty("correspondencePincode") + private String correspondencePincode = null; + + @JsonProperty("correspondenceAddress") + private String correspondenceAddress = null; + + @JsonProperty("active") + private Boolean active = null; + + @JsonProperty("dob") + private LocalDate dob = null; + + @JsonProperty("pwdExpiryDate") + private LocalDate pwdExpiryDate = null; + + @JsonProperty("locale") + private String locale = null; + + @JsonProperty("type") + private String type = null; + + @JsonProperty("signature") + private String signature = null; + + @JsonProperty("accountLocked") + private Boolean accountLocked = null; + + @JsonProperty("roles") + @Valid + private List roles = null; + + @JsonProperty("fatherOrHusbandName") + private String fatherOrHusbandName = null; + + @JsonProperty("bloodGroup") + private String bloodGroup = null; + + @JsonProperty("identificationMark") + private String identificationMark = null; + + @JsonProperty("photo") + private String photo = null; + + @JsonProperty("createdBy") + private Long createdBy = null; + + @JsonProperty("createdDate") + private LocalDate createdDate = null; + + @JsonProperty("lastModifiedBy") + private Long lastModifiedBy = null; + + @JsonProperty("lastModifiedDate") + private LocalDate lastModifiedDate = null; + + @JsonProperty("otpReference") + private String otpReference = null; + + @JsonProperty("tenantId") + private String tenantId = null; + + + public Applicant addRolesItem(Role rolesItem) { + if (this.roles == null) { + this.roles = new ArrayList<>(); + } + this.roles.add(rolesItem); + return this; + } + +} + diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/AuditDetails.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/AuditDetails.java new file mode 100644 index 00000000000..a244e41bc83 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/AuditDetails.java @@ -0,0 +1,35 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import lombok.*; +import org.springframework.validation.annotation.Validated; + +/** + * Collection of audit related fields used by most models + */ +@ApiModel(description = "Collection of audit related fields used by most models") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-10-25T21:43:19.662+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class AuditDetails { + @JsonProperty("createdBy") + private String createdBy = null; + + @JsonProperty("lastModifiedBy") + private String lastModifiedBy = null; + + @JsonProperty("createdTime") + private Long createdTime = null; + + @JsonProperty("lastModifiedTime") + private Long lastModifiedTime = null; + + +} + diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/Bill.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/Bill.java new file mode 100644 index 00000000000..86223908495 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/Bill.java @@ -0,0 +1,158 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.databind.JsonNode; +import lombok.*; +import org.springframework.util.CollectionUtils; + +import javax.validation.Valid; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +@Getter +@Setter +@ToString +@Builder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode +public class Bill { + + @JsonProperty("id") + private String id; + + @JsonProperty("mobileNumber") + private String mobileNumber; + + @JsonProperty("paidBy") + private String paidBy; + + @JsonProperty("payerName") + private String payerName; + + @JsonProperty("payerAddress") + private String payerAddress; + + @JsonProperty("payerEmail") + private String payerEmail; + + @JsonProperty("payerId") + private String payerId; + + @JsonProperty("status") + private StatusEnum status; + + @JsonProperty("reasonForCancellation") + private String reasonForCancellation; + + @JsonProperty("isCancelled") + private Boolean isCancelled; + + @JsonProperty("additionalDetails") + private JsonNode additionalDetails; + + @JsonProperty("billDetails") + @Valid + private List billDetails; + + @JsonProperty("tenantId") + private String tenantId; + + @JsonProperty("auditDetails") + private AuditDetails auditDetails; + + @JsonProperty("collectionModesNotAllowed") + private List collectionModesNotAllowed; + + @JsonProperty("partPaymentAllowed") + private Boolean partPaymentAllowed; + + @JsonProperty("isAdvanceAllowed") + private Boolean isAdvanceAllowed; + + @JsonProperty("minimumAmountToBePaid") + private BigDecimal minimumAmountToBePaid; + + @JsonProperty("businessService") + private String businessService; + + @JsonProperty("totalAmount") + private BigDecimal totalAmount; + + @JsonProperty("consumerCode") + private String consumerCode; + + @JsonProperty("billNumber") + private String billNumber; + + @JsonProperty("billDate") + private Long billDate; + + @JsonProperty("amountPaid") + private BigDecimal amountPaid; + + + + public enum StatusEnum { + ACTIVE("ACTIVE"), + + CANCELLED("CANCELLED"), + + PAID("PAID"), + + EXPIRED("EXPIRED"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + public static boolean contains(String test) { + for (StatusEnum val : StatusEnum.values()) { + if (val.name().equalsIgnoreCase(test)) { + return true; + } + } + return false; + } + + @JsonCreator + public static StatusEnum fromValue(String text) { + for (StatusEnum b : StatusEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + + } + + public Boolean addBillDetail(BillDetail billDetail) { + + if (CollectionUtils.isEmpty(billDetails)) { + + billDetails = new ArrayList<>(); + return billDetails.add(billDetail); + } else { + + if (!billDetails.contains(billDetail)) + return billDetails.add(billDetail); + else + return false; + } + } + + +} diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/BillAccountDetail.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/BillAccountDetail.java new file mode 100644 index 00000000000..1d5ab2d9d95 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/BillAccountDetail.java @@ -0,0 +1,56 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.JsonNode; +import lombok.*; + +import javax.validation.constraints.Size; +import java.math.BigDecimal; + +@Setter +@Getter +@ToString +@Builder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode +public class BillAccountDetail { + + @Size(max = 64) + @JsonProperty("id") + private String id; + + @Size(max = 64) + @JsonProperty("tenantId") + private String tenantId; + + @Size(max = 64) + @JsonProperty("billDetailId") + private String billDetailId; + + @Size(max = 64) + @JsonProperty("demandDetailId") + private String demandDetailId; + + @JsonProperty("order") + private Integer order; + + @JsonProperty("amount") + private BigDecimal amount; + + @JsonProperty("adjustedAmount") + private BigDecimal adjustedAmount; + + @JsonProperty("isActualDemand") + private Boolean isActualDemand; + + @Size(max = 64) + @JsonProperty("taxHeadCode") + private String taxHeadCode; + + @JsonProperty("additionalDetails") + private JsonNode additionalDetails; + + @JsonProperty("auditDetails") + private AuditDetails auditDetails; +} diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/BillDetail.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/BillDetail.java new file mode 100644 index 00000000000..bc0f7374b90 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/BillDetail.java @@ -0,0 +1,99 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.JsonNode; +import lombok.*; +import org.springframework.util.CollectionUtils; + +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +@Setter +@Getter +@ToString +@Builder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(of = { "id" }) +public class BillDetail { + + @JsonProperty("id") + private String id; + + @JsonProperty("tenantId") + private String tenantId; + + @JsonProperty("demandId") + private String demandId; + + @JsonProperty("billId") + private String billId; + + @JsonProperty("amount") + @NotNull + private BigDecimal amount; + + @JsonProperty("amountPaid") + private BigDecimal amountPaid; + + @NotNull + @JsonProperty("fromPeriod") + private Long fromPeriod; + + @NotNull + @JsonProperty("toPeriod") + private Long toPeriod; + + @JsonProperty("additionalDetails") + private JsonNode additionalDetails; + + @JsonProperty("channel") + private String channel; + + @JsonProperty("voucherHeader") + private String voucherHeader; + + @JsonProperty("boundary") + private String boundary; + + @JsonProperty("manualReceiptNumber") + private String manualReceiptNumber; + + @JsonProperty("manualReceiptDate") + private Long manualReceiptDate; + + @JsonProperty("billAccountDetails") + private List billAccountDetails; + + @NotNull + @JsonProperty("collectionType") + private String collectionType; + + @JsonProperty("auditDetails") + private AuditDetails auditDetails; + + private String billDescription; + + @NotNull + @JsonProperty("expiryDate") + private Long expiryDate; + + + public Boolean addBillAccountDetail(BillAccountDetail billAccountDetail) { + + if (CollectionUtils.isEmpty(billAccountDetails)) { + + billAccountDetails = new ArrayList<>(); + return billAccountDetails.add(billAccountDetail); + } else { + + if (!billAccountDetails.contains(billAccountDetail)) + return billAccountDetails.add(billAccountDetail); + else + return false; + } + } + +} diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/BirthApplicationSearchCriteria.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/BirthApplicationSearchCriteria.java new file mode 100644 index 00000000000..904da6c4448 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/BirthApplicationSearchCriteria.java @@ -0,0 +1,29 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; + +import java.util.List; + +@Data +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +@ToString +public class BirthApplicationSearchCriteria { + + @JsonProperty("tenantId") + private String tenantId; + + @JsonProperty("status") + private String status; + + @JsonProperty("ids") + private List ids; + + @JsonProperty("applicationNumber") + private String applicationNumber; + +} diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/BirthRegistrationApplication.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/BirthRegistrationApplication.java new file mode 100644 index 00000000000..c21043ca623 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/BirthRegistrationApplication.java @@ -0,0 +1,91 @@ +package digit.web.models; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import digit.web.models.Address; +import digit.web.models.AuditDetails; +import digit.web.models.FatherApplicant; +import digit.web.models.MotherApplicant; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.springframework.validation.annotation.Validated; +import javax.validation.Valid; +import javax.validation.constraints.*; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.Builder; + +/** + * A Object holds the basic data for a Birth Registration Application + */ +@ApiModel(description = "A Object holds the basic data for a Birth Registration Application") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-08-16T15:34:24.436+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class BirthRegistrationApplication { + + @JsonProperty("id") + private String id = null; + + @JsonProperty("tenantId") + private String tenantId = null; + + @JsonProperty("applicationNumber") + private String applicationNumber = null; + + @JsonProperty("babyFirstName") + private String babyFirstName = null; + + @JsonProperty("babyLastName") + private String babyLastName = null; + + @JsonProperty("fatherMobileNumber") + private String fatherMobileNumber = null; + + @JsonProperty("motherMobileNumber") + private String motherMobileNumber = null; + + @JsonProperty("doctorName") + private String doctorName = null; + + @JsonProperty("hospitalName") + private String hospitalName = null; + + @JsonProperty("placeOfBirth") + private String placeOfBirth = null; + + @JsonProperty("timeOfBirth") + private Integer timeOfBirth = null; + + @JsonProperty("address") + private Address address = null; + + @JsonProperty("fatherOfApplicant") + private FatherApplicant father = null; + + @JsonProperty("motherOfApplicant") + private MotherApplicant mother = null; + + @JsonProperty("auditDetails") + private AuditDetails auditDetails = null; + +// @JsonProperty("father") +// private User father = null; +// +// @JsonProperty("mother") +// private User mother = null; + + @Valid + @JsonProperty("workflow") + private Workflow workflow = null; + +} + diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/BirthRegistrationRequest.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/BirthRegistrationRequest.java new file mode 100644 index 00000000000..041a879f04c --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/BirthRegistrationRequest.java @@ -0,0 +1,43 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import lombok.*; +import org.egov.common.contract.request.RequestInfo; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import java.util.ArrayList; +import java.util.List; + +/** + * Contract class to receive request. Array of items are used in case of create, whereas single item is used for update + */ +@ApiModel(description = "Contract class to receive request. Array of items are used in case of create, whereas single item is used for update") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-10-25T21:43:19.662+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class BirthRegistrationRequest { + @JsonProperty("RequestInfo") + private RequestInfo requestInfo = null; + + @JsonProperty("BirthRegistrationApplications") + @Valid + private List birthRegistrationApplications = null; + + + public BirthRegistrationRequest addBirthRegistrationApplicationsItem(BirthRegistrationApplication birthRegistrationApplicationsItem) { + if (this.birthRegistrationApplications == null) { + this.birthRegistrationApplications = new ArrayList<>(); + } + this.birthRegistrationApplications.add(birthRegistrationApplicationsItem); + return this; + } + +} + diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/BirthRegistrationResponse.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/BirthRegistrationResponse.java new file mode 100644 index 00000000000..50450a7d0e7 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/BirthRegistrationResponse.java @@ -0,0 +1,43 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import lombok.*; +import org.egov.common.contract.response.ResponseInfo; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import java.util.ArrayList; +import java.util.List; + +/** + * Contract class to send response. Array of items are used in case of search results or response for create, whereas single item is used for update + */ +@ApiModel(description = "Contract class to send response. Array of items are used in case of search results or response for create, whereas single item is used for update") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-10-25T21:43:19.662+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class BirthRegistrationResponse { + @JsonProperty("ResponseInfo") + private ResponseInfo responseInfo = null; + + @JsonProperty("BirthRegistrationApplications") + @Valid + private List birthRegistrationApplications = null; + + + public BirthRegistrationResponse addBirthRegistrationApplicationsItem(BirthRegistrationApplication birthRegistrationApplicationsItem) { + if (this.birthRegistrationApplications == null) { + this.birthRegistrationApplications = new ArrayList<>(); + } + this.birthRegistrationApplications.add(birthRegistrationApplicationsItem); + return this; + } + +} + diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/Boundary.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/Boundary.java new file mode 100644 index 00000000000..9c9c18061aa --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/Boundary.java @@ -0,0 +1,55 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import java.util.ArrayList; +import java.util.List; + +/** + * Boundary + */ +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-10-25T21:43:19.662+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class Boundary { + @JsonProperty("code") + private String code = null; + + @JsonProperty("name") + private String name = null; + + @JsonProperty("label") + private String label = null; + + @JsonProperty("latitude") + private String latitude = null; + + @JsonProperty("longitude") + private String longitude = null; + + @JsonProperty("children") + @Valid + private List children = null; + + @JsonProperty("materializedPath") + private String materializedPath = null; + + + public Boundary addChildrenItem(Boundary childrenItem) { + if (this.children == null) { + this.children = new ArrayList<>(); + } + this.children.add(childrenItem); + return this; + } + +} + diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/BusinessService.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/BusinessService.java new file mode 100644 index 00000000000..7c28495ae0a --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/BusinessService.java @@ -0,0 +1,90 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.util.ArrayList; +import java.util.List; + + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +@ToString +@EqualsAndHashCode(of = {"tenantId","businessService"}) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class BusinessService { + + @Size(max=256) + @JsonProperty("tenantId") + private String tenantId = null; + + @Size(max=256) + @JsonProperty("uuid") + private String uuid = null; + + @Size(max=256) + @JsonProperty("businessService") + private String businessService = null; + + @Size(max=256) + @JsonProperty("business") + private String business = null; + + @Size(max=1024) + @JsonProperty("getUri") + private String getUri = null; + + @Size(max=1024) + @JsonProperty("postUri") + private String postUri = null; + + @JsonProperty("businessServiceSla") + private Long businessServiceSla = null; + + @NotNull + @Valid + @JsonProperty("states") + private List states = null; + + @JsonProperty("auditDetails") + private AuditDetails auditDetails = null; + + + + public BusinessService addStatesItem(State statesItem) { + if (this.states == null) { + this.states = new ArrayList<>(); + } + this.states.add(statesItem); + return this; + } + + + /** + * Returns the currentState with the given uuid if not present returns null + * @param uuid the uuid of the currentState to be returned + * @return + */ + public State getStateFromUuid(String uuid) { + State state = null; + if(this.states!=null){ + for(State s : this.states){ + if(s.getUuid().equalsIgnoreCase(uuid)){ + state = s; + break; + } + } + } + return state; + } + + + +} \ No newline at end of file diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/BusinessServiceResponse.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/BusinessServiceResponse.java new file mode 100644 index 00000000000..af8d29e3770 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/BusinessServiceResponse.java @@ -0,0 +1,40 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; +import org.egov.common.contract.response.ResponseInfo; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import java.util.ArrayList; +import java.util.List; + + + +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +@ToString +public class BusinessServiceResponse { + + @JsonProperty("ResponseInfo") + private ResponseInfo responseInfo; + + @JsonProperty("BusinessServices") + @Valid + @NotNull + private List businessServices; + + + public BusinessServiceResponse addBusinessServiceItem(BusinessService businessServiceItem) { + if (this.businessServices == null) { + this.businessServices = new ArrayList<>(); + } + this.businessServices.add(businessServiceItem); + return this; + } + + + +} \ No newline at end of file diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/Calculation.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/Calculation.java new file mode 100644 index 00000000000..78fc5103e69 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/Calculation.java @@ -0,0 +1,30 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; +import org.springframework.validation.annotation.Validated; + +/** + * Calculation + */ +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-11-04T14:15:45.774+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class Calculation { + @JsonProperty("applicationNumber") + private String applicationNumber = null; + + @JsonProperty("totalAmount") + private Double totalAmount = null; + + @JsonProperty("tenantId") + private String tenantId = null; + + +} + diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/CalculationCriteria.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/CalculationCriteria.java new file mode 100644 index 00000000000..6795983fcc7 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/CalculationCriteria.java @@ -0,0 +1,32 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import lombok.*; +import org.springframework.validation.annotation.Validated; + +/** + * Criteria to calculate charges for birth registration. + */ +@ApiModel(description = "Criteria to calculate charges for birth registration.") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-11-04T14:15:45.774+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class CalculationCriteria { + @JsonProperty("birthregistrationapplication") + private BirthRegistrationApplication birthregistrationapplication = null; + + @JsonProperty("applicationNumber") + private String applicationNumber = null; + + @JsonProperty("tenantId") + private String tenantId = null; + + +} + diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/CalculationReq.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/CalculationReq.java new file mode 100644 index 00000000000..8f521ac8020 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/CalculationReq.java @@ -0,0 +1,38 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; +import org.egov.common.contract.request.RequestInfo; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import java.util.ArrayList; +import java.util.List; + +/** + * CalculationReq + */ +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-11-04T14:15:45.774+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class CalculationReq { + @JsonProperty("RequestInfo") + private RequestInfo requestInfo = null; + + @JsonProperty("CalculationCriteria") + @Valid + private List calculationCriteria = new ArrayList<>(); + + + public CalculationReq addCalculationCriteriaItem(CalculationCriteria calculationCriteriaItem) { + this.calculationCriteria.add(calculationCriteriaItem); + return this; + } + +} + diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/CalculationRes.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/CalculationRes.java new file mode 100644 index 00000000000..bba37735840 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/CalculationRes.java @@ -0,0 +1,41 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; +import org.egov.common.contract.response.ResponseInfo; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import java.util.ArrayList; +import java.util.List; + +/** + * CalculationRes + */ +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-11-04T14:15:45.774+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class CalculationRes { + @JsonProperty("ResponseInfo") + private ResponseInfo responseInfo = null; + + @JsonProperty("Calculation") + @Valid + private List calculation = null; + + + public CalculationRes addCalculationItem(Calculation calculationItem) { + if (this.calculation == null) { + this.calculation = new ArrayList<>(); + } + this.calculation.add(calculationItem); + return this; + } + +} + diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/CreateUserRequest.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/CreateUserRequest.java new file mode 100644 index 00000000000..107b9972389 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/CreateUserRequest.java @@ -0,0 +1,20 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.egov.common.contract.request.RequestInfo; + +@AllArgsConstructor +@Getter +@NoArgsConstructor +public class CreateUserRequest { + + @JsonProperty("requestInfo") + private RequestInfo requestInfo; + + @JsonProperty("user") + private User user; + +} \ No newline at end of file diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/Document.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/Document.java new file mode 100644 index 00000000000..9549883c5fb --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/Document.java @@ -0,0 +1,38 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import lombok.*; +import org.springframework.validation.annotation.Validated; + +/** + * This object holds list of documents attached during the transaciton for a property + */ +@ApiModel(description = "This object holds list of documents attached during the transaciton for a property") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-10-25T21:43:19.662+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class Document { + @JsonProperty("id") + private String id = null; + + @JsonProperty("documentType") + private String documentType = null; + + @JsonProperty("fileStore") + private String fileStore = null; + + @JsonProperty("documentUid") + private String documentUid = null; + + @JsonProperty("additionalDetails") + private Object additionalDetails = null; + + +} + diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/Error.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/Error.java new file mode 100644 index 00000000000..2e169cf4ea6 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/Error.java @@ -0,0 +1,48 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import lombok.*; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import java.util.ArrayList; +import java.util.List; + +/** + * Error object will be returned as a part of reponse body in conjunction with ResponseInfo as part of ErrorResponse whenever the request processing status in the ResponseInfo is FAILED. HTTP return in this scenario will usually be HTTP 400. + */ +@ApiModel(description = "Error object will be returned as a part of reponse body in conjunction with ResponseInfo as part of ErrorResponse whenever the request processing status in the ResponseInfo is FAILED. HTTP return in this scenario will usually be HTTP 400.") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-10-25T21:43:19.662+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class Error { + @JsonProperty("code") + private String code = null; + + @JsonProperty("message") + private String message = null; + + @JsonProperty("description") + private String description = null; + + @JsonProperty("params") + @Valid + private List params = null; + + + public Error addParamsItem(String paramsItem) { + if (this.params == null) { + this.params = new ArrayList<>(); + } + this.params.add(paramsItem); + return this; + } + +} + diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/ErrorRes.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/ErrorRes.java new file mode 100644 index 00000000000..aadc513d943 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/ErrorRes.java @@ -0,0 +1,43 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import lombok.*; +import org.egov.common.contract.response.ResponseInfo; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import java.util.ArrayList; +import java.util.List; + +/** + * All APIs will return ErrorRes in case of failure which will carry ResponseInfo as metadata and Error object as actual representation of error. In case of bulk apis, some apis may chose to return the array of Error objects to indicate individual failure. + */ +@ApiModel(description = "All APIs will return ErrorRes in case of failure which will carry ResponseInfo as metadata and Error object as actual representation of error. In case of bulk apis, some apis may chose to return the array of Error objects to indicate individual failure.") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-10-25T21:43:19.662+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class ErrorRes { + @JsonProperty("ResponseInfo") + private ResponseInfo responseInfo = null; + + @JsonProperty("Errors") + @Valid + private List errors = null; + + + public ErrorRes addErrorsItem(Error errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); + } + this.errors.add(errorsItem); + return this; + } + +} + diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/FatherApplicant.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/FatherApplicant.java new file mode 100644 index 00000000000..b1aea741efc --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/FatherApplicant.java @@ -0,0 +1,142 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import lombok.*; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.List; + +/** + * Details of the user applying for birth registration + */ +@ApiModel(description = "Details of the user applying for birth registration") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-08-16T15:34:24.436+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class FatherApplicant { + @JsonProperty("id") + private String id = null; + + @JsonProperty("userName") + private String userName = null; + + @JsonProperty("password") + private String password = null; + + @JsonProperty("salutation") + private String salutation = null; + + @JsonProperty("name") + private String name = null; + + @JsonProperty("gender") + private String gender = null; + + @JsonProperty("mobileNumber") + private String mobileNumber = null; + + @JsonProperty("emailId") + private String emailId = null; + + @JsonProperty("altContactNumber") + private String altContactNumber = null; + + @JsonProperty("pan") + private String pan = null; + + @JsonProperty("aadhaarNumber") + private String aadhaarNumber = null; + + @JsonProperty("permanentAddress") + private String permanentAddress = null; + + @JsonProperty("permanentCity") + private String permanentCity = null; + + @JsonProperty("permanentPincode") + private String permanentPincode = null; + + @JsonProperty("correspondenceCity") + private String correspondenceCity = null; + + @JsonProperty("correspondencePincode") + private String correspondencePincode = null; + + @JsonProperty("correspondenceAddress") + private String correspondenceAddress = null; + + @JsonProperty("active") + private Boolean active = null; + + @JsonProperty("dob") + private LocalDate dob = null; + + @JsonProperty("pwdExpiryDate") + private LocalDate pwdExpiryDate = null; + + @JsonProperty("locale") + private String locale = null; + + @JsonProperty("type") + private String type = null; + + @JsonProperty("signature") + private String signature = null; + + @JsonProperty("accountLocked") + private Boolean accountLocked = null; + + @JsonProperty("roles") + @Valid + private List roles = null; + + @JsonProperty("fatherOrHusbandName") + private String fatherOrHusbandName = null; + + @JsonProperty("bloodGroup") + private String bloodGroup = null; + + @JsonProperty("identificationMark") + private String identificationMark = null; + + @JsonProperty("photo") + private String photo = null; + + @JsonProperty("createdBy") + private Long createdBy = null; + + @JsonProperty("createdDate") + private LocalDate createdDate = null; + + @JsonProperty("lastModifiedBy") + private Long lastModifiedBy = null; + + @JsonProperty("lastModifiedDate") + private LocalDate lastModifiedDate = null; + + @JsonProperty("otpReference") + private String otpReference = null; + + @JsonProperty("tenantId") + private String tenantId = null; + + + public FatherApplicant addRolesItem(Role rolesItem) { + if (this.roles == null) { + this.roles = new ArrayList<>(); + } + this.roles.add(rolesItem); + return this; + } + +} + diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/IdGenerationRequest.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/IdGenerationRequest.java new file mode 100644 index 00000000000..991c42964e4 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/IdGenerationRequest.java @@ -0,0 +1,23 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.egov.common.contract.request.RequestInfo; + +import java.util.List; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class IdGenerationRequest { + + @JsonProperty("RequestInfo") + private RequestInfo requestInfo; + + private List idRequests; + +} \ No newline at end of file diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/IdGenerationResponse.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/IdGenerationResponse.java new file mode 100644 index 00000000000..97d50b46808 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/IdGenerationResponse.java @@ -0,0 +1,22 @@ +package digit.web.models; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.egov.common.contract.response.ResponseInfo; + +import java.util.List; + + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class IdGenerationResponse { + + private ResponseInfo responseInfo; + + private List idResponses; + +} diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/IdRequest.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/IdRequest.java new file mode 100644 index 00000000000..908ca689e91 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/IdRequest.java @@ -0,0 +1,28 @@ +package digit.web.models; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotNull; + + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class IdRequest { + + @JsonProperty("idName") + @NotNull + private String idName; + + @NotNull + @JsonProperty("tenantId") + private String tenantId; + + @JsonProperty("format") + private String format; + +} diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/IdResponse.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/IdResponse.java new file mode 100644 index 00000000000..45c3dbc6f51 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/IdResponse.java @@ -0,0 +1,17 @@ +package digit.web.models; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class IdResponse { + + private String id; + +} \ No newline at end of file diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/MotherApplicant.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/MotherApplicant.java new file mode 100644 index 00000000000..a731c702647 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/MotherApplicant.java @@ -0,0 +1,142 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import lombok.*; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.List; + +/** + * Details of the user applying for birth registration + */ +@ApiModel(description = "Details of the user applying for birth registration") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-08-16T15:34:24.436+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class MotherApplicant { + @JsonProperty("id") + private String id = null; + + @JsonProperty("userName") + private String userName = null; + + @JsonProperty("password") + private String password = null; + + @JsonProperty("salutation") + private String salutation = null; + + @JsonProperty("name") + private String name = null; + + @JsonProperty("gender") + private String gender = null; + + @JsonProperty("mobileNumber") + private String mobileNumber = null; + + @JsonProperty("emailId") + private String emailId = null; + + @JsonProperty("altContactNumber") + private String altContactNumber = null; + + @JsonProperty("pan") + private String pan = null; + + @JsonProperty("aadhaarNumber") + private String aadhaarNumber = null; + + @JsonProperty("permanentAddress") + private String permanentAddress = null; + + @JsonProperty("permanentCity") + private String permanentCity = null; + + @JsonProperty("permanentPincode") + private String permanentPincode = null; + + @JsonProperty("correspondenceCity") + private String correspondenceCity = null; + + @JsonProperty("correspondencePincode") + private String correspondencePincode = null; + + @JsonProperty("correspondenceAddress") + private String correspondenceAddress = null; + + @JsonProperty("active") + private Boolean active = null; + + @JsonProperty("dob") + private LocalDate dob = null; + + @JsonProperty("pwdExpiryDate") + private LocalDate pwdExpiryDate = null; + + @JsonProperty("locale") + private String locale = null; + + @JsonProperty("type") + private String type = null; + + @JsonProperty("signature") + private String signature = null; + + @JsonProperty("accountLocked") + private Boolean accountLocked = null; + + @JsonProperty("roles") + @Valid + private List roles = null; + + @JsonProperty("fatherOrHusbandName") + private String fatherOrHusbandName = null; + + @JsonProperty("bloodGroup") + private String bloodGroup = null; + + @JsonProperty("identificationMark") + private String identificationMark = null; + + @JsonProperty("photo") + private String photo = null; + + @JsonProperty("createdBy") + private Long createdBy = null; + + @JsonProperty("createdDate") + private LocalDate createdDate = null; + + @JsonProperty("lastModifiedBy") + private Long lastModifiedBy = null; + + @JsonProperty("lastModifiedDate") + private LocalDate lastModifiedDate = null; + + @JsonProperty("otpReference") + private String otpReference = null; + + @JsonProperty("tenantId") + private String tenantId = null; + + + public MotherApplicant addRolesItem(Role rolesItem) { + if (this.roles == null) { + this.roles = new ArrayList<>(); + } + this.roles.add(rolesItem); + return this; + } + +} + diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/Payment.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/Payment.java new file mode 100644 index 00000000000..7ce384e2045 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/Payment.java @@ -0,0 +1,109 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.JsonNode; +import lombok.*; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +@EqualsAndHashCode +public class Payment { + + @Size(max = 64) + @JsonProperty("id") + private String id; + + @NotNull + @Size(max = 64) + @JsonProperty("tenantId") + private String tenantId; + + @JsonProperty("totalDue") + private BigDecimal totalDue; + + @NotNull + @JsonProperty("totalAmountPaid") + private BigDecimal totalAmountPaid; + + @Size(max = 128) + @JsonProperty("transactionNumber") + private String transactionNumber; + + @JsonProperty("transactionDate") + private Long transactionDate; + + @NotNull + @JsonProperty("paymentMode") + private String paymentMode; + + @JsonProperty("instrumentDate") + private Long instrumentDate; + + @Size(max = 128) + @JsonProperty("instrumentNumber") + private String instrumentNumber; + + @JsonProperty("instrumentStatus") + private String instrumentStatus; + + @Size(max = 64) + @JsonProperty("ifscCode") + private String ifscCode; + + @JsonProperty("auditDetails") + private AuditDetails auditDetails; + + @JsonProperty("additionalDetails") + private JsonNode additionalDetails; + + @JsonProperty("paymentDetails") + @Valid + private List paymentDetails; + + @Size(max = 128) + @NotNull + @JsonProperty("paidBy") + private String paidBy; + + @Size(max = 64) + @NotNull + @JsonProperty("mobileNumber") + private String mobileNumber; + + @Size(max = 128) + @JsonProperty("payerName") + private String payerName; + + @Size(max = 1024) + @JsonProperty("payerAddress") + private String payerAddress; + + @Size(max = 64) + @JsonProperty("payerEmail") + private String payerEmail; + + @Size(max = 64) + @JsonProperty("payerId") + private String payerId; + + @JsonProperty("paymentStatus") + private String paymentStatus; + + public Payment addpaymentDetailsItem(PaymentDetail paymentDetail) { + if (this.paymentDetails == null) { + this.paymentDetails = new ArrayList<>(); + } + this.paymentDetails.add(paymentDetail); + return this; + } + +} diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/PaymentDetail.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/PaymentDetail.java new file mode 100644 index 00000000000..bd56b4519b4 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/PaymentDetail.java @@ -0,0 +1,67 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.JsonNode; +import lombok.*; + +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.math.BigDecimal; + +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +@EqualsAndHashCode +public class PaymentDetail { + + @Size(max = 64) + @JsonProperty("id") + private String id; + + @Size(max = 64) + @JsonProperty("tenantId") + private String tenantId; + + @JsonProperty("totalDue") + private BigDecimal totalDue; + + @NotNull + @JsonProperty("totalAmountPaid") + private BigDecimal totalAmountPaid; + + @Size(max = 64) + @JsonProperty("receiptNumber") + private String receiptNumber; + + @Size(max = 64) + @JsonProperty("manualReceiptNumber") + private String manualReceiptNumber; + + @JsonProperty("manualReceiptDate") + private Long manualReceiptDate; + + @JsonProperty("receiptDate") + private Long receiptDate; + + @JsonProperty("receiptType") + private String receiptType; + + @JsonProperty("businessService") + private String businessService; + + @NotNull + @Size(max = 64) + @JsonProperty("billId") + private String billId; + + @JsonProperty("bill") + private Bill bill; + + @JsonProperty("additionalDetails") + private JsonNode additionalDetails; + + @JsonProperty("auditDetails") + private AuditDetails auditDetails; + +} diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/PaymentRequest.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/PaymentRequest.java new file mode 100644 index 00000000000..d2eb9ee7cad --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/PaymentRequest.java @@ -0,0 +1,28 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.egov.common.contract.request.RequestInfo; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; + + +@Data +@NoArgsConstructor +@AllArgsConstructor +public class PaymentRequest { + + @NotNull + @Valid + @JsonProperty("RequestInfo") + private RequestInfo requestInfo; + + @NotNull + @Valid + @JsonProperty("Payment") + private Payment payment; + +} \ No newline at end of file diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/ProcessInstance.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/ProcessInstance.java new file mode 100644 index 00000000000..e581662cf24 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/ProcessInstance.java @@ -0,0 +1,73 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.util.ArrayList; +import java.util.List; + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +@EqualsAndHashCode(of = { "id" }) +@ToString +public class ProcessInstance { + + @Size(max = 64) + @JsonProperty("id") + private String id; + + @NotNull + @Size(max = 128) + @JsonProperty("tenantId") + private String tenantId; + + @NotNull + @Size(max = 128) + @JsonProperty("businessService") + private String businessService; + + @NotNull + @Size(max = 128) + @JsonProperty("businessId") + private String businessId; + + @NotNull + @Size(max = 128) + @JsonProperty("action") + private String action; + + @NotNull + @Size(max = 64) + @JsonProperty("moduleName") + private String moduleName; + + @JsonProperty("state") + private State state; + + @JsonProperty("comment") + private String comment; + + @JsonProperty("documents") + @Valid + private List documents; + + @JsonProperty("assignes") + private List assignes; + + public ProcessInstance addDocumentsItem(Document documentsItem) { + if (this.documents == null) { + this.documents = new ArrayList<>(); + } + if (!this.documents.contains(documentsItem)) + this.documents.add(documentsItem); + + return this; + } + +} \ No newline at end of file diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/ProcessInstanceRequest.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/ProcessInstanceRequest.java new file mode 100644 index 00000000000..25603738136 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/ProcessInstanceRequest.java @@ -0,0 +1,37 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; +import org.egov.common.contract.request.RequestInfo; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import java.util.ArrayList; +import java.util.List; + + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +@ToString +public class ProcessInstanceRequest { + @JsonProperty("RequestInfo") + private RequestInfo requestInfo; + + @JsonProperty("ProcessInstances") + @Valid + @NotNull + private List processInstances; + + + public ProcessInstanceRequest addProcessInstanceItem(ProcessInstance processInstanceItem) { + if (this.processInstances == null) { + this.processInstances = new ArrayList<>(); + } + this.processInstances.add(processInstanceItem); + return this; + } + +} \ No newline at end of file diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/ProcessInstanceResponse.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/ProcessInstanceResponse.java new file mode 100644 index 00000000000..31cacadf997 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/ProcessInstanceResponse.java @@ -0,0 +1,33 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; +import org.egov.common.contract.response.ResponseInfo; + +import javax.validation.Valid; +import java.util.ArrayList; +import java.util.List; + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class ProcessInstanceResponse { + @JsonProperty("ResponseInfo") + private ResponseInfo responseInfo; + + @JsonProperty("ProcessInstances") + @Valid + private List processInstances; + + + public ProcessInstanceResponse addProceInstanceItem(ProcessInstance proceInstanceItem) { + if (this.processInstances == null) { + this.processInstances = new ArrayList<>(); + } + this.processInstances.add(proceInstanceItem); + return this; + } + +} \ No newline at end of file diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/RequestInfoWrapper.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/RequestInfoWrapper.java new file mode 100644 index 00000000000..160a6d3b93f --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/RequestInfoWrapper.java @@ -0,0 +1,17 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; +import org.egov.common.contract.request.RequestInfo; + + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class RequestInfoWrapper { + + @JsonProperty("RequestInfo") + private RequestInfo requestInfo; +} diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/Role.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/Role.java new file mode 100644 index 00000000000..1d3301a80c3 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/Role.java @@ -0,0 +1,50 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; +import org.springframework.validation.annotation.Validated; + +import java.time.LocalDate; + +/** + * Role + */ +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-10-25T21:43:19.662+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class Role { + @JsonProperty("id") + private Long id = null; + + @JsonProperty("name") + private String name = null; + + @JsonProperty("code") + private String code = null; + + @JsonProperty("description") + private String description = null; + + @JsonProperty("createdBy") + private Long createdBy = null; + + @JsonProperty("createdDate") + private LocalDate createdDate = null; + + @JsonProperty("lastModifiedBy") + private Long lastModifiedBy = null; + + @JsonProperty("lastModifiedDate") + private LocalDate lastModifiedDate = null; + + @JsonProperty("tenantId") + private String tenantId = null; + + +} + diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/Role2.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/Role2.java new file mode 100644 index 00000000000..4448dd5b5ad --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/Role2.java @@ -0,0 +1,32 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import lombok.*; +import org.springframework.validation.annotation.Validated; + +/** + * minimal representation of the Roles in the system to be carried along in UserInfo with RequestInfo meta data. Actual authorization service to extend this to have more role related attributes + */ +@ApiModel(description = "minimal representation of the Roles in the system to be carried along in UserInfo with RequestInfo meta data. Actual authorization service to extend this to have more role related attributes ") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-10-25T21:43:19.662+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class Role2 { + @JsonProperty("name") + private String name = null; + + @JsonProperty("code") + private String code = null; + + @JsonProperty("description") + private String description = null; + + +} + diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/SMSRequest.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/SMSRequest.java new file mode 100644 index 00000000000..0b753f5cfe2 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/SMSRequest.java @@ -0,0 +1,13 @@ +package digit.web.models; + +import lombok.*; + +@Getter +@AllArgsConstructor +@NoArgsConstructor +@Builder +@ToString +public class SMSRequest { + private String mobileNumber; + private String message; +} diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/State.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/State.java new file mode 100644 index 00000000000..352bd27fc87 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/State.java @@ -0,0 +1,70 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; + +import javax.validation.Valid; +import javax.validation.constraints.Size; +import java.util.ArrayList; +import java.util.List; + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +@ToString +@EqualsAndHashCode(of = {"tenantId","businessServiceId","state"}) +public class State { + + @Size(max=256) + @JsonProperty("uuid") + private String uuid; + + @Size(max=256) + @JsonProperty("tenantId") + private String tenantId; + + @Size(max=256) + @JsonProperty("businessServiceId") + private String businessServiceId; + + @JsonProperty("sla") + private Long sla; + + @Size(max=256) + @JsonProperty("state") + private String state; + + @Size(max=256) + @JsonProperty("applicationStatus") + private String applicationStatus; + + @JsonProperty("docUploadRequired") + private Boolean docUploadRequired; + + @JsonProperty("isStartState") + private Boolean isStartState; + + @JsonProperty("isTerminateState") + private Boolean isTerminateState; + + @JsonProperty("isStateUpdatable") + private Boolean isStateUpdatable; + + @JsonProperty("actions") + @Valid + private List actions; + + private AuditDetails auditDetails; + + + public State addActionsItem(Action actionsItem) { + if (this.actions == null) { + this.actions = new ArrayList<>(); + } + this.actions.add(actionsItem); + return this; + } + +} \ No newline at end of file diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/TenantRole.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/TenantRole.java new file mode 100644 index 00000000000..f813d179acc --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/TenantRole.java @@ -0,0 +1,39 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import lombok.*; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import java.util.ArrayList; +import java.util.List; + +/** + * User role carries the tenant related role information for the user. A user can have multiple roles per tenant based on the need of the tenant. A user may also have multiple roles for multiple tenants. + */ +@ApiModel(description = "User role carries the tenant related role information for the user. A user can have multiple roles per tenant based on the need of the tenant. A user may also have multiple roles for multiple tenants.") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-10-25T21:43:19.662+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class TenantRole { + @JsonProperty("tenantId") + private String tenantId = null; + + @JsonProperty("roles") + @Valid + private List roles = new ArrayList<>(); + + + public TenantRole addRolesItem(Role rolesItem) { + this.roles.add(rolesItem); + return this; + } + +} + diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/User.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/User.java new file mode 100644 index 00000000000..917f7f0129c --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/User.java @@ -0,0 +1,130 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import java.util.ArrayList; +import java.util.List; + +/** + * User + */ +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-08-16T15:34:24.436+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +@ToString +public class User { + @JsonProperty("id") + private Long id = null; + + @JsonProperty("uuid") + private String uuid = null; + + @JsonProperty("userName") + private String userName = null; + + @JsonProperty("password") + private String password = null; + + @JsonProperty("salutation") + private String salutation = null; + + @JsonProperty("name") + private String name = null; + + @JsonProperty("gender") + private String gender = null; + + @JsonProperty("mobileNumber") + private String mobileNumber = null; + + @JsonProperty("emailId") + private String emailId = null; + + @JsonProperty("altContactNumber") + private String altContactNumber = null; + + @JsonProperty("pan") + private String pan = null; + + @JsonProperty("aadhaarNumber") + private String aadhaarNumber = null; + + @JsonProperty("permanentAddress") + private String permanentAddress = null; + + @JsonProperty("permanentCity") + private String permanentCity = null; + + @JsonProperty("permanentPincode") + private String permanentPincode = null; + + + @JsonProperty("roles") + @Valid + private List roles = null;@JsonProperty("correspondenceCity") + private String correspondenceCity = null; + + @JsonProperty("correspondencePincode") + private String correspondencePincode = null; + + @JsonProperty("correspondenceAddress") + private String correspondenceAddress = null; + + @JsonProperty("active") + private Boolean active = null; + + @JsonProperty("locale") + private String locale = null; + + @JsonProperty("type") + private String type = null; + + @JsonProperty("signature") + private String signature = null; + + @JsonProperty("accountLocked") + private Boolean accountLocked = null; + + @JsonProperty("fatherOrHusbandName") + private String fatherOrHusbandName = null; + + @JsonProperty("bloodGroup") + private String bloodGroup = null; + + @JsonProperty("identificationMark") + private String identificationMark = null; + + @JsonProperty("photo") + private String photo = null; + + @JsonProperty("createdBy") + private Long createdBy = null; + + @JsonProperty("lastModifiedBy") + private Long lastModifiedBy = null; + + @JsonProperty("otpReference") + private String otpReference = null; + + @JsonProperty("tenantId") + private String tenantId = null; + + + public User addRolesItem(Role rolesItem) { + if (this.roles == null) { + this.roles = new ArrayList<>(); + } + this.roles.add(rolesItem); + return this; + } + +} + diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/UserDetailResponse.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/UserDetailResponse.java new file mode 100644 index 00000000000..4571b31d29e --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/UserDetailResponse.java @@ -0,0 +1,22 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.ToString; +import org.egov.common.contract.response.ResponseInfo; + +import java.util.List; + +@AllArgsConstructor +@NoArgsConstructor +@Getter +@ToString +public class UserDetailResponse { + @JsonProperty("responseInfo") + ResponseInfo responseInfo; + + @JsonProperty("user") + List user; +} \ No newline at end of file diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/UserInfo.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/UserInfo.java new file mode 100644 index 00000000000..173898eddef --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/UserInfo.java @@ -0,0 +1,69 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import lombok.*; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import java.util.ArrayList; +import java.util.List; + +/** + * This is acting ID token of the authenticated user on the server. Any value provided by the clients will be ignored and actual user based on authtoken will be used on the server. + */ +@ApiModel(description = "This is acting ID token of the authenticated user on the server. Any value provided by the clients will be ignored and actual user based on authtoken will be used on the server.") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-10-25T21:43:19.662+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class UserInfo { + @JsonProperty("tenantId") + private String tenantId = null; + + @JsonProperty("uuid") + private String uuid = null; + + @JsonProperty("userName") + private String userName = null; + + @JsonProperty("password") + private String password = null; + + @JsonProperty("idToken") + private String idToken = null; + + @JsonProperty("mobile") + private String mobile = null; + + @JsonProperty("email") + private String email = null; + + @JsonProperty("primaryrole") + @Valid + private List primaryrole = new ArrayList<>(); + + @JsonProperty("additionalroles") + @Valid + private List additionalroles = null; + + + public UserInfo addPrimaryroleItem(Role primaryroleItem) { + this.primaryrole.add(primaryroleItem); + return this; + } + + public UserInfo addAdditionalrolesItem(TenantRole additionalrolesItem) { + if (this.additionalroles == null) { + this.additionalroles = new ArrayList<>(); + } + this.additionalroles.add(additionalrolesItem); + return this; + } + +} + diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/UserSearchRequest.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/UserSearchRequest.java new file mode 100644 index 00000000000..48d9a7dd0de --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/UserSearchRequest.java @@ -0,0 +1,68 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Getter; +import lombok.Setter; +import org.egov.common.contract.request.RequestInfo; + +import java.util.Collections; +import java.util.List; + + +@Getter +@Setter +public class UserSearchRequest { + + @JsonProperty("RequestInfo") + private RequestInfo requestInfo; + + @JsonProperty("uuid") + private List uuid; + + @JsonProperty("id") + private List id; + + @JsonProperty("userName") + private String userName; + + @JsonProperty("name") + private String name; + + @JsonProperty("mobileNumber") + private String mobileNumber; + + @JsonProperty("aadhaarNumber") + private String aadhaarNumber; + + @JsonProperty("pan") + private String pan; + + @JsonProperty("emailId") + private String emailId; + + @JsonProperty("fuzzyLogic") + private boolean fuzzyLogic; + + @JsonProperty("active") + @Setter + private Boolean active; + + @JsonProperty("tenantId") + private String tenantId; + + @JsonProperty("pageSize") + private int pageSize; + + @JsonProperty("pageNumber") + private int pageNumber = 0; + + @JsonProperty("sort") + private List sort = Collections.singletonList("name"); + + @JsonProperty("userType") + private String userType; + + @JsonProperty("roleCodes") + private List roleCodes; + +} \ No newline at end of file diff --git a/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/Workflow.java b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/Workflow.java new file mode 100644 index 00000000000..121136b6d4b --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/java/digit/web/models/Workflow.java @@ -0,0 +1,51 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import lombok.*; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import java.util.ArrayList; +import java.util.List; + +/** + * Fields related to workflow service + */ +@ApiModel(description = "Fields related to workflow service") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-08-16T15:34:24.436+05:30") + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class Workflow { + @JsonProperty("action") + private String action = null; + + @JsonProperty("status") + private String status = null; + + @JsonProperty("comments") + private String comments = null; + + @JsonProperty("documents") + @Valid + private List documents = null; + + @JsonProperty("assignes") + @Valid + private List assignes = null; + + public Workflow addDocumentsItem(Document documentsItem) { + if (this.documents == null) { + this.documents = new ArrayList<>(); + } + this.documents.add(documentsItem); + return this; + } + +} + diff --git a/tutorials/Assignment-5/btr-services/src/main/resources/application.properties b/tutorials/Assignment-5/btr-services/src/main/resources/application.properties new file mode 100644 index 00000000000..46cfa8869e2 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/resources/application.properties @@ -0,0 +1,93 @@ +server.contextPath=/birth-registration +server.port=8280 +app.timezone=UTC + +# BTR config +btr.kafka.create.topic=save-bt-application +btr.kafka.update.topic=update-bt-application +btr.default.offset=0 +btr.default.limit=10 +btr.search.max.limit=50 + +#DATABASE CONFIGURATION +spring.datasource.driver-class-name=org.postgresql.Driver +spring.datasource.url=jdbc:postgresql://localhost:5432/birthdb +spring.datasource.username=postgres +spring.datasource.password=postgres + +#FLYWAY CONFIGURATION +spring.flyway.url=jdbc:postgresql://localhost:5432/birthdb +spring.flyway.user=postgres +spring.flyway.password=postgres +spring.flyway.table=public +spring.flyway.baseline-on-migrate=true +spring.flyway.outOfOrder=true +spring.flyway.locations=classpath:/db/migration/main +spring.flyway.enabled=true + +# KAFKA SERVER CONFIGURATIONS +kafka.config.bootstrap_server_config=localhost:9092 +spring.kafka.consumer.value-deserializer=org.egov.tracer.kafka.deserializer.HashMapDeserializer +spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer +spring.kafka.consumer.group-id=birth-registration +spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer +spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer +spring.kafka.listener.missing-topics-fatal=false +spring.kafka.consumer.properties.spring.json.use.type.headers=false + +# KAFKA CONSUMER CONFIGURATIONS +kafka.consumer.config.auto_commit=true +kafka.consumer.config.auto_commit_interval=100 +kafka.consumer.config.session_timeout=15000 +kafka.consumer.config.auto_offset_reset=earliest +# KAFKA PRODUCER CONFIGURATIONS +kafka.producer.config.retries_config=0 +kafka.producer.config.batch_size_config=16384 +kafka.producer.config.linger_ms_config=1 +kafka.producer.config.buffer_memory_config=33554432 + +##Localization config +#egov.localization.host=https://dev.digit.org +#egov.localization.workDir.path=/localization/messages/v1 +#egov.localization.context.path=/localization/messages/v1 +#egov.localization.search.endpoint=/_search +#egov.localization.statelevel=true + +#mdms urls +egov.mdms.host=https://dev.digit.org +egov.mdms.search.endpoint=/egov-mdms-service/v1/_search +egov.mdms.master.name=RegistrationCharges +egov.mdms.module.name=BTR + +##hrms urls +#egov.hrms.host=https://dev.digit.org +#egov.hrms.search.endpoint=/egov-hrms/employees/_search + +#User config +egov.user.host=http://localhost:8081 +egov.user.context.path=/user/users +egov.user.create.path=/_createnovalidate +egov.user.search.path=/user/_search +egov.user.update.path=/_updatenovalidate + +#Idgen Config +egov.idgen.host=http://localhost:8012/ +egov.idgen.path=egov-idgen/id/_generate + +#Workflow config +is.workflow.enabled=true +egov.workflow.host=http://localhost:8013 +egov.workflow.transition.path=/egov-workflow-v2/egov-wf/process/_transition +egov.workflow.businessservice.search.path=/egov-workflow-v2/egov-wf/businessservice/_search +egov.workflow.processinstance.search.path=/egov-workflow-v2/egov-wf/process/_search + +#BTR Calculator +egov.btrcalculator.host=http://localhost:2345 +egov.btrcalculator.endpoint=/birth-calculator/v1/_calculate + +##url shortner +egov.url.shortner.host=https://dev.digit.org +egov.url.shortner.endpoint=/egov-url-shortening/shortener + +egov.sms.notification.topic=egov.core.notification.sms +kafka.topics.receipt.create=dss-collection diff --git a/tutorials/Assignment-5/btr-services/src/main/resources/db/migration/main/V20220816155959__bt_registration_ddl.sql b/tutorials/Assignment-5/btr-services/src/main/resources/db/migration/main/V20220816155959__bt_registration_ddl.sql new file mode 100644 index 00000000000..1df6ed3bbaa --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/main/resources/db/migration/main/V20220816155959__bt_registration_ddl.sql @@ -0,0 +1,46 @@ +CREATE TABLE eg_bt_registration( + id character varying(64), + tenantId character varying(64), + applicationNumber character varying(64), + babyFirstName character varying(64), + babyLastName character varying(64), + fatherId character varying(64), + motherId character varying(64), + doctorNme character varying(64), + hospitalNme character varying(64), + placeOfBirth character varying(64), + timeOfBirth bigint, + createdBy character varying(64), + lastModifiedBy character varying(64), + createdTime bigint, + lastModifiedTime bigint, + CONSTRAINT uk_eg_bt_registration UNIQUE (id) +); +CREATE TABLE eg_bt_address( + id character varying(64), + tenantId character varying(64), + doorNo character varying(64), + latitude FLOAT, + longitude FLOAT, + buildingName character varying(64), + addressId character varying(64), + addressNumber character varying(64), + type character varying(64), + addressLine1 character varying(256), + addressLine2 character varying(256), + landmark character varying(64), + street character varying(64), + city character varying(64), + locality character varying(64), + pincode character varying(64), + detail character varying(64), + registrationId character varying(64), + createdBy character varying(64), + lastModifiedBy character varying(64), + createdTime bigint, + lastModifiedTime bigint, + CONSTRAINT uk_eg_bt_address PRIMARY KEY (id), + CONSTRAINT fk_eg_bt_address FOREIGN KEY (registrationId) REFERENCES eg_bt_registration (id) + ON UPDATE CASCADE + ON DELETE CASCADE +); diff --git a/tutorials/Assignment-5/btr-services/src/test/java/digit/TestConfiguration.java b/tutorials/Assignment-5/btr-services/src/test/java/digit/TestConfiguration.java new file mode 100644 index 00000000000..570236cfc94 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/test/java/digit/TestConfiguration.java @@ -0,0 +1,16 @@ +package digit; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.kafka.core.KafkaTemplate; + +import static org.mockito.Mockito.mock; + +@Configuration +public class TestConfiguration { + @Bean + @SuppressWarnings("unchecked") + public KafkaTemplate kafkaTemplate() { + return mock(KafkaTemplate.class); + } +} \ No newline at end of file diff --git a/tutorials/Assignment-5/btr-services/src/test/java/digit/web/controllers/V1ApiControllerTest.java b/tutorials/Assignment-5/btr-services/src/test/java/digit/web/controllers/V1ApiControllerTest.java new file mode 100644 index 00000000000..2156a279a29 --- /dev/null +++ b/tutorials/Assignment-5/btr-services/src/test/java/digit/web/controllers/V1ApiControllerTest.java @@ -0,0 +1,72 @@ +package digit.web.controllers; + +import org.junit.Test; +import org.junit.Ignore; +import org.junit.runner.RunWith; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.context.annotation.Import; +import org.springframework.http.MediaType; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import digit.TestConfiguration; + +import static org.mockito.Matchers.any; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +/** +* API tests for V1ApiController +*/ +@Ignore +@RunWith(SpringRunner.class) +@WebMvcTest(V1ApiController.class) +@Import(TestConfiguration.class) +public class V1ApiControllerTest { + + @Autowired + private MockMvc mockMvc; + + @Test + public void v1RegistrationCreatePostSuccess() throws Exception { + mockMvc.perform(post("/birth-services/v1/registration/_create").contentType(MediaType + .APPLICATION_JSON_UTF8)) + .andExpect(status().isOk()); + } + + @Test + public void v1RegistrationCreatePostFailure() throws Exception { + mockMvc.perform(post("/birth-services/v1/registration/_create").contentType(MediaType + .APPLICATION_JSON_UTF8)) + .andExpect(status().isBadRequest()); + } + + @Test + public void v1RegistrationSearchPostSuccess() throws Exception { + mockMvc.perform(post("/birth-services/v1/registration/_search").contentType(MediaType + .APPLICATION_JSON_UTF8)) + .andExpect(status().isOk()); + } + + @Test + public void v1RegistrationSearchPostFailure() throws Exception { + mockMvc.perform(post("/birth-services/v1/registration/_search").contentType(MediaType + .APPLICATION_JSON_UTF8)) + .andExpect(status().isBadRequest()); + } + + @Test + public void v1RegistrationUpdatePostSuccess() throws Exception { + mockMvc.perform(post("/birth-services/v1/registration/_update").contentType(MediaType + .APPLICATION_JSON_UTF8)) + .andExpect(status().isOk()); + } + + @Test + public void v1RegistrationUpdatePostFailure() throws Exception { + mockMvc.perform(post("/birth-services/v1/registration/_update").contentType(MediaType + .APPLICATION_JSON_UTF8)) + .andExpect(status().isBadRequest()); + } + +}