parent
43b305f47a
commit
d329806652
@ -0,0 +1,68 @@
|
||||
package au.com.royalpay.payment.manage.merchants.core.impls;
|
||||
|
||||
import au.com.royalpay.payment.manage.mappers.system.ClientConfigMapper;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @Description
|
||||
* @title:
|
||||
* @Date 2021/1/28 11:15
|
||||
* @author: zhangTao
|
||||
*/
|
||||
@Component
|
||||
public class AlipayChannelsConfig {
|
||||
|
||||
@Resource
|
||||
private ClientConfigMapper clientConfigMapper;
|
||||
|
||||
|
||||
public boolean isMandatoryAlipayOnline(int clientId) {
|
||||
Optional<JSONObject> optionalClientConfigInfo = getClientConfig(clientId);
|
||||
if (optionalClientConfigInfo.isPresent()){
|
||||
JSONObject clientConfigInfo = optionalClientConfigInfo.get();
|
||||
if (clientConfigInfo.getBooleanValue("mandatory_alipay_online")){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void modifyMandatoryAlipayOnline(int clientId ,boolean mandatoryAlipayOnlineStatus){
|
||||
JSONObject mandatoryAlipayOnlineConfig = new JSONObject();
|
||||
mandatoryAlipayOnlineConfig.put("client_id",clientId);
|
||||
mandatoryAlipayOnlineConfig.put("mandatory_alipay_online",mandatoryAlipayOnlineStatus);
|
||||
clientConfigMapper.update(mandatoryAlipayOnlineConfig);
|
||||
}
|
||||
|
||||
|
||||
public boolean isAlipayPlus(int clientId) {
|
||||
Optional<JSONObject> optionalClientConfigInfo = getClientConfig(clientId);
|
||||
if (optionalClientConfigInfo.isPresent()){
|
||||
JSONObject clientConfigInfo = optionalClientConfigInfo.get();
|
||||
if (clientConfigInfo.getBooleanValue("alipay_payment_channels")){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void modifyAlipayPaymentChannels(int clientId ,boolean alipayPaymentChannelsStatus){
|
||||
JSONObject mandatoryAlipayOnlineConfig = new JSONObject();
|
||||
mandatoryAlipayOnlineConfig.put("client_id",clientId);
|
||||
mandatoryAlipayOnlineConfig.put("alipay_payment_channels",alipayPaymentChannelsStatus);
|
||||
clientConfigMapper.update(mandatoryAlipayOnlineConfig);
|
||||
}
|
||||
|
||||
|
||||
private Optional<JSONObject> getClientConfig(int clientId) {
|
||||
Optional<JSONObject> optionalClientConfigInfo = Optional.of(clientConfigMapper.find(clientId));
|
||||
return optionalClientConfigInfo;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package au.com.royalpay.payment.manage.merchants.web;
|
||||
|
||||
|
||||
import au.com.royalpay.payment.manage.merchants.core.impls.AlipayChannelsConfig;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @Description
|
||||
* @title:
|
||||
* @Date 2021/2/1 9:42
|
||||
* @author: zhangTao
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sys/partners")
|
||||
public class AlipayConfigController {
|
||||
|
||||
@Resource
|
||||
AlipayChannelsConfig alipayChannelsConfig;
|
||||
|
||||
@RequestMapping(method = RequestMethod.PUT,value = "/modifyAlipayPaymentChannels/{clientId}/{alipayPaymentChannelsStatus}")
|
||||
public void modifyAlipayPaymentChannels(@PathVariable Integer clientId, @PathVariable Boolean alipayPaymentChannelsStatus) {
|
||||
alipayChannelsConfig.modifyAlipayPaymentChannels(clientId,alipayPaymentChannelsStatus);
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in new issue