Merge remote-tracking branch 'origin/develop' into develop

# Conflicts:
#	pom.xml
#	src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java
master
duLingLing 5 years ago
commit 98309e68b1

@ -9,7 +9,7 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>manage</artifactId>
<version>1.2.98</version>
<version>1.3.1</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jib-maven-plugin.version>1.4.0</jib-maven-plugin.version>
@ -212,6 +212,10 @@
<artifactId>HikariCP</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies>
<build>
<plugins>

@ -0,0 +1,3 @@
ALTER TABLE sys_incremental_channels ADD COLUMN channel_pub_key TEXT DEFAULT NULL AFTER source_code;
ALTER TABLE sys_incremental_channels ADD COLUMN platform_pub_key TEXT DEFAULT NULL AFTER channel_pub_key;
ALTER TABLE sys_incremental_channels ADD COLUMN platform_pri_key TEXT DEFAULT NULL AFTER platform_pub_key;

@ -0,0 +1,50 @@
package au.com.royalpay.payment.manage.appclient.beans;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class RSvcMchBean {
/**
*
*/
private String merchantNumber;
/**
* partnerCode
*/
private String partnerCode;
/**
* CredentialCode
*/
private String credentialCode;
/**
* HostpayHost
*/
private String payHost;
/**
* logo
*/
private String logo;
/**
*
*/
private String industryCode;
/**
*
*/
private String industryName;
/**
*
*/
private String merchantName;
}

@ -0,0 +1,14 @@
package au.com.royalpay.payment.manage.appclient.core;
import com.alibaba.fastjson.JSONObject;
public interface RetailRSvcService {
/**
* Appservice code
*
* @param device
* @param sourceCode
* @return
*/
JSONObject findMchInfoBySourceCode(JSONObject device, String sourceCode);
}

@ -0,0 +1,65 @@
package au.com.royalpay.payment.manage.appclient.core.impls;
import au.com.royalpay.payment.manage.appclient.beans.RSvcMchBean;
import au.com.royalpay.payment.manage.appclient.core.RetailRSvcService;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.tools.codec.AESCrypt;
import au.com.royalpay.payment.tools.device.DeviceSupport;
import au.com.royalpay.payment.tools.encryptalgorithm.SignUtils;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.mappers.CommonIncrementalChannelMapper;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.parser.Feature;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.net.util.Base64;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.nio.charset.StandardCharsets;
import java.security.Key;
@Service
public class RetailRSvcServiceImpl implements RetailRSvcService {
@Resource
private ClientManager clientManager;
@Resource
private DeviceSupport deviceSupport;
@Resource
private CommonIncrementalChannelMapper commonIncrementalChannelMapper;
@Override
public JSONObject findMchInfoBySourceCode(JSONObject device, String sourceCode) {
String clientType = device.getString("client_type");
deviceSupport.findRegister(clientType);
JSONObject svcInfo = commonIncrementalChannelMapper.findIncreamentalChannelBySourceCode(sourceCode);
if (svcInfo == null || StringUtils.isEmpty(svcInfo.getString("channel_pub_key"))
|| StringUtils.isEmpty(svcInfo.getString("platform_pub_key")) || StringUtils.isEmpty("platform_pri_key")) {
throw new BadRequestException("this channel config is wrong");
}
RSvcMchBean svcMchBean = clientManager.findSvcMchByAccountId(device.getString("account_id"));
String aesKeyStr = Base64.encodeBase64String(AESCrypt.randomKey().getEncoded());
Key key = AESCrypt.fromKeyString(Base64.decodeBase64(aesKeyStr));
JSONObject result = (JSONObject) JSONObject.toJSON(svcMchBean);
result.put("sign_type", "RSA2");
result.put("enc_data", new JSONObject() {
{
put("credentialCode", encData(svcMchBean.getCredentialCode(), key, svcInfo.getString("channel_pub_key")));
put("payHost", encData(svcMchBean.getPayHost(), key, svcInfo.getString("channel_pub_key")));
put("partnerCode", encData(svcMchBean.getPartnerCode(), key, svcInfo.getString("channel_pub_key")));
put("merchantNumber", encData(svcMchBean.getMerchantNumber(), key, svcInfo.getString("channel_pub_key")));
}
});
result.put("nonce_str", aesKeyStr);
result.put("timestamp", System.currentTimeMillis());
result = JSONObject.parseObject(JSON.toJSONString(result), Feature.OrderedField);
result.put("sign", SignUtils.buildSign(result.toJSONString(), svcInfo.getString("platform_pri_key")));
return result;
}
private String encData(String data, Key key, String publicKey) {
String pubKeyEncData = SignUtils.encData(data, publicKey);
return org.apache.commons.codec.binary.Base64.encodeBase64String(AESCrypt.encrypt(pubKeyEncData.getBytes(StandardCharsets.UTF_8), key));
}
}

