diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java
index 44511c48a..6eb2c031a 100644
--- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java
+++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java
@@ -313,7 +313,9 @@ public interface ClientManager {
String subMerchantApplication(String clientMoniker, SubMerchantIdApply subMerchantApply,JSONObject manager);
- void registerAlipayGms(String clientMoniker,JSONObject manager);
+ void registerAlipayGms(String clientMoniker, String representative_id, JSONObject manager);
+
+ String queryAlipayGmsStatus(String clientMoniker, JSONObject manager);
List listMerchantIds(String clientMoniker,JSONObject manager);
diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java
index fd119646a..32d648e5b 100644
--- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java
+++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java
@@ -3673,7 +3673,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();
@@ -3682,6 +3682,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"))) {
@@ -3697,6 +3710,22 @@ 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") + " - status : " + responseElement.elementText("status");
+ }
+
@Override
public void subRpayMerchantApplication(String clientMoniker, JSONObject merchantInfo,JSONObject manager) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java
index 1a0b3aabd..61908f907 100644
--- a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java
+++ b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java
@@ -567,8 +567,13 @@ public class PartnerManageController {
}
@ManagerMapping(value = "/{clientMoniker}/register/alipay_gms", method = RequestMethod.POST, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN})
- public void registerAlipayGms(@PathVariable String clientMoniker,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
- clientManager.registerAlipayGms(clientMoniker,manager);
+ public void registerAlipayGms(@PathVariable String clientMoniker,@RequestBody String representative_id,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
+ clientManager.registerAlipayGms(clientMoniker, representative_id, manager);
+ }
+
+ @ManagerMapping(value = "/{clientMoniker}/query/alipay_gms", method = RequestMethod.GET, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN})
+ public String queryAlipayGmsStatus(@PathVariable String clientMoniker,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
+ return clientManager.queryAlipayGmsStatus(clientMoniker, manager);
}
@ManagerMapping(value = "/{clientMoniker}/get_merchant_ids",method = RequestMethod.GET,role = {ManagerRole.OPERATOR,ManagerRole.ADMIN})
diff --git a/src/main/ui/static/payment/partner/partner-manage.js b/src/main/ui/static/payment/partner/partner-manage.js
index 0d86a6440..6ff2ddc76 100644
--- a/src/main/ui/static/payment/partner/partner-manage.js
+++ b/src/main/ui/static/payment/partner/partner-manage.js
@@ -1500,13 +1500,35 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
title: 'Warning',
content: '是否使用该商户的现有信息进件?'
}).then(function () {
- $http.post('/sys/partners/' + $scope.partner.client_moniker + '/register/alipay_gms').then(function () {
- commonDialog.alert({title: 'Success', content: 'Alipay进件成功', type: 'success'});
- }, function (resp) {
- commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
- })
+ if ($scope.partner.business_structure == "Company"){
+ $http.post('/sys/partners/' + $scope.partner.client_moniker + '/register/alipay_gms',{representative_id:""}).then(function () {
+ commonDialog.alert({title: 'Success', content: 'Alipay进件成功', type: 'success'});
+ }, function (resp) {
+ commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
+ })
+ }else {
+ commonDialog.inputText({title: '请输入商户身份证或护照号码'}).then(function (text) {
+ $http.post('/sys/partners/' + $scope.partner.client_moniker + '/register/alipay_gms',{representative_id:text}).then(function () {
+ commonDialog.alert({title: 'Success', content: 'Alipay进件成功', type: 'success'});
+ }, function (resp) {
+ commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
+ })
+ });
+ }
})
};
+ $scope.queryAlipayGms = function () {
+ commonDialog.confirm({
+ title: 'Warning',
+ content: '是否查询该商户报备状态?'
+ }).then(function () {
+ $http.get('/sys/partners/' + $scope.partner.client_moniker + '/query/alipay_gms').then(function (resp) {
+ commonDialog.alert({title: 'Success', content: resp.data, type: 'success'});
+ }, function (resp) {
+ commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
+ })
+ })
+ }
$scope.refreshCredential = function () {
commonDialog.confirm({
title: 'Warning',
diff --git a/src/main/ui/static/payment/partner/templates/partner_payment_info.html b/src/main/ui/static/payment/partner/templates/partner_payment_info.html
index d7edcf5da..6eb4ce61e 100644
--- a/src/main/ui/static/payment/partner/templates/partner_payment_info.html
+++ b/src/main/ui/static/payment/partner/templates/partner_payment_info.html
@@ -72,6 +72,7 @@
{{paymentInfo.ali_sub_merchant_id||'Not Configure'}}
+