Merge pull request '[UCOD][23]- onboarding/digital/UcoCustomerAccount' (#6) from UCOD-23 into UCO-PRE-PRODUCTION-2026

Reviewed-on: https://ct.mfsys.com.pk/Digital-banking/UCO-BS/pulls/6
UCOBS-10
Naeem Ullah 3 days ago
commit a5d0b54ab1

@ -191,7 +191,7 @@ 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);
} }
@ -215,15 +215,18 @@ public void saveCustomerAccountDetails(String porOrgacode, String cmpCustcode,St
} }
}); });
} }
public String preparePayloadForAccount(CustomerProfile customerProfile,String title){
public String preparePayloadForAccount(CustomerProfile customerProfile, String title, String dmpProdcode) {
System.out.println(customerProfile);
Map<String, Object> jsonMap = new HashMap<>(); 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,6 +254,7 @@ 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);

@ -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