Untitled
unknown
plain_text
4 months ago
2.3 kB
5
Indexable
public class PetInsuranceMapper { private final EncryptDecryptUtility encryptDecryptUtility; private final LeapCryptoHandler leapCryptoHandler; public PetInfoDTO buildPetInfo(PetInsuranceOriginationEntity entity, RequestContext context) { return PetInfoDTO.builder() .applicantID(entity.getApplicantId()) .applicationID(entity.getApplicationId()) .customerID(entity.getCustomerId()) .customerDetails(validateAndDecryptCustomerDetails(entity.getCustomerDetails(), context)) .petDetails(entity.getPetDetails()) .createdTimestamp(entity.getCreatedTimestamp()) .modifiedTimestamp(entity.getModifiedTimestamp()) .build(); } private PetCustomerDetails validateAndDecryptCustomerDetails(PetCustomerDetails customerDetails, RequestContext requestContext) { String cif = encryptDecryptUtility.validateAndDecrypt(customerDetails.getCif()); return PetCustomerDetails.builder() .cif(StringUtils.isNotEmpty(cif) ? leapCryptoHandler.encrypt(cif.toCharArray(), requestContext) : null) .firstName(encryptDecryptUtility.validateAndDecrypt(customerDetails.getFirstName())) .lastName(encryptDecryptUtility.validateAndDecrypt(customerDetails.getLastName())) .dateOfBirth(customerDetails.getDateOfBirth()) .nationality(customerDetails.getNationality()) .nationalityCode(customerDetails.getNationalityCode()) .email(encryptDecryptUtility.validateAndDecrypt(customerDetails.getEmail())) .mobile(encryptDecryptUtility.validateAndDecrypt(customerDetails.getMobile())) .title(customerDetails.getTitle()) .emiratesId(encryptDecryptUtility.validateAndDecrypt(customerDetails.getEmiratesId())) .emirate(customerDetails.getEmirate()) .address(customerDetails.getAddress()) .countryCode(customerDetails.getCountryCode()) .gender(customerDetails.getGender()) .poBox(customerDetails.getPoBox()) .build(); } }
Editor is loading...
Leave a Comment