Merge branch 'develop'

# Conflicts:
#	pom.xml
master
yangkai 5 years ago
commit 25cf788682

@ -10,7 +10,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>manage</artifactId>
<version>1.1.11</version>
<version>1.1.12</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@ -33,11 +33,11 @@
</dependency>
<dependency>
<groupId>au.com.royalpay.payment</groupId>
<artifactId>hf-core</artifactId>
<artifactId>alipay-core</artifactId>
</dependency>
<dependency>
<groupId>au.com.royalpay.payment</groupId>
<artifactId>alipay-core</artifactId>
<artifactId>hf-core</artifactId>
</dependency>
<dependency>
<groupId>au.com.royalpay.payment</groupId>
@ -55,15 +55,15 @@
<groupId>au.com.royalpay.payment</groupId>
<artifactId>lakala-core</artifactId>
</dependency>
<dependency>
<groupId>au.com.royalpay.payment</groupId>
<artifactId>bestpay-core</artifactId>
</dependency>
<dependency>
<groupId>com.github.stuxuhai</groupId>
<artifactId>jpinyin</artifactId>
<version>1.1.7</version>
</dependency>
<dependency>
<groupId>au.com.royalpay.payment</groupId>
<artifactId>bestpay-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
@ -207,7 +207,7 @@
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>3.3.1</version>
<version>3.2.0</version>
</dependency>
</dependencies>
<build>
@ -276,10 +276,10 @@
<version>${jib-maven-plugin.version}</version>
<configuration>
<from>
<image>hkccr.ccs.tencentyun.com/rpay/serverjre:openj9</image>
<image>hkccr.ccs.tencentyun.com/cross-payment/base:v1.0</image>
</from>
<to>
<image>hkccr.ccs.tencentyun.com/rpay/manage:${docker-image.version}</image>
<image>hkccr.ccs.tencentyun.com/cb-payment/manage:${docker-image.version}</image>
</to>
<extraDirectory>
<path>extra/</path>

@ -31,4 +31,7 @@ public interface SimpleClientApplyService {
JSONObject getBankInfo(String bsb_no);
void checkAccountName(String contact_phone,String nation_code);
void subscribeNewsletter(String mail, String lang);
}

@ -16,7 +16,6 @@ import au.com.royalpay.payment.manage.signin.core.SignInAccountService;
import au.com.royalpay.payment.manage.support.sms.SmsSender;
import au.com.royalpay.payment.manage.system.core.MailGunService;
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import au.com.royalpay.payment.tools.env.RequestEnvironment;
import au.com.royalpay.payment.tools.env.SysConfigManager;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
@ -26,14 +25,12 @@ import au.com.royalpay.payment.tools.locale.LocaleSupport;
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;
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;
@ -91,6 +88,8 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
private PmtSubMerchantIdMapper pmtSubMerchantIdMapper;
@Resource
private ManagerMapper managerMapper;
@Resource
private SysCustomerSubscribeMapper subscribeMapper;
@Resource
private ClientBDMapper clientBDMapper;
@ -247,6 +246,41 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
}
}
@Override
public void subscribeNewsletter(String mail, String lang) {
JSONObject subscribeInfo = subscribeMapper.findByEmail(mail);
Date newDate = new Date();
if (subscribeInfo != null && subscribeInfo.getBoolean("is_valid")) {
throw new BadRequestException("您已订阅成功,请勿重新提交");
}
String imageUrl = lang == null || "zh".equals(lang) ? "royalpay_newsletter_thank_you.png" : "royalpay_newsletter_thank_you_en.png";
Context ctx = new Context();
ctx.setVariable("imageUrl", PlatformEnvironment.getEnv().concatUrl("/static/images/" + imageUrl));
final String content = thymeleaf.process("mail/subscribe_mail.html", ctx);
try {
String emailId = mailService.sendEmail("You have successfully subscribed to Newsletter", mail, "", content);
if (subscribeInfo == null) {
subscribeInfo = new JSONObject();
subscribeInfo.put("approve_email_id", emailId);
subscribeInfo.put("subscribe_email", mail);
subscribeInfo.put("create_time", newDate);
subscribeInfo.put("update_time", newDate);
subscribeMapper.save(subscribeInfo);
return;
}
if (!subscribeInfo.getBoolean("is_valid")) {
subscribeInfo.put("approve_email_id", emailId);
subscribeInfo.put("is_valid", 1);
subscribeInfo.put("update_time", newDate);
subscribeMapper.update(subscribeInfo);
}
} catch (URISyntaxException | IOException e) {
e.printStackTrace();
}
}
@Override
@Transactional
public void saveOrUpdateApplyInfo(JSONObject applyInfo, String username) {

@ -3,6 +3,7 @@ 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.notice.core.MailService;
import au.com.royalpay.payment.tools.env.SysConfigManager;
import com.alibaba.fastjson.JSONObject;
@ -17,9 +18,13 @@ 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 org.thymeleaf.context.Context;
import org.thymeleaf.spring4.SpringTemplateEngine;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.io.IOException;
import java.net.URISyntaxException;
@RestController
@RequestMapping("/register")
@ -90,5 +95,10 @@ public class SimpleClientApplyController {
return JSONObject.parseObject(sysConfig.getString("sys_apply_rates"));
}
@RequestMapping(value = "/send/mail/subscribe", method = RequestMethod.GET)
public void sendSubscribeMail(@RequestParam(value = "mail", required = true) String mail, @RequestParam("lang") String lang) {
simpleClientApplyService.subscribeNewsletter(mail, lang);
}
}

