From 09976bbab9944c8e02dcfdd4b1e9f8226cfb8cf3 Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Wed, 23 May 2018 13:42:54 +0800 Subject: [PATCH] tmp --- .../core/SimpleClientApplyService.java | 2 +- .../impls/SimpleClientApplyServiceImpl.java | 40 +++++++++++++++++++ .../web/SimpleClientApplyController.java | 2 +- .../merchants/beans/NewAccountBean.java | 10 +++++ src/main/resources/application.properties | 5 +++ 5 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 src/main/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImpl.java diff --git a/src/main/java/au/com/royalpay/payment/manage/application/core/SimpleClientApplyService.java b/src/main/java/au/com/royalpay/payment/manage/application/core/SimpleClientApplyService.java index 008d754c4..9e02379d4 100644 --- a/src/main/java/au/com/royalpay/payment/manage/application/core/SimpleClientApplyService.java +++ b/src/main/java/au/com/royalpay/payment/manage/application/core/SimpleClientApplyService.java @@ -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); diff --git a/src/main/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImpl.java new file mode 100644 index 000000000..658c11e0d --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImpl.java @@ -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; + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/application/web/SimpleClientApplyController.java b/src/main/java/au/com/royalpay/payment/manage/application/web/SimpleClientApplyController.java index 1a8a47e00..b7ad70d2d 100644 --- a/src/main/java/au/com/royalpay/payment/manage/application/web/SimpleClientApplyController.java +++ b/src/main/java/au/com/royalpay/payment/manage/application/web/SimpleClientApplyController.java @@ -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"); } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/beans/NewAccountBean.java b/src/main/java/au/com/royalpay/payment/manage/merchants/beans/NewAccountBean.java index ca16c3f56..4fd5f8981 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/beans/NewAccountBean.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/beans/NewAccountBean.java @@ -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; + } } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index bc53561d1..490a6d3f3 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -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