|
|
|
@ -3726,6 +3726,58 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
return responseElement.elementText("secondary_merchant_id") + " - status : " + 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") + " - status : " + responseElement.elementText("status");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void subRpayMerchantApplication(String clientMoniker, JSONObject merchantInfo,JSONObject manager) {
|
|
|
|
|
JSONObject client = getClientInfoByMoniker(clientMoniker);
|
|
|
|
|