From 2d953d2dcaa5f815b801bc23a5d310120cea8fc9 Mon Sep 17 00:00:00 2001 From: yixian Date: Thu, 11 Mar 2021 15:20:53 +0800 Subject: [PATCH] match 2.2.27 --- pom.xml | 2 +- .../OneDollarDayActivitySupportImpl.java | 7 +- .../impls/PartnerCardDashboardServiceImp.java | 10 +- .../beans/NewSubMerchantIdApply.java | 48 +- .../manage/merchants/core/ClientManager.java | 6 +- .../core/impls/ClientManagerImpl.java | 434 +++++++----------- .../web/PartnerManageController.java | 4 +- .../CtripCouponOnlyLogProcessor.java | 18 +- .../CtripCouponProvideProcessor.java | 12 +- .../refund/impls/RefundServiceImpl.java | 2 +- .../static/payment/partner/partner-manage.js | 95 ---- 11 files changed, 217 insertions(+), 421 deletions(-) diff --git a/pom.xml b/pom.xml index 7d409829d..c3dae2efc 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ au.com.royalpay.payment payment-parent - 2.2.26 + 2.2.27 4.0.0 manage diff --git a/src/main/java/au/com/royalpay/payment/manage/activities/diet/core/impls/OneDollarDayActivitySupportImpl.java b/src/main/java/au/com/royalpay/payment/manage/activities/diet/core/impls/OneDollarDayActivitySupportImpl.java index 638bb9133..6a46ae9d3 100644 --- a/src/main/java/au/com/royalpay/payment/manage/activities/diet/core/impls/OneDollarDayActivitySupportImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/activities/diet/core/impls/OneDollarDayActivitySupportImpl.java @@ -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.env.SysConfigManager; 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 com.alibaba.fastjson.JSONObject; import com.github.miemiedev.mybatis.paginator.domain.Order; @@ -81,12 +82,12 @@ public class OneDollarDayActivitySupportImpl implements OneDollarDayActivity, Pa JSONObject dietOrderInfo = new JSONObject(); dietOrderInfo.put("order_id", orderId); dietOrderInfo.put("client_id", paymentInfo.getClientId()); - String currency = paymentInfo.getCurrency(); + Currency currency = paymentInfo.getCurrency(); dietOrderInfo.put("order_currency", currency); BigDecimal totalFee = paymentInfo.getTotalFee(); BigDecimal payAmount = totalFee.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); payLocalCurrency = payLocalCurrency.divide(exchange, 2, RoundingMode.DOWN); } @@ -95,7 +96,7 @@ public class OneDollarDayActivitySupportImpl implements OneDollarDayActivity, Pa } BigDecimal discount; dietOrderInfo.put("order_amount", totalFee.divide(CommonConsts.HUNDRED, 2, RoundingMode.DOWN)); - if (!"AUD".equals(currency)) { + if (currency != Currency.AUD) { BigDecimal exchange = mpPaymentApi.queryExchangeRateDecimal(clientId); discount = DISCOUNT_AMOUNT.multiply(exchange).setScale(2, RoundingMode.DOWN); } else { diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PartnerCardDashboardServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PartnerCardDashboardServiceImp.java index 99f6556e9..264b6d7c4 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PartnerCardDashboardServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PartnerCardDashboardServiceImp.java @@ -79,7 +79,7 @@ public class PartnerCardDashboardServiceImp implements PartnerCardDashboardServi @Override public JSONObject getTransactionAnalysis(String clientMoniker) { JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker); - Assert.notNull(client); + Assert.notNull(client, "client not found"); JSONObject params = new JSONObject(); params.put("client_id", client.getIntValue("client_id")); return transactionAnalysisMapper.getTransactionCommonAnalysis(params); @@ -88,7 +88,7 @@ public class PartnerCardDashboardServiceImp implements PartnerCardDashboardServi @Override public List getOrderCustomerChartAnalysis(String clientMoniker) { JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker); - Assert.notNull(client); + Assert.notNull(client, "client not found"); JSONObject params = new JSONObject(); params.put("client_id", client.getIntValue("client_id")); return customerAndOrdersStatisticsMapper.getPartnerCustomerAndOrderStatistics(params); @@ -97,7 +97,7 @@ public class PartnerCardDashboardServiceImp implements PartnerCardDashboardServi @Override public List getTransTypesAnalysis(String clientMoniker) { JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker); - Assert.notNull(client); + Assert.notNull(client, "client not found"); JSONObject params = new JSONObject(); params.put("client_id", client.getIntValue("client_id")); return dashboardService.getTradeInTypes(params); @@ -106,7 +106,7 @@ public class PartnerCardDashboardServiceImp implements PartnerCardDashboardServi @Override public JSONObject getOrderAndCustomerPerDay(String clientMoniker) { JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker); - Assert.notNull(client); + Assert.notNull(client, "client not found"); JSONObject params = new JSONObject(); params.put("client_id", client.getIntValue("client_id")); return customerAndOrdersStatisticsMapper.getAvgOrderAndCustomerStatistics(params); @@ -115,7 +115,7 @@ public class PartnerCardDashboardServiceImp implements PartnerCardDashboardServi @Override public List getTradeAnalysisInHours(String clientMoniker) { JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker); - Assert.notNull(client); + Assert.notNull(client, "client not found"); JSONObject earlistOrder = transactionAnalysisMapper.getEarliestOrder(client.getIntValue("client_id")); String timezone = client.getString("timezone"); AnalysisBean analysisBean = new AnalysisBean(); diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/beans/NewSubMerchantIdApply.java b/src/main/java/au/com/royalpay/payment/manage/merchants/beans/NewSubMerchantIdApply.java index 30309d852..b8e2b88a4 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/beans/NewSubMerchantIdApply.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/beans/NewSubMerchantIdApply.java @@ -1,5 +1,7 @@ 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.annotation.JSONField; import org.apache.commons.lang3.StringUtils; @@ -148,29 +150,29 @@ public class NewSubMerchantIdApply { return params; } - public static JSONObject resultParams(JSONObject subMerchantApplyInfo){ - return new JSONObject(){{ - put("company_name",subMerchantApplyInfo.getString("merchant_name")); - put("merchant_id",subMerchantApplyInfo.getString("merchant_id")); - put("short_name",subMerchantApplyInfo.getString("merchant_shortname")); - put("company_phone",subMerchantApplyInfo.getString("office_phone")); - put("contact_person",subMerchantApplyInfo.getString("contact_name")); - put("contact_phone",subMerchantApplyInfo.getString("contact_phone")); - put("contact_email",subMerchantApplyInfo.getString("contact_email")); - put("industry",subMerchantApplyInfo.getString("business_category")); - put("company_website",subMerchantApplyInfo.getString("website")); - put("mcc_code",subMerchantApplyInfo.getString("mcc_code")); - put("address",subMerchantApplyInfo.getString("stores_address")); - put("company_register_no",subMerchantApplyInfo.getString("extra_reg_cer_number")); - put("certificat_expire_date",subMerchantApplyInfo.getString("extra_reg_cer_exp_date")); - put("merchant_type",subMerchantApplyInfo.getString("extra_merchant_type")); - put("director_name",subMerchantApplyInfo.getString("director_name")); - put("director_id_number",subMerchantApplyInfo.getString("director_id_number")); - put("principal_name",subMerchantApplyInfo.getString("principal_name")); - put("principal_id_number",subMerchantApplyInfo.getString("principal_id_number")); - put("business_type",subMerchantApplyInfo.getString("business_type")); - put("sub_merchant_id",subMerchantApplyInfo.getString("sub_merchant_id")); - }}; + public static JSONObject resultParams(WechatMerchantInfo subMerchantApplyInfo){ + return JsonUtils.newJson(json->{ + json.put("company_name",subMerchantApplyInfo.getMerchantName()); + json.put("merchant_id",subMerchantApplyInfo.getMerchantId()); + json.put("short_name",subMerchantApplyInfo.getMerchantShortname()); + json.put("company_phone",subMerchantApplyInfo.getOfficePhone()); + json.put("contact_person",subMerchantApplyInfo.getContactName()); + json.put("contact_phone",subMerchantApplyInfo.getContactPhone()); + json.put("contact_email",subMerchantApplyInfo.getContactEmail()); + json.put("industry",subMerchantApplyInfo.getBusinessCategory()); + json.put("company_website",subMerchantApplyInfo.getWebsite()); + json.put("mcc_code",subMerchantApplyInfo.getMccCode()); + json.put("address",subMerchantApplyInfo.getStoresAddress()); + json.put("company_register_no",subMerchantApplyInfo.getExtraRegCerNumber()); + json.put("certificat_expire_date",subMerchantApplyInfo.getExtraRegCerExpDate()); + json.put("merchant_type",subMerchantApplyInfo.getExtraMerchantType()); + json.put("director_name",subMerchantApplyInfo.getDirectorName()); + json.put("director_id_number",subMerchantApplyInfo.getDirectorIdNumber()); + json.put("principal_name",subMerchantApplyInfo.getPrincipalName()); + json.put("principal_id_number",subMerchantApplyInfo.getPrincipalIdNumber()); + json.put("business_type",subMerchantApplyInfo.getBusinessType()); + json.put("sub_merchant_id",subMerchantApplyInfo.getSubMerchantId()); + }); } public NewSubMerchantIdApply() { diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java index 66661665e..def6bff51 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java @@ -1,6 +1,7 @@ package au.com.royalpay.payment.manage.merchants.core; 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.manage.appclient.beans.AppClientBean; 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); - List listSubMerchantIdApplys(JSONObject manager, String clientMoniker); + List listSubMerchantIdApplys(JSONObject manager, String clientMoniker); List listRpaySubMerchantIdApplys(JSONObject manager, String clientMoniker); + @Deprecated String subMerchantApplication(String clientMoniker, SubMerchantIdApply subMerchantApply, JSONObject manager); String newSubMerchantApplication(String clientMoniker, NewSubMerchantIdApply subMerchantIdApply, JSONObject manager); @@ -456,8 +458,6 @@ public interface ClientManager { List listMerchantIds(String clientMoniker, JSONObject manager); - void clearCacheSubMerchantIdApplices(String clientMoniker); - JSONObject getCheckClientInfo(int client_id, String account_id, String channel); List getClientSubMerchantIdLogs(String clientMoniker, JSONObject manager); diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java index 2837dde2d..325fcfd50 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java @@ -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.AlipayEnvironment; -import au.com.royalpay.payment.channels.alipay.runtime.AlipayClient; -import au.com.royalpay.payment.channels.rpay.runtime.RpayApi; +import au.com.royalpay.payment.channels.alipay.runtime.AlipayCommonApi; +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.impls.RPayMerchantRegister; 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.request.entities.RPayMerchantEntity; 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.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.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.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.beans.ChannelMerchantInfo; 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.exceptions.EmailException; 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.utils.OrderExpiryRuleResolver; 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.exceptions.WechatException; 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.SysConfigManager; 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.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.Font; +import org.dom4j.DocumentException; +import org.dom4j.DocumentHelper; import org.dom4j.Element; import org.joda.time.DateTime; import org.joda.time.format.DateTimeFormat; @@ -168,7 +182,7 @@ import static au.com.royalpay.payment.manage.permission.utils.OrgCheckUtils.chec */ @Service public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvider, ApplicationEventPublisherAware { - private Logger logger = LoggerFactory.getLogger(getClass()); + private final Logger logger = LoggerFactory.getLogger(getClass()); @Resource private ClientMapper clientMapper; @Resource @@ -216,20 +230,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid private ClientModifySupport clientModifySupport; @Resource - private PaymentChannelApi[] channels; + private MerchantChannelApplicationManager merchantChannelApplicationManager; @Resource private MerchantInfoProvider merchantInfoProvider; @Resource - private MpPaymentApi mpPaymentApi; - @Resource private SignInAccountService signInAccountService; - @Resource - private WxPayClient wxPayClient; - @Resource - private AlipayClient alipayClient; - - @Resource - private RpayApi rpayApi; @Resource private ManagerMapper managerMapper; @@ -251,7 +256,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid private ClientAuditProcessMapper clientAuditProcessMapper; @Resource - private SysWxMerchantApplyMapper sysWxMerchantApplyMapper; + private WxMerchantApplyMapper wxMerchantApplyMapper; @Resource private SysRpayMerchantApplyMapper sysRpayMerchantApplyMapper; @Resource @@ -279,8 +284,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid @Resource private MailGunService mailGunService; @Resource - private MailSendMapper mailSendMapper; - @Resource private ClearingDetailMapper clearingDetailMapper; @Resource private ClearingLogMapper clearingLogMapper; @@ -326,6 +329,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid private RPayMerchantMapper rPayMerchantMapper; @Resource private SysClientUpayProfileMapper sysClientUpayProfileMapper; + @Resource + private PaymentApi paymentApi; DateTimeFormatter formatter = DateTimeFormat.forPattern("dd MMM yyyy"); @@ -362,6 +367,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid @Resource private PaymentChannelMccGoodMapper paymentChannelMccGoodMapper; + @PostConstruct public void init() { tags.add("account"); @@ -539,7 +545,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (representativeInfo != null) { client.put("representativeInfo", representativeInfo); } - JSONObject wechatMcc= paymentChannelMccGoodMapper.findWechatPayMccByClientId(client.getIntValue("client_id")); + JSONObject wechatMcc = paymentChannelMccGoodMapper.findWechatPayMccByClientId(client.getIntValue("client_id")); if (wechatMcc != null) { client.put("mc_code", wechatMcc.getIntValue("mc_code")); } @@ -876,22 +882,23 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid /** * 保存微信mccode + * * @param partner */ - private void saveWechatMcc(JSONObject partner){ + private void saveWechatMcc(JSONObject partner) { 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.put("client_id",partner.getIntValue("client_id")); - wxGoodMcc.put("mc_code",partner.getString("mc_code")); - wxGoodMcc.put("channel","Wechat"); - wxGoodMcc.put("creation_date",new Date()); - wxGoodMcc.put("creation_by","System"); + wxGoodMcc.put("client_id", partner.getIntValue("client_id")); + wxGoodMcc.put("mc_code", partner.getString("mc_code")); + wxGoodMcc.put("channel", "Wechat"); + wxGoodMcc.put("creation_date", new Date()); + wxGoodMcc.put("creation_by", "System"); paymentChannelMccGoodMapper.save(wxGoodMcc); return; } - if(!TextUtils.isEmpty(partner.getString("mc_code"))) { + if (!TextUtils.isEmpty(partner.getString("mc_code"))) { wxGoodMcc.put("mc_code", partner.getString("mc_code")); paymentChannelMccGoodMapper.update(wxGoodMcc); } @@ -976,7 +983,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } clientConfigMapper.update(clientConfig); clientInfoCacheSupport.clearClientCache(clientId); - client.put("mc_code",info.getMc_code()); + client.put("mc_code", info.getMc_code()); saveWechatMcc(client); } @@ -1069,7 +1076,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid String originSubMerchantId = client.getString("sub_merchant_id"); update.put("client_id", clientId); 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("sub_merchant_id", subMerchantId); try { @@ -1556,7 +1564,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid @Override 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)) { JSONObject client = getClientInfoByMoniker(clientMoniker); if (client == null) { @@ -1564,8 +1572,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "enable_" + channel.toLowerCase(), allow)); - logger.info(manager.getString("display_name") + "(" + manager.getString("manager_id") + ") switched client " + clientMoniker + " channel " - + channel + " to " + allow); + logger.info("{}({}) switched client {} channel {} to {}", manager.getString("display_name"), manager.getString("manager_id"), clientMoniker, channel, allow); if (allow && (StringUtils.equalsAnyIgnoreCase("Wechat", channel) || StringUtils.equalsAnyIgnoreCase("Alipay", channel))) { int clientId = client.getIntValue("client_id"); List clientBankAccounts = clientBankAccountMapper.clientBankAccounts(clientId); @@ -1886,7 +1893,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid int clientId = client.getIntValue("client_id"); JSONObject clientConfig = clientConfigService.find(clientId); List 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(), "CB_BankPay", includingInactive)); @@ -5206,15 +5213,15 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid for (JSONObject compliance : complianceList) { String wxopenid = compliance.getString("wx_openid"); String loginUrl = PlatformEnvironment.getEnv().concatUrl("/global/userstatus/manager_signin_wechat"); - MpWechatApi paymentApi = mpWechatApiProvider.getWechatApiForTemplateMessage(wxopenid); - String templateId = paymentApi.getTemplateId("new-apply"); + MpWechatApi wxApi = mpWechatApiProvider.getWechatApiForTemplateMessage(wxopenid); + String templateId = wxApi.getTemplateId("new-apply"); try { TemplateMessage msg = initSendToComplianceTemplate(loginUrl, wxopenid, templateId, bd_user_name, client); - paymentApi.sendTemplateMessage(msg); + wxApi.sendTemplateMessage(msg); } catch (Exception e) { try { TemplateMessage msg = initSendToComplianceTemplate(loginUrl, wxopenid, templateId, bd_user_name, client); - paymentApi.sendTemplateMessage(msg); + wxApi.sendTemplateMessage(msg); } catch (Exception ignore) { } } @@ -5241,9 +5248,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid // String loginUrl = // PlatformEnvironment.getEnvironment().concatUrl("/global/userstatus/manager_signin_wechat"); try { - MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); - TemplateMessage msg = initSendToBDTemplate(wxopenid, paymentApi.getTemplateId("refuse-bd"), refuseRemark, client); - paymentApi.sendTemplateMessage(msg); + MpWechatApi wxApi = mpWechatApiProvider.getNewPaymentApi(); + TemplateMessage msg = initSendToBDTemplate(wxopenid, wxApi.getTemplateId("refuse-bd"), refuseRemark, client); + wxApi.sendTemplateMessage(msg); } catch (Exception ignored) { } } @@ -5270,9 +5277,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (wxopenid != null) { String loginUrl = PlatformEnvironment.getEnv().concatUrl("/global/userstatus/manager_signin_wechat"); try { - MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); - TemplateMessage msg = initSendToBDAgreeFileTemplate(wxopenid, paymentApi.getTemplateId("new-apply"), remark, client); - paymentApi.sendTemplateMessage(msg); + MpWechatApi wxApi = mpWechatApiProvider.getNewPaymentApi(); + TemplateMessage msg = initSendToBDAgreeFileTemplate(wxopenid, wxApi.getTemplateId("new-apply"), remark, client); + wxApi.sendTemplateMessage(msg); } catch (Exception e) { } } @@ -5298,15 +5305,15 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid for (JSONObject compliance : complianceList) { String wxopenid = compliance.getString("wx_openid"); String loginUrl = PlatformEnvironment.getEnv().concatUrl("/global/userstatus/manager_signin_wechat"); - MpWechatApi paymentApi = mpWechatApiProvider.getWechatApiForTemplateMessage(wxopenid); - String templateId = paymentApi.getTemplateId("new-apply"); + MpWechatApi wxApi = mpWechatApiProvider.getWechatApiForTemplateMessage(wxopenid); + String templateId = wxApi.getTemplateId("new-apply"); try { TemplateMessage msg = initSendToComAgreeFileTemplate(loginUrl, wxopenid, templateId, bd_user_name, client); - paymentApi.sendTemplateMessage(msg); + wxApi.sendTemplateMessage(msg); } catch (Exception e) { try { TemplateMessage msg = initSendToComAgreeFileTemplate(loginUrl, wxopenid, templateId, bd_user_name, client); - paymentApi.sendTemplateMessage(msg); + wxApi.sendTemplateMessage(msg); } catch (Exception ignore) { } } @@ -5331,15 +5338,15 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid for (JSONObject compliance : complianceList) { String wxopenid = compliance.getString("wx_openid"); String loginUrl = PlatformEnvironment.getEnv().concatUrl("/global/userstatus/manager_signin_wechat"); - MpWechatApi paymentApi = mpWechatApiProvider.getWechatApiForTemplateMessage(wxopenid); - String templateId = paymentApi.getTemplateId("new-apply"); + MpWechatApi wxApi = mpWechatApiProvider.getWechatApiForTemplateMessage(wxopenid); + String templateId = wxApi.getTemplateId("new-apply"); try { TemplateMessage msg = initSendToComplianceGreenChannelTemplate(loginUrl, wxopenid, templateId, bd_user_name, client); - paymentApi.sendTemplateMessage(msg); + wxApi.sendTemplateMessage(msg); } catch (Exception e) { try { TemplateMessage msg = initSendToComplianceGreenChannelTemplate(loginUrl, wxopenid, templateId, bd_user_name, client); - paymentApi.sendTemplateMessage(msg); + wxApi.sendTemplateMessage(msg); } catch (Exception ignore) { } } @@ -5392,10 +5399,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (wxopenid != null) { try { TemplateMessage msg = initTaskFinishTemplate(wxopenid, client_moniker + "已快速开通", "绿色通道申请通过", ""); - MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); - paymentApi.sendTemplateMessage(msg); + MpWechatApi wxApi = mpWechatApiProvider.getNewPaymentApi(); + wxApi.sendTemplateMessage(msg); } 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)); } } @@ -5409,12 +5416,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid for (JSONObject compliance : complianceList) { String wxopenid = compliance.getString("wx_openid"); try { - MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); - TemplateMessage msg = initSendCommissionTemplate(wxopenid, paymentApi.getTemplateId("commission"), "BD申请制作合同" + client_moniker, + MpWechatApi wxApi = mpWechatApiProvider.getNewPaymentApi(); + TemplateMessage msg = initSendCommissionTemplate(wxopenid, wxApi.getTemplateId("commission"), "BD申请制作合同" + client_moniker, bd_user_name, "制作合同申请", "BD申请制作" + short_name + "的合同"); - paymentApi.sendTemplateMessage(msg); + wxApi.sendTemplateMessage(msg); } 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)); } } @@ -5427,12 +5434,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid String wxopenid = bd.getString("wx_openid"); if (wxopenid != null) { try { - MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); - TemplateMessage msg = initSendCommissionTemplate(wxopenid, paymentApi.getTemplateId("commission"), client_moniker + "合同制作完成", + MpWechatApi wxApi = mpWechatApiProvider.getNewPaymentApi(); + TemplateMessage msg = initSendCommissionTemplate(wxopenid, wxApi.getTemplateId("commission"), client_moniker + "合同制作完成", "Compliance", "合规材料", "上传完整合规材料,商户:" + short_name); - paymentApi.sendTemplateMessage(msg); + wxApi.sendTemplateMessage(msg); } 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)); } @@ -5450,15 +5457,15 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid for (JSONObject compliance : complianceList) { String wxopenid = compliance.getString("wx_openid"); try { - MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); - TemplateMessage msg = initSendCommissionTemplate(wxopenid, paymentApi.getTemplateId("commission"), client_moniker + "合规材料已提交", + MpWechatApi wxApi = mpWechatApiProvider.getNewPaymentApi(); + TemplateMessage msg = initSendCommissionTemplate(wxopenid, wxApi.getTemplateId("commission"), client_moniker + "合规材料已提交", bd_user_name, "审核材料", "已提交合规材料,等待审核"); - paymentApi.sendTemplateMessage(msg); + wxApi.sendTemplateMessage(msg); } 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)); } 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) { try { TemplateMessage msg = initTaskFinishTemplate(wxopenid, client_moniker + "已正式开通", "Compliance审核通过", ""); - MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); - paymentApi.sendTemplateMessage(msg); + MpWechatApi wxApi = mpWechatApiProvider.getNewPaymentApi(); + wxApi.sendTemplateMessage(msg); } 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)); } } @@ -5488,12 +5495,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid for (JSONObject compliance : complianceList) { String wxopenid = compliance.getString("wx_openid"); try { - MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); - TemplateMessage msg = initSendCommissionTemplate(wxopenid, paymentApi.getTemplateId("commission"), client_moniker + "申请绿色通道", + MpWechatApi wxApi = mpWechatApiProvider.getNewPaymentApi(); + TemplateMessage msg = initSendCommissionTemplate(wxopenid, wxApi.getTemplateId("commission"), client_moniker + "申请绿色通道", bd_user_name, "绿色通道申请", "BD已提交绿色通道申请,商户:" + short_name); - paymentApi.sendTemplateMessage(msg); + wxApi.sendTemplateMessage(msg); } 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)); } } @@ -5517,12 +5524,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid for (JSONObject compliance : complianceList) { String wxopenid = compliance.getString("wx_openid"); try { - MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); - TemplateMessage msg = initSendCommissionTemplate(wxopenid, paymentApi.getTemplateId("commission"), "BD申请制作信用卡支付合同" + client_moniker, + MpWechatApi wxApi = mpWechatApiProvider.getNewPaymentApi(); + TemplateMessage msg = initSendCommissionTemplate(wxopenid, wxApi.getTemplateId("commission"), "BD申请制作信用卡支付合同" + client_moniker, bd_user_name, "制作卡支付合同申请", "BD申请制作" + short_name + "的卡支付合同"); - paymentApi.sendTemplateMessage(msg); + wxApi.sendTemplateMessage(msg); } 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)); } } @@ -5535,12 +5542,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid String wxopenid = bd.getString("wx_openid"); if (wxopenid != null) { try { - MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); - TemplateMessage msg = initSendCommissionTemplate(wxopenid, paymentApi.getTemplateId("commission"), client_moniker + "信用卡支付合同制作完成", + MpWechatApi wxApi = mpWechatApiProvider.getNewPaymentApi(); + TemplateMessage msg = initSendCommissionTemplate(wxopenid, wxApi.getTemplateId("commission"), client_moniker + "信用卡支付合同制作完成", "Compliance", "合规材料", "上传完整合规材料,商户:" + short_name); - paymentApi.sendTemplateMessage(msg); + wxApi.sendTemplateMessage(msg); } 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)); } @@ -5558,15 +5565,15 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid for (JSONObject compliance : complianceList) { String wxopenid = compliance.getString("wx_openid"); try { - MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); - TemplateMessage msg = initSendCommissionTemplate(wxopenid, paymentApi.getTemplateId("commission"), client_moniker + "信用卡卡支付合规材料已提交", + MpWechatApi wxApi = mpWechatApiProvider.getNewPaymentApi(); + TemplateMessage msg = initSendCommissionTemplate(wxopenid, wxApi.getTemplateId("commission"), client_moniker + "信用卡卡支付合规材料已提交", bd_user_name, "审核材料", "已提交合规材料,等待审核"); - paymentApi.sendTemplateMessage(msg); + wxApi.sendTemplateMessage(msg); } 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)); } 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) { try { TemplateMessage msg = initTaskFinishTemplate(wxopenid, client_moniker + "已正式开通", "Card Payment Compliance审核通过", ""); - MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); - paymentApi.sendTemplateMessage(msg); + MpWechatApi wxApi = mpWechatApiProvider.getNewPaymentApi(); + wxApi.sendTemplateMessage(msg); } 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)); } } @@ -5593,37 +5600,22 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid @Override @Cacheable(value = ":all_sub_merchant_id_applices:", key = "#clientMoniker") - public List listSubMerchantIdApplys(JSONObject manager, String clientMoniker) { + public List listSubMerchantIdApplys(JSONObject manager, String clientMoniker) { JSONObject client = getClientInfoByMoniker(clientMoniker); if (client == null) { throw new InvalidShortIdException(); } checkOrgPermission(manager, client); - List applices = sysWxMerchantApplyMapper.listWxMerchantApplices(client.getInteger("client_id"), + List applices = wxMerchantApplyMapper.listWxMerchantApplices(client.getInteger("client_id"), new PageBounds(Order.formString("create_time.desc"))); if (!applices.isEmpty()) { - return applices; + return new ArrayList<>(applices); } else { 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")); - JSONObject object = new JSONObject(); - object.put("sub_merchant_id", elem.elementText("sub_mch_id_0")); - object.put("client_id", client.getInteger("client_id")); - 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 applyQuery = new ArrayList<>(); - applyQuery.add(object); + WxPayMerchantRegister wxRegistry = Optional.ofNullable(merchantChannelApplicationManager.getRegister(WxPayMerchantRegister.class)).orElseThrow(() -> new ServerErrorException("No Wechat registry found")); + ChannelMerchantInfo wxMerchantInfo = wxRegistry.findMerchant(client); + List applyQuery = new ArrayList<>(); + applyQuery.add(wxMerchantInfo); return applyQuery; } } @@ -5647,6 +5639,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid @Override @CacheEvict(value = ":all_sub_merchant_id_applices:", key = "#clientMoniker") + @Deprecated public String subMerchantApplication(String clientMoniker, SubMerchantIdApply subMerchantApply, JSONObject manager) { JSONObject client = getClientInfoByMoniker(clientMoniker); if (client == null) { @@ -5655,25 +5648,21 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid checkOrgPermission(manager, client); JSONObject params = subMerchantApply.insertObject(); - SubMerchantInfo subMerchantInfo = JSONObject.toJavaObject(params, SubMerchantInfo.class); - params.put("merchant_id", subMerchantApply.getMerchant_id()); - params.put("client_id", client.getString("client_id")); - params.put("create_time", new Date()); - params.put("operator", manager.getString("display_name")); - Element elem = wxPayClient.subMerchantApplication(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); - sysWxMerchantApplyMapper.insertWxMerchantApply(params); - clearCacheSubMerchantIdApplices(clientMoniker); + SubMerchantInfo subMerchantInfo = JSON.toJavaObject(params, SubMerchantInfo.class); + + MerchantApplicationResult res = Optional.ofNullable(merchantChannelApplicationManager.getRegister(WxPayMerchantRegisterLegacy.class)) + .map(channel -> channel.apply(client, subMerchantInfo, manager)) + .orElseThrow(() -> new ServerErrorException("No Wechat merchant registry found")); + if (res.isSuccess()) { + return res.getMid(); } else { - throw new BadRequestException(elem.elementText("return_msg")); + throw new BadRequestException("Failed to register wechat merchant"); } - return sub_merchant_id; } /** * 微信新进件 + * * @param clientMoniker * @param subMerchantApply * @param manager @@ -5681,7 +5670,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid */ @Override @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); if (client == null) { throw new InvalidShortIdException(); @@ -5689,48 +5678,39 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid checkOrgPermission(manager, client); JSONObject params = subMerchantApply.insertObject(client); - SubMerchantInfoInheritance subMerchantInfo = JSONObject.toJavaObject(params, SubMerchantInfoInheritance.class); - params.put("merchant_id", subMerchantApply.getMerchant_id()); - params.put("client_id", client.getString("client_id")); - params.put("create_time", new Date()); - params.put("operator", manager.getString("display_name")); - params.put("is_valid","1"); - 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 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); + SubMerchantInfoInheritance subMerchantInfo = JSON.toJavaObject(params, SubMerchantInfoInheritance.class); + MerchantApplicationResult res = Optional.ofNullable(merchantChannelApplicationManager.getRegister(WxPayMerchantRegister.class)) + .map(channel -> channel.apply(client, subMerchantInfo, manager)) + .orElseThrow(() -> new ServerErrorException("No Wechat merchant registry found")); + if (res.isSuccess()) { + return res.getMid(); } else { - throw new BadRequestException(elem.elementText("return_msg")); + throw new BadRequestException("Failed to register wechat merchant"); } - return sub_merchant_id; } /** * 获取指定商户-微信子商户详情 + * * @param clientMoniker * @param merchantAppId */ @Override - public JSONObject queryApplicationSubMerchantById(String clientMoniker, String merchantAppId){ + public JSONObject queryApplicationSubMerchantById(String clientMoniker, String merchantAppId) { JSONObject client = clientMapper.findClientByMoniker(clientMoniker); if (client == null) { 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); - resultParams.put("merchant_app_id",subMerchantApplyInfo.getString("merchant_app_id")); + resultParams.put("merchant_app_id", subMerchantApplyInfo.getMerchantAppId()); return resultParams; } /** * 修改指定微信子进件商户信息 + * * @param clientMoniker * @param merchantAppId * @param subMerchantIdApply @@ -5738,7 +5718,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid */ @Override @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); if (client == null) { throw new BadRequestException("partner code is not exists!"); @@ -5746,37 +5726,32 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid checkOrgPermission(manager, client); JSONObject params = subMerchantIdApply.insertObject(client); - params.put("merchant_app_id",merchantAppId); - SubMerchantInfoInheritance subMerchantInfo = JSONObject.toJavaObject(params, SubMerchantInfoInheritance.class); + params.put("merchant_app_id", merchantAppId); + SubMerchantInfoInheritance subMerchantInfo = JSON.toJavaObject(params, SubMerchantInfoInheritance.class); params.put("merchant_id", subMerchantIdApply.getMerchant_id()); params.put("client_id", client.getString("client_id")); params.put("create_time", new Date()); params.put("operator", manager.getString("display_name")); - - - Element elem = wxPayClient.modfiySubMerchant(subMerchantIdApply.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); - sysWxMerchantApplyMapper.updateSubMerchantInfoByMerchantAppId(params); - clearCacheSubMerchantIdApplices(clientMoniker); - } else { - throw new BadRequestException(elem.elementText("return_msg")); - } + WxPayMerchantRegister register = Optional.ofNullable(merchantChannelApplicationManager.getRegister(WxPayMerchantRegister.class)) + .orElseThrow(() -> new ServerErrorException("No Register found for wechat")); + register.modify(merchantAppId, client, subMerchantInfo, manager); } @Override - public JSONObject querySubMerchantStatus(String clientMoniker,String subMerchantId){ + public JSONObject querySubMerchantStatus(String clientMoniker, String subMerchantId) { JSONObject client = clientMapper.findClientByMoniker(clientMoniker); if (client == null) { 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(); - - object.put("apply_status", elem.elementText("result_code")); - object.put("response_str", elem.asXML()); + object.put("response_str", xml); + object.put("apply_status", info.getRawResponse()); return object; } @@ -5798,20 +5773,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid throw new BadRequestException("Alipay Industry can't be null"); } - AlipayConfig.AlipayMerchant mch = AlipayEnvironment.getEnv().getAlipayRetailMerchant(); - 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); - } + merchantChannelApplicationManager.getRegister(AlipayRetailApi.class).apply(client, new EmptyMerchantApplication(), manager); } @Override @@ -5821,8 +5783,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid throw new InvalidShortIdException(); } checkOrgPermission(manager, client); - AlipayConfig.AlipayMerchant mch = AlipayEnvironment.getEnv().getAlipayRetailMerchant(); - Element resultElement = alipayClient.queryGmsPortalStatus(mch.getPid(), client); + AlipayMerchantEntity alipayMch = merchantChannelApplicationManager.getRegister(AlipayRetailApi.class).findMerchant(client); + Element resultElement = alipayMch.getRawResponseXml(); if (!StringUtils.equalsIgnoreCase("T", resultElement.elementText("is_success"))) { return "查询成功:" + resultElement.elementText("error"); } @@ -5841,7 +5803,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } checkOrgPermission(manager, client); 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("partner", mch.getPid()); queryGMSJson.put("sign_type", "MD5"); @@ -5877,7 +5839,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid throw new InvalidShortIdException(); } checkOrgPermission(manager, client); - JSONObject queryGMSJson = new JSONObject(new LinkedHashMap()); + JSONObject queryGMSJson = new JSONObject(new LinkedHashMap<>()); AlipayConfig.AlipayMerchant mch = AlipayEnvironment.getEnv().getAlipayOnlineMerchant(); queryGMSJson.put("service", "alipay.overseas.secmerchant.online.maintain"); queryGMSJson.put("partner", mch.getPid()); @@ -5927,19 +5889,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } AlipayConfig.AlipayMerchant mch = AlipayEnvironment.getEnv().getAlipayOnlineMerchant(); - Element resultElement = alipayClient.registerOnlineGmsPortal(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); - } + merchantChannelApplicationManager.getRegister(AlipayOnlineApi.class).apply(client, new EmptyMerchantApplication(), manager); } @Override @@ -5974,7 +5924,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid throw new InvalidShortIdException(); } 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"))) { return "查询成功:" + resultElement.elementText("error"); } @@ -6001,20 +5953,14 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid throw new BadRequestException("您已申请成功子商务号,请勿重复申请"); } - SubRpayMerchantInfo subRpayMerchantInfo = JSONObject.toJavaObject(merchantInfo, SubRpayMerchantInfo.class); + SubRpayMerchantInfo subRpayMerchantInfo = JSON.toJavaObject(merchantInfo, SubRpayMerchantInfo.class); subRpayMerchantInfo.CheckEmpty(); - JSONObject rpayMerchantInfo = rpayApi.registerMerchant(client.getIntValue("client_id"), subRpayMerchantInfo); + MerchantApplicationResult rpayMerchantInfo = merchantChannelApplicationManager.getRegister(RPayMerchantRegister.class) + .apply(client, subRpayMerchantInfo, manager); if (rpayMerchantInfo != null) { - merchantInfo.put("merchant_id", rpayMerchantInfo.getString("rpay_order_id")); - merchantInfo.put("client_id", client.getString("client_id")); - 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")); + + clientMapper.updateRpayEnterpriseId(client.getIntValue("client_id"), rpayMerchantInfo.getMid()); } else { throw new BadRequestException("请求失败"); } @@ -6036,11 +5982,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid return list; } - @Override - @CacheEvict(value = ":all_sub_merchant_id_applices:", key = "#clientMoniker") - public void clearCacheSubMerchantIdApplices(String clientMoniker) { - } - @Override public JSONObject getCheckClientInfo(int client_id, String account_id, String channel) { JSONObject result = null; @@ -6049,67 +5990,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (PartnerRole.getRole(account.getIntValue("role")) == PartnerRole.CASHIER) { return result; } else { - if (expireInfo.getBoolean("alert")) { + if (expireInfo.getBooleanValue("alert")) { 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", "

Dear Valued Merchants,


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. 


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. 


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. 


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. 


If you have any questions related to this change please direct them to our Sales Management Team or your relevant BD officer.


(note: GST is for the surcharge fee only, not related to the price of the goods.)


尊敬的商户,


感谢您选择RoyalPay。作为澳洲移动支付的先行者和领导者,RoyalPay自2016年起就开始针对交易手续费这一澳洲目前空白的税务问题对接澳大利亚相关监管机构。作为市场上全新的支付模式,这两年来我们不断地与相关机构探讨最为合适的监管法令应用,同时澳洲的相应法律法规也在不断地完善来提供更全面的监管,来营造更加稳定、健康、健全的金融市场。


RoyalPay于近期正式收到澳洲监管机构的通知,针对手续费Tax Free的申请和特殊税务条款考量做出了相应的回复:目前澳洲市场上的移动支付(扫码)解决方案所产生的手续费部分的GST并不能享受Tax Free及部分减免的政策条款。我们已经替2018年前交易的商户补足了手续费部分的税金,并应澳大利亚税务局ATO的要求进行了合同上手续费GST部分的相应调整。您也可咨询专业的会计师来申请您额外的手续费GST Return。感谢您的支持和理解,愿我们一起共同努力,塑造一个良好而有序的澳洲移动支付市场。


有任何疑问,请随时联络我们的客服与公众号。

(注:GST只针对手续费部分,与商品价格无关)


"); result.put("title", "【Important!重要!!】GST Modification Notice | 澳洲监管机构关于手续费GST调整问题通知\n"); @@ -6686,9 +6568,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid }); needNotifyUsers.forEach(userOpenId -> { try { - MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); - TemplateMessage msg = initSendTestPasswordTemplate(userOpenId, paymentApi.getTemplateId("test-merchant-password")); - paymentApi.sendTemplateMessage(msg); + MpWechatApi wxApi = mpWechatApiProvider.getNewPaymentApi(); + TemplateMessage msg = initSendTestPasswordTemplate(userOpenId, wxApi.getTemplateId("test-merchant-password")); + wxApi.sendTemplateMessage(msg); } catch (Exception e) { logger.error("给{}发送微信消息失败,原因:{}", userOpenId, e); } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java index efd63bec4..4d9179838 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java @@ -1,6 +1,7 @@ package au.com.royalpay.payment.manage.merchants.web; 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.manage.dev.core.MerchantLocationService; 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}) - public List listSubMerchantIdApplys(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + public List listSubMerchantIdApplys(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { 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}) + @Deprecated public String subMerchantApplication(@PathVariable String clientMoniker, @RequestBody SubMerchantIdApply subMerchantIdApply, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { return clientManager.subMerchantApplication(clientMoniker, subMerchantIdApply, manager); } diff --git a/src/main/java/au/com/royalpay/payment/manage/processors/CtripCouponOnlyLogProcessor.java b/src/main/java/au/com/royalpay/payment/manage/processors/CtripCouponOnlyLogProcessor.java index f63418a00..8ea9f3024 100644 --- a/src/main/java/au/com/royalpay/payment/manage/processors/CtripCouponOnlyLogProcessor.java +++ b/src/main/java/au/com/royalpay/payment/manage/processors/CtripCouponOnlyLogProcessor.java @@ -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.SysConfigManager; 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 cn.yixblog.platform.http.HttpRequestGenerator; import cn.yixblog.platform.http.HttpRequestResult; @@ -59,6 +60,7 @@ public class CtripCouponOnlyLogProcessor implements PaymentProcessor { private CouponAccuessLogMapper payCouponAccuessLogMapper; @Resource private PaymentApi paymentApi; + @Override public String processorId() { return COUPON_ID + "_USE"; @@ -82,7 +84,7 @@ public class CtripCouponOnlyLogProcessor implements PaymentProcessor { } BigDecimal payFee = paymentInfo.getTotalFee(); 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()); } BigDecimal couponCondition = couponInfo.getBigDecimal("condition") == null ? BigDecimal.ZERO @@ -91,15 +93,15 @@ public class CtripCouponOnlyLogProcessor implements PaymentProcessor { return; } JSONObject couponAccuessLog = new JSONObject(); - couponAccuessLog.put("client_id",order.getIntValue("client_id")); - couponAccuessLog.put("customer_openid","创建订单时无"); - couponAccuessLog.put("creation_date",new Date()); - couponAccuessLog.put("order_id",order.getString("order_id")); - couponAccuessLog.put("coupon_id","CTRIP_"+tmpEle.getString("ctrip_coupon_id")); + couponAccuessLog.put("client_id", order.getIntValue("client_id")); + couponAccuessLog.put("customer_openid", "创建订单时无"); + couponAccuessLog.put("creation_date", new Date()); + couponAccuessLog.put("order_id", order.getString("order_id")); + couponAccuessLog.put("coupon_id", "CTRIP_" + tmpEle.getString("ctrip_coupon_id")); //携程满减 if (StringUtils.equals(couponInfo.getString("type"), "31")) { 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()); } 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); String timestamp = System.currentTimeMillis() + ""; String base = CUSTOMER_APP_ID + timestamp + CUSTOMER_AUTH_CODE; diff --git a/src/main/java/au/com/royalpay/payment/manage/processors/CtripCouponProvideProcessor.java b/src/main/java/au/com/royalpay/payment/manage/processors/CtripCouponProvideProcessor.java index 321728514..e77fcba6b 100644 --- a/src/main/java/au/com/royalpay/payment/manage/processors/CtripCouponProvideProcessor.java +++ b/src/main/java/au/com/royalpay/payment/manage/processors/CtripCouponProvideProcessor.java @@ -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.manage.mappers.log.CouponAccuessLogMapper; 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.SysConfigManager; 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 cn.yixblog.platform.http.HttpRequestGenerator; import cn.yixblog.platform.http.HttpRequestResult; @@ -91,7 +93,7 @@ public class CtripCouponProvideProcessor implements PaymentProcessor { } BigDecimal payFee = paymentInfo.getTotalFee(); 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()); } BigDecimal couponCondition = couponInfo.getBigDecimal("condition") == null ? BigDecimal.ZERO @@ -109,7 +111,7 @@ public class CtripCouponProvideProcessor implements PaymentProcessor { //携程满减 if (StringUtils.equals(couponInfo.getString("type"), "31")) { 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()); } paymentInfo.setDiscount(currentDiscount.add(actureAmount)); @@ -127,15 +129,15 @@ public class CtripCouponProvideProcessor implements PaymentProcessor { payCouponAccuessLogMapper.save(couponAccuessLog); JSONObject updateOrder = new JSONObject(); - BigDecimal customerPay = paymentInfo.getUserPayAmount(); - updateOrder.put("customer_payment_amount", customerPay); + Money customerPay = paymentInfo.getUserPayAmount(); + updateOrder.put("customer_payment_amount", customerPay.getAmount()); BigDecimal couponDiscount = paymentInfo.getDiscount(); updateOrder.put("coupon_payment_amount", couponDiscount); updateOrder.put("order_id", paymentInfo.getOrderId()); pmtOrderMapper.update(updateOrder); - order.put("customer_payment_amount", customerPay); + order.put("customer_payment_amount", customerPay.getAmount()); order.put("coupon_payment_amount", couponDiscount); } diff --git a/src/main/java/au/com/royalpay/payment/manage/tradelog/refund/impls/RefundServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/tradelog/refund/impls/RefundServiceImpl.java index 820fb48ab..8f91bc885 100644 --- a/src/main/java/au/com/royalpay/payment/manage/tradelog/refund/impls/RefundServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/tradelog/refund/impls/RefundServiceImpl.java @@ -1,7 +1,6 @@ package au.com.royalpay.payment.manage.tradelog.refund.impls; 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.manage.analysis.beans.RefundReviewBean; 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.events.NewRefundReviewEvent; 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.mappers.SysConfigMapper; import au.com.royalpay.payment.tools.exceptions.BadRequestException; diff --git a/src/main/ui/static/payment/partner/partner-manage.js b/src/main/ui/static/payment/partner/partner-manage.js index 2fda3e242..671bb9a57 100644 --- a/src/main/ui/static/payment/partner/partner-manage.js +++ b/src/main/ui/static/payment/partner/partner-manage.js @@ -5726,101 +5726,6 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $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) { $scope.wxIndustries = angular.copy(wxMerchantIndustries);