wangning 7 years ago
parent 0851f793a0
commit 09976bbab9

@ -4,7 +4,7 @@ import au.com.royalpay.payment.manage.merchants.beans.NewAccountBean;
import com.alibaba.fastjson.JSONObject;
public interface SimpleClientApplyService {
String getSMSVerifyCode(String codeKey);
String getSMSVerifyCode(String codeKey,String phoneNumber,String nationCode);
JSONObject newAccount(NewAccountBean accountBean);

@ -0,0 +1,40 @@
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.tools.utils.sms.SmsSingleSender;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Value;
public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
@Value("${royalpay.sms.appid}")
private int appId;
@Value("${royalpay.sms.appkey}")
private String appKey;
private final SmsSingleSender smsSingleSender = new SmsSingleSender(appId,appKey);
@Override
String getSMSVerifyCode(String codeKey,String phoneNumber,String nationCode){
// smsSingleSender.sendWithParam();
return null;
}
@Override
public JSONObject newAccount(NewAccountBean accountBean) {
return null;
}
@Override
public void deleteSMSVerifyCodeKey(String codeKey) {
}
@Override
public String partnerSignIn(JSONObject account) {
return null;
}
}

@ -21,7 +21,7 @@ public class SimpleClientApplyController {
@RequestMapping(value = "/account/{codeKey}", method = RequestMethod.POST)
public void registerAccount(@PathVariable String codeKey, @RequestBody @Valid NewAccountBean accountBean, Errors errors, HttpServletResponse response) throws Exception {
HttpUtils.handleValidErrors(errors);
String codeValue = simpleClientApplyService.getSMSVerifyCode(codeKey);
String codeValue = simpleClientApplyService.getSMSVerifyCode(codeKey,accountBean.getContactPhone(),accountBean.getNation_code());
if (codeValue == null || !codeValue.equals(accountBean.getUsername())) {
throw new Exception("Verification code has expired or is not correct");
}

@ -18,6 +18,8 @@ public class NewAccountBean {
private String displayName;
@JSONField(name = "contact_phone")
private String contactPhone;
@JSONField(name = "nation_code")
private String nation_code = "+61";
private int role = PartnerRole.CASHIER.getCode();
public JSONObject toJson() {
@ -70,4 +72,12 @@ public class NewAccountBean {
public void setContactPhone(String contactPhone) {
this.contactPhone = contactPhone;
}
public String getNation_code() {
return nation_code;
}
public void setNation_code(String nation_code) {
this.nation_code = nation_code;
}
}

@ -106,3 +106,8 @@ mail.mailgun.domain=mail.royalpay.com.au
mail.mailgun.default.merchantlist=merchants@mail.royalpay.com.au
##############
##短信key
##############
royalpay.sms.appid=1400035361
royalpay.sms.appkey=d6e7cc6400ecd159963c1972cdb088cf

Loading…
Cancel
Save