FINERACT-1932: Add custom Configuration class for self-registration module
This commit is contained in:
committed by
Arnold Gálovics
parent
5b0ed43054
commit
ed4c85a5c8
+2
-8
@@ -18,20 +18,14 @@
|
||||
*/
|
||||
package org.apache.fineract.portfolio.self.registration.service;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SelfServiceRegistrationReadPlatformServiceImpl implements SelfServiceRegistrationReadPlatformService {
|
||||
|
||||
private final JdbcTemplate jdbcTemplate;
|
||||
|
||||
@Autowired
|
||||
public SelfServiceRegistrationReadPlatformServiceImpl(final JdbcTemplate jdbcTemplate) {
|
||||
this.jdbcTemplate = jdbcTemplate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isClientExist(String accountNumber, String firstName, String lastName, String mobileNumber,
|
||||
boolean isEmailAuthenticationMode) {
|
||||
|
||||
+3
-27
@@ -31,6 +31,7 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
import org.apache.fineract.infrastructure.campaigns.sms.data.SmsProviderData;
|
||||
import org.apache.fineract.infrastructure.campaigns.sms.domain.SmsCampaign;
|
||||
@@ -64,15 +65,13 @@ import org.apache.fineract.useradministration.domain.RoleRepository;
|
||||
import org.apache.fineract.useradministration.domain.UserDomainService;
|
||||
import org.apache.fineract.useradministration.exception.RoleNotFoundException;
|
||||
import org.apache.fineract.useradministration.service.AppUserReadPlatformService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.security.authentication.AuthenticationServiceException;
|
||||
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
||||
import org.springframework.security.core.userdetails.User;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SelfServiceRegistrationWritePlatformServiceImpl implements SelfServiceRegistrationWritePlatformService {
|
||||
|
||||
private final SelfServiceRegistrationRepository selfServiceRegistrationRepository;
|
||||
@@ -83,35 +82,12 @@ public class SelfServiceRegistrationWritePlatformServiceImpl implements SelfServ
|
||||
private final UserDomainService userDomainService;
|
||||
private final GmailBackedPlatformEmailService gmailBackedPlatformEmailService;
|
||||
private final SmsMessageRepository smsMessageRepository;
|
||||
private SmsMessageScheduledJobService smsMessageScheduledJobService;
|
||||
private final SmsMessageScheduledJobService smsMessageScheduledJobService;
|
||||
private final SmsCampaignDropdownReadPlatformService smsCampaignDropdownReadPlatformService;
|
||||
private final AppUserReadPlatformService appUserReadPlatformService;
|
||||
private final RoleRepository roleRepository;
|
||||
private static final SecureRandom secureRandom = new SecureRandom();
|
||||
|
||||
@Autowired
|
||||
public SelfServiceRegistrationWritePlatformServiceImpl(final SelfServiceRegistrationRepository selfServiceRegistrationRepository,
|
||||
final FromJsonHelper fromApiJsonHelper,
|
||||
final SelfServiceRegistrationReadPlatformService selfServiceRegistrationReadPlatformService,
|
||||
final ClientRepositoryWrapper clientRepository, final PasswordValidationPolicyRepository passwordValidationPolicy,
|
||||
final UserDomainService userDomainService, final GmailBackedPlatformEmailService gmailBackedPlatformEmailService,
|
||||
final SmsMessageRepository smsMessageRepository, SmsMessageScheduledJobService smsMessageScheduledJobService,
|
||||
final SmsCampaignDropdownReadPlatformService smsCampaignDropdownReadPlatformService,
|
||||
final AppUserReadPlatformService appUserReadPlatformService, final RoleRepository roleRepository) {
|
||||
this.selfServiceRegistrationRepository = selfServiceRegistrationRepository;
|
||||
this.fromApiJsonHelper = fromApiJsonHelper;
|
||||
this.selfServiceRegistrationReadPlatformService = selfServiceRegistrationReadPlatformService;
|
||||
this.clientRepository = clientRepository;
|
||||
this.passwordValidationPolicy = passwordValidationPolicy;
|
||||
this.userDomainService = userDomainService;
|
||||
this.gmailBackedPlatformEmailService = gmailBackedPlatformEmailService;
|
||||
this.smsMessageRepository = smsMessageRepository;
|
||||
this.smsMessageScheduledJobService = smsMessageScheduledJobService;
|
||||
this.smsCampaignDropdownReadPlatformService = smsCampaignDropdownReadPlatformService;
|
||||
this.appUserReadPlatformService = appUserReadPlatformService;
|
||||
this.roleRepository = roleRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SelfServiceRegistration createRegistrationRequest(String apiRequestBodyAsJson) {
|
||||
Gson gson = new Gson();
|
||||
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.portfolio.self.registration.starter;
|
||||
|
||||
import org.apache.fineract.infrastructure.campaigns.sms.service.SmsCampaignDropdownReadPlatformService;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.infrastructure.core.service.GmailBackedPlatformEmailService;
|
||||
import org.apache.fineract.infrastructure.sms.domain.SmsMessageRepository;
|
||||
import org.apache.fineract.infrastructure.sms.scheduler.SmsMessageScheduledJobService;
|
||||
import org.apache.fineract.portfolio.client.domain.ClientRepositoryWrapper;
|
||||
import org.apache.fineract.portfolio.self.registration.domain.SelfServiceRegistrationRepository;
|
||||
import org.apache.fineract.portfolio.self.registration.service.SelfServiceRegistrationReadPlatformService;
|
||||
import org.apache.fineract.portfolio.self.registration.service.SelfServiceRegistrationReadPlatformServiceImpl;
|
||||
import org.apache.fineract.portfolio.self.registration.service.SelfServiceRegistrationWritePlatformService;
|
||||
import org.apache.fineract.portfolio.self.registration.service.SelfServiceRegistrationWritePlatformServiceImpl;
|
||||
import org.apache.fineract.useradministration.domain.PasswordValidationPolicyRepository;
|
||||
import org.apache.fineract.useradministration.domain.RoleRepository;
|
||||
import org.apache.fineract.useradministration.domain.UserDomainService;
|
||||
import org.apache.fineract.useradministration.service.AppUserReadPlatformService;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
|
||||
@Configuration
|
||||
public class SelfRegistrationConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(SelfServiceRegistrationReadPlatformService.class)
|
||||
public SelfServiceRegistrationReadPlatformService selfServiceRegistrationReadPlatformService(JdbcTemplate jdbcTemplate) {
|
||||
return new SelfServiceRegistrationReadPlatformServiceImpl(jdbcTemplate);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(SelfServiceRegistrationWritePlatformService.class)
|
||||
public SelfServiceRegistrationWritePlatformService selfServiceRegistrationWritePlatformService(
|
||||
|
||||
SelfServiceRegistrationRepository selfServiceRegistrationRepository, FromJsonHelper fromApiJsonHelper,
|
||||
SelfServiceRegistrationReadPlatformService selfServiceRegistrationReadPlatformService, ClientRepositoryWrapper clientRepository,
|
||||
PasswordValidationPolicyRepository passwordValidationPolicy, UserDomainService userDomainService,
|
||||
GmailBackedPlatformEmailService gmailBackedPlatformEmailService, SmsMessageRepository smsMessageRepository,
|
||||
SmsMessageScheduledJobService smsMessageScheduledJobService,
|
||||
SmsCampaignDropdownReadPlatformService smsCampaignDropdownReadPlatformService,
|
||||
AppUserReadPlatformService appUserReadPlatformService, RoleRepository roleRepository) {
|
||||
return new SelfServiceRegistrationWritePlatformServiceImpl(selfServiceRegistrationRepository, fromApiJsonHelper,
|
||||
selfServiceRegistrationReadPlatformService, clientRepository, passwordValidationPolicy, userDomainService,
|
||||
gmailBackedPlatformEmailService, smsMessageRepository, smsMessageScheduledJobService,
|
||||
smsCampaignDropdownReadPlatformService, appUserReadPlatformService, roleRepository);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user