|
|
|
|
@ -12,6 +12,7 @@ import com.mfsys.uco.dto.SignupStep3RequestModel;
|
|
|
|
|
import com.mfsys.uco.dto.webclientdto.AccountDetail;
|
|
|
|
|
import com.mfsys.uco.exception.AccountDoesntExistsException;
|
|
|
|
|
import com.mfsys.uco.exception.CustomerAccountOpeningNotAllowedException;
|
|
|
|
|
import com.mfsys.uco.exception.DepositAccountNotReadyException;
|
|
|
|
|
import com.mfsys.uco.exception.UserAlreadyRegisteredException;
|
|
|
|
|
import com.mfsys.uco.model.AccountId;
|
|
|
|
|
import com.mfsys.uco.model.CustomerProfile;
|
|
|
|
|
@ -96,8 +97,8 @@ public class UcoAccountService {
|
|
|
|
|
"CIT_IDENVALUE", signupStep3RequestModel.getIdentificationNumber(),
|
|
|
|
|
"PAD_ADRSMOBPHONE", signupStep3RequestModel.getPhone(),
|
|
|
|
|
"POR_ORGACODE", signupStep3RequestModel.getPorOrgacode(),
|
|
|
|
|
"SUS_USERCODE", "01",
|
|
|
|
|
"PLC_LOCACODE", "2003",
|
|
|
|
|
"SUS_USERCODE", signupStep3RequestModel.getChannelCode(),
|
|
|
|
|
"PLC_LOCACODE", signupStep3RequestModel.getPlcLocacode(),
|
|
|
|
|
"DMP_PRODCODE", signupStep3RequestModel.getDmpProdcode()
|
|
|
|
|
),
|
|
|
|
|
UCOURI.CUSTOMER_ONBOARDING,
|
|
|
|
|
@ -106,7 +107,11 @@ public class UcoAccountService {
|
|
|
|
|
String cmpCustcode = String.valueOf(cmpCustcodeReturn.get("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())
|
|
|
|
|
.cmpName(signupStep3RequestModel.getName()).cmpIsKycVerified(signupStep3RequestModel.isKycAdded())
|
|
|
|
|
.pitIdencode(signupStep3RequestModel.getIdentificationType()).pitIdenvalue(signupStep3RequestModel.getIdentificationNumber())
|
|
|
|
|
@ -151,8 +156,22 @@ public class UcoAccountService {
|
|
|
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
|
|
|
|
|
|
|
|
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) {
|
|
|
|
|
|