match 2.2.27

master
yixian 4 years ago
parent 4ae564bae5
commit 2d953d2dca

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>au.com.royalpay.payment</groupId> <groupId>au.com.royalpay.payment</groupId>
<artifactId>payment-parent</artifactId> <artifactId>payment-parent</artifactId>
<version>2.2.26</version> <version>2.2.27</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>manage</artifactId> <artifactId>manage</artifactId>

@ -19,6 +19,7 @@ import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.connections.attachment.core.AttachmentClient; import au.com.royalpay.payment.tools.connections.attachment.core.AttachmentClient;
import au.com.royalpay.payment.tools.env.SysConfigManager; import au.com.royalpay.payment.tools.env.SysConfigManager;
import au.com.royalpay.payment.tools.exceptions.NotFoundException; import au.com.royalpay.payment.tools.exceptions.NotFoundException;
import au.com.royalpay.payment.tools.utils.Currency;
import au.com.royalpay.payment.tools.utils.PageListUtils; import au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.Order;
@ -81,12 +82,12 @@ public class OneDollarDayActivitySupportImpl implements OneDollarDayActivity, Pa
JSONObject dietOrderInfo = new JSONObject(); JSONObject dietOrderInfo = new JSONObject();
dietOrderInfo.put("order_id", orderId); dietOrderInfo.put("order_id", orderId);
dietOrderInfo.put("client_id", paymentInfo.getClientId()); dietOrderInfo.put("client_id", paymentInfo.getClientId());
String currency = paymentInfo.getCurrency(); Currency currency = paymentInfo.getCurrency();
dietOrderInfo.put("order_currency", currency); dietOrderInfo.put("order_currency", currency);
BigDecimal totalFee = paymentInfo.getTotalFee(); BigDecimal totalFee = paymentInfo.getTotalFee();
BigDecimal payAmount = totalFee.divide(CommonConsts.HUNDRED, 2, RoundingMode.DOWN); BigDecimal payAmount = totalFee.divide(CommonConsts.HUNDRED, 2, RoundingMode.DOWN);
BigDecimal payLocalCurrency = paymentInfo.getDisplayAmount().divide(CommonConsts.HUNDRED, 2, RoundingMode.DOWN); BigDecimal payLocalCurrency = paymentInfo.getDisplayAmount().divide(CommonConsts.HUNDRED, 2, RoundingMode.DOWN);
if (!"AUD".equals(currency)) { if (currency != Currency.AUD) {
BigDecimal exchange = mpPaymentApi.queryExchangeRateDecimal(clientId); BigDecimal exchange = mpPaymentApi.queryExchangeRateDecimal(clientId);
payLocalCurrency = payLocalCurrency.divide(exchange, 2, RoundingMode.DOWN); payLocalCurrency = payLocalCurrency.divide(exchange, 2, RoundingMode.DOWN);
} }
@ -95,7 +96,7 @@ public class OneDollarDayActivitySupportImpl implements OneDollarDayActivity, Pa
} }
BigDecimal discount; BigDecimal discount;
dietOrderInfo.put("order_amount", totalFee.divide(CommonConsts.HUNDRED, 2, RoundingMode.DOWN)); dietOrderInfo.put("order_amount", totalFee.divide(CommonConsts.HUNDRED, 2, RoundingMode.DOWN));
if (!"AUD".equals(currency)) { if (currency != Currency.AUD) {
BigDecimal exchange = mpPaymentApi.queryExchangeRateDecimal(clientId); BigDecimal exchange = mpPaymentApi.queryExchangeRateDecimal(clientId);
discount = DISCOUNT_AMOUNT.multiply(exchange).setScale(2, RoundingMode.DOWN); discount = DISCOUNT_AMOUNT.multiply(exchange).setScale(2, RoundingMode.DOWN);
} else { } else {

@ -79,7 +79,7 @@ public class PartnerCardDashboardServiceImp implements PartnerCardDashboardServi
@Override @Override
public JSONObject getTransactionAnalysis(String clientMoniker) { public JSONObject getTransactionAnalysis(String clientMoniker) {
JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker); JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker);
Assert.notNull(client); Assert.notNull(client, "client not found");
JSONObject params = new JSONObject(); JSONObject params = new JSONObject();
params.put("client_id", client.getIntValue("client_id")); params.put("client_id", client.getIntValue("client_id"));
return transactionAnalysisMapper.getTransactionCommonAnalysis(params); return transactionAnalysisMapper.getTransactionCommonAnalysis(params);
@ -88,7 +88,7 @@ public class PartnerCardDashboardServiceImp implements PartnerCardDashboardServi
@Override @Override
public List<JSONObject> getOrderCustomerChartAnalysis(String clientMoniker) { public List<JSONObject> getOrderCustomerChartAnalysis(String clientMoniker) {
JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker); JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker);
Assert.notNull(client); Assert.notNull(client, "client not found");
JSONObject params = new JSONObject(); JSONObject params = new JSONObject();
params.put("client_id", client.getIntValue("client_id")); params.put("client_id", client.getIntValue("client_id"));
return customerAndOrdersStatisticsMapper.getPartnerCustomerAndOrderStatistics(params); return customerAndOrdersStatisticsMapper.getPartnerCustomerAndOrderStatistics(params);
@ -97,7 +97,7 @@ public class PartnerCardDashboardServiceImp implements PartnerCardDashboardServi
@Override @Override
public List<JSONObject> getTransTypesAnalysis(String clientMoniker) { public List<JSONObject> getTransTypesAnalysis(String clientMoniker) {
JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker); JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker);
Assert.notNull(client); Assert.notNull(client, "client not found");
JSONObject params = new JSONObject(); JSONObject params = new JSONObject();
params.put("client_id", client.getIntValue("client_id")); params.put("client_id", client.getIntValue("client_id"));
return dashboardService.getTradeInTypes(params); return dashboardService.getTradeInTypes(params);
@ -106,7 +106,7 @@ public class PartnerCardDashboardServiceImp implements PartnerCardDashboardServi
@Override @Override
public JSONObject getOrderAndCustomerPerDay(String clientMoniker) { public JSONObject getOrderAndCustomerPerDay(String clientMoniker) {
JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker); JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker);
Assert.notNull(client); Assert.notNull(client, "client not found");
JSONObject params = new JSONObject(); JSONObject params = new JSONObject();
params.put("client_id", client.getIntValue("client_id")); params.put("client_id", client.getIntValue("client_id"));
return customerAndOrdersStatisticsMapper.getAvgOrderAndCustomerStatistics(params); return customerAndOrdersStatisticsMapper.getAvgOrderAndCustomerStatistics(params);
@ -115,7 +115,7 @@ public class PartnerCardDashboardServiceImp implements PartnerCardDashboardServi
@Override @Override
public List<JSONObject> getTradeAnalysisInHours(String clientMoniker) { public List<JSONObject> getTradeAnalysisInHours(String clientMoniker) {
JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker); JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker);
Assert.notNull(client); Assert.notNull(client, "client not found");
JSONObject earlistOrder = transactionAnalysisMapper.getEarliestOrder(client.getIntValue("client_id")); JSONObject earlistOrder = transactionAnalysisMapper.getEarliestOrder(client.getIntValue("client_id"));
String timezone = client.getString("timezone"); String timezone = client.getString("timezone");
AnalysisBean analysisBean = new AnalysisBean(); AnalysisBean analysisBean = new AnalysisBean();

@ -1,5 +1,7 @@
package au.com.royalpay.payment.manage.merchants.beans; package au.com.royalpay.payment.manage.merchants.beans;
import au.com.royalpay.payment.channels.wechat.runtime.beans.WechatMerchantInfo;
import au.com.royalpay.payment.tools.utils.JsonUtils;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -148,29 +150,29 @@ public class NewSubMerchantIdApply {
return params; return params;
} }
public static JSONObject resultParams(JSONObject subMerchantApplyInfo){ public static JSONObject resultParams(WechatMerchantInfo subMerchantApplyInfo){
return new JSONObject(){{ return JsonUtils.newJson(json->{
put("company_name",subMerchantApplyInfo.getString("merchant_name")); json.put("company_name",subMerchantApplyInfo.getMerchantName());
put("merchant_id",subMerchantApplyInfo.getString("merchant_id")); json.put("merchant_id",subMerchantApplyInfo.getMerchantId());
put("short_name",subMerchantApplyInfo.getString("merchant_shortname")); json.put("short_name",subMerchantApplyInfo.getMerchantShortname());
put("company_phone",subMerchantApplyInfo.getString("office_phone")); json.put("company_phone",subMerchantApplyInfo.getOfficePhone());
put("contact_person",subMerchantApplyInfo.getString("contact_name")); json.put("contact_person",subMerchantApplyInfo.getContactName());
put("contact_phone",subMerchantApplyInfo.getString("contact_phone")); json.put("contact_phone",subMerchantApplyInfo.getContactPhone());
put("contact_email",subMerchantApplyInfo.getString("contact_email")); json.put("contact_email",subMerchantApplyInfo.getContactEmail());
put("industry",subMerchantApplyInfo.getString("business_category")); json.put("industry",subMerchantApplyInfo.getBusinessCategory());
put("company_website",subMerchantApplyInfo.getString("website")); json.put("company_website",subMerchantApplyInfo.getWebsite());
put("mcc_code",subMerchantApplyInfo.getString("mcc_code")); json.put("mcc_code",subMerchantApplyInfo.getMccCode());
put("address",subMerchantApplyInfo.getString("stores_address")); json.put("address",subMerchantApplyInfo.getStoresAddress());
put("company_register_no",subMerchantApplyInfo.getString("extra_reg_cer_number")); json.put("company_register_no",subMerchantApplyInfo.getExtraRegCerNumber());
put("certificat_expire_date",subMerchantApplyInfo.getString("extra_reg_cer_exp_date")); json.put("certificat_expire_date",subMerchantApplyInfo.getExtraRegCerExpDate());
put("merchant_type",subMerchantApplyInfo.getString("extra_merchant_type")); json.put("merchant_type",subMerchantApplyInfo.getExtraMerchantType());
put("director_name",subMerchantApplyInfo.getString("director_name")); json.put("director_name",subMerchantApplyInfo.getDirectorName());
put("director_id_number",subMerchantApplyInfo.getString("director_id_number")); json.put("director_id_number",subMerchantApplyInfo.getDirectorIdNumber());
put("principal_name",subMerchantApplyInfo.getString("principal_name")); json.put("principal_name",subMerchantApplyInfo.getPrincipalName());
put("principal_id_number",subMerchantApplyInfo.getString("principal_id_number")); json.put("principal_id_number",subMerchantApplyInfo.getPrincipalIdNumber());
put("business_type",subMerchantApplyInfo.getString("business_type")); json.put("business_type",subMerchantApplyInfo.getBusinessType());
put("sub_merchant_id",subMerchantApplyInfo.getString("sub_merchant_id")); json.put("sub_merchant_id",subMerchantApplyInfo.getSubMerchantId());
}}; });
} }
public NewSubMerchantIdApply() { public NewSubMerchantIdApply() {

@ -1,6 +1,7 @@
package au.com.royalpay.payment.manage.merchants.core; package au.com.royalpay.payment.manage.merchants.core;
import au.com.royalpay.payment.channels.rpaypaymentsvc.runtime.request.entities.RPayMerchantEntity; import au.com.royalpay.payment.channels.rpaypaymentsvc.runtime.request.entities.RPayMerchantEntity;
import au.com.royalpay.payment.core.beans.ChannelMerchantInfo;
import au.com.royalpay.payment.core.exceptions.EmailException; import au.com.royalpay.payment.core.exceptions.EmailException;
import au.com.royalpay.payment.manage.appclient.beans.AppClientBean; import au.com.royalpay.payment.manage.appclient.beans.AppClientBean;
import au.com.royalpay.payment.manage.appclient.beans.AppMerchantBean; import au.com.royalpay.payment.manage.appclient.beans.AppMerchantBean;
@ -426,10 +427,11 @@ public interface ClientManager {
void setWeekendDelay(JSONObject account, String clientMoniker, int clientId, boolean delay); void setWeekendDelay(JSONObject account, String clientMoniker, int clientId, boolean delay);
List<JSONObject> listSubMerchantIdApplys(JSONObject manager, String clientMoniker); List<ChannelMerchantInfo> listSubMerchantIdApplys(JSONObject manager, String clientMoniker);
List<JSONObject> listRpaySubMerchantIdApplys(JSONObject manager, String clientMoniker); List<JSONObject> listRpaySubMerchantIdApplys(JSONObject manager, String clientMoniker);
@Deprecated
String subMerchantApplication(String clientMoniker, SubMerchantIdApply subMerchantApply, JSONObject manager); String subMerchantApplication(String clientMoniker, SubMerchantIdApply subMerchantApply, JSONObject manager);
String newSubMerchantApplication(String clientMoniker, NewSubMerchantIdApply subMerchantIdApply, JSONObject manager); String newSubMerchantApplication(String clientMoniker, NewSubMerchantIdApply subMerchantIdApply, JSONObject manager);
@ -456,8 +458,6 @@ public interface ClientManager {
List<JSONObject> listMerchantIds(String clientMoniker, JSONObject manager); List<JSONObject> listMerchantIds(String clientMoniker, JSONObject manager);
void clearCacheSubMerchantIdApplices(String clientMoniker);
JSONObject getCheckClientInfo(int client_id, String account_id, String channel); JSONObject getCheckClientInfo(int client_id, String account_id, String channel);
List<JSONObject> getClientSubMerchantIdLogs(String clientMoniker, JSONObject manager); List<JSONObject> getClientSubMerchantIdLogs(String clientMoniker, JSONObject manager);

@ -2,24 +2,35 @@ package au.com.royalpay.payment.manage.merchants.core.impls;
import au.com.royalpay.payment.channels.alipay.config.AlipayConfig; import au.com.royalpay.payment.channels.alipay.config.AlipayConfig;
import au.com.royalpay.payment.channels.alipay.config.AlipayEnvironment; import au.com.royalpay.payment.channels.alipay.config.AlipayEnvironment;
import au.com.royalpay.payment.channels.alipay.runtime.AlipayClient; import au.com.royalpay.payment.channels.alipay.runtime.AlipayCommonApi;
import au.com.royalpay.payment.channels.rpay.runtime.RpayApi; import au.com.royalpay.payment.channels.alipay.runtime.AlipayOnlineApi;
import au.com.royalpay.payment.channels.alipay.runtime.AlipayRetailApi;
import au.com.royalpay.payment.channels.alipay.runtime.entity.AlipayMerchantEntity;
import au.com.royalpay.payment.channels.rpay.runtime.beans.SubRpayMerchantInfo; import au.com.royalpay.payment.channels.rpay.runtime.beans.SubRpayMerchantInfo;
import au.com.royalpay.payment.channels.rpay.runtime.impls.RPayMerchantRegister;
import au.com.royalpay.payment.channels.rpaypaymentsvc.mappers.RPayMerchantMapper; import au.com.royalpay.payment.channels.rpaypaymentsvc.mappers.RPayMerchantMapper;
import au.com.royalpay.payment.channels.rpaypaymentsvc.runtime.RPayPaymentCardSvcApi; import au.com.royalpay.payment.channels.rpaypaymentsvc.runtime.RPayPaymentCardSvcApi;
import au.com.royalpay.payment.channels.rpaypaymentsvc.runtime.request.entities.RPayMerchantEntity; import au.com.royalpay.payment.channels.rpaypaymentsvc.runtime.request.entities.RPayMerchantEntity;
import au.com.royalpay.payment.channels.wechat.config.WeChatPayConfig; import au.com.royalpay.payment.channels.wechat.config.WeChatPayConfig;
import au.com.royalpay.payment.channels.wechat.config.WechatPayEnvironment; import au.com.royalpay.payment.channels.wechat.config.WechatPayEnvironment;
import au.com.royalpay.payment.channels.wechat.runtime.MpPaymentApi; import au.com.royalpay.payment.channels.wechat.runtime.MpPaymentApi;
import au.com.royalpay.payment.channels.wechat.runtime.WxPayClient;
import au.com.royalpay.payment.channels.wechat.runtime.beans.SubMerchantInfo; import au.com.royalpay.payment.channels.wechat.runtime.beans.SubMerchantInfo;
import au.com.royalpay.payment.channels.wechat.runtime.beans.SubMerchantInfoInheritance; import au.com.royalpay.payment.channels.wechat.runtime.beans.SubMerchantInfoInheritance;
import au.com.royalpay.payment.channels.wechat.runtime.beans.WechatMerchantInfo;
import au.com.royalpay.payment.channels.wechat.runtime.impls.WxPayMerchantRegister;
import au.com.royalpay.payment.channels.wechat.runtime.impls.WxPayMerchantRegisterLegacy;
import au.com.royalpay.payment.channels.wechat.runtime.mappers.PaymentChannelMccGoodMapper; import au.com.royalpay.payment.channels.wechat.runtime.mappers.PaymentChannelMccGoodMapper;
import au.com.royalpay.payment.channels.wechat.runtime.mappers.WxMerchantApplyMapper;
import au.com.royalpay.payment.core.ChannelMerchantApplicationService;
import au.com.royalpay.payment.core.PaymentApi;
import au.com.royalpay.payment.core.PaymentChannelApi; import au.com.royalpay.payment.core.PaymentChannelApi;
import au.com.royalpay.payment.core.beans.ChannelMerchantInfo;
import au.com.royalpay.payment.core.beans.EmptyMerchantApplication; import au.com.royalpay.payment.core.beans.EmptyMerchantApplication;
import au.com.royalpay.payment.core.beans.MchChannelContract;
import au.com.royalpay.payment.core.beans.MerchantApplicationResult; import au.com.royalpay.payment.core.beans.MerchantApplicationResult;
import au.com.royalpay.payment.core.exceptions.EmailException; import au.com.royalpay.payment.core.exceptions.EmailException;
import au.com.royalpay.payment.core.exceptions.InvalidShortIdException; import au.com.royalpay.payment.core.exceptions.InvalidShortIdException;
import au.com.royalpay.payment.core.impls.MerchantChannelApplicationManager;
import au.com.royalpay.payment.core.mappers.SysClientMapper; import au.com.royalpay.payment.core.mappers.SysClientMapper;
import au.com.royalpay.payment.core.utils.OrderExpiryRuleResolver; import au.com.royalpay.payment.core.utils.OrderExpiryRuleResolver;
import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper; import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper;
@ -74,6 +85,7 @@ import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApiProvider;
import au.com.royalpay.payment.tools.connections.mpsupport.beans.TemplateMessage; import au.com.royalpay.payment.tools.connections.mpsupport.beans.TemplateMessage;
import au.com.royalpay.payment.tools.connections.mpsupport.exceptions.WechatException; import au.com.royalpay.payment.tools.connections.mpsupport.exceptions.WechatException;
import au.com.royalpay.payment.tools.defines.IncrementalChannel; import au.com.royalpay.payment.tools.defines.IncrementalChannel;
import au.com.royalpay.payment.tools.defines.PayChannel;
import au.com.royalpay.payment.tools.env.PlatformEnvironment; import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import au.com.royalpay.payment.tools.env.SysConfigManager; import au.com.royalpay.payment.tools.env.SysConfigManager;
import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.BadRequestException;
@ -115,6 +127,8 @@ import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.hssf.util.HSSFColor; import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Font; import org.apache.poi.ss.usermodel.Font;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element; import org.dom4j.Element;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormat;
@ -168,7 +182,7 @@ import static au.com.royalpay.payment.manage.permission.utils.OrgCheckUtils.chec
*/ */
@Service @Service
public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvider, ApplicationEventPublisherAware { public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvider, ApplicationEventPublisherAware {
private Logger logger = LoggerFactory.getLogger(getClass()); private final Logger logger = LoggerFactory.getLogger(getClass());
@Resource @Resource
private ClientMapper clientMapper; private ClientMapper clientMapper;
@Resource @Resource
@ -216,20 +230,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
private ClientModifySupport clientModifySupport; private ClientModifySupport clientModifySupport;
@Resource @Resource
private PaymentChannelApi[] channels; private MerchantChannelApplicationManager merchantChannelApplicationManager;
@Resource @Resource
private MerchantInfoProvider merchantInfoProvider; private MerchantInfoProvider merchantInfoProvider;
@Resource @Resource
private MpPaymentApi mpPaymentApi;
@Resource
private SignInAccountService signInAccountService; private SignInAccountService signInAccountService;
@Resource
private WxPayClient wxPayClient;
@Resource
private AlipayClient alipayClient;
@Resource
private RpayApi rpayApi;
@Resource @Resource
private ManagerMapper managerMapper; private ManagerMapper managerMapper;
@ -251,7 +256,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
private ClientAuditProcessMapper clientAuditProcessMapper; private ClientAuditProcessMapper clientAuditProcessMapper;
@Resource @Resource
private SysWxMerchantApplyMapper sysWxMerchantApplyMapper; private WxMerchantApplyMapper wxMerchantApplyMapper;
@Resource @Resource
private SysRpayMerchantApplyMapper sysRpayMerchantApplyMapper; private SysRpayMerchantApplyMapper sysRpayMerchantApplyMapper;
@Resource @Resource
@ -279,8 +284,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Resource @Resource
private MailGunService mailGunService; private MailGunService mailGunService;
@Resource @Resource
private MailSendMapper mailSendMapper;
@Resource
private ClearingDetailMapper clearingDetailMapper; private ClearingDetailMapper clearingDetailMapper;
@Resource @Resource
private ClearingLogMapper clearingLogMapper; private ClearingLogMapper clearingLogMapper;
@ -326,6 +329,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
private RPayMerchantMapper rPayMerchantMapper; private RPayMerchantMapper rPayMerchantMapper;
@Resource @Resource
private SysClientUpayProfileMapper sysClientUpayProfileMapper; private SysClientUpayProfileMapper sysClientUpayProfileMapper;
@Resource
private PaymentApi paymentApi;
DateTimeFormatter formatter = DateTimeFormat.forPattern("dd MMM yyyy"); DateTimeFormatter formatter = DateTimeFormat.forPattern("dd MMM yyyy");
@ -362,6 +367,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Resource @Resource
private PaymentChannelMccGoodMapper paymentChannelMccGoodMapper; private PaymentChannelMccGoodMapper paymentChannelMccGoodMapper;
@PostConstruct @PostConstruct
public void init() { public void init() {
tags.add("account"); tags.add("account");
@ -539,7 +545,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (representativeInfo != null) { if (representativeInfo != null) {
client.put("representativeInfo", representativeInfo); client.put("representativeInfo", representativeInfo);
} }
JSONObject wechatMcc= paymentChannelMccGoodMapper.findWechatPayMccByClientId(client.getIntValue("client_id")); JSONObject wechatMcc = paymentChannelMccGoodMapper.findWechatPayMccByClientId(client.getIntValue("client_id"));
if (wechatMcc != null) { if (wechatMcc != null) {
client.put("mc_code", wechatMcc.getIntValue("mc_code")); client.put("mc_code", wechatMcc.getIntValue("mc_code"));
} }
@ -876,22 +882,23 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
/** /**
* mccode * mccode
*
* @param partner * @param partner
*/ */
private void saveWechatMcc(JSONObject partner){ private void saveWechatMcc(JSONObject partner) {
JSONObject wxGoodMcc = paymentChannelMccGoodMapper.findWechatPayMccByClientId(partner.getIntValue("client_id")); JSONObject wxGoodMcc = paymentChannelMccGoodMapper.findWechatPayMccByClientId(partner.getIntValue("client_id"));
if ((wxGoodMcc == null || wxGoodMcc.isEmpty())&& !TextUtils.isEmpty(partner.getString("mc_code"))) { if ((wxGoodMcc == null || wxGoodMcc.isEmpty()) && !TextUtils.isEmpty(partner.getString("mc_code"))) {
wxGoodMcc = new JSONObject(); wxGoodMcc = new JSONObject();
wxGoodMcc.put("client_id",partner.getIntValue("client_id")); wxGoodMcc.put("client_id", partner.getIntValue("client_id"));
wxGoodMcc.put("mc_code",partner.getString("mc_code")); wxGoodMcc.put("mc_code", partner.getString("mc_code"));
wxGoodMcc.put("channel","Wechat"); wxGoodMcc.put("channel", "Wechat");
wxGoodMcc.put("creation_date",new Date()); wxGoodMcc.put("creation_date", new Date());
wxGoodMcc.put("creation_by","System"); wxGoodMcc.put("creation_by", "System");
paymentChannelMccGoodMapper.save(wxGoodMcc); paymentChannelMccGoodMapper.save(wxGoodMcc);
return; return;
} }
if(!TextUtils.isEmpty(partner.getString("mc_code"))) { if (!TextUtils.isEmpty(partner.getString("mc_code"))) {
wxGoodMcc.put("mc_code", partner.getString("mc_code")); wxGoodMcc.put("mc_code", partner.getString("mc_code"));
paymentChannelMccGoodMapper.update(wxGoodMcc); paymentChannelMccGoodMapper.update(wxGoodMcc);
} }
@ -976,7 +983,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
} }
clientConfigMapper.update(clientConfig); clientConfigMapper.update(clientConfig);
clientInfoCacheSupport.clearClientCache(clientId); clientInfoCacheSupport.clearClientCache(clientId);
client.put("mc_code",info.getMc_code()); client.put("mc_code", info.getMc_code());
saveWechatMcc(client); saveWechatMcc(client);
} }
@ -1069,7 +1076,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
String originSubMerchantId = client.getString("sub_merchant_id"); String originSubMerchantId = client.getString("sub_merchant_id");
update.put("client_id", clientId); update.put("client_id", clientId);
String subMerchantId = subMerchantInfo.getString("sub_merchant_id"); String subMerchantId = subMerchantInfo.getString("sub_merchant_id");
WeChatPayConfig.Merchant availableMerchant = mpPaymentApi.determineMerchant(subMerchantId); MpPaymentApi wxApi = (MpPaymentApi) paymentApi.channelApi(PayChannel.WECHAT.getChannelCode());
WeChatPayConfig.Merchant availableMerchant = wxApi.determineMerchant(subMerchantId);
update.put("merchant_id", availableMerchant == null ? null : availableMerchant.getMerchantId()); update.put("merchant_id", availableMerchant == null ? null : availableMerchant.getMerchantId());
update.put("sub_merchant_id", subMerchantId); update.put("sub_merchant_id", subMerchantId);
try { try {
@ -1556,7 +1564,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Override @Override
public void switchChannelPermission(JSONObject manager, String clientMoniker, String channel, boolean allow) { public void switchChannelPermission(JSONObject manager, String clientMoniker, String channel, boolean allow) {
for (PaymentChannelApi channelApi : channels) { for (PaymentChannelApi channelApi : paymentApi.channels()) {
if (channelApi.channel().equalsIgnoreCase(channel) || "CB_BankPay".equalsIgnoreCase(channel)) { if (channelApi.channel().equalsIgnoreCase(channel) || "CB_BankPay".equalsIgnoreCase(channel)) {
JSONObject client = getClientInfoByMoniker(clientMoniker); JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) { if (client == null) {
@ -1564,8 +1572,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
} }
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "enable_" + channel.toLowerCase(), allow)); clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "enable_" + channel.toLowerCase(), allow));
logger.info(manager.getString("display_name") + "(" + manager.getString("manager_id") + ") switched client " + clientMoniker + " channel " logger.info("{}({}) switched client {} channel {} to {}", manager.getString("display_name"), manager.getString("manager_id"), clientMoniker, channel, allow);
+ channel + " to " + allow);
if (allow && (StringUtils.equalsAnyIgnoreCase("Wechat", channel) || StringUtils.equalsAnyIgnoreCase("Alipay", channel))) { if (allow && (StringUtils.equalsAnyIgnoreCase("Wechat", channel) || StringUtils.equalsAnyIgnoreCase("Alipay", channel))) {
int clientId = client.getIntValue("client_id"); int clientId = client.getIntValue("client_id");
List<JSONObject> clientBankAccounts = clientBankAccountMapper.clientBankAccounts(clientId); List<JSONObject> clientBankAccounts = clientBankAccountMapper.clientBankAccounts(clientId);
@ -1886,7 +1893,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
int clientId = client.getIntValue("client_id"); int clientId = client.getIntValue("client_id");
JSONObject clientConfig = clientConfigService.find(clientId); JSONObject clientConfig = clientConfigService.find(clientId);
List<JSONObject> rates = new ArrayList<>(); List<JSONObject> rates = new ArrayList<>();
for (PaymentChannelApi channel : channels) { for (PaymentChannelApi channel : paymentApi.channels()) {
rates.addAll(merchantInfoProvider.listClientRates(clientId, new Date(), channel.channel(), includingInactive)); rates.addAll(merchantInfoProvider.listClientRates(clientId, new Date(), channel.channel(), includingInactive));
} }
rates.addAll(merchantInfoProvider.listClientRates(clientId, new Date(), "CB_BankPay", includingInactive)); rates.addAll(merchantInfoProvider.listClientRates(clientId, new Date(), "CB_BankPay", includingInactive));
@ -5206,15 +5213,15 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
for (JSONObject compliance : complianceList) { for (JSONObject compliance : complianceList) {
String wxopenid = compliance.getString("wx_openid"); String wxopenid = compliance.getString("wx_openid");
String loginUrl = PlatformEnvironment.getEnv().concatUrl("/global/userstatus/manager_signin_wechat"); String loginUrl = PlatformEnvironment.getEnv().concatUrl("/global/userstatus/manager_signin_wechat");
MpWechatApi paymentApi = mpWechatApiProvider.getWechatApiForTemplateMessage(wxopenid); MpWechatApi wxApi = mpWechatApiProvider.getWechatApiForTemplateMessage(wxopenid);
String templateId = paymentApi.getTemplateId("new-apply"); String templateId = wxApi.getTemplateId("new-apply");
try { try {
TemplateMessage msg = initSendToComplianceTemplate(loginUrl, wxopenid, templateId, bd_user_name, client); TemplateMessage msg = initSendToComplianceTemplate(loginUrl, wxopenid, templateId, bd_user_name, client);
paymentApi.sendTemplateMessage(msg); wxApi.sendTemplateMessage(msg);
} catch (Exception e) { } catch (Exception e) {
try { try {
TemplateMessage msg = initSendToComplianceTemplate(loginUrl, wxopenid, templateId, bd_user_name, client); TemplateMessage msg = initSendToComplianceTemplate(loginUrl, wxopenid, templateId, bd_user_name, client);
paymentApi.sendTemplateMessage(msg); wxApi.sendTemplateMessage(msg);
} catch (Exception ignore) { } catch (Exception ignore) {
} }
} }
@ -5241,9 +5248,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
// String loginUrl = // String loginUrl =
// PlatformEnvironment.getEnvironment().concatUrl("/global/userstatus/manager_signin_wechat"); // PlatformEnvironment.getEnvironment().concatUrl("/global/userstatus/manager_signin_wechat");
try { try {
MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); MpWechatApi wxApi = mpWechatApiProvider.getNewPaymentApi();
TemplateMessage msg = initSendToBDTemplate(wxopenid, paymentApi.getTemplateId("refuse-bd"), refuseRemark, client); TemplateMessage msg = initSendToBDTemplate(wxopenid, wxApi.getTemplateId("refuse-bd"), refuseRemark, client);
paymentApi.sendTemplateMessage(msg); wxApi.sendTemplateMessage(msg);
} catch (Exception ignored) { } catch (Exception ignored) {
} }
} }
@ -5270,9 +5277,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (wxopenid != null) { if (wxopenid != null) {
String loginUrl = PlatformEnvironment.getEnv().concatUrl("/global/userstatus/manager_signin_wechat"); String loginUrl = PlatformEnvironment.getEnv().concatUrl("/global/userstatus/manager_signin_wechat");
try { try {
MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); MpWechatApi wxApi = mpWechatApiProvider.getNewPaymentApi();
TemplateMessage msg = initSendToBDAgreeFileTemplate(wxopenid, paymentApi.getTemplateId("new-apply"), remark, client); TemplateMessage msg = initSendToBDAgreeFileTemplate(wxopenid, wxApi.getTemplateId("new-apply"), remark, client);
paymentApi.sendTemplateMessage(msg); wxApi.sendTemplateMessage(msg);
} catch (Exception e) { } catch (Exception e) {
} }
} }
@ -5298,15 +5305,15 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
for (JSONObject compliance : complianceList) { for (JSONObject compliance : complianceList) {
String wxopenid = compliance.getString("wx_openid"); String wxopenid = compliance.getString("wx_openid");
String loginUrl = PlatformEnvironment.getEnv().concatUrl("/global/userstatus/manager_signin_wechat"); String loginUrl = PlatformEnvironment.getEnv().concatUrl("/global/userstatus/manager_signin_wechat");
MpWechatApi paymentApi = mpWechatApiProvider.getWechatApiForTemplateMessage(wxopenid); MpWechatApi wxApi = mpWechatApiProvider.getWechatApiForTemplateMessage(wxopenid);
String templateId = paymentApi.getTemplateId("new-apply"); String templateId = wxApi.getTemplateId("new-apply");
try { try {
TemplateMessage msg = initSendToComAgreeFileTemplate(loginUrl, wxopenid, templateId, bd_user_name, client); TemplateMessage msg = initSendToComAgreeFileTemplate(loginUrl, wxopenid, templateId, bd_user_name, client);
paymentApi.sendTemplateMessage(msg); wxApi.sendTemplateMessage(msg);
} catch (Exception e) { } catch (Exception e) {
try { try {
TemplateMessage msg = initSendToComAgreeFileTemplate(loginUrl, wxopenid, templateId, bd_user_name, client); TemplateMessage msg = initSendToComAgreeFileTemplate(loginUrl, wxopenid, templateId, bd_user_name, client);
paymentApi.sendTemplateMessage(msg); wxApi.sendTemplateMessage(msg);
} catch (Exception ignore) { } catch (Exception ignore) {
} }
} }
@ -5331,15 +5338,15 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
for (JSONObject compliance : complianceList) { for (JSONObject compliance : complianceList) {
String wxopenid = compliance.getString("wx_openid"); String wxopenid = compliance.getString("wx_openid");
String loginUrl = PlatformEnvironment.getEnv().concatUrl("/global/userstatus/manager_signin_wechat"); String loginUrl = PlatformEnvironment.getEnv().concatUrl("/global/userstatus/manager_signin_wechat");
MpWechatApi paymentApi = mpWechatApiProvider.getWechatApiForTemplateMessage(wxopenid); MpWechatApi wxApi = mpWechatApiProvider.getWechatApiForTemplateMessage(wxopenid);
String templateId = paymentApi.getTemplateId("new-apply"); String templateId = wxApi.getTemplateId("new-apply");
try { try {
TemplateMessage msg = initSendToComplianceGreenChannelTemplate(loginUrl, wxopenid, templateId, bd_user_name, client); TemplateMessage msg = initSendToComplianceGreenChannelTemplate(loginUrl, wxopenid, templateId, bd_user_name, client);
paymentApi.sendTemplateMessage(msg); wxApi.sendTemplateMessage(msg);
} catch (Exception e) { } catch (Exception e) {
try { try {
TemplateMessage msg = initSendToComplianceGreenChannelTemplate(loginUrl, wxopenid, templateId, bd_user_name, client); TemplateMessage msg = initSendToComplianceGreenChannelTemplate(loginUrl, wxopenid, templateId, bd_user_name, client);
paymentApi.sendTemplateMessage(msg); wxApi.sendTemplateMessage(msg);
} catch (Exception ignore) { } catch (Exception ignore) {
} }
} }
@ -5392,10 +5399,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (wxopenid != null) { if (wxopenid != null) {
try { try {
TemplateMessage msg = initTaskFinishTemplate(wxopenid, client_moniker + "已快速开通", "绿色通道申请通过", ""); TemplateMessage msg = initTaskFinishTemplate(wxopenid, client_moniker + "已快速开通", "绿色通道申请通过", "");
MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); MpWechatApi wxApi = mpWechatApiProvider.getNewPaymentApi();
paymentApi.sendTemplateMessage(msg); wxApi.sendTemplateMessage(msg);
} catch (WechatException e) { } catch (WechatException e) {
logger.error("Wechat Message Error,绿色通道开通完成" + e.getMessage()); logger.error("Wechat Message Error,绿色通道开通完成", e);
publisher.publishEvent(new WechatExceptionEvent(this, e, "Audit,绿色通道开通完成,openid=" + wxopenid)); publisher.publishEvent(new WechatExceptionEvent(this, e, "Audit,绿色通道开通完成,openid=" + wxopenid));
} }
} }
@ -5409,12 +5416,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
for (JSONObject compliance : complianceList) { for (JSONObject compliance : complianceList) {
String wxopenid = compliance.getString("wx_openid"); String wxopenid = compliance.getString("wx_openid");
try { try {
MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); MpWechatApi wxApi = mpWechatApiProvider.getNewPaymentApi();
TemplateMessage msg = initSendCommissionTemplate(wxopenid, paymentApi.getTemplateId("commission"), "BD申请制作合同" + client_moniker, TemplateMessage msg = initSendCommissionTemplate(wxopenid, wxApi.getTemplateId("commission"), "BD申请制作合同" + client_moniker,
bd_user_name, "制作合同申请", "BD申请制作" + short_name + "的合同"); bd_user_name, "制作合同申请", "BD申请制作" + short_name + "的合同");
paymentApi.sendTemplateMessage(msg); wxApi.sendTemplateMessage(msg);
} catch (WechatException e) { } catch (WechatException e) {
logger.error("Wechat Message Error,open_status=1" + e.getMessage()); logger.error("Wechat Message Error,open_status=1", e);
publisher.publishEvent(new WechatExceptionEvent(this, e, "Audit,open_status=1,openid=" + wxopenid)); publisher.publishEvent(new WechatExceptionEvent(this, e, "Audit,open_status=1,openid=" + wxopenid));
} }
} }
@ -5427,12 +5434,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
String wxopenid = bd.getString("wx_openid"); String wxopenid = bd.getString("wx_openid");
if (wxopenid != null) { if (wxopenid != null) {
try { try {
MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); MpWechatApi wxApi = mpWechatApiProvider.getNewPaymentApi();
TemplateMessage msg = initSendCommissionTemplate(wxopenid, paymentApi.getTemplateId("commission"), client_moniker + "合同制作完成", TemplateMessage msg = initSendCommissionTemplate(wxopenid, wxApi.getTemplateId("commission"), client_moniker + "合同制作完成",
"Compliance", "合规材料", "上传完整合规材料,商户:" + short_name); "Compliance", "合规材料", "上传完整合规材料,商户:" + short_name);
paymentApi.sendTemplateMessage(msg); wxApi.sendTemplateMessage(msg);
} catch (WechatException e) { } catch (WechatException e) {
logger.error("Wechat Message Error,open_status=3" + e.getMessage()); logger.error("Wechat Message Error,open_status=3", e);
publisher.publishEvent(new WechatExceptionEvent(this, e, "Audit,open_status=3,openid=" + wxopenid)); publisher.publishEvent(new WechatExceptionEvent(this, e, "Audit,open_status=3,openid=" + wxopenid));
} }
@ -5450,15 +5457,15 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
for (JSONObject compliance : complianceList) { for (JSONObject compliance : complianceList) {
String wxopenid = compliance.getString("wx_openid"); String wxopenid = compliance.getString("wx_openid");
try { try {
MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); MpWechatApi wxApi = mpWechatApiProvider.getNewPaymentApi();
TemplateMessage msg = initSendCommissionTemplate(wxopenid, paymentApi.getTemplateId("commission"), client_moniker + "合规材料已提交", TemplateMessage msg = initSendCommissionTemplate(wxopenid, wxApi.getTemplateId("commission"), client_moniker + "合规材料已提交",
bd_user_name, "审核材料", "已提交合规材料,等待审核"); bd_user_name, "审核材料", "已提交合规材料,等待审核");
paymentApi.sendTemplateMessage(msg); wxApi.sendTemplateMessage(msg);
} catch (WechatException e) { } catch (WechatException e) {
logger.error("Wechat Message Error,open_status=1" + e.getMessage()); logger.error("Wechat Message Error,open_status=1", e);
publisher.publishEvent(new WechatExceptionEvent(this, e, "Audit,open_status=1,openid=" + wxopenid)); publisher.publishEvent(new WechatExceptionEvent(this, e, "Audit,open_status=1,openid=" + wxopenid));
} catch (Exception e) { } catch (Exception e) {
logger.error("Wechat Message Error,open_status=1" + e.getMessage()); logger.error("Wechat Message Error,open_status=1", e);
} }
} }
} }
@ -5471,10 +5478,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (wxopenid != null) { if (wxopenid != null) {
try { try {
TemplateMessage msg = initTaskFinishTemplate(wxopenid, client_moniker + "已正式开通", "Compliance审核通过", ""); TemplateMessage msg = initTaskFinishTemplate(wxopenid, client_moniker + "已正式开通", "Compliance审核通过", "");
MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); MpWechatApi wxApi = mpWechatApiProvider.getNewPaymentApi();
paymentApi.sendTemplateMessage(msg); wxApi.sendTemplateMessage(msg);
} catch (WechatException e) { } catch (WechatException e) {
logger.error("Wechat Message Error,open_status=5" + e.getMessage()); logger.error("Wechat Message Error,open_status=5", e);
publisher.publishEvent(new WechatExceptionEvent(this, e, "Audit,open_status=5,openid=" + wxopenid)); publisher.publishEvent(new WechatExceptionEvent(this, e, "Audit,open_status=5,openid=" + wxopenid));
} }
} }
@ -5488,12 +5495,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
for (JSONObject compliance : complianceList) { for (JSONObject compliance : complianceList) {
String wxopenid = compliance.getString("wx_openid"); String wxopenid = compliance.getString("wx_openid");
try { try {
MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); MpWechatApi wxApi = mpWechatApiProvider.getNewPaymentApi();
TemplateMessage msg = initSendCommissionTemplate(wxopenid, paymentApi.getTemplateId("commission"), client_moniker + "申请绿色通道", TemplateMessage msg = initSendCommissionTemplate(wxopenid, wxApi.getTemplateId("commission"), client_moniker + "申请绿色通道",
bd_user_name, "绿色通道申请", "BD已提交绿色通道申请,商户:" + short_name); bd_user_name, "绿色通道申请", "BD已提交绿色通道申请,商户:" + short_name);
paymentApi.sendTemplateMessage(msg); wxApi.sendTemplateMessage(msg);
} catch (WechatException e) { } catch (WechatException e) {
logger.error("Wechat Message Error,open_status=10"); logger.error("Wechat Message Error,open_status=10", e);
publisher.publishEvent(new WechatExceptionEvent(this, e, "Audit,open_status=10,openid=" + wxopenid)); publisher.publishEvent(new WechatExceptionEvent(this, e, "Audit,open_status=10,openid=" + wxopenid));
} }
} }
@ -5517,12 +5524,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
for (JSONObject compliance : complianceList) { for (JSONObject compliance : complianceList) {
String wxopenid = compliance.getString("wx_openid"); String wxopenid = compliance.getString("wx_openid");
try { try {
MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); MpWechatApi wxApi = mpWechatApiProvider.getNewPaymentApi();
TemplateMessage msg = initSendCommissionTemplate(wxopenid, paymentApi.getTemplateId("commission"), "BD申请制作信用卡支付合同" + client_moniker, TemplateMessage msg = initSendCommissionTemplate(wxopenid, wxApi.getTemplateId("commission"), "BD申请制作信用卡支付合同" + client_moniker,
bd_user_name, "制作卡支付合同申请", "BD申请制作" + short_name + "的卡支付合同"); bd_user_name, "制作卡支付合同申请", "BD申请制作" + short_name + "的卡支付合同");
paymentApi.sendTemplateMessage(msg); wxApi.sendTemplateMessage(msg);
} catch (WechatException e) { } catch (WechatException e) {
logger.error("Wechat Message Error,open_status=1" + e.getMessage()); logger.error("Wechat Message Error,open_status=1", e);
publisher.publishEvent(new WechatExceptionEvent(this, e, "Audit,open_status=1,openid=" + wxopenid)); publisher.publishEvent(new WechatExceptionEvent(this, e, "Audit,open_status=1,openid=" + wxopenid));
} }
} }
@ -5535,12 +5542,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
String wxopenid = bd.getString("wx_openid"); String wxopenid = bd.getString("wx_openid");
if (wxopenid != null) { if (wxopenid != null) {
try { try {
MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); MpWechatApi wxApi = mpWechatApiProvider.getNewPaymentApi();
TemplateMessage msg = initSendCommissionTemplate(wxopenid, paymentApi.getTemplateId("commission"), client_moniker + "信用卡支付合同制作完成", TemplateMessage msg = initSendCommissionTemplate(wxopenid, wxApi.getTemplateId("commission"), client_moniker + "信用卡支付合同制作完成",
"Compliance", "合规材料", "上传完整合规材料,商户:" + short_name); "Compliance", "合规材料", "上传完整合规材料,商户:" + short_name);
paymentApi.sendTemplateMessage(msg); wxApi.sendTemplateMessage(msg);
} catch (WechatException e) { } catch (WechatException e) {
logger.error("Wechat Message Error,open_status=3" + e.getMessage()); logger.error("Wechat Message Error,open_status=3", e);
publisher.publishEvent(new WechatExceptionEvent(this, e, "Audit,open_status=3,openid=" + wxopenid)); publisher.publishEvent(new WechatExceptionEvent(this, e, "Audit,open_status=3,openid=" + wxopenid));
} }
@ -5558,15 +5565,15 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
for (JSONObject compliance : complianceList) { for (JSONObject compliance : complianceList) {
String wxopenid = compliance.getString("wx_openid"); String wxopenid = compliance.getString("wx_openid");
try { try {
MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); MpWechatApi wxApi = mpWechatApiProvider.getNewPaymentApi();
TemplateMessage msg = initSendCommissionTemplate(wxopenid, paymentApi.getTemplateId("commission"), client_moniker + "信用卡卡支付合规材料已提交", TemplateMessage msg = initSendCommissionTemplate(wxopenid, wxApi.getTemplateId("commission"), client_moniker + "信用卡卡支付合规材料已提交",
bd_user_name, "审核材料", "已提交合规材料,等待审核"); bd_user_name, "审核材料", "已提交合规材料,等待审核");
paymentApi.sendTemplateMessage(msg); wxApi.sendTemplateMessage(msg);
} catch (WechatException e) { } catch (WechatException e) {
logger.error("Wechat Message Error,open_status=1" + e.getMessage()); logger.error("Wechat Message Error,open_status=1", e);
publisher.publishEvent(new WechatExceptionEvent(this, e, "Audit,open_status=1,openid=" + wxopenid)); publisher.publishEvent(new WechatExceptionEvent(this, e, "Audit,open_status=1,openid=" + wxopenid));
} catch (Exception e) { } catch (Exception e) {
logger.error("Wechat Message Error,open_status=1" + e.getMessage()); logger.error("Wechat Message Error,open_status=1", e);
} }
} }
} }
@ -5579,10 +5586,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (wxopenid != null) { if (wxopenid != null) {
try { try {
TemplateMessage msg = initTaskFinishTemplate(wxopenid, client_moniker + "已正式开通", "Card Payment Compliance审核通过", ""); TemplateMessage msg = initTaskFinishTemplate(wxopenid, client_moniker + "已正式开通", "Card Payment Compliance审核通过", "");
MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); MpWechatApi wxApi = mpWechatApiProvider.getNewPaymentApi();
paymentApi.sendTemplateMessage(msg); wxApi.sendTemplateMessage(msg);
} catch (WechatException e) { } catch (WechatException e) {
logger.error("Wechat Message Error,open_status=5" + e.getMessage()); logger.error("Wechat Message Error,open_status=5", e);
publisher.publishEvent(new WechatExceptionEvent(this, e, "Audit,open_status=5,openid=" + wxopenid)); publisher.publishEvent(new WechatExceptionEvent(this, e, "Audit,open_status=5,openid=" + wxopenid));
} }
} }
@ -5593,37 +5600,22 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Override @Override
@Cacheable(value = ":all_sub_merchant_id_applices:", key = "#clientMoniker") @Cacheable(value = ":all_sub_merchant_id_applices:", key = "#clientMoniker")
public List<JSONObject> listSubMerchantIdApplys(JSONObject manager, String clientMoniker) { public List<ChannelMerchantInfo> listSubMerchantIdApplys(JSONObject manager, String clientMoniker) {
JSONObject client = getClientInfoByMoniker(clientMoniker); JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) { if (client == null) {
throw new InvalidShortIdException(); throw new InvalidShortIdException();
} }
checkOrgPermission(manager, client); checkOrgPermission(manager, client);
List<JSONObject> applices = sysWxMerchantApplyMapper.listWxMerchantApplices(client.getInteger("client_id"), List<WechatMerchantInfo> applices = wxMerchantApplyMapper.listWxMerchantApplices(client.getInteger("client_id"),
new PageBounds(Order.formString("create_time.desc"))); new PageBounds(Order.formString("create_time.desc")));
if (!applices.isEmpty()) { if (!applices.isEmpty()) {
return applices; return new ArrayList<>(applices);
} else { } else {
if (StringUtils.isNotEmpty(client.getString("sub_merchant_id")) && StringUtils.isNotEmpty(client.getString("merchant_id"))) { if (StringUtils.isNotEmpty(client.getString("sub_merchant_id")) && StringUtils.isNotEmpty(client.getString("merchant_id"))) {
Element elem = wxPayClient.querySubMerchant(client.getString("merchant_id"), client.getString("sub_merchant_id")); WxPayMerchantRegister wxRegistry = Optional.ofNullable(merchantChannelApplicationManager.getRegister(WxPayMerchantRegister.class)).orElseThrow(() -> new ServerErrorException("No Wechat registry found"));
JSONObject object = new JSONObject(); ChannelMerchantInfo wxMerchantInfo = wxRegistry.findMerchant(client);
object.put("sub_merchant_id", elem.elementText("sub_mch_id_0")); List<ChannelMerchantInfo> applyQuery = new ArrayList<>();
object.put("client_id", client.getInteger("client_id")); applyQuery.add(wxMerchantInfo);
object.put("merchant_name", elem.elementText("merchant_name_0"));
object.put("merchant_shortname", elem.elementText("merchant_shortname_0"));
object.put("office_phone", elem.elementText("office_phone_0"));
object.put("contact_name", elem.elementText("contact_name_0"));
object.put("contact_email", elem.elementText("contact_email_0"));
object.put("contact_phone", elem.elementText("contact_phone_0"));
object.put("business_category", elem.elementText("business_category_0"));
object.put("merchant_remark", elem.elementText("merchant_remark_0"));
object.put("website", elem.elementText("website_0"));
object.put("merchant_introduction", elem.elementText("merchant_introduction_0"));
object.put("merchant_id", client.getString("merchant_id"));
object.put("create_time", new Date());
object.put("operator", manager.getString("display_name"));
List<JSONObject> applyQuery = new ArrayList<>();
applyQuery.add(object);
return applyQuery; return applyQuery;
} }
} }
@ -5647,6 +5639,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Override @Override
@CacheEvict(value = ":all_sub_merchant_id_applices:", key = "#clientMoniker") @CacheEvict(value = ":all_sub_merchant_id_applices:", key = "#clientMoniker")
@Deprecated
public String subMerchantApplication(String clientMoniker, SubMerchantIdApply subMerchantApply, JSONObject manager) { public String subMerchantApplication(String clientMoniker, SubMerchantIdApply subMerchantApply, JSONObject manager) {
JSONObject client = getClientInfoByMoniker(clientMoniker); JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) { if (client == null) {
@ -5655,25 +5648,21 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
checkOrgPermission(manager, client); checkOrgPermission(manager, client);
JSONObject params = subMerchantApply.insertObject(); JSONObject params = subMerchantApply.insertObject();
SubMerchantInfo subMerchantInfo = JSONObject.toJavaObject(params, SubMerchantInfo.class); SubMerchantInfo subMerchantInfo = JSON.toJavaObject(params, SubMerchantInfo.class);
params.put("merchant_id", subMerchantApply.getMerchant_id());
params.put("client_id", client.getString("client_id")); MerchantApplicationResult res = Optional.ofNullable(merchantChannelApplicationManager.getRegister(WxPayMerchantRegisterLegacy.class))
params.put("create_time", new Date()); .map(channel -> channel.apply(client, subMerchantInfo, manager))
params.put("operator", manager.getString("display_name")); .orElseThrow(() -> new ServerErrorException("No Wechat merchant registry found"));
Element elem = wxPayClient.subMerchantApplication(subMerchantApply.getMerchant_id(), subMerchantInfo); if (res.isSuccess()) {
String sub_merchant_id = elem.elementText("sub_mch_id"); return res.getMid();
if (StringUtils.isNotEmpty(sub_merchant_id)) {
params.put("sub_merchant_id", sub_merchant_id);
sysWxMerchantApplyMapper.insertWxMerchantApply(params);
clearCacheSubMerchantIdApplices(clientMoniker);
} else { } else {
throw new BadRequestException(elem.elementText("return_msg")); throw new BadRequestException("Failed to register wechat merchant");
} }
return sub_merchant_id;
} }
/** /**
* *
*
* @param clientMoniker * @param clientMoniker
* @param subMerchantApply * @param subMerchantApply
* @param manager * @param manager
@ -5681,7 +5670,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
*/ */
@Override @Override
@CacheEvict(value = ":all_sub_merchant_id_applices:", key = "#clientMoniker") @CacheEvict(value = ":all_sub_merchant_id_applices:", key = "#clientMoniker")
public String newSubMerchantApplication(String clientMoniker, NewSubMerchantIdApply subMerchantApply, JSONObject manager){ public String newSubMerchantApplication(String clientMoniker, NewSubMerchantIdApply subMerchantApply, JSONObject manager) {
JSONObject client = getClientInfoByMoniker(clientMoniker); JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) { if (client == null) {
throw new InvalidShortIdException(); throw new InvalidShortIdException();
@ -5689,48 +5678,39 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
checkOrgPermission(manager, client); checkOrgPermission(manager, client);
JSONObject params = subMerchantApply.insertObject(client); JSONObject params = subMerchantApply.insertObject(client);
SubMerchantInfoInheritance subMerchantInfo = JSONObject.toJavaObject(params, SubMerchantInfoInheritance.class); SubMerchantInfoInheritance subMerchantInfo = JSON.toJavaObject(params, SubMerchantInfoInheritance.class);
params.put("merchant_id", subMerchantApply.getMerchant_id()); MerchantApplicationResult res = Optional.ofNullable(merchantChannelApplicationManager.getRegister(WxPayMerchantRegister.class))
params.put("client_id", client.getString("client_id")); .map(channel -> channel.apply(client, subMerchantInfo, manager))
params.put("create_time", new Date()); .orElseThrow(() -> new ServerErrorException("No Wechat merchant registry found"));
params.put("operator", manager.getString("display_name")); if (res.isSuccess()) {
params.put("is_valid","1"); return res.getMid();
Element elem = wxPayClient.newSubMerchantApplication(subMerchantApply.getMerchant_id(), subMerchantInfo);
String sub_merchant_id = elem.elementText("sub_mch_id");
if (StringUtils.isNotEmpty(sub_merchant_id)) {
params.put("sub_merchant_id", sub_merchant_id);
List<JSONObject> subMerchants= sysWxMerchantApplyMapper.findByClientIdAndSubMerchantId(client.getInteger("client_id"),sub_merchant_id);
if(subMerchants.size()>0){
sysWxMerchantApplyMapper.failureSubMerchantByClientIdAndSubMerchantId(client.getInteger("client_id"),sub_merchant_id);
}
sysWxMerchantApplyMapper.insertWxMerchantApply(params);
clearCacheSubMerchantIdApplices(clientMoniker);
} else { } else {
throw new BadRequestException(elem.elementText("return_msg")); throw new BadRequestException("Failed to register wechat merchant");
} }
return sub_merchant_id;
} }
/** /**
* - * -
*
* @param clientMoniker * @param clientMoniker
* @param merchantAppId * @param merchantAppId
*/ */
@Override @Override
public JSONObject queryApplicationSubMerchantById(String clientMoniker, String merchantAppId){ public JSONObject queryApplicationSubMerchantById(String clientMoniker, String merchantAppId) {
JSONObject client = clientMapper.findClientByMoniker(clientMoniker); JSONObject client = clientMapper.findClientByMoniker(clientMoniker);
if (client == null) { if (client == null) {
throw new BadRequestException("partner code is not exists!"); throw new BadRequestException("partner code is not exists!");
} }
JSONObject subMerchantApplyInfo = sysWxMerchantApplyMapper.findByClientIdAndSubMerchantAppId(client.getInteger("client_id"), merchantAppId); WechatMerchantInfo subMerchantApplyInfo = wxMerchantApplyMapper.findByClientIdAndSubMerchantAppId(client.getInteger("client_id"), merchantAppId);
JSONObject resultParams = NewSubMerchantIdApply.resultParams(subMerchantApplyInfo); JSONObject resultParams = NewSubMerchantIdApply.resultParams(subMerchantApplyInfo);
resultParams.put("merchant_app_id",subMerchantApplyInfo.getString("merchant_app_id")); resultParams.put("merchant_app_id", subMerchantApplyInfo.getMerchantAppId());
return resultParams; return resultParams;
} }
/** /**
* *
*
* @param clientMoniker * @param clientMoniker
* @param merchantAppId * @param merchantAppId
* @param subMerchantIdApply * @param subMerchantIdApply
@ -5738,7 +5718,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
*/ */
@Override @Override
@CacheEvict(value = ":all_sub_merchant_id_applices:", key = "#clientMoniker") @CacheEvict(value = ":all_sub_merchant_id_applices:", key = "#clientMoniker")
public void changeApplicationSubMerchantById(String clientMoniker, String merchantAppId, NewSubMerchantIdApply subMerchantIdApply, JSONObject manager){ public void changeApplicationSubMerchantById(String clientMoniker, String merchantAppId, NewSubMerchantIdApply subMerchantIdApply, JSONObject manager) {
JSONObject client = clientMapper.findClientByMoniker(clientMoniker); JSONObject client = clientMapper.findClientByMoniker(clientMoniker);
if (client == null) { if (client == null) {
throw new BadRequestException("partner code is not exists!"); throw new BadRequestException("partner code is not exists!");
@ -5746,37 +5726,32 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
checkOrgPermission(manager, client); checkOrgPermission(manager, client);
JSONObject params = subMerchantIdApply.insertObject(client); JSONObject params = subMerchantIdApply.insertObject(client);
params.put("merchant_app_id",merchantAppId); params.put("merchant_app_id", merchantAppId);
SubMerchantInfoInheritance subMerchantInfo = JSONObject.toJavaObject(params, SubMerchantInfoInheritance.class); SubMerchantInfoInheritance subMerchantInfo = JSON.toJavaObject(params, SubMerchantInfoInheritance.class);
params.put("merchant_id", subMerchantIdApply.getMerchant_id()); params.put("merchant_id", subMerchantIdApply.getMerchant_id());
params.put("client_id", client.getString("client_id")); params.put("client_id", client.getString("client_id"));
params.put("create_time", new Date()); params.put("create_time", new Date());
params.put("operator", manager.getString("display_name")); params.put("operator", manager.getString("display_name"));
WxPayMerchantRegister register = Optional.ofNullable(merchantChannelApplicationManager.getRegister(WxPayMerchantRegister.class))
.orElseThrow(() -> new ServerErrorException("No Register found for wechat"));
Element elem = wxPayClient.modfiySubMerchant(subMerchantIdApply.getMerchant_id(), subMerchantInfo); register.modify(merchantAppId, client, subMerchantInfo, manager);
String sub_merchant_id = elem.elementText("sub_mch_id");
if (StringUtils.isNotEmpty(sub_merchant_id)) {
params.put("sub_merchant_id", sub_merchant_id);
sysWxMerchantApplyMapper.updateSubMerchantInfoByMerchantAppId(params);
clearCacheSubMerchantIdApplices(clientMoniker);
} else {
throw new BadRequestException(elem.elementText("return_msg"));
}
} }
@Override @Override
public JSONObject querySubMerchantStatus(String clientMoniker,String subMerchantId){ public JSONObject querySubMerchantStatus(String clientMoniker, String subMerchantId) {
JSONObject client = clientMapper.findClientByMoniker(clientMoniker); JSONObject client = clientMapper.findClientByMoniker(clientMoniker);
if (client == null) { if (client == null) {
throw new BadRequestException("partner code is not exists!"); throw new BadRequestException("partner code is not exists!");
} }
Element elem = wxPayClient.querySubMerchant(client.getString("merchant_id"), subMerchantId); client.put("sub_merchant_id", subMerchantId);
WechatMerchantInfo info = Optional.ofNullable(merchantChannelApplicationManager.getRegister(WxPayMerchantRegister.class))
.map(register -> register.findMerchant(client))
.orElseThrow(() -> new ServerErrorException("No Register found for wechat"));
Element xml = info.getRawResponseXml();
JSONObject object = new JSONObject(); JSONObject object = new JSONObject();
object.put("response_str", xml);
object.put("apply_status", elem.elementText("result_code")); object.put("apply_status", info.getRawResponse());
object.put("response_str", elem.asXML());
return object; return object;
} }
@ -5798,20 +5773,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new BadRequestException("Alipay Industry can't be null"); throw new BadRequestException("Alipay Industry can't be null");
} }
AlipayConfig.AlipayMerchant mch = AlipayEnvironment.getEnv().getAlipayRetailMerchant(); merchantChannelApplicationManager.getRegister(AlipayRetailApi.class).apply(client, new EmptyMerchantApplication(), manager);
Element resultElement = alipayClient.registerGmsPortal(mch.getPid(), client);
if (!StringUtils.equalsIgnoreCase("T", resultElement.elementText("is_success"))) {
throw new BadRequestException(resultElement.elementText("error"));
}
try {
Element responseElement = resultElement.element("response").element("alipay");
if (!StringUtils.equalsIgnoreCase("SUCCESS", responseElement.elementText("result_code"))) {
throw new BadRequestException(responseElement.elementText("result_code") +
":" + responseElement.elementText("reject_reason"));
}
} catch (Exception e) {
throw new ServerErrorException(e);
}
} }
@Override @Override
@ -5821,8 +5783,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new InvalidShortIdException(); throw new InvalidShortIdException();
} }
checkOrgPermission(manager, client); checkOrgPermission(manager, client);
AlipayConfig.AlipayMerchant mch = AlipayEnvironment.getEnv().getAlipayRetailMerchant(); AlipayMerchantEntity alipayMch = merchantChannelApplicationManager.getRegister(AlipayRetailApi.class).findMerchant(client);
Element resultElement = alipayClient.queryGmsPortalStatus(mch.getPid(), client); Element resultElement = alipayMch.getRawResponseXml();
if (!StringUtils.equalsIgnoreCase("T", resultElement.elementText("is_success"))) { if (!StringUtils.equalsIgnoreCase("T", resultElement.elementText("is_success"))) {
return "查询成功:" + resultElement.elementText("error"); return "查询成功:" + resultElement.elementText("error");
} }
@ -5841,7 +5803,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
} }
checkOrgPermission(manager, client); checkOrgPermission(manager, client);
AlipayConfig.AlipayMerchant mch = AlipayEnvironment.getEnv().getAlipayRetailMerchant(); AlipayConfig.AlipayMerchant mch = AlipayEnvironment.getEnv().getAlipayRetailMerchant();
JSONObject queryGMSJson = new JSONObject(new LinkedHashMap()); JSONObject queryGMSJson = new JSONObject(new LinkedHashMap<>());
queryGMSJson.put("service", "alipay.overseas.secmerchant.offline.maintain"); queryGMSJson.put("service", "alipay.overseas.secmerchant.offline.maintain");
queryGMSJson.put("partner", mch.getPid()); queryGMSJson.put("partner", mch.getPid());
queryGMSJson.put("sign_type", "MD5"); queryGMSJson.put("sign_type", "MD5");
@ -5877,7 +5839,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new InvalidShortIdException(); throw new InvalidShortIdException();
} }
checkOrgPermission(manager, client); checkOrgPermission(manager, client);
JSONObject queryGMSJson = new JSONObject(new LinkedHashMap()); JSONObject queryGMSJson = new JSONObject(new LinkedHashMap<>());
AlipayConfig.AlipayMerchant mch = AlipayEnvironment.getEnv().getAlipayOnlineMerchant(); AlipayConfig.AlipayMerchant mch = AlipayEnvironment.getEnv().getAlipayOnlineMerchant();
queryGMSJson.put("service", "alipay.overseas.secmerchant.online.maintain"); queryGMSJson.put("service", "alipay.overseas.secmerchant.online.maintain");
queryGMSJson.put("partner", mch.getPid()); queryGMSJson.put("partner", mch.getPid());
@ -5927,19 +5889,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
} }
AlipayConfig.AlipayMerchant mch = AlipayEnvironment.getEnv().getAlipayOnlineMerchant(); AlipayConfig.AlipayMerchant mch = AlipayEnvironment.getEnv().getAlipayOnlineMerchant();
Element resultElement = alipayClient.registerOnlineGmsPortal(mch.getPid(), client); merchantChannelApplicationManager.getRegister(AlipayOnlineApi.class).apply(client, new EmptyMerchantApplication(), manager);
if (!StringUtils.equalsIgnoreCase("T", resultElement.elementText("is_success"))) {
throw new BadRequestException(resultElement.elementText("error"));
}
try {
Element responseElement = resultElement.element("response").element("alipay");
if (!StringUtils.equalsIgnoreCase("SUCCESS", responseElement.elementText("result_code"))) {
throw new BadRequestException(responseElement.elementText("result_code") +
":" + responseElement.elementText("reject_reason"));
}
} catch (Exception e) {
throw new ServerErrorException(e);
}
} }
@Override @Override
@ -5974,7 +5924,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new InvalidShortIdException(); throw new InvalidShortIdException();
} }
AlipayConfig.AlipayMerchant mch = AlipayEnvironment.getEnv().getAlipayOnlineMerchant(); AlipayConfig.AlipayMerchant mch = AlipayEnvironment.getEnv().getAlipayOnlineMerchant();
Element resultElement = alipayClient.queryOnlineGmsPortalStatus(mch.getPid(), client); AlipayMerchantEntity entity = merchantChannelApplicationManager.getRegister(AlipayOnlineApi.class)
.findMerchant(client);
Element resultElement = entity.getRawResponseXml();
if (!StringUtils.equalsIgnoreCase("T", resultElement.elementText("is_success"))) { if (!StringUtils.equalsIgnoreCase("T", resultElement.elementText("is_success"))) {
return "查询成功:" + resultElement.elementText("error"); return "查询成功:" + resultElement.elementText("error");
} }
@ -6001,20 +5953,14 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new BadRequestException("您已申请成功子商务号,请勿重复申请"); throw new BadRequestException("您已申请成功子商务号,请勿重复申请");
} }
SubRpayMerchantInfo subRpayMerchantInfo = JSONObject.toJavaObject(merchantInfo, SubRpayMerchantInfo.class); SubRpayMerchantInfo subRpayMerchantInfo = JSON.toJavaObject(merchantInfo, SubRpayMerchantInfo.class);
subRpayMerchantInfo.CheckEmpty(); subRpayMerchantInfo.CheckEmpty();
JSONObject rpayMerchantInfo = rpayApi.registerMerchant(client.getIntValue("client_id"), subRpayMerchantInfo); MerchantApplicationResult rpayMerchantInfo = merchantChannelApplicationManager.getRegister(RPayMerchantRegister.class)
.apply(client, subRpayMerchantInfo, manager);
if (rpayMerchantInfo != null) { if (rpayMerchantInfo != null) {
merchantInfo.put("merchant_id", rpayMerchantInfo.getString("rpay_order_id"));
merchantInfo.put("client_id", client.getString("client_id")); clientMapper.updateRpayEnterpriseId(client.getIntValue("client_id"), rpayMerchantInfo.getMid());
merchantInfo.put("create_time", new Date());
merchantInfo.put("operator", manager.getString("display_name"));
merchantInfo.put("sub_merchant_id", rpayMerchantInfo.getString("merchantId"));
merchantInfo.put("business_category", client.getString("royalpayindustry"));
merchantInfo.put("merchant_shortname", merchantInfo.getString("company_shortname"));
sysRpayMerchantApplyMapper.insertRpayMerchantApply(merchantInfo);
clientMapper.updateRpayEnterpriseId(client.getIntValue("client_id"), rpayMerchantInfo.getString("merchantId"));
} else { } else {
throw new BadRequestException("请求失败"); throw new BadRequestException("请求失败");
} }
@ -6036,11 +5982,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
return list; return list;
} }
@Override
@CacheEvict(value = ":all_sub_merchant_id_applices:", key = "#clientMoniker")
public void clearCacheSubMerchantIdApplices(String clientMoniker) {
}
@Override @Override
public JSONObject getCheckClientInfo(int client_id, String account_id, String channel) { public JSONObject getCheckClientInfo(int client_id, String account_id, String channel) {
JSONObject result = null; JSONObject result = null;
@ -6049,67 +5990,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (PartnerRole.getRole(account.getIntValue("role")) == PartnerRole.CASHIER) { if (PartnerRole.getRole(account.getIntValue("role")) == PartnerRole.CASHIER) {
return result; return result;
} else { } else {
if (expireInfo.getBoolean("alert")) { if (expireInfo.getBooleanValue("alert")) {
result = new JSONObject(); result = new JSONObject();
// result.put("content","Dear Valued Merchants,\n" +
// "\n" +
// "\n" +
// "\n" +
// "We would like to extend our warm gratitude to your business for your continued support of RoyalPay.
// Without our merchants we wouldn't be where we are today. \n" +
// "\n" +
// "\n" +
// "\n" +
// "RoyalPay has and always will be committed to complying with all Australian laws, rules and
// regulations. With our deep roots in China, we also work with all Chinese regulations simultaneously
// with Australia. Since our humble beginnings in 2016 we have worked with the ATO (Australian Tax
// Office) to make sure that we are in alignment with all tax requirements. \n" +
// "\n" +
// "\n" +
// "\n" +
// "\n" +
// "During FY18 we entered negotiations with the ATO to file for GST exemptions for the part of
// surcharge fees. The ATO has recently advised that we have been unsuccessful in this bid. To ensure we
// comply with the ATO, we will need to adjust our current service agreements to be exclusionary of GST.
// \n" +
// "\n" +
// "\n" +
// "\n" +
// "This will result in contractual changes to your agreement. However, your business may be eligible to
// claim this amount back depending on the tax relationship of your business. Please consult with your
// accounting team in relation to these changes. \n" +
// "\n" +
// "\n" +
// "\n" +
// "If you have any questions related to this change please direct them to our Sales Management Team or
// your relevant BD officer.\n" +
// "\n" +
// "\n" +
// "\n" +
// "(note: GST is for the surcharge fee only, not related to the price of the goods.)\n" +
// "\n" +
// "\n" +
// "\n" +
// "尊敬的商户,\n" +
// "\n" +
// "\n" +
// "\n" +
// "\n" +
// "感谢您选择RoyalPay。作为澳洲移动支付的先行者和领导者RoyalPay自2016年起就开始针对交易手续费这一澳洲目前空白的税务问题对接澳大利亚相关监管机构。作为市场上全新的支付模式这两年来我们不断地与相关机构探讨最为合适的监管法令应用同时澳洲的相应法律法规也在不断地完善来提供更全面的监管来营造更加稳定、健康、健全的金融市场。\n"
// +
// "\n" +
// "\n" +
// "\n" +
// "RoyalPay于近期正式收到澳洲监管机构的通知针对手续费Tax Free的申请和特殊税务条款考量做出了相应的回复目前澳洲市场上的移动支付扫码解决方案所产生的手续费部分的GST并不能享受Tax
// Free及部分减免的政策条款。我们已经替2018年前交易的商户补足了手续费部分的税金并应澳大利亚税务局ATO的要求进行了合同上手续费GST部分的相应调整。您也可咨询专业的会计师来申请您额外的手续费GST
// Return。感谢您的支持和理解愿我们一起共同努力塑造一个良好而有序的澳洲移动支付市场。\n" +
// "\n" +
// "\n" +
// "\n" +
// "有任何疑问,请随时联络我们的客服与公众号。\n" +
// "\n" +
// "GST只针对手续费部分与商品价格无关\n" +
// "\n");
result.put("content", result.put("content",
"<p class=\"p1\"><span style=\"font-size: 20px;\"></span></p><p class=\"p1\"><span style=\"font-size: 20px;\">Dear Valued Merchants,</span></p><p class=\"p2\"><span style=\"font-size: 20px;\"><br/></span></p><p class=\"p1\"><span style=\"font-size: 20px;\">We would like to extend our warm gratitude to your business for your continued support of RoyalPay. Without our merchants we wouldn&#39;t be where we are today.&nbsp;</span></p><p class=\"p2\"><span style=\"font-size: 20px;\"><br/></span></p><p class=\"p1\"><span style=\"font-size: 20px;\">RoyalPay has and always will be committed to complying with all Australian laws, rules and regulations. With our deep roots in China, we also work with all Chinese regulations simultaneously with Australia. Since our humble beginnings in 2016 we have worked with the ATO (Australian Tax Office) to make sure that we are in alignment with all tax requirements.&nbsp;</span></p><p class=\"p2\"><span style=\"font-size: 20px;\"><br/></span></p><p class=\"p1\"><span style=\"font-size: 20px;\"></span></p><p><span style=\"font-size: 20px;\">During FY18 we entered negotiations with the ATO to file for GST exemptions for the part of surcharge fees. The ATO has recently advised that we have been unsuccessful in this bid. To ensure we comply with the ATO, we will need to adjust our current service agreements to be exclusionary of GST.&nbsp;</span></p><p><br/></p><p><span style=\"font-size: 20px;\">This will result in contractual changes to your agreement. However, your business may be eligible to claim this amount back depending on the tax relationship of your business. Please consult with your accounting team in relation to these changes.&nbsp;</span></p><p><span style=\"font-size: 20px;\"><br/></span></p><p><span style=\"font-size: 20px;\">If you have any questions related to this change please direct them to our Sales Management Team or your relevant BD officer.</span><br/></p><p><br/></p><p><strong><span style=\"font-size: 20px;\">(note: GST is for the surcharge fee only, not related to the price of the goods.)</span></strong></p><p class=\"p1\"><br/></p><p class=\"p1\"><span style=\"font-size: 20px;\">尊敬的商户,<br/></span></p><p class=\"p2\"><span style=\"font-size: 20px;\"></span></p><p class=\"p2\"><span style=\"font-size: 20px;\"><br/></span></p><p class=\"p3\"><span style=\"font-size: 20px;\">感谢您选择RoyalPay。作为澳洲移动支付的先行者和领导者RoyalPay自2016年起就开始针对交易手续费这一澳洲目前空白的税务问题对接澳大利亚相关监管机构。作为市场上全新的支付模式这两年来我们不断地与相关机构探讨最为合适的监管法令应用同时澳洲的相应法律法规也在不断地完善来提供更全面的监管来营造更加稳定、健康、健全的金融市场。</span></p><p class=\"p2\"><span style=\"font-size: 20px;\"><br/></span></p><p class=\"p3\"><span style=\"font-size: 20px;\">RoyalPay于近期正式收到澳洲监管机构的通知针对手续费Tax Free的申请和特殊税务条款考量做出了相应的回复目前澳洲市场上的移动支付扫码解决方案所产生的手续费部分的GST并不能享受Tax Free及部分减免的政策条款。我们已经替2018年前交易的商户补足了手续费部分的税金并应澳大利亚税务局ATO的要求进行了合同上手续费GST部分的相应调整。您也可咨询专业的会计师来申请您额外的手续费GST Return。感谢您的支持和理解愿我们一起共同努力塑造一个良好而有序的澳洲移动支付市场。</span></p><p class=\"p2\"><span style=\"font-size: 20px;\"><br/></span></p><p class=\"p3\"><span style=\"font-size: 20px;\">有任何疑问,请随时联络我们的客服与公众号。</span></p><p class=\"p3\"><strong><span style=\"font-size: 20px;\">GST只针对手续费部分与商品价格无关</span></strong></p><p><br/></p>"); "<p class=\"p1\"><span style=\"font-size: 20px;\"></span></p><p class=\"p1\"><span style=\"font-size: 20px;\">Dear Valued Merchants,</span></p><p class=\"p2\"><span style=\"font-size: 20px;\"><br/></span></p><p class=\"p1\"><span style=\"font-size: 20px;\">We would like to extend our warm gratitude to your business for your continued support of RoyalPay. Without our merchants we wouldn&#39;t be where we are today.&nbsp;</span></p><p class=\"p2\"><span style=\"font-size: 20px;\"><br/></span></p><p class=\"p1\"><span style=\"font-size: 20px;\">RoyalPay has and always will be committed to complying with all Australian laws, rules and regulations. With our deep roots in China, we also work with all Chinese regulations simultaneously with Australia. Since our humble beginnings in 2016 we have worked with the ATO (Australian Tax Office) to make sure that we are in alignment with all tax requirements.&nbsp;</span></p><p class=\"p2\"><span style=\"font-size: 20px;\"><br/></span></p><p class=\"p1\"><span style=\"font-size: 20px;\"></span></p><p><span style=\"font-size: 20px;\">During FY18 we entered negotiations with the ATO to file for GST exemptions for the part of surcharge fees. The ATO has recently advised that we have been unsuccessful in this bid. To ensure we comply with the ATO, we will need to adjust our current service agreements to be exclusionary of GST.&nbsp;</span></p><p><br/></p><p><span style=\"font-size: 20px;\">This will result in contractual changes to your agreement. However, your business may be eligible to claim this amount back depending on the tax relationship of your business. Please consult with your accounting team in relation to these changes.&nbsp;</span></p><p><span style=\"font-size: 20px;\"><br/></span></p><p><span style=\"font-size: 20px;\">If you have any questions related to this change please direct them to our Sales Management Team or your relevant BD officer.</span><br/></p><p><br/></p><p><strong><span style=\"font-size: 20px;\">(note: GST is for the surcharge fee only, not related to the price of the goods.)</span></strong></p><p class=\"p1\"><br/></p><p class=\"p1\"><span style=\"font-size: 20px;\">尊敬的商户,<br/></span></p><p class=\"p2\"><span style=\"font-size: 20px;\"></span></p><p class=\"p2\"><span style=\"font-size: 20px;\"><br/></span></p><p class=\"p3\"><span style=\"font-size: 20px;\">感谢您选择RoyalPay。作为澳洲移动支付的先行者和领导者RoyalPay自2016年起就开始针对交易手续费这一澳洲目前空白的税务问题对接澳大利亚相关监管机构。作为市场上全新的支付模式这两年来我们不断地与相关机构探讨最为合适的监管法令应用同时澳洲的相应法律法规也在不断地完善来提供更全面的监管来营造更加稳定、健康、健全的金融市场。</span></p><p class=\"p2\"><span style=\"font-size: 20px;\"><br/></span></p><p class=\"p3\"><span style=\"font-size: 20px;\">RoyalPay于近期正式收到澳洲监管机构的通知针对手续费Tax Free的申请和特殊税务条款考量做出了相应的回复目前澳洲市场上的移动支付扫码解决方案所产生的手续费部分的GST并不能享受Tax Free及部分减免的政策条款。我们已经替2018年前交易的商户补足了手续费部分的税金并应澳大利亚税务局ATO的要求进行了合同上手续费GST部分的相应调整。您也可咨询专业的会计师来申请您额外的手续费GST Return。感谢您的支持和理解愿我们一起共同努力塑造一个良好而有序的澳洲移动支付市场。</span></p><p class=\"p2\"><span style=\"font-size: 20px;\"><br/></span></p><p class=\"p3\"><span style=\"font-size: 20px;\">有任何疑问,请随时联络我们的客服与公众号。</span></p><p class=\"p3\"><strong><span style=\"font-size: 20px;\">GST只针对手续费部分与商品价格无关</span></strong></p><p><br/></p>");
result.put("title", "【Important重要】GST Modification Notice | 澳洲监管机构关于手续费GST调整问题通知\n"); result.put("title", "【Important重要】GST Modification Notice | 澳洲监管机构关于手续费GST调整问题通知\n");
@ -6686,9 +6568,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}); });
needNotifyUsers.forEach(userOpenId -> { needNotifyUsers.forEach(userOpenId -> {
try { try {
MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); MpWechatApi wxApi = mpWechatApiProvider.getNewPaymentApi();
TemplateMessage msg = initSendTestPasswordTemplate(userOpenId, paymentApi.getTemplateId("test-merchant-password")); TemplateMessage msg = initSendTestPasswordTemplate(userOpenId, wxApi.getTemplateId("test-merchant-password"));
paymentApi.sendTemplateMessage(msg); wxApi.sendTemplateMessage(msg);
} catch (Exception e) { } catch (Exception e) {
logger.error("给{}发送微信消息失败,原因:{}", userOpenId, e); logger.error("给{}发送微信消息失败,原因:{}", userOpenId, e);
} }

@ -1,6 +1,7 @@
package au.com.royalpay.payment.manage.merchants.web; package au.com.royalpay.payment.manage.merchants.web;
import au.com.royalpay.payment.channels.rpaypaymentsvc.runtime.request.entities.RPayMerchantEntity; import au.com.royalpay.payment.channels.rpaypaymentsvc.runtime.request.entities.RPayMerchantEntity;
import au.com.royalpay.payment.core.beans.ChannelMerchantInfo;
import au.com.royalpay.payment.core.exceptions.InvalidShortIdException; import au.com.royalpay.payment.core.exceptions.InvalidShortIdException;
import au.com.royalpay.payment.manage.dev.core.MerchantLocationService; import au.com.royalpay.payment.manage.dev.core.MerchantLocationService;
import au.com.royalpay.payment.manage.merchants.beans.*; import au.com.royalpay.payment.manage.merchants.beans.*;
@ -826,7 +827,7 @@ public class PartnerManageController {
} }
@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) { public List<ChannelMerchantInfo> listSubMerchantIdApplys(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return clientManager.listSubMerchantIdApplys(manager, clientMoniker); return clientManager.listSubMerchantIdApplys(manager, clientMoniker);
} }
@ -836,6 +837,7 @@ public class PartnerManageController {
} }
@ManagerMapping(value = "/{clientMoniker}/sub_apply", method = RequestMethod.POST, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN}) @ManagerMapping(value = "/{clientMoniker}/sub_apply", method = RequestMethod.POST, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN})
@Deprecated
public String subMerchantApplication(@PathVariable String clientMoniker, @RequestBody SubMerchantIdApply subMerchantIdApply, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { 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);
} }

