|
|
|
@ -6,10 +6,7 @@ import au.com.royalpay.payment.core.exceptions.InvalidShortIdException;
|
|
|
|
|
import au.com.royalpay.payment.manage.activities.app_index.core.AppActService;
|
|
|
|
|
import au.com.royalpay.payment.manage.analysis.mappers.CustomerAndOrdersStatisticsMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.appclient.beans.AppClientBean;
|
|
|
|
|
import au.com.royalpay.payment.manage.appclient.beans.AppPaymentConfigBean;
|
|
|
|
|
import au.com.royalpay.payment.manage.appclient.beans.AppQueryBean;
|
|
|
|
|
import au.com.royalpay.payment.manage.appclient.beans.RetailAppMessage;
|
|
|
|
|
import au.com.royalpay.payment.manage.appclient.beans.*;
|
|
|
|
|
import au.com.royalpay.payment.manage.appclient.core.RetailAppService;
|
|
|
|
|
import au.com.royalpay.payment.manage.appclient.extend.GatewayOAuthRegister;
|
|
|
|
|
import au.com.royalpay.payment.manage.cashback.core.CashbackService;
|
|
|
|
@ -73,6 +70,8 @@ import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
|
|
|
|
|
import au.com.royalpay.payment.tools.permission.enums.PartnerRole;
|
|
|
|
|
import au.com.royalpay.payment.tools.threadpool.RoyalThreadPoolExecutor;
|
|
|
|
|
import au.com.royalpay.payment.tools.utils.*;
|
|
|
|
|
import au.com.royalpay.payment.tools.utils.apple.AppleAuthUtils;
|
|
|
|
|
import au.com.royalpay.payment.tools.utils.apple.UserClaim;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
@ -1782,7 +1781,7 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
if (geekShowActVersion(device.getString("version"))) {
|
|
|
|
|
newActs.add(act);
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
newActs.add(act);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -2322,6 +2321,14 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
clientAccountMapper.update(updateAccount);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void updateLoginClientAccountAppleId(JSONObject account, JSONObject params) {
|
|
|
|
|
JSONObject updateAccount = new JSONObject();
|
|
|
|
|
updateAccount.put("account_id", account.getString("account_id"));
|
|
|
|
|
updateAccount.put("apple_userid", params.getString("apple_userid"));
|
|
|
|
|
clientAccountMapper.update(updateAccount);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public JSONObject unbindAccountPhone(JSONObject device, JSONObject params) {
|
|
|
|
|
String codeKeyValueRedis = stringRedisTemplate.boundValueOps(getUpdateAccountPhoneKey(device.getString("account_id"))).get();
|
|
|
|
@ -2379,6 +2386,36 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public JSONObject unbindAccountApple(JSONObject device) {
|
|
|
|
|
JSONObject account = new JSONObject();
|
|
|
|
|
account.put("account_id", device.getString("account_id"));
|
|
|
|
|
account.put("apple_userid", null);
|
|
|
|
|
clientAccountMapper.update(account);
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
result.put("status", "success");
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public JSONObject bindAccountApple(JSONObject device, AppleLoginBean appleLoginBean) {
|
|
|
|
|
UserClaim userClaim = AppleAuthUtils.verifyIdentifyToken(appleLoginBean.getIdentityToken());
|
|
|
|
|
if (!StringUtils.equalsIgnoreCase(userClaim.getSub(), appleLoginBean.getUser())) {
|
|
|
|
|
throw new ForbiddenException("apple userinfo is error");
|
|
|
|
|
}
|
|
|
|
|
JSONObject account = clientAccountMapper.findByAppleUserId(userClaim.getSub());
|
|
|
|
|
if (account != null) {
|
|
|
|
|
throw new BadRequestException("Apple UserID has been bound to other accounts, please unbind it before binding");
|
|
|
|
|
}
|
|
|
|
|
JSONObject updateAccount = new JSONObject();
|
|
|
|
|
updateAccount.put("account_id", device.getString("account_id"));
|
|
|
|
|
updateAccount.put("apple_userid", userClaim.getSub());
|
|
|
|
|
clientAccountMapper.update(updateAccount);
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
result.put("status", "success");
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public JSONObject getAccountBindInfos(JSONObject device) {
|
|
|
|
|
JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
|
|
|
|
@ -2391,6 +2428,7 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
result.put("nation_code", account.getString("nation_code"));
|
|
|
|
|
}
|
|
|
|
|
result.put("wechat_bind_status", account.containsKey("wx_unionid"));
|
|
|
|
|
result.put("apple_bind_status", account.containsKey("apple_userid"));
|
|
|
|
|
if (account.containsKey("wx_unionid")) {
|
|
|
|
|
result.put("wechat_name", account.getString("wechat_name"));
|
|
|
|
|
}
|
|
|
|
@ -2536,7 +2574,7 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
}
|
|
|
|
|
JSONObject compliance = clientComplianceCompanyMapper.findFileByClientId(account.getIntValue("client_id"));
|
|
|
|
|
if (compliance != null) {
|
|
|
|
|
if (compliance.getIntValue("status")==0 || compliance.getIntValue("status")==1) {
|
|
|
|
|
if (compliance.getIntValue("status") == 0 || compliance.getIntValue("status") == 1) {
|
|
|
|
|
authFileStatus.put("client_less_file", false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -2555,14 +2593,14 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
authFileStatus.put("content", messageSource.getMessage("client.auth.file.title", null, RequestEnvironment.getLocale()));
|
|
|
|
|
|
|
|
|
|
List<JSONObject> supplement_array = new ArrayList<>();
|
|
|
|
|
JSONObject complianceFilesNotice = complianceFilesNotice(client,account);
|
|
|
|
|
JSONObject kycFilesNotice = kycFilesNotice(client,account);
|
|
|
|
|
JSONObject complianceFilesNotice = complianceFilesNotice(client, account);
|
|
|
|
|
JSONObject kycFilesNotice = kycFilesNotice(client, account);
|
|
|
|
|
|
|
|
|
|
if(complianceFilesNotice != null && kycFilesNotice != null){
|
|
|
|
|
if( !kycFilesNotice.getBoolean("client_less_file") && !complianceFilesNotice.getBoolean("client_less_file")){
|
|
|
|
|
authFileStatus.put("isNeedShowKycAlert",false);
|
|
|
|
|
}else{
|
|
|
|
|
authFileStatus.put("isNeedShowKycAlert",true);
|
|
|
|
|
if (complianceFilesNotice != null && kycFilesNotice != null) {
|
|
|
|
|
if (!kycFilesNotice.getBoolean("client_less_file") && !complianceFilesNotice.getBoolean("client_less_file")) {
|
|
|
|
|
authFileStatus.put("isNeedShowKycAlert", false);
|
|
|
|
|
} else {
|
|
|
|
|
authFileStatus.put("isNeedShowKycAlert", true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (PartnerRole.getRole(account.getIntValue("role")) == PartnerRole.CASHIER) {
|
|
|
|
@ -2652,20 +2690,20 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
|
|
|
|
|
complianceFilesNotice.put("auth_type", FilesAuthTypeEnum.COMPLIANCE.getAuthType());
|
|
|
|
|
complianceFilesNotice.put("type", messageSource.getMessage("client.auth.file.compliance.type", null, RequestEnvironment.getLocale()));
|
|
|
|
|
complianceFilesNotice.put("client_less_file",complianceFileStatus.getBoolean("client_less_file"));
|
|
|
|
|
if(compliance != null){
|
|
|
|
|
if (compliance.getIntValue("status")==0 || compliance.getIntValue("status")==1) {
|
|
|
|
|
complianceFilesNotice.put("client_less_file", complianceFileStatus.getBoolean("client_less_file"));
|
|
|
|
|
if (compliance != null) {
|
|
|
|
|
if (compliance.getIntValue("status") == 0 || compliance.getIntValue("status") == 1) {
|
|
|
|
|
complianceFilesNotice.put("client_less_file", false);
|
|
|
|
|
}
|
|
|
|
|
if(complianceFileStatus.getBoolean("client_less_file")){
|
|
|
|
|
complianceFilesNotice.put("client_refuse_reason",compliance.getString("description"));
|
|
|
|
|
if (complianceFileStatus.getBoolean("client_less_file")) {
|
|
|
|
|
complianceFilesNotice.put("client_refuse_reason", compliance.getString("description"));
|
|
|
|
|
}
|
|
|
|
|
complianceFilesNotice.put("status",compliance.getString("status"));
|
|
|
|
|
complianceFilesNotice.put( "status_type", FilesAuthStatusEnum.STATUS.getAuthStatus(compliance.getIntValue("status")) );
|
|
|
|
|
}else if( !complianceFileStatus.getBoolean("client_less_file")){
|
|
|
|
|
complianceFilesNotice.put( "status_type", FilesAuthStatusEnum.STATUS.getAuthStatus(1) );
|
|
|
|
|
}else{
|
|
|
|
|
complianceFilesNotice.put( "status_type", FilesAuthStatusEnum.STATUS.getAuthStatus(-1) );
|
|
|
|
|
complianceFilesNotice.put("status", compliance.getString("status"));
|
|
|
|
|
complianceFilesNotice.put("status_type", FilesAuthStatusEnum.STATUS.getAuthStatus(compliance.getIntValue("status")));
|
|
|
|
|
} else if (!complianceFileStatus.getBoolean("client_less_file")) {
|
|
|
|
|
complianceFilesNotice.put("status_type", FilesAuthStatusEnum.STATUS.getAuthStatus(1));
|
|
|
|
|
} else {
|
|
|
|
|
complianceFilesNotice.put("status_type", FilesAuthStatusEnum.STATUS.getAuthStatus(-1));
|
|
|
|
|
}
|
|
|
|
|
complianceFilesNotice.put("status_type_description", messageSource.getMessage("client.auth.file.status." + complianceFilesNotice.getString("status_type").toLowerCase(), null, RequestEnvironment.getLocale()));
|
|
|
|
|
return complianceFilesNotice;
|
|
|
|
@ -2683,15 +2721,15 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
|
|
|
|
|
kycFilesNotice.put("auth_type", FilesAuthTypeEnum.KYC.getAuthType());
|
|
|
|
|
kycFilesNotice.put("type", messageSource.getMessage("client.auth.file.kyc.type", null, RequestEnvironment.getLocale()));
|
|
|
|
|
kycFilesNotice.put("client_less_file",kycFileStatus.getBoolean("client_less_file"));
|
|
|
|
|
if(compliance != null){
|
|
|
|
|
if(kycFilesNotice.getBoolean("client_less_file")){
|
|
|
|
|
kycFilesNotice.put("client_refuse_reason",compliance.getString("description"));
|
|
|
|
|
kycFilesNotice.put("client_less_file", kycFileStatus.getBoolean("client_less_file"));
|
|
|
|
|
if (compliance != null) {
|
|
|
|
|
if (kycFilesNotice.getBoolean("client_less_file")) {
|
|
|
|
|
kycFilesNotice.put("client_refuse_reason", compliance.getString("description"));
|
|
|
|
|
}
|
|
|
|
|
kycFilesNotice.put("status",compliance.getString("status"));
|
|
|
|
|
kycFilesNotice.put( "status_type", FilesAuthStatusEnum.STATUS.getAuthStatus(compliance.getIntValue("status")) );
|
|
|
|
|
}else{
|
|
|
|
|
kycFilesNotice.put( "status_type", FilesAuthStatusEnum.STATUS.getAuthStatus(-1) );
|
|
|
|
|
kycFilesNotice.put("status", compliance.getString("status"));
|
|
|
|
|
kycFilesNotice.put("status_type", FilesAuthStatusEnum.STATUS.getAuthStatus(compliance.getIntValue("status")));
|
|
|
|
|
} else {
|
|
|
|
|
kycFilesNotice.put("status_type", FilesAuthStatusEnum.STATUS.getAuthStatus(-1));
|
|
|
|
|
}
|
|
|
|
|
kycFilesNotice.put("status_type_description", messageSource.getMessage("client.auth.file.status." + kycFilesNotice.getString("status_type").toLowerCase(), null, RequestEnvironment.getLocale()));
|
|
|
|
|
return kycFilesNotice;
|
|
|
|
@ -3103,7 +3141,7 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
int clientId = account.getIntValue("client_id");
|
|
|
|
|
JSONObject displayInfo = actPartnerReadMapper.displayInfo(actId, clientId, accountId);
|
|
|
|
|
if (displayInfo == null) {
|
|
|
|
|
displayInfo = new JSONObject(){{
|
|
|
|
|
displayInfo = new JSONObject() {{
|
|
|
|
|
put("display_client_id", UUID.randomUUID().toString());
|
|
|
|
|
put("act_id", actId);
|
|
|
|
|
put("client_id", clientId);
|
|
|
|
@ -3117,7 +3155,7 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
int accountDisplayCount = displayInfo.getIntValue("display_count");
|
|
|
|
|
if (accountDisplayCount < displayCount) {
|
|
|
|
|
displayInfo.put("last_read_time", new Date());
|
|
|
|
|
displayInfo.put("display_count", (accountDisplayCount+1));
|
|
|
|
|
displayInfo.put("display_count", (accountDisplayCount + 1));
|
|
|
|
|
actPartnerReadMapper.update(displayInfo);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|