@ -2,24 +2,33 @@ 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.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.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.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.impls.MerchantChannelPermissionManager ;
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 +83,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 ;
@ -87,6 +97,7 @@ import au.com.royalpay.payment.tools.lock.Locker;
import au.com.royalpay.payment.tools.mail.SendMail ;
import au.com.royalpay.payment.tools.merchants.beans.QRCodeConfig ;
import au.com.royalpay.payment.tools.merchants.beans.UpdateSurchargeDTO ;
import au.com.royalpay.payment.tools.merchants.core.MerchantChannelPermissionResolver ;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider ;
import au.com.royalpay.payment.tools.merchants.qrboard.QRBoard ;
import au.com.royalpay.payment.tools.merchants.qrboard.QRBoardProvider ;
@ -168,7 +179,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 +227,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 +253,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
private ClientAuditProcessMapper clientAuditProcessMapper ;
@Resource
private SysWxMerchantApplyMapper sysW xMerchantApplyMapper;
private WxMerchantApplyMapper w xMerchantApplyMapper;
@Resource
private SysRpayMerchantApplyMapper sysRpayMerchantApplyMapper ;
@Resource
@ -279,8 +281,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 +326,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
private RPayMerchantMapper rPayMerchantMapper ;
@Resource
private SysClientUpayProfileMapper sysClientUpayProfileMapper ;
@Resource
private PaymentApi paymentApi ;
@Resource
private MerchantChannelPermissionManager merchantChannelPermissionManager ;
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,10 +545,17 @@ 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" ) ) ;
}
client . put ( "enable_alipayplus" , false ) ;
MerchantChannelPermissionResolver resolver = this . paymentApi . channelApi ( PayChannel . ALIPAY_PLUS . getChannelCode ( ) ) . getChannelPermissionResolver ( ) ;
if ( ! Objects . isNull ( resolver ) ) {
if ( resolver . newOrderEnabled ( client ) ) {
client . put ( "enable_alipayplus" , true ) ;
}
}
return client ;
}
@ -876,22 +889,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 +990,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 +1083,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,16 +1571,19 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Override
public void switchChannelPermission ( JSONObject manager , String clientMoniker , String channel , boolean allow ) {
for ( PaymentChannelApi channelApi : channels) {
if ( channelApi . channel ( ) . equalsIgnoreCase ( channel ) || "CB_BankPay" . equalsIgnoreCase ( channel ) ) {
for ( PaymentChannelApi channelApi : paymentApi. channels( ) ) {
if ( channelApi . channel ( ) . equalsIgnoreCase ( channel ) ) {
JSONObject client = getClientInfoByMoniker ( clientMoniker ) ;
if ( client = = null ) {
throw new NotFoundException ( "Client Not Exists" ) ;
}
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 ) ;
merchantChannelPermissionManager . switchMerchantChannelPermission ( channelApi . getMetadata ( ) . payChannel ( ) , client . getIntValue ( "client_id" ) , allow ) ;
try {
clientModifySupport . processModify ( new SwitchPermissionModify ( manager , clientMoniker , "enable_" + channel . toLowerCase ( ) , allow ) ) ;
} catch ( Exception e ) {
logger . error ( "Failed to change channel switch:{}" , channel ) ;
}
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 < JSONObject > clientBankAccounts = clientBankAccountMapper . clientBankAccounts ( clientId ) ;
@ -1886,7 +1904,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
int clientId = client . getIntValue ( "client_id" ) ;
JSONObject clientConfig = clientConfigService . find ( clientId ) ;
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 ( ) , "CB_BankPay" , includingInactive ) ) ;
@ -5206,15 +5224,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 payment Api = mpWechatApiProvider . getWechatApiForTemplateMessage ( wxopenid ) ;
String templateId = payment Api. getTemplateId ( "new-apply" ) ;
MpWechatApi wx Api = mpWechatApiProvider . getWechatApiForTemplateMessage ( wxopenid ) ;
String templateId = wx Api. getTemplateId ( "new-apply" ) ;
try {
TemplateMessage msg = initSendToComplianceTemplate ( loginUrl , wxopenid , templateId , bd_user_name , client ) ;
payment Api. sendTemplateMessage ( msg ) ;
wx Api. sendTemplateMessage ( msg ) ;
} catch ( Exception e ) {
try {
TemplateMessage msg = initSendToComplianceTemplate ( loginUrl , wxopenid , templateId , bd_user_name , client ) ;
payment Api. sendTemplateMessage ( msg ) ;
wx Api. sendTemplateMessage ( msg ) ;
} catch ( Exception ignore ) {
}
}
@ -5241,9 +5259,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
// String loginUrl =
// PlatformEnvironment.getEnvironment().concatUrl("/global/userstatus/manager_signin_wechat");
try {
MpWechatApi payment Api = mpWechatApiProvider . getNewPaymentApi ( ) ;
TemplateMessage msg = initSendToBDTemplate ( wxopenid , payment Api. getTemplateId ( "refuse-bd" ) , refuseRemark , client ) ;
payment Api. sendTemplateMessage ( msg ) ;
MpWechatApi wx Api = mpWechatApiProvider . getNewPaymentApi ( ) ;
TemplateMessage msg = initSendToBDTemplate ( wxopenid , wx Api. getTemplateId ( "refuse-bd" ) , refuseRemark , client ) ;
wx Api. sendTemplateMessage ( msg ) ;
} catch ( Exception ignored ) {
}
}
@ -5270,9 +5288,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if ( wxopenid ! = null ) {
String loginUrl = PlatformEnvironment . getEnv ( ) . concatUrl ( "/global/userstatus/manager_signin_wechat" ) ;
try {
MpWechatApi payment Api = mpWechatApiProvider . getNewPaymentApi ( ) ;
TemplateMessage msg = initSendToBDAgreeFileTemplate ( wxopenid , payment Api. getTemplateId ( "new-apply" ) , remark , client ) ;
payment Api. sendTemplateMessage ( msg ) ;
MpWechatApi wx Api = mpWechatApiProvider . getNewPaymentApi ( ) ;
TemplateMessage msg = initSendToBDAgreeFileTemplate ( wxopenid , wx Api. getTemplateId ( "new-apply" ) , remark , client ) ;
wx Api. sendTemplateMessage ( msg ) ;
} catch ( Exception e ) {
}
}
@ -5298,15 +5316,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 payment Api = mpWechatApiProvider . getWechatApiForTemplateMessage ( wxopenid ) ;
String templateId = payment Api. getTemplateId ( "new-apply" ) ;
MpWechatApi wx Api = mpWechatApiProvider . getWechatApiForTemplateMessage ( wxopenid ) ;
String templateId = wx Api. getTemplateId ( "new-apply" ) ;
try {
TemplateMessage msg = initSendToComAgreeFileTemplate ( loginUrl , wxopenid , templateId , bd_user_name , client ) ;
payment Api. sendTemplateMessage ( msg ) ;
wx Api. sendTemplateMessage ( msg ) ;
} catch ( Exception e ) {
try {
TemplateMessage msg = initSendToComAgreeFileTemplate ( loginUrl , wxopenid , templateId , bd_user_name , client ) ;
payment Api. sendTemplateMessage ( msg ) ;
wx Api. sendTemplateMessage ( msg ) ;
} catch ( Exception ignore ) {
}
}
@ -5331,15 +5349,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 payment Api = mpWechatApiProvider . getWechatApiForTemplateMessage ( wxopenid ) ;
String templateId = payment Api. getTemplateId ( "new-apply" ) ;
MpWechatApi wx Api = mpWechatApiProvider . getWechatApiForTemplateMessage ( wxopenid ) ;
String templateId = wx Api. getTemplateId ( "new-apply" ) ;
try {
TemplateMessage msg = initSendToComplianceGreenChannelTemplate ( loginUrl , wxopenid , templateId , bd_user_name , client ) ;
payment Api. sendTemplateMessage ( msg ) ;
wx Api. sendTemplateMessage ( msg ) ;
} catch ( Exception e ) {
try {
TemplateMessage msg = initSendToComplianceGreenChannelTemplate ( loginUrl , wxopenid , templateId , bd_user_name , client ) ;
payment Api. sendTemplateMessage ( msg ) ;
wx Api. sendTemplateMessage ( msg ) ;
} catch ( Exception ignore ) {
}
}
@ -5392,10 +5410,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if ( wxopenid ! = null ) {
try {
TemplateMessage msg = initTaskFinishTemplate ( wxopenid , client_moniker + "已快速开通" , "绿色通道申请通过" , "" ) ;
MpWechatApi payment Api = mpWechatApiProvider . getNewPaymentApi ( ) ;
payment Api. sendTemplateMessage ( msg ) ;
MpWechatApi wx Api = mpWechatApiProvider . getNewPaymentApi ( ) ;
wx Api. 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 +5427,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
for ( JSONObject compliance : complianceList ) {
String wxopenid = compliance . getString ( "wx_openid" ) ;
try {
MpWechatApi payment Api = mpWechatApiProvider . getNewPaymentApi ( ) ;
TemplateMessage msg = initSendCommissionTemplate ( wxopenid , payment Api. getTemplateId ( "commission" ) , "BD申请制作合同" + client_moniker ,
MpWechatApi wx Api = mpWechatApiProvider . getNewPaymentApi ( ) ;
TemplateMessage msg = initSendCommissionTemplate ( wxopenid , wx Api. getTemplateId ( "commission" ) , "BD申请制作合同" + client_moniker ,
bd_user_name , "制作合同申请" , "BD申请制作" + short_name + "的合同" ) ;
payment Api. sendTemplateMessage ( msg ) ;
wx Api. 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 +5445,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
String wxopenid = bd . getString ( "wx_openid" ) ;
if ( wxopenid ! = null ) {
try {
MpWechatApi payment Api = mpWechatApiProvider . getNewPaymentApi ( ) ;
TemplateMessage msg = initSendCommissionTemplate ( wxopenid , payment Api. getTemplateId ( "commission" ) , client_moniker + "合同制作完成" ,
MpWechatApi wx Api = mpWechatApiProvider . getNewPaymentApi ( ) ;
TemplateMessage msg = initSendCommissionTemplate ( wxopenid , wx Api. getTemplateId ( "commission" ) , client_moniker + "合同制作完成" ,
"Compliance" , "合规材料" , "上传完整合规材料,商户:" + short_name ) ;
payment Api. sendTemplateMessage ( msg ) ;
wx Api. 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 +5468,15 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
for ( JSONObject compliance : complianceList ) {
String wxopenid = compliance . getString ( "wx_openid" ) ;
try {
MpWechatApi payment Api = mpWechatApiProvider . getNewPaymentApi ( ) ;
TemplateMessage msg = initSendCommissionTemplate ( wxopenid , payment Api. getTemplateId ( "commission" ) , client_moniker + "合规材料已提交" ,
MpWechatApi wx Api = mpWechatApiProvider . getNewPaymentApi ( ) ;
TemplateMessage msg = initSendCommissionTemplate ( wxopenid , wx Api. getTemplateId ( "commission" ) , client_moniker + "合规材料已提交" ,
bd_user_name , "审核材料" , "已提交合规材料,等待审核" ) ;
payment Api. sendTemplateMessage ( msg ) ;
wx Api. 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 +5489,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if ( wxopenid ! = null ) {
try {
TemplateMessage msg = initTaskFinishTemplate ( wxopenid , client_moniker + "已正式开通" , "Compliance审核通过" , "" ) ;
MpWechatApi payment Api = mpWechatApiProvider . getNewPaymentApi ( ) ;
payment Api. sendTemplateMessage ( msg ) ;
MpWechatApi wx Api = mpWechatApiProvider . getNewPaymentApi ( ) ;
wx Api. 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 +5506,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
for ( JSONObject compliance : complianceList ) {
String wxopenid = compliance . getString ( "wx_openid" ) ;
try {
MpWechatApi payment Api = mpWechatApiProvider . getNewPaymentApi ( ) ;
TemplateMessage msg = initSendCommissionTemplate ( wxopenid , payment Api. getTemplateId ( "commission" ) , client_moniker + "申请绿色通道" ,
MpWechatApi wx Api = mpWechatApiProvider . getNewPaymentApi ( ) ;
TemplateMessage msg = initSendCommissionTemplate ( wxopenid , wx Api. getTemplateId ( "commission" ) , client_moniker + "申请绿色通道" ,
bd_user_name , "绿色通道申请" , "BD已提交绿色通道申请,商户:" + short_name ) ;
payment Api. sendTemplateMessage ( msg ) ;
wx Api. 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 +5535,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
for ( JSONObject compliance : complianceList ) {
String wxopenid = compliance . getString ( "wx_openid" ) ;
try {
MpWechatApi payment Api = mpWechatApiProvider . getNewPaymentApi ( ) ;
TemplateMessage msg = initSendCommissionTemplate ( wxopenid , payment Api. getTemplateId ( "commission" ) , "BD申请制作信用卡支付合同" + client_moniker ,
MpWechatApi wx Api = mpWechatApiProvider . getNewPaymentApi ( ) ;
TemplateMessage msg = initSendCommissionTemplate ( wxopenid , wx Api. getTemplateId ( "commission" ) , "BD申请制作信用卡支付合同" + client_moniker ,
bd_user_name , "制作卡支付合同申请" , "BD申请制作" + short_name + "的卡支付合同" ) ;
payment Api. sendTemplateMessage ( msg ) ;
wx Api. 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 +5553,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
String wxopenid = bd . getString ( "wx_openid" ) ;
if ( wxopenid ! = null ) {
try {
MpWechatApi payment Api = mpWechatApiProvider . getNewPaymentApi ( ) ;
TemplateMessage msg = initSendCommissionTemplate ( wxopenid , payment Api. getTemplateId ( "commission" ) , client_moniker + "信用卡支付合同制作完成" ,
MpWechatApi wx Api = mpWechatApiProvider . getNewPaymentApi ( ) ;
TemplateMessage msg = initSendCommissionTemplate ( wxopenid , wx Api. getTemplateId ( "commission" ) , client_moniker + "信用卡支付合同制作完成" ,
"Compliance" , "合规材料" , "上传完整合规材料,商户:" + short_name ) ;
payment Api. sendTemplateMessage ( msg ) ;
wx Api. 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 +5576,15 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
for ( JSONObject compliance : complianceList ) {
String wxopenid = compliance . getString ( "wx_openid" ) ;
try {
MpWechatApi payment Api = mpWechatApiProvider . getNewPaymentApi ( ) ;
TemplateMessage msg = initSendCommissionTemplate ( wxopenid , payment Api. getTemplateId ( "commission" ) , client_moniker + "信用卡卡支付合规材料已提交" ,
MpWechatApi wx Api = mpWechatApiProvider . getNewPaymentApi ( ) ;
TemplateMessage msg = initSendCommissionTemplate ( wxopenid , wx Api. getTemplateId ( "commission" ) , client_moniker + "信用卡卡支付合规材料已提交" ,
bd_user_name , "审核材料" , "已提交合规材料,等待审核" ) ;
payment Api. sendTemplateMessage ( msg ) ;
wx Api. 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 +5597,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if ( wxopenid ! = null ) {
try {
TemplateMessage msg = initTaskFinishTemplate ( wxopenid , client_moniker + "已正式开通" , "Card Payment Compliance审核通过" , "" ) ;
MpWechatApi payment Api = mpWechatApiProvider . getNewPaymentApi ( ) ;
payment Api. sendTemplateMessage ( msg ) ;
MpWechatApi wx Api = mpWechatApiProvider . getNewPaymentApi ( ) ;
wx Api. 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 +5611,22 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Override
@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 ) ;
if ( client = = null ) {
throw new InvalidShortIdException ( ) ;
}
checkOrgPermission ( manager , client ) ;
List < JSONObject> applices = sysW xMerchantApplyMapper. listWxMerchantApplices ( client . getInteger ( "client_id" ) ,
List < WechatMerchantInfo> applices = w xMerchantApplyMapper. 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 < JSONObject > 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 < ChannelMerchantInfo > applyQuery = new ArrayList < > ( ) ;
applyQuery . add ( wxMerchantInfo ) ;
return applyQuery ;
}
}
@ -5647,6 +5650,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 +5659,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 +5681,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 +5689,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 < 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 ) ;
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 = sysW xMerchantApplyMapper. findByClientIdAndSubMerchantAppId ( client . getInteger ( "client_id" ) , merchantAppId ) ;
WechatMerchantInfo subMerchantApplyInfo = w xMerchantApplyMapper. 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 +5729,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 +5737,32 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
checkOrgPermission ( manager , client ) ;
JSONObject params = subMerchantIdApply . insertObject ( client ) ;
params . put ( "merchant_app_id" , merchantAppId ) ;
SubMerchantInfoInheritance subMerchantInfo = JSON Object . 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 +5784,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 +5794,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new InvalidShortIdException ( ) ;
}
checkOrgPermission ( manager , client ) ;
Alipay Config. AlipayMerchant mch = AlipayEnvironment . getEnv ( ) . getAlipayRetailMerchant ( ) ;
Element resultElement = alipay Client. queryGmsPortalStatus ( mch . getPid ( ) , client ) ;
Alipay MerchantEntity alipayMch = merchantChannelApplicationManager . getRegister ( AlipayRetailApi . class ) . findMerchant ( client ) ;
Element resultElement = alipay Mch. getRawResponseXml ( ) ;
if ( ! StringUtils . equalsIgnoreCase ( "T" , resultElement . elementText ( "is_success" ) ) ) {
return "查询成功:" + resultElement . elementText ( "error" ) ;
}
@ -5841,7 +5814,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 +5850,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 +5900,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 +5935,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 +5964,14 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new BadRequestException ( "您已申请成功子商务号,请勿重复申请" ) ;
}
SubRpayMerchantInfo subRpayMerchantInfo = JSON Object . 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 +5993,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 +6001,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if ( PartnerRole . getRole ( account . getIntValue ( "role" ) ) = = PartnerRole . CASHIER ) {
return result ;
} else {
if ( expireInfo . getBoolean ( "alert" ) ) {
if ( expireInfo . getBoolean Value ( "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" ,
"<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't be where we are today. </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. </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. </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. </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" ) ;
@ -6686,9 +6579,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
} ) ;
needNotifyUsers . forEach ( userOpenId - > {
try {
MpWechatApi payment Api = mpWechatApiProvider . getNewPaymentApi ( ) ;
TemplateMessage msg = initSendTestPasswordTemplate ( userOpenId , payment Api. getTemplateId ( "test-merchant-password" ) ) ;
payment Api. sendTemplateMessage ( msg ) ;
MpWechatApi wx Api = mpWechatApiProvider . getNewPaymentApi ( ) ;
TemplateMessage msg = initSendTestPasswordTemplate ( userOpenId , wx Api. getTemplateId ( "test-merchant-password" ) ) ;
wx Api. sendTemplateMessage ( msg ) ;
} catch ( Exception e ) {
logger . error ( "给{}发送微信消息失败,原因:{}" , userOpenId , e ) ;
}