|
|
|
@ -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;
|
|
|
|
@ -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"));
|
|
|
|
|
}
|
|
|
|
|