Merge pull request '[UCOD][PRE-PROD][11]-Onboard Customer implementation' (#1) from UCOD-11 into UCO-PRE-PRODUCTION-2026

Reviewed-on: https://ct.mfsys.com.pk/Digital-banking/UCO-BS/pulls/1
UCOD-14
Mubashar Hussain 1 month ago
commit bb1edcd42c

@ -1,5 +1,6 @@
package com.mfsys.uco.dto; package com.mfsys.uco.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
@ -17,7 +18,8 @@ public class SignupStep3RequestModel {
private String address; private String address;
private String identificationType; private String identificationType;
private String identificationNumber; private String identificationNumber;
private boolean isKycAdded; @JsonProperty("isKycAdded")
private boolean kycAdded;
private String dmpProdcode; private String dmpProdcode;
private String kycType; private String kycType;
private String kycDocumentId1; // base64 encoded private String kycDocumentId1; // base64 encoded
@ -25,4 +27,5 @@ public class SignupStep3RequestModel {
private String userRole; private String userRole;
private String channelCode; private String channelCode;
private String porOrgacode; private String porOrgacode;
private String plcLocacode;
} }

@ -0,0 +1,10 @@
package com.mfsys.uco.exception;
import com.mfsys.comm.exception.ApplicationException;
import com.mfsys.comm.exception.ERRCode;
public class DepositAccountNotReadyException extends ApplicationException {
public DepositAccountNotReadyException() {
super(null, ERRCode.DEPOSIT_ACCOUNT_NOT_READY, null);
}
}

@ -12,6 +12,7 @@ import com.mfsys.uco.dto.SignupStep3RequestModel;
import com.mfsys.uco.dto.webclientdto.AccountDetail; import com.mfsys.uco.dto.webclientdto.AccountDetail;
import com.mfsys.uco.exception.AccountDoesntExistsException; import com.mfsys.uco.exception.AccountDoesntExistsException;
import com.mfsys.uco.exception.CustomerAccountOpeningNotAllowedException; import com.mfsys.uco.exception.CustomerAccountOpeningNotAllowedException;
import com.mfsys.uco.exception.DepositAccountNotReadyException;
import com.mfsys.uco.exception.UserAlreadyRegisteredException; import com.mfsys.uco.exception.UserAlreadyRegisteredException;
import com.mfsys.uco.model.AccountId; import com.mfsys.uco.model.AccountId;
import com.mfsys.uco.model.CustomerProfile; import com.mfsys.uco.model.CustomerProfile;
@ -96,8 +97,8 @@ public class UcoAccountService {
"CIT_IDENVALUE", signupStep3RequestModel.getIdentificationNumber(), "CIT_IDENVALUE", signupStep3RequestModel.getIdentificationNumber(),
"PAD_ADRSMOBPHONE", signupStep3RequestModel.getPhone(), "PAD_ADRSMOBPHONE", signupStep3RequestModel.getPhone(),
"POR_ORGACODE", signupStep3RequestModel.getPorOrgacode(), "POR_ORGACODE", signupStep3RequestModel.getPorOrgacode(),
"SUS_USERCODE", "01", "SUS_USERCODE", signupStep3RequestModel.getChannelCode(),
"PLC_LOCACODE", "2003", "PLC_LOCACODE", signupStep3RequestModel.getPlcLocacode(),
"DMP_PRODCODE", signupStep3RequestModel.getDmpProdcode() "DMP_PRODCODE", signupStep3RequestModel.getDmpProdcode()
), ),
UCOURI.CUSTOMER_ONBOARDING, UCOURI.CUSTOMER_ONBOARDING,
@ -106,7 +107,11 @@ public class UcoAccountService {
String cmpCustcode = String.valueOf(cmpCustcodeReturn.get("cmpCustcode")); String cmpCustcode = String.valueOf(cmpCustcodeReturn.get("cmpCustcode"));
System.out.println(cmpCustcode); System.out.println(cmpCustcode);
AccountDetail accountDetail = fetchdepositAccountFromCiihive(porOrgacode, cmpCustcode).get(0); List<AccountDetail> depositAccounts = fetchDepositAccountWithRetry(porOrgacode, cmpCustcode);
if (depositAccounts.isEmpty()) {
throw new DepositAccountNotReadyException();
}
AccountDetail accountDetail = depositAccounts.get(0);
CustomerProfile customerProfile = CustomerProfile.builder().cmpCustcode(accountDetail.getCmpCustcode()).cmpEmail(signupStep3RequestModel.getEmail()) CustomerProfile customerProfile = CustomerProfile.builder().cmpCustcode(accountDetail.getCmpCustcode()).cmpEmail(signupStep3RequestModel.getEmail())
.cmpName(signupStep3RequestModel.getName()).cmpIsKycVerified(signupStep3RequestModel.isKycAdded()) .cmpName(signupStep3RequestModel.getName()).cmpIsKycVerified(signupStep3RequestModel.isKycAdded())
.pitIdencode(signupStep3RequestModel.getIdentificationType()).pitIdenvalue(signupStep3RequestModel.getIdentificationNumber()) .pitIdencode(signupStep3RequestModel.getIdentificationType()).pitIdenvalue(signupStep3RequestModel.getIdentificationNumber())
@ -151,8 +156,22 @@ public class UcoAccountService {
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
return objectMapper.convertValue(map, objectMapper.getTypeFactory().constructCollectionType(List.class, AccountDetail.class)); return objectMapper.convertValue(map, objectMapper.getTypeFactory().constructCollectionType(List.class, AccountDetail.class));
}
private List<AccountDetail> fetchDepositAccountWithRetry(String porOrgacode, String cmpCustcode) {
int maxAttempts = 3;
int delayMs = 2000;
List<AccountDetail> accounts = fetchdepositAccountFromCiihive(porOrgacode, cmpCustcode);
for (int attempt = 1; attempt < maxAttempts && accounts.isEmpty(); attempt++) {
try {
Thread.sleep(delayMs);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
break;
}
accounts = fetchdepositAccountFromCiihive(porOrgacode, cmpCustcode);
}
return accounts;
} }
public Object fetchExchangeRate(String porOrgacode) { public Object fetchExchangeRate(String porOrgacode) {

Loading…
Cancel
Save