CRM Api added

CRM Api added
ACONNECT-CRM-API
Naeem Ullah 1 month ago
parent 1e375887e5
commit 2426fb7c7e

@ -1,7 +1,34 @@
package com.mfsys.aconnect.client.controller; package com.mfsys.aconnect.client.controller;
import com.mfsys.aconnect.client.dto.WorkflowRequestDTO;
import com.mfsys.aconnect.client.service.CRMService;
import com.mfsys.common.configuration.constant.AconnectURI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
public class CRMController { public class CRMController {
@Autowired
private CRMService crmService;
@Autowired
public CRMController(CRMService crmService) {
this.crmService = crmService;
}
@PostMapping(AconnectURI.INDIVIDUAL_CRM_CREATION_URI)
public Object createIndividualCRM(@RequestBody WorkflowRequestDTO workflowRequestDTO,
@RequestHeader("Authorization") String token) {
return crmService.createIndividualCRM(workflowRequestDTO, token);
}
@PostMapping(AconnectURI.BUSINESS_CRM_CREATION_URI)
public Object createBusinessCRM(@RequestBody WorkflowRequestDTO workflowRequestDTO,
@RequestHeader("Authorization") String token) {
return crmService.createBusinessCRM(workflowRequestDTO, token);
}
} }

@ -0,0 +1,39 @@
package com.mfsys.aconnect.client.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.util.List;
import java.util.Map;
@Data
public class WorkflowRequestDTO {
private String workFlowId;
@JsonProperty("SUS_USERCODE")
private String susUsercode;
private Map<String, Object> filesMap;
private List<AutoIncrementField> autoIncrementFields;
private String formId;
private String postProcessFormId;
private String payload;
private String operation;
@JsonProperty("POR_ORGACODE")
private String porOrgacode;
private List<List<String>> uniqueConstraints;
private List<Object> formCounters;
@Data
public static class AutoIncrementField {
private String key;
private String type;
private List<Object> position;
private Boolean incrementByCategoryTag;
private Boolean incrementIfFlowTerminated;
}
}

@ -0,0 +1,61 @@
package com.mfsys.aconnect.client.service;
import com.mfsys.aconnect.client.dto.WorkflowRequestDTO;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.*;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import java.util.Map;
@Service
public class CRMService {
@Value("${app.crm.uri}")
private String crmURI;
private final RestTemplate restTemplate = new RestTemplate();
public Object createIndividualCRM(WorkflowRequestDTO workflowRequestDTO, String token) {
String porOrgacode = workflowRequestDTO.getPorOrgacode();
String url = crmURI + "/crm" + "/mongodb/formdata" ;
HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", token);
headers.set("POR_ORGACODE", porOrgacode);
headers.set("SUS_USERCODE", workflowRequestDTO.getSusUsercode());
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity<WorkflowRequestDTO> entity = new HttpEntity<>(workflowRequestDTO, headers);
ResponseEntity<Map> response = restTemplate.exchange(
url,
HttpMethod.POST,
entity,
Map.class
);
return ResponseEntity.status(response.getStatusCode()).body(response.getBody());
}
public Object createBusinessCRM(WorkflowRequestDTO workflowRequestDTO, String token) {
String porOrgacode = workflowRequestDTO.getPorOrgacode();
String url = crmURI + "/crm" + "/mongodb/formdata" ;
HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", token);
headers.set("POR_ORGACODE", porOrgacode);
headers.set("SUS_USERCODE", workflowRequestDTO.getSusUsercode());
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity<WorkflowRequestDTO> entity = new HttpEntity<>(workflowRequestDTO, headers);
ResponseEntity<Map> response = restTemplate.exchange(
url,
HttpMethod.POST,
entity,
Map.class
);
return ResponseEntity.status(response.getStatusCode()).body(response.getBody());
}
}

@ -2,5 +2,7 @@ app.security.uri=http://localhost:9090/security/auth/user
app.deposit.uri=http://localhost:9095 app.deposit.uri=http://localhost:9095
app.generalledger.uri=http://localhost:9093 app.generalledger.uri=http://localhost:9093
app.onlinebanking.uri=http://localhost:9099 app.onlinebanking.uri=http://localhost:9099
app.crm.uri=http://localhost:9096
app.loan.uri=http://localhost:9094
app.organization.uri=0005 app.organization.uri=0005

