|
|
|
@ -3,13 +3,17 @@ package au.com.royalpay.payment.manage.application.core.impls;
|
|
|
|
|
import au.com.royalpay.payment.manage.application.core.SimpleClientApplyService;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.beans.NewAccountBean;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
|
|
|
|
|
import au.com.royalpay.payment.manage.signin.beans.LoginInfo;
|
|
|
|
|
import au.com.royalpay.payment.manage.signin.core.SignInAccountService;
|
|
|
|
|
import au.com.royalpay.payment.manage.system.core.MailGunService;
|
|
|
|
|
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
|
|
|
|
|
import au.com.royalpay.payment.tools.env.SysConfigManager;
|
|
|
|
|
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
|
|
|
|
|
import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
|
|
|
|
|
import au.com.royalpay.payment.tools.locale.LocaleSupport;
|
|
|
|
|
import au.com.royalpay.payment.tools.mail.SendMail;
|
|
|
|
|
import au.com.royalpay.payment.tools.utils.sms.SmsSingleSender;
|
|
|
|
|
import au.com.royalpay.payment.tools.utils.sms.SmsSingleSenderResult;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
|
|
|
|
@ -46,11 +50,14 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
|
|
|
|
|
private SpringTemplateEngine thymeleaf;
|
|
|
|
|
@Resource
|
|
|
|
|
private ClientManager clientManager;
|
|
|
|
|
@Resource
|
|
|
|
|
private SignInAccountService signInAccountService;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private StringRedisTemplate stringRedisTemplate;
|
|
|
|
|
private final SmsSingleSender smsSingleSender = new SmsSingleSender(appId, appKey);
|
|
|
|
|
private final int REGISTER_CLIENT_TEMPLID = 126008;
|
|
|
|
|
// private final int REGISTER_CLIENT_TEMPLID = 126008;//正式
|
|
|
|
|
private final int REGISTER_CLIENT_TEMPLID = 110449;
|
|
|
|
|
private final String REGISTER_CLIENT_PREFIX = "REGISTER_CLIENT";
|
|
|
|
|
private final String REGISTER_CLIENT_PROCESS_PREFIX = "REGISTER_CLIENT_PROCESS";
|
|
|
|
|
private final String VERIFY_MAIL_PREFIX = "VERIFY_MAIL";
|
|
|
|
@ -96,7 +103,10 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
|
|
|
|
|
String expireMin = (String) sysConfig.getOrDefault("sms.verification.code.expire", 3);
|
|
|
|
|
param.add(expireMin);
|
|
|
|
|
try {
|
|
|
|
|
smsSingleSender.sendWithParam(nationCode, phoneNumber, REGISTER_CLIENT_TEMPLID, param, "", "", "");
|
|
|
|
|
SmsSingleSenderResult result = smsSingleSender.sendWithParam(nationCode, phoneNumber, REGISTER_CLIENT_TEMPLID, param, "", "", "");
|
|
|
|
|
System.out.println(result);
|
|
|
|
|
System.out.println(result);
|
|
|
|
|
System.out.println(result);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw new ServerErrorException("System Error");
|
|
|
|
|
}
|
|
|
|
@ -169,12 +179,27 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
|
|
|
|
|
stringRedisTemplate.delete(getVerifyMailRedisKey(codeKey));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void verifyMail(String address, JSONObject loginAccount) {
|
|
|
|
|
LoginInfo loginInfo = new LoginInfo();
|
|
|
|
|
loginInfo.setLoginId(loginAccount.getString("userName"));
|
|
|
|
|
loginInfo.setPassword(loginAccount.getString("password"));
|
|
|
|
|
JSONObject account = signInAccountService.accountCheck(loginInfo);
|
|
|
|
|
JSONObject client = clientManager.getClientInfo(account.getIntValue("client_id"));
|
|
|
|
|
if (!address.equals(client.getString("contact_email"))) {
|
|
|
|
|
throw new BadRequestException(LocaleSupport.localeMessage("error.login.password"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String getRegisterClientRedisKey(String phoneNumber) {
|
|
|
|
|
return REGISTER_CLIENT_PREFIX + phoneNumber;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String getRegisterClientProcessRedisKey(String codeKey) {
|
|
|
|
|
return REGISTER_CLIENT_PROCESS_PREFIX + codeKey;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String getVerifyMailRedisKey(String codekey) {
|
|
|
|
|
return VERIFY_MAIL_PREFIX + codekey;
|
|
|
|
|
}
|
|
|
|
|