@ -11,6 +11,7 @@ import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.env.PlatformEnvironment; import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import au.com.royalpay.payment.tools.env.SysConfigManager; import au.com.royalpay.payment.tools.env.SysConfigManager;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider; import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import au.com.royalpay.payment.tools.utils.Currency;
import au.com.royalpay.payment.tools.utils.CurrencyAmountUtils; import au.com.royalpay.payment.tools.utils.CurrencyAmountUtils;
import cn.yixblog.platform.http.HttpRequestGenerator; import cn.yixblog.platform.http.HttpRequestGenerator;
import cn.yixblog.platform.http.HttpRequestResult; import cn.yixblog.platform.http.HttpRequestResult;
@ -59,6 +60,7 @@ public class CtripCouponOnlyLogProcessor implements PaymentProcessor {
private CouponAccuessLogMapper payCouponAccuessLogMapper; private CouponAccuessLogMapper payCouponAccuessLogMapper;
@Resource @Resource
private PaymentApi paymentApi; private PaymentApi paymentApi;
@Override @Override
public String processorId() { public String processorId() {
return COUPON_ID + "_USE"; return COUPON_ID + "_USE";
@ -82,7 +84,7 @@ public class CtripCouponOnlyLogProcessor implements PaymentProcessor {
} }
BigDecimal payFee = paymentInfo.getTotalFee(); BigDecimal payFee = paymentInfo.getTotalFee();
BigDecimal exchange = paymentApi.channelApi(paymentInfo.getChannel()).queryExchangeRateDecimal(paymentInfo.getClientId()); BigDecimal exchange = paymentApi.channelApi(paymentInfo.getChannel()).queryExchangeRateDecimal(paymentInfo.getClientId());
if (StringUtils.equals(paymentInfo.getCurrency(), "CNY")) { if (paymentInfo.getCurrency() == Currency.CNY) {
payFee = CurrencyAmountUtils.scale(payFee.divide(exchange, 2, RoundingMode.HALF_UP), PlatformEnvironment.getEnv().getForeignCurrency()); payFee = CurrencyAmountUtils.scale(payFee.divide(exchange, 2, RoundingMode.HALF_UP), PlatformEnvironment.getEnv().getForeignCurrency());
} }
BigDecimal couponCondition = couponInfo.getBigDecimal("condition") == null ? BigDecimal.ZERO BigDecimal couponCondition = couponInfo.getBigDecimal("condition") == null ? BigDecimal.ZERO
@ -91,15 +93,15 @@ public class CtripCouponOnlyLogProcessor implements PaymentProcessor {
return; return;
} }
JSONObject couponAccuessLog = new JSONObject(); JSONObject couponAccuessLog = new JSONObject();
couponAccuessLog.put("client_id",order.getIntValue("client_id")); couponAccuessLog.put("client_id", order.getIntValue("client_id"));
couponAccuessLog.put("customer_openid","创建订单时无"); couponAccuessLog.put("customer_openid", "创建订单时无");
couponAccuessLog.put("creation_date",new Date()); couponAccuessLog.put("creation_date", new Date());
couponAccuessLog.put("order_id",order.getString("order_id")); couponAccuessLog.put("order_id", order.getString("order_id"));
couponAccuessLog.put("coupon_id","CTRIP_"+tmpEle.getString("ctrip_coupon_id")); couponAccuessLog.put("coupon_id", "CTRIP_" + tmpEle.getString("ctrip_coupon_id"));
//携程满减 //携程满减
if (StringUtils.equals(couponInfo.getString("type"), "31")) { if (StringUtils.equals(couponInfo.getString("type"), "31")) {
BigDecimal actureAmount = couponInfo.getBigDecimal("acture_amount"); BigDecimal actureAmount = couponInfo.getBigDecimal("acture_amount");
if (StringUtils.equals(paymentInfo.getCurrency(), "CNY")) { if (paymentInfo.getCurrency() == Currency.CNY) {
actureAmount = CurrencyAmountUtils.scale(couponInfo.getBigDecimal("acture_amount").multiply(exchange), PlatformEnvironment.getEnv().getForeignCurrency()); actureAmount = CurrencyAmountUtils.scale(couponInfo.getBigDecimal("acture_amount").multiply(exchange), PlatformEnvironment.getEnv().getForeignCurrency());
} }
couponAccuessLog.put("coupon_deal_amount", actureAmount); couponAccuessLog.put("coupon_deal_amount", actureAmount);
@ -164,7 +166,7 @@ public class CtripCouponOnlyLogProcessor implements PaymentProcessor {
} }
// 使用券的信息 // 使用券的信息
private JSONObject getPreOrderCoupon(String couponLogId,int clientId) { private JSONObject getPreOrderCoupon(String couponLogId, int clientId) {
JSONObject client = merchantInfoProvider.getClientInfo(clientId); JSONObject client = merchantInfoProvider.getClientInfo(clientId);
String timestamp = System.currentTimeMillis() + ""; String timestamp = System.currentTimeMillis() + "";
String base = CUSTOMER_APP_ID + timestamp + CUSTOMER_AUTH_CODE; String base = CUSTOMER_APP_ID + timestamp + CUSTOMER_AUTH_CODE;

@ -11,9 +11,11 @@ import au.com.royalpay.payment.core.mappers.PmtOrderMapper;
import au.com.royalpay.payment.core.processors.PaymentProcessor; import au.com.royalpay.payment.core.processors.PaymentProcessor;
import au.com.royalpay.payment.manage.mappers.log.CouponAccuessLogMapper; import au.com.royalpay.payment.manage.mappers.log.CouponAccuessLogMapper;
import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.defines.Money;
import au.com.royalpay.payment.tools.env.PlatformEnvironment; import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import au.com.royalpay.payment.tools.env.SysConfigManager; import au.com.royalpay.payment.tools.env.SysConfigManager;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider; import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import au.com.royalpay.payment.tools.utils.Currency;
import au.com.royalpay.payment.tools.utils.CurrencyAmountUtils; import au.com.royalpay.payment.tools.utils.CurrencyAmountUtils;
import cn.yixblog.platform.http.HttpRequestGenerator; import cn.yixblog.platform.http.HttpRequestGenerator;
import cn.yixblog.platform.http.HttpRequestResult; import cn.yixblog.platform.http.HttpRequestResult;
@ -91,7 +93,7 @@ public class CtripCouponProvideProcessor implements PaymentProcessor {
} }
BigDecimal payFee = paymentInfo.getTotalFee(); BigDecimal payFee = paymentInfo.getTotalFee();
BigDecimal exchange = paymentApi.channelApi(paymentInfo.getChannel()).queryExchangeRateDecimal(paymentInfo.getClientId()); BigDecimal exchange = paymentApi.channelApi(paymentInfo.getChannel()).queryExchangeRateDecimal(paymentInfo.getClientId());
if (StringUtils.equals(paymentInfo.getCurrency(), "CNY")) { if (paymentInfo.getCurrency() == Currency.CNY) {
payFee = CurrencyAmountUtils.scale(payFee.divide(exchange, 2, RoundingMode.HALF_UP), PlatformEnvironment.getEnv().getForeignCurrency()); payFee = CurrencyAmountUtils.scale(payFee.divide(exchange, 2, RoundingMode.HALF_UP), PlatformEnvironment.getEnv().getForeignCurrency());
} }
BigDecimal couponCondition = couponInfo.getBigDecimal("condition") == null ? BigDecimal.ZERO BigDecimal couponCondition = couponInfo.getBigDecimal("condition") == null ? BigDecimal.ZERO
@ -109,7 +111,7 @@ public class CtripCouponProvideProcessor implements PaymentProcessor {
//携程满减 //携程满减
if (StringUtils.equals(couponInfo.getString("type"), "31")) { if (StringUtils.equals(couponInfo.getString("type"), "31")) {
BigDecimal actureAmount = couponInfo.getBigDecimal("acture_amount"); BigDecimal actureAmount = couponInfo.getBigDecimal("acture_amount");
if (StringUtils.equals(paymentInfo.getCurrency(), "CNY")) { if (paymentInfo.getCurrency() == Currency.CNY) {
actureAmount = CurrencyAmountUtils.scale(couponInfo.getBigDecimal("acture_amount").multiply(exchange), PlatformEnvironment.getEnv().getForeignCurrency()); actureAmount = CurrencyAmountUtils.scale(couponInfo.getBigDecimal("acture_amount").multiply(exchange), PlatformEnvironment.getEnv().getForeignCurrency());
} }
paymentInfo.setDiscount(currentDiscount.add(actureAmount)); paymentInfo.setDiscount(currentDiscount.add(actureAmount));
@ -127,15 +129,15 @@ public class CtripCouponProvideProcessor implements PaymentProcessor {
payCouponAccuessLogMapper.save(couponAccuessLog); payCouponAccuessLogMapper.save(couponAccuessLog);
JSONObject updateOrder = new JSONObject(); JSONObject updateOrder = new JSONObject();
BigDecimal customerPay = paymentInfo.getUserPayAmount(); Money customerPay = paymentInfo.getUserPayAmount();
updateOrder.put("customer_payment_amount", customerPay); updateOrder.put("customer_payment_amount", customerPay.getAmount());
BigDecimal couponDiscount = paymentInfo.getDiscount(); BigDecimal couponDiscount = paymentInfo.getDiscount();
updateOrder.put("coupon_payment_amount", couponDiscount); updateOrder.put("coupon_payment_amount", couponDiscount);
updateOrder.put("order_id", paymentInfo.getOrderId()); updateOrder.put("order_id", paymentInfo.getOrderId());
pmtOrderMapper.update(updateOrder); pmtOrderMapper.update(updateOrder);
order.put("customer_payment_amount", customerPay); order.put("customer_payment_amount", customerPay.getAmount());
order.put("coupon_payment_amount", couponDiscount); order.put("coupon_payment_amount", couponDiscount);
} }

@ -1,7 +1,6 @@
package au.com.royalpay.payment.manage.tradelog.refund.impls; package au.com.royalpay.payment.manage.tradelog.refund.impls;
import au.com.royalpay.payment.core.PaymentApi; import au.com.royalpay.payment.core.PaymentApi;
import au.com.royalpay.payment.core.beans.OperatorType;
import au.com.royalpay.payment.core.exceptions.RefundExistException; import au.com.royalpay.payment.core.exceptions.RefundExistException;
import au.com.royalpay.payment.manage.analysis.beans.RefundReviewBean; import au.com.royalpay.payment.manage.analysis.beans.RefundReviewBean;
import au.com.royalpay.payment.manage.mappers.log.CouponAccuessLogMapper; import au.com.royalpay.payment.manage.mappers.log.CouponAccuessLogMapper;
@ -16,6 +15,7 @@ import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.tradelog.refund.RefundService; import au.com.royalpay.payment.manage.tradelog.refund.RefundService;
import au.com.royalpay.payment.manage.tradelog.refund.events.NewRefundReviewEvent; import au.com.royalpay.payment.manage.tradelog.refund.events.NewRefundReviewEvent;
import au.com.royalpay.payment.manage.tradelog.refund.events.RefundRefunseEvent; import au.com.royalpay.payment.manage.tradelog.refund.events.RefundRefunseEvent;
import au.com.royalpay.payment.tools.defines.OperatorType;
import au.com.royalpay.payment.tools.env.PlatformEnvironment; import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import au.com.royalpay.payment.tools.env.mappers.SysConfigMapper; import au.com.royalpay.payment.tools.env.mappers.SysConfigMapper;
import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.BadRequestException;

@ -5726,101 +5726,6 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
$scope.loadSubMerchantInfos(); $scope.loadSubMerchantInfos();
}) })
} }
// $scope.useRpaySubMerchantId = function (sub_merchant_id) {
// $http.put('/sys/partners/' + $scope.partner.client_moniker + '/rpay_payment_config', { rpay_enterprise_id: sub_merchant_id }).then(function (resp) {
// commonDialog.alert({
// title: 'Success',
// content: 'Modify Rpay+ Sub Merchant ID successfully',
// type: 'success'
// });
// $state.reload();
// }, function (resp) {
// commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' })
// });
// }
// $scope.useYeepaySubMerchantId = function (sub_merchant_id) {
// $http.put('/sys/partners/' + $scope.partner.client_moniker + '/yeepay_payment_config', { yeepay_sub_merchant_id: sub_merchant_id }).then(function (resp) {
// commonDialog.alert({
// title: 'Success',
// content: 'Modify Yeepay Sub Merchant ID successfully',
// type: 'success'
// });
// $state.reload();
// }, function (resp) {
// commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' })
// });
// }
// $scope.applyWxSubMerchantId = function () {
// $uibModal.open({
// templateUrl: '/static/payment/partner/templates/apply_wx_sub_merchant_id.html',
// controller: 'applyWxSubMerchantIdCtrl',
// resolve: {
// subMerchantInfo: function () {
// return $scope.partner;
// },
// merchantIds: ['$http', '$stateParams', function ($http) {
// return $http.get('/sys/partners/' + $scope.partner.client_moniker + '/get_merchant_ids');
// }]
// }
// }).result.then(function () {
// $scope.loadSubMerchantInfos();
// })
// };
// $scope.applyRpaySubMerchantId = function () {
// $uibModal.open({
// templateUrl: '/static/payment/partner/templates/apply_rpay_sub_merchant_id.html',
// controller: 'applyRpaySubMerchantIdCtrl',
// resolve: {
// subMerchantInfo: function () {
// return $scope.partner;
// }
// }
// }).result.then(function () {
// $scope.loadSubMerchantInfos();
// })
// };
// $scope.applyYeepaySubMerchantId = function () {
// $uibModal.open({
// templateUrl: '/static/payment/partner/templates/apply_yeepay_sub_merchant_id.html',
// controller: 'applyYeepaySubMerchantIdCtrl',
// resolve: {
// subMerchantInfo: function () {
// return $scope.partner;
// }
// }
// }).result.then(function () {
// $scope.loadSubMerchantInfos();
// })
// };
// $scope.addYeepaySubMerchantId = function () {
// $uibModal.open({
// templateUrl: '/static/payment/partner/templates/add_yeepay_sub_merchant_id.html',
// controller: 'addYeepaySubMerchantIdCtrl',
// resolve: {
// subMerchantInfo: function () {
// return $scope.partner;
// }
// }
// }).result.then(function () {
// $scope.loadSubMerchantInfos();
// })
// };
// $scope.updateYeepaySubMerchantId = function (sub_merchant_id) {
// $uibModal.open({
// templateUrl: '/static/payment/partner/templates/update_yeepay_sub_merchant_id.html',
// controller: 'updateYeepaySubMerchantIdCtrl',
// resolve: {
// subMerchantInfo: function () {
// return $scope.partner;
// },
// subMerchantId: function () {
// return sub_merchant_id;
// }
// }
// }).result.then(function () {
// $scope.loadSubMerchantInfos();
// })
// };
}]); }]);
app.controller('applyWxSubMerchantIdCtrl', ['$scope', '$http', '$uibModal', '$state', 'subMerchantInfo', '$filter', 'merchantIds', 'commonDialog', function ($scope, $http, $uibModal, $state, subMerchantInfo, $filter, merchantIds, commonDialog) { app.controller('applyWxSubMerchantIdCtrl', ['$scope', '$http', '$uibModal', '$state', 'subMerchantInfo', '$filter', 'merchantIds', 'commonDialog', function ($scope, $http, $uibModal, $state, subMerchantInfo, $filter, merchantIds, commonDialog) {
$scope.wxIndustries = angular.copy(wxMerchantIndustries); $scope.wxIndustries = angular.copy(wxMerchantIndustries);

Loading…
Cancel
Save