commit
parent
06f486bc85
commit
7c46dbf603
@ -0,0 +1,27 @@
|
||||
package com.mfsys.uco.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class SignupStep3RequestModel {
|
||||
private String username;
|
||||
private String email;
|
||||
private String phone;
|
||||
private String name;
|
||||
private String address;
|
||||
private String identificationType;
|
||||
private String identificationNumber;
|
||||
private boolean isKycAdded;
|
||||
private String kycType;
|
||||
private String kycDocumentId1; // base64 encoded
|
||||
private String kycDocumentId2; // base64 encoded
|
||||
private String userRole;
|
||||
private String channelCode;
|
||||
private String porOrgacode;
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
package com.mfsys.uco.dto.webclientdto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Map;
|
||||
@Data
|
||||
@RequiredArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class AccountDetail {
|
||||
protected String porOrgacode;
|
||||
protected String mbmBkmsnumber;
|
||||
protected String mbmBkmstitle;
|
||||
protected String dmpProddesc;
|
||||
protected String plcLocadesc;
|
||||
protected String pcrCurrcode;
|
||||
protected String pcrCurrdesc;
|
||||
protected String cmpCustcode;
|
||||
protected boolean mbmBkmsclosed;
|
||||
protected String pctCstycode;
|
||||
protected BigDecimal mbmBkmsbalance;
|
||||
protected Map<String, BigDecimal> charges = Map.of();
|
||||
protected String dmpProdcode;
|
||||
protected boolean cmpBlacklisted;
|
||||
protected String plcLocacode;
|
||||
protected boolean mbmNotificationService;
|
||||
protected String dmpCredittype;
|
||||
protected BigDecimal perEratrateact;
|
||||
protected LocalDate kycRenewalDate;
|
||||
protected String padAdrsmobphone;
|
||||
protected boolean btaRolloverSpecialRate;
|
||||
private String pasAcstcode;
|
||||
private BigDecimal btaBookingamount;
|
||||
private BigDecimal bdaDpacblockamt;
|
||||
private boolean bdaDpacblocked;
|
||||
private String pbdBankname;
|
||||
private String pbbBranchname;
|
||||
private String pbbBranchcountry;
|
||||
private String pbbBranchcity;
|
||||
private String pcaGlaccode;
|
||||
private String accJointStatus;
|
||||
private String accAttortype;
|
||||
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.mfsys.uco.service;
|
||||
|
||||
import com.mfsys.uco.dto.webclientdto.AccountDetail;
|
||||
import com.mfsys.uco.model.CustomerProfile;
|
||||
import com.mfsys.uco.repository.CustomerProfileRepository;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class CustomerProfileService {
|
||||
private final CustomerProfileRepository customerProfileRepository;
|
||||
public CustomerProfile fetchCustcodeBasedOnEmail(String porOrgacode, String email) {
|
||||
return customerProfileRepository.findbyEmail(porOrgacode,email);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,72 @@
|
||||
package com.mfsys.uco.service;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.mfsys.comm.exception.ApplicationException;
|
||||
import com.mfsys.comm.exception.ApplicationExceptionMapper;
|
||||
import org.apache.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.reactive.function.client.WebClient;
|
||||
import org.springframework.web.reactive.function.client.WebClientResponseException;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class WebClientCrmService {
|
||||
private final WebClient webClientCrm;
|
||||
|
||||
|
||||
public WebClientCrmService(WebClient webClientCrm) {
|
||||
this.webClientCrm = webClientCrm;
|
||||
}
|
||||
public Object getUcoAccountBalance(String url,String porOrgacode) {
|
||||
return handleResponse(webClientCrm.get().uri(url).accept(MediaType.APPLICATION_JSON)
|
||||
.header("SUS_USERCODE", porOrgacode)
|
||||
.header("POR_ORGACODE", porOrgacode).retrieve().toEntity(Object.class),
|
||||
null);
|
||||
}
|
||||
public Object onboardCustomer(Map onBoardingData, String url, String porOrgaCode) {
|
||||
return handleResponse(webClientCrm.post().uri(url).bodyValue(onBoardingData).accept(MediaType.APPLICATION_JSON)
|
||||
.header("SUS_USERCODE", porOrgaCode)
|
||||
.header("POR_ORGACODE", porOrgaCode).retrieve()
|
||||
.toEntity(Object.class),
|
||||
porOrgaCode);
|
||||
}
|
||||
|
||||
private <T> T handleResponse(Mono<ResponseEntity<T>> responseMono, String porgaCode) {
|
||||
try {
|
||||
ResponseEntity<T> response = responseMono.block();
|
||||
return response.getBody();
|
||||
} catch (WebClientResponseException e) {
|
||||
ApplicationExceptionMapper.APIError errorDetails = parseErrorDetails(e);
|
||||
throw new ApplicationException(porgaCode,errorDetails.getErrorCode(),errorDetails.getArguments());
|
||||
}
|
||||
}
|
||||
|
||||
private ApplicationExceptionMapper.APIError parseErrorDetails(WebClientResponseException e) {
|
||||
String errorCode = null;
|
||||
List<String> arguments = null;
|
||||
if (e.getResponseBodyAsString() != null) {
|
||||
try {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
JsonNode errorNode = objectMapper.readTree(e.getResponseBodyAsString());
|
||||
errorCode = errorNode.get("errorCode").asText();
|
||||
arguments = Arrays.asList(objectMapper.convertValue(errorNode.get("arguments"), String[].class));
|
||||
} catch (IOException ex) {
|
||||
}
|
||||
}
|
||||
return new ApplicationExceptionMapper.APIError(errorCode, arguments.toArray());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue