|
|
|
@ -3789,7 +3789,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void registerAlipayGms(String clientMoniker, JSONObject manager) {
|
|
|
|
|
public void registerAlipayGms(String clientMoniker, String representative_id, JSONObject manager) {
|
|
|
|
|
JSONObject client = getClientInfoByMoniker(clientMoniker);
|
|
|
|
|
if (client == null) {
|
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
@ -3798,6 +3798,19 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
if (!client.containsKey("store_photo") || !client.containsKey("company_photo")) {
|
|
|
|
|
throw new InvalidParameterException("store photo cannot be empty ");
|
|
|
|
|
}
|
|
|
|
|
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!");
|
|
|
|
|
}
|
|
|
|
|
client.put("bank_id", client_bank.getString("account_no"));
|
|
|
|
|
|
|
|
|
|
if (!"Company".equals(client.getString("business_structure"))) {
|
|
|
|
|
if (representative_id == null || representative_id.isEmpty()) {
|
|
|
|
|
throw new BadRequestException("ID or passport number can't be null");
|
|
|
|
|
}
|
|
|
|
|
client.put("representative_id", representative_id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AlipayConfig.AlipayMerchant mch = AlipayEnvironment.getEnv().getAlipayRetailMerchant();
|
|
|
|
|
Element resultElement = alipayClient.registerGmsPortal(mch.getPid(), client);
|
|
|
|
|
if (!StringUtils.equalsIgnoreCase("T", resultElement.elementText("is_success"))) {
|
|
|
|
@ -3813,6 +3826,74 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String queryAlipayGmsStatus(String clientMoniker, JSONObject manager) {
|
|
|
|
|
JSONObject client = getClientInfoByMoniker(clientMoniker);
|
|
|
|
|
if (client == null) {
|
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
|
}
|
|
|
|
|
checkOrgPermission(manager, client);
|
|
|
|
|
AlipayConfig.AlipayMerchant mch = AlipayEnvironment.getEnv().getAlipayRetailMerchant();
|
|
|
|
|
Element resultElement = alipayClient.queryGmsPortalStatus(mch.getPid(), client);
|
|
|
|
|
if (!StringUtils.equalsIgnoreCase("T", resultElement.elementText("is_success"))) {
|
|
|
|
|
return "查询成功:" + resultElement.elementText("error");
|
|
|
|
|
}
|
|
|
|
|
Element responseElement = resultElement.element("response").element("alipay");
|
|
|
|
|
return "查询成功:" + responseElement.elementText("secondary_merchant_id") + "报备状态 : " + responseElement.elementText("status");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void registerAlipayOnlineGms(String clientMoniker, String representative_id, JSONObject manager) {
|
|
|
|
|
JSONObject client = getClientInfoByMoniker(clientMoniker);
|
|
|
|
|
if (client == null) {
|
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
|
}
|
|
|
|
|
checkOrgPermission(manager, client);
|
|
|
|
|
if (!client.containsKey("company_website")) {
|
|
|
|
|
throw new InvalidParameterException("Website cannot be empty ");
|
|
|
|
|
}
|
|
|
|
|
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!");
|
|
|
|
|
}
|
|
|
|
|
client.put("bank_id", client_bank.getString("account_no"));
|
|
|
|
|
|
|
|
|
|
if (representative_id == null || representative_id.isEmpty()) {
|
|
|
|
|
throw new BadRequestException("ID or passport number can't be null");
|
|
|
|
|
}
|
|
|
|
|
client.put("representative_id", representative_id);
|
|
|
|
|
|
|
|
|
|
AlipayConfig.AlipayMerchant mch = AlipayEnvironment.getEnv().getAlipayOnlineMerchant();
|
|
|
|
|
Element resultElement = alipayClient.registerOnlineGmsPortal(mch.getPid(), client);
|
|
|
|
|
if (!StringUtils.equalsIgnoreCase("T", resultElement.elementText("is_success"))) {
|
|
|
|
|
throw new BadRequestException(resultElement.elementText("error"));
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
Element responseElement = resultElement.element("response").element("alipay");
|
|
|
|
|
if (!StringUtils.equalsIgnoreCase("SUCCESS", responseElement.elementText("result_code"))) {
|
|
|
|
|
throw new BadRequestException(responseElement.elementText("result_code"));
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw new ServerErrorException(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String queryAlipayOnlineGmsStatus(String clientMoniker, JSONObject manager) {
|
|
|
|
|
JSONObject client = getClientInfoByMoniker(clientMoniker);
|
|
|
|
|
if (client == null) {
|
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
|
}
|
|
|
|
|
checkOrgPermission(manager, client);
|
|
|
|
|
AlipayConfig.AlipayMerchant mch = AlipayEnvironment.getEnv().getAlipayOnlineMerchant();
|
|
|
|
|
Element resultElement = alipayClient.queryOnlineGmsPortalStatus(mch.getPid(), client);
|
|
|
|
|
if (!StringUtils.equalsIgnoreCase("T", resultElement.elementText("is_success"))) {
|
|
|
|
|
return "查询成功:" + resultElement.elementText("error");
|
|
|
|
|
}
|
|
|
|
|
Element responseElement = resultElement.element("response").element("alipay");
|
|
|
|
|
return "查询成功:" + responseElement.elementText("secondary_merchant_id") + "报备状态 : " + responseElement.elementText("status");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void subRpayMerchantApplication(String clientMoniker, JSONObject merchantInfo,JSONObject manager) {
|
|
|
|
|
JSONObject client = getClientInfoByMoniker(clientMoniker);
|
|
|
|
|