Merge remote-tracking branch 'origin/develop' into develop

master
dalong306 4 years ago
commit 44baebb509

@ -5,11 +5,11 @@
<parent>
<groupId>au.com.royalpay.payment</groupId>
<artifactId>payment-parent</artifactId>
<version>2.2.29</version>
<version>2.2.30</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>manage</artifactId>
<version>2.3.84</version>
<version>2.3.87</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jib-maven-plugin.version>2.4.0</jib-maven-plugin.version>

@ -3,7 +3,6 @@ package au.com.royalpay.payment.manage.appclient.core.impls;
import au.com.royalpay.payment.core.exceptions.EmailException;
import au.com.royalpay.payment.manage.appclient.beans.AppMerchantBean;
import au.com.royalpay.payment.manage.appclient.core.ManageAppService;
import au.com.royalpay.payment.manage.bdprize.core.BDPrizeService;
import au.com.royalpay.payment.manage.mappers.financial.FinancialBDConfigMapper;
import au.com.royalpay.payment.manage.mappers.financial.FinancialBDPrizeLogMapper;
import au.com.royalpay.payment.manage.mappers.financial.FinancialBDPrizeRecordMapper;
@ -15,16 +14,14 @@ import au.com.royalpay.payment.manage.mappers.system.OrgMapper;
import au.com.royalpay.payment.manage.merchants.beans.BankAccountInfo;
import au.com.royalpay.payment.manage.merchants.beans.ClientAuthFilesInfo;
import au.com.royalpay.payment.manage.merchants.beans.ClientRegisterInfo;
import au.com.royalpay.payment.manage.merchants.beans.PartnerQuery;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.notice.core.MailService;
import au.com.royalpay.payment.manage.product.beans.ProductBean;
import au.com.royalpay.payment.manage.product.core.ClientProduct;
import au.com.royalpay.payment.manage.signin.beans.ChangePwdBean;
import au.com.royalpay.payment.manage.signin.core.ManagerAccountsService;
import au.com.royalpay.payment.manage.signin.core.SignInAccountService;
import au.com.royalpay.payment.manage.support.sms.SmsSender;
import au.com.royalpay.payment.tools.device.DeviceSupport;
import au.com.royalpay.payment.manage.support.sms.msg.AuthCodeMessage;
import au.com.royalpay.payment.tools.device.ManageDeviceSupport;
import au.com.royalpay.payment.tools.device.support.DeviceRegister;
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
@ -37,7 +34,6 @@ import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.ibatis.annotations.Param;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cache.annotation.Cacheable;
@ -48,13 +44,14 @@ import org.thymeleaf.spring5.SpringTemplateEngine;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.Duration;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@Service
public class ManageAppServiceImp implements ManageAppService {
private Logger logger = LoggerFactory.getLogger(getClass());
private final Logger logger = LoggerFactory.getLogger(getClass());
@Resource
private ManageDeviceSupport manageDeviceSupport;
@ -77,8 +74,6 @@ public class ManageAppServiceImp implements ManageAppService {
@Resource
private FinancialPartnerCommissionMapper financialPartnerCommissionMapper;
@Resource
private BDPrizeService bdPrizeService;
@Resource
private FinancialBDConfigMapper financialBDConfigMapper;
@Resource
private ClientProduct clientProduct;
@ -94,7 +89,6 @@ public class ManageAppServiceImp implements ManageAppService {
private SmsSender smsSender;
private final String BIND_MANAGE_EMAIL_PREFIX = "BIND_MANAGE_EMAIL";
private final String BIND_MANAGE_PHONE_PREFIX = "BIND_MANAGE_PHONE";
private final int BIND_PHONE_TEMPLID = 126978;
@Override
@ -125,7 +119,7 @@ public class ManageAppServiceImp implements ManageAppService {
public List<JSONObject> getReferrerList(JSONObject device) {
String clientType = device.getString("client_type");
manageDeviceSupport.findRegister(clientType);
return orgMapper.listOrgs(1,new PageBounds());
return orgMapper.listOrgs(1, new PageBounds());
}
@Override
@ -141,7 +135,7 @@ public class ManageAppServiceImp implements ManageAppService {
String clientType = device.getString("client_type");
manageDeviceSupport.findRegister(clientType);
JSONObject manager = managerMapper.findById(device.getString("manager_id"));
if (StringUtils.isNotBlank(info.getClient_pay_type())&& StringUtils.isNotBlank(info.getClient_pay_desc())) {
if (StringUtils.isNotBlank(info.getClient_pay_type()) && StringUtils.isNotBlank(info.getClient_pay_desc())) {
info.setClient_pay_type("");
info.setClient_pay_desc("");
}
@ -153,7 +147,7 @@ public class ManageAppServiceImp implements ManageAppService {
String clientType = device.getString("client_type");
manageDeviceSupport.findRegister(clientType);
JSONObject manager = managerMapper.findById(device.getString("manager_id"));
clientManager.disableClient(clientMoniker,manager);
clientManager.disableClient(clientMoniker, manager);
}
@Override
@ -219,7 +213,7 @@ public class ManageAppServiceImp implements ManageAppService {
String clientType = device.getString("client_type");
manageDeviceSupport.findRegister(clientType);
List<JSONObject> rates = clientManager.clientRates(clientMoniker, true);
return rates.stream().collect(Collectors.groupingBy(e -> e.getString("rate_name"),HashMap::new,Collectors.toList()));
return rates.stream().collect(Collectors.groupingBy(e -> e.getString("rate_name"), HashMap::new, Collectors.toList()));
}
@Override
@ -274,7 +268,7 @@ public class ManageAppServiceImp implements ManageAppService {
String clientType = device.getString("client_type");
manageDeviceSupport.findRegister(clientType);
JSONObject manager = managerMapper.findById(device.getString("manager_id"));
clientManager.uploadAuthFiles(manager, clientMoniker,filesInfo);
clientManager.uploadAuthFiles(manager, clientMoniker, filesInfo);
}
@Override
@ -377,7 +371,7 @@ public class ManageAppServiceImp implements ManageAppService {
Calendar monthCal = Calendar.getInstance();
monthCal.setTime(new Date());
monthCal.set(Calendar.MONTH, (monthCal.get(Calendar.MONTH) - 1));
JSONObject total = financialPartnerCommissionMapper.findTotalByOrg(monthCal.get(Calendar.YEAR), monthCal.get(Calendar.MONTH)+1, manager.getString("org_id"));
JSONObject total = financialPartnerCommissionMapper.findTotalByOrg(monthCal.get(Calendar.YEAR), monthCal.get(Calendar.MONTH) + 1, manager.getString("org_id"));
if (total == null) {
total = new JSONObject();
total.put("total_amount", BigDecimal.ZERO);
@ -408,7 +402,7 @@ public class ManageAppServiceImp implements ManageAppService {
}
@Override
public List<JSONObject> getBdPrizeList(JSONObject device) {
public List<JSONObject> getBdPrizeList(JSONObject device) {
String clientType = device.getString("client_type");
manageDeviceSupport.findRegister(clientType);
JSONObject manager = managerMapper.findById(device.getString("manager_id"));
@ -469,15 +463,15 @@ public class ManageAppServiceImp implements ManageAppService {
public void bindAccountEmail(JSONObject device, JSONObject email) {
String codeKey = device.getString("manager_id");
String codeKeyValueRedis = stringRedisTemplate.boundValueOps(getUpdateManageEmailKey(codeKey)).get();
if(StringUtils.isNotEmpty(codeKeyValueRedis)){
if (StringUtils.isNotEmpty(codeKeyValueRedis)) {
throw new BadRequestException("Captcha has been sent.Please check your email or try again in 5 minutes.");
}
String codeKeyValue = RandomStringUtils.random(6, false, true);
logger.debug("send sms code : {} ", codeKeyValue);
Context ctx = new Context();
JSONObject manager = managerMapper.findById(device.getString("manager_id"));
ctx.setVariable("account",manager);
ctx.setVariable("captcha",codeKeyValue);
ctx.setVariable("account", manager);
ctx.setVariable("captcha", codeKeyValue);
final String content = thymeleaf.process("mail/account_bind_email.html", ctx);
royalThreadPoolExecutor.execute(() -> {
try {
@ -487,23 +481,23 @@ public class ManageAppServiceImp implements ManageAppService {
throw new EmailException("Email Sending Failed", e);
}
});
stringRedisTemplate.boundValueOps(getUpdateManageEmailKey(codeKey)).set(codeKeyValue+"&"+email.getString("contact_email"), 5, TimeUnit.MINUTES);
stringRedisTemplate.boundValueOps(getUpdateManageEmailKey(codeKey)).set(codeKeyValue + "&" + email.getString("contact_email"), 5, TimeUnit.MINUTES);
}
@Override
public void updateAccountEmail(JSONObject device, JSONObject params) {
String key = stringRedisTemplate.boundValueOps(getUpdateManageEmailKey(device.getString("manager_id"))).get();
if(key == null){
if (key == null) {
throw new BadRequestException("Captcha has expired");
}
String captcha = key.split("&")[0];
String email = key.split("&")[1];
if(!StringUtils.equals(captcha,params.getString("captcha"))){
if (!StringUtils.equals(captcha, params.getString("captcha"))) {
throw new BadRequestException("Verification code is wrong");
}
JSONObject account = new JSONObject();
account.put("manager_id",device.getString("manager_id"));
account.put("email",email);
JSONObject account = new JSONObject();
account.put("manager_id", device.getString("manager_id"));
account.put("email", email);
managerMapper.update(account);
deleteManageEmailKey(device.getString("manager_id"));
}
@ -512,60 +506,55 @@ public class ManageAppServiceImp implements ManageAppService {
public void bindAccountPhone(JSONObject device, JSONObject phone) {
String codeKey = device.getString("manager_id");
String codeKeyValueRedis = stringRedisTemplate.boundValueOps(getUpdateManagePhoneKey(codeKey)).get();
if(StringUtils.isNotEmpty(codeKeyValueRedis)){
if (StringUtils.isNotEmpty(codeKeyValueRedis)) {
throw new BadRequestException("Captcha has been sent.Please check your phone or try again in 5 minutes.");
}
String codeKeyValue = RandomStringUtils.random(6, false, true);
logger.debug("send sms code : {} ", codeKeyValue);
String nationCode = phone.getString("nation_code");
String phoneNumber = phone.getString("contact_phone");
ArrayList<String> param = new ArrayList<>();
param.add("绑定手机号");
param.add(codeKeyValue);
String expireMin = "5";
param.add(expireMin);
try {
smsSender.getSender().sendWithParam(nationCode.trim(), phoneNumber, BIND_PHONE_TEMPLID, param, "RoyalPay", "", "");
smsSender.sendAuthCodeMessage(nationCode.trim(), phoneNumber, Locale.ENGLISH, new AuthCodeMessage("绑定手机号", codeKeyValue, 5));
} catch (Exception e) {
e.printStackTrace();
throw new ServerErrorException("Phone number is wrong.Please try again.");
}
stringRedisTemplate.boundValueOps(getUpdateManagePhoneKey(codeKey)).set(codeKeyValue+"&"+nationCode+"&"+phoneNumber, Long.parseLong(expireMin), TimeUnit.MINUTES);
stringRedisTemplate.boundValueOps(getUpdateManagePhoneKey(codeKey)).set(codeKeyValue + "&" + nationCode + "&" + phoneNumber, Duration.ofMinutes(5));
}
@Override
public void updateAccountPhone(JSONObject device, JSONObject params) {
String key = stringRedisTemplate.boundValueOps(getUpdateManagePhoneKey(device.getString("manager_id"))).get();
if(key == null){
if (key == null) {
throw new BadRequestException("Captcha has expired");
}
String captcha = key.split("&")[0];
String nation_code = key.split("&")[1];
String contact_phone = key.split("&")[2];
if(!StringUtils.equals(captcha,params.getString("captcha"))){
if (!StringUtils.equals(captcha, params.getString("captcha"))) {
throw new BadRequestException("Verification code is wrong");
}
JSONObject account = new JSONObject();
account.put("manager_id",device.getString("manager_id"));
account.put("contact_phone",contact_phone);
account.put("nation_code","+" + nation_code);
JSONObject account = new JSONObject();
account.put("manager_id", device.getString("manager_id"));
account.put("contact_phone", contact_phone);
account.put("nation_code", "+" + nation_code);
managerMapper.update(account);
deleteManagePhoneKey(device.getString("manager_id"));
}
private void deleteManageEmailKey(String codeKey){
private void deleteManageEmailKey(String codeKey) {
stringRedisTemplate.delete(getUpdateManageEmailKey(codeKey));
}
private void deleteManagePhoneKey(String codeKey){
private void deleteManagePhoneKey(String codeKey) {
stringRedisTemplate.delete(getUpdateManagePhoneKey(codeKey));
}
private String getUpdateManageEmailKey(String codeKey){
return BIND_MANAGE_EMAIL_PREFIX+codeKey;
private String getUpdateManageEmailKey(String codeKey) {
return BIND_MANAGE_EMAIL_PREFIX + codeKey;
}
private String getUpdateManagePhoneKey(String codeKey){
return BIND_MANAGE_PHONE_PREFIX+codeKey;
private String getUpdateManagePhoneKey(String codeKey) {
return BIND_MANAGE_PHONE_PREFIX + codeKey;
}
}

@ -47,6 +47,7 @@ import au.com.royalpay.payment.manage.signin.beans.ChangePwdBean;
import au.com.royalpay.payment.manage.signin.core.SignInAccountService;
import au.com.royalpay.payment.manage.signin.core.impls.SignInAccountServiceImpl;
import au.com.royalpay.payment.manage.support.sms.SmsSender;
import au.com.royalpay.payment.manage.support.sms.msg.AuthCodeMessage;
import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery;
import au.com.royalpay.payment.manage.tradelog.core.TradeLogService;
import au.com.royalpay.payment.manage.tradelog.refund.RefundService;
@ -106,6 +107,7 @@ import java.math.RoundingMode;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.Duration;
import java.util.*;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
@ -238,7 +240,6 @@ public class RetailAppServiceImp implements RetailAppService {
private final String BIND_ACCOUNT_EMAIL_PREFIX = "BIND_ACCOUNT_EMAIL";
private final String BIND_ACCOUNT_PHONE_PREFIX = "BIND_ACCOUNT_PHONE";
private final String UNBIND_ACCOUNT_PHONE_PREFIX = "UHBIND_ACCOUNT_PHONE";
private final int BIND_PHONE_TEMPLID = 126978;
private Map<String, AppMsgSender> senderMap = new HashMap<>();
private final String fileName[] = {"client_bank_file", "client_id_file", "client_company_file"};
@ -2234,18 +2235,13 @@ public class RetailAppServiceImp implements RetailAppService {
logger.debug("send sms code : {} ", codeKeyValue);
String nationCode = phone.getString("nation_code").contains("+") ? phone.getString("nation_code").substring(1) : phone.getString("nation_code");
String phoneNumber = phone.getString("contact_phone");
ArrayList<String> param = new ArrayList<>();
param.add("绑定手机号");
param.add(codeKeyValue);
String expireMin = "1";
param.add(expireMin);
try {
smsSender.getSender().sendWithParam(nationCode.trim(), phoneNumber, BIND_PHONE_TEMPLID, param, "RoyalPay", "", "");
smsSender.sendAuthCodeMessage(nationCode.trim(), phoneNumber, Locale.ENGLISH, new AuthCodeMessage("绑定手机号", codeKeyValue, 1));
} catch (Exception e) {
logger.error(e.getMessage(), e);
throw new BadRequestException("Phone number is wrong.Please try again.");
}
stringRedisTemplate.boundValueOps(getUpdateAccountPhoneKey(codeKey)).set(codeKeyValue + "&" + nationCode + "&" + phoneNumber, Long.parseLong(expireMin), TimeUnit.MINUTES);
stringRedisTemplate.boundValueOps(getUpdateAccountPhoneKey(codeKey)).set(codeKeyValue + "&" + nationCode + "&" + phoneNumber, Duration.ofMinutes(1));
}
@Override
@ -2259,18 +2255,13 @@ public class RetailAppServiceImp implements RetailAppService {
String codeKeyValue = RandomStringUtils.random(6, false, true);
String nationCode = client.getString("nation_code").contains("+") ? client.getString("nation_code").substring(1) : client.getString("nation_code");
String phoneNumber = client.getString("contact_phone");
ArrayList<String> param = new ArrayList<>();
param.add("解綁绑定手机号");
param.add(codeKeyValue);
String expireMin = "1";
param.add(expireMin);
try {
smsSender.getSender().sendWithParam(nationCode.trim(), phoneNumber, BIND_PHONE_TEMPLID, param, "RoyalPay", "", "");
smsSender.sendAuthCodeMessage(nationCode.trim(), phoneNumber, Locale.ENGLISH, new AuthCodeMessage("解綁绑定手机号", codeKeyValue, 1));
} catch (Exception e) {
logger.error(e.getMessage(), e);
throw new BadRequestException("Phone number is wrong.Please try again.");
}
stringRedisTemplate.boundValueOps(getUpdateAccountPhoneKey(codeKey)).set(codeKeyValue + "&" + nationCode + "&" + phoneNumber, Long.parseLong(expireMin), TimeUnit.MINUTES);
stringRedisTemplate.boundValueOps(getUpdateAccountPhoneKey(codeKey)).set(codeKeyValue + "&" + nationCode + "&" + phoneNumber, Duration.ofMinutes(1));
}
@Override

@ -14,6 +14,8 @@ import au.com.royalpay.payment.manage.notice.core.MailService;
import au.com.royalpay.payment.manage.signin.beans.LoginInfo;
import au.com.royalpay.payment.manage.signin.core.SignInAccountService;
import au.com.royalpay.payment.manage.support.sms.SmsSender;
import au.com.royalpay.payment.manage.support.sms.msg.OpenMessage;
import au.com.royalpay.payment.manage.support.sms.msg.AuthCodeMessage;
import au.com.royalpay.payment.manage.system.core.MailGunService;
import au.com.royalpay.payment.tools.connections.attachment.core.AttachmentClient;
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
@ -55,6 +57,7 @@ import java.awt.image.BufferedImage;
import java.io.*;
import java.net.URISyntaxException;
import java.net.URLDecoder;
import java.time.Duration;
import java.util.*;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
@ -86,7 +89,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
private SignInAccountService signInAccountService;
@Resource
private SimpleClientApplyService simpleClientApplyService;
private Logger logger = LoggerFactory.getLogger(getClass());
private final Logger logger = LoggerFactory.getLogger(getClass());
@Resource
private ClientAccountMapper clientAccountMapper;
@Resource
@ -117,8 +120,6 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
private SmsSender smsSender;
@Resource
private StringRedisTemplate stringRedisTemplate;
private final int REGISTER_CLIENT_TEMPLID = 126978;
private final int REGISTER_CLIENT_TEMPLID_ENGLISH = 346078;
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";
@ -159,34 +160,18 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
if (StringUtils.isNotEmpty(value)) {
throw new BadRequestException("SMS has been sentPlease check your messages or try again in 3 minutes.");
}
ArrayList<String> param = new ArrayList<>();
String registerClientCode = RandomStringUtils.random(6, false, true);
param.add("RoyalPay");
param.add(registerClientCode);
String expireMin = "3";
param.add(expireMin);
logger.debug("send sms code : {} ", registerClientCode);
try {
if(request.getLocales().nextElement().equals(Locale.CHINESE)|| request.getLocales().nextElement().equals(Locale.SIMPLIFIED_CHINESE)){
smsSender.getSender().sendWithParam(nationCode.trim(), phoneNumber, REGISTER_CLIENT_TEMPLID, param, "RoyalPay", "", "");
}else{
smsSender.getSender().sendWithParam(nationCode.trim(), phoneNumber, REGISTER_CLIENT_TEMPLID_ENGLISH, param, "RoyalPay", "", "");
}
} catch (Exception e) {
e.printStackTrace();
throw new ServerErrorException("Phone number is wrong Please try again");
}
stringRedisTemplate.boundValueOps(getRegisterClientRedisKey(phoneNumber)).set(registerClientCode, Long.parseLong(expireMin), TimeUnit.MINUTES);
int expireMin = 3;
logger.debug("send {} sms code : {} ",phoneNumber, registerClientCode);
smsSender.sendAuthCodeMessage(nationCode.trim(),phoneNumber,request.getLocales().nextElement(),new AuthCodeMessage("RoyalPay", registerClientCode,expireMin));
stringRedisTemplate.boundValueOps(getRegisterClientRedisKey(phoneNumber)).set(registerClientCode, Duration.ofMinutes(expireMin));
return registerClientCode;
}
@Override
public void sendOpenSms(String phoneNumber, String nationCode) {
ArrayList<String> param = new ArrayList<>();
String phone_Number = phoneNumber.substring(0, 3) + "****" + phoneNumber.substring(7, phoneNumber.length());
param.add(phone_Number);
try {
smsSender.getSender().sendWithParam(nationCode.trim(), phoneNumber, 462770, param, "RoyalPay", "", "");
smsSender.sendOpenMessage(nationCode.trim(), phoneNumber, Locale.CHINESE, new OpenMessage(phoneNumber));
} catch (Exception e) {
e.printStackTrace();
throw new ServerErrorException("Phone number is wrong Please try again");
@ -857,24 +842,11 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
if (StringUtils.isNotEmpty(value)) {
throw new BadRequestException("SMS has been sentPlease check your messages or try again in 1 minutes.");
}
ArrayList<String> param = new ArrayList<>();
String registerClientCode = RandomStringUtils.random(6, false, true);
param.add("RoyalPay");
param.add(registerClientCode);
String expireMin = "1";
logger.debug("{} phone sms send code :{}",phoneNumber,registerClientCode);
param.add(expireMin);
try {
if(request.getLocales().nextElement().equals(Locale.CHINESE)|| request.getLocales().nextElement().equals(Locale.SIMPLIFIED_CHINESE)){
smsSender.getSender().sendWithParam(nationCode.trim(), phoneNumber, REGISTER_CLIENT_TEMPLID, param, "RoyalPay", "", "");
}else{
smsSender.getSender().sendWithParam(nationCode.trim(), phoneNumber, REGISTER_CLIENT_TEMPLID_ENGLISH, param, "RoyalPay", "", "");
}
} catch (Exception e) {
e.printStackTrace();
throw new ServerErrorException("Phone number is wrong Please try again");
}
stringRedisTemplate.boundValueOps(getLoginClientRedisKey(phoneNumber)).set(registerClientCode, Long.parseLong(expireMin), TimeUnit.MINUTES);
int expireMin = 1;
smsSender.sendAuthCodeMessage(nationCode.trim(),phoneNumber,request.getLocales().nextElement(),new AuthCodeMessage("RoyalPay", registerClientCode,expireMin));
stringRedisTemplate.boundValueOps(getLoginClientRedisKey(phoneNumber)).set(registerClientCode, Duration.ofMinutes(expireMin));
}
@Override

@ -74,6 +74,7 @@ import au.com.royalpay.payment.manage.signin.core.ManagerTodoNoticeProvider;
import au.com.royalpay.payment.manage.signin.core.SignInAccountService;
import au.com.royalpay.payment.manage.support.serverless.ServerlessFunctionTrigger;
import au.com.royalpay.payment.manage.support.sms.SmsSender;
import au.com.royalpay.payment.manage.support.sms.msg.RefuseMessage;
import au.com.royalpay.payment.manage.system.core.ClientContractService;
import au.com.royalpay.payment.manage.system.core.MailGunService;
import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery;
@ -205,9 +206,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
private ClientComplianceApply clientComplianceApply;
@Resource
private ClientIncrementalMapper clientIncrementalMapper;
@Value("${client_card.account_reserve}")
private String cardAccountReserve;
@Value("${client_card.annual_rate}")
private String cardAnnualRate;
@ -364,7 +362,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Resource
private MpWechatApiProvider mpWechatApiProvider;
private final int REFUSE_CLIENT_TEMPLID = 166108;
@Resource
private PaymentChannelMccGoodMapper paymentChannelMccGoodMapper;
@ -4968,13 +4965,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client.getIntValue("source") == 4) {
String contactPhone = client.getString("contact_phone");
if (contactPhone.startsWith("+61")) {
ArrayList<String> param = new ArrayList<>();
param.add(refuseRemark);
try {
smsSender.getSender().sendWithParam("61", contactPhone.replace("+61", ""), REFUSE_CLIENT_TEMPLID, param, "RoyalPay", "", "");
} catch (Exception ignore) {
throw new ServerErrorException("Phone number is wrong :" + contactPhone);
}
smsSender.sendRefuseMessage("61", contactPhone, Locale.CHINESE, new RefuseMessage(refuseRemark));
}
}
if (client.getIntValue("source") == 5) {
@ -5015,13 +5006,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client.getIntValue("source") == 4) {
String contactPhone = client.getString("contact_phone");
if (contactPhone.startsWith("+61")) {
ArrayList<String> param = new ArrayList<>();
param.add(refuseRemark);
try {
smsSender.getSender().sendWithParam("61", contactPhone.replace("+61", ""), REFUSE_CLIENT_TEMPLID, param, "RoyalPay", "", "");
} catch (Exception ignore) {
throw new ServerErrorException("Phone number is wrong :" + contactPhone);
}
smsSender.sendRefuseMessage("61", contactPhone, Locale.CHINESE, new RefuseMessage(refuseRemark));
}
}
if (client.getIntValue("source") == 5) {

@ -15,12 +15,12 @@ import au.com.royalpay.payment.manage.signin.core.SignInStatusManager;
import au.com.royalpay.payment.manage.signin.events.ClientLoginEvent;
import au.com.royalpay.payment.manage.signin.events.ManagerLoginEvent;
import au.com.royalpay.payment.manage.support.sms.SmsSender;
import au.com.royalpay.payment.manage.support.sms.msg.AuthCodeMessage;
import au.com.royalpay.payment.manage.system.core.PermissionClientModulesService;
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import au.com.royalpay.payment.tools.env.RequestEnvironment;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
import au.com.royalpay.payment.tools.locale.LocaleSupport;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
@ -44,10 +44,7 @@ import org.thymeleaf.spring5.SpringTemplateEngine;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@ -105,7 +102,7 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
private final String[] KYC_FILE_KEYS = {"client_bank_file", "kyc_utility_bill_file", "client_id_file"};
private final String[] KYC_PUT_KEYS = {"file_bank_info", "utility_bill_info", "file_id_info"};
private final String[] KYC_FILE_NAMES = {"* ASIC File", "Utility Bill Files", "* ID"};
private final int RESET_PASSWORD_TEMPLID = 126978;
private ApplicationEventPublisher publisher;
private static final List<String> tags = new ArrayList<>();
@ -574,17 +571,7 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
});
break;
case "phone":
ArrayList<String> param = new ArrayList<>();
param.add("密码重置服务");
param.add(codeKeyValue);
String expireMin = "5";
param.add(expireMin);
try {
smsSender.getSender().sendWithParam(account.getString("nation_code").trim(), account.getString("contact_phone"), RESET_PASSWORD_TEMPLID, param, "RoyalPay", "", "");
} catch (Exception e) {
e.printStackTrace();
throw new ServerErrorException("Phone number is wrong.Please try again.");
}
smsSender.sendAuthCodeMessage(account.getString("nation_code").trim(), account.getString("contact_phone"), Locale.ENGLISH, new AuthCodeMessage("密码重置服务", codeKeyValue, 5));
break;
}
stringRedisTemplate.boundValueOps(getResetClientAccountKey(accountId)).set(codeKeyValue, 5, TimeUnit.MINUTES);
@ -620,17 +607,7 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
});
break;
case "phone":
ArrayList<String> param = new ArrayList<>();
param.add("密码重置服务");
param.add(codeKeyValue);
String expireMin = "5";
param.add(expireMin);
try {
smsSender.getSender().sendWithParam(account.getString("nation_code").trim(), account.getString("phone"), RESET_PASSWORD_TEMPLID, param, "RoyalPay", "", "");
} catch (Exception e) {
e.printStackTrace();
throw new ServerErrorException("Phone number is wrong.Please try again.");
}
smsSender.sendAuthCodeMessage(account.getString("nation_code").trim(), account.getString("phone"), Locale.CHINESE, new AuthCodeMessage("密码重置服务",codeKeyValue,5));
break;
}
stringRedisTemplate.boundValueOps(getResetManagerAccountKey(managerId)).set(codeKeyValue, 5, TimeUnit.MINUTES);

@ -1,33 +1,17 @@
package au.com.royalpay.payment.manage.support.sms;
import com.github.qcloudsms.SmsSingleSender;
import au.com.royalpay.payment.manage.support.sms.msg.OpenMessage;
import au.com.royalpay.payment.manage.support.sms.msg.RefuseMessage;
import au.com.royalpay.payment.manage.support.sms.msg.AuthCodeMessage;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.util.Locale;
import javax.annotation.PostConstruct;
public interface SmsSender {
/**
* @author kira
* @date 2018/8/1
*/
@Component
public class SmsSender {
@Value("${royalpay.sms.appid:1400094878}")
private int appId;
@Value("${royalpay.sms.appkey:43390d81e20c5191c278fbf4cd275be2}")
private String appKey;
void sendOpenMessage(String nationCode, String mobile, Locale locale, OpenMessage msg);
private SmsSingleSender sender = null;
@PostConstruct
public void init() {
sender = new SmsSingleSender(appId, appKey);
}
public SmsSingleSender getSender(){
return sender;
}
void sendAuthCodeMessage(String nationCode, String mobile, Locale locale, AuthCodeMessage register);
void sendRefuseMessage(String nationCode, String mobile, Locale locale, RefuseMessage refuse);
}

@ -0,0 +1,7 @@
package au.com.royalpay.payment.manage.support.sms;
import org.springframework.core.Ordered;
public interface SmsSenderChannel extends SmsSender, Ordered {
boolean supportNationCode(String nationCode);
}

@ -0,0 +1,140 @@
package au.com.royalpay.payment.manage.support.sms;
import au.com.royalpay.payment.manage.support.sms.daas.DaasMessageTemplate;
import au.com.royalpay.payment.manage.support.sms.daas.OpenMessageTemplate;
import au.com.royalpay.payment.manage.support.sms.daas.RefuseMessageTemplate;
import au.com.royalpay.payment.manage.support.sms.daas.AuthCodeMessageTemplate;
import au.com.royalpay.payment.manage.support.sms.msg.OpenMessage;
import au.com.royalpay.payment.manage.support.sms.msg.RefuseMessage;
import au.com.royalpay.payment.manage.support.sms.msg.AuthCodeMessage;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
import org.apache.commons.codec.binary.Base64;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.RequestEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.http.converter.FormHttpMessageConverter;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.stereotype.Service;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestClientResponseException;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.server.ServerErrorException;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.NoSuchAlgorithmException;
import java.util.Locale;
import java.util.Optional;
@Service
@ConditionalOnProperty(value = "royalpay.sms.daas.enable", havingValue = "true")
public class SmsSenderDaasImpl implements SmsSenderChannel {
private final Logger logger = LoggerFactory.getLogger(getClass());
private final String secretId;
private final String secretKey;
private final RestTemplate restTemplate;
private static final String URL = "https://service-rzq04n9p-1255701024.sh.apigw.tencentcs.com/release/superapi/super/sms/internation/single";
public SmsSenderDaasImpl(@Value("${royalpay.sms.daas.secret-id}") String secretId, @Value("${royalpay.sms.daas.secret-key}") String secretKey) {
this.secretId = secretId;
this.secretKey = secretKey;
this.restTemplate = new RestTemplateBuilder().messageConverters(new FormHttpMessageConverter(),
new StringHttpMessageConverter(StandardCharsets.UTF_8),
new FastJsonHttpMessageConverter())
.build();
}
@Override
public void sendOpenMessage(String nationCode, String mobile, Locale locale, OpenMessage msg) {
sendSms(nationCode, mobile, new OpenMessageTemplate(msg));
}
@Override
public void sendAuthCodeMessage(String nationCode, String mobile, Locale locale, AuthCodeMessage register) {
sendSms(nationCode, mobile, new AuthCodeMessageTemplate(locale, register));
}
@Override
public void sendRefuseMessage(String nationCode, String mobile, Locale locale, RefuseMessage refuse) {
sendSms(nationCode, mobile, new RefuseMessageTemplate(refuse));
}
private void sendSms(String nationCode, String mobile, DaasMessageTemplate tpl) {
MultiValueMap<String, String> body = new LinkedMultiValueMap<>();
body.add("mobile", nationCode + mobile.replaceAll("^(\\+61)(61)", ""));
body.add("msg", "[RoyalPay]" + tpl.getMessage());
RequestEntity<MultiValueMap<String, String>> request = RequestEntity.post(URI.create(URL))
.headers(signature()).contentType(MediaType.APPLICATION_FORM_URLENCODED)
.body(body);
try {
ResponseEntity<JSONObject> resp = restTemplate.exchange(request, JSONObject.class);
JSONObject respBody = resp.getBody();
logger.debug("daas sms response:{}", respBody);
Optional.ofNullable(respBody)
.map(resBody -> resBody.getJSONArray("data"))
.filter(arr -> !arr.isEmpty())
.map(dataArr -> dataArr.getJSONObject(0))
.ifPresent(data -> {
JSONObject record0 = data.getJSONArray("record").getJSONObject(0);
logger.info("send sms success:[{}]{}, messageNum:{}", record0.getString("resCode"), record0.getString("resDesc"), data.getString("recordNum"));
});
} catch (RestClientResponseException e) {
logger.error("request sms service failed:[{}]{}", e.getRawStatusCode(), e.getResponseBodyAsString(), e);
} catch (RestClientException e) {
logger.error("request sms service failed", e);
}
}
private HttpHeaders signature() {
String source = "market";
String datetime = DateTime.now().withZone(DateTimeZone.UTC).toString("EEE, dd MMM yyyy HH:mm:ss 'GMT'", Locale.ENGLISH);
try {
String auth = calcAuthorization(source, secretId, secretKey, datetime);
MultiValueMap<String, String> headers = new LinkedMultiValueMap<>();
headers.add("X-Source", source);
headers.add("X-Date", datetime);
headers.add("Authorization", auth);
return new HttpHeaders(headers);
} catch (NoSuchAlgorithmException | UnsupportedEncodingException | InvalidKeyException e) {
throw new ServerErrorException("Signature failed", e);
}
}
public static String calcAuthorization(String source, String secretId, String secretKey, String datetime)
throws NoSuchAlgorithmException, UnsupportedEncodingException, InvalidKeyException {
String signStr = "x-date: " + datetime + "\n" + "x-source: " + source;
Mac mac = Mac.getInstance("HmacSHA1");
Key sKey = new SecretKeySpec(secretKey.getBytes(StandardCharsets.UTF_8), mac.getAlgorithm());
mac.init(sKey);
byte[] hash = mac.doFinal(signStr.getBytes(StandardCharsets.UTF_8));
String sig = Base64.encodeBase64String(hash);
return "hmac id=\"" + secretId + "\", algorithm=\"hmac-sha1\", headers=\"x-date x-source\", signature=\"" + sig + "\"";
}
@Override
public boolean supportNationCode(String nationCode) {
return "61".equals(nationCode);
}
@Override
public int getOrder() {
return 100;
}
}

@ -0,0 +1,75 @@
package au.com.royalpay.payment.manage.support.sms;
import au.com.royalpay.payment.manage.support.sms.msg.OpenMessage;
import au.com.royalpay.payment.manage.support.sms.msg.RefuseMessage;
import au.com.royalpay.payment.manage.support.sms.msg.AuthCodeMessage;
import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
import com.github.qcloudsms.SmsSingleSender;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.core.Ordered;
import org.springframework.stereotype.Component;
import java.util.Locale;
/**
* @author kira
* @date 2018/8/1
*/
@Component
@ConditionalOnProperty(value = "royalpay.sms.qcloud.enable", havingValue = "true")
public class SmsSenderQcloudImpl implements SmsSenderChannel {
private static final int OPEN_MESSAGE_ID = 462770;
private static final int REGISTER_CLIENT_TEMPLID_ZH = 126978;
private static final int REGISTER_CLIENT_TEMPLID_EN = 346078;
private static final int REFUSE_CLIENT_TEMPLID = 166108;
private final SmsSingleSender sender;
private final String sign;
public SmsSenderQcloudImpl(@Value("${royalpay.sms.qcloud.appid}") int appId, @Value("${royalpay.sms.qcloud.appkey}") String appKey) {
sender = new SmsSingleSender(appId, appKey);
sign = "RoyalPay";
}
public SmsSingleSender getSender() {
return sender;
}
@Override
public void sendOpenMessage(String nationCode, String mobile, Locale locale, OpenMessage msg) {
sendMessage(nationCode, mobile, OPEN_MESSAGE_ID, msg.getMaskedPhoneNumber());
}
private void sendMessage(String nationCode, String mobile, int tplId, String... param) {
try {
sender.sendWithParam(nationCode, mobile.replace("+61", ""), tplId, param, sign, "", "");
} catch (Exception e) {
throw new ServerErrorException("Phone number is wrong :" + mobile, e);
}
}
@Override
public void sendAuthCodeMessage(String nationCode, String mobile, Locale locale, AuthCodeMessage register) {
if (locale.equals(Locale.CHINESE) || locale.equals(Locale.SIMPLIFIED_CHINESE)) {
sendMessage(nationCode, mobile, REGISTER_CLIENT_TEMPLID_ZH, register.getBiz(), register.getCode(), register.getExpireMin() + "");
} else {
sendMessage(nationCode, mobile, REGISTER_CLIENT_TEMPLID_EN, register.getBiz(), register.getCode(), register.getExpireMin() + "");
}
}
@Override
public void sendRefuseMessage(String nationCode, String mobile, Locale locale, RefuseMessage refuse) {
sendMessage(nationCode, mobile, REFUSE_CLIENT_TEMPLID, refuse.getReason());
}
@Override
public boolean supportNationCode(String nationCode) {
return true;
}
@Override
public int getOrder() {
return Integer.MAX_VALUE;
}
}

@ -0,0 +1,35 @@
package au.com.royalpay.payment.manage.support.sms;
import au.com.royalpay.payment.manage.support.sms.msg.AuthCodeMessage;
import au.com.royalpay.payment.manage.support.sms.msg.OpenMessage;
import au.com.royalpay.payment.manage.support.sms.msg.RefuseMessage;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Locale;
@Service
@Primary
public class SmsSenderRoute implements SmsSender{
private final List<SmsSenderChannel> channels;
public SmsSenderRoute(List<SmsSenderChannel> channels) {
this.channels = channels;
}
@Override
public void sendOpenMessage(String nationCode, String mobile, Locale locale, OpenMessage msg) {
channels.stream().filter(channel->channel.supportNationCode(nationCode)).findFirst().ifPresent(channel->channel.sendOpenMessage(nationCode, mobile, locale, msg));
}
@Override
public void sendAuthCodeMessage(String nationCode, String mobile, Locale locale, AuthCodeMessage register) {
channels.stream().filter(channel->channel.supportNationCode(nationCode)).findFirst().ifPresent(channel->channel.sendAuthCodeMessage(nationCode, mobile, locale, register));
}
@Override
public void sendRefuseMessage(String nationCode, String mobile, Locale locale, RefuseMessage refuse) {
channels.stream().filter(channel->channel.supportNationCode(nationCode)).findFirst().ifPresent(channel->channel.sendRefuseMessage(nationCode, mobile, locale, refuse));
}
}

@ -0,0 +1,27 @@
package au.com.royalpay.payment.manage.support.sms.daas;
import au.com.royalpay.payment.manage.support.sms.msg.AuthCodeMessage;
import java.util.Locale;
public class AuthCodeMessageTemplate implements DaasMessageTemplate {
private static final String CN_TPL = "您正在申请%s验证码为%s%s分钟内有效请勿向任何人提供此验证码";
private static final String EN_TPL = "Your %s secret code is %svalid for %s minutes). Do not provide this to anyone.";
private final Locale locale;
private final AuthCodeMessage register;
public AuthCodeMessageTemplate(Locale locale, AuthCodeMessage register) {
this.locale = locale;
this.register = register;
}
@Override
public String getMessage() {
String tpl = EN_TPL;
if (locale.equals(Locale.CHINESE) || locale.equals(Locale.SIMPLIFIED_CHINESE)) {
tpl = CN_TPL;
}
return String.format(tpl, register.getBiz(), register.getCode(), register.getExpireMin());
}
}

@ -0,0 +1,9 @@
package au.com.royalpay.payment.manage.support.sms.daas;
import org.springframework.util.MultiValueMap;
public interface DaasMessageTemplate {
String getMessage();
}

@ -0,0 +1,19 @@
package au.com.royalpay.payment.manage.support.sms.daas;
import au.com.royalpay.payment.manage.support.sms.msg.OpenMessage;
public class OpenMessageTemplate implements DaasMessageTemplate {
private static final String TEMPLATE = "尊敬的商户,恭喜您注册成功,请使用您的(%s账户登录网址(https://mpay.royalpay.com.au/)或者使用RoyalPay手机App。您可以使用RoyalPay所有的功能包括接受客户的付款在您激活账号之前RoyalPay将不执行清算操作。因此请您尽快提交合规材料若有任何疑问请联系我们客服。";
private final OpenMessage openMessage;
public OpenMessageTemplate(OpenMessage openMessage) {
this.openMessage = openMessage;
}
@Override
public String getMessage() {
return String.format(TEMPLATE, openMessage.getMaskedPhoneNumber());
}
}

@ -0,0 +1,17 @@
package au.com.royalpay.payment.manage.support.sms.daas;
import au.com.royalpay.payment.manage.support.sms.msg.RefuseMessage;
public class RefuseMessageTemplate implements DaasMessageTemplate{
private static final String TPL = "尊敬的RoyalPay商户您提交的商户资料审核不通过原因%s,请登录系统后台修改后,重新提交审核。[RoyalPay合规部]";
private final RefuseMessage refuseMessage;
public RefuseMessageTemplate(RefuseMessage refuseMessage) {
this.refuseMessage = refuseMessage;
}
@Override
public String getMessage() {
return String.format(TPL,refuseMessage.getReason());
}
}

@ -0,0 +1,25 @@
package au.com.royalpay.payment.manage.support.sms.msg;
public class AuthCodeMessage {
private final String biz;
private final String code;
private final int expireMin;
public AuthCodeMessage(String biz, String code, int expireMin) {
this.biz = biz;
this.code = code;
this.expireMin = expireMin;
}
public String getBiz() {
return biz;
}
public String getCode() {
return code;
}
public int getExpireMin() {
return expireMin;
}
}

@ -0,0 +1,14 @@
package au.com.royalpay.payment.manage.support.sms.msg;
public class OpenMessage {
private final String phoneNumber;
public OpenMessage(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public String getMaskedPhoneNumber(){
return new StringBuilder(phoneNumber).replace(3,7,"****").toString();
}
}

@ -0,0 +1,13 @@
package au.com.royalpay.payment.manage.support.sms.msg;
public class RefuseMessage {
private final String reason;
public RefuseMessage(String reason) {
this.reason = reason;
}
public String getReason() {
return reason;
}
}

@ -0,0 +1,4 @@
package au.com.royalpay.payment.manage.support.sms.qcloud;
public interface QCloudMessageTemplate {
}

@ -120,8 +120,14 @@ qcloud:
secret-key: YswoQDsIZfWEqEAEvMXS8Yic84lFn9Jp
royalpay:
sms:
appid: 1400094878
appkey: 43390d81e20c5191c278fbf4cd275be2
qcloud:
appid: 1400094878
appkey: 43390d81e20c5191c278fbf4cd275be2
enable: true
daas:
secret-id: AKIDKR8WAXdaRcfbZysCU41K6ViGMwL2XG49zdDE
secret-key: 15ug40UL3X74v7705tKqb2u0bmqyOr873Yyyn41C
enable: true
settle:
abafile:
bank:

@ -105,6 +105,9 @@
border-radius: 4px;
height: 50px;
}
.threeds-container .dialog{
width:100%;
}
}
.btn-warning {
@ -184,4 +187,49 @@
60% {
opacity: 1;
}
}
}
.threeds-container {
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
background: rgba(0, 0, 0, .4);
display: block;
}
.threeds-container.hide{
display: none;
}
.threeds-container .dialog{
display: block;
max-width: 768px;
width: 100%;
position: relative;
margin: 40px auto;
background: #fff;
}
.threeds-container .dialog>.title{
width: 100%;
display: block;
padding: 5px;
background: #ff6633;
color: white;
font-size: 1.2em;
font-weight: bold;
}
.threeds-container .dialog>.framebox{
width: 100%;
overflow: auto;
max-height: 80%;
}
.threeds-container .dialog>.framebox>iframe{
border: none;
width: 100%;
height: 400px;
}

@ -4,6 +4,46 @@ $(function () {
let cardFrame = new CardInputFrame($container, window.card_input_appid, window.card_input_token);
let $errorMsgBox = $('#errorMsgBox');
let loading = $('.loading-container');
function bindEvent(element, eventName, eventHandler) {
if (element.addEventListener) {
element.addEventListener(eventName, eventHandler, true);
} else if (element.attachEvent) {
element.attachEvent('on' + eventName, eventHandler);
}
}
bindEvent(window, 'message', function (evt) {
if (!evt.data) {
return
}
let msg = typeof evt.data == 'string' ? JSON.parse(evt.data) : evt.data;
if (msg && msg.type == '3dsResult') {
evt.stopPropagation();
evt.stopImmediatePropagation();
if (msg.success) {
location.href = './result'
} else {
$errorMsgBox.text('[' + evt.errCode + ']' + evt.errMsg).show();
}
$('.threeds-container').addClass('hide');
}
})
if (window.three_ds_params) {
handleThreeDs(window.three_ds_params)
}
function handleThreeDs(threeDsParams) {
let form = $('<form></form>').attr('action', threeDsParams.acs_url).attr('method', 'post').css('display', 'none')
.attr('target', 'threeds-frame');
$('<input>').attr('name', 'PaReq').val(threeDsParams.pa_req).attr('type', 'hidden').appendTo(form);
$('<input>').attr('name', 'TermUrl').val(threeDsParams.term_url).attr('type', 'hidden').appendTo(form);
$('body').append(form);
form.submit();
$('.threeds-container').removeClass('hide')
}
cardFrame.onSuccess = function (secretData) {
$.ajax({
url: 'commit',
@ -12,12 +52,9 @@ $(function () {
method: 'POST',
success: function (res) {
if (res.sdk_params) {
loading.addClass('hide')
let threeDsParams = JSON.parse(res.sdk_params);
let form = $('<form></form>').attr('action', threeDsParams.acs_url).attr('method', 'post').css('display', 'none');
$('<input>').attr('name', 'PaReq').val(threeDsParams.pa_req).attr('type', 'hidden').appendTo(form);
$('<input>').attr('name', 'TermUrl').val(threeDsParams.term_url).attr('type', 'hidden').appendTo(form);
$('body').append(form);
form.submit();
handleThreeDs(threeDsParams);
return;
}
startCheckOrder(window.client_moniker, window.partner_order_id);

@ -0,0 +1,23 @@
package au.com.royalpay.payment.manage.support.sms;
import au.com.royalpay.payment.manage.support.sms.msg.AuthCodeMessage;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.util.Locale;
import static org.junit.jupiter.api.Assertions.*;
class SmsSenderDaasImplTest {
private SmsSender sender;
@BeforeEach
void initService() {
sender = new SmsSenderQcloudImpl(1400094878, "43390d81e20c5191c278fbf4cd275be2");
}
@Test
void testSms() {
sender.sendAuthCodeMessage("86", "18913315655", Locale.CHINESE, new AuthCodeMessage("测试", "111", 1));
}
}
Loading…
Cancel
Save