[UCOD][23]- onboarding/digital/UcoCustomerAccount

UCOD-23
Omar Shahbaz 3 days ago
parent 9508dfc3b6
commit 131d7f6eef

@ -191,12 +191,12 @@ public class UcoAccountService {
} }
}); });
} }
String accountNumber = webClientDeposit.createUcoAccount(JsonToString(Map.of("payload",preparePayloadForAccount(customerProfile,addAccountRequestModel.getTitle()), String accountNumber = webClientDeposit.createUcoAccount(JsonToString(Map.of("payload",preparePayloadForAccount(customerProfile,addAccountRequestModel.getTitle(), addAccountRequestModel.getDmpProdcode()),
"uniqueConstraints",List.of(List.of(String.valueOf(addAccountRequestModel.getDmpProdcode()))))),UCOURI.UCO_CUSTOMER_ACCOUNT,porOrgacode); "uniqueConstraints",List.of(List.of(String.valueOf(addAccountRequestModel.getDmpProdcode()))))),UCOURI.UCO_CUSTOMER_ACCOUNT,porOrgacode);
saveCustomerAccountDetails(porOrgacode,customerProfile.getCmpCustcode(),accountNumber); saveCustomerAccountDetails(porOrgacode,customerProfile.getCmpCustcode(),accountNumber);
} }
public void saveCustomerAccountDetails(String porOrgacode, String cmpCustcode,String accountNumber){ public void saveCustomerAccountDetails(String porOrgacode, String cmpCustcode,String accountNumber){
fetchdepositAccountFromCiihive(porOrgacode, cmpCustcode).stream().forEach(k -> { fetchdepositAccountFromCiihive(porOrgacode, cmpCustcode).stream().forEach(k -> {
if(k.getMbmBkmsnumber().equals(accountNumber)){ if(k.getMbmBkmsnumber().equals(accountNumber)){
UcoAccount ucoAccount = UcoAccount.builder() UcoAccount ucoAccount = UcoAccount.builder()
@ -214,16 +214,19 @@ public void saveCustomerAccountDetails(String porOrgacode, String cmpCustcode,St
ucoAccountRepository.save(ucoAccount); ucoAccountRepository.save(ucoAccount);
} }
}); });
} }
public String preparePayloadForAccount(CustomerProfile customerProfile,String title){
Map<String,Object> jsonMap = new HashMap<>(); public String preparePayloadForAccount(CustomerProfile customerProfile, String title, String dmpProdcode) {
System.out.println(customerProfile);
Map<String, Object> jsonMap = new HashMap<>();
jsonMap.put("SUS_USERCODE", "01"); jsonMap.put("SUS_USERCODE", "01");
jsonMap.put("CMP_CUSTCODE",customerProfile.getCmpCustcode()); jsonMap.put("CMP_CUSTCODE", customerProfile.getCmpCustcode());
jsonMap.put("CMP_FULLNAME", title); jsonMap.put("CMP_FULLNAME", title);
jsonMap.put("PLC_LOCACODE", "2003"); jsonMap.put("PLC_LOCACODE", "0010");
jsonMap.put("workFlowStage", "BN_WF_CP_AUTHORIZATION"); jsonMap.put("workFlowStage", "BN_WF_CP_AUTHORIZATION");
jsonMap.put("PCT_CSTYCODE", "I"); jsonMap.put("PCT_CSTYCODE", "I");
jsonMap.put("POR_ORGACODE", customerProfile.getPorOrgacode()); jsonMap.put("POR_ORGACODE", customerProfile.getPorOrgacode());
jsonMap.put("DMP_PRODCODE", dmpProdcode);
List<Map<String, Object>> workFlowLog = new ArrayList<>(); List<Map<String, Object>> workFlowLog = new ArrayList<>();
Map<String, Object> logEntry = new HashMap<>(); Map<String, Object> logEntry = new HashMap<>();
logEntry.put("susUsercode", "01"); logEntry.put("susUsercode", "01");
@ -251,7 +254,8 @@ public void saveCustomerAccountDetails(String porOrgacode, String cmpCustcode,St
jsonMap.put("@_CREATEDATE", createdDateMap); jsonMap.put("@_CREATEDATE", createdDateMap);
return JsonToString(jsonMap); return JsonToString(jsonMap);
} }
public String JsonToString(Object jsonMap){
public String JsonToString(Object jsonMap) {
try { try {
return this.objectMapper.writeValueAsString(jsonMap); return this.objectMapper.writeValueAsString(jsonMap);
} catch (JsonProcessingException var3) { } catch (JsonProcessingException var3) {

@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.mfsys.comm.exception.ApplicationException; import com.mfsys.comm.exception.ApplicationException;
import com.mfsys.comm.exception.ApplicationExceptionMapper; import com.mfsys.comm.exception.ApplicationExceptionMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -14,6 +15,7 @@ import reactor.core.publisher.Mono;
import java.io.IOException; import java.io.IOException;
@Service @Service
@Slf4j
public class WebClientDepositService { public class WebClientDepositService {
private final WebClient webClientDeposit; private final WebClient webClientDeposit;
@ -70,6 +72,9 @@ public class WebClientDepositService {
return response.getBody(); return response.getBody();
} catch (WebClientResponseException e) { } catch (WebClientResponseException e) {
ApplicationExceptionMapper.APIError errorDetails = parseErrorDetails(e); ApplicationExceptionMapper.APIError errorDetails = parseErrorDetails(e);
log.error("UCO Error Status: {}", e.getStatusCode());
log.error("UCO Error Body: {}", e.getResponseBodyAsString());
log.error("UCO Request Headers: {}", e.getRequest().getHeaders());
throw new ApplicationException(porgaCode, errorDetails.getErrorCode(), errorDetails.getArguments()); throw new ApplicationException(porgaCode, errorDetails.getErrorCode(), errorDetails.getArguments());
} }
} }

Loading…
Cancel
Save