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 711b267b1..039a68912 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 @@ -121,7 +121,7 @@ public interface ClientManager { void changeRole(JSONObject manager, String clientMoniker, String accountId, int role); @Transactional - void toggleAuditRefund(String clientMoniker, boolean enable); + void toggleAuditRefund(String clientMoniker, boolean enable, JSONObject account); List listPaymentNoticeAccounts(int clientId); diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientModifySupport.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientModifySupport.java new file mode 100644 index 000000000..1fc7260a1 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientModifySupport.java @@ -0,0 +1,11 @@ +package au.com.royalpay.payment.manage.merchants.core; + +import au.com.royalpay.payment.manage.merchants.entity.ClientModify; + +/** + * Create by yixian at 2018-04-12 16:24 + */ +public interface ClientModifySupport { + + void processClientModify(ClientModify clientModify); +} 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 ea37c8c63..af83e0186 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 @@ -41,6 +41,8 @@ import au.com.royalpay.payment.manage.merchants.beans.SubMerchantIdApply; import au.com.royalpay.payment.manage.merchants.core.ClientComplyValidator; import au.com.royalpay.payment.manage.merchants.core.ClientInfoCacheSupport; import au.com.royalpay.payment.manage.merchants.core.ClientManager; +import au.com.royalpay.payment.manage.merchants.core.ClientModifySupport; +import au.com.royalpay.payment.manage.merchants.entity.impls.RefundAuditModify; import au.com.royalpay.payment.manage.notice.core.MailService; import au.com.royalpay.payment.manage.signin.beans.TodoNotice; import au.com.royalpay.payment.manage.signin.core.ManagerTodoNoticeProvider; @@ -176,6 +178,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid // todo 作用 @Resource private ClientComplyValidator[] validators; + @Resource + private ClientModifySupport clientModifySupport; + @Resource private PaymentChannelApi[] channels; @Resource @@ -1083,12 +1088,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } @Override - public void toggleAuditRefund(String clientMoniker, boolean enable) { - JSONObject partner = getClientInfoByMoniker(clientMoniker); - Assert.notNull(partner, "Merchant is null"); - partner.put("enable_refund_auth", enable); - clientMapper.update(partner); - clientInfoCacheSupport.clearClientCache(partner.getIntValue("client_id")); + public void toggleAuditRefund(String clientMoniker, boolean enable, JSONObject account) { + clientModifySupport.processClientModify(new RefundAuditModify(account, clientMoniker, enable)); } @Override @@ -2141,7 +2142,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid file.put("last_update_by", manager.getString("display_name")); } JSONObject contract = clientsContractMapper.findByClientId(client.getIntValue("client_id")); - if (contract == null || now.compareTo(contract.getDate("expiry_date")) > 0 ||!contract.getBoolean("has_sign")|| existFile == null || existFile.isEmpty()) { + if (contract == null || now.compareTo(contract.getDate("expiry_date")) > 0 || !contract.getBoolean("has_sign") || existFile == null || existFile.isEmpty()) { clientFilesMapper.save(file); } else { file.put("file_id", existFile.getString("file_id")); @@ -3000,7 +3001,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } private TemplateMessage initSendToComplianceGreenChannelTemplate(String loginUrl, String wxopenid, String templateId2, String bd_user_name, - JSONObject client) { + JSONObject client) { TemplateMessage msg = new TemplateMessage(wxopenid, templateId2, loginUrl); msg.put("first", bd_user_name + " 提交了新商户绿色通道申请,请审核", "#ff0000"); msg.put("keyword1", client.getString("client_moniker") + "申请绿色通道", "#0000ff"); @@ -3241,12 +3242,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid @Override public JSONObject getCheckClientInfo(int client_id, String account_id, String channel) { JSONObject result = null; - JSONObject expireInfo = clientContractService.getClientContractExpire(client_id,channel); + JSONObject expireInfo = clientContractService.getClientContractExpire(client_id, channel); JSONObject account = clientAccountMapper.findById(account_id); if (PartnerRole.getRole(account.getIntValue("role")) == PartnerRole.CASHIER) { - return result; + return result; } else { - if(expireInfo.getBoolean("alert")){ + if (expireInfo.getBoolean("alert")) { result = new JSONObject(); // result.put("content","Dear Valued Merchants,\n" + // "\n" + @@ -3294,8 +3295,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid // "\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"); + 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"); } } return result; diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientModifySupportImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientModifySupportImpl.java new file mode 100644 index 000000000..a996be459 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientModifySupportImpl.java @@ -0,0 +1,30 @@ +package au.com.royalpay.payment.manage.merchants.core.impls; + +import au.com.royalpay.payment.manage.mappers.system.ClientMapper; +import au.com.royalpay.payment.manage.merchants.core.ClientInfoCacheSupport; +import au.com.royalpay.payment.manage.merchants.core.ClientModifySupport; +import au.com.royalpay.payment.manage.merchants.entity.ClientModify; +import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +/** + * Create by yixian at 2018-04-12 16:25 + */ +@Service +public class ClientModifySupportImpl implements ClientModifySupport { + @Resource + private MerchantInfoProvider merchantInfoProvider; + @Resource + private ClientInfoCacheSupport clientInfoCacheSupport; + @Resource + private ClientMapper clientMapper; + + + @Override + public void processClientModify(ClientModify modify) { + int clientId = modify.doModify(merchantInfoProvider, mapper, clientMapper); + clientInfoCacheSupport.clearClientCache(clientId); + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/ClientModify.java b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/ClientModify.java new file mode 100644 index 000000000..9341e27f2 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/ClientModify.java @@ -0,0 +1,53 @@ +package au.com.royalpay.payment.manage.merchants.entity; + +import au.com.royalpay.payment.manage.mappers.system.ClientMapper; +import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; + +import java.util.Map; +import java.util.stream.Collectors; + +/** + * Create by yixian at 2018-04-12 16:19 + */ +public abstract class ClientModify { + + private JSONObject manager; + private JSONObject account; + + private String clientMoniker; + + public ClientModify(JSONObject manager, JSONObject account, String clientMoniker) { + this.manager = manager; + this.account = account; + this.clientMoniker = clientMoniker; + } + + protected abstract String business(); + + protected abstract JSONObject getModifyResult(); + + public int doModify(MerchantInfoProvider merchantInfoProvider, ModifyHistoryMapper modifyHistoryMapper, ClientMapper clientMapper) { + JSONObject client = merchantInfoProvider.getClientInfoByMoniker(clientMoniker); + JSONObject modifyResult = getModifyResult(); + saveModifyHistory(modifyHistoryMapper, client, modifyResult); + int clientId = client.getIntValue("client_id"); + modifyResult.put("client_id", clientId); + clientMapper.update(modifyResult); + return clientId; + } + + private void saveModifyHistory(ModifyHistoryMapper modifyHistoryMapper, JSONObject client, JSONObject modifyResult) { + Map beforeModify = modifyResult.keySet().stream().collect(Collectors.toMap(key -> key, client::get)); + JSONObject modifyHistory = new JSONObject(); + modifyHistory.put("client_id", client.getIntValue("client_id")); + modifyHistory.put("business", business()); + modifyHistory.put("user_type", manager == null ? "Merchant" : "Manager"); + modifyHistory.put("user_id", manager == null ? account.getString("account_id") : manager.getString("manager_id")); + modifyHistory.put("username", manager == null ? account.getString("display_name") : manager.getString("display_name")); + modifyHistory.put("origin_data", JSON.toJSONString(beforeModify)); + modifyHistory.put("new_data", modifyResult.toJSONString()); + modifyHistoryMapper.saveModifyHistory(modifyHistory); + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/RefundAuditModify.java b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/RefundAuditModify.java new file mode 100644 index 000000000..2da1fc16b --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/RefundAuditModify.java @@ -0,0 +1,28 @@ +package au.com.royalpay.payment.manage.merchants.entity.impls; + +import au.com.royalpay.payment.manage.merchants.entity.ClientModify; +import com.alibaba.fastjson.JSONObject; + +/** + * Create by yixian at 2018-04-12 16:43 + */ +public class RefundAuditModify extends ClientModify { + private boolean enable; + + public RefundAuditModify(JSONObject account, String clientMoniker, boolean enable) { + super(null, account, clientMoniker); + this.enable = enable; + } + + @Override + protected String business() { + return "refund_audit"; + } + + @Override + protected JSONObject getModifyResult() { + JSONObject modify = new JSONObject(); + modify.put("enable_refund_auth", enable) + return modify; + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerViewController.java b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerViewController.java index 783be78d9..0f7a2a89f 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerViewController.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerViewController.java @@ -225,7 +225,7 @@ public class PartnerViewController { @PartnerMapping(value = "/audit_refund", method = RequestMethod.PUT, roles = PartnerRole.ADMIN) @ResponseBody public void toggleAuditRefund(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account, @RequestBody JSONObject enable) { - clientManager.toggleAuditRefund(account.getString("client_moniker"), enable.getBooleanValue("enable")); + clientManager.toggleAuditRefund(account.getString("client_moniker"), enable.getBooleanValue("enable"), account); } @PartnerMapping(value = "/refund_pwd", method = RequestMethod.PUT, roles = {PartnerRole.ADMIN, PartnerRole.MANAGER}) @@ -292,7 +292,7 @@ public class PartnerViewController { public JSONObject listClientDevices(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account, @RequestParam(required = false) String remark, @RequestParam(defaultValue = "1") int page, @RequestParam(defaultValue = "10") int limit, @RequestParam(required = false) String client_type, @RequestParam(required = false) String[] client_ids) { - return clientManager.listClientDevices(null, account.getString("client_moniker"), remark, page, limit,client_type,client_ids); + return clientManager.listClientDevices(null, account.getString("client_moniker"), remark, page, limit, client_type, client_ids); } @PartnerMapping(value = "/devices/{devId}", method = RequestMethod.PUT, roles = PartnerRole.ADMIN) @@ -366,18 +366,18 @@ public class PartnerViewController { @PartnerMapping(value = "/manual_settle", method = RequestMethod.PUT, roles = PartnerRole.ADMIN) @ResponseBody public void manualSettle(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account, @RequestParam boolean manual_settle) { - clientManager.changeManualSettle(account.getIntValue("client_id"),manual_settle,account.getString("account_id"),1,"商户"+(manual_settle?"打开":"关闭")+"手动清算"); + clientManager.changeManualSettle(account.getIntValue("client_id"), manual_settle, account.getString("account_id"), 1, "商户" + (manual_settle ? "打开" : "关闭") + "手动清算"); } @PartnerMapping(value = "/checkContract", method = RequestMethod.GET) @ResponseBody public JSONObject getCheckClientInfov2(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account) { - return clientManager.getCheckClientInfo(account.getIntValue("client_id"),account.getString("account_id"),"PC"); + return clientManager.getCheckClientInfo(account.getIntValue("client_id"), account.getString("account_id"), "PC"); } - @PartnerMapping(value = "/agree/confirm", method = RequestMethod.POST,roles = {PartnerRole.ADMIN, PartnerRole.MANAGER}) + @PartnerMapping(value = "/agree/confirm", method = RequestMethod.POST, roles = {PartnerRole.ADMIN, PartnerRole.MANAGER}) @ResponseBody public void confirmSourceAgreeFile(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account) { - clientContractService.confirmSourceAgreement(account.getIntValue("client_id"),account.getString("account_id"),"PC"); + clientContractService.confirmSourceAgreement(account.getIntValue("client_id"), account.getString("account_id"), "PC"); } }