@ -4,11 +4,15 @@ public interface AconnectURI {
String ACONNECT = "/aconnect"; String ACONNECT = "/aconnect";
String REFRESH_TOKEN = "/refreshtoken"; String REFRESH_TOKEN = "/refreshtoken";
String DEPOSIT = "/deposit"; String DEPOSIT = "/deposit";
String CRM = "/crm";
String LOAN = "/loan";
String GENERALLEDGER = "/generalledger"; String GENERALLEDGER = "/generalledger";
String SIGNIN = "/signin"; String SIGNIN = "/signin";
String TRANSACTION_URI = "/transactions"; String TRANSACTION_URI = "/transactions";
String CANCEL_URI = "/cancel"; String CANCEL_URI = "/cancel";
String REJECT_URI = "/rejection"; String REJECT_URI = "/rejection";
String INDIVIDUAL = "/individual";
String BUSINESS = "/business";
String REVERSE_URI = "/reversal"; String REVERSE_URI = "/reversal";
String AUTHORIZATION_URI = "/authorizations"; String AUTHORIZATION_URI = "/authorizations";
String DEPOSIT_AUTHORIZATION_URI = DEPOSIT + AUTHORIZATION_URI; String DEPOSIT_AUTHORIZATION_URI = DEPOSIT + AUTHORIZATION_URI;
@ -22,6 +26,13 @@ public interface AconnectURI {
String TRANSACTION_GL_GL_URI = TRANSACTION_URI + "/gltogls"; String TRANSACTION_GL_GL_URI = TRANSACTION_URI + "/gltogls";
String ACCOUNT_TO_ACCOUNT_TRANSACTION_URI = TRANSACTION_URI + "/accounttoaccount"; String ACCOUNT_TO_ACCOUNT_TRANSACTION_URI = TRANSACTION_URI + "/accounttoaccount";
String GL_TO_ACCOUNT_TRANSACTION_URI = TRANSACTION_URI + "/gl-account"; String GL_TO_ACCOUNT_TRANSACTION_URI = TRANSACTION_URI + "/gl-account";
String INDIVIDUAL_CRM_CREATION_URI = CRM + INDIVIDUAL + "/create";
String BUSINESS_CRM_CREATION_URI = CRM + BUSINESS + "/create";
String INDIVIDUAL_DEPOSIT_CREATION_URI = DEPOSIT + INDIVIDUAL + "/create";
String BUSINESS_DEPOSIT_CREATION_URI = DEPOSIT + BUSINESS + "/create";
String INDIVIDUAL_LOAN_CREATION_URI = LOAN + INDIVIDUAL + "/create";
String TRANSACTION_CANCEL_URI = TRANSACTION_URI + CANCEL_URI + "/nodes/{nodeId}/trannums/{sgtGntrtranlink}"; String TRANSACTION_CANCEL_URI = TRANSACTION_URI + CANCEL_URI + "/nodes/{nodeId}/trannums/{sgtGntrtranlink}";
String DEPOSIT_TRANSACTION_REJECT_URI = DEPOSIT + TRANSACTION_URI + REJECT_URI; String DEPOSIT_TRANSACTION_REJECT_URI = DEPOSIT + TRANSACTION_URI + REJECT_URI;
String GENERALLEDGER_TRANSACTION_REJECT_URI = GENERALLEDGER + TRANSACTION_URI + REJECT_URI; String GENERALLEDGER_TRANSACTION_REJECT_URI = GENERALLEDGER + TRANSACTION_URI + REJECT_URI;

@ -18,7 +18,10 @@ public interface TokenBypassURI {
"/aconnect/deposit/authorizations", "/aconnect/deposit/authorizations",
"/aconnect/generalledger/authorizations", "/aconnect/generalledger/authorizations",
"/aconnect/deposit/authorizations", "/aconnect/deposit/authorizations",
"/aconnect/crm/individual/create",
"/aconnect/crm/business/create",
"/aconnect/deposit/individual/create",
"/aconnect/deposit/business/create",
"/aconnect/deposit/transactions/cancel", "/aconnect/deposit/transactions/cancel",
"/aconnect/generalledger/transactions/cancel", "/aconnect/generalledger/transactions/cancel",

Loading…
Cancel
Save