yeepay 手动添加子商户号

master
james.zhao 6 years ago
parent 58c85c9db1
commit 4c9079a2ff

@ -371,6 +371,8 @@ public interface ClientManager {
void subYeepayMerchantApplication(String clientMoniker,JSONObject merchantInfo, JSONObject manager); void subYeepayMerchantApplication(String clientMoniker,JSONObject merchantInfo, JSONObject manager);
void subYeepayMerchantAdd(String clientMoniker,JSONObject merchantInfo, JSONObject manager);
void reSubYeepayMerchantApplication(String clientMoniker,JSONObject merchantInfo, JSONObject manager); void reSubYeepayMerchantApplication(String clientMoniker,JSONObject merchantInfo, JSONObject manager);
void updateAllPartnerPassword(String clientMoniker); void updateAllPartnerPassword(String clientMoniker);

@ -10,6 +10,7 @@ import au.com.royalpay.payment.channels.wechat.config.WechatPayEnvironment;
import au.com.royalpay.payment.channels.wechat.runtime.MpPaymentApi; import au.com.royalpay.payment.channels.wechat.runtime.MpPaymentApi;
import au.com.royalpay.payment.channels.wechat.runtime.WxPayClient; import au.com.royalpay.payment.channels.wechat.runtime.WxPayClient;
import au.com.royalpay.payment.channels.wechat.runtime.beans.SubMerchantInfo; import au.com.royalpay.payment.channels.wechat.runtime.beans.SubMerchantInfo;
import au.com.royalpay.payment.channels.yeepay.config.YeePayConfig;
import au.com.royalpay.payment.channels.yeepay.mappers.YeePayClientConfigMapper; import au.com.royalpay.payment.channels.yeepay.mappers.YeePayClientConfigMapper;
import au.com.royalpay.payment.channels.yeepay.runtime.YeePayClient; import au.com.royalpay.payment.channels.yeepay.runtime.YeePayClient;
import au.com.royalpay.payment.core.PaymentChannelApi; import au.com.royalpay.payment.core.PaymentChannelApi;
@ -218,6 +219,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Resource @Resource
private YeePayClient yeePayClient; private YeePayClient yeePayClient;
@Resource
private YeePayConfig yeePayConfig;
@Resource @Resource
private YeePayClientConfigMapper yeePayClientConfigMapper; private YeePayClientConfigMapper yeePayClientConfigMapper;
@ -805,7 +809,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
} }
JSONObject yeepayConfigValid =yeePayClientConfigMapper.findMerchantConfig(client.getIntValue("client_id")); JSONObject yeepayConfigValid =yeePayClientConfigMapper.findMerchantConfig(client.getIntValue("client_id"));
yeePayClientConfigMapper.updateSubMerchantIdValid(yeepayConfigValid.getString("yeepay_config_id"),0); yeePayClientConfigMapper.updateSubMerchantIdValid(yeepayConfigValid.getString("yeepay_config_id"),0);
JSONObject yeepayConfig = yeePayClientConfigMapper.findMerchantConfigBySub(yeepaySubMerchantInfo.getString("yeepay_sub_merchant_id")); JSONObject yeepayConfig = yeePayClientConfigMapper.findMerchantConfigBySub(client.getIntValue("client_id"),yeepaySubMerchantInfo.getString("yeepay_sub_merchant_id"));
yeePayClientConfigMapper.updateSubMerchantIdValid(yeepayConfig.getString("yeepay_config_id"),1); yeePayClientConfigMapper.updateSubMerchantIdValid(yeepayConfig.getString("yeepay_config_id"),1);
client.put("yeepay_sub_merchant_id",yeepaySubMerchantInfo.getString("yeepay_sub_merchant_id")); client.put("yeepay_sub_merchant_id",yeepaySubMerchantInfo.getString("yeepay_sub_merchant_id"));
clientMapper.update(client); clientMapper.update(client);
@ -3893,6 +3897,35 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
clientMapper.update(client); clientMapper.update(client);
} }
@Override
public void subYeepayMerchantAdd(String clientMoniker, JSONObject merchantInfo, JSONObject manager) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
checkOrgPermission(manager, client);
JSONObject config = yeePayClientConfigMapper.findMerchantConfigBySub(client.getIntValue("client_id"),merchantInfo.getString("sub_merchant_id"));
if(config != null){
throw new BadRequestException("You had add the sub merchant id");
}
List<JSONObject> yeepayClientConfigs = yeePayClientConfigMapper.findAllMerchantConfig(client.getIntValue("client_id"));
if(yeepayClientConfigs!=null){
for(JSONObject yeepayClientConfig:yeepayClientConfigs){
if(yeepayClientConfig.getIntValue("is_valid")==1){
yeePayClientConfigMapper.updateSubMerchantIdValid(yeepayClientConfig.getString("yeepay_config_id"),0);
}
}
}
merchantInfo.put("client_id",client.getIntValue("client_id"));
merchantInfo.put("merchant_id",yeePayConfig.getAppKey().split("_")[1]);
merchantInfo.put("create_time",new Date());
merchantInfo.put("is_valid",1);
merchantInfo.put("operator",manager.getString("display_name"));
yeePayClientConfigMapper.saveMerchantConfig(merchantInfo);
client.put("yeepay_sub_merchant_id",merchantInfo.getString("sub_merchant_id"));
clientMapper.update(client);
}
@Override @Override
public void reSubYeepayMerchantApplication(String clientMoniker, JSONObject merchantInfo, JSONObject manager) { public void reSubYeepayMerchantApplication(String clientMoniker, JSONObject merchantInfo, JSONObject manager) {
JSONObject client = getClientInfoByMoniker(clientMoniker); JSONObject client = getClientInfoByMoniker(clientMoniker);
@ -3900,7 +3933,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new InvalidShortIdException(); throw new InvalidShortIdException();
} }
checkOrgPermission(manager, client); checkOrgPermission(manager, client);
JSONObject yeepayConfig = yeePayClientConfigMapper.findMerchantConfigBySub(merchantInfo.getString("subMerchantId")); JSONObject yeepayConfig = yeePayClientConfigMapper.findMerchantConfigBySub(client.getIntValue("client_id"),merchantInfo.getString("subMerchantId"));
List<JSONObject> directorsAll = new ArrayList<>(); List<JSONObject> directorsAll = new ArrayList<>();
List<JSONObject> executivesAll = new ArrayList<>(); List<JSONObject> executivesAll = new ArrayList<>();
directorsAll.add(merchantInfo.getJSONObject("directors")); directorsAll.add(merchantInfo.getJSONObject("directors"));