@ -0,0 +1,26 @@
package au.com.royalpay.payment.manage.appclient.web;
import au.com.royalpay.payment.manage.appclient.core.RetailRSvcService;
import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.device.advise.AppClientController;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.annotation.Resource;
@AppClientController
@RequestMapping("/api/v1.0/retail/rsvc")
public class RetailRSvcController {
@Resource
private RetailRSvcService retailRSvcService;
@GetMapping(value = "/{source_code}/userinfo")
public JSONObject findUserInfoBySourceCode(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @PathVariable String source_code) {
return retailRSvcService.findMchInfoBySourceCode(device, source_code);
}
}

@ -99,4 +99,8 @@ public interface ClientAccountMapper {
@AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "is_valid=1", excludeColumns = {"salt", "password_hash"})
List<JSONObject> findByWechatUnionId(@Param("wx_unionid")String unionId);
@AutoSql(type = SqlType.SELECT)
JSONObject findRSvcClientInfo(@Param("account_id")String accountId);
}

@ -3,6 +3,7 @@ package au.com.royalpay.payment.manage.merchants.core;
import au.com.royalpay.payment.core.exceptions.EmailException;
import au.com.royalpay.payment.manage.appclient.beans.AppClientBean;
import au.com.royalpay.payment.manage.appclient.beans.AppMerchantBean;
import au.com.royalpay.payment.manage.appclient.beans.RSvcMchBean;
import au.com.royalpay.payment.manage.merchants.beans.*;
import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery;
import au.com.royalpay.payment.tools.merchants.beans.QRCodeConfig;
@ -40,7 +41,7 @@ public interface ClientManager {
JSONObject listClients(JSONObject manager, PartnerQuery query);
void exportClients(JSONObject manager,PartnerQuery query,HttpServletResponse resp);
void exportClients(JSONObject manager, PartnerQuery query, HttpServletResponse resp);
JSONObject listClientsByApp(JSONObject manager, AppMerchantBean query);
@ -136,7 +137,7 @@ public interface ClientManager {
void toggleAccountReceiveNoticeByOpenId(String openid, boolean enable);
@Transactional
void togglePayNotice(JSONObject account,String clientMoniker, boolean enable);
void togglePayNotice(JSONObject account, String clientMoniker, boolean enable);
@Transactional
void changeRole(JSONObject manager, String clientMoniker, String accountId, int role);
@ -150,7 +151,7 @@ public interface ClientManager {
JSONObject getAccountByOpenId(String openid);
void updateClientBDUser(JSONObject account,String clientMoniker, int managerId);
void updateClientBDUser(JSONObject account, String clientMoniker, int managerId);
void refreshClientCredentialCode(JSONObject manager, String clientMoniker);
@ -183,13 +184,13 @@ public interface ClientManager {
JSONObject getQRCode(JSONObject manager, String clientMoniker, QRCodeConfig config);
String getQrCodeBoard(JSONObject client, QRCodeConfig config,JSONObject account,String plantform);
String getQrCodeBoard(JSONObject client, QRCodeConfig config, JSONObject account, String plantform);
void writeAggregateQrCodeBoard(JSONObject manager, String clientMoniker, QRCodeConfig config, OutputStream ous,String plantform);
void writeAggregateQrCodeBoard(JSONObject manager, String clientMoniker, QRCodeConfig config, OutputStream ous, String plantform);
void writeCBBankAggregateQrCodeBoard(JSONObject manager, String clientMoniker, OutputStream ous,String plantform);
void writeCBBankAggregateQrCodeBoard(JSONObject manager, String clientMoniker, OutputStream ous, String plantform);
void writeQrCodeBoard(JSONObject manager, String clientMoniker, QRCodeConfig config, OutputStream ous,String plantform);
void writeQrCodeBoard(JSONObject manager, String clientMoniker, QRCodeConfig config, OutputStream ous, String plantform);
void writePoster(JSONObject manager, String clientMoniker, OutputStream ous);
@ -198,7 +199,7 @@ public interface ClientManager {
void writeActivityPoster(JSONObject manager, String clientMoniker, String activityName, OutputStream ous) throws IOException;
@Transactional
void updateTimeZone(JSONObject account,String clientMoniker, String timezone);
void updateTimeZone(JSONObject account, String clientMoniker, String timezone);
JSONObject listClientDevices(JSONObject manager, String clientMoniker, String remark, int page, int limit, String client_type, String[] client_ids);
@ -219,19 +220,19 @@ public interface ClientManager {
JSONObject getBankInfo(JSONObject manager, String clientMoniker, String bsb_no);
void setMaxOrderAmount(JSONObject account,String clientMoniker, BigDecimal limit);
void setMaxOrderAmount(JSONObject account, String clientMoniker, BigDecimal limit);
void setClientQRCodePaySurCharge(JSONObject account,String clientMoniker, boolean paySurcharge);
void setClientQRCodePaySurCharge(JSONObject account, String clientMoniker, boolean paySurcharge);
void setClientApiPaySurCharge(JSONObject account,String clientMoniker, boolean enableApiSurcharge);
void setClientApiPaySurCharge(JSONObject account, String clientMoniker, boolean enableApiSurcharge);
void setClientRetailPaySurCharge(JSONObject account,String clientMoniker, boolean paySurcharge);
void setClientRetailPaySurCharge(JSONObject account, String clientMoniker, boolean paySurcharge);
void setClientCBBankPaySurCharge(JSONObject account,String clientMoniker, boolean paySurcharge);
void setClientCBBankPaySurCharge(JSONObject account, String clientMoniker, boolean paySurcharge);
void setClientTaxInSurcharge(JSONObject account,String clientMoniker, boolean taxInSurcharge);
void setClientTaxInSurcharge(JSONObject account, String clientMoniker, boolean taxInSurcharge);
void setClientCustomerTaxFree(JSONObject account,String clientMoniker, boolean customerTaxFree);
void setClientCustomerTaxFree(JSONObject account, String clientMoniker, boolean customerTaxFree);
List<JSONObject> listClientsForSettlement();
@ -291,7 +292,7 @@ public interface ClientManager {
void changeCBBankPaymentPage(JSONObject account, String paypad_version);
void changeManualSettle(JSONObject account , int client_id, boolean manual_settle,String operator_id,int type,String operation);
void changeManualSettle(JSONObject account, int client_id, boolean manual_settle, String operator_id, int type, String operation);
void changeQRCodePaySurcharge(JSONObject account, boolean paySurcharge);
@ -305,37 +306,37 @@ public interface ClientManager {
void changeRequireRemark(JSONObject account, boolean requireRemark);
void changeSurcharge(JSONObject account,JSONObject device, UpdateSurchargeDTO updateSurchargeDTO);
void changeSurcharge(JSONObject account, JSONObject device, UpdateSurchargeDTO updateSurchargeDTO);
void refusePartner(String clientMoniker, JSONObject manager, String refuse_remark);
JSONArray getAllClientIds(int clientId);
void updateAppClient(JSONObject account,int client_id, AppClientBean appClientBean);
void updateAppClient(JSONObject account, int client_id, AppClientBean appClientBean);
void setSkipClearing(JSONObject account,String clientMoniker, Boolean skip_clearing,String remark);
void setSkipClearing(JSONObject account, String clientMoniker, Boolean skip_clearing, String remark);
void setSurchargeMode(JSONObject account, String clientMoniker, String surcharge_mode);
JSONObject surchargeAccount(JSONObject account, String clientMoniker);
void setAllowSurchargeCredit(JSONObject account,String clientMoniker, Boolean allow_surcharge_credit);
void setAllowSurchargeCredit(JSONObject account, String clientMoniker, Boolean allow_surcharge_credit);
List<JSONObject> getAccountTransactions(JSONObject account,String clientMoniker);
List<JSONObject> getAccountTransactions(JSONObject account, String clientMoniker);
List<JSONObject> getAccountDetailByMonths(JSONObject account,String clientMoniker);
List<JSONObject> getAccountDetailByMonths(JSONObject account, String clientMoniker);
List<JSONObject> getAccountTransactionsByDetailId(JSONObject account,String clientMoniker, String detailId);
List<JSONObject> getAccountTransactionsByDetailId(JSONObject account, String clientMoniker, String detailId);
List<JSONObject> getAccountMonthDetails(JSONObject account,String clientMoniker);
List<JSONObject> getAccountMonthDetails(JSONObject account, String clientMoniker);
void saveAccountTransaction(JSONObject account,String clientMoniker, JSONObject transaction);
void saveAccountTransaction(JSONObject account, String clientMoniker, JSONObject transaction);
void enableGatewayUpgrade(JSONObject account,String clientMoniker, boolean gatewayUpgrade);
void enableGatewayUpgrade(JSONObject account, String clientMoniker, boolean gatewayUpgrade);
void enableGatewayAlipayOnline(JSONObject account,String clientMoniker, boolean gatewayAlipayOnline);
void enableGatewayAlipayOnline(JSONObject account, String clientMoniker, boolean gatewayAlipayOnline);
void setCustomerSurchargeRate(JSONObject account,String clientMoniker, BigDecimal customer_surcharge_rate);
void setCustomerSurchargeRate(JSONObject account, String clientMoniker, BigDecimal customer_surcharge_rate);
void setPartnerPublicKeyConfig(JSONObject account, String ipWhitelistConfig);
@ -343,17 +344,17 @@ public interface ClientManager {
void setIpWhitelistConfig(JSONObject account, String ipWhitelistConfig);
void setOrderExpiryConfig(JSONObject account,String clientMoniker, String orderExpiryConfig);
void setOrderExpiryConfig(JSONObject account, String clientMoniker, String orderExpiryConfig);
void getAgreeFile(String clientMoniker, JSONObject manager) throws Exception;
void getAggregateAgreeFile(String clientMoniker, JSONObject manager,boolean renewal) throws Exception;
void getAggregateAgreeFile(String clientMoniker, JSONObject manager, boolean renewal) throws Exception;
void getNewAggregateAgreeFile(String clientMoniker, JSONObject manager,boolean renewal) throws Exception;
void getNewAggregateAgreeFile(String clientMoniker, JSONObject manager, boolean renewal) throws Exception;
void temporaryExportPdf(String clientMoniker, JSONObject manager, HttpServletResponse httpResponse) throws Exception;
void importAgreeFile(String clientMoniker, JSONObject manager, String sourceFile,boolean renewal);
void importAgreeFile(String clientMoniker, JSONObject manager, String sourceFile, boolean renewal);
void completeAgree(String clientMoniker, JSONObject manager);
@ -365,17 +366,18 @@ public interface ClientManager {
/**
*
*
* @param manager
* @param clientMoniker
* @param query
*/
void excelSettlementLog(JSONObject manager, String clientMoniker, TradeLogQuery query,HttpServletResponse response);
void excelSettlementLog(JSONObject manager, String clientMoniker, TradeLogQuery query, HttpServletResponse response);
void updateRefundPwd(JSONObject account, String pwd);
void validRefundPwd(JSONObject account, String pwd);
void setWeekendDelay(JSONObject account,String client_moniker,int clientId, boolean delay);
void setWeekendDelay(JSONObject account, String client_moniker, int clientId, boolean delay);
List<JSONObject> listSubMerchantIdApplys(JSONObject manager, String clientMoniker);
@ -383,7 +385,7 @@ public interface ClientManager {
List<JSONObject> listYeepaySubMerchantIdApplys(JSONObject manager, String clientMoniker);
String subMerchantApplication(String clientMoniker, SubMerchantIdApply subMerchantApply,JSONObject manager);
String subMerchantApplication(String clientMoniker, SubMerchantIdApply subMerchantApply, JSONObject manager);
void registerAlipayGms(String clientMoniker, JSONObject manager);
@ -399,25 +401,25 @@ public interface ClientManager {
String queryAlipayOnlineGmsStatus(String clientMoniker, JSONObject manager);
List<JSONObject> listMerchantIds(String clientMoniker,JSONObject manager);
List<JSONObject> listMerchantIds(String clientMoniker, JSONObject manager);
void clearCacheSubMerchantIdApplices(String clientMoniker);
JSONObject getCheckClientInfo(int client_id,String account_id, String channel);
JSONObject getCheckClientInfo(int client_id, String account_id, String channel);
List<JSONObject> getClientSubMerchantIdLogs(String clientMoniker,JSONObject manager);
List<JSONObject> getClientSubMerchantIdLogs(String clientMoniker, JSONObject manager);
void applyToCompliance(String client_moniker, JSONObject account);
void sendVerifyEmail(JSONObject client,String accountId);
void sendVerifyEmail(JSONObject client, String accountId);
JSONObject getWithConfig(int client_id);
List<JSONObject> getClientsByBD(String bd_user);
JSONObject simpleQuery(JSONObject param, int page,int limit);
JSONObject simpleQuery(JSONObject param, int page, int limit);
JSONObject getByEmail(String email, int page, int limit,List<String> ExceptClientIds);
JSONObject getByEmail(String email, int page, int limit, List<String> ExceptClientIds);
void addSub(String client_moniker, JSONObject manager);
@ -425,25 +427,25 @@ public interface ClientManager {
String getShortLink(String client_moniker);
String getGatewayShortLink(String client_moniker,String channel);
String getGatewayShortLink(String client_moniker, String channel);
@Transactional
void switchHfLink(JSONObject manager, String clientMoniker,boolean allow);
void switchHfLink(JSONObject manager, String clientMoniker, boolean allow);
@Transactional
void switchGatewayLink(JSONObject manager, String clientMoniker,String channel,boolean allow);
void switchGatewayLink(JSONObject manager, String clientMoniker, String channel, boolean allow);
void sendHfEmailNotice(JSONObject order);
void sendGatewayEmailNotice(JSONObject order);
void subRpayMerchantApplication(String clientMoniker,JSONObject merchantInfo, JSONObject manager);
void subRpayMerchantApplication(String clientMoniker, JSONObject merchantInfo, JSONObject manager);
void subYeepayMerchantApplication(String clientMoniker,JSONObject merchantInfo, JSONObject manager);
void subYeepayMerchantApplication(String clientMoniker, JSONObject merchantInfo, JSONObject manager);
void subYeepayMerchantAdd(String clientMoniker,JSONObject merchantInfo, JSONObject manager);
void subYeepayMerchantAdd(String clientMoniker, JSONObject merchantInfo, JSONObject manager);
void reSubYeepayMerchantApplication(String clientMoniker,JSONObject merchantInfo, JSONObject manager);
void reSubYeepayMerchantApplication(String clientMoniker, JSONObject merchantInfo, JSONObject manager);
void updateAllPartnerPassword(String clientMoniker);
@ -454,7 +456,7 @@ public interface ClientManager {
*
* @param clientId
*/
boolean postponeClientRate(int clientId, String clientMoniker,String nextYearExipryDate);
boolean postponeClientRate(int clientId, String clientMoniker, String nextYearExipryDate);
JSONObject comListPartnerSelection(JSONObject manager, PartnerQuery query);
@ -483,7 +485,7 @@ public interface ClientManager {
*/
void resetRefundPassword(JSONObject account, JSONObject json);
void resetRefundPasswordByManage(String clientMoniker,JSONObject manage, JSONObject json);
void resetRefundPasswordByManage(String clientMoniker, JSONObject manage, JSONObject json);
List<Integer> listLevel3Client(int client_id);
@ -505,24 +507,30 @@ public interface ClientManager {
/**
* /
*
* @param clientMoniker
* @param incrementalService
*/
void changePartnerIncrementalService(String clientMoniker, JSONObject incrementalService,JSONObject manager);
void changePartnerIncrementalService(String clientMoniker, JSONObject incrementalService, JSONObject manager);
/**
* /
*
* @param clientMoniker
* @param incrementalService
*/
void changeSwitchIncrementalService(String clientMoniker, JSONObject incrementalService,JSONObject manager);
void changeSwitchIncrementalService(String clientMoniker, JSONObject incrementalService, JSONObject manager);
/**
*
*
* @param clientMoniker
* @return
*/
JSONObject partnerIncrementalServiceInfo(String clientMoniker, String incrementalId);
JSONObject findByLookupCode(String code);
RSvcMchBean findSvcMchByAccountId(String accountId);
}

@ -17,6 +17,7 @@ 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.mappers.SysClientMapper;
import au.com.royalpay.payment.manage.appclient.beans.RSvcMchBean;
import au.com.royalpay.payment.tools.defines.IncrementalChannel;
import au.com.royalpay.payment.core.utils.OrderExpiryRuleResolver;
import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper;
@ -6160,14 +6161,33 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
@Override
public JSONObject findByLookupCode(String code){
public JSONObject findByLookupCode(String code) {
JSONObject industryInfo = industryLookupMapper.findByLookupCode(code);
if(industryInfo==null){
return new JSONObject(){{
put("lookup_code","未知行业");
if (industryInfo == null) {
return new JSONObject() {{
put("lookup_code", "code");
put("lookup_value", "未知行业");
}};
}
return industryInfo;
}
@Override
public RSvcMchBean findSvcMchByAccountId(String accountId) {
JSONObject mchInfo = clientAccountMapper.findRSvcClientInfo(accountId);
if (mchInfo == null || mchInfo.isEmpty()) {
throw new BadRequestException("Client Not Exists!");
}
RSvcMchBean svcMchBean = new RSvcMchBean();
svcMchBean.setMerchantNumber(mchInfo.getString("username"));
svcMchBean.setMerchantName(mchInfo.getString("short_name"));
svcMchBean.setPartnerCode(mchInfo.getString("client_moniker"));
svcMchBean.setCredentialCode(mchInfo.getString("credential_code"));
svcMchBean.setPayHost(PlatformEnvironment.getEnv().mainHost());
svcMchBean.setLogo(mchInfo.getString("logo_url"));
svcMchBean.setIndustryCode(mchInfo.getString("industry"));
svcMchBean.setIndustryName(findByLookupCode(mchInfo.getString("industry")).getString("lookup_value"));
return svcMchBean;
}
}

@ -41,4 +41,24 @@
ORDER BY a.create_time DESC
limit 1
</select>
<select id="findRSvcClientInfo" resultType="com.alibaba.fastjson.JSONObject">
SELECT
sa.username,
sc.client_id,
sc.client_moniker,
sc.credential_code,
sc.short_name,
sc.company_name,
ifnull(sc.logo_url,"NONE") logo_url,
sc.industry,
industry
FROM
sys_accounts sa,
sys_clients sc
WHERE
sa.account_id = #{account_id}
AND sc.client_id = sa.client_id
AND sc.is_valid = 1
AND sa.is_valid = 1
</select>
</mapper>

@ -212,7 +212,7 @@
uib-tooltip="HF Pay" ng-if="trade.channel=='hf'"/>
<img src="/static/images/rpayplus_sign.png"
uib-tooltip="RPay+" ng-if="trade.channel=='Rpay'"/>
{{trade.order_id2}}<span ng-if="trade.source!='system'"><i class="fa fa-question-circle-o" uib-tooltip-html="trade.htmlTooltip"></i></span>
{{trade.order_id2}}<span ng-if="trade.source!='system' && trade.incremental_surcharge != null"><i class="fa fa-question-circle-o" uib-tooltip-html="trade.htmlTooltip"></i></span>
</td>
<td ng-bind="trade.currency"></td>
<td ng-bind="trade.display_amount"></td>

@ -346,7 +346,7 @@
uib-tooltip="Yeepay" ng-if="trade.channel=='Yeepay'"/>
<img src="/static/images/lakalapay_sign.png"
uib-tooltip="LakalaPay" ng-if="trade.channel=='LakalaPay'"/>
{{trade.order_id2}}<span ng-if="trade.source!='system'"><i class="fa fa-question-circle-o" uib-tooltip-html="trade.htmlTooltip"></i></span>
{{trade.order_id2}}<span ng-if="trade.source!='system' && trade.incremental_surcharge != null"><i class="fa fa-question-circle-o" uib-tooltip-html="trade.htmlTooltip"></i></span>
</td>
<td ng-bind="trade.currency"></td>
<td ng-bind="trade.display_amount"></td>

@ -442,7 +442,7 @@
<img src="/static/images/rpayplus_sign.png" uib-tooltip="RPay+" ng-if="trade.channel=='Rpay'"/>
<img src="/static/images/yeepay_sign.png" uib-tooltip="Yeepay" ng-if="trade.channel=='Yeepay'"/>
<img src="/static/images/lakalapay_sign.png" uib-tooltip="LakalaPay" ng-if="trade.channel=='LakalaPay'"/>
{{trade.order_id}}<span ng-if="trade.source!='system'"><i class="fa fa-question-circle-o" uib-tooltip-html="trade.htmlTooltip"></i></span>
{{trade.order_id}}<span ng-if="trade.source!='system' && trade.incremental_surcharge != null"><i class="fa fa-question-circle-o" uib-tooltip-html="trade.htmlTooltip"></i></span>
</td>
<td>
{{trade.total_amount|currency:trade.currency+' '}}

@ -486,7 +486,7 @@
uib-tooltip="Yeepay" ng-if="trade.channel=='Yeepay'"/>
<img src="/static/images/lakalapay_sign.png"
uib-tooltip="LakalaPay" ng-if="trade.channel=='LakalaPay'"/>
{{trade.order_id}}<span ng-if="trade.source!='system'"><i class="fa fa-question-circle-o" uib-tooltip-html="trade.htmlTooltip"></i></span>
{{trade.order_id}}<span ng-if="trade.source!='system' && trade.incremental_surcharge != null"><i class="fa fa-question-circle-o" uib-tooltip-html="trade.htmlTooltip"></i></span>
</td>
<td>
{{trade.total_amount|currency:trade.currency}}

@ -1,11 +1,23 @@
package au.com.royalpay.payment.manage.valid;
import au.com.royalpay.payment.manage.analysis.beans.ato.CharacterUtils;
import au.com.royalpay.payment.manage.appclient.beans.RSvcMchBean;
import au.com.royalpay.payment.tools.codec.AESCrypt;
import au.com.royalpay.payment.tools.encryptalgorithm.SignUtils;
import com.alibaba.fastjson.JSONObject;
import com.github.stuxuhai.jpinyin.PinyinException;
import com.github.stuxuhai.jpinyin.PinyinFormat;
import com.github.stuxuhai.jpinyin.PinyinHelper;
import org.apache.commons.net.util.Base64;
import org.junit.Test;
import javax.crypto.BadPaddingException;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import java.nio.charset.StandardCharsets;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
/**
* Create by yixian at 2018-09-06 8:57
*/
@ -16,4 +28,38 @@ public class JPinYinTest {
System.out.println(CharacterUtils.convertFullWidthToHalfWidth(CharacterUtils.convertToPinYin(test)));
}
@Test
public void testRSA() throws NoSuchPaddingException, NoSuchAlgorithmException, IllegalBlockSizeException, BadPaddingException, InvalidKeyException, InvalidKeySpecException {
String rsa1_pub = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQ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Ey2N4DxSKPzHSqn+rdvQRAs2QaVPUcND63V7J5mpp97MzsqWzBiESG0jIoNys0IrpdrqHCkcMAtOukEZ9o+MQKBgQDJ9KB086XiS3gIYqgfutF2QuTTpm9sjuPr3Ij1Xq6xPo3Dxc1nCMNx8dnka0erwPZ1bypbQcvgjxjxuow1XsnbvY9dQpmg51eH1/oFoXHeuY4qel5LnODJ05RSPK25bYX29ezV4Fp+LX/5ZRQwJXojPvZhxB8i0RdMiNmPQzjbTwKBgQCRB0sL+w6dSndwKdUag5CjllO9fIxMhNYVfGpBye0dqJyeJ8m7h6oOkDgYUt1LJzBLXqilRhZNxJtm9ZsBipNbgFQSC+Gi51ZBgkLx/IA8DT4Kd9BOgZmZBuf+Bt03uKPJaVRGsyQB8e+aJntwy6zJFTkDYxtDH0rpQNYfEjRwEQKBgA+p3IQVnakWh2HHHRkQ6UwN1iegQgYecwkJGspFJLF0k5Q6lDrIkDgXNPolY/KrTbJAA/399W0eTCX7fQJqrqdPZX4rOzUinERZ+PdU1TscEy2yPfwJV9nvghJ6yFKYbwp/enYAJ6SfrMxQDafKUFXJfVyJ1IxjwTXba1xUL2W7AoGAc6PzW66wEVYqvzfWzWr22tR0JS87b0h9eqyqHib5XATKmpKpJztMZvgj50fCGWxWcwW+QoEoxFZqRXWiFiS1Tax+UY7QDRF55JOOfZyl1+eerAQAq99sVg0QAom/9V4jZNfX3JZvIYI15opGSdI2hsRrtW7CBvYxsGz7mT3cLoE=";
RSvcMchBean aaa = new RSvcMchBean();
aaa.setMerchantNumber("taylor");
aaa.setIndustryName("其他服务行业");
aaa.setIndustryCode("331");
aaa.setCredentialCode("7dlXrdvhyuN73NDpZsGYftdIMuZms1Qc");
aaa.setLogo("https://file.royalpay.com.au/open/2017/07/24/1500898932409_7uFGyWIpk4IRTQyT3INk2Nk3KHedOG.png");
aaa.setPayHost("http://192.168.1.6:9008/");
aaa.setPartnerCode("PINE");
aaa.setMerchantName("TEST");
String pubKeyEncCredentialCode = SignUtils.encData(aaa.getCredentialCode(), rsa1_pub);
String aesKeyStr = Base64.encodeBase64String(AESCrypt.randomKey().getEncoded());
Key key = AESCrypt.fromKeyString(Base64.decodeBase64(aesKeyStr));
String decCredentialCode = Base64.encodeBase64String(AESCrypt.encrypt(pubKeyEncCredentialCode.getBytes(StandardCharsets.UTF_8), key));
JSONObject result = (JSONObject) JSONObject.toJSON(aaa);
result.put("sign_type", "RSA2");
result.put("enc_data", decCredentialCode);
result.put("nonce_str", aesKeyStr);
result.put("timestamp", System.currentTimeMillis());
result.put("sign", SignUtils.buildSign(result.toJSONString(), rsa2_pri));
System.err.println(result);
String signa = result.getString("sign");
result.remove("sign");
SignUtils.checkStringSign(result.toJSONString(), signa, rsa2_pub);
String aesData = new String(AESCrypt.decrypt(Base64.decodeBase64(result.getString("enc_data")), key), StandardCharsets.UTF_8);
System.err.println(SignUtils.decData(aesData, rsa1_pri));
}
}

Loading…
Cancel
Save