@ -16,7 +16,6 @@ import au.com.royalpay.payment.channels.yeepay.runtime.YeePayClient;
import au.com.royalpay.payment.core.PaymentChannelApi ;
import au.com.royalpay.payment.core.exceptions.EmailException ;
import au.com.royalpay.payment.core.exceptions.InvalidShortIdException ;
import au.com.royalpay.payment.core.exceptions.ParamInvalidException ;
import au.com.royalpay.payment.core.utils.OrderExpiryRuleResolver ;
import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper ;
import au.com.royalpay.payment.manage.appclient.beans.AppClientBean ;
@ -25,30 +24,16 @@ import au.com.royalpay.payment.manage.application.core.SimpleClientApplyService;
import au.com.royalpay.payment.manage.device.core.DeviceManager ;
import au.com.royalpay.payment.manage.management.sysconfig.core.impls.PermissionPartnerManagerImpl ;
import au.com.royalpay.payment.manage.mappers.financial.FinancialBDConfigMapper ;
import au.com.royalpay.payment.manage.mappers.log.ClearingDetailMapper ;
import au.com.royalpay.payment.manage.mappers.log.ClearingLogMapper ;
import au.com.royalpay.payment.manage.mappers.log.ClientsOperationLogMapper ;
import au.com.royalpay.payment.manage.mappers.log.LogClientSubMerchantIdMapper ;
import au.com.royalpay.payment.manage.mappers.log.LogSettleMailMapper ;
import au.com.royalpay.payment.manage.mappers.log.* ;
import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper ;
import au.com.royalpay.payment.manage.mappers.redpack.ActClientInvitationCodeMapper ;
import au.com.royalpay.payment.manage.mappers.risk.RiskAttentionMerchantsMapper ;
import au.com.royalpay.payment.manage.mappers.system.* ;
import au.com.royalpay.payment.manage.merchants.beans.ActivityPosterBuilder ;
import au.com.royalpay.payment.manage.merchants.beans.BankAccountInfo ;
import au.com.royalpay.payment.manage.merchants.beans.ClientAuthFilesInfo ;
import au.com.royalpay.payment.manage.merchants.beans.ClientRateConfig ;
import au.com.royalpay.payment.manage.merchants.beans.ClientRegisterInfo ;
import au.com.royalpay.payment.manage.merchants.beans.NewAccountBean ;
import au.com.royalpay.payment.manage.merchants.beans.PartnerQuery ;
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.ClientConfigService ;
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.beans.* ;
import au.com.royalpay.payment.manage.merchants.core.* ;
import au.com.royalpay.payment.manage.merchants.entity.impls.* ;
import au.com.royalpay.payment.manage.notice.core.MailService ;
import au.com.royalpay.payment.manage.permission.utils.OrgCheckUtils ;
import au.com.royalpay.payment.manage.signin.beans.TodoNotice ;
import au.com.royalpay.payment.manage.signin.core.ManagerTodoNoticeProvider ;
import au.com.royalpay.payment.manage.signin.core.SignInAccountService ;
@ -72,7 +57,6 @@ import au.com.royalpay.payment.tools.inspiry.core.InspiryPOSFinder;
import au.com.royalpay.payment.tools.locale.LocaleSupport ;
import au.com.royalpay.payment.tools.lock.Locker ;
import au.com.royalpay.payment.tools.mail.SendMail ;
import org.apache.commons.codec.binary.Base64 ;
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.MerchantInfoProvider ;
@ -80,31 +64,24 @@ import au.com.royalpay.payment.tools.merchants.qrboard.QRBoard;
import au.com.royalpay.payment.tools.merchants.qrboard.QRBoardProvider ;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole ;
import au.com.royalpay.payment.tools.permission.enums.PartnerRole ;
import au.com.royalpay.payment.tools.utils.ImageUtils ;
import au.com.royalpay.payment.tools.utils.PageListUtils ;
import au.com.royalpay.payment.tools.utils.PasswordUtils ;
import au.com.royalpay.payment.tools.utils.PdfUtils ;
import au.com.royalpay.payment.tools.utils.QRCodeUtils ;
import au.com.royalpay.payment.tools.utils.TimeZoneUtils ;
import au.com.royalpay.payment.tools.utils.* ;
import au.com.royalpay.payment.tools.websocket.notify.PartnerPageEvent ;
import cn.yixblog.platform.http.HttpRequestGenerator ;
import cn.yixblog.platform.http.HttpRequestResult ;
import com.alibaba.fastjson.JSON ;
import com.alibaba.fastjson.JSONArray ;
import com.alibaba.fastjson.JSONObject ;
import com.github.miemiedev.mybatis.paginator.domain.Order ;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds ;
import com.github.miemiedev.mybatis.paginator.domain.PageList ;
import com.yeepay.yop.sdk.service.kj.model.SubmerchantRegisterResult ;
import org.apache.commons.codec.binary.Base64 ;
import org.apache.commons.io.IOUtils ;
import org.apache.commons.lang3.ArrayUtils ;
import org.apache.commons.lang3.RandomStringUtils ;
import org.apache.commons.lang3.RandomUtils ;
import org.apache.commons.lang3.StringUtils ;
import org.apache.commons.lang3.time.DateFormatUtils ;
import org.apache.commons.lang3.time.DateUtils ;
import org.apache.el.parser.AstNot ;
import org.apache.http.client.utils.URLEncodedUtils ;
import org.dom4j.Element ;
import org.slf4j.Logger ;
import org.slf4j.LoggerFactory ;
@ -124,6 +101,13 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.thymeleaf.context.Context ;
import org.thymeleaf.spring4.SpringTemplateEngine ;
import javax.annotation.PostConstruct ;
import javax.annotation.Resource ;
import javax.crypto.* ;
import javax.crypto.spec.SecretKeySpec ;
import javax.imageio.ImageIO ;
import javax.servlet.ServletOutputStream ;
import javax.servlet.http.HttpServletResponse ;
import java.awt.* ;
import java.awt.image.BufferedImage ;
import java.io.* ;
@ -131,34 +115,18 @@ import java.math.BigDecimal;
import java.math.RoundingMode ;
import java.net.URISyntaxException ;
import java.net.URL ;
import java.n et.URLEncoder ;
import java.n io.charset.StandardCharsets ;
import java.security.InvalidKeyException ;
import java.security.InvalidParameterException ;
import java.security.NoSuchAlgorithmException ;
import java.security.SecureRandom ;
import java.text.ParseException ;
import java.text.SimpleDateFormat ;
import java.util.* ;
import java.util.List ;
import java.util.* ;
import java.util.concurrent.TimeUnit ;
import java.util.stream.Collectors ;
import java.util.zip.ZipEntry ;
import java.util.zip.ZipOutputStream ;
import javax.annotation.PostConstruct ;
import javax.annotation.Resource ;
import javax.crypto.* ;
import javax.crypto.spec.DESKeySpec ;
import javax.crypto.spec.IvParameterSpec ;
import javax.crypto.spec.SecretKeySpec ;
import javax.imageio.ImageIO ;
import javax.servlet.ServletOutputStream ;
import javax.servlet.http.HttpServletResponse ;
import cn.yixblog.platform.http.HttpRequestGenerator ;
import cn.yixblog.platform.http.HttpRequestResult ;
import sun.misc.BASE64Encoder ;
import static au.com.royalpay.payment.manage.permission.utils.OrgCheckUtils.checkOrgPermission ;
/ * *
@ -388,7 +356,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
client . put ( "contact_email" , "******" ) ;
}
} else {
client . put ( "rate_editable" , ManagerRole . OPERATOR . hasRole ( role ) ) ;
client . put ( "rate_editable" , ManagerRole . OPERATOR . hasRole ( role ) ) ;
}
}
List < JSONObject > children = clientMapper . listChildClients ( client . getIntValue ( "client_id" ) ) ;
@ -884,14 +852,14 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new InvalidShortIdException ( ) ;
}
checkOrgPermission ( manager , client ) ;
if ( client . getString ( "yeepay_sub_merchant_id" ) . equals ( yeepaySubMerchantInfo . getString ( "yeepay_sub_merchant_id" ) ) ) {
if ( client . getString ( "yeepay_sub_merchant_id" ) . equals ( yeepaySubMerchantInfo . getString ( "yeepay_sub_merchant_id" ) ) ) {
throw new BadRequestException ( "The sub merchant Id is in use" ) ;
}
JSONObject yeepayConfigValid = yeePayClientConfigMapper . findMerchantConfig ( client . getIntValue ( "client_id" ) ) ;
yeePayClientConfigMapper . updateSubMerchantIdValid ( yeepayConfigValid . getString ( "yeepay_config_id" ) , 0 ) ;
JSONObject yeepayConfigValid = yeePayClientConfigMapper . findMerchantConfig ( client . getIntValue ( "client_id" ) ) ;
yeePayClientConfigMapper . updateSubMerchantIdValid ( yeepayConfigValid . getString ( "yeepay_config_id" ) , 0 ) ;
JSONObject yeepayConfig = yeePayClientConfigMapper . findMerchantConfigBySub ( client . getIntValue ( "client_id" ) , yeepaySubMerchantInfo . getString ( "yeepay_sub_merchant_id" ) ) ;
yeePayClientConfigMapper . updateSubMerchantIdValid ( yeepayConfig . getString ( "yeepay_config_id" ) , 1 ) ;
client . put ( "yeepay_sub_merchant_id" , yeepaySubMerchantInfo . getString ( "yeepay_sub_merchant_id" ) ) ;
yeePayClientConfigMapper . updateSubMerchantIdValid ( yeepayConfig . getString ( "yeepay_config_id" ) , 1 ) ;
client . put ( "yeepay_sub_merchant_id" , yeepaySubMerchantInfo . getString ( "yeepay_sub_merchant_id" ) ) ;
clientMapper . update ( client ) ;
}
@ -1156,14 +1124,13 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
* email = bd . getString ( "email" ) ; if ( StringUtils . isNotEmpty ( email ) ) { emails . add ( email ) ; } } new Thread ( ) {
*
* @Override public void run ( ) { try { SendMail sendMail = new SendMail ( ) ; Set < String > to = new HashSet < > ( ) ;
* to . add ( mailTo ) ; sendMail . setFrom ( "info@mail.royalpay.com.au" ) ; sendMail . setMailTos ( to ) ;
* sendMail . setMailCcs ( emails ) ; sendMail . setTitle ( "Your RoyalPay Cross-border Payment has been set up" ) ;
* sendMail . setContent ( content ) ; sendMail . setTags ( tags ) ; JSONObject mailResult =
* mailGunService . sendMail ( sendMail ) ; clientModifySupport . processClientModify ( new EmailModify ( account ,
* client . getString ( "client_moniker" ) , 3 , mailResult . getString ( "mail_id" ) ) ) ; } catch ( Exception e ) {
* clientModifySupport . processClientModify ( new EmailModify ( account , client . getString ( "client_moniker" ) , 0 ,
* null ) ) ; throw new EmailException ( "Email Sending Failed" , e ) ; } } } . start ( ) ; }
*
* to . add ( mailTo ) ; sendMail . setFrom ( "info@mail.royalpay.com.au" ) ; sendMail . setMailTos ( to ) ;
* sendMail . setMailCcs ( emails ) ; sendMail . setTitle ( "Your RoyalPay Cross-border Payment has been set up" ) ;
* sendMail . setContent ( content ) ; sendMail . setTags ( tags ) ; JSONObject mailResult =
* mailGunService . sendMail ( sendMail ) ; clientModifySupport . processClientModify ( new EmailModify ( account ,
* client . getString ( "client_moniker" ) , 3 , mailResult . getString ( "mail_id" ) ) ) ; } catch ( Exception e ) {
* clientModifySupport . processClientModify ( new EmailModify ( account , client . getString ( "client_moniker" ) , 0 ,
* null ) ) ; throw new EmailException ( "Email Sending Failed" , e ) ; } } } . start ( ) ; }
* /
public void sendAuthInitEmail ( JSONObject account , final JSONObject client ) {
@ -1351,7 +1318,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new InvalidShortIdException ( ) ;
}
checkOrgPermission ( manager , client ) ;
if ( ! client . containsKey ( "parent_client_id" ) & & client . getBoolean ( "sub_manage" ) ) {
return clientAccountMapper . partnerAndSubPartnerAccounts ( client . getIntValue ( "client_id" ) ) ;
}
return clientAccountMapper . listPartnerAccounts ( client . getIntValue ( "client_id" ) ) ;
}
@Override
@ -1370,7 +1341,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
accountJson . put ( "salt" , salt ) ;
accountJson . put ( "password_hash" , PasswordUtils . hashPwd ( account . getPwd ( ) , salt ) ) ;
accountJson . put ( "password_aes" , PasswordUtils . encryptAESPwd ( account . getPwd ( ) ) ) ;
accountJson . put ( "client_id" , client. getIntValue ( "client_id" ) ) ;
accountJson . put ( "client_id" , account. getClientId ( ) = = 0 ? client. getIntValue ( "client_id" ) : account . getClientId ( ) ) ;
accountJson . put ( "creator" , managerType = = 1 ? manager . getString ( "manager_id" ) : manager . getString ( "account_id" ) ) ;
accountJson . put ( "creator_type" , managerType ) ;
accountJson . put ( "create_time" , new Date ( ) ) ;
@ -1401,8 +1372,15 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if ( clientMoniker ! = null ) {
JSONObject client = getClientInfoByMoniker ( clientMoniker ) ;
Assert . notNull ( client ) ;
//父商户全局管理子商户时候,跳过
if ( account . getIntValue ( "client_id" ) ! = client . getIntValue ( "client_id" ) ) {
throw new BadRequestException ( "error.partner.valid.account_not_match" ) ;
//登录用户所属商户
JSONObject clientLogin = getClientInfo ( account . getIntValue ( "client_id" ) ) ;
Boolean validChildClients = clientLogin . containsKey ( "parent_client_id" ) ? clientLogin . getIntValue ( "parent_client_id" ) = = client . getIntValue ( "client_id" ) : false ;
Boolean validLevel3Clients = listLevel3Client ( client . getIntValue ( "client_id" ) ) . contains ( clientLogin . getIntValue ( "parent_client_id" ) ) ;
if ( ! ( client . getBoolean ( "sub_manage" ) & & ( validChildClients | | validLevel3Clients ) ) ) {
throw new BadRequestException ( "error.partner.valid.account_not_match" ) ;
}
}
checkOrgPermission ( manager , client ) ;
}
@ -1795,7 +1773,18 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new InvalidShortIdException ( ) ;
}
checkOrgPermission ( manager , client ) ;
return clientMapper . listChildClients ( client . getIntValue ( "client_id" ) ) ;
JSONObject listSubClients = new JSONObject ( ) ;
List < JSONObject > listChildClients = clientMapper . listChildClients ( client . getIntValue ( "client_id" ) ) ;
for ( JSONObject partner : listChildClients ) {
List < JSONObject > clients = clientMapper . listChildClients ( partner . getIntValue ( "client_id" ) ) ;
if ( clients . size ( ) > 0 ) {
partner . put ( "level3Clients" , clients ) ;
clients . forEach ( e - > {
e . put ( "parent_client_moniker" , partner . getString ( "client_moniker" ) ) ;
} ) ;
}
}
return listChildClients ;
}
@Override
@ -1874,7 +1863,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
for ( String currentClientId : client_ids ) {
JSONObject clientInfo = getClientInfo ( Integer . parseInt ( currentClientId ) ) ;
if ( clientInfo . containsKey ( "parent_client_id" ) ) {
if ( clientInfo . getIntValue ( "parent_client_id" ) ! = client_id ) {
int parentClientId = clientInfo . getIntValue ( "parent_client_id" ) ;
if ( parentClientId ! = client_id & & client_id ! = Integer . parseInt ( currentClientId ) & & ! listLevel3Client ( client_id ) . contains ( parentClientId ) ) {
throw new Exception ( "partner has no permission" ) ;
}
}
@ -1883,6 +1873,27 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
}
@Override
public List < Integer > listLevel3Client ( int clientId ) {
return clientMapper . childClientId ( clientId ) ;
}
@Override
public void updateRefundCreditLine ( JSONObject manager , String clientMoniker , JSONObject refundLineInfo ) {
JSONObject client = getClientInfoByMoniker ( clientMoniker ) ;
if ( client = = null ) {
throw new InvalidShortIdException ( ) ;
}
OrgCheckUtils . checkOrgPermission ( manager , client ) ;
JSONObject update = new JSONObject ( ) ;
int clientId = client . getIntValue ( "client_id" ) ;
BigDecimal refundCreditLine = refundLineInfo . getBigDecimal ( "refund_credit_line" ) ;
update . put ( "client_id" , clientId ) ;
update . put ( "refund_credit_line" , refundCreditLine ) ;
clientMapper . update ( update ) ;
clientInfoCacheSupport . clearClientCache ( clientId ) ;
}
@Override
@Transactional
public void updateClientBDUsers ( JSONObject manager , String clientMoniker , JSONObject data ) throws Exception {
@ -2200,6 +2211,57 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
clientDeviceMapper . save ( newDevice ) ;
}
@Override
public void verifyRefundPassword ( JSONObject account , JSONObject json ) {
JSONObject clientConfig = clientConfigMapper . find ( account . getIntValue ( "client_id" ) ) ;
String needVerifyPassword = json . getString ( "refund_password" ) ;
String refundPwdSalt = clientConfig . getString ( "refund_pwd_salt" ) ;
if ( ! StringUtils . equals ( clientConfig . getString ( "refund_pwd" ) , PasswordUtils . hashPwd ( needVerifyPassword , refundPwdSalt ) ) ) {
throw new BadRequestException ( "Incorrect refund password" ) ;
}
}
@Override
public void resetRefundPassword ( JSONObject account , JSONObject json ) {
if ( PartnerRole . getRole ( account . getIntValue ( "role" ) ) ! = PartnerRole . ADMIN ) {
throw new BadRequestException ( "You have no permission" ) ;
}
verifyRefundPassword ( account , json ) ;
String newSalt = PasswordUtils . newSalt ( ) ;
String newPassWord = json . getString ( "new_refund_password" ) ;
if ( ! StringUtils . isNumeric ( newPassWord ) ) {
throw new BadRequestException ( "Refund password must be pure number" ) ;
}
String newPwdHash = PasswordUtils . hashPwd ( newPassWord , newSalt ) ;
if ( StringUtils . equals ( newPwdHash , PasswordUtils . hashPwd ( json . getString ( "refund_password" ) , newSalt ) ) ) {
throw new BadRequestException ( "Old and new passwords cannot be duplicated" ) ;
}
JSONObject update = new JSONObject ( ) ;
update . put ( "client_id" , account . getIntValue ( "client_id" ) ) ;
update . put ( "refund_pwd" , newPwdHash ) ;
update . put ( "refund_pwd_salt" , newSalt ) ;
clientConfigMapper . update ( update ) ;
}
@Override
public void resetRefundPasswordByManage ( String clientMoniker , JSONObject manage , JSONObject json ) {
JSONObject client = getClientInfoByMoniker ( clientMoniker ) ;
if ( client = = null ) {
throw new InvalidShortIdException ( ) ;
}
JSONObject update = new JSONObject ( ) ;
update . put ( "client_id" , client . getIntValue ( "client_id" ) ) ;
String newPassWord = json . getString ( "new_refund_password" ) ;
if ( ! StringUtils . isNumeric ( newPassWord ) ) {
throw new BadRequestException ( "Refund password must be pure number" ) ;
}
String newSalt = PasswordUtils . newSalt ( ) ;
String newPwdHash = PasswordUtils . hashPwd ( newPassWord , newSalt ) ;
update . put ( "refund_pwd" , newPwdHash ) ;
update . put ( "refund_pwd_salt" , newSalt ) ;
clientConfigMapper . update ( update ) ;
}
@Override
public void updateDevie ( JSONObject manager , String clientMoniker , String devId , String remark ) {
JSONObject client = getClientInfoByMoniker ( clientMoniker ) ;
@ -3359,7 +3421,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Override
@Transactional
public void setSkipClearing ( JSONObject account , String clientMoniker , Boolean skip_clearing , String remark ) {
public void setSkipClearing ( JSONObject account , String clientMoniker , Boolean skip_clearing , String remark ) {
JSONObject client = getClientInfoByMoniker ( clientMoniker ) ;
if ( client = = null ) {
throw new InvalidShortIdException ( ) ;
@ -3367,7 +3429,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
clientModifySupport . processClientConfigModify ( new SwitchPermissionModify ( account , clientMoniker , "skip_clearing" , skip_clearing ) ) ;
if ( ! skip_clearing ) {
if ( "" . equals ( remark ) | | remark = = null ) {
if ( "" . equals ( remark ) | | remark = = null ) {
throw new ServerErrorException ( "请填写关闭清算原因" ) ;
}
JSONObject clientConfig = clientConfigMapper . find ( client . getIntValue ( "client_id" ) ) ;
@ -3431,8 +3493,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new InvalidShortIdException ( ) ;
}
List < JSONObject > transactions = clearingDistributedSurchargeMapper . findTransactions ( client . getIntValue ( "client_id" ) ) ;
transactions . forEach ( e - > {
if ( "Credit" . equals ( e . getString ( "type" ) ) ) {
transactions . forEach ( e - > {
if ( "Credit" . equals ( e . getString ( "type" ) ) & & ! "settle revoke" . equals ( e . getString ( "remark" ) ) ) {
JSONObject manager = managerMapper . findDetail ( e . getString ( "operation" ) ) ;
e . put ( "operator_displayname" , manager . getString ( "display_name" ) ) ;
}
@ -3441,25 +3503,21 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
@Override
public List < JSONObject > getAccount TransactionsByDate ( JSONObject account , String clientMoniker , String date ) {
public List < JSONObject > getAccount DetailByMonths ( JSONObject account , String clientMoniker ) {
JSONObject client = getClientInfoByMoniker ( clientMoniker ) ;
if ( client = = null ) {
throw new InvalidShortIdException ( ) ;
}
return financialSurchargeAccountDetailMapper . listSettlementDatesByClientId ( client . getIntValue ( "client_id" ) ) ;
}
JSONObject params = new JSONObject ( ) ;
params . put ( "client_id" , client . getIntValue ( "client_id" ) ) ;
params . put ( "year" , date . substring ( 0 , 4 ) ) ;
params . put ( "month" , date . substring ( date . length ( ) - 2 , date . length ( ) ) ) ;
List < JSONObject > transactions = clearingDistributedSurchargeMapper . findTransactionsByDate ( params ) ;
transactions . forEach ( e - > {
if ( "Credit" . equals ( e . getString ( "type" ) ) ) {
JSONObject manager = managerMapper . findDetail ( e . getString ( "operation" ) ) ;
e . put ( "operator_displayname" , manager . getString ( "display_name" ) ) ;
}
} ) ;
return transactions ;
@Override
public List < JSONObject > getAccountTransactionsByDetailId ( JSONObject account , String clientMoniker , String detailId ) {
JSONObject client = getClientInfoByMoniker ( clientMoniker ) ;
if ( client = = null ) {
throw new InvalidShortIdException ( ) ;
}
return clearingDistributedSurchargeMapper . findSurchargeTransactionsByDetailId ( client . getIntValue ( "client_id" ) , detailId ) ;
}
@Override
@ -3468,8 +3526,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if ( client = = null ) {
throw new InvalidShortIdException ( ) ;
}
List < JSONObject > details = financialSurchargeAccountDetailMapper . findDetailsByClientId ( client . getIntValue ( "client_id" ) ) ;
return details ;
return financialSurchargeAccountDetailMapper . findDetailsByClientId ( client . getIntValue ( "client_id" ) ) ;
}
@Override
@ -3487,19 +3544,19 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new ServerErrorException ( "Processing task, wait for a moment" ) ;
}
try {
JSONObject surcharge _a ccount = clientsSurchargeAccountsMapper . find ( client . getIntValue ( "client_id" ) ) ;
JSONObject surcharge A ccount = clientsSurchargeAccountsMapper . find ( client . getIntValue ( "client_id" ) ) ;
transaction . put ( "client_id" , client . getIntValue ( "client_id" ) ) ;
transaction . put ( "type" , "Credit" ) ;
transaction . put ( "total_surcharge" , BigDecimal . ZERO ) ;
transaction . put ( "tax_amount" , BigDecimal . ZERO ) ;
transaction . put ( "post_balance" , surcharge_a ccount. getBigDecimal ( "balance" ) . add ( transaction . getBigDecimal ( "amount" ) ) ) ;
transaction . put ( "operation" , account . getString ( "manager_id" ) ) ;
transaction . put ( "create_time" , new Date ( ) ) ;
transaction . put ( "tax_amount" , BigDecimal . ZERO ) ;
transaction . put ( "post_balance" , surchargeA ccount. getBigDecimal ( "balance" ) . add ( transaction . getBigDecimal ( "amount" ) ) ) ;
transaction . put ( "operation" , account . getString ( "manager_id" ) ) ;
transaction . put ( "create_time" , new Date ( ) ) ;
clearingDistributedSurchargeMapper . save ( transaction ) ;
surcharge _account. put ( "balance" , surcharge_a ccount. getBigDecimal ( "balance" ) . add ( transaction . getBigDecimal ( "amount" ) ) ) ;
clientsSurchargeAccountsMapper . update ( surcharge _a ccount) ;
surcharge Account. put ( "balance" , surchargeA ccount. getBigDecimal ( "balance" ) . add ( transaction . getBigDecimal ( "amount" ) ) ) ;
clientsSurchargeAccountsMapper . update ( surcharge A ccount) ;
} finally {
locker . unlock ( clientMoniker + "_surcharge_account_save" ) ;
@ -3672,8 +3729,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
}
private TemplateMessage initSendToComplianceGreenChannelTemplate ( String loginUrl , String wxopenid , String templateId2 , String bd_user_name ,
JSONObject client ) {
private TemplateMessage initSendToComplianceGreenChannelTemplate ( String loginUrl , String wxopenid , String templateId2 , String bd_user_name , JSONObject client ) {
TemplateMessage msg = new TemplateMessage ( wxopenid , templateId2 , loginUrl ) ;
msg . put ( "first" , bd_user_name + " 提交了新商户绿色通道申请,请审核" , "#ff0000" ) ;
msg . put ( "keyword1" , client . getString ( "client_moniker" ) + "申请绿色通道" , "#0000ff" ) ;
@ -3938,6 +3994,14 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
client . put ( "bank_id" , client_bank . getString ( "account_no" ) ) ;
if ( StringUtils . isBlank ( client . getString ( "business_structure" ) ) ) {
throw new BadRequestException ( "Business Structure can't be null" ) ;
}
if ( StringUtils . isBlank ( client . getString ( "alipayindustry" ) ) ) {
throw new BadRequestException ( "Alipay Industry can't be null" ) ;
}
if ( ! "Company" . equals ( client . getString ( "business_structure" ) ) ) {
if ( StringUtils . isBlank ( representative_id . getString ( "representative_id" ) ) ) {
throw new BadRequestException ( "ID or passport number can't be null" ) ;
@ -3976,6 +4040,82 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
return "查询成功:" + responseElement . elementText ( "secondary_merchant_id" ) + "报备状态 : " + responseElement . elementText ( "status" ) ;
}
@Override
public JSONObject queryAlipayGmsJson ( String clientMoniker , JSONObject manager ) {
JSONObject client = getClientInfoByMoniker ( clientMoniker ) ;
if ( client = = null ) {
throw new InvalidShortIdException ( ) ;
}
checkOrgPermission ( manager , client ) ;
AlipayConfig . AlipayMerchant mch = AlipayEnvironment . getEnv ( ) . getAlipayRetailMerchant ( ) ;
JSONObject queryGMSJson = new JSONObject ( new LinkedHashMap ( ) ) ;
queryGMSJson . put ( "service" , "alipay.overseas.secmerchant.offline.maintain" ) ;
queryGMSJson . put ( "partner" , mch . getPid ( ) ) ;
queryGMSJson . put ( "sign_type" , "MD5" ) ;
queryGMSJson . put ( "_input_charset" , "utf-8" ) ;
queryGMSJson . put ( "timestamp" , DateFormatUtils . format ( System . currentTimeMillis ( ) , "yyyy-MM-dd HH:mm:ss" ) ) ;
queryGMSJson . put ( "secondary_merchant_name" , client . getString ( "company_name" ) ) ;
queryGMSJson . put ( "secondary_merchant_id" , client . getString ( "client_moniker" ) ) ;
queryGMSJson . put ( "store_id" , client . getString ( "client_moniker" ) ) ;
queryGMSJson . put ( "store_name" , client . getString ( "short_name" ) ) ;
queryGMSJson . put ( "store_country" , client . getString ( "country" ) . substring ( 0 , 2 ) ) ;
queryGMSJson . put ( "store_address" , client . getString ( "country" ) + " " + client . getString ( "state" ) + " " + client . getString ( "suburb" ) + " " + client . getString ( "address" ) ) ;
queryGMSJson . put ( "store_industry" , client . getString ( "alipayindustry" ) ) ;
queryGMSJson . put ( "internal_store_photo" , client . getString ( "company_photo" ) ) ;
queryGMSJson . put ( "external_storefront_photo" , client . getString ( "store_photo" ) ) ;
queryGMSJson . put ( "register_country" , client . getString ( "country" ) . substring ( 0 , 2 ) ) ;
queryGMSJson . put ( "register_address" , client . getString ( "country" ) + " " + client . getString ( "state" ) + " " + client . getString ( "suburb" ) + " " + client . getString ( "address" ) ) ;
if ( "Company" . equals ( client . getString ( "business_structure" ) ) ) {
queryGMSJson . put ( "secondary_merchant_type" , "ENTERPRISE" ) ;
queryGMSJson . put ( "registration_no" , client . getString ( "acn" ) ) ;
} else {
queryGMSJson . put ( "secondary_merchant_type" , "INDIVIDUAL" ) ;
queryGMSJson . put ( "representative_name" , client . getString ( "contact_person" ) ) ;
}
queryGMSJson . put ( "contact_no" , client . getString ( "contact_phone" ) ) ;
queryGMSJson . put ( "contact_email" , client . getString ( "contact_email" ) ) ;
return queryGMSJson ;
}
@Override
public JSONObject queryAlipayOnlineGmsJson ( String clientMoniker , JSONObject manager ) {
JSONObject client = getClientInfoByMoniker ( clientMoniker ) ;
if ( client = = null ) {
throw new InvalidShortIdException ( ) ;
}
checkOrgPermission ( manager , client ) ;
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 ( ) ) ;
queryGMSJson . put ( "sign_type" , "MD5" ) ;
queryGMSJson . put ( "_input_charset" , "utf-8" ) ;
queryGMSJson . put ( "timestamp" , DateFormatUtils . format ( System . currentTimeMillis ( ) , "yyyy-MM-dd HH:mm:ss" ) ) ;
queryGMSJson . put ( "secondary_merchant_name" , client . getString ( "company_name" ) ) ;
queryGMSJson . put ( "secondary_merchant_id" , client . getString ( "client_moniker" ) ) ;
queryGMSJson . put ( "secondary_merchant_industry" , client . getString ( "alipayindustry" ) ) ;
queryGMSJson . put ( "register_country" , client . getString ( "country" ) . substring ( 0 , 2 ) ) ;
queryGMSJson . put ( "register_address" , client . getString ( "country" ) + " " + client . getString ( "state" ) + " " + client . getString ( "suburb" ) + " " + client . getString ( "address" ) ) ;
JSONObject website = new JSONObject ( ) ;
List < JSONObject > websites = new ArrayList < > ( ) ;
website . put ( "site_type" , "WEB" ) ;
website . put ( "site_url" , client . getString ( "company_website" ) ) ;
website . put ( "site_name" , client . getString ( "company_name" ) + " Website" ) ;
websites . add ( website ) ;
queryGMSJson . put ( "site_infos" , websites . toString ( ) ) ;
if ( "Company" . equals ( client . getString ( "business_structure" ) ) ) {
queryGMSJson . put ( "secondary_merchant_type" , "ENTERPRISE" ) ;
queryGMSJson . put ( "registration_no" , client . getString ( "acn" ) ) ;
queryGMSJson . put ( "shareholder_name" , client . getString ( "contact_person" ) ) ;
} else {
queryGMSJson . put ( "secondary_merchant_type" , "INDIVIDUAL" ) ;
queryGMSJson . put ( "representative_name" , client . getString ( "contact_person" ) ) ;
}
queryGMSJson . put ( "contact_no" , client . getString ( "contact_phone" ) ) ;
queryGMSJson . put ( "contact_email" , client . getString ( "contact_email" ) ) ;
return queryGMSJson ;
}
@Override
public void registerAlipayOnlineGms ( String clientMoniker , JSONObject representative_id , JSONObject manager ) {
JSONObject client = getClientInfoByMoniker ( clientMoniker ) ;
@ -3986,6 +4126,14 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if ( ! client . containsKey ( "company_website" ) ) {
throw new InvalidParameterException ( "Website cannot be empty " ) ;
}
if ( StringUtils . isBlank ( client . getString ( "business_structure" ) ) ) {
throw new BadRequestException ( "Business Structure can't be null" ) ;
}
if ( StringUtils . isBlank ( client . getString ( "alipayindustry" ) ) ) {
throw new BadRequestException ( "Alipay Industry can't be null" ) ;
}
JSONObject client_bank = getBankAccountByClientId ( client . getIntValue ( "client_id" ) ) ;
if ( client_bank = = null | | client_bank . size ( ) < = 0 ) {
throw new BadRequestException ( "The Partner's Account is not config!" ) ;
@ -4029,7 +4177,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
@Override
public void subRpayMerchantApplication ( String clientMoniker , JSONObject merchantInfo , JSONObject manager ) {
public void subRpayMerchantApplication ( String clientMoniker , JSONObject merchantInfo , JSONObject manager ) {
JSONObject client = getClientInfoByMoniker ( clientMoniker ) ;
if ( client = = null ) {
throw new InvalidShortIdException ( ) ;
@ -4038,7 +4186,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
List < JSONObject > listByshortName = sysRpayMerchantApplyMapper . listByShortName ( merchantInfo . getString ( "company_shortname" ) ) ;
if ( listByshortName . size ( ) > 0 ) {
if ( listByshortName . size ( ) > 0 ) {
throw new BadRequestException ( "请修改【" + clientMoniker + "】的Company shortName信息( Short Name 已被使用)" ) ;
}
if ( client . getString ( "rpay_enterprise_id" ) ! = null ) {
@ -4059,7 +4207,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
merchantInfo . put ( "merchant_shortname" , merchantInfo . getString ( "company_shortname" ) ) ;
sysRpayMerchantApplyMapper . insertRpayMerchantApply ( merchantInfo ) ;
clientMapper . updateRpayEnterpriseId ( client . getIntValue ( "client_id" ) , rpayMerchantInfo . getString ( "merchantId" ) ) ;
} else {
} else {
throw new BadRequestException ( "请求失败" ) ;
}
}
@ -4074,41 +4222,41 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
checkOrgPermission ( manager , client ) ;
List < JSONObject > yeepayClientConfigs = yeePayClientConfigMapper . findAllMerchantConfig ( client . getIntValue ( "client_id" ) ) ;
if ( yeepayClientConfigs ! = null ) {
for ( JSONObject yeepayClientConfig : yeepayClientConfigs ) {
if ( yeepayClientConfig . getIntValue ( "is_valid" ) = = 1 ) {
yeePayClientConfigMapper . updateSubMerchantIdValid ( yeepayClientConfig . getString ( "yeepay_config_id" ) , 0 ) ;
if ( yeepayClientConfigs ! = null ) {
for ( JSONObject yeepayClientConfig : yeepayClientConfigs ) {
if ( yeepayClientConfig . getIntValue ( "is_valid" ) = = 1 ) {
yeePayClientConfigMapper . updateSubMerchantIdValid ( yeepayClientConfig . getString ( "yeepay_config_id" ) , 0 ) ;
}
}
}
merchantInfo . put ( "create_time" , new Date ( ) ) ;
merchantInfo . put ( "operator" , manager . getString ( "display_name" ) ) ;
merchantInfo . put ( "client_id" , client . getIntValue ( "client_id" ) ) ;
merchantInfo . put ( "client_id" , merchantInfo . getString ( "client_id" ) ) ;
merchantInfo . put ( "create_time" , new Date ( ) ) ;
merchantInfo . put ( "operator" , manager . getString ( "display_name" ) ) ;
merchantInfo . put ( "client_id" , client . getIntValue ( "client_id" ) ) ;
merchantInfo . put ( "client_id" , merchantInfo . getString ( "client_id" ) ) ;
// merchantInfo.put("vouchers",merchantInfo.getJSONObject("vouchers").toJSONString());
List < JSONObject > directorsAll = new ArrayList < > ( ) ;
List < JSONObject > executivesAll = new ArrayList < > ( ) ;
directorsAll . add ( merchantInfo . getJSONObject ( "directors" ) ) ;
executivesAll . add ( merchantInfo . getJSONObject ( "executives" ) ) ;
JSONObject extInfo = new JSONObject ( ) ;
extInfo . put ( "directors" , directorsAll ) ;
extInfo . put ( "executives" , executivesAll ) ;
merchantInfo . put ( "extinfo" , extInfo . toJSONString ( ) ) ;
extInfo . put ( "directors" , directorsAll ) ;
extInfo . put ( "executives" , executivesAll ) ;
merchantInfo . put ( "extinfo" , extInfo . toJSONString ( ) ) ;
yeePayClientConfigMapper . saveMerchantConfig ( merchantInfo ) ;
JSONObject yeepayConfig = yeePayClientConfigMapper . findMerchantConfig ( client . getIntValue ( "client_id" ) ) ;
yeepayConfig . put ( "company_website" , merchantInfo . getString ( "company_website" ) ) ;
yeepayConfig . put ( "abn" , merchantInfo . getString ( "abn" ) ) ;
yeepayConfig . put ( "company_name" , merchantInfo . getString ( "company_name" ) ) ;
yeepayConfig . put ( "contact_phone" , merchantInfo . getString ( "contact_phone" ) ) ;
yeepayConfig . put ( "contact_email" , merchantInfo . getString ( "contact_email" ) ) ;
yeepayConfig . put ( "contact_person" , merchantInfo . getString ( "contact_person" ) ) ;
SubmerchantRegisterResult result = yeePayClient . registerMerchant ( client , yeepayConfig ) ;
if ( result . getStatus ( ) . equals ( "FAILED" ) ) {
yeepayConfig . put ( "company_website" , merchantInfo . getString ( "company_website" ) ) ;
yeepayConfig . put ( "abn" , merchantInfo . getString ( "abn" ) ) ;
yeepayConfig . put ( "company_name" , merchantInfo . getString ( "company_name" ) ) ;
yeepayConfig . put ( "contact_phone" , merchantInfo . getString ( "contact_phone" ) ) ;
yeepayConfig . put ( "contact_email" , merchantInfo . getString ( "contact_email" ) ) ;
yeepayConfig . put ( "contact_person" , merchantInfo . getString ( "contact_person" ) ) ;
SubmerchantRegisterResult result = yeePayClient . registerMerchant ( client , yeepayConfig ) ;
if ( result . getStatus ( ) . equals ( "FAILED" ) ) {
throw new BadRequestException ( result . getErrorMsg ( ) ) ;
}
yeepayConfig . put ( "sub_merchant_id" , result . getSubMerchantId ( ) ) ;
yeePayClientConfigMapper . updateSubMerchantId ( yeepayConfig . getString ( "yeepay_config_id" ) , result . getMerchantId ( ) , result . getSubMerchantId ( ) ) ;
client . put ( "yeepay_sub_merchant_id" , result . getSubMerchantId ( ) ) ;
yeepayConfig . put ( "sub_merchant_id" , result . getSubMerchantId ( ) ) ;
yeePayClientConfigMapper . updateSubMerchantId ( yeepayConfig . getString ( "yeepay_config_id" ) , result . getMerchantId ( ) , result . getSubMerchantId ( ) ) ;
client . put ( "yeepay_sub_merchant_id" , result . getSubMerchantId ( ) ) ;
clientMapper . update ( client ) ;
}
@ -4119,25 +4267,25 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new InvalidShortIdException ( ) ;
}
checkOrgPermission ( manager , client ) ;
JSONObject config = yeePayClientConfigMapper . findMerchantConfigBySub ( client . getIntValue ( "client_id" ) , merchantInfo . getString ( "sub_merchant_id" ) ) ;
if ( config ! = null ) {
JSONObject config = yeePayClientConfigMapper . findMerchantConfigBySub ( client . getIntValue ( "client_id" ) , merchantInfo . getString ( "sub_merchant_id" ) ) ;
if ( config ! = null ) {
throw new BadRequestException ( "You had add the sub merchant id" ) ;
}
List < JSONObject > yeepayClientConfigs = yeePayClientConfigMapper . findAllMerchantConfig ( client . getIntValue ( "client_id" ) ) ;
if ( yeepayClientConfigs ! = null ) {
for ( JSONObject yeepayClientConfig : yeepayClientConfigs ) {
if ( yeepayClientConfig . getIntValue ( "is_valid" ) = = 1 ) {
yeePayClientConfigMapper . updateSubMerchantIdValid ( yeepayClientConfig . getString ( "yeepay_config_id" ) , 0 ) ;
if ( yeepayClientConfigs ! = null ) {
for ( JSONObject yeepayClientConfig : yeepayClientConfigs ) {
if ( yeepayClientConfig . getIntValue ( "is_valid" ) = = 1 ) {
yeePayClientConfigMapper . updateSubMerchantIdValid ( yeepayClientConfig . getString ( "yeepay_config_id" ) , 0 ) ;
}
}
}
merchantInfo . put ( "client_id" , client . getIntValue ( "client_id" ) ) ;
merchantInfo . put ( "merchant_id" , yeePayConfig . getAppKey ( ) . split ( "_" ) [ 1 ] ) ;
merchantInfo . put ( "create_time" , new Date ( ) ) ;
merchantInfo . put ( "is_valid" , 1 ) ;
merchantInfo . put ( "operator" , manager . getString ( "display_name" ) ) ;
merchantInfo . put ( "client_id" , client . getIntValue ( "client_id" ) ) ;
merchantInfo . put ( "merchant_id" , yeePayConfig . getAppKey ( ) . split ( "_" ) [ 1 ] ) ;
merchantInfo . put ( "create_time" , new Date ( ) ) ;
merchantInfo . put ( "is_valid" , 1 ) ;
merchantInfo . put ( "operator" , manager . getString ( "display_name" ) ) ;
yeePayClientConfigMapper . saveMerchantConfig ( merchantInfo ) ;
client . put ( "yeepay_sub_merchant_id" , merchantInfo . getString ( "sub_merchant_id" ) ) ;
client . put ( "yeepay_sub_merchant_id" , merchantInfo . getString ( "sub_merchant_id" ) ) ;
clientMapper . update ( client ) ;
}
@ -4148,28 +4296,28 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new InvalidShortIdException ( ) ;
}
checkOrgPermission ( manager , client ) ;
JSONObject yeepayConfig = yeePayClientConfigMapper . findMerchantConfigBySub ( client . getIntValue ( "client_id" ) , merchantInfo . getString ( "subMerchantId" ) ) ;
JSONObject yeepayConfig = yeePayClientConfigMapper . findMerchantConfigBySub ( client . getIntValue ( "client_id" ) , merchantInfo . getString ( "subMerchantId" ) ) ;
List < JSONObject > directorsAll = new ArrayList < > ( ) ;
List < JSONObject > executivesAll = new ArrayList < > ( ) ;
directorsAll . add ( merchantInfo . getJSONObject ( "directors" ) ) ;
executivesAll . add ( merchantInfo . getJSONObject ( "executives" ) ) ;
JSONObject extInfo = new JSONObject ( ) ;
extInfo . put ( "directors" , directorsAll ) ;
extInfo . put ( "executives" , executivesAll ) ;
yeepayConfig . put ( "extinfo" , extInfo . toJSONString ( ) ) ;
yeepayConfig . put ( "industry" , merchantInfo . getString ( "industry" ) ) ;
yeepayConfig . put ( "business_content" , merchantInfo . getString ( "business_content" ) ) ;
yeepayConfig . put ( "business_licence" , merchantInfo . getString ( "business_licence" ) ) ;
extInfo . put ( "directors" , directorsAll ) ;
extInfo . put ( "executives" , executivesAll ) ;
yeepayConfig . put ( "extinfo" , extInfo . toJSONString ( ) ) ;
yeepayConfig . put ( "industry" , merchantInfo . getString ( "industry" ) ) ;
yeepayConfig . put ( "business_content" , merchantInfo . getString ( "business_content" ) ) ;
yeepayConfig . put ( "business_licence" , merchantInfo . getString ( "business_licence" ) ) ;
yeePayClientConfigMapper . update ( yeepayConfig ) ;
yeepayConfig . put ( "company_website" , merchantInfo . getString ( "company_website" ) ) ;
yeepayConfig . put ( "abn" , merchantInfo . getString ( "abn" ) ) ;
yeepayConfig . put ( "company_name" , merchantInfo . getString ( "company_name" ) ) ;
yeepayConfig . put ( "contact_phone" , merchantInfo . getString ( "contact_phone" ) ) ;
yeepayConfig . put ( "contact_email" , merchantInfo . getString ( "contact_email" ) ) ;
yeepayConfig . put ( "contact_person" , merchantInfo . getString ( "contact_person" ) ) ;
yeepayConfig . put ( "mode" , "UPDATE" ) ;
SubmerchantRegisterResult result = yeePayClient . registerMerchant ( client , yeepayConfig ) ;
if ( result . getStatus ( ) . equals ( "FAILED" ) ) {
yeepayConfig . put ( "company_website" , merchantInfo . getString ( "company_website" ) ) ;
yeepayConfig . put ( "abn" , merchantInfo . getString ( "abn" ) ) ;
yeepayConfig . put ( "company_name" , merchantInfo . getString ( "company_name" ) ) ;
yeepayConfig . put ( "contact_phone" , merchantInfo . getString ( "contact_phone" ) ) ;
yeepayConfig . put ( "contact_email" , merchantInfo . getString ( "contact_email" ) ) ;
yeepayConfig . put ( "contact_person" , merchantInfo . getString ( "contact_person" ) ) ;
yeepayConfig . put ( "mode" , "UPDATE" ) ;
SubmerchantRegisterResult result = yeePayClient . registerMerchant ( client , yeepayConfig ) ;
if ( result . getStatus ( ) . equals ( "FAILED" ) ) {
throw new BadRequestException ( result . getErrorMsg ( ) ) ;
}
}
@ -4418,7 +4566,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
@Override
public void switchGatewayLink ( JSONObject manager , String clientMoniker , String channel , boolean allow ) {
public void switchGatewayLink ( JSONObject manager , String clientMoniker , String channel , boolean allow ) {
JSONObject client = getClientInfoByMoniker ( clientMoniker ) ;
if ( client = = null ) {
throw new InvalidShortIdException ( ) ;
@ -4426,18 +4574,18 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
checkOrgPermission ( manager , client ) ;
if ( allow ) {
if ( StringUtils . isEmpty ( client . getString ( channel + "_pay_url" ) ) ) {
String channel_pay_url = getGatewayShortLink ( clientMoniker , channel . toLowerCase ( ) ) ;
client . put ( channel + "_pay_url" , channel_pay_url ) ;
if ( StringUtils . isEmpty ( client . getString ( channel + "_pay_url" ) ) ) {
String channel_pay_url = getGatewayShortLink ( clientMoniker , channel . toLowerCase ( ) ) ;
client . put ( channel + "_pay_url" , channel_pay_url ) ;
JSONObject clientConfig = new JSONObject ( ) ;
clientConfig . put ( channel + "_pay_url" , channel_pay_url ) ;
clientConfig . put ( channel + "_pay_url" , channel_pay_url ) ;
clientConfig . put ( "client_id" , client . getIntValue ( "client_id" ) ) ;
clientConfigMapper . update ( clientConfig ) ;
clientMapper . update ( client ) ;
}
}
clientModifySupport . processClientConfigModify ( new SwitchPermissionModify ( manager , clientMoniker , "enable_" + channel + "_link" , allow ) ) ;
clientModifySupport . processClientConfigModify ( new SwitchPermissionModify ( manager , clientMoniker , "enable_" + channel , allow ) ) ;
clientModifySupport . processClientConfigModify ( new SwitchPermissionModify ( manager , clientMoniker , "enable_" + channel + "_link" , allow ) ) ;
clientModifySupport . processClientConfigModify ( new SwitchPermissionModify ( manager , clientMoniker , "enable_" + channel , allow ) ) ;
}
@ -4466,7 +4614,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
create_time = DateFormatUtils . format ( order . getDate ( "create_time" ) , "yyyy-MM-dd HH:mm:ss" ) ;
}
ctx . setVariable ( "time" , create_time ) ;
final String content = thymeleaf . process ( "mail/hf_email_notice" , ctx ) ;
final String content = thymeleaf . process ( "mail/hf_email_notice" , ctx ) ;
final String mailTo = client . getString ( "contact_email" ) ;
if ( StringUtils . isEmpty ( mailTo ) ) {
throw new EmailException ( "Client Contact Email is invalid" ) ;
@ -4488,7 +4636,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
return ;
}
if ( client . getString ( "contact_email" ) = = null | |
! clientConfig . getBoolean ( "enable_" + order . getString ( "channel" ) . toLowerCase ( ) + "_email_notice" ) ) {
! clientConfig . getBoolean ( "enable_" + order . getString ( "channel" ) . toLowerCase ( ) + "_email_notice" ) ) {
return ;
}
Context ctx = new Context ( ) ;
@ -4506,7 +4654,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
create_time = DateFormatUtils . format ( order . getDate ( "create_time" ) , "yyyy-MM-dd HH:mm:ss" ) ;
}
ctx . setVariable ( "time" , create_time ) ;
final String content = thymeleaf . process ( "mail/gateway_email_notice" , ctx ) ;
final String content = thymeleaf . process ( "mail/gateway_email_notice" , ctx ) ;
final String mailTo = client . getString ( "contact_email" ) ;
if ( StringUtils . isEmpty ( mailTo ) ) {
throw new EmailException ( "Client Contact Email is invalid" ) ;
@ -4520,8 +4668,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
} ) . start ( ) ;
}
private String getOrderChannel ( String channel ) {
switch ( channel ) {
private String getOrderChannel ( String channel ) {
switch ( channel ) {
case "hf" :
return "汇付" ;
case "Yeepay" :
@ -4529,6 +4677,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
return "" ;
}
@Override
@Transactional
public void updateAllPartnerPassword ( String clientMoniker ) {
@ -4570,7 +4719,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Override
public String getGatewayShortLink ( String clientMoniker , String channel ) {
String longUrl = PlatformEnvironment . getEnv ( ) . concatUrl ( "/api/v1.0/" + channel + "/partners/" + clientMoniker + "/jump/pc" ) ;
String longUrl = PlatformEnvironment . getEnv ( ) . concatUrl ( "/api/v1.0/" + channel + "/partners/" + clientMoniker + "/jump/pc" ) ;
MpWechatApi api = mpWechatApiProvider . getNewPaymentApi ( ) ;
return api . registerShortUrl ( longUrl ) ;
}
@ -4597,7 +4746,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
infoStr . append ( "ABN = " + riskInfo . getString ( "abn" ) + ",ACN = " + riskInfo . getString ( "acn" ) + ",contact_phone = " + riskInfo . getString ( "contact_phone" ) + ",contact_person = " + riskInfo . getString ( "contact_person" ) + ",bank_account_no = " + riskInfo . getString ( "bank_account_no" ) ) ;
} ) ;
appendStr . deleteCharAt ( appendStr . length ( ) - 1 ) ;
throw new BadRequestException ( "该商户信息已经进入系统黑名单,关联商户为【" + appendStr . toString ( ) . toUpperCase ( ) + "】【" + infoStr . toString ( ) + "】" ) ;
throw new BadRequestException ( "该商户信息已经进入系统黑名单,关联商户为【" + appendStr . toString ( ) . toUpperCase ( ) + "】【" + infoStr . toString ( ) + "】" ) ;
}
}
@ -4666,6 +4815,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
return null ;
}
@Override
@Transactional
public boolean postponeClientRate ( int clientId , String clientMoniker , String nextYearExipryDate ) {
@ -4785,7 +4935,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
}
String path = paymentConfig . getString ( "path" ) ;
path = path . replaceAll ( "app" , "pc" ) ;
path = path . replaceAll ( "app" , "pc" ) ;
response . sendRedirect ( String . format ( PlatformEnvironment . getEnv ( ) . concatUrl ( path ) , clientMoniker ) ) ;
}
@ -4837,7 +4987,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
List < String > needNotifyUsers = royalPayUsers . stream ( ) . filter ( user - > StringUtils . isNotEmpty ( user . getString ( "wx_openid" ) ) ) . map ( user - > user . getString ( "wx_openid" ) ) . collect ( Collectors . toList ( ) ) ;
needNotifyUsers . forEach ( userOpenId - > {
try {
String signStr = "?sign=" + AESencrypt ( accounts . toString ( ) , userOpenId ) ;
String signStr = "?sign=" + AESencrypt ( accounts . toString ( ) , userOpenId ) ;
MpWechatApi paymentApi = mpWechatApiProvider . getNewPaymentApi ( ) ;
TemplateMessage msg = initSendTestPasswordTemplate ( userOpenId , paymentApi . getTemplateId ( "test-merchant-password" ) , signStr . replace ( "+" , "%2B" ) ) ;
paymentApi . sendTemplateMessage ( msg ) ;
@ -4875,21 +5025,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
byte [ ] enCodeFormat = secretKey . getEncoded ( ) ;
SecretKeySpec key = new SecretKeySpec ( enCodeFormat , "AES" ) ;
Cipher cipher = Cipher . getInstance ( "AES" ) ;
byte [ ] byteContent = content . getBytes ( "utf-8" ) ;
byte [ ] byteContent = content . getBytes ( StandardCharsets . UTF_8 ) ;
cipher . init ( Cipher . ENCRYPT_MODE , key ) ;
byte [ ] result = cipher . doFinal ( byteContent ) ;
return Base64 . encodeBase64String ( result ) ;
} catch ( NoSuchPaddingException e ) {
e . printStackTrace ( ) ;
} catch ( NoSuchAlgorithmException e ) {
e . printStackTrace ( ) ;
} catch ( UnsupportedEncodingException e ) {
e . printStackTrace ( ) ;
} catch ( InvalidKeyException e ) {
e . printStackTrace ( ) ;
} catch ( IllegalBlockSizeException e ) {
e . printStackTrace ( ) ;
} catch ( BadPaddingException e ) {
} catch ( NoSuchPaddingException | NoSuchAlgorithmException | InvalidKeyException | IllegalBlockSizeException | BadPaddingException e ) {
e . printStackTrace ( ) ;
}
return null ;