@ -681,6 +681,11 @@ public class PartnerManageController {
return clientManager.cbBankPayLink(clientMoniker); return clientManager.cbBankPayLink(clientMoniker);
} }
@ManagerMapping(value = "/{clientMoniker}/addYeepaySubMerchantId", method = RequestMethod.POST, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN})
public void subYeepayMerchantAdd(@PathVariable String clientMoniker,@RequestBody JSONObject merchantInfo,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.subYeepayMerchantAdd(clientMoniker, merchantInfo,manager);
}
@RequestMapping(value = "/{clientMoniker}/cb_bankpay/link/pc", method = RequestMethod.GET) @RequestMapping(value = "/{clientMoniker}/cb_bankpay/link/pc", method = RequestMethod.GET)
public void switchPaymentWayPC(@PathVariable String clientMoniker, HttpServletResponse response) throws IOException { public void switchPaymentWayPC(@PathVariable String clientMoniker, HttpServletResponse response) throws IOException {
clientManager.switchPaymentConfigPC(clientMoniker, response); clientManager.switchPaymentConfigPC(clientMoniker, response);

@ -2,7 +2,4 @@ app.lakala_pay.host=https://intl.lakala.com:7777
app.lakala_pay.publicKey=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDPg0O4rPQJL1O+jqJ4rBjFVNRAuDmBSoii9pYfPQBaescCVY0irkWWoLyfTT65TjvnPpOx+IfNzBTlB13qCEFm7algREoeUHjFgFNHiXJ2LK/R0+VWgXe5+EDFfbrFCPnmLKG3OcKDGQszP0VOf6VVTM1t56CpgaRMm1/+Tzd2TQIDAQAB app.lakala_pay.publicKey=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDPg0O4rPQJL1O+jqJ4rBjFVNRAuDmBSoii9pYfPQBaescCVY0irkWWoLyfTT65TjvnPpOx+IfNzBTlB13qCEFm7algREoeUHjFgFNHiXJ2LK/R0+VWgXe5+EDFfbrFCPnmLKG3OcKDGQszP0VOf6VVTM1t56CpgaRMm1/+Tzd2TQIDAQAB
app.lakala_pay.merchants.COPAUS000003.accountId=COPAUS000003 app.lakala_pay.merchants.COPAUS000003.accountId=COPAUS000003
app.lakala_pay.merchants.COPAUS000003.currency=AUD app.lakala_pay.merchants.COPAUS000003.currency=AUD
app.lakala_pay.merchants.COPAUS000003.privateKey=c:\\Software\\lakala\\COPAUS000003.key app.lakala_pay.merchants.COPAUS000003.privateKey=MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBAIDjX164cAJrlsikv2aCtGendMxOi97lCU/7sLp5qpMGIIYjpN71LpYR2SBm2vzQNGP0UE6kFtOUfsPLf8CZxPHXVd2Qnz3YC+2uUGkWmafEWVkw1LnDenI9SD5vvGZYeEH5H7Ct6yYv5/JTSevRgCVllWqcPXDs8spQmbcr8/oVAgMBAAECgYAF9v/d6Vk9s276AC3fd6MTvPs5zVTJzv28VuCZ8LGFNl5g9ttVejFavp620ivGUXhrO85PpWZtCk1HkG5sInGr0pVnBb8dtsfyEzTHnguv7mNSQ6tYEsINcyYbhOnPMsECaNrdwCC7q0i82MQGTHss50F0mjxRCVz4ndiBseRXYQJBANJ9lTuyuKUmUdxsQNLy+ajFSWvVcC0IRLBT2E1EqgPBRJuTc2wlULJVAKz/+eSEjDsmJ0yD9fnISjdY1csyS20CQQCcwTBZIejjwP011sB2A91z2DSnveU4vvgFWnj0hhM4a/ChuUKoylMVYlDQ1vrqErFag96keU9BUwQ1LlmfC1hJAkANDKoW1GKsIm8Kyk9OhK/Drc96dvYIZK3VfK05RRuBNhcpyf9q4flZxPlQwGHer/T9qcTf8oJqZOds/P3sJgcVAkB/C6Sf2Pfj/3o5tH/wJlnJliW2/hVV1JE35Ye6xx+0zucMbBY2ryR/ZFuTp2ldZSEQ92fvbdJqY1o5sAM6//rhAkAMhwWEtGZ8tboADbWBnxD/maMGYlI/oGsQHWTT9/Jt2LmlR+dgpl1DVwizPbVJ0hVJZWkF/BC5bdZ9XEIZsv/K
app.lakala_pay.merchants.COPAUS000004.accountId=COPAUS000004
app.lakala_pay.merchants.COPAUS000004.currency=CNY
app.lakala_pay.merchants.COPAUS000004.privateKey=c:\\Software\\lakala\\COPAUS000004.key

@ -3638,6 +3638,19 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
$scope.loadSubMerchantInfos(); $scope.loadSubMerchantInfos();
}) })
}; };
$scope.addYeepaySubMerchantId = function () {
$uibModal.open({
templateUrl: '/static/payment/partner/templates/add_yeepay_sub_merchant_id.html',
controller: 'addYeepaySubMerchantIdCtrl',
resolve: {
subMerchantInfo: function () {
return $scope.partner;
}
}
}).result.then(function () {
$scope.loadSubMerchantInfos();
})
};
$scope.updateYeepaySubMerchantId = function (sub_merchant_id) { $scope.updateYeepaySubMerchantId = function (sub_merchant_id) {
$uibModal.open({ $uibModal.open({
templateUrl: '/static/payment/partner/templates/update_yeepay_sub_merchant_id.html', templateUrl: '/static/payment/partner/templates/update_yeepay_sub_merchant_id.html',
@ -4068,6 +4081,54 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
} }
}]); }]);
app.controller('addYeepaySubMerchantIdCtrl', ['$scope', '$http', '$uibModal', '$state','subMerchantInfo','yeepayIndustryMap','yeepayBusinessContentMap','$filter', 'commonDialog','Upload', function ($scope, $http, $uibModal, $state,subMerchantInfo,yeepayIndustryMap,yeepayBusinessContentMap,$filter, commonDialog,Upload) {
$scope.yeepay_industries = yeepayIndustryMap.configs();
$scope.yeepay_business_contents = yeepayBusinessContentMap.configs();
$scope.subMerchantInfo = angular.copy(subMerchantInfo);
var merchantInfo = {};
$scope.saveYeepayAdd = function (form) {
$scope.errmsg = null;
if (form.$invalid) {
angular.forEach(form, function (item, key) {
if (key.indexOf('$') < 0) {
item.$dirty = true;
}
});
return;
}
// angular.forEach(form, function (item, key) {
// if(item !=null) {
// if(item.$name !=null) {
// merchantInfo[key] = item.$modelValue;
// }
// }
// });
merchantInfo['sub_merchant_id'] = $scope.sub_merchant_id;
merchantInfo['business_content'] = $scope.business_content;
merchantInfo['industry'] = $scope.industry;
$http.post('/sys/partners/' + $scope.subMerchantInfo.client_moniker + '/addYeepaySubMerchantId', merchantInfo).then(function (resp) {
$scope.$close();
commonDialog.alert({
title: 'Success',
content: 'Add Yeepay Sub Merchant ID successfully',
type: 'success'
});
$state.reload();
}, function (resp) {
commonDialog.alert({
title: 'Error',
content: resp.data.message,
type: 'error'
});
})
}
}]);
app.controller('updateYeepaySubMerchantIdCtrl', ['$scope', '$http', '$uibModal', '$state','subMerchantInfo','yeepayIndustryMap','yeepayBusinessContentMap','$filter', 'commonDialog','Upload','subMerchantId', function ($scope, $http, $uibModal, $state,subMerchantInfo,yeepayIndustryMap,yeepayBusinessContentMap,$filter, commonDialog,Upload,subMerchantId) { app.controller('updateYeepaySubMerchantIdCtrl', ['$scope', '$http', '$uibModal', '$state','subMerchantInfo','yeepayIndustryMap','yeepayBusinessContentMap','$filter', 'commonDialog','Upload','subMerchantId', function ($scope, $http, $uibModal, $state,subMerchantInfo,yeepayIndustryMap,yeepayBusinessContentMap,$filter, commonDialog,Upload,subMerchantId) {
$scope.yeepay_industries = yeepayIndustryMap.configs(); $scope.yeepay_industries = yeepayIndustryMap.configs();
$scope.yeepay_business_contents = yeepayBusinessContentMap.configs(); $scope.yeepay_business_contents = yeepayBusinessContentMap.configs();

@ -0,0 +1,65 @@
<div class="content">
<form novalidate name="subForm">
<div class="row">
<div class="col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">Add Yeepay Sub Merchant Id</div>
<div class="panel-body">
<div class="form-horizontal">
<div class="form-group"
ng-class="{'has-error':subForm.business_content.$invalid && subForm.business_content.$dirty}">
<label class="control-label col-sm-3" for="business_content">* Business Content</label>
<div class="col-sm-8">
<select class="form-control" name="business_content"
ng-model="business_content"
id="business_content" required
ng-options="business_content.value as business_content.label for business_content in yeepay_business_contents">
<option value="">Please Choose</option>
</select>
<div ng-messages="subForm.business_content.$error" ng-if="subForm.business_content.$dirty">
<p class="small text-danger" ng-message="required">Required Field</p>
</div>
</div>
</div>
<div class="form-group"
ng-class="{'has-error':subForm.industry.$invalid && subForm.industry.$dirty}">
<label class="control-label col-sm-3" for="industry">* Business Category</label>
<div class="col-sm-8">
<select class="form-control" name="industry"
ng-model="industry"
id="industry" required
ng-options="industry.value as industry.label for industry in yeepay_industries">
<option value="">Please Choose</option>
</select>
<div ng-messages="subForm.industry.$error" ng-if="subForm.industry.$dirty">
<p class="small text-danger" ng-message="required">Required Field</p>
</div>
</div>
</div>
<div class="form-group"
ng-class="{'has-error':subForm.sub_merchant_id.$invalid && subForm.sub_merchant_id.$dirty}">
<label class="control-label col-sm-3" for="sub_merchant_id_input">* Yeepay Sub Merchant ID</label>
<div class="col-sm-8">
<input class="form-control" ng-model="sub_merchant_id"
type="text" name="sub_merchant_id" id="sub_merchant_id_input" required maxlength="50">
<div ng-messages="subForm.sub_merchant_id.$error" ng-if="subForm.sub_merchant_id.$dirty">
<p class="small text-danger" ng-message="required">Required Field</p>
<p class="small text-danger" ng-message="maxlength">More Than 50</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="btn-group margin-bottom margin-top">
<button class="btn btn-success" type="button"
ng-click="saveYeepayAdd(subForm)">Submit
</button>
</div>
</div>
</div>
</form>
</div>

@ -164,6 +164,11 @@
<i class="fa fa-plus"></i> <i class="fa fa-plus"></i>
Apply Sub Merchant Id Apply Sub Merchant Id
</button> </button>
<button role="button" class="btn btn-success pull-right" title="Add Sub Merchant Id"
ng-click="addYeepaySubMerchantId()">
<i class="fa fa-plus"></i>
Add Sub Merchant Id
</button>
</div> </div>
</div> </div>
<div class="box"> <div class="box">

Loading…
Cancel
Save