diff --git a/pom.xml b/pom.xml index d2d370dfe..c7dd78e36 100644 --- a/pom.xml +++ b/pom.xml @@ -136,7 +136,11 @@ com.alibaba druid - + + com.github.qcloudsms + qcloudsms + 1.0.3 + cn.jpush.api diff --git a/src/db/modify.sql b/src/db/modify.sql index 12073aaad..18f1aa781 100644 --- a/src/db/modify.sql +++ b/src/db/modify.sql @@ -488,9 +488,9 @@ CREATE TABLE `pmt_directed_bill_code` ( PRIMARY KEY (`bill_code_id`), KEY `client_id` (`client_id`), KEY `order_id` (`order_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -ALTER TABLE `act_red_packets_customer` ADD COLUMN `rule_max_num_limit` tinyint(1) DEFAULT 1 COMMENT '0:Whole Activity,1:day' +ALTER TABLE `act_red_packets_customer` ADD COLUMN `rule_max_num_limit` tinyint(1) DEFAULT 1 COMMENT '0:Whole Activity,1:day'; @@ -505,4 +505,35 @@ CREATE TABLE `sys_mail_send` ( PRIMARY KEY (`id`,`mail_address`), KEY `mail_address` (`mail_address`), KEY `id` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 \ No newline at end of file +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 + +alter table sys_clients add column mail_confirm tinyint(1) default '0' COMMENT '0: 未验证,1已验证'; + +CREATE TABLE `sys_client_pre_apply` ( + `client_pre_apply_id` int(11) NOT NULL AUTO_INCREMENT, + `password` varchar(20) DEFAULT '', + `contact_person` varchar(50) DEFAULT NULL, + `contact_phone` varchar(20) DEFAULT '', + `contact_email` varchar(255) DEFAULT NULL, + `company_name` varchar(100) DEFAULT NULL, + `abn` varchar(20) DEFAULT NULL, + `short_name` varchar(50) DEFAULT NULL, + `address` varchar(200) DEFAULT NULL, + `suburb` varchar(50) DEFAULT NULL, + `state` varchar(20) DEFAULT NULL, + `postcode` varchar(20) DEFAULT NULL, + `industry` varchar(50) DEFAULT NULL, + `bank_no` varchar(20) DEFAULT NULL, + `bank_name` varchar(50) DEFAULT NULL, + `bsb_no` varchar(6) DEFAULT NULL, + `clean_days` smallint(6) DEFAULT NULL, + `create_time` datetime DEFAULT NULL, + `update_time` datetime DEFAULT NULL, + `agree` tinyint(1) DEFAULT NULL, + `company_phone` varchar(20) DEFAULT NULL, + PRIMARY KEY (`client_pre_apply_id`), + UNIQUE KEY `username` (`username`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + + +alter table sys_accounts add COLUMN nation_code VARCHAR(5) DEFAULT NULL ; \ No newline at end of file diff --git a/src/main/java/au/com/royalpay/payment/manage/application/beans/ClientPreApplyBean.java b/src/main/java/au/com/royalpay/payment/manage/application/beans/ClientPreApplyBean.java new file mode 100644 index 000000000..d00e8e90a --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/application/beans/ClientPreApplyBean.java @@ -0,0 +1,228 @@ +package au.com.royalpay.payment.manage.application.beans; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; + +import org.apache.commons.lang3.StringUtils; +import org.hibernate.validator.constraints.NotEmpty; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by yuan on 2018/5/23. + */ +public class ClientPreApplyBean { + @NotEmpty(message = "username can't be null") + private String username; + @NotEmpty(message = "password can't be null") + private String password; + @NotEmpty(message = "contact_person can't be null") + private String contact_person; + @NotEmpty(message = "contact_phone can't be null") + private String contact_phone; + @NotEmpty(message = "contact_email can't be null") + private String contact_email; + @NotEmpty(message = "company_name can't be null") + private String company_name; + @NotEmpty(message = "company_phone can't be null") + private String company_phone; + @NotEmpty(message = "abn can't be null") + private String abn; + @NotEmpty(message = "short_name can't be null") + private String short_name; + @NotEmpty(message = "address can't be null") + private String address; + @NotEmpty(message = "suburb can't be null") + private String suburb; + @NotEmpty(message = "state can't be null") + private String state; + @NotEmpty(message = "postcode can't be null") + private String postcode; + @NotEmpty(message = "industry can't be null") + private String industry; + @NotEmpty(message = "bank_no can't be null") + private String bank_no; + @NotEmpty(message = "bank_name can't be null") + private String bank_name; + @NotEmpty(message = "bsb_no can't be null") + private String bsb_no; + @NotEmpty(message = "clean_days can't be null") + private String clean_days; + @NotEmpty(message = "codeKey can't be null") + private String codeKey; + private boolean agree; + + public JSONObject insertObject() { + JSONObject res = (JSONObject) JSON.toJSON(this); + List keys = new ArrayList<>(); + res.keySet().forEach(p-> { + if (StringUtils.isEmpty(res.getString(p).trim())) { + keys.add(p); + } + }); + keys.forEach(p->{ + res.remove(p); + }); + return res; + } + public String getCompany_name() { + return company_name; + } + + public void setCompany_name(String company_name) { + this.company_name = company_name; + } + + public String getAbn() { + return abn; + } + + public void setAbn(String abn) { + this.abn = abn; + } + + public String getShort_name() { + return short_name; + } + + public void setShort_name(String short_name) { + this.short_name = short_name; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public String getSuburb() { + return suburb; + } + + public void setSuburb(String suburb) { + this.suburb = suburb; + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + public String getPostcode() { + return postcode; + } + + public void setPostcode(String postcode) { + this.postcode = postcode; + } + + public String getIndustry() { + return industry; + } + + public void setIndustry(String industry) { + this.industry = industry; + } + + public String getBank_no() { + return bank_no; + } + + public void setBank_no(String bank_no) { + this.bank_no = bank_no; + } + + public String getBank_name() { + return bank_name; + } + + public void setBank_name(String bank_name) { + this.bank_name = bank_name; + } + + public String getBsb_no() { + return bsb_no; + } + + public void setBsb_no(String bsb_no) { + this.bsb_no = bsb_no; + } + + public String getClean_days() { + return clean_days; + } + + public void setClean_days(String clean_days) { + this.clean_days = clean_days; + } + + public boolean isAgree() { + return agree; + } + + public void setAgree(boolean agree) { + this.agree = agree; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getContact_person() { + return contact_person; + } + + public void setContact_person(String contact_person) { + this.contact_person = contact_person; + } + + public String getContact_phone() { + return contact_phone; + } + + public void setContact_phone(String contact_phone) { + this.contact_phone = contact_phone; + } + + public String getContact_email() { + return contact_email; + } + + public void setContact_email(String contact_email) { + this.contact_email = contact_email; + } + + public String getCompany_phone() { + return company_phone; + } + + public void setCompany_phone(String company_phone) { + this.company_phone = company_phone; + } + + public String getCodeKey() { + return codeKey; + } + + public void setCodeKey(String codeKey) { + this.codeKey = codeKey; + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/application/beans/ClientPreApplyStep1Bean.java b/src/main/java/au/com/royalpay/payment/manage/application/beans/ClientPreApplyStep1Bean.java new file mode 100644 index 000000000..23b1a0a18 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/application/beans/ClientPreApplyStep1Bean.java @@ -0,0 +1,78 @@ +package au.com.royalpay.payment.manage.application.beans; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; + +import org.hibernate.validator.constraints.NotEmpty; + +/** + * Created by yuan on 2018/5/23. + */ +public class ClientPreApplyStep1Bean { + @NotEmpty(message = "username can't be null") + private String username; + @NotEmpty(message = "password can't be null") + private String password; + @NotEmpty(message = "contact_person can't be null") + private String contact_person; + @NotEmpty(message = "contact_phone can't be null") + private String contact_phone; + @NotEmpty(message = "contact_email can't be null") + private String contact_email; + @NotEmpty(message = "phoneCodeKey can't be null") + private String phoneCodeKey; + + + public JSONObject insertObject() { + JSONObject res = (JSONObject) JSON.toJSON(this); + return res; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getContact_person() { + return contact_person; + } + + public void setContact_person(String contact_person) { + this.contact_person = contact_person; + } + + public String getContact_phone() { + return contact_phone; + } + + public void setContact_phone(String contact_phone) { + this.contact_phone = contact_phone; + } + + public String getContact_email() { + return contact_email; + } + + public void setContact_email(String contact_email) { + this.contact_email = contact_email; + } + + public String getPhoneCodeKey() { + return phoneCodeKey; + } + + public void setPhoneCodeKey(String phoneCodeKey) { + this.phoneCodeKey = phoneCodeKey; + } +} 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 new file mode 100644 index 000000000..e47105ef4 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/application/core/SimpleClientApplyService.java @@ -0,0 +1,33 @@ +package au.com.royalpay.payment.manage.application.core; + +import au.com.royalpay.payment.manage.merchants.beans.NewAccountBean; + +import com.alibaba.fastjson.JSONObject; + +public interface SimpleClientApplyService { + void verifyRegisterSMSCode(String codeKey, String phoneNumber); + + JSONObject newAccount(NewAccountBean accountBean); + + String partnerSignIn(JSONObject account); + + String getAndSendSmsCode(String phoneNumber, String nationCode); + + String checkOrGenerateRegisterProcessKey(String accountName, String codeKey); + + void deleteRegisterProcessKey(String codeKey); + + void sendVerifyEmail(String address, int client_id,String username); + + String checkOrGenerateVerifyMailKey(String address, String codeKey); + + void deleteVerifyMailKey(String codeKey); + + void verifyMail(String address, JSONObject loginAccount); + + void saveOrUpdateApplyInfo(JSONObject companyBean, String username); + + JSONObject getBankInfo(String bsb_no); + + void checkAccountName(String contact_phone,String nation_code); +} 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..fc4b29bfb --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImpl.java @@ -0,0 +1,425 @@ +package au.com.royalpay.payment.manage.application.core.impls; + +import au.com.royalpay.payment.core.mappers.PmtSubMerchantIdMapper; +import au.com.royalpay.payment.manage.application.core.SimpleClientApplyService; +import au.com.royalpay.payment.manage.mappers.preapply.SysClientPreMapperMapper; +import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper; +import au.com.royalpay.payment.manage.mappers.system.ClientBankAccountMapper; +import au.com.royalpay.payment.manage.mappers.system.ClientConfigMapper; +import au.com.royalpay.payment.manage.mappers.system.ClientMapper; +import au.com.royalpay.payment.manage.mappers.system.ClientRateMapper; +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.ForbiddenException; +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.PasswordUtils; + +import com.alibaba.fastjson.JSONObject; +import com.github.qcloudsms.SmsSingleSender; + +import org.apache.commons.lang3.RandomStringUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.time.DateFormatUtils; +import org.apache.commons.lang3.time.DateUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.Assert; +import org.springframework.web.bind.annotation.RequestMethod; +import org.thymeleaf.context.Context; +import org.thymeleaf.spring4.SpringTemplateEngine; + +import java.io.IOException; +import java.net.URISyntaxException; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.concurrent.TimeUnit; + +import javax.annotation.PostConstruct; +import javax.annotation.Resource; + +import cn.yixblog.platform.http.HttpRequestGenerator; +import cn.yixblog.platform.http.HttpRequestResult; + + +@Service +public class SimpleClientApplyServiceImpl implements SimpleClientApplyService { + + + @Value("${royalpay.sms.appid:1400094878}") + private int appId; + @Value("${royalpay.sms.appkey:43390d81e20c5191c278fbf4cd275be2}") + private String appKey; + @Resource + private SysConfigManager sysConfigManager; + @Resource + private MailGunService mailGunService; + @Resource + private SpringTemplateEngine thymeleaf; + @Resource + private ClientManager clientManager; + @Resource + private SignInAccountService signInAccountService; + + @Resource + private ClientAccountMapper clientAccountMapper; + + @Resource + private SysClientPreMapperMapper sysClientPreMapperMapper; + + @Resource + private ClientBankAccountMapper clientBankAccountMapper; + + @Resource + private ClientMapper clientMapper; + + @Resource + private ClientRateMapper clientRateMapper; + + @Resource + private ClientConfigMapper clientConfigMapper; + @Resource + private PmtSubMerchantIdMapper pmtSubMerchantIdMapper; + + @Resource + private StringRedisTemplate stringRedisTemplate; + private SmsSingleSender sender = null; + private final int REGISTER_CLIENT_TEMPLID = 126978; + 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"; + private final List tags = new ArrayList<>(); + + @PostConstruct + public void init() { + tags.add("account"); + sender = new SmsSingleSender(appId, appKey); + } + + @Override + public void verifyRegisterSMSCode(String codeKey, String phoneNumber) { + String rediskey = getRegisterClientRedisKey(phoneNumber); + String codeValue = stringRedisTemplate.boundValueOps(rediskey).get(); + if (codeValue == null || !codeValue.equals(codeKey)) { + throw new BadRequestException("Verification code has expired or is not correct"); + } + stringRedisTemplate.delete(rediskey); + } + + @Override + public JSONObject newAccount(NewAccountBean accountBean) { + return null; + } + + @Override + public String partnerSignIn(JSONObject account) { + return null; + } + + @Override + public String getAndSendSmsCode(String phoneNumber, String nationCode) { + String reidsCheckCodeKey = getRegisterClientRedisKey(phoneNumber); + String value = stringRedisTemplate.boundValueOps(reidsCheckCodeKey).get(); + if (StringUtils.isNotEmpty(value)) { + throw new BadRequestException("SMS has been sent,Please check your messages or try again in 3 minutes."); + } + JSONObject sysConfig = sysConfigManager.getSysConfig(); + ArrayList param = new ArrayList<>(); + String registerClientCode = RandomStringUtils.random(6, false, true); + param.add("RoyalPay"); + param.add(registerClientCode); + String expireMin = (String) sysConfig.getOrDefault("sms.verification.code.expire", 3); + param.add(expireMin); + try { + sender.sendWithParam(nationCode.trim(), phoneNumber, REGISTER_CLIENT_TEMPLID, 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); + return registerClientCode; + } + + @Override + public void sendVerifyEmail(String address, int client_id,String username) { + JSONObject client = clientManager.getClientInfo(client_id); + if (client == null) { + throw new BadRequestException("Merchant not found"); + } + String key = checkOrGenerateVerifyMailKey(address, null); + Context ctx = new Context(); + ctx.setVariable("url", PlatformEnvironment.getEnv().concatUrl("/register/account/mail/" + address + "/verify/" + key + "/jump?username="+username)); + final String content = thymeleaf.process("mail/register_application", ctx); + SendMail sendMail = new SendMail(); + Set to = new HashSet<>(); + to.add(address); + sendMail.setMailTos(to); + sendMail.setFrom("info@mail.royalpay.com.au"); + sendMail.setTitle("Royalpay"); + sendMail.setContent(content); + sendMail.setTags(tags); + mailGunService.sendMail(sendMail); + + } + + @Override + public String checkOrGenerateRegisterProcessKey(String accountName, String codeKey) { + Assert.notNull(accountName, "accountName can't be null"); + if (StringUtils.isNotEmpty(codeKey)) { + String redisAccountName = stringRedisTemplate.boundValueOps(getRegisterClientProcessRedisKey(codeKey)).get(); + if (!accountName.equals(redisAccountName)) { + throw new BadRequestException("Data error,Please re-register for safety."); + } else { + return codeKey; + } + } + String key = RandomStringUtils.random(10, true, false); + stringRedisTemplate.boundValueOps(getRegisterClientProcessRedisKey(key)).set(accountName, 1, TimeUnit.HOURS); + return key; + } + + @Override + public void deleteRegisterProcessKey(String codeKey) { + stringRedisTemplate.delete(getRegisterClientProcessRedisKey(codeKey)); + } + + @Override + public String checkOrGenerateVerifyMailKey(String address, String codeKey) { + Assert.notNull(address, "address can't be null"); + if (StringUtils.isNotEmpty(codeKey)) { + String redisAddress = stringRedisTemplate.boundValueOps(getVerifyMailRedisKey(codeKey)).get(); + if (!address.equals(redisAddress)) { + throw new BadRequestException("Mail expired"); + } else { + return codeKey; + } + } + String key = RandomStringUtils.random(10, true, false); + stringRedisTemplate.boundValueOps(getVerifyMailRedisKey(key)).set(address, 1, TimeUnit.HOURS); + return key; + + } + + @Override + public void deleteVerifyMailKey(String codeKey) { + stringRedisTemplate.delete(getVerifyMailRedisKey(codeKey)); + } + + @Override + public void checkAccountName(String contact_phone,String nation_code) { + nation_code = nation_code.trim(); + if(!nation_code.startsWith("+")){ + nation_code ="+"+nation_code; + } + JSONObject account = clientAccountMapper.findByPhone(contact_phone,nation_code); + if (account != null){ + throw new ForbiddenException("用户名已被注册"); + } + } + + @Override + @Transactional + public void saveOrUpdateApplyInfo(JSONObject applyInfo, String username) { + JSONObject apply = sysClientPreMapperMapper.findByUserName(username); + if (apply == null ){ + sysClientPreMapperMapper.save(applyInfo); + }else { + applyInfo.put("client_pre_apply_id", apply.getIntValue("client_pre_apply_id")); + applyInfo.put("update_time", new Date()); + sysClientPreMapperMapper.update(applyInfo); + if(applyInfo.getBooleanValue("agree")){ + applyerToClient(username); + } + } + } + + private void applyerToClient(String username){ + Date now = new Date(); + JSONObject param = new JSONObject(); + param.put("begin_time",DateFormatUtils.format(now,"YYYYMMdd")); + param.put("end_time",DateFormatUtils.format(DateUtils.addDays(now,1),"YYYYMMdd")); + param.put("agree",true); + List existCount = sysClientPreMapperMapper.query(param); + if(existCount.size()>30){ + throw new BadRequestException("New merchant over limit,Please contact us"); + } + JSONObject apply = sysClientPreMapperMapper.findByUserName(username); + + JSONObject subMerchantId = pmtSubMerchantIdMapper.randomOne(); + String clientMoniker = generateClientMoniker(); + JSONObject sysClient = new JSONObject(); + sysClient.put("company_name",apply.getString("company_name")); + sysClient.put("abn",apply.getString("abn")); + sysClient.put("short_name",apply.getString("short_name")); + sysClient.put("address",apply.getString("address")); + sysClient.put("suburb",apply.getString("suburb")); + sysClient.put("state",apply.getString("state")); + sysClient.put("postcode",apply.getString("postcode")); + sysClient.put("royalpayindustry",apply.getString("industry")); + sysClient.put("contact_person",apply.getString("contact_person")); + sysClient.put("contact_email",apply.getString("contact_email")); + sysClient.put("contact_phone",apply.getString("contact_phone")); + sysClient.put("company_phone",apply.getString("company_phone")); + sysClient.put("client_moniker",clientMoniker); + sysClient.put("create_time",new Date()); + sysClient.put("source",4); + sysClient.put("approve_result",2); + sysClient.put("creator",0); + sysClient.put("industry",331); + sysClient.put("merchant_id",subMerchantId.getString("merchant_id")); + sysClient.put("sub_merchant_id",subMerchantId.getString("sub_merchant_id")); + sysClient.put("common_sub_merchant_id",1); + clientMapper.save(sysClient); + + int clientId = sysClient.getIntValue("client_id"); + + JSONObject sysAccount = new JSONObject(); + sysAccount.put("username",apply.getString("username")); + sysAccount.put("display_name",apply.getString("username")); + String salt = PasswordUtils.newSalt(); + sysAccount.put("salt", salt); + sysAccount.put("password_hash", PasswordUtils.hashPwd(apply.getString("password"), salt)); + sysAccount.put("password_aes", PasswordUtils.encryptAESPwd(apply.getString("password"))); + sysAccount.put("creator",0); + sysAccount.put("contact_phone",apply.getString("contact_phone")); + sysAccount.put("password_hash",apply.getString("password")); + sysAccount.put("client_id",clientId); + sysAccount.put("create_time",new Date()); + sysAccount.put("is_password_expired",0); + sysAccount.put("nation_code","+61"); + clientAccountMapper.save(sysAccount); + + JSONObject sysBank = new JSONObject(); + sysBank.put("client_id",clientId); + sysBank.put("account_no",apply.getString("bank_no")); + sysBank.put("account_name",apply.getString("bank_name")); + sysBank.put("bsb_no",apply.getString("bsb_no")); + JSONObject bankInfo = getBankInfo(apply.getString("bsb_no")); + sysBank.put("bank",bankInfo.getString("bank")); + sysBank.put("city",bankInfo.getString("city")); + sysBank.put("address",bankInfo.getString("address")); + sysBank.put("system",bankInfo.getString("system")); + sysBank.put("postcode",bankInfo.getString("postcode")); + sysBank.put("state",bankInfo.getString("state")); + sysBank.put("branch",bankInfo.getString("branch")); + clientBankAccountMapper.save(sysBank); + + JSONObject sysConfig = new JSONObject(); + sysConfig.put("client_id",clientId); + sysConfig.put("client_moniker",clientMoniker); + sysConfig.put("clean_days",apply.getIntValue("clean_days")); + sysConfig.put("common_sub_merchant_id",1); + clientConfigMapper.save(sysConfig); + + JSONObject sysRate = new JSONObject(); + sysRate.put("client_id",clientId); + sysRate.put("clean_days",apply.getIntValue("clean_days")); + sysRate.put("remark","自主申请"); + sysRate.put("create_time", new Date()); + sysRate.put("update_time", new Date()); + sysRate.put("active_time", DateFormatUtils.format(new Date(), "yyyy-MM-dd")); + sysRate.put("expiry_time", DateFormatUtils.format(DateUtils.addYears(new Date(),1), "yyyy-MM-dd")); + + JSONObject rateConfig = clientManager.getSysRateConfig(); + JSONObject chooseRate = new JSONObject(); + if (apply.getIntValue("clean_days") == 1){ + chooseRate = rateConfig.getJSONObject("t1"); + } + if (apply.getIntValue("clean_days") == 2){ + chooseRate = rateConfig.getJSONObject("t2"); + } + if (apply.getIntValue("clean_days") == 3){ + chooseRate = rateConfig.getJSONObject("t3"); + } + sysRate.putAll(chooseRate); + + configNewClientRate(sysRate, clientId, "Wechat", "Wechat"); + configNewClientRate(sysRate, clientId, "Alipay", "Alipay"); + configNewClientRate(sysRate, clientId, "AlipayOnline", "AlipayOnline"); + configNewClientRate(sysRate, clientId, "Bestpay", "Bestpay"); + configNewClientRate(sysRate, clientId, "jd", "JDpay"); + } + + private String generateClientMoniker(){ + String clientMoniker = RandomStringUtils.random(4, true, true).toUpperCase(); + JSONObject client = clientMapper.findClientByMoniker(clientMoniker); + if (client != null){ + generateClientMoniker(); + } + return clientMoniker; + } + + + private void configNewClientRate(JSONObject config, int clientId, String channel, String rateKey) { + if (config.containsKey(rateKey)) { + JSONObject newConfig = new JSONObject(); + newConfig.putAll(config); + newConfig.put("rate_value", config.getBigDecimal(rateKey)); + newConfig.put("rate_name", channel); + if (!clientRateMapper.listClientRatesForSaving(clientId, config.getDate("active_time"), config.getDate("expiry_time"), + config.getDoubleValue("rate_value"), config.getInteger("clean_days"), channel).isEmpty()) { + return; + } + List existRate = clientRateMapper.listCurrentClientRates(clientId, config.getDate("active_time"), channel); + for (JSONObject rateLog : existRate) { + rateLog.put("expiry_time", DateUtils.addDays(config.getDate("active_time"), -1)); + clientRateMapper.updateConfig(rateLog); + } + clientRateMapper.saveRate(newConfig); + } + } + + @Override + public JSONObject getBankInfo(String bsb_no) { + String url = "https://api.bank.codes/au-bsb/json/ab9379cfdab559509bbdcdd11923489f/" + bsb_no; + JSONObject banInfo = new JSONObject(); + try { + HttpRequestResult result = new HttpRequestGenerator(url, RequestMethod.GET).execute(); + if (result.isSuccess()) { + banInfo = result.getResponseContentJSONObj(); + } + } catch (URISyntaxException | IOException e) { + } + return banInfo; + } + + @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")); + } + JSONObject record = new JSONObject(); + record.put("client_id",client.getIntValue("client_id")); + record.put("mail_confirm",true); + clientMapper.update(record); + } + + 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; + } +} 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 new file mode 100644 index 000000000..c409e3288 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/application/web/SimpleClientApplyController.java @@ -0,0 +1,96 @@ +package au.com.royalpay.payment.manage.application.web; + +import au.com.royalpay.payment.manage.application.beans.ClientPreApplyBean; +import au.com.royalpay.payment.manage.application.beans.ClientPreApplyStep1Bean; +import au.com.royalpay.payment.manage.application.core.SimpleClientApplyService; +import au.com.royalpay.payment.manage.merchants.beans.NewAccountBean; +import au.com.royalpay.payment.tools.CommonConsts; +import au.com.royalpay.payment.tools.http.HttpUtils; + +import com.alibaba.fastjson.JSONObject; + +import org.springframework.validation.Errors; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.servlet.ModelAndView; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + +@RestController +@RequestMapping("/register") +public class SimpleClientApplyController { + @Resource + private SimpleClientApplyService simpleClientApplyService; + + @RequestMapping(value = "/account/check", method = RequestMethod.GET) + public void checkAccountName(@RequestParam String nation_code,@RequestParam String phone) { + simpleClientApplyService.checkAccountName(phone,nation_code); + } + + @RequestMapping(value = "/account/{codeKey}", method = RequestMethod.POST) + @ResponseBody + public void registerAccount(@PathVariable String codeKey, @RequestBody @Valid NewAccountBean accountBean, Errors errors, HttpServletResponse response) { + HttpUtils.handleValidErrors(errors); + simpleClientApplyService.verifyRegisterSMSCode(codeKey, accountBean.getContactPhone()); + + JSONObject account = simpleClientApplyService.newAccount(accountBean); + String statusKey = simpleClientApplyService.partnerSignIn(account); + HttpUtils.setCookie(response, CommonConsts.CODE_KEY, statusKey); + } + + @RequestMapping(value = "/account/mail/{address}/verify/{codeKey}/jump", method = RequestMethod.GET) + public ModelAndView jumpVerifyMail(@PathVariable String codeKey, @PathVariable String address,@RequestParam String username) { + simpleClientApplyService.checkOrGenerateVerifyMailKey(address, codeKey); + ModelAndView view = new ModelAndView("mail/verify_mail"); + view.addObject("codeKey", codeKey); + view.addObject("address", address); + view.addObject("username",username); + return view; + } + + @RequestMapping(value = "/account/mail/{address}/verify/{codeKey}", method = RequestMethod.POST) + @ResponseBody + public void verifyMail(@PathVariable String codeKey, @PathVariable String address, @RequestBody JSONObject account) { + simpleClientApplyService.checkOrGenerateVerifyMailKey(address, codeKey); + simpleClientApplyService.verifyMail(address, account); + simpleClientApplyService.deleteVerifyMailKey(codeKey); + } + + @RequestMapping(value = "/info/update/{username}/step1", method = RequestMethod.POST) + @ResponseBody + public JSONObject registerCompanyInfoStep1(@PathVariable String username, @RequestBody @Valid ClientPreApplyStep1Bean account) { + JSONObject result = new JSONObject(); + simpleClientApplyService.verifyRegisterSMSCode(account.getPhoneCodeKey(), account.getContact_phone()); + String codeKey = simpleClientApplyService.checkOrGenerateRegisterProcessKey(username, null); + simpleClientApplyService.saveOrUpdateApplyInfo(account.insertObject(), username); + result.put("codeKey",codeKey); + return result; + } + + @RequestMapping(value = "/info/phone/{phone_number}/verify", method = RequestMethod.POST) + @ResponseBody + public JSONObject getAndSendSmsCode(@PathVariable String phone_number, @RequestParam String nation_code) { + JSONObject result = new JSONObject(); + result.put("phoneCodeKey", simpleClientApplyService.getAndSendSmsCode(phone_number, nation_code)); + return result; + } + + @RequestMapping(value = "/info/update/{username}", method = RequestMethod.POST) + public void registerCompanyInfo(@PathVariable String username, @RequestBody @Valid ClientPreApplyBean applyBean) { + simpleClientApplyService.checkOrGenerateRegisterProcessKey(username,applyBean.getCodeKey()); + simpleClientApplyService.saveOrUpdateApplyInfo(applyBean.insertObject(), username); + } + + @RequestMapping(value = "/info/bank/{bsb_no}", method = RequestMethod.GET) + public JSONObject getBankInfo(@PathVariable String bsb_no, @RequestParam String username, @RequestParam String codeKey) { + simpleClientApplyService.checkOrGenerateRegisterProcessKey(username, codeKey); + return simpleClientApplyService.getBankInfo(bsb_no); + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/preapply/SysClientPreMapperMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/preapply/SysClientPreMapperMapper.java new file mode 100644 index 000000000..0b11501bb --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/preapply/SysClientPreMapperMapper.java @@ -0,0 +1,25 @@ +package au.com.royalpay.payment.manage.mappers.preapply; + +import com.alibaba.fastjson.JSONObject; + +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper; +import cn.yixblog.support.mybatis.autosql.annotations.AutoSql; +import cn.yixblog.support.mybatis.autosql.annotations.SqlType; + +@AutoMapper(tablename = "sys_client_pre_apply", pkName = "client_pre_apply_id",pkAutoIncrement = true) +public interface SysClientPreMapperMapper { + @AutoSql(type = SqlType.UPDATE) + void update(JSONObject data); + + @AutoSql(type = SqlType.INSERT) + void save(JSONObject data); + + @AutoSql(type = SqlType.SELECT) + JSONObject findByUserName(@Param("username") String username); + + List query(JSONObject param); +} diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientAccountMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientAccountMapper.java index 24586c341..f3e3428d3 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientAccountMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientAccountMapper.java @@ -26,6 +26,10 @@ public interface ClientAccountMapper { @AutoSql(type = SqlType.SELECT) JSONObject findByUsernameForDuplicate(@Param("username") String username); + @AutoSql(type = SqlType.SELECT) + @AdvanceSelect(addonWhereClause = "is_valid=1") + JSONObject findByPhone(@Param("contact_phone") String contact_phone,@Param("nation_code")String nation_code); + @AutoSql(type = SqlType.SELECT) JSONObject findDetail(@Param("account_id") String accountId); 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/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java index a9e1b0313..6ab259398 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java @@ -290,4 +290,6 @@ public interface ClientManager { JSONObject getCheckClientInfo(int client_id,String account_id, String channel); List getClientSubMerchantIdLogs(String clientMoniker,JSONObject manager); + + void applyToCompliance(String client_moniker, JSONObject account); } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java index ec73b90f2..631b59bc6 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java @@ -778,7 +778,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } List accounts = clientAccountMapper.listAdminAccounts(clientId); if (client.getIntValue("source") == 4) { - sendAuthInitEmail(manager, client); + JSONObject account = accounts.get(0); + sendInitEmail(manager, client, account.getString("username"), "*****"); } else { if (accounts.size() == 0) { initAdminUserAndSendEmail(manager, clientMoniker, client); @@ -3149,6 +3150,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid return; } if (client.getIntValue("open_status") == 4) { + if (client.getIntValue("source")==4 && !StringUtils.isNotEmpty(bd_user_name)){ + bd_user_name = "自助开通商户"; + } List complianceList = managerMapper.getOnlyCompliance(); if (complianceList != null && complianceList.size() > 0) { for (JSONObject compliance : complianceList) { @@ -3156,7 +3160,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid try { MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); TemplateMessage msg = initSendCommissionTemplate(wxopenid, paymentApi.getTemplateId("commission"), client_moniker + "合规材料已提交", - bd_user_name, "审核材料", "BD已提交合规材料,等待审核"); + bd_user_name, "审核材料", "已提交合规材料,等待审核"); paymentApi.sendTemplateMessage(msg); } catch (WechatException e) { logger.error("Wechat Message Error,open_status=1" + e.getMessage()); @@ -3391,4 +3395,48 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid checkOrgPermission(manager, client); return logClientSubMerchantIdMapper.listLogsByClientId(client.getInteger("client_id")); } + + @Override + public void applyToCompliance(String client_moniker, JSONObject client_account) { + JSONObject client = getClientInfoByMoniker(client_moniker); + if (client == null) { + throw new InvalidShortIdException(); + } + client.putAll(clientConfigService.find(client.getIntValue("client_id"))); + if (client.getInteger("open_status") == null) { + int countProduct = commoditiesMapper.checkProduct(client.getInteger("client_id")); + if (countProduct <= 0) { + throw new BadRequestException("The Merchant's Product is empty!"); + } + } + + // 提交合规启用银行、费率验证 add by Tayl0r 2017/06/13 + JSONObject rate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Wechat"); + if (rate == null) { + throw new BadRequestException("The Partner's Rate is not config!"); + } + List clientFiles = clientFilesMapper.findClientFile(client.getIntValue("client_id")); + if (clientFiles == null || clientFiles.equals("")) { + throw new BadRequestException("The Compliance File Must Be Uploaded!"); + } + JSONObject account = getBankAccountByClientId(client.getIntValue("client_id")); + if (account == null) { + throw new BadRequestException("The Partner's Bank Account is not config!"); + } + int open_status_from = client.getIntValue("open_status"); + OpenStatusModify openStatusModify = new OpenStatusModify(client_account, client_moniker, 4); + if ((client.getIntValue("source") == 1 || client.getIntValue("source") == 2) && client.getIntValue("approve_result") == 2) { + openStatusModify.setApprove_time(new Date()); + } else { + openStatusModify.setApprove_time(new Date()); + openStatusModify.setApprove_result(3); + } + client.put("open_status", 4); + clientModifySupport.processClientModify(openStatusModify); + saveClientAuditProcess(client.getIntValue("client_id"), open_status_from, 4, "自助开通商户提交compliance审核", client_account); + if (client_account != null) { + // sendMessagetoCompliance(client, manager.getString("display_name")); + sendCommissionWechatMessage(client); + } + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerViewController.java b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerViewController.java index 3e2e8fcad..3ecfa512b 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerViewController.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerViewController.java @@ -379,4 +379,10 @@ public class PartnerViewController { public void confirmSourceAgreeFile(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account) { clientContractService.confirmSourceAgreement(account.getIntValue("client_id"), account.getString("account_id"), "PC"); } + + @PartnerMapping(value = "/compliance_audit", method = RequestMethod.POST, roles = PartnerRole.ADMIN) + @ResponseBody + public void commitAudit(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account) { + clientManager.applyToCompliance(account.getString("client_moniker"),account); + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/signin/core/SignInAccountService.java b/src/main/java/au/com/royalpay/payment/manage/signin/core/SignInAccountService.java index 7d8920447..0cdaa4683 100644 --- a/src/main/java/au/com/royalpay/payment/manage/signin/core/SignInAccountService.java +++ b/src/main/java/au/com/royalpay/payment/manage/signin/core/SignInAccountService.java @@ -17,6 +17,8 @@ public interface SignInAccountService { JSONObject managerLoginCheck(LoginInfo loginInfo); + JSONObject accountCheck(LoginInfo loginInfo); + JSONObject clientLoginCheck(LoginInfo loginInfo); void changeManagerPassword(JSONObject manager, ChangePwdBean change); diff --git a/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInAccountServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInAccountServiceImpl.java index fd25de569..42b3d7849 100644 --- a/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInAccountServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInAccountServiceImpl.java @@ -166,6 +166,13 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati return account; } + @Override + public JSONObject accountCheck(LoginInfo loginInfo) { + JSONObject account = managerMapper.findAvailableByLoginId(loginInfo.getLoginId()); + validLoginInfo(loginInfo, account); + return account; + } + private void validLoginInfo(LoginInfo loginInfo, JSONObject account) { if (account == null) { throw new BadRequestException(LocaleSupport.localeMessage("error.login.password")); diff --git a/src/main/resources/application-local.properties b/src/main/resources/application-local.properties index c9015a1d9..91173a856 100644 --- a/src/main/resources/application-local.properties +++ b/src/main/resources/application-local.properties @@ -1,6 +1,6 @@ spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.schema-name=royalpay_production -spring.datasource.host=192.168.99.100:3306 +spring.datasource.host=192.168.0.49:3306 spring.datasource.url=jdbc:mysql://${spring.datasource.host}/${spring.datasource.schema-name}?useUnicode=true&characterEncoding=utf8&useSSL=false spring.datasource.username=root spring.datasource.password=root \ No newline at end of file diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index bc53561d1..456d70c5e 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=1400094878 +royalpay.sms.appkey=43390d81e20c5191c278fbf4cd275be2 diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/preapply/SysClientPreMapperMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/preapply/SysClientPreMapperMapper.xml new file mode 100644 index 000000000..0a8bf90a6 --- /dev/null +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/preapply/SysClientPreMapperMapper.xml @@ -0,0 +1,18 @@ + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/mail/register_application.html b/src/main/resources/templates/mail/register_application.html new file mode 100644 index 000000000..8e4e8fc38 --- /dev/null +++ b/src/main/resources/templates/mail/register_application.html @@ -0,0 +1,63 @@ + + + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/mail/verify_mail.html b/src/main/resources/templates/mail/verify_mail.html new file mode 100644 index 000000000..e68034a6d --- /dev/null +++ b/src/main/resources/templates/mail/verify_mail.html @@ -0,0 +1,138 @@ + + + + + + RoyalPay | Reset Password + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/ui/merchant_application.html b/src/main/ui/merchant_application.html new file mode 100644 index 000000000..23e6a03d8 --- /dev/null +++ b/src/main/ui/merchant_application.html @@ -0,0 +1,878 @@ + + + + + + + RoyalPay | Merchant Application + + + + + + + + + + + + + + + + Partner Register + + + + + + + + + + + + +
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ + + + + +
+
+
+ +
+ +
+
+
+
+ + Account Information +
+
+ + Company Information +
+
+ + Bank Account +
+
+ + Submit Materials +
+
+ + Success +
+
+
+
+
+ +
+
+ +
+ +
+ +
+

The mailbox is incorrect

+
+
+ +
+
+
+ +61 + + +
+
+ phone number is also your login id +
+
+
+ +
+ +
+ +
+ +
+ 6 to 12 characters, case sensitive +
+
+ +
+ +
+ +
+
+ +
+

{{resError}}

+
+
+
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+
+
+
+ +
+
+
+ + +
+
+ +
+

{{resError}}

+
+
+
+
+
+
+ +
+ +
+ +
+ +
+
+ + +
+
+
+
+

  Bank: bank{{bankaccount.bank}}

+
+
+

  City: {{bankaccount.city}}

+
+
+

  Address: {{bankaccount.address}}

+
+
+

  system: {{bankaccount.system}}

+
+
+

  postcode: {{bankaccount.postcode}}

+
+
+

  state: {{bankaccount.state}}

+
+
+

  branch: {{bankaccount.branch}}

+
+
+
+
+ +
+

{{resError}}

+
+
+
+
+
+ +
+ +
+
+
+

  WeChat Rate Value: {{rate.wechat_rate_value}}%

+
+
+

  Alipay Rate Value(Retail): {{rate.alipay_rate_value}}%

+
+ +
+

  Alipay Rate Value(Online): {{rate.alipayonline_rate_value}}%

+
+ +
+

  Bestpay Rate Value: {{rate.bestpay_rate_value}}%

+
+
+

  JD Rate Value: {{rate.jd_rate_value}}%

+
+
+ +
+
+ +
+
+
+
+ +
+

{{resError}}

+
+
+
+
+ +
+
+
+ +
+
+
恭喜注册成功
+
欢迎使用RoyalPay收单服务
+
+
+
+
+
注意事项:
+

1、需要完成 合规材料的提交,具体请查看appxx菜单xx功能;

+

2、在完成合规认证之前,不会对交易进行清算;

+

3、账户名和密码以及相关信息已发送至账户邮箱,请妥善保护自己的密码,及时进行修改。

+
+
+
+ +
+

{{resError}}

+
+
+
+
+
+
+
+ + + +
+ +
+
+ + +
+
+ + \ No newline at end of file diff --git a/src/main/ui/static/css/merchant_application.css b/src/main/ui/static/css/merchant_application.css new file mode 100644 index 000000000..218f8cb27 --- /dev/null +++ b/src/main/ui/static/css/merchant_application.css @@ -0,0 +1,471 @@ +body .progress_inner #step-5:checked + div + div + div + div > .box_base, body .progress_inner #step-4:checked + input + div + div + div + div > .box_base, body .progress_inner #step-2:checked + input + input + input + div + div + div + div > .box_base, body .progress_inner #step-3:checked + input + input + div + div + div + div > .box_base, body .progress_inner #step-1:checked + input + input + input + input + div + div + div + div > .box_base { + top: 50%; + left: 0px; + opacity: 1; +} +body .progress_inner #step-5:checked + div + div + div + div > .box_item, body .progress_inner #step-4:checked + input + div + div + div + div > .box_item, body .progress_inner #step-2:checked + input + input + input + div + div + div + div > .box_item, body .progress_inner #step-3:checked + input + input + div + div + div + div > .box_item, body .progress_inner #step-1:checked + input + input + input + input + div + div + div + div > .box_item { + top: -30px; + left: 0px; + opacity: 0; +} + +body .progress_inner #step-5:checked + div + div + div + div > .box_lid, body .progress_inner #step-4:checked + input + div + div + div + div > .box_lid, body .progress_inner #step-2:checked + input + input + input + div + div + div + div > .box_lid { + top: -20px; + left: 0px; + opacity: 0; +} +body .progress_inner #step-5:checked + div + div + div + div > .box_item, body .progress_inner #step-4:checked + input + div + div + div + div > .box_item, body .progress_inner #step-2:checked + input + input + input + div + div + div + div > .box_item { + top: -10px; + left: 0px; + opacity: 1; +} + +body .progress_inner #step-5:checked + div + div + div + div > .box_item, body .progress_inner #step-4:checked + input + div + div + div + div > .box_item, body .progress_inner #step-3:checked + input + input + div + div + div + div > .box_item { + top: 10px; + left: 0px; + opacity: 1; +} +body .progress_inner #step-5:checked + div + div + div + div > .box_lid, body .progress_inner #step-4:checked + input + div + div + div + div > .box_lid, body .progress_inner #step-3:checked + input + input + div + div + div + div > .box_lid { + top: -1px; + left: 0px; + opacity: 1; +} +body .progress_inner #step-5:checked + div + div + div + div > .box_ribbon, body .progress_inner #step-4:checked + input + div + div + div + div > .box_ribbon, body .progress_inner #step-3:checked + input + input + div + div + div + div > .box_ribbon { + top: 70%; + left: 0px; + opacity: 0; +} +body .progress_inner #step-5:checked + div + div + div + div > .box_bow, body .progress_inner #step-4:checked + input + div + div + div + div > .box_bow, body .progress_inner #step-3:checked + input + input + div + div + div + div > .box_bow { + top: 0px; + left: 0px; + opacity: 0; +} + +body .progress_inner #step-5:checked + div + div + div + div > .box_ribbon, body .progress_inner #step-4:checked + input + div + div + div + div > .box_ribbon { + top: 50%; + left: 0px; + opacity: 1; +} +body .progress_inner #step-5:checked + div + div + div + div > .box_bow, body .progress_inner #step-4:checked + input + div + div + div + div > .box_bow { + top: -10px; + left: 0px; + opacity: 1; +} + +body .progress_inner #step-5:checked + div + div + div + div > .box_tag { + top: 10px; + left: 20px; + opacity: 1; +} +body .progress_inner #step-5:checked + div + div + div + div > .box_string { + top: 10px; + left: 20px; + opacity: 1; +} + +* { + box-sizing: border-box; +} + +body .progress_inner__step:before, body .progress_inner, body .progress_inner__status .box_base, body .progress_inner__status .box_item, body .progress_inner__status .box_ribbon, body .progress_inner__status .box_bow, body .progress_inner__status .box_bow__left, body .progress_inner__status .box_bow__right, body .progress_inner__status .box_tag, body .progress_inner__status .box_string { + position: absolute; + left: 0; + right: 0; + top: 16em; + -webkit-transform: translateY(-50%); + transform: translateY(-50%); + margin: auto; +} + +body .progress_inner__bar, body .progress_inner__bar--set { + height: 6px; + left: 10%; + background: -webkit-repeating-linear-gradient(45deg, #1ea4ec, #1ea4ec 4px, #1f8bc5 4px, #1f8bc5 10px); + background: repeating-linear-gradient(45deg, #1ea4ec, #1ea4ec 4px, #1f8bc5 4px, #1f8bc5 10px); + -webkit-transition: width 800ms cubic-bezier(0.915, 0.015, 0.3, 1.005); + transition: width 800ms cubic-bezier(0.915, 0.015, 0.3, 1.005); + border-radius: 6px; + width: 0; + position: relative; + z-index: -1; +} + +body .progress_inner__step:before { + width: 30px; + height: 30px; + color: #70afd0; + background: white; + line-height: 30px; + border: 3px solid #a6cde2; + font-size: 12px; + top: 3px; + border-radius: 100%; + -webkit-transition: all .4s; + transition: all .4s; + cursor: pointer; + pointer-events: none; +} + +body .progress_inner__step { + width: 20%; + font-size: 14px; + padding: 0 10px; + -webkit-transition: all .4s; + transition: all .4s; + float: left; + text-align: center; + position: relative; +} +body .progress_inner__step label { + padding-top: 50px; + top: -20px; + display: block; + position: relative; + cursor: pointer; +} +/*body .progress_inner__step:hover { + color: white; +} +body .progress_inner__step:hover:before { + color: white; + background: #1ea4ec; +}*/ + +body { + font-family: "Nunito", sans-serif; + background: #a6cde2; + color: #2e6c8e; + text-align: center; + font-weight: 900; +} +body .progress_inner { + height: 200px; + width: 1000px; +} +body .progress_inner #step-5:checked + div { + width: 80%; +} +body .progress_inner #step-5:checked + div + div + div > .tab:nth-of-type(5) { + opacity: 1; + top: 0; +} +body .progress_inner #step-5:checked + div + div + div + div { + right: 10%; +} +body .progress_inner #step-4:checked + input + div { + width: 60%; +} +body .progress_inner #step-4:checked + input + div + div + div > .tab:nth-of-type(4) { + opacity: 1; + top: 0; +} +body .progress_inner #step-4:checked + input + div + div + div + div { + right: 30%; +} +body .progress_inner #step-3:checked + input + input + div { + width: 40%; +} +body .progress_inner #step-3:checked + input + input + div + div + div > .tab:nth-of-type(3) { + opacity: 1; + top: 0; +} +body .progress_inner #step-3:checked + input + input + div + div + div + div { + right: 50%; +} +body .progress_inner #step-2:checked + input + input + input + div { + width: 20%; +} +body .progress_inner #step-2:checked + input + input + input + div + div + div > .tab:nth-of-type(2) { + opacity: 1; + top: 0; +} +body .progress_inner #step-2:checked + input + input + input + div + div + div + div { + right: 70%; +} +body .progress_inner #step-1:checked + input + input + input + input + div { + width: 0%; +} +body .progress_inner #step-1:checked + input + input + input + input + div + div + div > .tab:nth-of-type(1) { + opacity: 1; + top: 0; +} +body .progress_inner #step-1:checked + input + input + input + input + div + div + div + div { + right: 90%; +} +body .progress_inner__step:nth-of-type(1):before { + content: "1"; +} +body .progress_inner__step:nth-of-type(2):before { + content: "2"; +} +body .progress_inner__step:nth-of-type(3):before { + content: "3"; +} +body .progress_inner__step:nth-of-type(4):before { + content: "4"; +} +body .progress_inner__step:nth-of-type(5):before { + content: "5"; +} +body .progress_inner__step:nth-of-type(6):before { + content: "6"; +} +body .progress_inner__bar--set { + width: 80%; + top: -6px; + background: #70afd0; + position: relative; + z-index: -2; +} +body .progress_inner__tabs .tab { + opacity: 0; + position: absolute; + top: 40px; + text-align: center; + margin-top: 80px; + box-shadow: 0px 2px 1px #80b7d5; + padding: 30px; + background: white; + border-radius: 10px; + -webkit-transition: all .2s; + transition: all .2s; +} +body .progress_inner__tabs .tab h1 { + margin: 0; +} +body .progress_inner__tabs .tab p { + font-weight: 400; + opacity: 0.8; +} +body .progress_inner__status { + width: 40px; + height: 40px; + top: -65px; + -webkit-transition: right 800ms cubic-bezier(0.915, 0.015, 0.3, 1.005); + transition: right 800ms cubic-bezier(0.915, 0.015, 0.3, 1.005); + -webkit-transform: translateX(50%); + transform: translateX(50%); + position: absolute; +} +body .progress_inner__status div { + opacity: 0; + -webkit-transition: all 600ms cubic-bezier(0.915, 0.015, 0.3, 1.005); + transition: all 600ms cubic-bezier(0.915, 0.015, 0.3, 1.005); + -webkit-transition-delay: 300ms; + transition-delay: 300ms; +} +body .progress_inner__status div { + position: absolute; +} +body .progress_inner__status .box_base { + background: -webkit-repeating-linear-gradient(45deg, #986c5d, #986c5d 2px, #775144 2px, #775144 4px); + background: repeating-linear-gradient(45deg, #986c5d, #986c5d 2px, #775144 2px, #775144 4px); + width: 36px; + height: 40px; + z-index: 1; + border-radius: 1px; +} +body .progress_inner__status .box_lid { + width: 40px; + height: 13.33333px; + background: #775144; + z-index: 2; + border-radius: 1px; + top: 0; +} +body .progress_inner__status .box_item { + width: 20px; + height: 20px; + background: #be69d2; + z-index: 0; + border-radius: 4px; + -webkit-transform: rotate(45deg); + transform: rotate(45deg); +} +body .progress_inner__status .box_ribbon { + width: 10px; + height: 42px; + background: #ee0f29; + z-index: 4; + border-radius: 1px; +} +body .progress_inner__status .box_bow__left, body .progress_inner__status .box_bow__right { + width: 6px; + height: 10px; + background: #be0c21; + position: absolute; + z-index: 3; + opacity: 1; + border-radius: 1px; +} +body .progress_inner__status .box_bow { + top: -6px; + z-index: 1; + -webkit-transition-delay: 500ms; + transition-delay: 500ms; +} +body .progress_inner__status .box_bow__left { + left: 6px; + -webkit-transform: rotate(45deg); + transform: rotate(45deg); +} +body .progress_inner__status .box_bow__right { + left: -4px; + -webkit-transform: rotate(-45deg); + transform: rotate(-45deg); +} +body .progress_inner__status .box_tag { + width: 20px; + height: 10px; + background: #487ac7; + z-index: 4; + -webkit-transform: rotate(-10deg) translateX(-40px) translateY(0px); + transform: rotate(-10deg) translateX(-40px) translateY(0px); + border-radius: 2px; + -webkit-transition-delay: 500ms; + transition-delay: 500ms; +} +body .progress_inner__status .box_string { + width: 17px; + height: 2px; + background: #343434; + z-index: 4; + -webkit-transform: rotate(-39deg) translateX(-22px) translateY(-12px); + transform: rotate(-39deg) translateX(-22px) translateY(-12px); +} +body .progress_inner input[type="radio"] { + display: none; +} +.step_header{ + text-align: left; + padding-left:7%; +} +.step_header img{ + height: 30px; + width: 30px; +} + +.success_wrapper{ + margin-top: 30px; + text-align: center; +} +.success_img{ + display: inline-block; +} +.success_img img{ + vertical-align: baseline; +} +.success_text{ + text-align: left; + display: inline-block; + margin-left: 14px; +} +.success_text2{ + font-family: PingFangSC-Regular; + font-size: 15px; + color: #8B919D; + letter-spacing: 0px; +} +.success_content{ + margin-top: 50px; + font-family: PingFangSC-Regular; + font-size: 15px; + color: #8B919D; + letter-spacing: 0px; +} +.content_align{ + margin:0 auto; + width:50%; + text-align:left; +} +.margin-bottom2{ + margin-top: 120px; +} +.agree-text{ + font-family: SanFranciscoText-Regular; + font-size: 15px; + color: #FF6600; + letter-spacing: 0px; +} +.agree-to{ + border: 1px solid #FF6600; + padding: 6px 8px 6px 8px; + color: grey; + cursor: pointer; +} +.agree_left{ + text-align: left; +} +body .dis_before{ + color: white; +} +body .dis_before:nth-child(1):before{ + color: white; + background: #1ea4ec; +} +body .dis_before:nth-child(2):before{ + color: white; + background: #1ea4ec; +} +body .dis_before:nth-child(3):before{ + color: white; + background: #1ea4ec; +} +body .dis_before:nth-child(4):before{ + color: white; + background: #1ea4ec; +} +body .dis_before:nth-child(5):before { + color: white; + background: #1ea4ec; + } +.dropdown-submenu { + position: relative; +} +.dropdown-submenu > .dropdown-menu { + top: 0; + left: 100%; + margin-top: -6px; + margin-left: -1px; + -webkit-border-radius: 0 6px 6px 6px; + -moz-border-radius: 0 6px 6px; + border-radius: 0 6px 6px 6px; +} +.dropdown-submenu:hover > .dropdown-menu { + display: block; +} +.dropdown-submenu > a:after { + display: block; + content: " "; + float: right; + width: 0; + height: 0; + border-color: transparent; + border-style: solid; + border-width: 5px 0 5px 5px; + border-left-color: #ccc; + margin-top: 5px; + margin-right: -10px; +} +.dropdown-submenu:hover > a:after { + border-left-color: #fff; +} +.dropdown-submenu.pull-left { + float: none; +} +.dropdown-submenu.pull-left > .dropdown-menu { + left: -100%; + margin-left: 10px; + -webkit-border-radius: 6px 0 6px 6px; + -moz-border-radius: 6px 0 6px 6px; + border-radius: 6px 0 6px 6px; +} +/*.progress_inner__step:before{ + background: #1ea4ec; +} +.step_submit_color{ + color: white; + +}*/ + + diff --git a/src/main/ui/static/images/step/gou.png b/src/main/ui/static/images/step/gou.png new file mode 100644 index 000000000..f4a81919a Binary files /dev/null and b/src/main/ui/static/images/step/gou.png differ diff --git a/src/main/ui/static/images/step/num1_1.png b/src/main/ui/static/images/step/num1_1.png new file mode 100644 index 000000000..e4a8e2496 Binary files /dev/null and b/src/main/ui/static/images/step/num1_1.png differ diff --git a/src/main/ui/static/images/step/num1_2.png b/src/main/ui/static/images/step/num1_2.png new file mode 100644 index 000000000..c009a6baa Binary files /dev/null and b/src/main/ui/static/images/step/num1_2.png differ diff --git a/src/main/ui/static/images/step/num1_3.png b/src/main/ui/static/images/step/num1_3.png new file mode 100644 index 000000000..93931e4be Binary files /dev/null and b/src/main/ui/static/images/step/num1_3.png differ diff --git a/src/main/ui/static/images/step/num1_4.png b/src/main/ui/static/images/step/num1_4.png new file mode 100644 index 000000000..e1b9e4028 Binary files /dev/null and b/src/main/ui/static/images/step/num1_4.png differ diff --git a/src/main/ui/static/images/step/num1_5.png b/src/main/ui/static/images/step/num1_5.png new file mode 100644 index 000000000..63524502e Binary files /dev/null and b/src/main/ui/static/images/step/num1_5.png differ diff --git a/src/main/ui/static/images/step/send_code.png b/src/main/ui/static/images/step/send_code.png new file mode 100644 index 000000000..2c2f5546d Binary files /dev/null and b/src/main/ui/static/images/step/send_code.png differ diff --git a/src/main/ui/static/merchantapplication/merchant_application.js b/src/main/ui/static/merchantapplication/merchant_application.js new file mode 100644 index 000000000..40aa14f0e --- /dev/null +++ b/src/main/ui/static/merchantapplication/merchant_application.js @@ -0,0 +1,304 @@ +angular.module('applyPartnerApp', ['ngMessages']).controller('applyPartnerCtrl', ['$scope', '$http','$interval', function ($scope, $http,$interval) { + var countryMap = [{ + "label": "AUS", + "value": "AUS" + }, { + "label": "CHN", + "value": "CHN" + }]; + var cleanDays = [{ + "label": "T+1", + "value": "1" + }, { + "label": "T+2", + "value": "2" + }, { + "label": "T+3", + "value": "3" + }]; + + var stateMap = [ + { + "label": "ACT", + "value": "ACT" + }, + { + "label": "NSW", + "value": "NSW" + }, + { + "label": "NT", + "value": "NT" + }, + { + "label": "QLD", + "value": "QLD" + }, + { + "label": "SA", + "value": "SA" + }, + { + "label": "TAS", + "value": "TAS" + }, + { + "label": "VIC", + "value": "VIC" + }, + { + "label": "WA", + "value": "WA" + } + ]; + $scope.name_exist = false; + $scope.states = angular.copy(stateMap); + $scope.countries = angular.copy(countryMap); + $scope.cleanDays = angular.copy(cleanDays); + $scope.seconds = 6; + $scope.canClick=false; + $scope.description = "Send Code"; + $scope.partner = {nation_code:"+61"}; + $scope.bankaccount = {}; + $scope.rate = {}; + $scope.phone_code_timer=$interval(function () {}, 1000); + + $scope.loadRoyalpayindustry = function () { + $http.get('/static/data/royalpayindustry.json').then(function (resp) { + $scope.royalpayindustry = resp.data; + }) + }; + $scope.loadRoyalpayindustry(); + + + $scope.checkUserName = function (phone,nation_code) { + if(phone && nation_code){ + $http.get('/register/account/check?phone='+phone+'&nation_code='+nation_code).then(function (resp) { + $scope.name_exist = false; + }, function (resp) { + if (resp.data.status == 403){ + $scope.name_exist = true; + } + }) + } + }; + $scope.chooseArray = new Array(true, false, false, false, false); + $scope.changeChoose = function (index) { + $scope.repartner = {}; + angular.forEach($scope.partner, function(value, key) { + if((value+'').trim()!=''){ + $scope.repartner[key] = value; + } + }); + $scope.partner = $scope.repartner; + $scope.chooseArray = new Array(false, false, false, false, false); + $scope.chooseArray[index] = true; + }; + $scope.getRateConfig = function () { + $http.get('/sys/partners/sys_rates').then(function (resp) { + $scope.sysRateConfig = resp.data; + }, function (resp) { + }) + }; + $scope.sendPhoneCodeTime = function(){ + var second=59; + $scope.phone_code_timer = $interval(function () { + if(second<=0){ + $interval.cancel($scope.phone_code_timer); + second=59; + $scope.description="Send Code"; + $scope.canClick=false; + }else{ + $scope.description=second+"s后重发"; + second--; + $scope.canClick=true; + } + }, 1000); + }; + + $scope.goToLogin = function () { + var timer = $interval(function(){ + $scope.seconds = $scope.seconds -1; + if ($scope.seconds == 0) { + location.href = '/login.html'; + } + },1000) + }; + $scope.checkEmail = function () { + $scope.trueEmail = false; + if($scope.partner.contact_email){ + var reg = new RegExp("^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$"); + if(!reg.test($scope.partner.contact_email)){ + $scope.trueEmail = true; + }else { + $scope.trueEmail = false; + } + } + }; + $scope.sendVerificationCode = function () { + $scope.initErrorMsg(); + $scope.checkUserName($scope.partner.contact_phone,$scope.partner.nation_code) + $scope.sendPhoneCodeTime(); + $http.post('/register/info/phone/'+ $scope.partner.contact_phone +'/verify?nation_code='+$scope.partner.nation_code).then(function (resp) { + }, function (resp) { + if(resp.data.status+0 ==500) { + $interval.cancel($scope.phone_code_timer); + } + + $scope.resError = resp.data.message; + }); + }; + $scope.chooseIndustry = function (industry) { + $scope.partner.industry = industry.mccCode; + $scope.industryLable = industry.label; + }; + $scope.searchBankInfo = function (bsb_no) { + $scope.initErrorMsg(); + if (bsb_no != null && bsb_no != "") { + $scope.showBankInfo = false; + $http.get('/register/info/bank/' + bsb_no).then(function (resp) { + $scope.bankInfo = resp.data; + $scope.bankaccount.bank = $scope.bankInfo.bank; + $scope.bankaccount.city = $scope.bankInfo.city; + $scope.bankaccount.address = $scope.bankInfo.address; + $scope.bankaccount.system = $scope.bankInfo.system; + $scope.bankaccount.postcode = $scope.bankInfo.postcode; + $scope.bankaccount.state = $scope.bankInfo.state; + $scope.bankaccount.branch = $scope.bankInfo.branch; + $scope.showBankInfo = true; + }, function (resp) { + $scope.showBankInfo = false; + }); + } else { + $scope.resError = "请先填写BSB No"; + } + }; + $scope.changeDays = function (clean_days) { + if (clean_days) { + $scope.showCleanDay = false; + switch (clean_days) { + case '1': { + $scope.rate.wechat_rate_value = parseFloat($scope.sysRateConfig.t1.Wechat); + $scope.rate.alipay_rate_value = parseFloat($scope.sysRateConfig.t1.Alipay); + $scope.rate.alipayonline_rate_value = parseFloat($scope.sysRateConfig.t1.AlipayOnline); + $scope.rate.bestpay_rate_value = parseFloat($scope.sysRateConfig.t1.Bestpay); + $scope.rate.jd_rate_value = parseFloat($scope.sysRateConfig.t1.JDpay); + $scope.showCleanDay = true; + break; + } + case '2': { + $scope.rate.wechat_rate_value = parseFloat($scope.sysRateConfig.t2.Wechat); + $scope.rate.alipay_rate_value = parseFloat($scope.sysRateConfig.t2.Alipay); + $scope.rate.bestpay_rate_value = parseFloat($scope.sysRateConfig.t2.Bestpay); + $scope.rate.alipayonline_rate_value = parseFloat($scope.sysRateConfig.t2.AlipayOnline); + $scope.rate.jd_rate_value = parseFloat($scope.sysRateConfig.t2.JDpay); + $scope.showCleanDay = true; + break; + } + case '3': { + $scope.rate.wechat_rate_value = parseFloat($scope.sysRateConfig.t3.Wechat); + $scope.rate.alipay_rate_value = parseFloat($scope.sysRateConfig.t3.Alipay); + $scope.rate.bestpay_rate_value = parseFloat($scope.sysRateConfig.t3.Bestpay); + $scope.rate.alipayonline_rate_value = parseFloat($scope.sysRateConfig.t3.AlipayOnline); + $scope.rate.jd_rate_value = parseFloat($scope.sysRateConfig.t3.JDpay); + $scope.showCleanDay = true; + break; + } + } + }else { + $scope.showCleanDay = false; + } + }; + + $scope.saveStep1 = function (form,index) { + $scope.initErrorMsg(); + if (form.$invalid) { + angular.forEach(form, function (item, key) { + if (key.indexOf('$') < 0) { + item.$dirty = true; + } + }); + return; + } + $scope.initParam(); + $scope.partner.username = $scope.partner.contact_phone; + $http.post('/register/info/update/' + $scope.partner.username +'/step1', $scope.partner).then(function (resp) { + $scope.changeChoose(index); + $scope.partner.codeKey = resp.data.codeKey; + }, function (resp) { + $scope.resError = resp.data.message; + }); + }; + + $scope.saveApplyInfo = function (form,index) { + $scope.initErrorMsg(); + if (form.$invalid) { + angular.forEach(form, function (item, key) { + if (key.indexOf('$') < 0) { + item.$dirty = true; + } + }); + return; + } + $scope.initParam(); + $http.post('/register/info/update/' + $scope.partner.username, $scope.partner).then(function (resp) { + if (index == 3) { + $scope.getRateConfig(); + } + if (index == 4) { + $scope.goToLogin(); + } + $scope.changeChoose(index); + }, function (resp) { + $scope.resError = resp.data.message; + }); + }; + + $scope.initParam = function () { + if(!$scope.partner.company_name){ + $scope.partner.company_name = ' '; + } + if(!$scope.partner.short_name){ + $scope.partner.short_name = ' '; + } + if(!$scope.partner.company_phone){ + $scope.partner.company_phone = ' '; + } + if(!$scope.partner.address){ + $scope.partner.address = ' '; + } + if(!$scope.partner.suburb){ + $scope.partner.suburb = ' '; + } + if(!$scope.partner.state){ + $scope.partner.state = ' '; + } + if(!$scope.partner.postcode){ + $scope.partner.postcode = ' '; + } + if(!$scope.partner.industry){ + $scope.partner.industry = ' '; + } + if(!$scope.partner.bank_no){ + $scope.partner.bank_no = ' '; + } + if(!$scope.partner.bank_name){ + $scope.partner.bank_name = ' '; + } + if(!$scope.partner.bsb_no){ + $scope.partner.bsb_no = ' '; + } + if(!$scope.partner.clean_days){ + $scope.partner.clean_days = ' '; + } + if(!$scope.partner.abn){ + $scope.partner.abn = ' '; + } + + } + + $scope.initErrorMsg = function () { + $scope.resError = ''; + } + +}]); \ No newline at end of file diff --git a/src/main/ui/static/payment/partner/templates/partner_detail.html b/src/main/ui/static/payment/partner/templates/partner_detail.html index 7b9717ead..a15f92f2f 100644 --- a/src/main/ui/static/payment/partner/templates/partner_detail.html +++ b/src/main/ui/static/payment/partner/templates/partner_detail.html @@ -60,6 +60,13 @@ (The Partner Using Green Channel Now!) 【目前状态】- + + (自助申请)资料完善中 + (自助申请)已开通 + (自助申请)快速开通等待提交合规材料 + (自助申请)待审核(材料已提交) + + 资料完善中 待审核(合同制作中) 合同制作完成 @@ -68,6 +75,7 @@ 通过 不通过 绿色通道申请中 +
@@ -114,7 +122,7 @@
- +
diff --git a/src/main/ui/static/payment/partner/templates/partners.html b/src/main/ui/static/payment/partner/templates/partners.html index ea6f15944..595d36503 100644 --- a/src/main/ui/static/payment/partner/templates/partners.html +++ b/src/main/ui/static/payment/partner/templates/partners.html @@ -498,11 +498,10 @@ 通过({{partner.approve_time}}) 资料完善中 + (自助开通)资料完善中 自助开通试用中({{partner.approve_time}}~{{partner.expiry_time}}) 不通过({{partner.approve_time}}) 申请打回({{partner.refuse_remark|limitTo:15}}) - 申请打回{{partner.refuse_remark|limitTo:15}} - Quick Pass(等待同意协议) 等待合规 自助开通(等待合规) 合同制作完成 diff --git a/src/test/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImplTest.java b/src/test/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImplTest.java new file mode 100644 index 000000000..255fad75f --- /dev/null +++ b/src/test/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImplTest.java @@ -0,0 +1,60 @@ +package au.com.royalpay.payment.manage.application.core.impls; + +import au.com.royalpay.payment.manage.application.core.SimpleClientApplyService; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringRunner; + +import javax.annotation.Resource; + +@SpringBootTest +@ActiveProfiles({ "dev", "alipay", "wechat", "jd", "bestpay" }) +@RunWith(SpringRunner.class) +public class SimpleClientApplyServiceImplTest { + + @Resource + private SimpleClientApplyService simpleClientApplyService; + + @Test + public void verifyRegisterSMSCode() { + } + + @Test + public void newAccount() { + } + + @Test + public void partnerSignIn() { + simpleClientApplyService.partnerSignIn(null); + } + + @Test + public void getAndSendSmsCode() { + simpleClientApplyService.getAndSendSmsCode("0451120326","61"); + } + + @Test + public void sendVerifyEmail() { + simpleClientApplyService.sendVerifyEmail("kira.wang@royalpay.com.au", 9,"kiratest"); + + } + + @Test + public void checkOrGenerateRegisterProcessKey() { + } + + @Test + public void deleteRegisterProcessKey() { + } + + @Test + public void checkOrGenerateVerifyMailKey() { + } + + @Test + public void deleteVerifyMailKey() { + } +} \ No newline at end of file diff --git a/src/test/java/au/com/royalpay/payment/manage/kira/WechatMessageTest.java b/src/test/java/au/com/royalpay/payment/manage/kira/WechatMessageTest.java new file mode 100644 index 000000000..7a3bc4404 --- /dev/null +++ b/src/test/java/au/com/royalpay/payment/manage/kira/WechatMessageTest.java @@ -0,0 +1,42 @@ +package au.com.royalpay.payment.manage.kira; + +import au.com.royalpay.payment.core.PaymentApi; +import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApi; +import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApiProvider; +import au.com.royalpay.payment.tools.connections.mpsupport.beans.TemplateMessage; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringRunner; + +import javax.annotation.Resource; + +@SpringBootTest +@ActiveProfiles({"dev","alipay","wechat","jd","bestpay"}) +@RunWith(SpringRunner.class) +public class WechatMessageTest { + + @Resource + private PaymentApi paymentApi; + @Resource + private MpWechatApiProvider mpWechatApiProvider; + + @Test + public void asd(){ + String openId = "o32MzuO4s8c7iFOVxnxejkbhMoEc"; + MpWechatApi api = mpWechatApiProvider.getApiFromOpenId(openId); + String templateId = api.getTemplateId("refund-send"); + + TemplateMessage msg = new TemplateMessage(openId, templateId, ""); + msg.put("first", "退款已提交处理", "#10b24c"); + msg.put("keyword1", "test1", "#000000"); + msg.put("keyword2", "test2", "#000000"); + msg.put("keyword3","test3", "#000000"); + msg.put("keyword4", "test4", "#000000"); + msg.put("remark", "已受理您的退款申请,\n将\n\r在近期到账", "#10b24c"); + + api.sendTemplateMessage(msg); + } +}