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

master
todking 6 years ago
commit 2e9093c1be

@ -22,6 +22,7 @@ public class ClientPreApplyStep1Bean {
@NotEmpty(message = "phoneCodeKey can't be null")
private String phoneCodeKey;
private String apply_source = "pc";
private int channel;
public JSONObject insertObject() {
@ -84,4 +85,12 @@ public class ClientPreApplyStep1Bean {
public void setApply_source(String apply_source) {
this.apply_source = apply_source;
}
public int getChannel() {
return channel;
}
public void setChannel(int channel) {
this.channel = channel;
}
}

@ -3,6 +3,7 @@ package au.com.royalpay.payment.manage.application.core;
import au.com.royalpay.payment.manage.merchants.beans.NewAccountBean;
import com.alibaba.fastjson.JSONObject;
import org.apache.catalina.servlet4preview.http.HttpServletRequest;
public interface SimpleClientApplyService {
void verifyRegisterSMSCode(String codeKey, String phoneNumber);
@ -11,7 +12,7 @@ public interface SimpleClientApplyService {
String partnerSignIn(JSONObject account);
String getAndSendSmsCode(String phoneNumber, String nationCode);
String getAndSendSmsCode(String phoneNumber, String nationCode, HttpServletRequest request);
String checkOrGenerateRegisterProcessKey(String accountName, String codeKey);

@ -28,6 +28,7 @@ import au.com.royalpay.payment.tools.utils.PasswordUtils;
import com.alibaba.fastjson.JSONObject;
import com.github.qcloudsms.SmsSingleSender;
import org.apache.catalina.servlet4preview.http.HttpServletRequest;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
@ -43,10 +44,7 @@ import org.thymeleaf.spring4.SpringTemplateEngine;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Random;
import java.util.*;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
@ -103,6 +101,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
@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";
@ -134,7 +133,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
}
@Override
public String getAndSendSmsCode(String phoneNumber, String nationCode) {
public String getAndSendSmsCode(String phoneNumber, String nationCode, HttpServletRequest request) {
String reidsCheckCodeKey = getRegisterClientRedisKey(phoneNumber);
String value = stringRedisTemplate.boundValueOps(reidsCheckCodeKey).get();
if (StringUtils.isNotEmpty(value)) {
@ -147,7 +146,11 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
String expireMin = "3";
param.add(expireMin);
try {
smsSender.getSender().sendWithParam(nationCode.trim(), phoneNumber, REGISTER_CLIENT_TEMPLID, param, "RoyalPay", "", "");
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");

@ -7,6 +7,7 @@ import au.com.royalpay.payment.tools.env.SysConfigManager;
import com.alibaba.fastjson.JSONObject;
import org.apache.catalina.servlet4preview.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
@ -64,8 +65,8 @@ public class SimpleClientApplyController {
@RequestMapping(value = "/info/phone/{phone_number}/verify", method = RequestMethod.POST)
@ResponseBody
public void getAndSendSmsCode(@PathVariable String phone_number, @RequestParam String nation_code) {
simpleClientApplyService.getAndSendSmsCode(phone_number, nation_code);
public void getAndSendSmsCode(@PathVariable String phone_number, @RequestParam String nation_code, HttpServletRequest request) {
simpleClientApplyService.getAndSendSmsCode(phone_number, nation_code, request);
}
@RequestMapping(value = "/info/update/{username}", method = RequestMethod.POST)

@ -23,6 +23,7 @@ public class GoodInfo {
private int inventory = -1;
private String origin;
private String type;
private String order_desc;
private String description;
private List<JSONObject> images;
// private String image_thumbnail;
@ -130,4 +131,12 @@ public class GoodInfo {
public void setActual_cny_price(String actual_cny_price) {
this.actual_cny_price = actual_cny_price;
}
public String getOrder_desc() {
return order_desc;
}
public void setOrder_desc(String order_desc) {
this.order_desc = order_desc;
}
}

@ -18,6 +18,8 @@ public interface GoodManage {
@Transactional
void updateGoodInfo(JSONObject partner, String goodId, GoodInfo goodInfo) throws Exception;
void updateDisplayInventory(JSONObject partner, String goodId, boolean displayInventory);
@Transactional
void delete(JSONObject partner, String goodId);
}

@ -105,6 +105,14 @@ public class GoodManageImpl implements GoodManage {
goodMapper.update(updateObject);
}
@Override
public void updateDisplayInventory(JSONObject partner,String goodId, boolean displayInventory) {
JSONObject good = goodMapper.findGood(goodId);
Assert.notNull(good);
good.put("inventory_display", displayInventory);
goodMapper.update(good);
}
@Override
public void delete(JSONObject partner, String goodId) {
JSONObject good = goodMapper.findGood(goodId);

@ -46,7 +46,6 @@ public class GoodManageController {
throw new Exception("商户未知!");
}
return goodManage.getGoodDetail(goodId);
}
@PartnerMapping(value ="/{goodId}",method = RequestMethod.DELETE)
public void deleteGood(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner, @PathVariable String goodId) throws Exception {
@ -65,6 +64,14 @@ public class GoodManageController {
}
@PartnerMapping(value = "/{goodId}/inventory_display", method = RequestMethod.PUT)
public void updateDisplayInventory(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner, @PathVariable String goodId, @RequestBody JSONObject params) throws Exception {
if (partner == null) {
throw new Exception("商户未知!");
}
goodManage.updateDisplayInventory(partner, goodId,params.getBooleanValue("inventory_display"));
}
@PartnerMapping(value = "/goodOrders", method = RequestMethod.GET)
@ResponseBody
public JSONObject listGoodOrders(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner, GoodOrderQuery goodOrderQuery) {

@ -0,0 +1,21 @@
package au.com.royalpay.payment.manage.mappers.system;
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
import com.alibaba.fastjson.JSONObject;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator;
@AutoMapper(tablename = "merchant_sign_info", pkName = "client_moniker", keyGenerator = Jdbc3KeyGenerator.class)
public interface MerchantSignInfoMapper {
@AutoSql(type = SqlType.SELECT)
JSONObject findClientSign(@Param("client_moniker") String clientMoniker);
@AutoSql(type = SqlType.UPDATE)
void update(JSONObject signInfo);
@AutoSql(type = SqlType.INSERT)
void insert(JSONObject signInfo);
}

@ -245,6 +245,10 @@ public interface ClientManager {
void switchChildEachRefund(JSONObject manager, String clientMoniker, boolean childEachRefund);
void changeGatewayVersion(JSONObject account, boolean enable_v2);
void changeVerifyIp(JSONObject account, boolean enable_v2);
void changePaymentPage(JSONObject account, String paypad_version);
void changeManualSettle(JSONObject account , int client_id, boolean manual_settle,String operator_id,int type,String operation);
@ -291,6 +295,12 @@ public interface ClientManager {
void setCustomerSurchargeRate(JSONObject account,String clientMoniker, BigDecimal customer_surcharge_rate);
void setPartnerPublicKeyConfig(JSONObject account, String ipWhitelistConfig);
void refreshPlatformPublicKeyConfig(JSONObject account);
void setIpWhitelistConfig(JSONObject account, String ipWhitelistConfig);
void setOrderExpiryConfig(JSONObject account,String clientMoniker, String orderExpiryConfig);
void getAgreeFile(String clientMoniker, JSONObject manager) throws Exception;

@ -1,6 +1,7 @@
package au.com.royalpay.payment.manage.merchants.core;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify;
import au.com.royalpay.payment.manage.merchants.entity.ClientGatewaySignModify;
import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
/**
@ -11,4 +12,6 @@ public interface ClientModifySupport {
void processClientModify(ClientModify clientModify);
void processClientConfigModify(ClientConfigModify clientConfigModify);
void processClientGatewaySignModify(ClientGatewaySignModify clientGatewaySignModify);
}

@ -42,6 +42,7 @@ import au.com.royalpay.payment.manage.support.sms.SmsSender;
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;
import au.com.royalpay.payment.tools.codec.RSACrypt;
import au.com.royalpay.payment.tools.connections.attachment.core.AttachmentClient;
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApi;
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApiProvider;
@ -101,6 +102,7 @@ import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.RequestMethod;
import org.thymeleaf.context.Context;
import org.thymeleaf.spring4.SpringTemplateEngine;
import sun.misc.BASE64Encoder;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
@ -117,10 +119,9 @@ import java.math.RoundingMode;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.security.InvalidKeyException;
import java.security.InvalidParameterException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.*;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.util.List;
import java.util.*;
import java.util.concurrent.TimeUnit;
@ -274,6 +275,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Resource
private SysClientMapper sysClientMapper;
@Resource
private MerchantSignInfoMapper merchantSignInfoMapper;
@Resource
private Locker locker;
@ -421,6 +424,15 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
&& sysClientMapper.childClientId(client.getIntValue("client_id")).size() > 0) {
client.put("level2_client", 1);
}
//gateway V2
JSONObject partnerGatewaySign = merchantSignInfoMapper.findClientSign(client.getString("client_moniker"));
if (partnerGatewaySign == null) {
client.put("enable_gateway_version2", false);
}else {
client.put("enable_gateway_version2", partnerGatewaySign.getBooleanValue("is_valid"));
client.put("gateway_sign", partnerGatewaySign);
}
return client;
}
@ -1897,12 +1909,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new InvalidShortIdException();
}
OrgCheckUtils.checkOrgPermission(manager, client);
JSONObject update = new JSONObject();
int clientId = client.getIntValue("client_id");
BigDecimal refundCreditLine = refundLineInfo.getBigDecimal("refund_credit_line");
update.put("client_id", clientId);
update.put("refund_credit_line", refundCreditLine);
clientMapper.update(update);
client.put("refund_credit_line", refundCreditLine);
clientMapper.update(client);
clientInfoCacheSupport.clearClientCache(clientId);
}
@ -3212,6 +3222,79 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
clientModifySupport.processClientConfigModify(new PaypadVersionModify(manager, clientMoniker, paypad_version));
}
@Override
public void changeGatewayVersion(JSONObject account, boolean enable_gateway_v2) {
int clientId = account.getIntValue("client_id");
JSONObject client = getClientInfo(clientId);
if (client == null) {
throw new InvalidShortIdException();
}
JSONObject gatewaySignInfo = merchantSignInfoMapper.findClientSign(client.getString("client_moniker"));
if (gatewaySignInfo == null) {
JSONObject key = getRsaKey();
gatewaySignInfo = new JSONObject();
gatewaySignInfo.put("client_moniker", client.getString("client_moniker"));
gatewaySignInfo.put("platform_public_key", key.getString("public_key"));
gatewaySignInfo.put("platform_private_key", key.getString("private_key"));
gatewaySignInfo.put("is_valid", 0);
gatewaySignInfo.put("creation_by", account.getString("account_id"));
gatewaySignInfo.put("creation_date", new Date());
gatewaySignInfo.put("last_update_by", account.getString("account_id"));
gatewaySignInfo.put("last_update_date", new Date());
merchantSignInfoMapper.insert(gatewaySignInfo);
}
clientModifySupport.processClientGatewaySignModify(new SwitchGatewaySignPermissionModify(account, client.getString("client_moniker"),"is_valid" ,enable_gateway_v2));
}
@Override
public void changeVerifyIp(JSONObject account, boolean verify_ip) {
int clientId = account.getIntValue("client_id");
JSONObject client = getClientInfo(clientId);
if (client == null) {
throw new InvalidShortIdException();
}
clientModifySupport.processClientGatewaySignModify(new SwitchGatewaySignPermissionModify(account, client.getString("client_moniker"),"verify_ip" ,verify_ip));
}
@Override
public void setIpWhitelistConfig(JSONObject account, String ipWhitelistConfig) {
int clientId = account.getIntValue("client_id");
JSONObject client = getClientInfo(clientId);
if (client == null) {
throw new InvalidShortIdException();
}
if (StringUtils.isNotBlank(ipWhitelistConfig)) {
clientModifySupport.processClientGatewaySignModify(new GatewayInfoModify(account, client.getString("client_moniker"),"ip_whitelist", ipWhitelistConfig, "重新设置IP白名单"));
}
}
@Override
@Transactional
public void refreshPlatformPublicKeyConfig(JSONObject account) {
int clientId = account.getIntValue("client_id");
JSONObject client = getClientInfo(clientId);
if (client == null) {
throw new InvalidShortIdException();
}
JSONObject key = getRsaKey();
clientModifySupport.processClientGatewaySignModify(new GatewayInfoModify(account, client.getString("client_moniker"),"platform_public_key",key.getString("public_key"),"重新生成平台公钥"));
clientModifySupport.processClientGatewaySignModify(new GatewayInfoModify(account, client.getString("client_moniker"),"platform_private_key",key.getString("private_key"),"重新生成平台私钥"));
}
@Override
public void setPartnerPublicKeyConfig(JSONObject account, String publicKey) {
int clientId = account.getIntValue("client_id");
JSONObject client = getClientInfo(clientId);
if (client == null) {
throw new InvalidShortIdException();
}
JSONObject update = new JSONObject();
update.put("client_id", client.getIntValue("client_id"));
if (StringUtils.isNotBlank(publicKey)) {
clientModifySupport.processClientGatewaySignModify(new GatewayInfoModify(account, client.getString("client_moniker"), "mch_public_key", publicKey, "重新设置商户公钥"));
}
}
@Override
public void changePaymentSuccessPage(JSONObject manager, String clientMoniker, String paysuccess_version) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
@ -5029,4 +5112,14 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
return null;
}
private JSONObject getRsaKey() {
JSONObject key = new JSONObject();
KeyPair keyPairGen = RSACrypt.generateKeyPairs();
RSAPublicKey publicKey = (RSAPublicKey) keyPairGen.getPublic();
RSAPrivateKey privateKey = (RSAPrivateKey) keyPairGen.getPrivate();
key.put("public_key", new BASE64Encoder().encode(publicKey.getEncoded()));
key.put("private_key", new BASE64Encoder().encode(privateKey.getEncoded()));
return key;
}
}

@ -2,9 +2,11 @@ package au.com.royalpay.payment.manage.merchants.core.impls;
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.MerchantSignInfoMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientInfoCacheSupport;
import au.com.royalpay.payment.manage.merchants.core.ClientModifySupport;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify;
import au.com.royalpay.payment.manage.merchants.entity.ClientGatewaySignModify;
import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
@ -21,6 +23,8 @@ public class ClientModifySupportImpl implements ClientModifySupport {
@Resource
private MerchantInfoProvider merchantInfoProvider;
@Resource
private MerchantSignInfoMapper merchantSignInfoMapper;
@Resource
private ClientInfoCacheSupport clientInfoCacheSupport;
@Resource
private ClientMapper clientMapper;
@ -40,4 +44,10 @@ public class ClientModifySupportImpl implements ClientModifySupport {
int clientId =clientConfigModify.doModify(merchantInfoProvider, clientConfigMapper,clientMapper,mongoTemplate);
clientInfoCacheSupport.clearClientCache(clientId);
}
@Override
public void processClientGatewaySignModify(ClientGatewaySignModify clientGatewaySignModify) {
int clientId =clientGatewaySignModify.doModify(merchantInfoProvider, merchantSignInfoMapper,mongoTemplate);
clientInfoCacheSupport.clearClientCache(clientId);
}
}

@ -0,0 +1,78 @@
package au.com.royalpay.payment.manage.merchants.entity;
import au.com.royalpay.payment.manage.mappers.system.MerchantSignInfoMapper;
import au.com.royalpay.payment.manage.merchants.beans.mongo.ClientConfigLog;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import au.com.royalpay.payment.tools.utils.id.IdUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.Map;
import java.util.stream.Collectors;
/**
* Create by yixian at 2018-04-12 16:19
*/
public abstract class ClientGatewaySignModify {
private JSONObject account;
private String clientMoniker;
public ClientGatewaySignModify(JSONObject account, String clientMoniker) {
this.account = account;
this.clientMoniker = clientMoniker;
}
protected abstract String business();
protected abstract JSONObject getModifyResult();
@Transactional
public int doModify(MerchantInfoProvider merchantInfoProvider, MerchantSignInfoMapper merchantSignInfoMapper, MongoTemplate mongoTemplate) {
JSONObject client = merchantInfoProvider.getClientInfoByMoniker(clientMoniker);
JSONObject clientGatewaySign = merchantSignInfoMapper.findClientSign(clientMoniker);
JSONObject modifyResult = getModifyResult();
try {
saveModifyHistory(clientGatewaySign, modifyResult, mongoTemplate);
}catch (Exception e){
}
int clientId = client.getIntValue("client_id");
modifyResult.put("client_moniker", clientMoniker);
modifyResult.put("last_update_by", account.getString("account_id"));
modifyResult.put("last_update_date", new Date());
merchantSignInfoMapper.update(modifyResult);
return clientId;
}
private void saveModifyHistory(JSONObject clientGatewaySign, JSONObject modifyResult, MongoTemplate mongoTemplate) {
if (account == null) {
return;
}
ClientConfigLog clientConfigLog = new ClientConfigLog();
clientConfigLog.setId(IdUtil.getId());
clientConfigLog.setBusiness(business());
clientConfigLog.setClientId(clientGatewaySign.getIntValue("client_id"));
boolean isPartner = true;
if (StringUtils.isNotEmpty(account.getString("account_id"))) {
isPartner = true;
}
if (StringUtils.isNotEmpty(account.getString("manager_id"))) {
isPartner = false;
}
clientConfigLog.setUserType(isPartner ? "Merchant" : "Manager");
clientConfigLog.setCreateTime(new Date());
clientConfigLog.setNewData(modifyResult.toJSONString());
clientConfigLog.setUserId(isPartner ? account.getString("account_id") : account.getString("manager_id"));
Map<String, Object> beforeModify = modifyResult.keySet().stream().collect(Collectors.toMap(key -> key, clientGatewaySign::get));
clientConfigLog.setOriginData(JSON.toJSONString(beforeModify));
clientConfigLog.setUserName(isPartner ? account.getString("display_name") : account.getString("display_name"));
mongoTemplate.save(clientConfigLog);
}
}

@ -0,0 +1,34 @@
package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify;
import au.com.royalpay.payment.manage.merchants.entity.ClientGatewaySignModify;
import com.alibaba.fastjson.JSONObject;
/**
* Create by yixian at 2018-04-12 16:43
*/
public class GatewayInfoModify extends ClientGatewaySignModify {
private String key;
private String value;
private String changeMess;
public GatewayInfoModify(JSONObject account, String clientMoniker, String key, String value, String changeMess) {
super(account, clientMoniker);
this.key = key;
this.value = value;
this.changeMess = changeMess;
}
@Override
protected String business() {
return changeMess;
}
@Override
protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject();
modify.put(key, value);
return modify;
}
}

@ -0,0 +1,32 @@
package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify;
import au.com.royalpay.payment.manage.merchants.entity.ClientGatewaySignModify;
import com.alibaba.fastjson.JSONObject;
/**
* Create by yixian at 2018-04-12 16:43
*/
public class SwitchGatewaySignPermissionModify extends ClientGatewaySignModify {
private String key;
private boolean value;
public SwitchGatewaySignPermissionModify(JSONObject account, String clientMoniker, String key, boolean value) {
super(account, clientMoniker);
this.key = key;
this.value = value;
}
@Override
protected String business() {
return (value?"开启 ":"关闭 ")+key;
}
@Override
protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject();
modify.put(key, value);
return modify;
}
}

@ -358,6 +358,37 @@ public class PartnerViewController {
return tradeLogService.getOrdersCount(account);
}
@PartnerMapping(value = "/switch_gateway_v2", method = RequestMethod.PUT)
@ResponseBody
public void changeGatewayVersion(@RequestBody JSONObject pass, @ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account) {
clientManager.changeGatewayVersion(account, pass.getBooleanValue("enable_gateway_version2"));
}
@PartnerMapping(value = "/verify_ip", method = RequestMethod.PUT)
@ResponseBody
public void changeVerifyIp(@RequestBody JSONObject pass, @ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account) {
clientManager.changeVerifyIp(account, pass.getBooleanValue("verify_ip"));
}
@PartnerMapping(value = "/ip_whitelist", method = RequestMethod.PUT)
@ResponseBody
public void setIpWhitelistConfig(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account, @RequestBody JSONObject config) {
clientManager.setIpWhitelistConfig(account, config.getString("ip_whitelist"));
}
@PartnerMapping(value = "/partner_public_key", method = RequestMethod.PUT)
@ResponseBody
public void setPartnerPublicKeyConfig(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account, @RequestBody JSONObject config) {
clientManager.setPartnerPublicKeyConfig(account, config.getString("partner_public_key"));
}
@PartnerMapping(value = "/refresh_platform_public_key", method = RequestMethod.PUT)
@ResponseBody
public void refreshPlatformPublicKeyConfig(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account) {
clientManager.refreshPlatformPublicKeyConfig(account);
}
@PartnerMapping(value = "/payment_page_version", method = RequestMethod.PUT)
@ResponseBody
public void changePaymentPage(@RequestBody JSONObject pass, @ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account) {

@ -323,6 +323,27 @@
minlength="6" maxlength="12" name="rePassword">
</div>
<div class="row">
<div class="col-xs-12 margin-bottom">
<div class="form-group has-feedback" ng-class="{'has-error':companyForm.customerchannel.$invalid && companyForm.customerchannel.$dirty}">
<div class="dropdown">
<input id="channel" data-toggle="dropdown" data-target="#" class="form-control"
ng-model="channelLable" placeholder="What channel did you learn about RoyaPay?" required
maxlength="50" name="customerchannel" readonly="readonly">
<ul class="dropdown-menu multi-level" role="menu" aria-labelledby="dropdownMenu">
<li class="dropdown-submenu" ng-repeat="channel in customerchannel">
<a tabindex="-1" ng-if="channel.children" ng-model="channel.mccCode">{{channel.label}}</a>
<ul class="dropdown-menu" ng-if="channel.children">
<li><a tabindex="-1" href="javascript:;" ng-repeat="child in channel.children" ng-click="chooseChannel(child)">{{child.label}}</a></li>
</ul>
<a ng-if="!channel.children" ng-model="channel.mccCode" ng-click="chooseChannel(channel)">{{channel.label}}</a>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12 margin-bottom">
<button type="button" class="btn btn-success btn-block btn-flat"

@ -0,0 +1,49 @@
[
{
"children": [
{
"children": [],
"label": "谷歌|Google",
"mccCode": "10001"
},
{
"children": [],
"label": "领英|LinkedIn",
"mccCode": "10002"
},
{
"children": [],
"label": "微信|Wechat",
"mccCode": "10003"
},
{
"children": [],
"label": "传单手册|Flyer Manual",
"mccCode": "10004"
},
{
"children": [],
"label": "其他媒体|Other Media",
"mccCode": "10005"
}
],
"label": "媒体宣传|Media",
"mccCode": "1"
},
{
"label": "线下使用体验|Offline Experience",
"mccCode": "2"
},
{
"label": "朋友介绍|Friend Introduction",
"mccCode": "3"
},
{
"label": "商户推荐|Merchant Recommendation",
"mccCode": "4"
},
{
"label": "销售推荐|Sales Recommendation",
"mccCode": "5"
}
]

@ -3,187 +3,187 @@
"children": [
{
"children": [],
"label": "机票",
"label": "机票|Air Tickets",
"mccCode": "10001"
},
{
"children": [],
"label": "旅游行业",
"label": "旅游行业|Tourism Industry",
"mccCode": "10002"
},
{
"children": [],
"label": "私人定制旅游",
"label": "私人定制旅游|Private Custom Tour",
"mccCode": "10003"
},
{
"children": [],
"label": "租车",
"label": "租车|Car rental",
"mccCode": "10004"
},
{
"children": [],
"label": "巴士",
"label": "巴士|Bus",
"mccCode": "10005"
}
],
"label": "旅游出行",
"label": "旅游出行|Travel",
"mccCode": "1"
},
{
"children": [
{
"children": [],
"label": "饭店",
"label": "饭店|Restaurant",
"mccCode": "20001"
},
{
"children": [],
"label": "奶茶店",
"label": "奶茶店|Tea Shop",
"mccCode": "20002"
},
{
"children": [],
"label": "烧烤",
"label": "烧烤|Barbecue",
"mccCode": "20003"
},
{
"children": [],
"label": "火锅",
"label": "火锅|Hot Pot",
"mccCode": "20004"
},
{
"children": [],
"label": "Coffee",
"label": "咖啡|Coffee",
"mccCode": "20005"
},
{
"children": [],
"label": "酒吧",
"label": "酒吧|Bar",
"mccCode": "20006"
}
],
"label": "餐饮",
"label": "餐饮|Food",
"mccCode": "2"
},
{
"children": [
{
"children": [],
"label": "公众号服务商",
"label": "公众号服务商|Public Service Provider",
"mccCode": "50001"
},
{
"children": [],
"label": "各种媒体类宣传",
"label": "各种媒体类宣传|Various Media Promotion",
"mccCode": "50002"
}
],
"label": "传媒",
"label": "传媒|Media",
"mccCode": "5",
"value": "{\"category\":\"SERVICE\",\"code\":\"7542\",\"description\":\"Car Washes\",\"parentCode\":\"S10\"}"
},
{
"children": [
{
"label": "超市",
"label": "超市|Supermarket",
"mccCode": "70001"
},
{
"children": [],
"label": "服装店",
"label": "服装店|Clothing Store",
"mccCode": "70002"
},
{
"children": [],
"label": "鞋店",
"label": "鞋店|Shoe Store",
"mccCode": "70003"
},{
"children": [],
"label": "箱包",
"label": "箱包|Luggage",
"mccCode": "70005"
}
],
"label": "零售",
"label": "零售|Retail",
"mccCode": "7"
},
{
"children": [
{
"children": [],
"label": "桌游吧",
"label": "桌游吧|Board Game",
"mccCode": "80001"
},
{
"children": [],
"label": "网吧",
"label": "网吧|Internet Cafe",
"mccCode": "80007"
}
],
"label": "休闲娱乐",
"label": "休闲娱乐|Leisure and entertainment",
"mccCode": "8"
},
{
"children": [
{
"children": [],
"label": "摄影",
"label": "摄影|Photography",
"mccCode": "90001"
},
{
"children": [],
"label": "通讯运营商",
"label": "通讯运营商|Communication Carrier",
"mccCode": "90003"
},
{
"children:":[],
"label":"软件服务",
"label":"软件服务|Software Service",
"mccCode":"90005"
}
],
"label": "其他服务类",
"label": "其他服务类|Other Service Classes",
"mccCode": "9"
},
{
"children": [
{
"children": [],
"label": "Hotel",
"label": "旅馆|Hotel",
"mccCode": "100001"
},
{
"children": [],
"label": "Motel",
"label": "汽车旅馆|Motel",
"mccCode": "100002"
}
],
"label": "酒店",
"label": "酒店|Hotel",
"mccCode": "10"
},
{
"children": [
{
"children": [],
"label": "代购",
"label": "代购|Purchasing",
"mccCode": "110001"
},
{
"children": [],
"label": "物流(大宗出口贸易)",
"label": "物流(大宗出口贸易)|Logistics (Bulk Export Trade)",
"mccCode": "110002"
},
{
"children": [],
"label": "红酒出口",
"label": "红酒出口|Wine Export",
"mccCode": "110003"
},
{
"children": [],
"label": "综合电商",
"label": "综合电商|Integrated E-Commerce",
"mccCode": "110004"
}
],
"label": "出口贸易",
"label": "出口贸易|Export Trade",
"mccCode": "11"
}
]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 704 KiB

After

Width:  |  Height:  |  Size: 796 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 239 KiB

After

Width:  |  Height:  |  Size: 301 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 767 KiB

After

Width:  |  Height:  |  Size: 1.4 MiB

@ -71,6 +71,13 @@ angular.module('applyPartnerApp', ['ngMessages']).controller('applyPartnerCtrl',
};
$scope.loadRoyalpayindustry();
$scope.loadCustomerChannel = function () {
$http.get('/static/data/rp_customer_channel.json').then(function (resp) {
$scope.customerchannel = resp.data;
})
};
$scope.loadCustomerChannel();
$scope.checkParams = function () {
if($scope.partner.contact_phone && $scope.partner.nation_code){
@ -173,6 +180,12 @@ angular.module('applyPartnerApp', ['ngMessages']).controller('applyPartnerCtrl',
$scope.partner.industry = industry.mccCode;
$scope.industryLable = industry.label;
};
$scope.chooseChannel = function (channel) {
$scope.partner.channel = channel.mccCode;
$scope.channelLable = channel.label;
};
$scope.searchBankInfo = function (bsb_no) {
$scope.initErrorMsg();
if (bsb_no != null && bsb_no != "") {
@ -329,6 +342,9 @@ angular.module('applyPartnerApp', ['ngMessages']).controller('applyPartnerCtrl',
return;
}
if ($scope.partner.client_pay_type.indexOf('1') >= 0 && $scope.partner.client_pay_type.indexOf('2') >= 0) {
if (!($scope.partner.client_pay_desc instanceof Array)) {
$scope.partner.client_pay_desc = $scope.partner.client_pay_desc.split(',');
}
var fristDesc = $scope.partner.client_pay_desc[0];
var lastDesc = $scope.partner.client_pay_desc[($scope.partner.client_pay_desc.length - 1)];
if (parseInt(fristDesc) > 5 || parseInt(lastDesc) < 6) {
@ -345,6 +361,8 @@ angular.module('applyPartnerApp', ['ngMessages']).controller('applyPartnerCtrl',
}
if ($scope.partner.client_pay_type instanceof Array) {
$scope.partner.client_pay_type = $scope.partner.client_pay_type.join(',');
}
if ($scope.partner.client_pay_desc instanceof Array) {
$scope.partner.client_pay_desc = $scope.partner.client_pay_desc.join(',');
}
$http.post('/register/info/update/' + $scope.partner.username, $scope.partner).then(function (resp) {

@ -120,6 +120,23 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS
$scope.good = good.data;
var images = good.data.images;
$scope.good.images = images ? JSON.parse(images) : [];
$scope.init = {
displayInventory: false
};
$scope.switchDisplayInventory = function () {
if (!$scope.good) {
return;
}
if (!$scope.init.displayInventory) {
$scope.init.displayInventory = true;
return;
}
$http.put('/sys/client/goods/' + $scope.good.id + '/inventory_display', {inventory_display: $scope.good.inventory_display}).then(function () {
$state.reload();
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
});
};
$scope.editGood = function () {
commonDialog.confirm({
title: 'Edit Good',

@ -171,6 +171,20 @@
</div>
</div>
<div class="form-group"
ng-class="{'has-error':goodForm.description.$invalid && goodForm.description.$dirty}">
<label class="control-label col-sm-2" for="order-desc-input"> Order Description</label>
<div class="col-sm-8">
<input class="form-control" ng-model="good.order_desc"
name="description" id="order-desc-input" maxlength="20">
<div ng-messages="goodForm.description.$error"
ng-if="goodForm.description.$dirty">
<p class="small text-danger" ng-message="maxlength">Less Than 20
Characters(including symbols and spaces)</p>
</div>
</div>
</div>
<div class="form-group"
ng-class="{'has-error':goodForm.description.$invalid && goodForm.description.$dirty}">
<label class="control-label col-sm-2" for="desc-input"> Description</label>

@ -73,6 +73,13 @@
<img ng-src="{{image.url}}" class="col-sm-3 col-xs-5">
</div>
</div>
<div class="form-group" ng-if="good.inventory !=-1">
<label class="control-label col-sm-2">Display Inventory</label>
<div class="col-sm-10">
<input type="checkbox" ng-model="good.inventory_display" bs-switch
switch-change="switchDisplayInventory()">
</div>
</div>
<div class="form-group" ng-if="good.inventory !=-1">
<label class="control-label col-sm-2">Inventory</label>
@ -88,6 +95,13 @@
<p class="form-control-static" ng-bind="good.origin"></p>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2">Order Description</label>
<div class="col-sm-10">
<p class="form-control-static" ng-bind="good.order_desc"></p>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2">Description</label>

@ -189,7 +189,19 @@
</div>
</div>
</div>
<div class="form-group"
ng-class="{'has-error':goodForm.description.$invalid && goodForm.description.$dirty}">
<label class="control-label col-sm-2" for="order-desc-input"> Order Description</label>
<div class="col-sm-8">
<input class="form-control" ng-model="good.order_desc"
name="description" id="order-desc-input" maxlength="20">
<div ng-messages="goodForm.description.$error"
ng-if="goodForm.description.$dirty">
<p class="small text-danger" ng-message="maxlength">Less Than 20
Characters(including symbols and spaces)</p>
</div>
</div>
</div>
<div class="form-group"
ng-class="{'has-error':goodForm.description.$invalid && goodForm.description.$dirty}">
<label class="control-label col-sm-2" for="desc-input"> Description</label>

@ -349,6 +349,38 @@ define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload','uiBoot
};
}]);
app.controller('clientResetPartnerPublicKeyDialogCtrl', ['$scope', '$http', 'gateway_sign', function ($scope, $http,gateway_sign) {
$scope.gateway_sign = angular.copy(gateway_sign);
$scope.uploadPublicKey = function (mch_public_key) {
$scope.errmsg = null;
$http.put('/client/partner_info/partner_public_key', {partner_public_key:mch_public_key}).then(function () {
$scope.$close();
}, function (resp) {
$scope.errmsg = resp.data.message;
})
}
}]);
app.controller('clientRefreshPlatformPublicKeyDialogCtrl', ['$scope', '$http', 'gateway_sign','commonDialog', function ($scope, $http,gateway_sign,commonDialog) {
$scope.gateway_sign = angular.copy(gateway_sign);
$scope.copyPublicKey = function() {
var e=document.getElementById("c-cpKey");
e.select();
var successful = document.execCommand("Copy");
if (successful) {
commonDialog.alert({title: 'Success', content: '已复制到剪切板!', type: 'success'});
}else {
commonDialog.alert({title: 'Error', content: '您的浏览器不支持!请手动复制', type: 'error'});
}
};
$scope.refreshPublicKey = function () {
$scope.errmsg = null;
$http.put('/client/partner_info/refresh_platform_public_key').then(function () {
$scope.$close();
}, function (resp) {
$scope.errmsg = resp.data.message;
})
}
}]);
app.controller('clientResetRefundPwdDialogCtrl', ['$scope', '$http', function ($scope, $http) {
$scope.updateRefundPwd = function (refundPwd) {
$scope.errmsg = null;
@ -570,6 +602,10 @@ define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload','uiBoot
$scope.paymentInfo = $scope.partner;
$scope.old_customer_surcharge_rate = angular.copy($scope.partner.customer_surcharge_rate);
$scope.qrConfig = {currency: 'AUD'};
$scope.ctrl = {
switch_gateway_v2: false,
switch_verify_ip: false
};
$scope.clientCopyHfLink = function() {
var e=document.getElementById("c-cpbt");
@ -582,6 +618,91 @@ define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload','uiBoot
}
};
$scope.loadPartnerPaymentInfo = function () {
$http.get('/client/partner_info').then(function (resp) {
$scope.paymentInfo = resp.data;
})
};
$scope.switchGatewayV2 = function () {
if (!$scope.paymentInfo) {
return;
}
if (!$scope.ctrl.switch_gateway_v2) {
$scope.ctrl.switch_gateway_v2 = true;
return;
}
$http.put('/client/partner_info/switch_gateway_v2', {enable_gateway_version2: $scope.paymentInfo.enable_gateway_version2}).then(function () {
$scope.loadPartnerPaymentInfo();
}, function (resp) {
commonDialog.alert({
title: 'failed to change Gateway Version',
content: resp.data.message,
type: 'error'
})
})
};
$scope.switchVerifyIp = function () {
if (!$scope.paymentInfo.gateway_sign) {
return;
}
if (!$scope.ctrl.switch_verify_ip) {
$scope.ctrl.switch_verify_ip = true;
return;
}
$http.put('/client/partner_info/verify_ip', {verify_ip: $scope.paymentInfo.gateway_sign.verify_ip}).then(function () {
$scope.loadPartnerPaymentInfo();
}, function (resp) {
commonDialog.alert({
title: 'failed to change Verify IP',
content: resp.data.message,
type: 'error'
})
})
};
$scope.clientSaveIpWhitelistConfig = function (config) {
$http.put('/client/partner_info/ip_whitelist', {ip_whitelist: config}).then(function () {
$scope.ctrl.editIpWhitelistConfig = false;
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
})
};
$scope.resetPartnerPubliKey = function () {
$uibModal.open({
templateUrl: '/static/payment/partner/templates/partner_reset_public_key_dialog.html',
controller: 'clientResetPartnerPublicKeyDialogCtrl',
backdrop: false,
size: 'lg',
resolve: {
gateway_sign: function () {
return $scope.paymentInfo.gateway_sign;
}
}
}).result.then(function () {
commonDialog.alert({title: 'Success!', content: 'Partner Public Key Upload Successfully', type: 'success'})
$scope.loadPartnerPaymentInfo();
})
};
$scope.refreshPlatformPubliKey = function () {
$uibModal.open({
templateUrl: '/static/payment/partner/templates/partner_refresh_platform_public_key_dialog.html',
controller: 'clientRefreshPlatformPublicKeyDialogCtrl',
backdrop: false,
size: 'lg',
resolve: {
gateway_sign: function () {
return $scope.paymentInfo.gateway_sign;
}
}
}).result.then(function () {
commonDialog.alert({title: 'Success!', content: 'RoyalPay Public Key Refresh Successfully', type: 'success'})
$scope.loadPartnerPaymentInfo();
})
};
$scope.resetRefundPwd = function (account) {
$uibModal.open({
templateUrl: '/static/payment/partner/templates/partner_reset_refund_pwd_dialog.html',

@ -127,6 +127,78 @@
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">Gateway Version 2
<div class="pull-right">
Develop Document:
<a href="/docs/cn/" target="_blank">中文</a>|
<a href="/docs/en/" target="_blank">English</a>
</div>
</div>
<div class="panel-body">
<div class="form-horizontal">
<div class="form-group" ng-if="'111'|withRole">
<label class="col-sm-2 control-label">Enable Gateway Version 2</label>
<div class="col-sm-10">
<input type="checkbox" ng-model="paymentInfo.enable_gateway_version2" bs-switch
switch-change="switchGatewayV2()">
</div>
</div>
<div ng-if="paymentInfo.enable_gateway_version2">
<div class="form-group">
<label class="col-sm-2 control-label">RoyalPay Public Key</label>
<div class="col-sm-10" style="margin-top: 8px;">
<a role="button" ng-click="refreshPlatformPubliKey()">
View
</a>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Partner Public Key</label>
<div class="col-sm-10" style="margin-top: 8px;">
<a role="button" ng-click="resetPartnerPubliKey()">
Upload
</a>
</div>
</div>
<div class="form-group" ng-if="'111'|withRole">
<label class="col-sm-2 control-label">Verify IP</label>
<div class="col-sm-10">
<input type="checkbox" ng-model="paymentInfo.gateway_sign.verify_ip" bs-switch
switch-change="switchVerifyIp()">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">IP Whitelist</label>
<div class="col-sm-10">
<p ng-if="!ctrl.editIpWhitelistConfig" class="form-control-static">
{{paymentInfo.gateway_sign.ip_whitelist||'Not Configure'}}
<a role="button" ng-click="ctrl.editIpWhitelistConfig=true" ng-if="'01'|withRole"><i
class="fa fa-edit"></i></a> <span style="font-size:9px;padding-left: 40px">多个IP用逗号隔开</span>
</p>
<div class="input-group" ng-if="ctrl.editIpWhitelistConfig">
<input type="text" class="form-control" ng-model="paymentInfo.gateway_sign.ip_whitelist"
title="Prevent not enough refund">
<div class="input-group-btn">
<button class="btn btn-success"
ng-click="clientSaveIpWhitelistConfig(paymentInfo.gateway_sign.ip_whitelist)">
<i class="fa fa-check"></i>
</button>
</div>
<div class="input-group-btn">
<button class="btn btn-danger" ng-click="ctrl.editIpWhitelistConfig=false">
<i class="fa fa-remove"></i>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="panel panel-default" ng-if="partner.enable_hf&&partner.hf_pay_url">
<div class="panel-heading">HF Pay Link
</div>

@ -0,0 +1,33 @@
<style>
.modal-class {
}
.modal-lg {
width: 40%;
max-width: 400px;
}
</style>
<div class="modal-header">
<h4>RoyalPay Public Key</h4>
</div>
<div class="modal-body" style="height: 400px;">
<form novalidate name="resetForm">
<div class="form-group">
<label class="control-label" style="font-size: 20px;">RoyalPay Public key
</label>
<i class="fa fa-clipboard margin-r-5" style="cursor: pointer;float: right;" ng-click="copyPublicKey()"></i>
<textarea style="height: 250px;margin-top: 15px"
id="c-cpKey" class="form-control" ng-model="gateway_sign.platform_public_key" name="public-key" readonly></textarea>
</div>
<button class="btn btn-warning" type="button" ng-click="refreshPublicKey()" ng-if="'111'|withRole">
<a role="button"
title="refresh">
<i class="fa fa-refresh"></i>
</a>
Refresh RoyalPay Public Key</button>
</form>
</div>
<div class="modal-footer">
<button class="btn btn-danger" type="button" ng-click="$dismiss()">Cancel</button>
</div>

@ -0,0 +1,30 @@
<style>
.modal-class {
}
.modal-lg {
width: 40%;
max-width: 400px;
}
</style>
<div class="modal-header">
<h4>Upload Partner Public Key</h4>
</div>
<div class="modal-body" style="height: 400px;">
<form novalidate name="resetForm">
<div class="form-group">
<label class="control-label" style="font-size: 20px;" for="public-key-input">Upload Public key
*</label>
<textarea style="height: 250px;margin-top: 15px"
id="public-key-input" class="form-control" ng-model="gateway_sign.mch_public_key" name="public-key" required></textarea>
<p class="text-info">
Preserve the middle part and make sure it ends up all on one line
</p>
</div>
</form>
</div>
<div class="modal-footer">
<button class="btn btn-success" type="button" ng-click="uploadPublicKey(gateway_sign.mch_public_key)">Submit</button>
<button class="btn btn-danger" type="button" ng-click="$dismiss()">Cancel</button>
</div>

@ -33,7 +33,7 @@ public class SimpleClientApplyServiceImplTest {
@Test
public void getAndSendSmsCode() {
simpleClientApplyService.getAndSendSmsCode("0451120326","61");
simpleClientApplyService.getAndSendSmsCode("0451120326","61",null);
}
@Test

Loading…
Cancel
Save