upgrade complete shopify OAuth

master
ycfxx 3 years ago
parent 3790c18615
commit e2bf0889c0

@ -396,7 +396,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
} }
@Override @Override
@Cacheable(value = ":app_client_info_moniker:", key = "#clientMoniker") @Cacheable(value = ":app_client_info_moniker:", key = "#clientMoniker",unless="#result == null")
public JSONObject getClientInfoByMoniker(String clientMoniker) { public JSONObject getClientInfoByMoniker(String clientMoniker) {
return clientMapper.findClientByMonikerAll(clientMoniker); return clientMapper.findClientByMonikerAll(clientMoniker);
} }

@ -30,13 +30,13 @@ public class ShopifyStoreApplication {
private ShopifyMerchantAuthApplication shopifyMerchantAuthApplication; private ShopifyMerchantAuthApplication shopifyMerchantAuthApplication;
/** /**
* loginId * partnerCode
* *
* @param loginId * @param partnerCode
* @return * @return
*/ */
public Boolean existMerchant(String loginId) { public Boolean existMerchant(String partnerCode) {
return merchantservice.existMerchant(loginId); return merchantservice.existMerchant(partnerCode);
} }
/** /**

@ -3,6 +3,7 @@ package au.com.royalpay.payment.manage.shopify.store.domain.service;
import au.com.royalpay.payment.manage.management.sysconfig.core.impls.PermissionPartnerManagerImpl; import au.com.royalpay.payment.manage.management.sysconfig.core.impls.PermissionPartnerManagerImpl;
import au.com.royalpay.payment.manage.mappers.shopify.MerchantMapper; import au.com.royalpay.payment.manage.mappers.shopify.MerchantMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper; import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.shopify.store.domain.context.MerchantCreateContext; import au.com.royalpay.payment.manage.shopify.store.domain.context.MerchantCreateContext;
import au.com.royalpay.payment.manage.shopify.store.domain.entity.MerchantRequest; import au.com.royalpay.payment.manage.shopify.store.domain.entity.MerchantRequest;
import au.com.royalpay.payment.manage.shopify.store.domain.entity.SimpleMerchant; import au.com.royalpay.payment.manage.shopify.store.domain.entity.SimpleMerchant;
@ -25,9 +26,12 @@ public class MerchantService {
@Autowired @Autowired
private PermissionPartnerManagerImpl permissionPartnerManager; private PermissionPartnerManagerImpl permissionPartnerManager;
public Boolean existMerchant(String loginId) { @Autowired
JSONObject account = clientAccountMapper.findByUsername(loginId); private ClientManager clientManager;
if (account == null) {
public Boolean existMerchant(String partnerCode) {
JSONObject clientInfo = clientManager.getClientInfoByMoniker(partnerCode);
if (clientInfo == null) {
return false; return false;
} }
return true; return true;

@ -21,11 +21,11 @@ public class ShopifyStoreController {
/** /**
* loginId * loginId
* *
* @param loginId * @param partnerCode
*/ */
@GetMapping("/exist") @GetMapping("/exist")
public Boolean validPaymentAppMerchant(@RequestParam("loginId") String loginId) { public Boolean validPaymentAppMerchant(@RequestParam("partnerCode") String partnerCode) {
return shopifyStoreApplication.existMerchant(loginId); return shopifyStoreApplication.existMerchant(partnerCode);
} }
/** /**

@ -32,16 +32,16 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
module.controller('ShopifyAuthController', ['$scope', '$http', '$state', function ($scope, $http, $state) { module.controller('ShopifyAuthController', ['$scope', '$http', '$state', function ($scope, $http, $state) {
var that = $scope; var that = $scope;
that.store = { that.store = {
loginId: '' partnerCode: ''
} }
that.authDisable = false that.authDisable = false
that.validStoreLoginId = function () { that.validStoreLoginId = function () {
that.authDisable = true that.authDisable = true
$http.get("/shopify/store/exist", {params: that.store}).then(function (res) { $http.get("/shopify/store/exist", {params: that.store}).then(function (res) {
if (res.data) { if (res.data) {
$state.go('shopify.login', {userId: that.store.loginId}); $state.go('shopify.login', {partnerCode: that.store.partnerCode});
} else { } else {
$state.go('shopify.register', {userId: that.store.loginId}); $state.go('shopify.register', {partnerCode: that.store.partnerCode});
} }
},function (error) { },function (error) {
that.resError = error.data.message; that.resError = error.data.message;
@ -54,7 +54,8 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
var that = $scope; var that = $scope;
that.model = { that.model = {
shop: '', shop: '',
loginId: $stateParams.userId, partnerCode: $stateParams.partnerCode,
loginId: '',
password: '' password: ''
} }
that.loginDisable = false that.loginDisable = false
@ -182,7 +183,7 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
that.states = angular.copy(stateMap); that.states = angular.copy(stateMap);
that.industries = angular.copy(industryMap); that.industries = angular.copy(industryMap);
that.partner = { that.partner = {
loginId: $stateParams.userId partnerCode: $stateParams.partnerCode
}; };
that.registerDisable = false that.registerDisable = false
that.saveForm = function (form) { that.saveForm = function (form) {

@ -30,7 +30,7 @@
<div class="m-t-40"></div> <div class="m-t-40"></div>
<form> <form>
<div class="form-group form-group-lg"> <div class="form-group form-group-lg">
<input class="form-control input-lg" id="exampleInputEmail" placeholder="Login ID" ng-model="store.loginId"> <input class="form-control input-lg" id="exampleInputEmail" placeholder="Partner Code" ng-model="store.partnerCode">
</div> </div>
<button class="btn btn-warning btn-lg btn-block" ng-disabled="authDisable" ng-click="validStoreLoginId()">Next</button> <button class="btn btn-warning btn-lg btn-block" ng-disabled="authDisable" ng-click="validStoreLoginId()">Next</button>
</form> </form>

Loading…
Cancel
Save