@ -0,0 +1,81 @@
package au.com.royalpay.payment.manage.customers.beans;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.annotation.JSONField;
import org.hibernate.validator.constraints.NotEmpty;
import java.util.Date;
public class CustomerComment {
@NotEmpty(message = "error.payment.valid.param_missing")
@JSONField(name = "first_name")
private String firstName;
@NotEmpty(message = "error.payment.valid.param_missing")
@JSONField(name = "last_name")
private String lastName;
@NotEmpty(message = "error.payment.valid.param_missing")
private String email;
private String comment;
@JSONField(name = "create_time")
private Date createTime;
private int status;
public JSONObject insertObject() {
return (JSONObject) JSON.toJSON(this);
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
}

@ -0,0 +1,8 @@
package au.com.royalpay.payment.manage.customers.core;
import au.com.royalpay.payment.manage.customers.beans.CustomerComment;
public interface CustomerCommentService {
void save(CustomerComment customerComment);
}

@ -0,0 +1,22 @@
package au.com.royalpay.payment.manage.customers.core.impls;
import au.com.royalpay.payment.manage.customers.beans.CustomerComment;
import au.com.royalpay.payment.manage.customers.core.CustomerCommentService;
import au.com.royalpay.payment.manage.mappers.system.SysCustomerCommentMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
@Service
public class CustomerCommentServiceImpl implements CustomerCommentService {
@Resource
private SysCustomerCommentMapper customerCommentMapper;
@Override
public void save(CustomerComment customerComment) {
customerComment.setCreateTime(new Date());
customerCommentMapper.save(customerComment.insertObject());
}
}

@ -0,0 +1,26 @@
package au.com.royalpay.payment.manage.customers.web;
import au.com.royalpay.payment.manage.customers.beans.CustomerComment;
import au.com.royalpay.payment.manage.customers.core.CustomerCommentService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.Valid;
/**
*
*/
@RequestMapping("/customer")
@RestController
public class CustomerCommentController {
@Resource
private CustomerCommentService customerCommentService;
@RequestMapping("/contact/comment")
public void saveCustomerComment(@RequestBody @Valid CustomerComment customerComment) {
customerCommentService.save(customerComment);
}
}

@ -0,0 +1,13 @@
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;
@AutoMapper(tablename = "sys_customer_comment", pkName = "id")
public interface SysCustomerCommentMapper {
@AutoSql(type = SqlType.INSERT)
void save(JSONObject info);
}

@ -0,0 +1,20 @@
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;
@AutoMapper(tablename = "sys_customer_subscribe", pkName = "id")
public interface SysCustomerSubscribeMapper {
@AutoSql(type = SqlType.INSERT)
void save(JSONObject info);
@AutoSql(type = SqlType.SELECT)
JSONObject findByEmail(@Param("subscribe_email") String email);
@AutoSql(type = SqlType.UPDATE)
void update(JSONObject subscribeInfo);
}

@ -45,6 +45,8 @@ public class ClientApplyInfo {
private String industry;
private int source = 0;
private String remark;
@JSONField(name = "aus_mch_category")
private String ausMchCategory;
public JSONObject insertObject() {
@ -251,6 +253,14 @@ public class ClientApplyInfo {
this.industry = industry;
}
public String getAusMchCategory() {
return ausMchCategory;
}
public void setAusMchCategory(String ausMchCategory) {
this.ausMchCategory = ausMchCategory;
}
@Override
public String toString() {
return "ClientApplyInfo{" +

@ -39,6 +39,8 @@ public interface ClientManager {
JSONObject listClients(JSONObject manager, PartnerQuery query);
void exportClients(JSONObject manager,PartnerQuery query,HttpServletResponse resp);
JSONObject listClientsByApp(JSONObject manager, AppMerchantBean query);
List<JSONObject> listPartners(JSONObject manager, PartnerQuery query);

@ -40,6 +40,7 @@ import au.com.royalpay.payment.manage.permission.utils.OrgCheckUtils;
import au.com.royalpay.payment.manage.signin.beans.TodoNotice;
import au.com.royalpay.payment.manage.signin.core.ManagerTodoNoticeProvider;
import au.com.royalpay.payment.manage.signin.core.SignInAccountService;
import au.com.royalpay.payment.manage.support.serverless.ServerlessFunctionTrigger;
import au.com.royalpay.payment.manage.support.sms.SmsSender;
import au.com.royalpay.payment.manage.system.core.ClientContractService;
import au.com.royalpay.payment.manage.system.core.MailGunService;
@ -281,6 +282,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Resource
private CommonSubMerchantIdMapper commonSubMerchantIdMapper;
@Resource
private ServerlessFunctionTrigger serverlessFunctionTrigger;
@Resource
private Locker locker;
@Resource
private MongoTemplate mongoTemplate;
@ -346,27 +349,27 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
String same_phone = clientMapper.findSamePhone(client.getString("contact_phone")).getString("a");
if(same_phone!=null&& client.getString("contact_phone")!= null&&same_phone.contains(" ") ) {
same_phone = same_phone.replace(client.getString("client_moniker"),"");
client.put("same_phone","(雷同商户:"+same_phone+")" );
if (same_phone != null && client.getString("contact_phone") != null && same_phone.contains(" ")) {
same_phone = same_phone.replace(client.getString("client_moniker"), "");
client.put("same_phone", "(雷同商户:" + same_phone + ")");
}
String same_company_name = clientMapper.findSameCompanyName(client.getString("company_name")).getString("a");
if(same_company_name!=null&& client.getString("company_name")!= null&&same_company_name.contains(" ") ) {
same_company_name = same_company_name.replace(client.getString("client_moniker"),"");
client.put("same_company_name","(雷同商户:"+same_company_name+")" );
if (same_company_name != null && client.getString("company_name") != null && same_company_name.contains(" ")) {
same_company_name = same_company_name.replace(client.getString("client_moniker"), "");
client.put("same_company_name", "(雷同商户:" + same_company_name + ")");
}
String same_email = clientMapper.findSameEmail(client.getString("contact_email")).getString("a");
if(same_email!=null&& client.getString("contact_email")!= null&&same_email.contains(" ") ) {
same_email = same_email.replace(client.getString("client_moniker"),"");
client.put("same_email","(雷同商户:"+same_email+")" );
if (same_email != null && client.getString("contact_email") != null && same_email.contains(" ")) {
same_email = same_email.replace(client.getString("client_moniker"), "");
client.put("same_email", "(雷同商户:" + same_email + ")");
}
String same_address = clientMapper.findSameAddress(client.getString("address")).getString("a");
if(same_address!=null&& client.getString("address")!= null&&same_address.contains(" ") ) {
same_address = same_address.replace(client.getString("client_moniker"),"");
client.put("same_address","(雷同商户:"+same_address+")" );
if (same_address != null && client.getString("address") != null && same_address.contains(" ")) {
same_address = same_address.replace(client.getString("client_moniker"), "");
client.put("same_address", "(雷同商户:" + same_address + ")");
}
@ -445,8 +448,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
//商户支付场景
if (StringUtils.isNotBlank(client.getString("client_pay_type"))) {
client.put("client_pay_type",client.getString("client_pay_type").split(","));
client.put("client_pay_desc",client.getString("client_pay_desc").split(","));
client.put("client_pay_type", client.getString("client_pay_type").split(","));
client.put("client_pay_desc", client.getString("client_pay_desc").split(","));
}
if (StringUtils.isNotBlank(client.getString("parent_client_id"))
&& sysClientMapper.childClientId(client.getIntValue("client_id")).size() > 0) {
@ -487,6 +490,39 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Override
public JSONObject listClients(JSONObject manager, PartnerQuery query) {
JSONObject params = prepareListClientsParameter(manager, query);
PageList<JSONObject> partners = clientMapper.listPartners(params,
new PageBounds(query.getPage(), query.getLimit(), Order.formString("is_valid.desc,-approve_time.asc,create_time.desc")));
int authDays = PlatformEnvironment.getEnv().authDays();// 快速自助开通申请有效期
for (JSONObject partner : partners) {
String subMerchantId = partner.getString("sub_merchant_id");
if (subMerchantId != null) {
partner.put("temp_sub_merchant", checkSubMerchantIdInCommonPool(subMerchantId));
}
if (partner.getIntValue("approve_result") == 2) {
partner.put("expiry_time", DateUtils.addDays(partner.getDate("approve_time"), authDays));
partner.put("pass_timeout", DateUtils.addDays(partner.getDate("approve_time"), authDays).compareTo(new Date()) < 0);
}
}
return PageListUtils.buildPageListResult(partners);
}
@Override
public void exportClients(JSONObject manager, PartnerQuery query, HttpServletResponse resp) {
JSONObject params = prepareListClientsParameter(manager, query);
JSONObject retResp = serverlessFunctionTrigger.triggerFunction("export_merchants", params);
String contentB64 = retResp.getString("content");
resp.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
resp.setHeader("Content-Disposition", "attachment; filename=merchants.xlsx");
try (OutputStream out = resp.getOutputStream()) {
IOUtils.write(Base64.decodeBase64(contentB64), out);
out.flush();
} catch (IOException e) {
throw new ServerErrorException(e);
}
}
private JSONObject prepareListClientsParameter(JSONObject manager, PartnerQuery query) {
JSONObject params = query.toJsonParam();
if (params.getString("org_id") != null) {
if (params.getString("org_ids") == null) {
@ -549,20 +585,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
params.put("temp_mch_id", tempSubMchId);
params.put("temp_mch_id_source", tempSubMchSource);
}
PageList<JSONObject> partners = clientMapper.listPartners(params,
new PageBounds(query.getPage(), query.getLimit(), Order.formString("is_valid.desc,-approve_time.asc,create_time.desc")));
int authDays = PlatformEnvironment.getEnv().authDays();// 快速自助开通申请有效期
for (JSONObject partner : partners) {
String subMerchantId = partner.getString("sub_merchant_id");
if (subMerchantId != null) {
partner.put("temp_sub_merchant", checkSubMerchantIdInCommonPool(subMerchantId));
}
if (partner.getIntValue("approve_result") == 2) {
partner.put("expiry_time", DateUtils.addDays(partner.getDate("approve_time"), authDays));
partner.put("pass_timeout", DateUtils.addDays(partner.getDate("approve_time"), authDays).compareTo(new Date()) < 0);
}
}
return PageListUtils.buildPageListResult(partners);
return params;
}
@Override
@ -797,7 +820,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
JSONObject clientConfig = new JSONObject();
clientConfig.put("client_id", clientId);
clientConfig.put("client_moniker", client.getString("client_moniker"));
if (StringUtils.isNotBlank(updateInfo.getString("client_pay_type"))&& StringUtils.isNotBlank(updateInfo.getString("client_pay_desc"))) {
if (StringUtils.isNotBlank(updateInfo.getString("client_pay_type")) && StringUtils.isNotBlank(updateInfo.getString("client_pay_desc"))) {
clientConfig.put("client_pay_type", updateInfo.getString("client_pay_type"));
clientConfig.put("client_pay_desc", updateInfo.getString("client_pay_desc"));
}
@ -3481,7 +3504,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new ForbiddenException("Cashier has no permission to switch retail surcharge");
}
clientModifySupport
.processClientConfigModify(new SwitchPermissionModify(account, client.getString("client_moniker"), "cbbank_surcharge", paySurcharge),true);
.processClientConfigModify(new SwitchPermissionModify(account, client.getString("client_moniker"), "cbbank_surcharge", paySurcharge), true);
}
@Override
@ -5167,6 +5190,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
});
}
private TemplateMessage initSendTestPasswordTemplate(String wxopenid, String templateId) {
TemplateMessage msg = new TemplateMessage(wxopenid, templateId, PlatformEnvironment.getEnv().concatUrl("testMerchantPassword"));
msg.put("first", "系统测试商户账户已重置", "#000000");

@ -43,6 +43,11 @@ public class PartnerManageController {
return clientManager.listClients(manager, query);
}
@ManagerMapping(value = "/exporting_excel", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.FINANCIAL_STAFF})
public void exportClientsExcel(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, PartnerQuery query, HttpServletResponse resp) {
clientManager.exportClients(manager, query, resp);
}
@RequestMapping(value = "/list", method = RequestMethod.GET)
@RequireManager(role = {ManagerRole.ADMIN, ManagerRole.BD_USER, ManagerRole.OPERATOR, ManagerRole.SERVANT, ManagerRole.DIRECTOR})
public List<JSONObject> lisPartners(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, PartnerQuery query) {
@ -94,7 +99,7 @@ public class PartnerManageController {
response.setContentType("application/octet-stream;");
response.addHeader("Content-Disposition", "attachment; filename=qr_board.jpg");
OutputStream ous = response.getOutputStream();
clientManager.writeQrCodeBoard(manager, clientMoniker, config, ous,"PC");
clientManager.writeQrCodeBoard(manager, clientMoniker, config, ous, "PC");
}
@ManagerMapping(value = "/{clientMoniker}/qrcode_board/aggregate", method = RequestMethod.GET)
@ -103,16 +108,16 @@ public class PartnerManageController {
response.setContentType("application/octet-stream;");
response.addHeader("Content-Disposition", "attachment; filename=qr_board.jpg");
OutputStream ous = response.getOutputStream();
clientManager.writeAggregateQrCodeBoard(manager, clientMoniker, config, ous,"PC");
clientManager.writeAggregateQrCodeBoard(manager, clientMoniker, config, ous, "PC");
}
@ManagerMapping(value = "/{clientMoniker}/qrcode_board/CBBankAggregate", method = RequestMethod.GET)
public void getCBBankAggregateQRCodeBoardImage(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,
HttpServletResponse response) throws IOException {
HttpServletResponse response) throws IOException {
response.setContentType("application/octet-stream;");
response.addHeader("Content-Disposition", "attachment; filename=qr_board.jpg");
OutputStream ous = response.getOutputStream();
clientManager.writeCBBankAggregateQrCodeBoard(manager, clientMoniker, ous,"PC");
clientManager.writeCBBankAggregateQrCodeBoard(manager, clientMoniker, ous, "PC");
}
@ManagerMapping(value = "/{clientMoniker}/poster", method = RequestMethod.GET)
@ -141,18 +146,18 @@ public class PartnerManageController {
}
@ManagerMapping(value = "/{clientMoniker}/max_order_amount", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR})
public void setMaxOrderAmount(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String clientMoniker, @RequestBody JSONObject limit) {
clientManager.setMaxOrderAmount(manager,clientMoniker, limit.getBigDecimal("limit"));
public void setMaxOrderAmount(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String clientMoniker, @RequestBody JSONObject limit) {
clientManager.setMaxOrderAmount(manager, clientMoniker, limit.getBigDecimal("limit"));
}
@ManagerMapping(value = "/{clientMoniker}/customer_surcharge_rate", method = RequestMethod.PUT, role = {ManagerRole.ADMIN})
public void setCustomerSurchargeRate(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.setCustomerSurchargeRate(manager,clientMoniker, config.getBigDecimal("customer_surcharge_rate"));
public void setCustomerSurchargeRate(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.setCustomerSurchargeRate(manager, clientMoniker, config.getBigDecimal("customer_surcharge_rate"));
}
@ManagerMapping(value = "/{clientMoniker}/order_expiry_config", method = RequestMethod.PUT, role = {ManagerRole.ADMIN})
public void setOrderExpiryConfig(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.setOrderExpiryConfig(manager,clientMoniker, config.getString("order_expiry_config"));
public void setOrderExpiryConfig(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.setOrderExpiryConfig(manager, clientMoniker, config.getString("order_expiry_config"));
}
@ManagerMapping(value = "/{clientMoniker}", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.BD_USER, ManagerRole.OPERATOR})
@ -207,43 +212,43 @@ public class PartnerManageController {
}
@ManagerMapping(value = "/{clientMoniker}/qrcode_surcharge", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN, ManagerRole.BD_USER, ManagerRole.SERVANT})
public void setClientPaySurCharge(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.setClientQRCodePaySurCharge(manager,clientMoniker, config.getBooleanValue("qrcode_surcharge"));
public void setClientPaySurCharge(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.setClientQRCodePaySurCharge(manager, clientMoniker, config.getBooleanValue("qrcode_surcharge"));
}
@ManagerMapping(value = "/{clientMoniker}/gateway_upgrade", method = RequestMethod.PUT, role = {ManagerRole.DEVELOPER})
public void enableGatewayUpgrade(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.enableGatewayUpgrade(manager,clientMoniker, config.getBooleanValue("gateway_upgrade"));
public void enableGatewayUpgrade(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.enableGatewayUpgrade(manager, clientMoniker, config.getBooleanValue("gateway_upgrade"));
}
@ManagerMapping(value = "/{clientMoniker}/gateway_alipay_online", method = RequestMethod.PUT, role = {ManagerRole.DEVELOPER})
public void enableGatewayAlipayOnline(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.enableGatewayAlipayOnline(manager,clientMoniker, config.getBooleanValue("gateway_alipay_online"));
public void enableGatewayAlipayOnline(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.enableGatewayAlipayOnline(manager, clientMoniker, config.getBooleanValue("gateway_alipay_online"));
}
@ManagerMapping(value = "/{clientMoniker}/api_surcharge", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN, ManagerRole.BD_USER, ManagerRole.SERVANT})
public void setClientApiPaySurCharge(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.setClientApiPaySurCharge(manager,clientMoniker, config.getBooleanValue("api_surcharge"));
public void setClientApiPaySurCharge(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.setClientApiPaySurCharge(manager, clientMoniker, config.getBooleanValue("api_surcharge"));
}
@ManagerMapping(value = "/{clientMoniker}/retail_surcharge", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN, ManagerRole.BD_USER, ManagerRole.SERVANT})
public void setClientRetailPaySurCharge(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.setClientRetailPaySurCharge(manager,clientMoniker, config.getBooleanValue("retail_surcharge"));
public void setClientRetailPaySurCharge(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.setClientRetailPaySurCharge(manager, clientMoniker, config.getBooleanValue("retail_surcharge"));
}
@ManagerMapping(value = "/{clientMoniker}/cbbank_surcharge", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN, ManagerRole.BD_USER})
public void setClientCBBankPaySurCharge(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.setClientCBBankPaySurCharge(manager,clientMoniker, config.getBooleanValue("cbbank_surcharge"));
public void setClientCBBankPaySurCharge(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.setClientCBBankPaySurCharge(manager, clientMoniker, config.getBooleanValue("cbbank_surcharge"));
}
@ManagerMapping(value = "/{clientMoniker}/tax_in_surcharge", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN})
public void setClientTaxPayer(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.setClientTaxInSurcharge(manager,clientMoniker, config.getBooleanValue("tax_in_surcharge"));
public void setClientTaxPayer(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.setClientTaxInSurcharge(manager, clientMoniker, config.getBooleanValue("tax_in_surcharge"));
}
@ManagerMapping(value = "/{clientMoniker}/customer_tax_free", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR})
public void setClientCustomerTaxFree(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.setClientCustomerTaxFree(manager,clientMoniker, config.getBooleanValue("customer_tax_free"));
public void setClientCustomerTaxFree(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.setClientCustomerTaxFree(manager, clientMoniker, config.getBooleanValue("customer_tax_free"));
}
@ManagerMapping(value = "/{clientMoniker}/credential_code", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.BD_USER})
@ -283,6 +288,7 @@ public class PartnerManageController {
/**
*
*
* @param clientMoniker
* @param pass
* @param manager
@ -294,7 +300,7 @@ public class PartnerManageController {
@ManagerMapping(value = "/{clientMoniker}/child_each_refund", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR})
public void switchChildEachRefund(@PathVariable String clientMoniker, @RequestBody JSONObject pass, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.switchChildEachRefund(manager, clientMoniker, pass.getBooleanValue("allow"));
clientManager.switchChildEachRefund(manager, clientMoniker, pass.getBooleanValue("allow"));
}
@ManagerMapping(value = "/{clientMoniker}/channels/{channel}/permission", method = RequestMethod.PUT, role = {ManagerRole.SERVANT, ManagerRole.DEVELOPER})
@ -328,7 +334,7 @@ public class PartnerManageController {
}
@ManagerMapping(value = "/{clientMoniker}/reset/refund_pwd", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN, ManagerRole.DEVELOPER})
public void changeRefundPwd(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@RequestBody JSONObject config) {
public void changeRefundPwd(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @RequestBody JSONObject config) {
clientManager.resetRefundPasswordByManage(clientMoniker, manager, config);
}
@ -363,7 +369,7 @@ public class PartnerManageController {
return tradeLogService.listOrderRefunds(orderId, null);
}
@ManagerMapping(value = "/{clientMoniker}/accounts", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.BD_USER, ManagerRole.OPERATOR, ManagerRole.SERVANT, ManagerRole.DIRECTOR,ManagerRole.DEVELOPER})
@ManagerMapping(value = "/{clientMoniker}/accounts", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.BD_USER, ManagerRole.OPERATOR, ManagerRole.SERVANT, ManagerRole.DIRECTOR, ManagerRole.DEVELOPER})
public List<JSONObject> partnerAccounts(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return clientManager.listAccounts(manager, clientMoniker);
}
@ -411,8 +417,8 @@ public class PartnerManageController {
}
@ManagerMapping(value = "/{clientMoniker}/skip_clearing", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.FINANCIAL_STAFF})
public void skipClearing(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String clientMoniker, @RequestBody JSONObject skip_clearing) {
clientManager.setSkipClearing(manager,clientMoniker, skip_clearing.getBooleanValue("skip_clearing"),skip_clearing.getString("remark"));
public void skipClearing(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String clientMoniker, @RequestBody JSONObject skip_clearing) {
clientManager.setSkipClearing(manager, clientMoniker, skip_clearing.getBooleanValue("skip_clearing"), skip_clearing.getString("remark"));
}
@ManagerMapping(value = "/{clientMoniker}/surcharge_mode", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR})
@ -501,7 +507,7 @@ public class PartnerManageController {
@RequestParam(required = false) String[] client_ids,
@RequestParam(defaultValue = "1") int page, @RequestParam(defaultValue = "10") int limit,
@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return clientManager.listClientDevices(manager, clientMoniker, remark, page, limit,client_type,client_ids);
return clientManager.listClientDevices(manager, clientMoniker, remark, page, limit, client_type, client_ids);
}
//给商户新增设备
@ -567,7 +573,7 @@ public class PartnerManageController {
@ManagerMapping(value = "/{clientMoniker}/export/aggregate/agreepdf", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.DIRECTOR, ManagerRole.OPERATOR})
public void exportAggregateAgreeFile(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) throws Exception {
clientManager.getAggregateAgreeFile(clientMoniker, manager,false);
clientManager.getAggregateAgreeFile(clientMoniker, manager, false);
}
@ManagerMapping(value = "/{clientMoniker}/temp/export/pdf", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.BD_USER, ManagerRole.DIRECTOR, ManagerRole.OPERATOR})
@ -577,7 +583,7 @@ public class PartnerManageController {
@ManagerMapping(value = "/{clientMoniker}/import/agreepdf", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.DIRECTOR, ManagerRole.OPERATOR})
public void importAgreeFile(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @RequestBody JSONObject source) throws Exception {
clientManager.importAgreeFile(clientMoniker, manager, source.getString("source_agree_file"),false);
clientManager.importAgreeFile(clientMoniker, manager, source.getString("source_agree_file"), false);
}
@ManagerMapping(value = "/{clientMoniker}/notify/completeAgree", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR})
@ -628,19 +634,19 @@ public class PartnerManageController {
merchantLocationService.updateMerchantLocation(manager, clientMoniker, geoData);
}
@ManagerMapping(value = "/{clientMoniker}/wechat_compliance_permission",method = RequestMethod.PUT,role = {ManagerRole.OPERATOR,ManagerRole.ADMIN})
@ManagerMapping(value = "/{clientMoniker}/wechat_compliance_permission", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN})
public void wechatCcompliancePermission(@PathVariable String clientMoniker, @RequestBody JSONObject pass, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.switchPermission(manager, clientMoniker, "wechat_compliance", pass.getBooleanValue("allow"));
}
@ManagerMapping(value = "/{clientMoniker}/local_merchant_permission",method = RequestMethod.PUT,role = {ManagerRole.OPERATOR,ManagerRole.ADMIN})
@ManagerMapping(value = "/{clientMoniker}/local_merchant_permission", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN})
public void localMerchantPermission(@PathVariable String clientMoniker, @RequestBody JSONObject pass, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.switchPermission(manager, clientMoniker, "local_merchant", pass.getBooleanValue("allow"));
}
@ManagerMapping(value = "/{clientMoniker}/list_sub_applices",method = RequestMethod.GET,role = {ManagerRole.OPERATOR,ManagerRole.ADMIN})
@ManagerMapping(value = "/{clientMoniker}/list_sub_applices", method = RequestMethod.GET, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN})
public List<JSONObject> listSubMerchantIdApplys(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return clientManager.listSubMerchantIdApplys(manager,clientMoniker);
return clientManager.listSubMerchantIdApplys(manager, clientMoniker);
}
@ManagerMapping(value = "/{clientMoniker}/list_rpay_sub_applices", method = RequestMethod.GET, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN})
@ -655,56 +661,57 @@ public class PartnerManageController {
@ManagerMapping(value = "/{clientMoniker}/sub_apply", method = RequestMethod.POST, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN})
public String subMerchantApplication(@PathVariable String clientMoniker, @RequestBody SubMerchantIdApply subMerchantIdApply, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return clientManager.subMerchantApplication(clientMoniker,subMerchantIdApply,manager);
return clientManager.subMerchantApplication(clientMoniker, subMerchantIdApply, manager);
}
@ManagerMapping(value = "/{clientMoniker}/register/alipay_gms", method = RequestMethod.POST, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN})
public void registerAlipayGms(@PathVariable String clientMoniker,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
public void registerAlipayGms(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.registerAlipayGms(clientMoniker, manager);
}
@ManagerMapping(value = "/{clientMoniker}/query/alipay_gms", method = RequestMethod.GET, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN})
public String queryAlipayGmsStatus(@PathVariable String clientMoniker,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
public String queryAlipayGmsStatus(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return clientManager.queryAlipayGmsStatus(clientMoniker, manager);
}
@ManagerMapping(value = "/{clientMoniker}/register/alipayOnline_gms", method = RequestMethod.POST, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN})
public void registerAlipayOnlineGms(@PathVariable String clientMoniker,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
public void registerAlipayOnlineGms(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.registerAlipayOnlineGms(clientMoniker, manager);
}
@ManagerMapping(value = "/{clientMoniker}/query/alipayOnline_gms", method = RequestMethod.GET, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN})
public String queryAlipayOnlineGmsStatus(@PathVariable String clientMoniker,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
public String queryAlipayOnlineGmsStatus(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return clientManager.queryAlipayOnlineGmsStatus(clientMoniker, manager);
}
@ManagerMapping(value = "/{clientMoniker}/query/alipay_gms_json", method = RequestMethod.GET, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN})
public JSONObject queryAlipayGmsJson(@PathVariable String clientMoniker,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
public JSONObject queryAlipayGmsJson(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return clientManager.queryAlipayGmsJson(clientMoniker, manager);
}
@ManagerMapping(value = "/{clientMoniker}/query/alipayOnline_gms_json", method = RequestMethod.GET, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN})
public JSONObject queryAlipayOnlineGmsJson(@PathVariable String clientMoniker,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
public JSONObject queryAlipayOnlineGmsJson(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return clientManager.queryAlipayOnlineGmsJson(clientMoniker, manager);
}
@ManagerMapping(value = "/{clientMoniker}/get_merchant_ids",method = RequestMethod.GET,role = {ManagerRole.OPERATOR,ManagerRole.ADMIN})
@ManagerMapping(value = "/{clientMoniker}/get_merchant_ids", method = RequestMethod.GET, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN})
public List<JSONObject> getMerchantIds(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return clientManager.listMerchantIds(clientMoniker,manager);
return clientManager.listMerchantIds(clientMoniker, manager);
}
@ManagerMapping(value = "/{clientMoniker}/get_sub_merchant_id_logs",method = RequestMethod.GET,role = {ManagerRole.OPERATOR})
@ManagerMapping(value = "/{clientMoniker}/get_sub_merchant_id_logs", method = RequestMethod.GET, role = {ManagerRole.OPERATOR})
public List<JSONObject> getClientSubMerchantIdLogs(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return clientManager.getClientSubMerchantIdLogs(clientMoniker,manager);
return clientManager.getClientSubMerchantIdLogs(clientMoniker, manager);
}
@ManagerMapping(value = "/unsub/{clientMoniker}",method = RequestMethod.PUT,role = {ManagerRole.OPERATOR})
@ManagerMapping(value = "/unsub/{clientMoniker}", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR})
public void addSub(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.addSub(clientMoniker,manager);
clientManager.addSub(clientMoniker, manager);
}
@ManagerMapping(value = "/unsub/{clientMoniker}",method = RequestMethod.DELETE,role = {ManagerRole.OPERATOR})
@ManagerMapping(value = "/unsub/{clientMoniker}", method = RequestMethod.DELETE, role = {ManagerRole.OPERATOR})
public void removeSub(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.removeSub(clientMoniker,manager);
clientManager.removeSub(clientMoniker, manager);
}
@ManagerMapping(value = "/{clientMoniker}/hf", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR})
@ -718,32 +725,32 @@ public class PartnerManageController {
}
@ManagerMapping(value = "/{clientMoniker}/{channel}", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR})
public void switchGateWayLinkPermission(@PathVariable String clientMoniker, @PathVariable String channel,@RequestBody JSONObject pass, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.switchGatewayLink(manager, clientMoniker, channel,pass.getBooleanValue("allow"));
public void switchGateWayLinkPermission(@PathVariable String clientMoniker, @PathVariable String channel, @RequestBody JSONObject pass, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.switchGatewayLink(manager, clientMoniker, channel, pass.getBooleanValue("allow"));
}
@ManagerMapping(value = "/{clientMoniker}/{channel}/email_notice", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.BD_USER})
public void switchGatewayEmailNotice(@PathVariable String clientMoniker, @PathVariable String channel,@RequestBody JSONObject pass, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.switchPermission(manager, clientMoniker,"enable_"+channel+"_email_notice", pass.getBooleanValue("allow"));
public void switchGatewayEmailNotice(@PathVariable String clientMoniker, @PathVariable String channel, @RequestBody JSONObject pass, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.switchPermission(manager, clientMoniker, "enable_" + channel + "_email_notice", pass.getBooleanValue("allow"));
}
@ManagerMapping(value = "/{clientMoniker}/registRpaySubMerchantId", method = RequestMethod.POST, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN})
public void subRpayMerchantApplication(@PathVariable String clientMoniker,@RequestBody JSONObject merchantInfo,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.subRpayMerchantApplication(clientMoniker, merchantInfo,manager);
public void subRpayMerchantApplication(@PathVariable String clientMoniker, @RequestBody JSONObject merchantInfo, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.subRpayMerchantApplication(clientMoniker, merchantInfo, manager);
}
@ManagerMapping(value = "/{clientMoniker}/registYeepaySubMerchantId", method = RequestMethod.POST, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN})
public void subYeepayMerchantApplication(@PathVariable String clientMoniker,@RequestBody JSONObject merchantInfo,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.subYeepayMerchantApplication(clientMoniker, merchantInfo,manager);
public void subYeepayMerchantApplication(@PathVariable String clientMoniker, @RequestBody JSONObject merchantInfo, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.subYeepayMerchantApplication(clientMoniker, merchantInfo, manager);
}
@ManagerMapping(value = "/{clientMoniker}/updateYeepaySubMerchantId", method = RequestMethod.POST, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN})
public void reSubYeepayMerchantApplication(@PathVariable String clientMoniker,@RequestBody JSONObject merchantInfo,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.reSubYeepayMerchantApplication(clientMoniker, merchantInfo,manager);
public void reSubYeepayMerchantApplication(@PathVariable String clientMoniker, @RequestBody JSONObject merchantInfo, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.reSubYeepayMerchantApplication(clientMoniker, merchantInfo, manager);
}
@RequestMapping(value = "/compliance", method = RequestMethod.GET)
@RequireManager(role = { ManagerRole.OPERATOR})
@RequireManager(role = {ManagerRole.OPERATOR})
public JSONObject lisPartnersByCompliance(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, PartnerQuery query) {
return clientManager.comListPartnerSelection(manager, query);
}
@ -765,8 +772,8 @@ public class PartnerManageController {
}
@ManagerMapping(value = "/{clientMoniker}/addYeepaySubMerchantId", method = RequestMethod.POST, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN})
public void subYeepayMerchantAdd(@PathVariable String clientMoniker,@RequestBody JSONObject merchantInfo,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.subYeepayMerchantAdd(clientMoniker, merchantInfo,manager);
public void subYeepayMerchantAdd(@PathVariable String clientMoniker, @RequestBody JSONObject merchantInfo, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.subYeepayMerchantAdd(clientMoniker, merchantInfo, manager);
}
@RequestMapping(value = "/{clientMoniker}/cb_bankpay/link/pc", method = RequestMethod.GET)
@ -777,11 +784,12 @@ public class PartnerManageController {
/**
*
*
* @param clientMoniker
* @param channelKey
* @throws IOException
*/
@ManagerMapping(value = "/{clientMoniker}/cb_bankpay/{channelKey}/channel_id", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR})
@ManagerMapping(value = "/{clientMoniker}/cb_bankpay/{channelKey}/channel_id", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR})
public void switchPartnerCBChannelConfig(@PathVariable String clientMoniker, @PathVariable String channelKey, @RequestBody JSONObject channel) {
clientManager.partnerCBChannelConfig(clientMoniker, channelKey, channel.getString("channel_id"));
}

@ -0,0 +1,11 @@
package au.com.royalpay.payment.manage.support.serverless;
import com.alibaba.fastjson.JSONObject;
/**
* Create by davep at 2019-08-08 15:56
*/
public interface ServerlessFunctionTrigger {
JSONObject triggerFunction(String function,JSONObject params);
}

@ -0,0 +1,63 @@
package au.com.royalpay.payment.manage.support.serverless.qcloud;
import au.com.royalpay.payment.manage.support.serverless.ServerlessFunctionTrigger;
import au.com.royalpay.payment.manage.support.serverless.qcloud.support.ServerLessFunctionInvokeRequest;
import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.http.ResponseEntity;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import java.nio.charset.StandardCharsets;
/**
* Create by davep at 2019-08-12 9:31
*/
@Service
public class QCloudServerlessTrigger implements ServerlessFunctionTrigger {
private Logger logger = LoggerFactory.getLogger(getClass());
private RestTemplate restTemplate;
private String secretId;
private String secretKey;
private String region;
public QCloudServerlessTrigger(@Value("${qcloud.secret-id}") String secretId,
@Value("${qcloud.secret-key}") String secretKey,
@Value("${qcloud.scf.region}") String region) {
this.secretId = secretId;
this.secretKey = secretKey;
this.region = region;
this.restTemplate = new RestTemplateBuilder()
.messageConverters(new StringHttpMessageConverter(StandardCharsets.UTF_8))
.build();
}
@Override
public JSONObject triggerFunction(String function, JSONObject params) {
ServerLessFunctionInvokeRequest request = new ServerLessFunctionInvokeRequest(secretId, secretKey, region, function, params);
ResponseEntity<String> resp = restTemplate.exchange(request.request(), String.class);
JSONObject data = JSON.parseObject(resp.getBody());
JSONObject response = data.getJSONObject("Response");
String requestId = response.getString("RequestId");
JSONObject result = response.getJSONObject("Result");
int invokeResult = result.getIntValue("InvokeResult");
if (invokeResult != 0) {
String errMsg = result.getString("ErrMsg");
logger.error("Invoking function [{}] failed,request id={},invoke result={},errMsg={}", function, requestId, invokeResult, errMsg);
throw new ServerErrorException("Invoke function " + function + " failed:[" + errMsg + "]");
} else {
String retMsg = result.getString("RetMsg");
return StringUtils.isNotEmpty(retMsg) ? JSON.parseObject(retMsg) : null;
}
}
}

@ -0,0 +1,135 @@
package au.com.royalpay.payment.manage.support.serverless.qcloud.support;
import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
import org.apache.commons.codec.binary.Hex;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpMethod;
import org.springframework.http.RequestEntity;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.util.UriComponentsBuilder;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* Create by davep at 2019-08-12 15:06
*/
public abstract class QCloudV3Request {
private static Logger logger = LoggerFactory.getLogger(QCloudV3Request.class);
private static final String ALGORITHM = "TC3-HMAC-SHA256";
private String secretId;
private String secretKey;
private String region;
private MultiValueMap<String, String> headers = new LinkedMultiValueMap<>();
public QCloudV3Request(String secretId, String secretKey, String region) {
this.secretId = secretId;
this.secretKey = secretKey;
this.region = region;
headers.add("host", host());
headers.add("content-type", contentType());
}
protected abstract String host();
protected abstract String uri();
protected abstract HttpMethod method();
protected abstract String action();
protected abstract String version();
protected abstract String contentType();
protected abstract String requestPayload();
protected abstract String queryStringParams();
protected String service() {
return StringUtils.substringBefore(host(), ".");
}
public void setHeader(String name, String value) {
headers.add(name, value);
}
public RequestEntity<String> request() {
UriComponentsBuilder uriBuilder = UriComponentsBuilder.fromHttpUrl("https://" + host() + uri());
String queryStr = queryStringParams();
if (StringUtils.isNotEmpty(queryStr)) {
uriBuilder = uriBuilder.query(queryStr);
}
URI url = uriBuilder.build(false).toUri();
RequestEntity.BodyBuilder builder = RequestEntity.method(method(), url);
MultiValueMap<String, String> signHeaders = buildSignature();
for (Map.Entry<String, List<String>> entry : signHeaders.entrySet()) {
builder = builder.header(entry.getKey(), entry.getValue().toArray(new String[0]));
}
return builder.body(requestPayload());
}
private MultiValueMap<String, String> buildSignature() {
String timestamp = System.currentTimeMillis() / 1000 + "";
String date = DateTime.now(DateTimeZone.UTC).toString("yyyy-MM-dd");
// ************* 步骤 1拼接规范请求串 *************
String httpRequestMethod = method().name();
String canonicalUri = uri();
String canonicalQueryString = queryStringParams();
String canonicalHeaders = headers.entrySet().stream()
.flatMap(nameEntry -> nameEntry.getValue().stream()
.map(v -> nameEntry.getKey().toLowerCase() + ":" + v + "\n"))
.sorted()
.collect(Collectors.joining());
String signedHeaders = headers.keySet().stream().map(String::toLowerCase).sorted().collect(Collectors.joining(";"));
String hashedRequestPayload = DigestUtils.sha256Hex(requestPayload());
String canonicalRequest = String.join("\n", httpRequestMethod, canonicalUri, canonicalQueryString, canonicalHeaders, signedHeaders, hashedRequestPayload);
logger.info("request:\n{}", canonicalRequest);
// ************* 步骤 2拼接待签名字符串 *************
String credentialScope = date + "/" + service() + "/tc3_request";
String hashedCanonicalRequest = DigestUtils.sha256Hex(canonicalRequest.getBytes(StandardCharsets.UTF_8));
String stringToSign = String.join("\n", ALGORITHM, timestamp, credentialScope, hashedCanonicalRequest);
logger.info("to sign:\n{}", stringToSign);
// ************* 步骤 3计算签名 *************
byte[] secretDate = sign256(("TC3" + secretKey).getBytes(StandardCharsets.UTF_8), date);
byte[] secretService = sign256(secretDate, service());
byte[] secretSigning = sign256(secretService, "tc3_request");
String signature = Hex.encodeHexString(sign256(secretSigning, stringToSign)).toLowerCase();
String authorization = String.format("%s Credential=%s/%s, SignedHeaders=%s, Signature=%s",
ALGORITHM, secretId, credentialScope, signedHeaders, signature);
MultiValueMap<String, String> signHeaders = new LinkedMultiValueMap<>(headers);
signHeaders.set("Authorization", authorization);
signHeaders.set("X-TC-Action", action());
signHeaders.set("X-TC-Timestamp", timestamp);
signHeaders.set("X-TC-Version", version());
signHeaders.set("X-TC-Region", region);
return signHeaders;
}
private static byte[] sign256(byte[] key, String msg) {
try {
Mac mac = Mac.getInstance("HmacSHA256");
SecretKeySpec secretKeySpec = new SecretKeySpec(key, mac.getAlgorithm());
mac.init(secretKeySpec);
return mac.doFinal(msg.getBytes(StandardCharsets.UTF_8));
} catch (NoSuchAlgorithmException | InvalidKeyException e) {
logger.error(e.getMessage(), e);
throw new ServerErrorException(e);
}
}
}

@ -0,0 +1,62 @@
package au.com.royalpay.payment.manage.support.serverless.qcloud.support;
import com.alibaba.fastjson.JSONObject;
import org.springframework.http.HttpMethod;
import org.springframework.util.MimeTypeUtils;
/**
* Create by davep at 2019-08-12 17:13
*/
public class ServerLessFunctionInvokeRequest extends QCloudV3Request {
private final String functionName;
private final JSONObject clientContext;
public ServerLessFunctionInvokeRequest(String secretId, String secretKey, String region, String functionName, JSONObject clientContext) {
super(secretId, secretKey, region);
this.functionName = functionName;
this.clientContext = clientContext == null ? new JSONObject() : clientContext;
}
@Override
protected String host() {
return "scf.tencentcloudapi.com";
}
@Override
protected String uri() {
return "/";
}
@Override
protected HttpMethod method() {
return HttpMethod.POST;
}
@Override
protected String action() {
return "Invoke";
}
@Override
protected String version() {
return "2018-04-16";
}
@Override
protected String contentType() {
return MimeTypeUtils.APPLICATION_JSON_VALUE;
}
@Override
protected String requestPayload() {
JSONObject data = new JSONObject();
data.put("FunctionName", functionName);
data.put("ClientContext", clientContext.toJSONString());
return data.toJSONString();
}
@Override
protected String queryStringParams() {
return "";
}
}

@ -144,3 +144,6 @@ app.hanyin-secure.sftp-port=28480
app.hanyin-secure.sftp-username=royalpay
app.hanyin-secure.sftp-pwd=royalpay
qcloud.secret-id=AKIDlHdjgWzZliPvBauZFfrnW0MaZOyHdTPz
qcloud.secret-key=YswoQDsIZfWEqEAEvMXS8Yic84lFn9Jp
qcloud.scf.region=ap-hongkong

@ -0,0 +1,7 @@
<html xmlns:th="http://www.thymeleaf.org" lang="zh">
<body>
<div style="text-align: center">
<img style="width: 50%" th:src="${imageUrl}" />
</div>
</body>
</html>

@ -71,6 +71,18 @@ define(['../app', 'jquery'], function (app, $) {
}
});
var ausMchCategory = [];
$.ajax({
url: '/static/data/aus_mch_category.json',
method: 'GET',
async: false,
dataType: 'json',
success: function (data) {
ausMchCategory = data;
}
});
app.filter('partner_state', ['stateMap', function (stateMap) {
return function (stateValue) {
var stateLabel = '';
@ -247,4 +259,21 @@ define(['../app', 'jquery'], function (app, $) {
return sectorLabel;
}
}]);
app.filter('aus_mch_category', ['$http', function ($http) {
return function (industryCode) {
var categoryLabel = '';
var industryLabel = '';
angular.forEach(ausMchCategory, function (category) {
angular.forEach(category.children, function (categoryChildren1) {
if (categoryChildren1.mccCode == industryCode) {
industryLabel = categoryChildren1.label;
categoryLabel = category.label;
}
});
});
return { categoryLabel:categoryLabel, industryLabel: industryLabel };
}
}]);
});

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 348 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 KiB

@ -175,6 +175,21 @@
<p class="form-control-static" ng-bind="partner.country"></p>
</div>
</div>
<div class="form-group col-sm-6">
<label class="control-label col-sm-4">Business category</label>
<div class="col-sm-8">
<p class="form-control-static" ng-bind="(partner.aus_mch_category |aus_mch_category).categoryLabel"></p>
</div>
</div>
<div class="form-group col-sm-6">
<label class="control-label col-sm-4">Business industry</label>
<div class="col-sm-8">
<p class="form-control-static" ng-bind="(partner.aus_mch_category |aus_mch_category).industryLabel"></p>
</div>
</div>
</div>
</div>
</div>
@ -238,4 +253,4 @@
</div>
</div>
</div>
</div>

@ -0,0 +1,81 @@
package au.com.royalpay.payment.manage.valid;
import au.com.royalpay.payment.manage.support.serverless.qcloud.support.ServerLessFunctionInvokeRequest;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.RandomUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.net.util.Base64;
import org.junit.Test;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.http.ResponseEntity;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponentsBuilder;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.nio.charset.StandardCharsets;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Create by davep at 2019-08-08 16:21
*/
public class QCloudSignTest {
private String function = "export_merchants";
private String region = "ap-hongkong";
private String secretId = "AKIDlHdjgWzZliPvBauZFfrnW0MaZOyHdTPz";
private String secretKey = "YswoQDsIZfWEqEAEvMXS8Yic84lFn9Jp";
@Test
public void printUrl() throws NoSuchAlgorithmException, InvalidKeyException {
String host = "scf.tencentcloudapi.com/";
String method = "GET";
Map<String, String> paramsMap = new HashMap<>();
paramsMap.put("Action", "Invoke");
paramsMap.put("Version", "2018-04-16");
paramsMap.put("Region", region);
paramsMap.put("FunctionName", function);
paramsMap.put("ClientContext", "{\"client_moniker\":\"PINE\"}");
paramsMap.put("Nonce", "" + RandomUtils.nextInt(0, 999999));
paramsMap.put("Timestamp", "" + System.currentTimeMillis() / 1000);
paramsMap.put("SignatureMethod", "HmacSHA256");
paramsMap.put("SecretId", secretId);
String[] params = paramsMap.entrySet().stream().map(entry -> entry.getKey() + "=" + entry.getValue()).toArray(String[]::new);
Arrays.sort(params);
String base = method + host + "?" + StringUtils.join(params, "&");
String key = secretKey;
Mac sha256HMAC = Mac.getInstance("HmacSHA256");
SecretKeySpec secretKey = new SecretKeySpec(key.getBytes(), "HmacSHA256");
sha256HMAC.init(secretKey);
byte[] finalBytes = sha256HMAC.doFinal(base.getBytes());
String sign = Base64.encodeBase64String(finalBytes);
paramsMap.put("Signature", sign);
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl("https://" + host);
for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
builder.queryParam(entry.getKey(), entry.getValue());
}
System.out.println(builder.build(false).encode().toUriString());
}
@Test
public void v3Test() {
RestTemplate restTemplate = new RestTemplateBuilder()
.messageConverters(new StringHttpMessageConverter(StandardCharsets.UTF_8))
.build();
JSONObject params = new JSONObject();
params.put("client_moniker", "PINE");
ServerLessFunctionInvokeRequest request = new ServerLessFunctionInvokeRequest(secretId, secretKey, region, function, params);
ResponseEntity<String> resp = restTemplate.exchange(request.request(), String.class);
System.out.println(resp.getBody());
}
}
Loading…
Cancel
Save